add live select pannel
This commit is contained in:
@@ -0,0 +1,87 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class CanvasControl : MonoBehaviour
|
||||
{
|
||||
private Canvas canvas;
|
||||
|
||||
private CanvasScaler canvasScaler;
|
||||
|
||||
private Vector2 resolution;
|
||||
|
||||
private GameObject Panel;
|
||||
|
||||
private GameObject VerticalMenu;
|
||||
private GameObject HorizontalMenu;
|
||||
|
||||
/// <summary>
|
||||
/// View系のprefabを表示するGameObject
|
||||
/// </summary>
|
||||
private GameObject ViewSetter;
|
||||
|
||||
public bool isVertical
|
||||
{
|
||||
get
|
||||
{
|
||||
if(resolution.y > 0 && resolution.x > 0)
|
||||
{
|
||||
//縦長である場合(同じサイズの場合は横長扱い)
|
||||
if(resolution.y > resolution.x)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
canvas = GetComponent<Canvas>();
|
||||
canvasScaler = GetComponent<CanvasScaler>();
|
||||
resolution.x = Screen.width;
|
||||
resolution.y = Screen.height;
|
||||
|
||||
Panel = GameObject.Find("Canvas/Panel");
|
||||
|
||||
VerticalMenu = GameObject.Find("Panel/VerticalMenu");
|
||||
HorizontalMenu = GameObject.Find("Panel/HorizontalMenu");
|
||||
|
||||
if (isVertical)
|
||||
{
|
||||
//縦表示
|
||||
|
||||
canvasScaler.referenceResolution = new Vector2(800f, 0f);
|
||||
canvasScaler.matchWidthOrHeight = 0f; //横にフィット
|
||||
VerticalMenu.SetActive(true);
|
||||
HorizontalMenu.SetActive(false);
|
||||
|
||||
var _transform = Panel.transform;
|
||||
_transform.localPosition = new Vector3(0f, 0f, 0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
//横表示
|
||||
|
||||
canvasScaler.referenceResolution = new Vector2(0f, 750f);
|
||||
canvasScaler.matchWidthOrHeight = 1f; //縦にフィット
|
||||
VerticalMenu.SetActive(false);
|
||||
HorizontalMenu.SetActive(true);
|
||||
|
||||
var _transform = Panel.transform;
|
||||
_transform.localPosition = new Vector3(-90f, 0f, 0f);
|
||||
}
|
||||
}
|
||||
|
||||
// Use this for initialization
|
||||
void Start()
|
||||
{
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 287af1a07b722ba4c805689b355936df
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,71 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class FPSCounter : MonoBehaviour
|
||||
{
|
||||
[SerializeField]
|
||||
private float m_updateInterval = 0.4f;
|
||||
|
||||
private GameObject gText = null;
|
||||
|
||||
private Text text = null;
|
||||
|
||||
private float m_accum;
|
||||
|
||||
private int m_frames;
|
||||
|
||||
private float m_timeleft;
|
||||
|
||||
private float m_fps;
|
||||
|
||||
private bool isFPSdraw;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
gText = transform.Find("FPSText").gameObject;
|
||||
text = gText.GetComponent<Text>();
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
gText.SetActive(false);
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (gText != null && text != null)
|
||||
{
|
||||
m_timeleft -= Time.deltaTime;
|
||||
|
||||
m_accum += Time.timeScale / Time.deltaTime;
|
||||
m_frames++;
|
||||
|
||||
if (0 < m_timeleft) return;
|
||||
|
||||
m_fps = m_accum / m_frames;
|
||||
text.text = "FPS: " + m_fps.ToString("f2");
|
||||
|
||||
//初期化
|
||||
m_timeleft = m_updateInterval;
|
||||
m_accum = 0;
|
||||
m_frames = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void OnEnable()
|
||||
{
|
||||
m_timeleft = m_updateInterval;
|
||||
m_accum = 0;
|
||||
m_frames = 0;
|
||||
}
|
||||
|
||||
public void ChangeVisible()
|
||||
{
|
||||
if (gText != null)
|
||||
{
|
||||
//ひっくり返す
|
||||
gText.SetActive(!gText.activeSelf);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: af9fb7c4135fc4040a9d29481ca13fca
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,134 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
/// <summary>
|
||||
/// デレステ仕様のラジオボタン
|
||||
/// </summary>
|
||||
public class RadioButton : MonoBehaviour
|
||||
{
|
||||
/// <summary>
|
||||
/// 破棄時に毎回保存をするか
|
||||
/// </summary>
|
||||
public bool autoSave = true;
|
||||
|
||||
public int select = -1;
|
||||
|
||||
/// <summary>
|
||||
/// セーブがない時のデフォルト値を指定する
|
||||
/// </summary>
|
||||
public int defaultValue;
|
||||
|
||||
private int tmpValue = -1;
|
||||
|
||||
[System.Serializable]
|
||||
public class IntegerCallback : UnityEngine.Events.UnityEvent<int> { }
|
||||
|
||||
[SerializeField]
|
||||
private IntegerCallback OnChangeToggle = new IntegerCallback();
|
||||
|
||||
/// <summary>
|
||||
/// トグル名をそのままセーブに使用する
|
||||
/// </summary>
|
||||
public string toggleName;
|
||||
|
||||
/// <summary>
|
||||
/// 表示可になった
|
||||
/// </summary>
|
||||
public bool isStart = false;
|
||||
|
||||
private Toggle[] Toggles = null;
|
||||
|
||||
// Use this for initialization
|
||||
void Start()
|
||||
{
|
||||
toggleName = base.name;
|
||||
|
||||
Toggles = base.GetComponentsInChildren<Toggle>();
|
||||
|
||||
int save = SaveManager.GetInt(toggleName, defaultValue);
|
||||
|
||||
if (save > 0)
|
||||
{
|
||||
if (save < Toggles.Length)
|
||||
{
|
||||
Toggles[save].isOn = true;
|
||||
tmpValue = select = save;//確保
|
||||
}
|
||||
}
|
||||
isStart = true;
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// セレクタが変更された
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
public void OnToggleStateCheck(bool value)
|
||||
{
|
||||
//ステータス変更イベントのうちOnの物だけ使う
|
||||
if (value)
|
||||
{
|
||||
if (Toggles != null)
|
||||
{
|
||||
for (int i = 0; i < Toggles.Length; i++)
|
||||
{
|
||||
if (Toggles[i].isOn)
|
||||
{
|
||||
OnChangeToggle.Invoke(i);
|
||||
select = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 閉じられたときにセーブ
|
||||
/// </summary>
|
||||
private void OnDestroy()
|
||||
{
|
||||
if (autoSave)
|
||||
{
|
||||
Save();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 非表示になったときもセーブ
|
||||
/// </summary>
|
||||
private void OnDisable()
|
||||
{
|
||||
if (autoSave)
|
||||
{
|
||||
Save();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 明示的にセーブするときはこちら
|
||||
/// </summary>
|
||||
public void Save()
|
||||
{
|
||||
if (Toggles != null)
|
||||
{
|
||||
if (select != tmpValue)
|
||||
{
|
||||
if (Toggles[select].isOn)
|
||||
{
|
||||
SaveManager.SetInt(toggleName, select);
|
||||
print(toggleName + " " + select);
|
||||
SaveManager.Save();
|
||||
tmpValue = select;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5402fc351d7b3f442bd36a5ab82de201
|
||||
timeCreated: 1538184338
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,188 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine.Events;
|
||||
|
||||
public class ToggleSwitch : MonoBehaviour
|
||||
{
|
||||
/// <summary>
|
||||
/// ToggleSwitchの値がオンになっているかどうか
|
||||
/// </summary>
|
||||
private bool _isOn = false;
|
||||
|
||||
public bool isOn
|
||||
{
|
||||
get
|
||||
{
|
||||
if (isStart)
|
||||
{
|
||||
return _isOn;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (noSaveValue) { return DefaultValue; }
|
||||
int def = DefaultValue == true ? 1 : 0;
|
||||
return SaveManager.GetInt(base.name, def) == 1;
|
||||
}
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value && isStart)
|
||||
{
|
||||
rightToggle.isOn = false;
|
||||
leftToggle.isOn = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// セーブデータに値を保存しない場合
|
||||
/// </summary>
|
||||
public bool noSaveValue = false;
|
||||
|
||||
/// <summary>
|
||||
/// セーブに値がない場合のデフォルト値
|
||||
/// </summary>
|
||||
public bool DefaultValue = false;
|
||||
|
||||
/// <summary>
|
||||
/// 前回セーブ値との比較をするために残しておく
|
||||
/// </summary>
|
||||
private bool tmpValue = false;
|
||||
|
||||
[System.Serializable]
|
||||
public class BoolenCallback : UnityEngine.Events.UnityEvent<bool> { }
|
||||
|
||||
[SerializeField]
|
||||
private BoolenCallback OnChangeToggle = new BoolenCallback();
|
||||
|
||||
private Toggle leftToggle = null;
|
||||
private Toggle rightToggle = null;
|
||||
private Text leftDown;
|
||||
private Text rightDown;
|
||||
|
||||
/// <summary>
|
||||
/// ToggleSwitchが使用可能になっているか
|
||||
/// </summary>
|
||||
private bool isStart = false;
|
||||
|
||||
public string toggleName;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
toggleName = base.name;
|
||||
|
||||
leftToggle = base.transform.Find("ToggleLeft").GetComponent<Toggle>();
|
||||
rightToggle = base.transform.Find("ToggleRight").GetComponent<Toggle>();
|
||||
leftDown = base.transform.Find("ToggleLeft/Checkmark/LeftDown").GetComponent<Text>();
|
||||
rightDown = base.transform.Find("ToggleRight/Checkmark/RightDown").GetComponent<Text>();
|
||||
|
||||
int def = DefaultValue == true ? 1 : 0;
|
||||
int save = def;
|
||||
|
||||
//セーブを使用しない場合はデフォルト値
|
||||
if (!noSaveValue)
|
||||
{
|
||||
save = SaveManager.GetInt(toggleName, def);
|
||||
}
|
||||
|
||||
if (save == 1)
|
||||
{
|
||||
tmpValue = _isOn = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Use this for initialization
|
||||
void Start()
|
||||
{
|
||||
if (isOn)
|
||||
{
|
||||
leftToggle.isOn = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
rightToggle.isOn = true;
|
||||
}
|
||||
TextSet();
|
||||
leftToggle.onValueChanged.AddListener(OnToggleStateCheck);
|
||||
|
||||
isStart = true;
|
||||
}
|
||||
|
||||
void OnToggleStateCheck(bool value)
|
||||
{
|
||||
_isOn = value;
|
||||
TextSet();
|
||||
|
||||
//イベントを投げる
|
||||
OnChangeToggle.Invoke(_isOn);
|
||||
}
|
||||
|
||||
void TextSet()
|
||||
{
|
||||
if (isOn)
|
||||
{
|
||||
leftDown.enabled = true;
|
||||
rightDown.enabled = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
leftDown.enabled = false;
|
||||
rightDown.enabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 閉じられたときにセーブ
|
||||
/// </summary>
|
||||
private void OnDestroy()
|
||||
{
|
||||
if (toggleName != "")
|
||||
{
|
||||
Save();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 非表示になったときもセーブ
|
||||
/// </summary>
|
||||
private void OnDisable()
|
||||
{
|
||||
if (toggleName != "")
|
||||
{
|
||||
Save();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 明示的にセーブするときはこちら
|
||||
/// </summary>
|
||||
public void Save()
|
||||
{
|
||||
//セーブしない
|
||||
if (noSaveValue) { return; }
|
||||
|
||||
//変化があったときはセーブ
|
||||
if (tmpValue != _isOn)
|
||||
{
|
||||
if (_isOn)
|
||||
{
|
||||
SaveManager.SetInt(toggleName, 1);
|
||||
print(toggleName + " " + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
SaveManager.SetInt(toggleName, 0);
|
||||
print(toggleName + " " + 0);
|
||||
}
|
||||
SaveManager.Save();
|
||||
tmpValue = _isOn;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3475ff4089664514d875f0260fb78d6a
|
||||
timeCreated: 1536260303
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,123 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class UIButtonScript : MonoBehaviour
|
||||
{
|
||||
[SerializeField]
|
||||
GameObject errorPrefab;
|
||||
[SerializeField]
|
||||
GameObject SettingPrefab;
|
||||
|
||||
private GameObject Live;
|
||||
|
||||
private GameObject Studio;
|
||||
|
||||
private ToggleSwitch HViewSwitch;
|
||||
private ToggleSwitch VViewSwitch;
|
||||
|
||||
// Use this for initialization
|
||||
void Start()
|
||||
{
|
||||
StartCoroutine(CheckDBError());
|
||||
|
||||
Transform switchtransH = base.transform.Find("HorizontalMenu/ViewSwitch");
|
||||
if (switchtransH != null) { HViewSwitch = switchtransH.GetComponent<ToggleSwitch>(); }
|
||||
|
||||
Transform switchtransV = base.transform.Find("VerticalMenu/Header/ViewSwitch");
|
||||
if (switchtransV != null) { VViewSwitch = switchtransV.GetComponent<ToggleSwitch>(); }
|
||||
|
||||
Transform livetrans = base.transform.Find("LiveContent");
|
||||
if (livetrans != null) { Live = livetrans.gameObject; }
|
||||
|
||||
Transform studiotrans = base.transform.Find("PhotoStudio");
|
||||
if (studiotrans != null) { Studio = studiotrans.gameObject; }
|
||||
|
||||
OnChangeViewSwitchToggle();
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// エラーチェック
|
||||
/// </summary>
|
||||
private IEnumerator CheckDBError()
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
//読み込み完了まで待つ
|
||||
if (MasterDBManager.instance.isLoadDB && ManifestManager.instance.isLoad)
|
||||
{
|
||||
break;
|
||||
}
|
||||
//エラー発生時
|
||||
if (MasterDBManager.instance.isError || ManifestManager.instance.isError)
|
||||
{
|
||||
GameObject obj = Instantiate(errorPrefab);
|
||||
obj.transform.SetParent(GameObject.Find("Canvas").transform, false);
|
||||
|
||||
Text text = obj.transform.Find("Content/ErrorText").GetComponent<Text>();
|
||||
text.text = "データベースファイルが存在しません。\n設定からDBのダウンロードを行ってください。";
|
||||
yield break;
|
||||
}
|
||||
|
||||
yield return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 設定ボタンを押したときの動作
|
||||
/// </summary>
|
||||
public void OnClickMVSettingButton()
|
||||
{
|
||||
GameObject baseObj = GameObject.Find("Canvas/ViewSetter");
|
||||
Transform transform = baseObj.transform.Find("Setting");
|
||||
if (transform == null)
|
||||
{
|
||||
GameObject obj = Instantiate(SettingPrefab);
|
||||
obj.transform.SetParent(baseObj.transform, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
transform.gameObject.SetActive(true);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// LiveとPhotoStudioを切り替えるスイッチ
|
||||
/// </summary>
|
||||
public void OnChangeViewSwitchToggle()
|
||||
{
|
||||
ToggleSwitch ViewSwitch = null;
|
||||
if (HViewSwitch != null && HViewSwitch.isActiveAndEnabled)
|
||||
{
|
||||
ViewSwitch = HViewSwitch;
|
||||
}
|
||||
else if (VViewSwitch != null && VViewSwitch.isActiveAndEnabled)
|
||||
{
|
||||
ViewSwitch = VViewSwitch;
|
||||
}
|
||||
|
||||
if (ViewSwitch != null)
|
||||
{
|
||||
if (ViewSwitch.isOn)
|
||||
{
|
||||
//Live
|
||||
Live.SetActive(true);
|
||||
Studio.SetActive(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
//Studio
|
||||
Live.SetActive(false);
|
||||
Studio.SetActive(true);
|
||||
}
|
||||
ViewSwitch.Save();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 98f12794b4f08b248801a9d7411f6484
|
||||
timeCreated: 1536264174
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,339 @@
|
||||
using System.Collections;
|
||||
using UnityEngine.UI;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class UICharaRefine : MonoBehaviour {
|
||||
|
||||
[SerializeField]
|
||||
private bool[] visibleSelect = new bool[] { true, true, true, true };
|
||||
private bool[] lastValue = new bool[] { true, true, true, true };
|
||||
|
||||
private Toggle Cute = null;
|
||||
private Toggle Cool = null;
|
||||
private Toggle Passion = null;
|
||||
private Toggle Other = null;
|
||||
|
||||
private ToggleSwitch pageToggle = null;
|
||||
|
||||
private InputField inputField;
|
||||
private string searchString = "";
|
||||
|
||||
GameObject Select = null;
|
||||
GameObject Search = null;
|
||||
|
||||
private bool enterWait = false;
|
||||
|
||||
// Use this for initialization
|
||||
void Start()
|
||||
{
|
||||
base.name = base.name.Replace("(Clone)", "");
|
||||
|
||||
LoadSavedata();
|
||||
}
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
var toggles = transform.Find("Content/Select/Type/ContentArea/Cute");
|
||||
if(toggles != null)
|
||||
{
|
||||
Cute = toggles.GetComponent<Toggle>();
|
||||
}
|
||||
toggles = transform.Find("Content/Select/Type/ContentArea/Cool");
|
||||
if (toggles != null)
|
||||
{
|
||||
Cool = toggles.GetComponent<Toggle>();
|
||||
}
|
||||
toggles = transform.Find("Content/Select/Type/ContentArea/Passion");
|
||||
if (toggles != null)
|
||||
{
|
||||
Passion = toggles.GetComponent<Toggle>();
|
||||
}
|
||||
toggles = transform.Find("Content/Select/Type/ContentArea/Other");
|
||||
if (toggles != null)
|
||||
{
|
||||
Other = toggles.GetComponent<Toggle>();
|
||||
}
|
||||
var toggleSwitch = transform.Find("Header/CharaRefineSelect");
|
||||
if (toggleSwitch != null)
|
||||
{
|
||||
pageToggle = toggleSwitch.GetComponent<ToggleSwitch>();
|
||||
}
|
||||
var inputfield = transform.Find("Content/Search/InputField");
|
||||
if (inputfield != null)
|
||||
{
|
||||
inputField = inputfield.GetComponent<InputField>();
|
||||
}
|
||||
|
||||
Select = transform.Find("Content/Select").gameObject;
|
||||
Search = transform.Find("Content/Search").gameObject;
|
||||
|
||||
WindowSizeSetter();
|
||||
}
|
||||
|
||||
private void WindowSizeSetter()
|
||||
{
|
||||
//ウィンドウのサイズを取得
|
||||
Vector2 windowSize = GameObject.Find("Canvas").GetComponent<RectTransform>().sizeDelta;
|
||||
|
||||
//自分のサイズを取得
|
||||
Vector3 mylocalScale = GetComponent<RectTransform>().localScale;
|
||||
Vector2 mysize = GetComponent<RectTransform>().sizeDelta;
|
||||
|
||||
//縦長の場合
|
||||
if (windowSize.y > windowSize.x)
|
||||
{
|
||||
//はみ出すため小さくする
|
||||
mylocalScale.x = 0.8f;
|
||||
mylocalScale.y = 0.8f;
|
||||
}
|
||||
|
||||
GetComponent<RectTransform>().localScale = mylocalScale;
|
||||
GetComponent<RectTransform>().sizeDelta = mysize;
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
LoadSavedata();
|
||||
enterWait = false;
|
||||
if (Search.activeInHierarchy)
|
||||
{
|
||||
inputField.ActivateInputField();
|
||||
}
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
if (enterWait && Input.GetKeyDown(KeyCode.Return))
|
||||
{
|
||||
OnClickOK();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// セーブデータを読み込んで反映
|
||||
/// </summary>
|
||||
private void LoadSavedata()
|
||||
{
|
||||
visibleSelect = new bool[] { true, true, true, true };
|
||||
lastValue = new bool[] { true, true, true, true };
|
||||
|
||||
if (SaveManager.GetInt("CharaCuteVisible") == -1)
|
||||
{
|
||||
visibleSelect[0] = lastValue[0] = false;
|
||||
}
|
||||
if (SaveManager.GetInt("CharaCoolVisible") == -1)
|
||||
{
|
||||
visibleSelect[1] = lastValue[1] = false;
|
||||
}
|
||||
if (SaveManager.GetInt("CharaPassionVisible") == -1)
|
||||
{
|
||||
visibleSelect[2] = lastValue[2] = false;
|
||||
}
|
||||
if (SaveManager.GetInt("CharaOtherVisible") == -1)
|
||||
{
|
||||
visibleSelect[3] = lastValue[3] = false;
|
||||
}
|
||||
|
||||
searchString = SaveManager.GetString("SearchCharaString");
|
||||
inputField.text = searchString;
|
||||
|
||||
Select.SetActive(false);
|
||||
Search.SetActive(false);
|
||||
if (SaveManager.GetInt("CharaRefineSelect") == 1)
|
||||
{
|
||||
Select.SetActive(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
Search.SetActive(true);
|
||||
}
|
||||
|
||||
Cute.isOn = visibleSelect[0];
|
||||
Cool.isOn = visibleSelect[1];
|
||||
Passion.isOn = visibleSelect[2];
|
||||
Other.isOn = visibleSelect[3];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 属性表示ボタン変更(キュート)
|
||||
/// </summary>
|
||||
/// <param name="b"></param>
|
||||
public void OnToggleChangeCute(bool b)
|
||||
{
|
||||
bool value = Cute.isOn;
|
||||
if (value)
|
||||
{
|
||||
visibleSelect[0] = true;
|
||||
//SaveManager.SetInt("CharaCuteVisible", 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
visibleSelect[0] = false;
|
||||
//SaveManager.SetInt("CharaCuteVisible", -1);
|
||||
}
|
||||
//SaveManager.Save();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 属性表示ボタン変更(クール)
|
||||
/// </summary>
|
||||
/// <param name="b"></param>
|
||||
public void OnToggleChangeCool(bool b)
|
||||
{
|
||||
|
||||
bool value = Cool.isOn;
|
||||
if (value)
|
||||
{
|
||||
visibleSelect[1] = true;
|
||||
//SaveManager.SetInt("CharaCoolVisible", 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
visibleSelect[1] = false;
|
||||
// SaveManager.SetInt("CharaCoolVisible", -1);
|
||||
|
||||
}
|
||||
//SaveManager.Save();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 属性表示ボタン変更(パッション)
|
||||
/// </summary>
|
||||
/// <param name="b"></param>
|
||||
public void OnToggleChangePassion(bool b)
|
||||
{
|
||||
|
||||
bool value = Passion.isOn;
|
||||
if (value)
|
||||
{
|
||||
visibleSelect[2] = true;
|
||||
//SaveManager.SetInt("CharaPassionVisible", 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
visibleSelect[2] = false;
|
||||
//SaveManager.SetInt("CharaPassionVisible", -1);
|
||||
|
||||
}
|
||||
//SaveManager.Save();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 属性表示ボタン変更(その他)
|
||||
/// </summary>
|
||||
/// <param name="b"></param>
|
||||
public void OnToggleChangeOther(bool b)
|
||||
{
|
||||
|
||||
bool value = Other.isOn;
|
||||
if (value)
|
||||
{
|
||||
visibleSelect[3] = true;
|
||||
//SaveManager.SetInt("CharaPassionVisible", 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
visibleSelect[3] = false;
|
||||
//SaveManager.SetInt("CharaPassionVisible", -1);
|
||||
|
||||
}
|
||||
//SaveManager.Save();
|
||||
}
|
||||
|
||||
private void Save()
|
||||
{
|
||||
int value = 0;
|
||||
value = visibleSelect[0] ? 1 : -1;
|
||||
if(visibleSelect[0] != lastValue[0]) SaveManager.SetInt("CharaCuteVisible", value);
|
||||
|
||||
value = visibleSelect[1] ? 1 : -1;
|
||||
if (visibleSelect[1] != lastValue[1]) SaveManager.SetInt("CharaCoolVisible", value);
|
||||
|
||||
value = visibleSelect[2] ? 1 : -1;
|
||||
if (visibleSelect[2] != lastValue[2]) SaveManager.SetInt("CharaPassionVisible", value);
|
||||
|
||||
value = visibleSelect[3] ? 1 : -1;
|
||||
if (visibleSelect[3] != lastValue[3]) SaveManager.SetInt("CharaOtherVisible", value);
|
||||
|
||||
searchString = inputField.text;
|
||||
SaveManager.SetString("SearchCharaString", searchString);
|
||||
|
||||
SaveManager.Save();
|
||||
|
||||
lastValue[0] = visibleSelect[0];
|
||||
lastValue[1] = visibleSelect[1];
|
||||
lastValue[2] = visibleSelect[2];
|
||||
lastValue[3] = visibleSelect[3];
|
||||
}
|
||||
|
||||
private void rollback()
|
||||
{
|
||||
//LoadSavedata();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 決定ボタンクリック
|
||||
/// </summary>
|
||||
public void OnClickOK()
|
||||
{
|
||||
Save();
|
||||
|
||||
GameObject obj = GameObject.Find("Canvas/CharaView");
|
||||
obj.GetComponent<UICharaView>().ReVisible();
|
||||
|
||||
base.gameObject.SetActive(false);
|
||||
}
|
||||
/// <summary>
|
||||
/// 閉じるボタンクリック
|
||||
/// </summary>
|
||||
public void OnClickClose()
|
||||
{
|
||||
rollback();
|
||||
base.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 初期化ボタンをクリック
|
||||
/// </summary>
|
||||
public void OnClickClear()
|
||||
{
|
||||
if (Cute.isOn && Cool.isOn && Passion.isOn && Other.isOn && inputField.text == "")
|
||||
{
|
||||
visibleSelect = new bool[] { false, false, false, false };
|
||||
}
|
||||
else
|
||||
{
|
||||
visibleSelect = new bool[] { true, true, true, true };
|
||||
}
|
||||
Cute.isOn = visibleSelect[0];
|
||||
Cool.isOn = visibleSelect[1];
|
||||
Passion.isOn = visibleSelect[2];
|
||||
Other.isOn = visibleSelect[3];
|
||||
|
||||
searchString = "";
|
||||
inputField.text = searchString;
|
||||
}
|
||||
|
||||
public void OnChangePageToggle()
|
||||
{
|
||||
if (pageToggle.isOn)
|
||||
{
|
||||
Select.SetActive(true);
|
||||
Search.SetActive(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
Select.SetActive(false);
|
||||
Search.SetActive(true);
|
||||
inputField.ActivateInputField();
|
||||
}
|
||||
}
|
||||
|
||||
public void OnEndInputText()
|
||||
{
|
||||
enterWait = true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5c1f99201fd67e3428008c367b552b43
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,94 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class UICharaSort : MonoBehaviour
|
||||
{
|
||||
private RadioButton radioButton = null;
|
||||
private int initValue;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
radioButton = base.GetComponentInChildren<RadioButton>();
|
||||
radioButton.autoSave = false;
|
||||
WindowSizeSetter();
|
||||
}
|
||||
|
||||
private void WindowSizeSetter()
|
||||
{
|
||||
//ウィンドウのサイズを取得
|
||||
Vector2 windowSize = GameObject.Find("Canvas").GetComponent<RectTransform>().sizeDelta;
|
||||
|
||||
//自分のサイズを取得
|
||||
Vector3 mylocalScale = GetComponent<RectTransform>().localScale;
|
||||
Vector2 mysize = GetComponent<RectTransform>().sizeDelta;
|
||||
|
||||
//縦長の場合
|
||||
if (windowSize.y > windowSize.x)
|
||||
{
|
||||
//はみ出すため小さくする
|
||||
mylocalScale.x = 0.8f;
|
||||
mylocalScale.y = 0.8f;
|
||||
}
|
||||
|
||||
GetComponent<RectTransform>().localScale = mylocalScale;
|
||||
GetComponent<RectTransform>().sizeDelta = mysize;
|
||||
}
|
||||
|
||||
// Use this for initialization
|
||||
void Start()
|
||||
{
|
||||
base.name = base.name.Replace("(Clone)", "");
|
||||
|
||||
LoadSavedata();
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
LoadSavedata();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// セーブデータを読み込んで反映
|
||||
/// </summary>
|
||||
private void LoadSavedata()
|
||||
{
|
||||
initValue = SaveManager.GetInt("CharaSortSelect");
|
||||
}
|
||||
|
||||
private void Save()
|
||||
{
|
||||
int nowvalue = radioButton.select;
|
||||
if(initValue != nowvalue)
|
||||
{
|
||||
radioButton.Save();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 決定ボタンクリック
|
||||
/// </summary>
|
||||
public void OnClickOK()
|
||||
{
|
||||
Save();
|
||||
|
||||
GameObject obj = GameObject.Find("Canvas/CharaView");
|
||||
obj.GetComponent<UICharaView>().ReVisible();
|
||||
|
||||
base.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 閉じるボタンクリック
|
||||
/// </summary>
|
||||
public void OnClickClose()
|
||||
{
|
||||
base.gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 95b7683f702b00b409927f7455192eb5
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,534 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
public class UICharaView : MonoBehaviour
|
||||
{
|
||||
[SerializeField]
|
||||
private GameObject charaIcon;
|
||||
|
||||
[SerializeField]
|
||||
private GameObject CharaRefineView;
|
||||
|
||||
[SerializeField]
|
||||
private GameObject CharaSortView;
|
||||
|
||||
private GameObject SortChangeBtn;
|
||||
|
||||
private GameObject SortSelectBtn;
|
||||
|
||||
private Sprite[] icons = null;
|
||||
|
||||
private List<SQCharaData> charaList = null;
|
||||
|
||||
private bool[] visibleSelect = new bool[] { true, true, true, true };
|
||||
private string searchString = "";
|
||||
private int sortSelect;
|
||||
private bool sortOrder;
|
||||
|
||||
private int clickPlace = -1;
|
||||
|
||||
private Transform content;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
SortChangeBtn = base.transform.Find("Header/SortingButton/RightButton").gameObject;
|
||||
SortSelectBtn = base.transform.Find("Header/SortingButton/LeftButton").gameObject;
|
||||
|
||||
icons = new Sprite[2];
|
||||
icons[0] = Resources.Load<Sprite>("up");
|
||||
icons[1] = Resources.Load<Sprite>("down");
|
||||
|
||||
WindowSizeSetter();
|
||||
}
|
||||
|
||||
private void WindowSizeSetter()
|
||||
{
|
||||
//ウィンドウのサイズを取得
|
||||
Vector2 windowSize = GameObject.Find("Canvas").GetComponent<RectTransform>().sizeDelta;
|
||||
|
||||
//レイアウトを取得
|
||||
GridLayoutGroup gridLayoutGroup = base.GetComponentInChildren<GridLayoutGroup>();
|
||||
float contentXsize = gridLayoutGroup.cellSize.x + gridLayoutGroup.spacing.x;
|
||||
|
||||
//自分のサイズを取得
|
||||
Vector2 mysize = GetComponent<RectTransform>().sizeDelta;
|
||||
|
||||
Vector2 setSize;
|
||||
setSize.x = 47f;
|
||||
|
||||
//横コンテンツ数は最大10個
|
||||
for(int i = 0; i < 10; i++)
|
||||
{
|
||||
if (setSize.x + contentXsize > windowSize.x)
|
||||
{
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
//横幅に余裕があるなら増やしていく
|
||||
setSize.x += contentXsize;
|
||||
}
|
||||
}
|
||||
|
||||
//縦サイズ
|
||||
//デフォルトサイズをセット
|
||||
setSize.y = mysize.y;
|
||||
//縦長の場合
|
||||
if (windowSize.y > windowSize.x)
|
||||
{
|
||||
if (windowSize.y > 1000f)
|
||||
{
|
||||
setSize.y = 950f;
|
||||
}
|
||||
}
|
||||
|
||||
GetComponent<RectTransform>().sizeDelta = setSize;
|
||||
}
|
||||
|
||||
// Use this for initialization
|
||||
void Start()
|
||||
{
|
||||
base.name = base.name.Replace("(Clone)", "");
|
||||
|
||||
//セーブの読み込み
|
||||
LoadSavedata();
|
||||
|
||||
StartCoroutine(CreateCharaButtons());
|
||||
|
||||
ReViewSortSelect();
|
||||
ReViewSortChange();
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void SetClickPlace(int place)
|
||||
{
|
||||
clickPlace = place;
|
||||
}
|
||||
|
||||
private void LoadSavedata()
|
||||
{
|
||||
visibleSelect = new bool[] { true, true, true, true };
|
||||
|
||||
if (SaveManager.GetInt("CharaCuteVisible") == -1)
|
||||
{
|
||||
visibleSelect[0] = false;
|
||||
}
|
||||
if (SaveManager.GetInt("CharaCoolVisible") == -1)
|
||||
{
|
||||
visibleSelect[1] = false;
|
||||
}
|
||||
if (SaveManager.GetInt("CharaPassionVisible") == -1)
|
||||
{
|
||||
visibleSelect[2] = false;
|
||||
}
|
||||
if (SaveManager.GetInt("CharaOtherVisible") == -1)
|
||||
{
|
||||
visibleSelect[3] = false;
|
||||
}
|
||||
searchString = SaveManager.GetString("SearchCharaString");
|
||||
sortSelect = SaveManager.GetInt("CharaSortSelect");
|
||||
var tmp = SaveManager.GetInt("CharaSortOrder");
|
||||
sortOrder = tmp != 1; //1がtrue
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// キャラボタンの再描画
|
||||
/// </summary>
|
||||
public void ReVisible()
|
||||
{
|
||||
LoadSavedata();
|
||||
ChangeVisible();
|
||||
CharaSorting();
|
||||
ReViewSortSelect();
|
||||
ReViewSortChange();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// キャラリストをセットする
|
||||
/// </summary>
|
||||
public void SetCharaList(List<SQCharaData> _charalist)
|
||||
{
|
||||
this.charaList = _charalist;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// キャラクタの並び替えを行う
|
||||
/// </summary>
|
||||
private void CharaSorting()
|
||||
{
|
||||
IOrderedEnumerable<SQCharaData> sort = GetSortOrder();
|
||||
if (sort != null)
|
||||
{
|
||||
foreach (var tmp in sort)
|
||||
{
|
||||
//順番に最背面に移動⇒最終的に順番に並ぶ
|
||||
tmp.iconObject.transform.SetAsLastSibling();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// アイコンの表示を切り替え
|
||||
/// </summary>
|
||||
private void ChangeVisible()
|
||||
{
|
||||
foreach (var tmp in charaList)
|
||||
{
|
||||
GameObject gameObject = tmp.iconObject;
|
||||
|
||||
bool isVisible = checkVisible(tmp);
|
||||
if (isVisible)
|
||||
{
|
||||
gameObject.SetActive(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// アイコンを表示するかしないかを取得
|
||||
/// </summary>
|
||||
private bool checkVisible(SQCharaData data)
|
||||
{
|
||||
bool isVisible = true;
|
||||
int type = data.type - 1;
|
||||
|
||||
if (type < 4)
|
||||
{
|
||||
if (!visibleSelect[type])
|
||||
{
|
||||
isVisible = false;
|
||||
}
|
||||
}
|
||||
if (searchString != "")
|
||||
{
|
||||
if (!data.name.Contains(searchString))
|
||||
{
|
||||
if (!data.name_kana.Contains(searchString))
|
||||
{
|
||||
isVisible = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return isVisible;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 閉じるボタンクリック
|
||||
/// </summary>
|
||||
public void OnCharaViewClose()
|
||||
{
|
||||
base.gameObject.SetActive(false);
|
||||
//Destroy(base.gameObject);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 絞り込み表示画面の表示
|
||||
/// </summary>
|
||||
public void OnClickRefine()
|
||||
{
|
||||
GameObject obj = GameObject.Find("Canvas");
|
||||
Transform tf = obj.transform.Find("CharaRefineView");
|
||||
if (tf != null)
|
||||
{
|
||||
tf.gameObject.SetActive(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
GameObject obj2 = Instantiate(CharaRefineView);
|
||||
GameObject baseObj = GameObject.Find("Canvas");
|
||||
obj2.transform.SetParent(baseObj.transform, false);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ソート設定の切り替え
|
||||
/// </summary>
|
||||
public void OnClickSortSelect()
|
||||
{
|
||||
switch (sortSelect)
|
||||
{
|
||||
case 0:
|
||||
sortSelect = 1;
|
||||
break;
|
||||
case 1:
|
||||
sortSelect = 0;
|
||||
break;
|
||||
}
|
||||
SaveManager.SetInt("CharaSortSelect", sortSelect);
|
||||
|
||||
SaveManager.Save();
|
||||
|
||||
ReVisible();
|
||||
/*
|
||||
GameObject obj = GameObject.Find("Canvas");
|
||||
Transform tf = obj.transform.Find("CharaSortView");
|
||||
if (tf != null)
|
||||
{
|
||||
tf.gameObject.SetActive(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
GameObject obj2 = Instantiate(CharaSortView);
|
||||
GameObject baseObj = GameObject.Find("Canvas");
|
||||
obj2.transform.SetParent(baseObj.transform, false);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ソートの昇順/降順の切り替え
|
||||
/// </summary>
|
||||
public void OnClickSortChange()
|
||||
{
|
||||
//ひっくり返すよ
|
||||
sortOrder = !sortOrder;
|
||||
|
||||
if (sortOrder)
|
||||
{
|
||||
SaveManager.SetInt("CharaSortOrder", 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
SaveManager.SetInt("CharaSortOrder", 1);
|
||||
}
|
||||
SaveManager.Save();
|
||||
|
||||
ReVisible();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ソート順に並んだLINQイテレータを取得
|
||||
/// </summary>
|
||||
private IOrderedEnumerable<SQCharaData> GetSortOrder()
|
||||
{
|
||||
//セーブからソート順を指定
|
||||
IOrderedEnumerable<SQCharaData> sort = null;
|
||||
if (sortOrder)
|
||||
{
|
||||
switch (sortSelect)
|
||||
{
|
||||
case 0:
|
||||
sort = charaList.OrderBy(x => x.charaID);
|
||||
break;
|
||||
case 1:
|
||||
sort = charaList.OrderBy(x => x.name_kana);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (sortSelect)
|
||||
{
|
||||
case 0:
|
||||
sort = charaList.OrderByDescending(x => x.charaID);
|
||||
break;
|
||||
case 1:
|
||||
sort = charaList.OrderByDescending(x => x.name_kana);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return sort;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// キャラボタンリストを生成する
|
||||
/// </summary>
|
||||
private IEnumerator CreateCharaButtons()
|
||||
{
|
||||
//contentエリアを取得
|
||||
content = transform.Find("Content/CharaList/Viewport/Content").gameObject.GetComponent<RectTransform>();
|
||||
|
||||
//charalistセット待ち
|
||||
while (true)
|
||||
{
|
||||
if (charaList != null)
|
||||
{
|
||||
break;
|
||||
}
|
||||
yield return null;
|
||||
}
|
||||
|
||||
//セーブからソート順を指定
|
||||
IOrderedEnumerable<SQCharaData> sort = GetSortOrder();
|
||||
if (sort != null)
|
||||
{
|
||||
//ボタンを生成
|
||||
foreach (var tmp in sort)
|
||||
{
|
||||
GameObject btn = Instantiate(charaIcon);
|
||||
//並列で実行
|
||||
StartCoroutine(MakeButton(tmp, btn));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//ボタンを生成
|
||||
foreach (var tmp in charaList)
|
||||
{
|
||||
GameObject btn = Instantiate(charaIcon);
|
||||
//並列で実行
|
||||
StartCoroutine(MakeButton(tmp, btn));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ボタン生成単体
|
||||
/// </summary>
|
||||
private IEnumerator MakeButton(SQCharaData data, GameObject btn)
|
||||
{
|
||||
btn.name = data.charaID.ToString();
|
||||
|
||||
data.iconObject = btn;
|
||||
|
||||
//曲名を名前に設定
|
||||
string text = data.name;
|
||||
text = text.Replace("コミュ用", "プチ");
|
||||
btn.transform.GetComponentInChildren<Text>().text = text;
|
||||
|
||||
//ボタンにアクションを設定
|
||||
Button button = btn.transform.GetComponentInChildren<Button>();
|
||||
AddButtonEvent(button, data);
|
||||
|
||||
//親をセット
|
||||
btn.transform.SetParent(content, false);
|
||||
|
||||
//表示設定
|
||||
if (!checkVisible(data))
|
||||
{
|
||||
btn.SetActive(false);
|
||||
}
|
||||
|
||||
//Managerを取得
|
||||
UIManagerChara mc = GameObject.Find("UIManager").GetComponent<UIManagerChara>();
|
||||
Sprite icondata = null;
|
||||
|
||||
//ICON取得待ち
|
||||
while (true)
|
||||
{
|
||||
icondata = mc.GetIconSprite(data.iconID);
|
||||
if (icondata != null)
|
||||
{
|
||||
break;
|
||||
}
|
||||
yield return null;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
//ボタンアイコン変更
|
||||
Image img = btn.transform.Find("Button").GetComponent<Image>();
|
||||
img.sprite = icondata;
|
||||
}
|
||||
catch (MissingComponentException e)
|
||||
{
|
||||
//ボタンの生成前にMusicViewを閉じた場合エラーをはくため
|
||||
print(e);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ボタンに機能を付与する
|
||||
/// </summary>
|
||||
private void AddButtonEvent(Button button, SQCharaData data)
|
||||
{
|
||||
button.onClick.AddListener(() =>
|
||||
{
|
||||
this.OnClick(data);
|
||||
base.gameObject.SetActive(false);
|
||||
//Destroy(base.gameObject); //選択したらCharaViewを破棄する
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// キャラアイコンを選択
|
||||
/// </summary>
|
||||
private void OnClick(SQCharaData data)
|
||||
{
|
||||
SellectChara(data.charaID, data.iconID);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// キャラボタンにキャラを設定する
|
||||
/// </summary>
|
||||
private void SellectChara(int charaID, int charaIcon = -1)
|
||||
{
|
||||
if (charaIcon == -1)
|
||||
{
|
||||
charaIcon = charaID;
|
||||
}
|
||||
|
||||
//アイコンセット
|
||||
UIIdolSelect idolselect = GameObject.Find("Canvas/Panel/LiveContent/IdolInfo").GetComponent<UIIdolSelect>();
|
||||
StartCoroutine(idolselect.CharaIconSetter(charaID, charaIcon, this.clickPlace));
|
||||
/*
|
||||
if (this.clickPlace < 9)
|
||||
{
|
||||
//アイコンセット
|
||||
UIIdolSelect idolselect = GameObject.Find("Canvas/Panel/LiveContent/IdolInfo").GetComponent<UIIdolSelect>();
|
||||
StartCoroutine(idolselect.CharaIconSetter(charaID, charaIcon, this.clickPlace));
|
||||
}
|
||||
else
|
||||
{
|
||||
//フォトスタジオ
|
||||
UIPhotoStudioChara photoStudioChara = GameObject.Find("Canvas/Panel/PhotoStudio/PhotoStudioIdolSelect").GetComponent<UIPhotoStudioChara>();
|
||||
if (photoStudioChara != null)
|
||||
{
|
||||
StartCoroutine(photoStudioChara.CharaIconSetter(charaID, charaIcon, this.clickPlace));
|
||||
}
|
||||
}
|
||||
*/
|
||||
//キャラ選択時にDressアイコンをDLする
|
||||
StartCoroutine(GameObject.Find("UIManager").GetComponent<UIManagerDress>().DownloadAndCreateDressIcons(charaID));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// SortChangeボタンの表示を変更する
|
||||
/// </summary>
|
||||
private void ReViewSortChange()
|
||||
{
|
||||
Image icon = SortChangeBtn.transform.Find("Image").GetComponent<Image>();
|
||||
Text text = SortChangeBtn.transform.Find("Text").GetComponent<Text>();
|
||||
|
||||
if (sortOrder)
|
||||
{
|
||||
text.text = "昇順";
|
||||
icon.sprite = icons[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
text.text = "降順";
|
||||
icon.sprite = icons[1];
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// SortSelectボタンの表示を変更する
|
||||
/// </summary>
|
||||
private void ReViewSortSelect()
|
||||
{
|
||||
Text text = SortSelectBtn.transform.Find("Text").GetComponent<Text>();
|
||||
|
||||
switch (sortSelect)
|
||||
{
|
||||
case 0:
|
||||
text.text = "ID順";
|
||||
break;
|
||||
case 1:
|
||||
text.text = "五十音順";
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 76e65d8770c232a46bf6fb8f3c69ed8a
|
||||
timeCreated: 1528789959
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,168 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using System.Collections;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
public class UIDBNotice : MonoBehaviour {
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
base.name = base.name.Replace("(Clone)", "");
|
||||
WindowSizeSetter();
|
||||
}
|
||||
|
||||
private void WindowSizeSetter()
|
||||
{
|
||||
//ウィンドウのサイズを取得
|
||||
Vector2 windowSize = GameObject.Find("Canvas").GetComponent<RectTransform>().sizeDelta;
|
||||
|
||||
//自分のサイズを取得
|
||||
Vector3 mylocalScale = GetComponent<RectTransform>().localScale;
|
||||
Vector2 mysize = GetComponent<RectTransform>().sizeDelta;
|
||||
|
||||
//縦長の場合
|
||||
if (windowSize.y > windowSize.x)
|
||||
{
|
||||
//はみ出すため小さくする
|
||||
mylocalScale.x = 0.7f;
|
||||
mylocalScale.y = 0.8f;
|
||||
|
||||
//縦長に変更
|
||||
if (windowSize.y > 1160f)
|
||||
{
|
||||
mysize.y = 1250f;
|
||||
}
|
||||
}
|
||||
|
||||
GetComponent<RectTransform>().localScale = mylocalScale;
|
||||
GetComponent<RectTransform>().sizeDelta = mysize;
|
||||
}
|
||||
|
||||
// Use this for initialization
|
||||
void Start()
|
||||
{
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update () {
|
||||
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
Resources.UnloadUnusedAssets();
|
||||
}
|
||||
|
||||
public void OnClickClose()
|
||||
{
|
||||
//RuntimeInitializer.CallInitialize();
|
||||
|
||||
//SceneManager.LoadSceneAsync("Menu");
|
||||
|
||||
//ReLoadAllData();
|
||||
|
||||
//Destroy(base.gameObject);
|
||||
|
||||
#if UNITY_EDITOR
|
||||
UnityEditor.EditorApplication.isPlaying = false;
|
||||
#elif UNITY_STANDALONE
|
||||
UnityEngine.Application.Quit();
|
||||
#endif
|
||||
}
|
||||
|
||||
public void ReLoadAllData()
|
||||
{
|
||||
GameObject UIManager = GameObject.Find("UIManager");
|
||||
if(UIManager != null)
|
||||
{
|
||||
UIManagerChara uIManagerChara = UIManager.GetComponent<UIManagerChara>();
|
||||
if(uIManagerChara != null) { uIManagerChara.ResetData(); }
|
||||
|
||||
UIManagerDress uIManagerDress = UIManager.GetComponent<UIManagerDress>();
|
||||
if (uIManagerDress != null) { uIManagerDress.ResetData(); }
|
||||
|
||||
UIManagerMusic uIManagerMusic = UIManager.GetComponent<UIManagerMusic>();
|
||||
if (uIManagerMusic != null) { uIManagerMusic.ResetData(); }
|
||||
|
||||
UIManagerPhotoStudioStage uIManagerPhotoStudioStage = UIManager.GetComponent<UIManagerPhotoStudioStage>();
|
||||
if (uIManagerPhotoStudioStage != null) { uIManagerPhotoStudioStage.ResetData(); }
|
||||
|
||||
UIStartManager uIStartManager = UIManager.GetComponent<UIStartManager>();
|
||||
if (uIStartManager != null) { uIStartManager.ResetData(); }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void UpdateDatabase()
|
||||
{
|
||||
StartCoroutine(UpdateDB());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ManifestおよびMasterのデータベースの更新処理
|
||||
/// </summary>
|
||||
private IEnumerator UpdateDB()
|
||||
{
|
||||
Text text = base.transform.Find("Content/Text").gameObject.GetComponent<Text>();
|
||||
text.text = "DB更新中...";
|
||||
|
||||
|
||||
MasterDBManager.instance.DeleteMasterDB();
|
||||
ManifestManager.instance.DeleteManifest();
|
||||
|
||||
string fileVersion = "";
|
||||
int filever = 0;
|
||||
//バージョンを確認
|
||||
VersionCheckerKiraraAPI cv = new VersionCheckerKiraraAPI();
|
||||
yield return cv.Check();
|
||||
|
||||
//バージョンが取得できなかった
|
||||
if (cv.version == 0)
|
||||
{
|
||||
VersionCheckerMatsurihimeAPI matsurihime = new VersionCheckerMatsurihimeAPI();
|
||||
yield return matsurihime.Check();
|
||||
if(matsurihime.version > 0)
|
||||
{
|
||||
filever = matsurihime.version;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
filever = cv.version;
|
||||
}
|
||||
|
||||
if(filever == 0)
|
||||
{
|
||||
print("バージョンの取得に失敗しました");
|
||||
yield break;
|
||||
}
|
||||
fileVersion = filever.ToString();
|
||||
|
||||
text.text = text.text + "\n" + "ManifestVersion:" + fileVersion;
|
||||
yield return null;
|
||||
|
||||
yield return ManifestManager.instance.DownloadManifest(fileVersion);
|
||||
yield return MasterDBManager.instance.DownloadMasterDB();
|
||||
|
||||
text.text = text.text + "\n" + "更新完了";
|
||||
yield return null;
|
||||
yield return null;
|
||||
text.text = text.text + "\n" + "下部ボタンから一旦アプリを終了してください";
|
||||
yield return null;
|
||||
|
||||
//データソースをいったん全部破棄
|
||||
ViewLauncher.instance.Clear();
|
||||
AssetManager.instance.Init();
|
||||
ResourcesManager.instance.Destroy();
|
||||
Destroy(AssetManager.instance.gameObject);
|
||||
Destroy(ViewLauncher.instance.gameObject);
|
||||
GameObject UIManager = GameObject.Find("UIManager");
|
||||
Destroy(UIManager);
|
||||
|
||||
Resources.UnloadUnusedAssets();
|
||||
|
||||
var close = base.transform.Find("Footer/Close").gameObject;
|
||||
close.SetActive(true);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 60eb8f47c528b8544a2ce959f32c2db4
|
||||
timeCreated: 1528709140
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,60 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using System.Collections;
|
||||
|
||||
public class UIDLProgress : MonoBehaviour
|
||||
{
|
||||
private Text _text = null;
|
||||
|
||||
private bool isVisible = false;
|
||||
|
||||
// Use this for initialization
|
||||
void Start()
|
||||
{
|
||||
_text = base.transform.Find("DLProgress").gameObject.GetComponent<Text>();
|
||||
|
||||
if (AssetManager.instance != null)
|
||||
{
|
||||
AssetManager.instance.DLProgress = base.gameObject;
|
||||
}
|
||||
|
||||
base.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
if (isVisible != gameObject.activeSelf)
|
||||
{
|
||||
gameObject.SetActive(isVisible);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
if (AssetManager.instance != null)
|
||||
{
|
||||
AssetManager.instance.DLProgress = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void SetText(string text)
|
||||
{
|
||||
if (_text != null)
|
||||
{
|
||||
if (_text.text != text)
|
||||
{
|
||||
_text.text = text;
|
||||
if (_text.text == "")
|
||||
{
|
||||
isVisible = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
isVisible = true;
|
||||
}
|
||||
gameObject.SetActive(isVisible);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e3507a117ada0ba42876da31307acc1a
|
||||
timeCreated: 1529930956
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,346 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public class UIDressView : MonoBehaviour
|
||||
{
|
||||
|
||||
[SerializeField]
|
||||
private GameObject dressIcon;
|
||||
|
||||
[SerializeField]
|
||||
private List<GameObject> dressBtnList;
|
||||
|
||||
[SerializeField]
|
||||
private List<GameObject> dressBtnListAppend;
|
||||
|
||||
private int charaID = -1;
|
||||
private int clickPlace = -1;
|
||||
|
||||
private GameObject CharaDress;
|
||||
private Transform content;
|
||||
|
||||
private GameObject AllDress;
|
||||
private Transform contentAppend;
|
||||
|
||||
private ToggleSwitch AppendSwitch;
|
||||
|
||||
private UIManagerDress uIManagerDress;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
base.name = base.name.Replace("(Clone)", "");
|
||||
WindowSizeSetter();
|
||||
|
||||
CharaDress = transform.Find("Content/DressList").gameObject;
|
||||
AllDress = transform.Find("Content/DressListAppend").gameObject;
|
||||
|
||||
content = transform.Find("Content/DressList/Viewport/Content");
|
||||
contentAppend = transform.Find("Content/DressListAppend/Viewport/Content");
|
||||
|
||||
AppendSwitch = transform.Find("Header/AppendDress").GetComponent<ToggleSwitch>();
|
||||
|
||||
uIManagerDress = GameObject.Find("UIManager").GetComponent<UIManagerDress>();
|
||||
|
||||
OnChangePageToggle();
|
||||
|
||||
}
|
||||
|
||||
private void WindowSizeSetter()
|
||||
{
|
||||
//ウィンドウのサイズを取得
|
||||
Vector2 windowSize = GameObject.Find("Canvas").GetComponent<RectTransform>().sizeDelta;
|
||||
|
||||
//レイアウトを取得
|
||||
GridLayoutGroup gridLayoutGroup = base.GetComponentInChildren<GridLayoutGroup>();
|
||||
float contentXsize = gridLayoutGroup.cellSize.x + gridLayoutGroup.spacing.x;
|
||||
|
||||
//自分のサイズを取得
|
||||
Vector2 mysize = GetComponent<RectTransform>().sizeDelta;
|
||||
|
||||
Vector2 setSize;
|
||||
setSize.x = 67f;
|
||||
|
||||
//横コンテンツ数は最大7個
|
||||
for (int i = 0; i < 7; i++)
|
||||
{
|
||||
if (setSize.x + contentXsize > windowSize.x)
|
||||
{
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
//横幅に余裕があるなら増やしていく
|
||||
setSize.x += contentXsize;
|
||||
}
|
||||
}
|
||||
|
||||
//縦サイズ
|
||||
//デフォルトサイズをセット
|
||||
setSize.y = mysize.y;
|
||||
//縦長の場合
|
||||
if (windowSize.y > windowSize.x)
|
||||
{
|
||||
if (windowSize.y > 1000f)
|
||||
{
|
||||
setSize.y = 950f;
|
||||
}
|
||||
}
|
||||
|
||||
GetComponent<RectTransform>().sizeDelta = setSize;
|
||||
}
|
||||
|
||||
// Use this for initialization
|
||||
void Start()
|
||||
{
|
||||
StartCoroutine(CreateALLDressButtons());
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
//別キャラ衣装はデフォルトで非選択
|
||||
AppendSwitch.isOn = true;
|
||||
StartCoroutine(CreateDressButtons());
|
||||
}
|
||||
|
||||
private void OnDisable()
|
||||
{
|
||||
RemoveIcons();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 閉じるボタンクリック
|
||||
/// </summary>
|
||||
public void OnDressViewClose()
|
||||
{
|
||||
base.gameObject.SetActive(false);
|
||||
//Destroy(base.gameObject);
|
||||
}
|
||||
|
||||
public void SetCharaID(int chara)
|
||||
{
|
||||
charaID = chara;
|
||||
}
|
||||
|
||||
public void SetClickPlace(int place)
|
||||
{
|
||||
clickPlace = place;
|
||||
}
|
||||
|
||||
private void RemoveIcons()
|
||||
{
|
||||
if(dressBtnList != null && dressBtnList.Count > 0)
|
||||
{
|
||||
foreach(var tmp in dressBtnList)
|
||||
{
|
||||
Destroy(tmp);
|
||||
}
|
||||
dressBtnList.Clear();
|
||||
dressBtnList = null;
|
||||
}
|
||||
}
|
||||
|
||||
private IEnumerator CreateALLDressButtons()
|
||||
{
|
||||
//DB読み込み待ち
|
||||
while (true)
|
||||
{
|
||||
if (MasterDBManager.instance.isLoadDB && AssetManager.instance.isManifestLoad)
|
||||
{
|
||||
break;
|
||||
}
|
||||
if (MasterDBManager.instance.isError || ManifestManager.instance.isError)
|
||||
{
|
||||
yield break;
|
||||
}
|
||||
yield return null;
|
||||
}
|
||||
|
||||
List<SQDressData> dressList = new List<SQDressData>();
|
||||
|
||||
//SSR衣装
|
||||
var ssr = uIManagerDress.GetALLSSRDresses();
|
||||
dressList.AddRange(ssr);
|
||||
var april = uIManagerDress.GetAprilDresses();
|
||||
dressList.AddRange(april);
|
||||
|
||||
uIManagerDress.DownloadDressIcons(dressList);
|
||||
//アイコン辞書に登録
|
||||
foreach (var tmp in dressList)
|
||||
{
|
||||
StartCoroutine(uIManagerDress.CreateSprite(tmp.dressIconKey));
|
||||
}
|
||||
|
||||
yield return null;
|
||||
|
||||
dressBtnListAppend = new List<GameObject>(dressList.Count);
|
||||
foreach (var tmp in dressList)
|
||||
{
|
||||
GameObject btn = Instantiate(dressIcon);
|
||||
dressBtnListAppend.Add(btn);
|
||||
//並列で実行
|
||||
StartCoroutine(MakeButton(tmp, btn, contentAppend));
|
||||
}
|
||||
}
|
||||
|
||||
private IEnumerator CreateDressButtons()
|
||||
{
|
||||
//DB読み込み待ち
|
||||
while (true)
|
||||
{
|
||||
if (MasterDBManager.instance.isLoadDB && AssetManager.instance.isManifestLoad)
|
||||
{
|
||||
break;
|
||||
}
|
||||
if (MasterDBManager.instance.isError || ManifestManager.instance.isError)
|
||||
{
|
||||
yield break;
|
||||
}
|
||||
yield return null;
|
||||
}
|
||||
|
||||
//キャラIDセット待ち
|
||||
while (charaID == -1)
|
||||
{
|
||||
yield return null;
|
||||
}
|
||||
|
||||
List<SQDressData> dressList = new List<SQDressData>();
|
||||
//ちひろ、最上、ジュリアは共通衣装選択可能にする
|
||||
if(charaID == 20 || charaID == 313 || charaID == 314)
|
||||
{
|
||||
dressList.AddRange(uIManagerDress.GetCommonDresses());
|
||||
}
|
||||
dressList.AddRange(uIManagerDress.GetDressDataFromCharaID(charaID));
|
||||
|
||||
yield return null;
|
||||
|
||||
//Managerを取得
|
||||
StartCoroutine(uIManagerDress.DownloadAndCreateDressIcons(charaID));
|
||||
|
||||
dressBtnList = new List<GameObject>(dressList.Count);
|
||||
foreach (var tmp in dressList)
|
||||
{
|
||||
GameObject btn = Instantiate(dressIcon);
|
||||
dressBtnList.Add(btn);
|
||||
//並列で実行
|
||||
StartCoroutine(MakeButton(tmp, btn,content));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ボタン生成単体
|
||||
/// </summary>
|
||||
private IEnumerator MakeButton(SQDressData data, GameObject buttonObj,Transform parent)
|
||||
{
|
||||
//keyをオブジェクト名に設定。iconkeyではない
|
||||
buttonObj.name = data.activeDressID.ToString();
|
||||
|
||||
//ドレス名を名前に設定
|
||||
string text = data.dressKeyName;
|
||||
text = text.Replace("]", "]\n");
|
||||
buttonObj.transform.GetComponentInChildren<Text>().text = text;
|
||||
|
||||
//ボタンにアクションを設定
|
||||
Button button = buttonObj.transform.GetComponentInChildren<Button>();
|
||||
AddDressButtonEvent(button, data);
|
||||
|
||||
//親を設定
|
||||
buttonObj.transform.SetParent(parent, false);
|
||||
|
||||
//Managerを取得
|
||||
Sprite icondata = null;
|
||||
|
||||
//ICON取得待ち
|
||||
while (true)
|
||||
{
|
||||
icondata = uIManagerDress.GetIconSprite(data.dressIconKey);
|
||||
if (icondata != null)
|
||||
{
|
||||
break;
|
||||
}
|
||||
yield return null;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
//ボタンアイコン変更
|
||||
Image img = buttonObj.transform.Find("Button").GetComponent<Image>();
|
||||
img.sprite = icondata;
|
||||
}
|
||||
catch (MissingComponentException e)
|
||||
{
|
||||
//ボタンの生成前にDressViewを閉じた場合エラーをはくため
|
||||
print(e);
|
||||
}
|
||||
}
|
||||
|
||||
// ボタンに機能を付与する
|
||||
private void AddDressButtonEvent(Button button, SQDressData data)
|
||||
{
|
||||
button.onClick.AddListener(() =>
|
||||
{
|
||||
this.OnClick(data);
|
||||
base.gameObject.SetActive(false);
|
||||
//Destroy(base.gameObject);
|
||||
});
|
||||
}
|
||||
|
||||
private void OnClick(SQDressData data)
|
||||
{
|
||||
SelectDress(data.activeDressID, data.dressIconKey);
|
||||
}
|
||||
|
||||
private void SelectDress(int dressKey, int dressIcon = -1)
|
||||
{
|
||||
if (dressIcon == -1)
|
||||
{
|
||||
dressIcon = dressKey;
|
||||
}
|
||||
|
||||
|
||||
//アイコンセット
|
||||
UIIdolSelect idolselect = GameObject.Find("Canvas/Panel/LiveContent/IdolInfo").GetComponent<UIIdolSelect>();
|
||||
StartCoroutine(idolselect.DressIconSetter(dressKey, dressIcon, this.clickPlace));
|
||||
|
||||
/*
|
||||
if (clickPlace < 9)
|
||||
{
|
||||
//アイコンセット
|
||||
UIIdolSelect idolselect = GameObject.Find("Canvas/Panel/LiveContent/IdolInfo").GetComponent<UIIdolSelect>();
|
||||
StartCoroutine(idolselect.DressIconSetter(dressKey, dressIcon, this.clickPlace));
|
||||
}
|
||||
else
|
||||
{
|
||||
//フォトスタジオ
|
||||
UIPhotoStudioChara photoStudioChara = GameObject.Find("Canvas/Panel/PhotoStudio/PhotoStudioIdolSelect").GetComponent<UIPhotoStudioChara>();
|
||||
if (photoStudioChara != null)
|
||||
{
|
||||
StartCoroutine(photoStudioChara.DressIconSetter(dressKey, dressIcon, this.clickPlace));
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
public void OnChangePageToggle()
|
||||
{
|
||||
if (AppendSwitch.isOn)
|
||||
{
|
||||
CharaDress.SetActive(true);
|
||||
AllDress.SetActive(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
CharaDress.SetActive(false);
|
||||
AllDress.SetActive(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bec35d863d0d7cf499fe55d52d372de1
|
||||
timeCreated: 1528798581
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,69 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class UIEffectSettingView : MonoBehaviour
|
||||
{
|
||||
[SerializeField]
|
||||
private GameObject contentPrefab;
|
||||
private GameObject content;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
base.name = base.name.Replace("(Clone)", "");
|
||||
Transform transform = base.transform.Find("Content/ScrollView/Viewport/Content");
|
||||
content = GameObject.Instantiate(contentPrefab);
|
||||
content.transform.SetParent(transform, false);
|
||||
|
||||
WindowSizeSetter();
|
||||
}
|
||||
|
||||
private void WindowSizeSetter()
|
||||
{
|
||||
//ウィンドウのサイズを取得
|
||||
Vector2 windowSize = GameObject.Find("Canvas").GetComponent<RectTransform>().sizeDelta;
|
||||
|
||||
//自分のサイズを取得
|
||||
Vector3 mylocalScale = GetComponent<RectTransform>().localScale;
|
||||
Vector2 mysize = GetComponent<RectTransform>().sizeDelta;
|
||||
|
||||
//縦長の場合
|
||||
if (windowSize.y > windowSize.x)
|
||||
{
|
||||
//はみ出すため小さくする
|
||||
mylocalScale.x = 0.8f;
|
||||
mylocalScale.y = 0.8f;
|
||||
|
||||
//縦長に変更
|
||||
if (windowSize.y > 1160f)
|
||||
{
|
||||
mysize.y = 1100f;
|
||||
}
|
||||
}
|
||||
|
||||
GetComponent<RectTransform>().localScale = mylocalScale;
|
||||
GetComponent<RectTransform>().sizeDelta = mysize;
|
||||
}
|
||||
|
||||
// Use this for initialization
|
||||
void Start()
|
||||
{
|
||||
ScrollRect scrollRect = base.transform.Find("Content/ScrollView").GetComponent<ScrollRect>();
|
||||
scrollRect.verticalNormalizedPosition = 1;
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 閉じるボタンクリック
|
||||
/// </summary>
|
||||
public void OnClockClose()
|
||||
{
|
||||
Destroy(base.gameObject);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 412c71336f0257043b28f20b17d56d04
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,21 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class UIErrorNotice : MonoBehaviour {
|
||||
|
||||
// Use this for initialization
|
||||
void Start () {
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update () {
|
||||
|
||||
}
|
||||
|
||||
public void OnClickClose()
|
||||
{
|
||||
Destroy(base.gameObject);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5291d820378ea7740a583a2fbe99a204
|
||||
timeCreated: 1535532481
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,564 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public class UIIdolSelect : MonoBehaviour
|
||||
{
|
||||
//prefab
|
||||
[SerializeField]
|
||||
private GameObject UnitView;
|
||||
|
||||
protected GameObject UIManager = null;
|
||||
|
||||
[SerializeField]
|
||||
public GameObject[] charas;
|
||||
[SerializeField]
|
||||
public GameObject[] dresses;
|
||||
|
||||
private GameObject IdolSelect;
|
||||
private GameObject IdolSelectAnother;
|
||||
|
||||
private ToggleSwitch IdolSwitch;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
Transform switchtrans = base.transform.Find("IdolSelectSwitch");
|
||||
if (switchtrans != null) { IdolSwitch = switchtrans.GetComponent<ToggleSwitch>(); }
|
||||
|
||||
Transform livetrans = base.transform.Find("IdolSelect");
|
||||
if (livetrans != null) { IdolSelect = livetrans.gameObject; }
|
||||
|
||||
livetrans = base.transform.Find("IdolSelectAnother");
|
||||
if (livetrans != null) { IdolSelectAnother = livetrans.gameObject; }
|
||||
}
|
||||
|
||||
// Use this for initialization
|
||||
void Start()
|
||||
{
|
||||
UIManager = GameObject.Find("UIManager");
|
||||
|
||||
//CharaViewの呼び出しに使う番号を付与
|
||||
for (int i = 0; i < charas.Length; i++)
|
||||
{
|
||||
Button button = charas[i].transform.GetComponentInChildren<Button>();
|
||||
AddCharaViewEvent(button, i);
|
||||
}
|
||||
//DressViewの呼び出しに使う番号を付与
|
||||
for (int i = 0; i < dresses.Length; i++)
|
||||
{
|
||||
Button button = dresses[i].transform.GetComponentInChildren<Button>();
|
||||
AddDressViewEvent(button, i);
|
||||
}
|
||||
|
||||
//セーブデータを読み込む
|
||||
LoadingSavedata();
|
||||
|
||||
OnChangeIdolSelectToggle();
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
//読みに行く
|
||||
if (UIManager == null)
|
||||
{
|
||||
UIManager = GameObject.Find("UIManager");
|
||||
}
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
if (UIManager != null)
|
||||
{
|
||||
ReLoadIcons();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// セーブデータを読み込み
|
||||
/// </summary>
|
||||
private void LoadingSavedata()
|
||||
{
|
||||
//セーブの読み込み
|
||||
int isplus = SaveManager.GetInt("SSRIcon");
|
||||
if (isplus == 1)
|
||||
{
|
||||
SQDressData.isPlus = true;
|
||||
}
|
||||
|
||||
//アイコンファイルを列挙
|
||||
List<string> filelist = new List<string>(30);
|
||||
|
||||
int[] chara = new int[charas.Length];
|
||||
int[] charaIcon = new int[charas.Length];
|
||||
for (int i = 0; i < chara.Length; i++)
|
||||
{
|
||||
chara[i] = SaveManager.GetChara(i);
|
||||
charaIcon[i] = SaveManager.GetCharaIcon(i);
|
||||
if (chara[i] != 0)
|
||||
{
|
||||
filelist.Add(string.Format("chara_icon_{0:000}_m.unity3d", charaIcon[i]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int[] dress = new int[dresses.Length];
|
||||
int[] dressIcon = new int[dresses.Length];
|
||||
for (int i = 0; i < dresses.Length; i++)
|
||||
{
|
||||
dress[i] = SaveManager.GetDress(i);
|
||||
dressIcon[i] = SaveManager.GetDressIcon(i);
|
||||
if (dress[i] != 0)
|
||||
{
|
||||
filelist.Add(SQDressData.getIconfilename(dressIcon[i]));
|
||||
}
|
||||
}
|
||||
|
||||
//アイコンファイルをDL
|
||||
StartCoroutine(AssetManager.instance.DownloadFromFilenamesAsync(filelist));
|
||||
|
||||
//アイコンに設定
|
||||
for (int i = 0; i < charas.Length; i++)
|
||||
{
|
||||
if (chara[i] != 0)
|
||||
{
|
||||
StartCoroutine(CharaIconSetter(chara[i], charaIcon[i], i));
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < dresses.Length; i++)
|
||||
{
|
||||
if (dress[i] != 0)
|
||||
{
|
||||
StartCoroutine(DressIconSetter(dress[i], dressIcon[i], i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// キャラアイコンを変更する
|
||||
/// </summary>
|
||||
public void SetCharaIcon(int charaID, int charaIcon, int clickPlace)
|
||||
{
|
||||
StartCoroutine(CharaIconSetter(charaID, charaIcon, clickPlace));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// キャラアイコンを変更する
|
||||
/// </summary>
|
||||
public virtual IEnumerator CharaIconSetter(int charaID, int charaIcon, int charaPlace)
|
||||
{
|
||||
if (charaPlace < 0)
|
||||
{
|
||||
yield break;
|
||||
}
|
||||
|
||||
if (charaIcon <= 0)
|
||||
{
|
||||
Sprite sprite = Resources.Load<Sprite>("RandomChara");
|
||||
Image img = charas[charaPlace].GetComponent<Image>();
|
||||
img.sprite = sprite;
|
||||
|
||||
yield break;
|
||||
}
|
||||
//キャラクタが変更になった場合、ドレスアイコンを変更
|
||||
int currentChara = SaveManager.GetChara(charaPlace);
|
||||
if (currentChara != charaID)
|
||||
{
|
||||
//dressIcon=1 ※初期ドレスに設定
|
||||
int setDress = 1;
|
||||
int setDressIcon = 1;
|
||||
switch (charaID)
|
||||
{
|
||||
case 20:
|
||||
setDress = 9001;
|
||||
setDressIcon = 900001;
|
||||
break;
|
||||
case 48:
|
||||
setDress = 9002;
|
||||
setDressIcon = 900009;
|
||||
break;
|
||||
case 49:
|
||||
setDress = 9003;
|
||||
setDressIcon = 900011;
|
||||
break;
|
||||
case 50:
|
||||
setDress = 9004;
|
||||
setDressIcon = 900013;
|
||||
break;
|
||||
case 83:
|
||||
setDress = 9005;
|
||||
setDressIcon = 900019;
|
||||
break;
|
||||
case 672:
|
||||
setDress = 9007;
|
||||
setDressIcon = 900026;
|
||||
break;
|
||||
case 682:
|
||||
setDress = 9008;
|
||||
setDressIcon = 900028;
|
||||
break;
|
||||
case 701:
|
||||
setDress = 9009;
|
||||
setDressIcon = 900030;
|
||||
break;
|
||||
case 725:
|
||||
setDress = 9031;
|
||||
setDressIcon = 900074;
|
||||
break;
|
||||
case 726:
|
||||
setDress = 9032;
|
||||
setDressIcon = 900076;
|
||||
break;
|
||||
}
|
||||
StartCoroutine(DressIconSetter(setDress, setDressIcon, charaPlace));
|
||||
}
|
||||
|
||||
UIManagerChara uIManagerChara = UIManager.GetComponent<UIManagerChara>();
|
||||
|
||||
//スプライトを割り込みで生成
|
||||
//無ければ作るし、あったら戻ってくる
|
||||
StartCoroutine(uIManagerChara.CreateSprite(charaIcon));
|
||||
|
||||
SaveManager.SetChara(charaPlace, charaID);
|
||||
SaveManager.SetCharaIcon(charaPlace, charaIcon);
|
||||
SaveManager.Save();
|
||||
|
||||
Sprite sp = uIManagerChara.GetIconSprite(charaIcon);
|
||||
if (sp == null)
|
||||
{
|
||||
//nullが返ってくる場合はまだSpriteが作成中の時に呼んでしまった可能性がある
|
||||
|
||||
while (true)
|
||||
{
|
||||
sp = uIManagerChara.GetIconSprite(charaIcon);
|
||||
if (sp != null)
|
||||
{
|
||||
break;
|
||||
}
|
||||
yield return null;
|
||||
}
|
||||
}
|
||||
Image image = charas[charaPlace].GetComponent<Image>();
|
||||
image.sprite = sp;
|
||||
|
||||
//センターの変更の場合はソロ曲チェック
|
||||
if (charaPlace == 2)
|
||||
{
|
||||
UIManagerMusic uIManagerMusic = UIManager.GetComponent<UIManagerMusic>();
|
||||
while (!uIManagerMusic.isLoad)
|
||||
{
|
||||
yield return null;
|
||||
}
|
||||
uIManagerMusic.CheckSoloSong();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ドレスアイコンを変更する
|
||||
/// </summary>
|
||||
public void SetDressIcon(int dressID, int dressIcon, int clickPlace)
|
||||
{
|
||||
StartCoroutine(DressIconSetter(dressID, dressIcon, clickPlace));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ドレスアイコンを変更する
|
||||
/// </summary>
|
||||
public virtual IEnumerator DressIconSetter(int dressID, int dressIcon, int dressPlace)
|
||||
{
|
||||
if (dressPlace < 0)
|
||||
{
|
||||
yield break;
|
||||
}
|
||||
|
||||
if (dressIcon < 0)
|
||||
{
|
||||
Sprite sprite = Resources.Load<Sprite>("RandomDress");
|
||||
Image img = dresses[dressPlace].GetComponent<Image>();
|
||||
img.sprite = sprite;
|
||||
|
||||
yield break;
|
||||
}
|
||||
|
||||
UIManagerDress uIManagerDress = UIManager.GetComponent<UIManagerDress>();
|
||||
|
||||
//割り込みで読み込む
|
||||
StartCoroutine(uIManagerDress.CreateSprite(dressIcon));
|
||||
|
||||
SaveManager.SetDress(dressPlace, dressID);
|
||||
SaveManager.SetDressIcon(dressPlace, dressIcon);
|
||||
SaveManager.Save();
|
||||
|
||||
Sprite sp = uIManagerDress.GetIconSprite(dressIcon);
|
||||
if (sp == null)
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
sp = uIManagerDress.GetIconSprite(dressIcon);
|
||||
if (sp != null)
|
||||
{
|
||||
break;
|
||||
}
|
||||
yield return null;
|
||||
}
|
||||
}
|
||||
Image image = dresses[dressPlace].GetComponent<Image>();
|
||||
image.sprite = sp;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// キャラボタンにイベントを設置
|
||||
/// </summary>
|
||||
protected void AddCharaViewEvent(Button button, int num)
|
||||
{
|
||||
button.onClick.AddListener(() =>
|
||||
{
|
||||
this.OnClickCharaSelect(num);
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// イベント処理
|
||||
/// </summary>
|
||||
protected void OnClickCharaSelect(int num)
|
||||
{
|
||||
//print("キャラ選択アイコン:" + num);
|
||||
GameObject obj = GameObject.Find("Canvas");
|
||||
Transform tf = obj.transform.Find("CharaView");
|
||||
if (tf != null)
|
||||
{
|
||||
tf.gameObject.SetActive(true);
|
||||
var tmp = tf.gameObject.GetComponent<UICharaView>();
|
||||
tmp.SetClickPlace(num);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIManagerChara mc = UIManager.GetComponent<UIManagerChara>();
|
||||
if (mc.isLoad)
|
||||
{
|
||||
mc.CreateCharaView(num);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ドレスボタンにイベントを設置
|
||||
/// </summary>
|
||||
protected void AddDressViewEvent(Button button, int num)
|
||||
{
|
||||
button.onClick.AddListener(() =>
|
||||
{
|
||||
this.OnClickDressSelect(num);
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// イベント処理
|
||||
/// </summary>
|
||||
protected void OnClickDressSelect(int num)
|
||||
{
|
||||
//print("ドレス選択アイコン:" + num);
|
||||
GameObject obj = GameObject.Find("Canvas");
|
||||
Transform tf = obj.transform.Find("DressView");
|
||||
|
||||
int currentChara = SaveManager.GetChara(num);
|
||||
if (currentChara <= 0)
|
||||
{
|
||||
//選択されていない時は0、初期値は-1
|
||||
print("キャラクタが選択されていません");
|
||||
}
|
||||
else
|
||||
{
|
||||
UIManagerDress md = UIManager.GetComponent<UIManagerDress>();
|
||||
|
||||
if (tf != null)
|
||||
{
|
||||
var tmp = tf.gameObject.GetComponent<UIDressView>();
|
||||
tmp.SetCharaID(currentChara);
|
||||
tmp.SetClickPlace(num);
|
||||
tf.gameObject.SetActive(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (md.isLoad)
|
||||
{
|
||||
md.CreateDressView(currentChara, num);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void ReLoadIcons()
|
||||
{
|
||||
LoadingSavedata();
|
||||
}
|
||||
|
||||
public void OnClickReset()
|
||||
{
|
||||
ResetSelection();
|
||||
}
|
||||
|
||||
public void OnClickRandom()
|
||||
{
|
||||
StartCoroutine(RandomSelect());
|
||||
}
|
||||
|
||||
private void ResetSelection()
|
||||
{
|
||||
for (int i = 0; i < charas.Length; i++)
|
||||
{
|
||||
StartCoroutine(CharaIconSetter(-1, -1, i));
|
||||
SaveManager.SetChara(i, 0);
|
||||
SaveManager.SetCharaIcon(i, 0);
|
||||
}
|
||||
|
||||
for (int i = 0; i < dresses.Length; i++)
|
||||
{
|
||||
StartCoroutine(DressIconSetter(-1, -1, i));
|
||||
SaveManager.SetDress(i, 0);
|
||||
SaveManager.SetDressIcon(i, 0);
|
||||
}
|
||||
SaveManager.Save();
|
||||
}
|
||||
|
||||
private IEnumerator RandomSelect()
|
||||
{
|
||||
UIManagerChara mc = UIManager.GetComponent<UIManagerChara>();
|
||||
UIManagerDress md = UIManager.GetComponent<UIManagerDress>();
|
||||
int save = SaveManager.GetInt("RandomMemberSet");
|
||||
bool onlyAnother = false;
|
||||
//アナザーメンバーが選択されている
|
||||
if (IdolSelectAnother.activeInHierarchy)
|
||||
{
|
||||
onlyAnother = true;
|
||||
}
|
||||
|
||||
SQCharaData[] charaDatas = new SQCharaData[charas.Length];
|
||||
|
||||
for (int i = 0; i < charaDatas.Length; i++)
|
||||
{
|
||||
if (onlyAnother)
|
||||
{
|
||||
//0~4まではスキップ
|
||||
if (i < 5) continue;
|
||||
}
|
||||
charaDatas[i] = mc.GetRandomCharaDataWithoutAprilfool();
|
||||
if (charaDatas[i] == null) { yield break; }
|
||||
StartCoroutine(CharaIconSetter(charaDatas[i].charaID, charaDatas[i].iconID, i));
|
||||
StartCoroutine(md.DownloadAndCreateDressIcons(charaDatas[i].charaID));
|
||||
}
|
||||
|
||||
yield return null;
|
||||
|
||||
for (int i = 0; i < charaDatas.Length; i++)
|
||||
{
|
||||
if (onlyAnother)
|
||||
{
|
||||
//0~4まではスキップ
|
||||
if (i < 5) continue;
|
||||
}
|
||||
|
||||
if (charaDatas[i].charaID > 0)
|
||||
{
|
||||
//ドレスが指定されていない場合の処理
|
||||
switch (save)
|
||||
{
|
||||
case 0:
|
||||
//StartCoroutine(DressIconSetter(1, 1, i));
|
||||
break;
|
||||
case 1:
|
||||
{
|
||||
List<SQDressData> dressList = md.GetDressDataFromCharaID(charaDatas[i].charaID);
|
||||
if (dressList != null)
|
||||
{
|
||||
int iResult2 = Random.Range(0, dressList.Count);
|
||||
|
||||
StartCoroutine(DressIconSetter(dressList[iResult2].activeDressID, dressList[iResult2].dressIconKey, i));
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
{
|
||||
List<SQDressData> dressList = md.GetSSRDressesFromCharaID(charaDatas[i].charaID);
|
||||
if (dressList != null && dressList.Count != 0)
|
||||
{
|
||||
int iResult2 = Random.Range(0, dressList.Count);
|
||||
|
||||
StartCoroutine(DressIconSetter(dressList[iResult2].activeDressID, dressList[iResult2].dressIconKey, i));
|
||||
}
|
||||
else
|
||||
{
|
||||
goto case 1;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
/*
|
||||
List<SQDressData> dressList = null;
|
||||
if (RandomMemberSet == 0)
|
||||
{
|
||||
//デフォルト衣装
|
||||
StartCoroutine(DressIconSetter(0, 0, i));
|
||||
}
|
||||
else if (RandomMemberSet == 2)
|
||||
{
|
||||
dressList = MasterDBManager.instance.GetSSRDressesFromCharaID(charaDatas[i].charaID);
|
||||
}
|
||||
if (dressList == null || dressList.Count == 0)
|
||||
{
|
||||
dressList = md.GetDressDataFromCharaID(charaDatas[i].charaID);
|
||||
}
|
||||
if (dressList != null && dressList.Count > 0)
|
||||
{
|
||||
int iResult2 = Random.Range(0, dressList.Count);
|
||||
|
||||
StartCoroutine(AssetManager.instance.DownloadFromFilename(SQDressData.getIconfilename(dressList[iResult2].iconkey)));
|
||||
StartCoroutine(DressIconSetter(dressList[iResult2].key, dressList[iResult2].iconkey, i));
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// IdolSelectとIdolSelectAnotherを切り替えるスイッチ
|
||||
/// </summary>
|
||||
public void OnChangeIdolSelectToggle()
|
||||
{
|
||||
if (IdolSwitch.isOn)
|
||||
{
|
||||
IdolSelect.SetActive(true);
|
||||
IdolSelectAnother.SetActive(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
IdolSelect.SetActive(false);
|
||||
IdolSelectAnother.SetActive(true);
|
||||
}
|
||||
}
|
||||
|
||||
public void OnClickUnitSelectButton()
|
||||
{
|
||||
//print("ドレス選択アイコン:" + num);
|
||||
GameObject obj = GameObject.Find("Canvas");
|
||||
Transform tf = obj.transform.Find("IdolUnitListView");
|
||||
|
||||
if (tf != null)
|
||||
{
|
||||
//var tmp = tf.gameObject.GetComponent<UIIdolUnitListView>();
|
||||
tf.gameObject.SetActive(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
//prefabを実装
|
||||
GameObject gameObject = GameObject.Instantiate(UnitView);
|
||||
|
||||
Transform transform = GameObject.Find("Canvas").transform;
|
||||
|
||||
//Panel下に実装
|
||||
gameObject.transform.SetParent(transform, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 68f1d97672c7be94a89571ddb7eb499c
|
||||
timeCreated: 1528789189
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,219 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class UIIdolUnitListView : MonoBehaviour
|
||||
{
|
||||
//Prefab
|
||||
[SerializeField]
|
||||
private GameObject UnitIcon;
|
||||
|
||||
private Transform content;
|
||||
|
||||
private GameObject UIManager = null;
|
||||
|
||||
private GameObject IdolInfo = null;
|
||||
|
||||
private List<GameObject> unitBtnList = new List<GameObject>();
|
||||
|
||||
private ScrollRect scrollRect;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
base.name = base.name.Replace("(Clone)", "");
|
||||
|
||||
content = base.transform.Find("Content/UnitList/Viewport/Content").GetComponent<RectTransform>();
|
||||
scrollRect = base.transform.Find("Content/UnitList").GetComponent<ScrollRect>();
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
Save();
|
||||
}
|
||||
|
||||
private void WindowSizeSetter()
|
||||
{
|
||||
//ウィンドウのサイズを取得
|
||||
Vector2 windowSize = GameObject.Find("Canvas").GetComponent<RectTransform>().sizeDelta;
|
||||
|
||||
//自分のサイズを取得
|
||||
Vector3 mylocalScale = GetComponent<RectTransform>().localScale;
|
||||
Vector2 mysize = GetComponent<RectTransform>().sizeDelta;
|
||||
|
||||
//縦長の場合
|
||||
if (windowSize.y > windowSize.x)
|
||||
{
|
||||
//はみ出すため小さくする
|
||||
//mylocalScale.x = 0.7f;
|
||||
//mylocalScale.y = 0.8f;
|
||||
|
||||
//縦長に変更
|
||||
if (windowSize.y > 1160f)
|
||||
{
|
||||
mysize.y = 1250f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Use this for initialization
|
||||
void Start()
|
||||
{
|
||||
UIManager = GameObject.Find("UIManager");
|
||||
//多分ないけど非表示の時のため
|
||||
var obj = GameObject.Find("Panel");
|
||||
IdolInfo = obj.transform.Find("LiveContent/IdolInfo").gameObject;
|
||||
|
||||
CreateUnitButtons();
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void CreateUnitButtons()
|
||||
{
|
||||
List<SaveManager.IdolSet> unitlist = SaveManager.GetUnitList();
|
||||
if (unitBtnList == null)
|
||||
{
|
||||
unitBtnList = new List<GameObject>();
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach(var tmp in unitBtnList)
|
||||
{
|
||||
Destroy(tmp);
|
||||
}
|
||||
unitBtnList.Clear();
|
||||
}
|
||||
|
||||
if (unitlist == null) return;
|
||||
|
||||
//ボタンを生成
|
||||
foreach (var tmp in unitlist)
|
||||
{
|
||||
GameObject btn = Instantiate(UnitIcon);
|
||||
unitBtnList.Add(btn);
|
||||
StartCoroutine(MakeButton(tmp, btn));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ボタン生成単体
|
||||
/// </summary>
|
||||
private IEnumerator MakeButton(SaveManager.IdolSet data, GameObject btn)
|
||||
{
|
||||
//Awakeが動くまで待ち
|
||||
yield return null;
|
||||
|
||||
UIUnitPanel uIUnitPanel = btn.GetComponent<UIUnitPanel>();
|
||||
AddButtonEvent(uIUnitPanel.btSelect, uIUnitPanel);
|
||||
|
||||
UIManagerChara uIManagerChara = UIManager.GetComponent<UIManagerChara>();
|
||||
|
||||
uIUnitPanel.SetIdolUnit(data);
|
||||
|
||||
//スプライトを割り込みで生成
|
||||
//無ければ作るし、あったら戻ってくる
|
||||
StartCoroutine(IconSetter(uIUnitPanel.chara0, data.charaIcon0));
|
||||
StartCoroutine(IconSetter(uIUnitPanel.chara1, data.charaIcon1));
|
||||
StartCoroutine(IconSetter(uIUnitPanel.chara2, data.charaIcon2));
|
||||
StartCoroutine(IconSetter(uIUnitPanel.chara3, data.charaIcon3));
|
||||
StartCoroutine(IconSetter(uIUnitPanel.chara4, data.charaIcon4));
|
||||
|
||||
//親をセット
|
||||
btn.transform.SetParent(content, false);
|
||||
}
|
||||
|
||||
private IEnumerator IconSetter(GameObject charaIconObj, int iconID)
|
||||
{
|
||||
UIManagerChara uIManagerChara = UIManager.GetComponent<UIManagerChara>();
|
||||
|
||||
StartCoroutine(uIManagerChara.CreateSprite(iconID));
|
||||
|
||||
Sprite sp = uIManagerChara.GetIconSprite(iconID);
|
||||
if (sp == null)
|
||||
{
|
||||
//nullが返ってくる場合はまだSpriteが作成中の時に呼んでしまった可能性がある
|
||||
|
||||
while (true)
|
||||
{
|
||||
sp = uIManagerChara.GetIconSprite(iconID);
|
||||
if (sp != null)
|
||||
{
|
||||
break;
|
||||
}
|
||||
yield return null;
|
||||
}
|
||||
}
|
||||
Image image = charaIconObj.GetComponent<Image>();
|
||||
image.sprite = sp;
|
||||
}
|
||||
|
||||
// ボタンに機能を付与する
|
||||
void AddButtonEvent(Button button, UIUnitPanel uIUnitPanel)
|
||||
{
|
||||
button.onClick.AddListener(() => {
|
||||
this.OnClick(uIUnitPanel);
|
||||
base.gameObject.SetActive(false);
|
||||
});
|
||||
}
|
||||
|
||||
//選択されたとき
|
||||
private void OnClick(UIUnitPanel uIUnitPanel)
|
||||
{
|
||||
SaveManager.SetIdolUnit(uIUnitPanel.data);
|
||||
IdolInfo.GetComponent<UIIdolSelect>().ReLoadIcons();
|
||||
}
|
||||
|
||||
public void OnViewClose()
|
||||
{
|
||||
base.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
public void OnClickAddUnit()
|
||||
{
|
||||
var unit = SaveManager.GetCurrentUnit();
|
||||
|
||||
unit.unitname = "新規ユニット";
|
||||
|
||||
GameObject btn = Instantiate(UnitIcon);
|
||||
unitBtnList.Add(btn);
|
||||
StartCoroutine(MakeButton(unit, btn));
|
||||
|
||||
SaveManager.AddUnit(unit);
|
||||
|
||||
//一番下に移動
|
||||
StartCoroutine(SetScrollRect(0f));
|
||||
}
|
||||
|
||||
public void Save()
|
||||
{
|
||||
var list = content.GetComponentsInChildren<UIUnitPanel>();
|
||||
|
||||
SaveManager.IdolSet[] datas = new SaveManager.IdolSet[list.Length];
|
||||
|
||||
for(int i = 0; i < list.Length; i++)
|
||||
{
|
||||
int place = list[i].transform.GetSiblingIndex();
|
||||
datas[place] = list[i].data;
|
||||
}
|
||||
|
||||
SaveManager.SetUnitList(new List<SaveManager.IdolSet>(datas));
|
||||
SaveManager.Save();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ScrollRectはすぐには変更されないため1フレーム待つ必要がある
|
||||
/// </summary>
|
||||
private IEnumerator SetScrollRect(float pos)
|
||||
{
|
||||
//2フレーム待つ
|
||||
yield return null;
|
||||
yield return null;
|
||||
|
||||
scrollRect.verticalNormalizedPosition = pos;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 64036b83af4c67043a7689930cd8cea2
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,451 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public class UIManagerChara : MonoBehaviour
|
||||
{
|
||||
/*アイコン用prefab*/
|
||||
[SerializeField]
|
||||
private GameObject CharaView;
|
||||
|
||||
/*キャラクタリスト*/
|
||||
private List<SQCharaData> charaList;
|
||||
|
||||
private Dictionary<int, SQCharaData> charaDic;
|
||||
private Dictionary<int, Sprite> iconDic;
|
||||
|
||||
public bool isLoad
|
||||
{
|
||||
get
|
||||
{
|
||||
if (charaList != null)
|
||||
{
|
||||
if (charaList.Count > 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Use this for initialization
|
||||
void Start()
|
||||
{
|
||||
CreateSaveIcon();
|
||||
StartCoroutine(CreateSpriteDic());
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// キャラクタ関連のデータをいったん破棄して読み込み直す
|
||||
/// </summary>
|
||||
public void ResetData()
|
||||
{
|
||||
if (charaList != null)
|
||||
{
|
||||
charaList.Clear();
|
||||
charaList = null;
|
||||
}
|
||||
if (charaDic != null)
|
||||
{
|
||||
charaDic.Clear();
|
||||
charaDic = null;
|
||||
}
|
||||
if (iconDic != null)
|
||||
{
|
||||
iconDic.Clear();
|
||||
iconDic = null;
|
||||
}
|
||||
|
||||
CreateSaveIcon();
|
||||
StartCoroutine(CreateSpriteDic());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// セーブに入っているIconのSpriteを先に生成したい
|
||||
/// </summary>
|
||||
private void CreateSaveIcon()
|
||||
{
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
int iconID = SaveManager.GetCharaIcon(i);
|
||||
if (iconID > 0)
|
||||
{
|
||||
StartCoroutine(CreateSprite(iconID));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// CharaIcon用のSprite辞書を生成する
|
||||
/// </summary>
|
||||
private IEnumerator CreateSpriteDic()
|
||||
{
|
||||
if (iconDic == null)
|
||||
{
|
||||
iconDic = new Dictionary<int, Sprite>();
|
||||
}
|
||||
if (charaDic == null)
|
||||
{
|
||||
charaDic = new Dictionary<int, SQCharaData>();
|
||||
}
|
||||
|
||||
//DB読み込み待ち
|
||||
while (true)
|
||||
{
|
||||
if (MasterDBManager.instance.isLoadDB && AssetManager.instance.isManifestLoad)
|
||||
{
|
||||
break;
|
||||
}
|
||||
if (MasterDBManager.instance.isError || ManifestManager.instance.isError)
|
||||
{
|
||||
yield break;
|
||||
}
|
||||
yield return null;
|
||||
}
|
||||
//キャラリストを取得
|
||||
charaList = MasterDBManager.instance.GetAllCharas();
|
||||
int charaCount = charaList.Count;
|
||||
|
||||
//キャラリストを取得
|
||||
var aprilfools = MasterDBManager.instance.GetAprilfoolCharas();
|
||||
|
||||
charaList.AddRange(aprilfools);
|
||||
|
||||
//キャラリストを取得
|
||||
var vrcharas = MasterDBManager.instance.GetVRCharas();
|
||||
charaList.AddRange(vrcharas);
|
||||
|
||||
List<string> charaIcons = new List<string>(charaCount);
|
||||
foreach (var tmp in charaList)
|
||||
{
|
||||
charaIcons.Add(string.Format("chara_icon_{0:000}_m.unity3d", tmp.iconID));
|
||||
charaDic.Add(tmp.charaID, tmp);
|
||||
}
|
||||
//コルーチンでDLを投げる
|
||||
StartCoroutine(AssetManager.instance.DownloadFromFilenamesAsync(charaIcons));
|
||||
|
||||
AddAprilIconSprite();
|
||||
|
||||
//1フレーム待って、セーブのほうを先に割り込ませる
|
||||
yield return null;
|
||||
|
||||
//アイコン作成
|
||||
foreach (var tmp in charaList)
|
||||
{
|
||||
//並列で実行
|
||||
StartCoroutine(CreateSprite(tmp.iconID));
|
||||
}
|
||||
}
|
||||
|
||||
private void AddSpriteDicResource(int iconID, string resourcename)
|
||||
{
|
||||
Sprite spr = Resources.Load<Sprite>(resourcename);
|
||||
if (spr == null) { return; }
|
||||
|
||||
if (iconDic.ContainsKey(iconID))
|
||||
{
|
||||
if (iconDic[iconID] == null)
|
||||
{
|
||||
iconDic[iconID] = spr;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
iconDic.Add(iconID, spr);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// エイプリルフール曲を追加
|
||||
/// </summary>
|
||||
private void AddAprilIconSprite()
|
||||
{
|
||||
AddSpriteDicResource(20, "chara_icon_chihiro");
|
||||
AddSpriteDicResource(48, "putiuzuki_icon");
|
||||
AddSpriteDicResource(49, "putirin_icon");
|
||||
AddSpriteDicResource(50, "putimio_icon");
|
||||
AddSpriteDicResource(83, "kirarinLobo_Icon");
|
||||
AddSpriteDicResource(672, "staff_icon");
|
||||
AddSpriteDicResource(682, "sana_icon");
|
||||
AddSpriteDicResource(701, "pinya_icon");
|
||||
AddSpriteDicResource(725, "hiromi_icon");
|
||||
AddSpriteDicResource(726, "yuzu_icon");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Spriteを生成し辞書に登録する
|
||||
/// </summary>
|
||||
public IEnumerator CreateSprite(int iconID)
|
||||
{
|
||||
//存在しない場合は終わり
|
||||
if (iconID <= 0)
|
||||
{
|
||||
yield break;
|
||||
}
|
||||
|
||||
string name = string.Format("chara_icon_{0:000}_m.unity3d", iconID);
|
||||
|
||||
//辞書が存在しない
|
||||
if (iconDic == null)
|
||||
{
|
||||
iconDic = new Dictionary<int, Sprite>();
|
||||
}
|
||||
|
||||
//既に登録されている
|
||||
if (iconDic.ContainsKey(iconID))
|
||||
{
|
||||
yield break;
|
||||
}
|
||||
else
|
||||
{
|
||||
//仮登録
|
||||
iconDic.Add(iconID, null);
|
||||
}
|
||||
|
||||
|
||||
//Localのファイル確認
|
||||
while (!AssetManager.instance.CheckFileFromFilename(name))
|
||||
{
|
||||
//マニフェストに存在しない
|
||||
if (!AssetManager.instance.CheckExistFileInManifest(name))
|
||||
{
|
||||
iconDic.Remove(iconID);
|
||||
yield break;
|
||||
}
|
||||
yield return null;
|
||||
}
|
||||
//非同期で読み込み
|
||||
AssetBundleCreateRequest req = AssetManager.instance.LoadAssetFromNameAsync(name);
|
||||
//待ち
|
||||
while (!req.isDone)
|
||||
{
|
||||
yield return null;
|
||||
}
|
||||
AssetBundle bundle = req.assetBundle;
|
||||
|
||||
Sprite tmpSp = null;
|
||||
Texture2D tex2D = null;
|
||||
//非同期でオブジェクトを読み込み
|
||||
AssetBundleRequest textures = bundle.LoadAllAssetsAsync<Texture2D>();
|
||||
while (!textures.isDone)
|
||||
{
|
||||
yield return null;
|
||||
}
|
||||
|
||||
foreach (var obj in textures.allAssets)
|
||||
{
|
||||
if (obj is Texture2D)
|
||||
{
|
||||
if (obj.name.IndexOf("m") >= 0)
|
||||
{
|
||||
tex2D = obj as Texture2D;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Rect rect = new Rect(0, 0, tex2D.width, tex2D.height);
|
||||
tmpSp = Sprite.Create(tex2D, rect, Vector2.zero);
|
||||
|
||||
bundle.Unload(false);
|
||||
|
||||
|
||||
//既に登録されている
|
||||
if (iconDic.ContainsKey(iconID))
|
||||
{
|
||||
if (iconDic[iconID] == null)
|
||||
{
|
||||
iconDic[iconID] = tmpSp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Spriteを取得する
|
||||
/// </summary>
|
||||
public Sprite GetIconSprite(int iconID)
|
||||
{
|
||||
if (iconDic == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
if (iconDic.ContainsKey(iconID))
|
||||
{
|
||||
return iconDic[iconID];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// CharaViewを生成し表示
|
||||
/// </summary>
|
||||
public void CreateCharaView(int ClickPlace)
|
||||
{
|
||||
GameObject obj = Instantiate(CharaView);
|
||||
GameObject baseObj = GameObject.Find("Canvas");
|
||||
obj.transform.SetParent(baseObj.transform, false);
|
||||
|
||||
UICharaView charaView = obj.GetComponent<UICharaView>();
|
||||
|
||||
//クリック場所をセット
|
||||
charaView.SetClickPlace(ClickPlace);
|
||||
//キャラリストをセット
|
||||
charaView.SetCharaList(charaList);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 現在選択されているキャラデータを取得する
|
||||
/// </summary>
|
||||
public SQCharaData[] GetCurrentCharas()
|
||||
{
|
||||
SQCharaData[] ret = new SQCharaData[5];
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
int charaid = SaveManager.GetChara(i);
|
||||
SQCharaData data;
|
||||
|
||||
if (charaDic.TryGetValue(charaid, out data))
|
||||
{
|
||||
ret[i] = data;
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
//見つからなかったらランダム
|
||||
data = GetRandomCharaData();
|
||||
|
||||
//特殊キャラの場合は引き直し
|
||||
while (data.charaID < 100)
|
||||
{
|
||||
data = GetRandomCharaData();
|
||||
}
|
||||
ret[i] = data;
|
||||
*/
|
||||
ret[i] = null;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 追加メンバーのキャラデータを取得する
|
||||
/// </summary>
|
||||
public SQCharaData[] GetAnotherCharas()
|
||||
{
|
||||
SQCharaData[] ret = new SQCharaData[4];
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
int charaid = SaveManager.GetChara(i + 5);
|
||||
SQCharaData data;
|
||||
|
||||
if (charaDic.TryGetValue(charaid, out data))
|
||||
{
|
||||
ret[i] = data;
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
//見つからなかったらランダム
|
||||
data = GetRandomCharaData();
|
||||
|
||||
//特殊キャラの場合は引き直し
|
||||
while (data.charaID < 100)
|
||||
{
|
||||
data = GetRandomCharaData();
|
||||
}
|
||||
ret[i] = data;
|
||||
*/
|
||||
ret[i] = null;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// フォトスタジオ用のキャラデータを取得する
|
||||
/// </summary>
|
||||
public SQCharaData GetPhotoStudioChara()
|
||||
{
|
||||
int charaid = SaveManager.GetChara(9);
|
||||
|
||||
SQCharaData data = null;
|
||||
|
||||
if (charaDic.TryGetValue(charaid, out data))
|
||||
{
|
||||
return data;
|
||||
}
|
||||
else
|
||||
{
|
||||
//見つからなかったらランダム
|
||||
data = GetRandomCharaData();
|
||||
|
||||
//特殊キャラの場合は引き直し
|
||||
while (data.charaID < 100)
|
||||
{
|
||||
data = GetRandomCharaData();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
public SQCharaData GetCharaData(int charaID)
|
||||
{
|
||||
SQCharaData data = null;
|
||||
if (charaDic.TryGetValue(charaID, out data))
|
||||
{
|
||||
return data;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// キャラリストからランダムに1つ返す
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public SQCharaData GetRandomCharaData()
|
||||
{
|
||||
if (charaList != null)
|
||||
{
|
||||
int i = Random.Range(0, charaList.Count);
|
||||
|
||||
return charaList[i];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public SQCharaData GetRandomCharaDataWithoutAprilfool()
|
||||
{
|
||||
SQCharaData data;
|
||||
while (true)
|
||||
{
|
||||
data = GetRandomCharaData();
|
||||
if (data == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
if (data.charaID > 100 && data.charaID < 600)
|
||||
{
|
||||
return data;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 総キャラクタ数を取得する
|
||||
/// </summary>
|
||||
public int CharaCount()
|
||||
{
|
||||
return charaList.Count;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d3f4ebf9c2fa3d24c979e575cab01915
|
||||
timeCreated: 1528768216
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,681 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public class UIManagerDress : MonoBehaviour
|
||||
{
|
||||
/*アイコン用prefab*/
|
||||
[SerializeField]
|
||||
private GameObject DressView;
|
||||
|
||||
/// <summary>
|
||||
/// アイコン辞書
|
||||
/// </summary>
|
||||
private Dictionary<int, Sprite> iconDic;
|
||||
|
||||
/// <summary>
|
||||
/// ドレス辞書
|
||||
/// </summary>
|
||||
private Dictionary<int, SQDressData> dressDic;
|
||||
|
||||
/// <summary>
|
||||
/// 共通衣装リスト
|
||||
/// </summary>
|
||||
private List<SQDressData> commonDresses;
|
||||
|
||||
/// <summary>
|
||||
/// エイプリルフール衣装リスト
|
||||
/// </summary>
|
||||
private List<SQDressData> aprilDresses;
|
||||
|
||||
/// <summary>
|
||||
/// 共通衣装リスト
|
||||
/// </summary>
|
||||
private List<SQDressData> shopDresses;
|
||||
|
||||
/// <summary>
|
||||
/// 共通衣装辞書
|
||||
/// キャラIDから衣装を返す辞書
|
||||
/// </summary>
|
||||
private Dictionary<int, List<SQDressData>> shopDoressDic;
|
||||
|
||||
/// <summary>
|
||||
/// SSR衣装リスト
|
||||
/// </summary>
|
||||
private List<SQDressData> ssrDresses;
|
||||
|
||||
/// <summary>
|
||||
/// キャラIDからSSRドレスリストを返す辞書
|
||||
/// </summary>
|
||||
private Dictionary<int, List<SQDressData>> ssrDressDic;
|
||||
|
||||
|
||||
public bool isLoad
|
||||
{
|
||||
get
|
||||
{
|
||||
if (MasterDBManager.instance.isError || ManifestManager.instance.isError)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Use this for initialization
|
||||
void Start()
|
||||
{
|
||||
CreateSaveIcon();
|
||||
StartCoroutine(CreateSpriteDic());
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 衣装関連のデータをいったん破棄して読み込み直す
|
||||
/// </summary>
|
||||
public void ResetData()
|
||||
{
|
||||
if (ssrDressDic != null)
|
||||
{
|
||||
ssrDressDic.Clear();
|
||||
ssrDressDic = null;
|
||||
}
|
||||
if (iconDic != null)
|
||||
{
|
||||
iconDic.Clear();
|
||||
iconDic = null;
|
||||
}
|
||||
|
||||
CreateSaveIcon();
|
||||
StartCoroutine(CreateSpriteDic());
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// セーブに入っているIconのSpriteを先に生成したい
|
||||
/// </summary>
|
||||
private void CreateSaveIcon()
|
||||
{
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
//int iconID = SaveManager.GetInt(string.Format("dress{0}_icon", i), -1);
|
||||
int iconID = SaveManager.GetDressIcon(i);
|
||||
if (iconID > 0)
|
||||
{
|
||||
StartCoroutine(CreateSprite(iconID));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 共通衣装などのアイコンを生成
|
||||
/// </summary>
|
||||
private IEnumerator CreateSpriteDic()
|
||||
{
|
||||
if (iconDic == null)
|
||||
{
|
||||
iconDic = new Dictionary<int, Sprite>();
|
||||
}
|
||||
|
||||
//DB読み込み待ち
|
||||
while (true)
|
||||
{
|
||||
if (MasterDBManager.instance.isLoadDB && AssetManager.instance.isManifestLoad)
|
||||
{
|
||||
break;
|
||||
}
|
||||
if (MasterDBManager.instance.isError || ManifestManager.instance.isError)
|
||||
{
|
||||
yield break;
|
||||
}
|
||||
yield return null;
|
||||
}
|
||||
|
||||
//ドレスリストを作成
|
||||
List<SQDressData> dressList = new List<SQDressData>();
|
||||
|
||||
//共通衣装
|
||||
var common = MasterDBManager.instance.GetCommonDresses();
|
||||
if (common != null)
|
||||
{
|
||||
commonDresses = common;
|
||||
dressList.AddRange(common);
|
||||
}
|
||||
|
||||
//ショップ衣装
|
||||
var shop = MasterDBManager.instance.GetShopDressesIcon();
|
||||
if (shop != null)
|
||||
{
|
||||
dressList.AddRange(shop);
|
||||
shopDresses = shop;
|
||||
|
||||
//ショップ衣装辞書も取得
|
||||
shopDoressDic = MasterDBManager.instance.GetShopDresses();
|
||||
}
|
||||
|
||||
//エイプリルフール衣装
|
||||
var april = MasterDBManager.instance.GetAprilDresses();
|
||||
if (april != null)
|
||||
{
|
||||
aprilDresses = april;
|
||||
}
|
||||
|
||||
//SSR衣装
|
||||
var ssr = MasterDBManager.instance.GetALLSSRDresses();
|
||||
if (ssr != null)
|
||||
{
|
||||
ssrDressDic = new Dictionary<int, List<SQDressData>>(200);
|
||||
foreach (var tmp in ssr)
|
||||
{
|
||||
List<SQDressData> listdata = null;
|
||||
if (ssrDressDic.TryGetValue(tmp.charaID, out listdata))
|
||||
{
|
||||
listdata.Add(tmp);
|
||||
}
|
||||
else
|
||||
{
|
||||
listdata = new List<SQDressData>();
|
||||
listdata.Add(tmp);
|
||||
ssrDressDic.Add(tmp.charaID, listdata);
|
||||
}
|
||||
}
|
||||
ssrDresses = ssr;
|
||||
//dressList.AddRange(ssr);
|
||||
}
|
||||
|
||||
DownloadDressIcons(dressList);
|
||||
|
||||
|
||||
AddAprilIconSprite();
|
||||
|
||||
//1フレーム待って、セーブのほうを先に割り込ませる
|
||||
yield return null;
|
||||
|
||||
//アイコン辞書に登録
|
||||
foreach (var tmp in dressList)
|
||||
{
|
||||
StartCoroutine(CreateSprite(tmp.dressIconKey));
|
||||
}
|
||||
}
|
||||
|
||||
private void AddSpriteDicResource(int iconID, string resourcename, bool changePlusIcon)
|
||||
{
|
||||
Sprite spr = Resources.Load<Sprite>(resourcename);
|
||||
if (spr == null) { return; }
|
||||
|
||||
if (iconDic.ContainsKey(iconID))
|
||||
{
|
||||
if (iconDic[iconID] == null)
|
||||
{
|
||||
iconDic[iconID] = spr;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
iconDic.Add(iconID, spr);
|
||||
}
|
||||
if (changePlusIcon)
|
||||
{
|
||||
if (iconDic.ContainsKey(iconID + 1))
|
||||
{
|
||||
if (iconDic[iconID + 1] == null)
|
||||
{
|
||||
iconDic[iconID + 1] = spr;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
iconDic.Add(iconID + 1, spr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// エイプリルフール曲を追加
|
||||
/// </summary>
|
||||
private void AddAprilIconSprite()
|
||||
{
|
||||
AddSpriteDicResource(22, "icon_dress_mv", false);
|
||||
AddSpriteDicResource(900001, "chihiro_dress_icon", true);
|
||||
AddSpriteDicResource(900009, "dress_icon_cute", true);
|
||||
AddSpriteDicResource(900011, "dress_icon_cool", true);
|
||||
AddSpriteDicResource(900013, "dress_icon_passion", true);
|
||||
AddSpriteDicResource(900019, "kirarin_dress_icon", true);
|
||||
AddSpriteDicResource(900021, "kirarin_dress_icon", true);
|
||||
AddSpriteDicResource(900026, "staff_dress_icon", true);
|
||||
AddSpriteDicResource(900028, "sana_dress_icon", true);
|
||||
AddSpriteDicResource(900030, "pinya_dress_icon", true);
|
||||
AddSpriteDicResource(900074, "hiromi_dress_icon", true);
|
||||
AddSpriteDicResource(900076, "yuzu_dress_icon", true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Spriteを生成し辞書に登録する
|
||||
/// </summary>
|
||||
public IEnumerator CreateSprite(int iconID)
|
||||
{
|
||||
//存在しない場合は終わり
|
||||
if (iconID <= 0)
|
||||
{
|
||||
yield break;
|
||||
}
|
||||
|
||||
string name = SQDressData.getIconfilename(iconID);
|
||||
|
||||
//辞書が存在しない
|
||||
if (iconDic == null)
|
||||
{
|
||||
iconDic = new Dictionary<int, Sprite>();
|
||||
}
|
||||
|
||||
//既に登録されている
|
||||
if (iconDic.ContainsKey(iconID))
|
||||
{
|
||||
yield break;
|
||||
}
|
||||
else
|
||||
{
|
||||
//仮登録
|
||||
iconDic.Add(iconID, null);
|
||||
}
|
||||
|
||||
//Localのファイル確認
|
||||
while (!AssetManager.instance.CheckFileFromFilename(name))
|
||||
{
|
||||
if (!AssetManager.instance.CheckExistFileInManifest(name))
|
||||
{
|
||||
iconDic.Remove(iconID);
|
||||
yield break;
|
||||
}
|
||||
yield return null;
|
||||
}
|
||||
|
||||
//非同期で読み込み
|
||||
AssetBundleCreateRequest req = AssetManager.instance.LoadAssetFromNameAsync(name);
|
||||
//待ち
|
||||
while (!req.isDone)
|
||||
{
|
||||
yield return null;
|
||||
}
|
||||
AssetBundle bundle = req.assetBundle;
|
||||
|
||||
Sprite tmpSp = null;
|
||||
Texture2D tex2D = null;
|
||||
//非同期でオブジェクトを読み込み
|
||||
AssetBundleRequest textures = bundle.LoadAllAssetsAsync<Texture2D>();
|
||||
while (!textures.isDone)
|
||||
{
|
||||
yield return null;
|
||||
}
|
||||
|
||||
foreach (var obj in textures.allAssets)
|
||||
{
|
||||
if (obj is Texture2D)
|
||||
{
|
||||
tex2D = obj as Texture2D;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
Rect rect = new Rect(0, 0, tex2D.width, tex2D.height);
|
||||
tmpSp = Sprite.Create(tex2D, rect, Vector2.zero);
|
||||
|
||||
bundle.Unload(false);
|
||||
|
||||
|
||||
//既に登録されている
|
||||
if (iconDic.ContainsKey(iconID))
|
||||
{
|
||||
if (iconDic[iconID] == null)
|
||||
{
|
||||
iconDic[iconID] = tmpSp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Spriteを取得する
|
||||
/// </summary>
|
||||
public Sprite GetIconSprite(int iconID)
|
||||
{
|
||||
if (iconDic == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
if (iconDic.ContainsKey(iconID))
|
||||
{
|
||||
return iconDic[iconID];
|
||||
}
|
||||
else
|
||||
{
|
||||
print("Dress icon ID : " + iconID + " がアイコン辞書にありません");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// キャラIDからショップ衣装のリストを返す
|
||||
/// </summary>
|
||||
public List<SQDressData> GetShopDressesFromCharaID(int charaID)
|
||||
{
|
||||
if (shopDoressDic != null)
|
||||
{
|
||||
List<SQDressData> data = null;
|
||||
if (shopDoressDic.TryGetValue(charaID, out data))
|
||||
{
|
||||
return data;
|
||||
}
|
||||
}
|
||||
return new List<SQDressData>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 共通衣装のリストを返す
|
||||
/// </summary>
|
||||
public List<SQDressData> GetCommonDresses()
|
||||
{
|
||||
return commonDresses;
|
||||
}
|
||||
|
||||
public SQDressData GetDefaultDress()
|
||||
{
|
||||
return commonDresses[0];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// SSR衣装のリストを返す
|
||||
/// </summary>
|
||||
public List<SQDressData> GetALLSSRDresses()
|
||||
{
|
||||
return ssrDresses;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// キャラIDからSSR衣装のリストを返す
|
||||
/// </summary>
|
||||
public List<SQDressData> GetSSRDressesFromCharaID(int charaID)
|
||||
{
|
||||
if (ssrDressDic != null)
|
||||
{
|
||||
List<SQDressData> data = null;
|
||||
if (ssrDressDic.TryGetValue(charaID, out data))
|
||||
{
|
||||
return data;
|
||||
}
|
||||
}
|
||||
return new List<SQDressData>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// キャラIDからエイプリルフール衣装のリストを返す
|
||||
/// </summary>
|
||||
public List<SQDressData> GetAprilDressesFromCharaID(int charaID)
|
||||
{
|
||||
List<SQDressData> list = new List<SQDressData>();
|
||||
if (aprilDresses != null)
|
||||
{
|
||||
foreach (var tmp in aprilDresses)
|
||||
{
|
||||
if (tmp.charaID == charaID)
|
||||
{
|
||||
list.Add(tmp);
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// キャラIDからエイプリルフール衣装のリストを返す
|
||||
/// </summary>
|
||||
public List<SQDressData> GetAprilDresses()
|
||||
{
|
||||
List<SQDressData> list = new List<SQDressData>();
|
||||
if (aprilDresses != null)
|
||||
{
|
||||
foreach (var tmp in aprilDresses)
|
||||
{
|
||||
if (tmp.charaID < 700)
|
||||
{
|
||||
list.Add(tmp);
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// キャラIDから着れる衣装のリストを返す
|
||||
/// </summary>
|
||||
public List<SQDressData> GetDressDataFromCharaID(int charaID)
|
||||
{
|
||||
List<SQDressData> dressList = new List<SQDressData>();
|
||||
|
||||
//エイプリルフールキャラは共通衣装を着れないため
|
||||
//最上静香,ジュリアは除外
|
||||
if ((charaID > 100 && charaID < 600) && charaID != 313 && charaID != 314)
|
||||
{
|
||||
dressList.AddRange(commonDresses);
|
||||
//ショップ衣装
|
||||
var shop = GetShopDressesFromCharaID(charaID);
|
||||
dressList.AddRange(shop);
|
||||
}
|
||||
var april = GetAprilDressesFromCharaID(charaID);
|
||||
dressList.AddRange(april);
|
||||
|
||||
//SSR衣装
|
||||
var ssr = GetSSRDressesFromCharaID(charaID);
|
||||
dressList.AddRange(ssr);
|
||||
|
||||
return dressList;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// キャラIDからアイコンファイルのDLを行う
|
||||
/// </summary>
|
||||
public IEnumerator DownloadAndCreateDressIcons(int charaID)
|
||||
{
|
||||
if (iconDic == null)
|
||||
{
|
||||
iconDic = new Dictionary<int, Sprite>();
|
||||
}
|
||||
|
||||
while (true)
|
||||
{
|
||||
if (MasterDBManager.instance.isLoadDB && AssetManager.instance.isManifestLoad)
|
||||
{
|
||||
break;
|
||||
}
|
||||
if (MasterDBManager.instance.isError || ManifestManager.instance.isError)
|
||||
{
|
||||
yield break;
|
||||
}
|
||||
yield return null;
|
||||
}
|
||||
|
||||
List<SQDressData> dressList = new List<SQDressData>(GetDressDataFromCharaID(charaID));
|
||||
|
||||
DownloadDressIcons(dressList);
|
||||
|
||||
//アイコン辞書に登録
|
||||
foreach (var tmp in dressList)
|
||||
{
|
||||
StartCoroutine(CreateSprite(tmp.dressIconKey));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 衣装リストを入力してアイコンファイルをDLする
|
||||
/// </summary>
|
||||
public void DownloadDressIcons(List<SQDressData> dressDatas)
|
||||
{
|
||||
int dressCount = dressDatas.Count;
|
||||
List<string> dressIcons = new List<string>(dressCount);
|
||||
dressDic = new Dictionary<int, SQDressData>();
|
||||
|
||||
foreach (var tmp in dressDatas)
|
||||
{
|
||||
if (!dressDic.ContainsKey(tmp.dressIconKey))
|
||||
{
|
||||
dressDic.Add(tmp.dressIconKey, tmp);
|
||||
dressIcons.Add(SQDressData.getIconfilename(tmp.dressIconKey));
|
||||
}
|
||||
}
|
||||
|
||||
//ファイルのDL
|
||||
StartCoroutine(AssetManager.instance.DownloadFromFilenamesAsync(dressIcons));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// DressViewを生成して表示
|
||||
/// </summary>
|
||||
public void CreateDressView(int currentChara, int clickPlace)
|
||||
{
|
||||
//インスタンスの生成
|
||||
GameObject obj = Instantiate(DressView);
|
||||
GameObject baseObj = GameObject.Find("Canvas");
|
||||
obj.transform.SetParent(baseObj.transform, false);
|
||||
|
||||
UIDressView dv = obj.GetComponent<UIDressView>();
|
||||
dv.SetCharaID(currentChara);
|
||||
dv.SetClickPlace(clickPlace);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// SSRアイコンを切り替えた場合
|
||||
/// </summary>
|
||||
public void ReloadSSRIcons()
|
||||
{
|
||||
GameObject obj = GameObject.Find("Canvas");
|
||||
Transform tf = obj.transform.Find("DressView");
|
||||
if (tf != null)
|
||||
{
|
||||
var tmp = tf.gameObject;
|
||||
Destroy(tmp); //DressViewを消しちゃうんDA!
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ユニークIDからDressDataを返す
|
||||
/// </summary>
|
||||
public SQDressData GetDressDataFromKeyID(int keyID)
|
||||
{
|
||||
bool isCommon = false;
|
||||
bool isShop = false;
|
||||
bool isApril = false;
|
||||
bool isSSR = false;
|
||||
|
||||
if (keyID < 100) { isCommon = true; }
|
||||
if (keyID > 1000 && keyID < 9000) { isSSR = true; }
|
||||
if (keyID > 9000 && keyID < 10000) { isApril = true; }
|
||||
if (keyID > 7000000) { isShop = true; }
|
||||
|
||||
if (isSSR)
|
||||
{
|
||||
foreach (var tmp in ssrDresses)
|
||||
{
|
||||
//SSRはカードID
|
||||
if (tmp.activeDressID == keyID)
|
||||
{
|
||||
return tmp;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (isApril)
|
||||
{
|
||||
foreach (var tmp in aprilDresses)
|
||||
{
|
||||
if (tmp.activeDressID == keyID)
|
||||
{
|
||||
return tmp;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (isCommon)
|
||||
{
|
||||
foreach (var tmp in commonDresses)
|
||||
{
|
||||
if (tmp.activeDressID == keyID)
|
||||
{
|
||||
return tmp;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (isShop)
|
||||
{
|
||||
foreach (var tmp in shopDoressDic)
|
||||
{
|
||||
foreach (var tmp2 in tmp.Value)
|
||||
{
|
||||
if (tmp2.activeDressID == keyID)
|
||||
{
|
||||
return tmp2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print("dressCheckError!");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public SQDressData[] GetCurrentDresses()
|
||||
{
|
||||
SQDressData[] ret = new SQDressData[5];
|
||||
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
int dressid = SaveManager.GetDress(i);
|
||||
if (dressid != 0)
|
||||
{
|
||||
ret[i] = GetDressDataFromKeyID(dressid);
|
||||
}
|
||||
else
|
||||
{
|
||||
ret[i] = null;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
public SQDressData[] GetAnotherDresses()
|
||||
{
|
||||
SQDressData[] ret = new SQDressData[4];
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
int dressid = SaveManager.GetDress(i + 5);
|
||||
if (dressid != 0)
|
||||
{
|
||||
ret[i] = GetDressDataFromKeyID(dressid);
|
||||
}
|
||||
else
|
||||
{
|
||||
ret[i] = null;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
public SQDressData GetPhotoStudioDress()
|
||||
{
|
||||
int dressid = SaveManager.GetDress(9);
|
||||
|
||||
if (dressid == 0)
|
||||
{
|
||||
int rand = Random.Range(0, commonDresses.Count);
|
||||
|
||||
return commonDresses[rand];
|
||||
}
|
||||
|
||||
return GetDressDataFromKeyID(dressid);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2ad32b4e9c7ad4842affd845bf5b734a
|
||||
timeCreated: 1534163140
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,380 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections;
|
||||
|
||||
public class UIManagerMusic : MonoBehaviour
|
||||
{
|
||||
/*Prefab*/
|
||||
[SerializeField]
|
||||
private GameObject MusicView;
|
||||
|
||||
private List<SQMusicData> musicList;
|
||||
private Dictionary<int, SQMusicData> musicDic;
|
||||
private Dictionary<int, Sprite> iconDic;
|
||||
|
||||
public bool isLoad
|
||||
{
|
||||
get
|
||||
{
|
||||
if (musicDic != null)
|
||||
{
|
||||
if (musicDic.Count > 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Use this for initialization
|
||||
void Start()
|
||||
{
|
||||
|
||||
CreateSaveIcon();
|
||||
StartCoroutine(CreateSpriteDic());
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 音楽関連のデータをいったんすべて破棄して読み込み直す
|
||||
/// </summary>
|
||||
public void ResetData()
|
||||
{
|
||||
if (musicList != null)
|
||||
{
|
||||
musicList.Clear();
|
||||
musicList = null;
|
||||
}
|
||||
if (musicDic != null)
|
||||
{
|
||||
musicDic.Clear();
|
||||
musicDic = null;
|
||||
}
|
||||
if (iconDic != null)
|
||||
{
|
||||
iconDic.Clear();
|
||||
iconDic = null;
|
||||
}
|
||||
|
||||
CreateSaveIcon();
|
||||
StartCoroutine(CreateSpriteDic());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// セーブに入っているIconのSpriteを先に生成したい
|
||||
/// </summary>
|
||||
private void CreateSaveIcon()
|
||||
{
|
||||
int iconID = SaveManager.GetInt("music_jacket", -1);
|
||||
if (iconID > 0)
|
||||
{
|
||||
StartCoroutine(CreateSprite(iconID));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// MusicIcon用のSprite辞書を生成する
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private IEnumerator CreateSpriteDic()
|
||||
{
|
||||
if (iconDic == null)
|
||||
{
|
||||
iconDic = new Dictionary<int, Sprite>();
|
||||
}
|
||||
if (musicDic == null)
|
||||
{
|
||||
musicDic = new Dictionary<int, SQMusicData>();
|
||||
}
|
||||
if (musicList == null)
|
||||
{
|
||||
musicList = new List<SQMusicData>();
|
||||
}
|
||||
|
||||
while (true)
|
||||
{
|
||||
if (MasterDBManager.instance.isLoadDB && AssetManager.instance.isManifestLoad)
|
||||
{
|
||||
break;
|
||||
}
|
||||
if (MasterDBManager.instance.isError || ManifestManager.instance.isError)
|
||||
{
|
||||
yield break;
|
||||
}
|
||||
yield return null;
|
||||
}
|
||||
|
||||
//曲名のリスト生成
|
||||
musicList.AddRange(MasterDBManager.instance.GetPlayableMusic());
|
||||
//アナザー楽曲
|
||||
musicList.AddRange(MasterDBManager.instance.GetAnotherMusic());
|
||||
//エイプリルフール曲
|
||||
musicList.AddRange(MasterDBManager.instance.GetAprilfoolMusic());
|
||||
|
||||
List<string> jaketnames = new List<string>();
|
||||
foreach (var tmp in musicList)
|
||||
{
|
||||
jaketnames.Add(string.Format("jacket_{0:0000}.unity3d", tmp.jacket_id));
|
||||
if (!musicDic.ContainsKey(tmp.id))
|
||||
{
|
||||
musicDic.Add(tmp.id, tmp);
|
||||
}
|
||||
}
|
||||
//コルーチンでDLを投げる
|
||||
StartCoroutine(AssetManager.instance.DownloadFromFilenamesAsync(jaketnames));
|
||||
|
||||
AddAprilIconSprite();
|
||||
|
||||
//アイコン作成
|
||||
foreach (var tmp in musicList)
|
||||
{
|
||||
//並列で実行
|
||||
StartCoroutine(CreateSprite(tmp.jacket_id));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void AddSpriteDicResource(int iconID, string resourcename)
|
||||
{
|
||||
Sprite spr = Resources.Load<Sprite>(resourcename);
|
||||
if (spr == null) { return; }
|
||||
|
||||
if (iconDic.ContainsKey(iconID))
|
||||
{
|
||||
if (iconDic[iconID] == null)
|
||||
{
|
||||
iconDic[iconID] = spr;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
iconDic.Add(iconID, spr);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// エイプリルフール曲を追加
|
||||
/// </summary>
|
||||
private void AddAprilIconSprite()
|
||||
{
|
||||
AddSpriteDicResource(20160401, "jacket_chihiro");
|
||||
AddSpriteDicResource(20180401, "kirarinLobo");
|
||||
AddSpriteDicResource(20190401, "jacket_nono");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Spriteを生成し辞書に登録する
|
||||
/// </summary>
|
||||
public IEnumerator CreateSprite(int iconID)
|
||||
{
|
||||
//存在しない場合は終わり
|
||||
if (iconID <= 0)
|
||||
{
|
||||
yield break;
|
||||
}
|
||||
|
||||
string name = string.Format("jacket_{0:0000}.unity3d", iconID);
|
||||
|
||||
//辞書が存在しない
|
||||
if (iconDic == null)
|
||||
{
|
||||
iconDic = new Dictionary<int, Sprite>();
|
||||
}
|
||||
|
||||
//既に登録されている
|
||||
if (iconDic.ContainsKey(iconID))
|
||||
{
|
||||
yield break;
|
||||
}
|
||||
else
|
||||
{
|
||||
iconDic.Add(iconID, null);
|
||||
}
|
||||
|
||||
//Localのファイル確認
|
||||
while (!AssetManager.instance.CheckFileFromFilename(name))
|
||||
{
|
||||
if (!AssetManager.instance.CheckExistFileInManifest(name))
|
||||
{
|
||||
iconDic.Remove(iconID);
|
||||
yield break;
|
||||
}
|
||||
yield return null;
|
||||
}
|
||||
|
||||
//非同期で読み込み
|
||||
AssetBundleCreateRequest req = AssetManager.instance.LoadAssetFromNameAsync(name);
|
||||
while (!req.isDone)
|
||||
{
|
||||
yield return null;
|
||||
}
|
||||
AssetBundle bundle = req.assetBundle;
|
||||
|
||||
Sprite tmpSp = null;
|
||||
Texture2D tex2D = null;
|
||||
//非同期でオブジェクトを読み込み
|
||||
AssetBundleRequest textures = bundle.LoadAllAssetsAsync<Texture2D>();
|
||||
while (!textures.isDone)
|
||||
{
|
||||
yield return null;
|
||||
}
|
||||
|
||||
foreach (var obj in textures.allAssets)
|
||||
{
|
||||
if (obj is Texture2D)
|
||||
{
|
||||
if (obj.name.IndexOf("m") >= 0)
|
||||
{
|
||||
tex2D = obj as Texture2D;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
Rect rect = new Rect(0, 0, tex2D.width, tex2D.height);
|
||||
tmpSp = Sprite.Create(tex2D, rect, Vector2.zero);
|
||||
|
||||
bundle.Unload(false);
|
||||
|
||||
//既に登録されている
|
||||
if (iconDic.ContainsKey(iconID))
|
||||
{
|
||||
if (iconDic[iconID] == null)
|
||||
{
|
||||
iconDic[iconID] = tmpSp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Spriteを取得する
|
||||
/// </summary>
|
||||
public Sprite GetIconSprite(int jacket_id)
|
||||
{
|
||||
if (iconDic == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
if (iconDic.ContainsKey(jacket_id))
|
||||
{
|
||||
return iconDic[jacket_id];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// MusicViewを生成し表示
|
||||
/// </summary>
|
||||
public void CreateMusicView()
|
||||
{
|
||||
GameObject obj = Instantiate(MusicView);
|
||||
GameObject baseObj = GameObject.Find("Canvas");
|
||||
obj.transform.SetParent(baseObj.transform, false);
|
||||
|
||||
UIMusicView musicView = obj.GetComponent<UIMusicView>();
|
||||
musicView.SetMusicList(musicList);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 現在選択されている曲データを取得する
|
||||
/// </summary>
|
||||
public SQMusicData GetCurrentMusic()
|
||||
{
|
||||
/*
|
||||
GameObject baseObj = GameObject.Find("Canvas");
|
||||
if (baseObj == null) { return null; }
|
||||
Transform MusicSelect = GameObjectUtility.FindChildTransform("MusicSelect", baseObj.transform);
|
||||
if(MusicSelect == null) { return null; }
|
||||
|
||||
UIMusicSelect musicSelect = MusicSelect.GetComponent<UIMusicSelect>();
|
||||
SQMusicData data;
|
||||
|
||||
if(musicSelect.currentMusic == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (musicDic.TryGetValue(musicSelect.currentMusic, out data))
|
||||
{
|
||||
return data;
|
||||
}
|
||||
else
|
||||
{
|
||||
data = MasterDBManager.instance.GetMusicDataFromID(musicSelect.currentMusic);
|
||||
if(data.name != null)
|
||||
{
|
||||
return data;
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
SQMusicData data;
|
||||
int currentMusic = SaveManager.GetInt("music");
|
||||
|
||||
if (musicDic.TryGetValue(currentMusic, out data))
|
||||
{
|
||||
return data;
|
||||
}
|
||||
else
|
||||
{
|
||||
data = MasterDBManager.instance.GetMusicDataFromID(currentMusic);
|
||||
if (data != null && data.name != null)
|
||||
{
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public IEnumerator SetMusicInfo(int musicID)
|
||||
{
|
||||
SQMusicData data = null;
|
||||
GameObject MusicInfo = GameObject.Find("Canvas/Panel/LiveContent/MusicInfo");
|
||||
|
||||
while (!isLoad)
|
||||
{
|
||||
yield return null;
|
||||
}
|
||||
|
||||
if (musicDic.TryGetValue(musicID, out data))
|
||||
{
|
||||
MusicInfo.GetComponent<UIMusicInfo>().SetData(data);
|
||||
}
|
||||
else
|
||||
{
|
||||
MusicInfo.GetComponent<UIMusicInfo>().SetData(musicID);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void CheckSoloSong()
|
||||
{
|
||||
GameObject MusicInfo = GameObject.Find("Canvas/Panel/LiveContent/MusicInfo");
|
||||
MusicInfo.GetComponent<UIMusicInfo>().CheckSoloSong();
|
||||
}
|
||||
|
||||
public int GetLiveAttribute(int musicID)
|
||||
{
|
||||
SQMusicData data = null;
|
||||
if (musicDic != null)
|
||||
{
|
||||
if (musicDic.TryGetValue(musicID, out data))
|
||||
{
|
||||
return data.liveAttribute;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 654e614c62359124898b708c60d7c84f
|
||||
timeCreated: 1528768230
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,243 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections;
|
||||
|
||||
public class UIManagerPhotoStudioStage : MonoBehaviour {
|
||||
|
||||
/*Prefab*/
|
||||
[SerializeField]
|
||||
private GameObject PhotoStudioStageView;
|
||||
|
||||
private List<SQPhotoStudioStageData> stageList;
|
||||
private Dictionary<int, SQPhotoStudioStageData> stageDic;
|
||||
private Dictionary<int, Sprite> iconDic;
|
||||
|
||||
|
||||
public bool isLoad
|
||||
{
|
||||
get
|
||||
{
|
||||
if(stageDic != null)
|
||||
{
|
||||
if(stageDic.Count > 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Use this for initialization
|
||||
void Start()
|
||||
{
|
||||
StartCoroutine(CreateSpriteDic());
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update () {
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// フォトスタジオステージ関連のデータをすべて破棄して読み込み直す
|
||||
/// </summary>
|
||||
public void ResetData()
|
||||
{
|
||||
if (stageList != null)
|
||||
{
|
||||
stageList.Clear();
|
||||
stageList = null;
|
||||
}
|
||||
if (stageDic != null)
|
||||
{
|
||||
stageDic.Clear();
|
||||
stageDic = null;
|
||||
}
|
||||
if (iconDic != null)
|
||||
{
|
||||
iconDic.Clear();
|
||||
iconDic = null;
|
||||
}
|
||||
|
||||
StartCoroutine(CreateSpriteDic());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// MusicIcon用のSprite辞書を生成する
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private IEnumerator CreateSpriteDic()
|
||||
{
|
||||
if (iconDic == null)
|
||||
{
|
||||
iconDic = new Dictionary<int, Sprite>();
|
||||
}
|
||||
if (stageDic == null)
|
||||
{
|
||||
stageDic = new Dictionary<int, SQPhotoStudioStageData>();
|
||||
}
|
||||
if (stageList == null)
|
||||
{
|
||||
stageList = new List<SQPhotoStudioStageData>();
|
||||
}
|
||||
|
||||
while (true)
|
||||
{
|
||||
if (MasterDBManager.instance.isLoadDB && AssetManager.instance.isManifestLoad)
|
||||
{
|
||||
break;
|
||||
}
|
||||
if (MasterDBManager.instance.isError || ManifestManager.instance.isError)
|
||||
{
|
||||
yield break;
|
||||
}
|
||||
yield return null;
|
||||
}
|
||||
|
||||
while (true)
|
||||
{
|
||||
if (MasterDBManager.instance != null && MasterDBManager.instance.master3dLive != null)
|
||||
{
|
||||
break;
|
||||
}
|
||||
yield return null;
|
||||
}
|
||||
|
||||
stageList.AddRange(MasterDBManager.instance.GetPhotoStudioStageData());
|
||||
List<string> bgnames = new List<string>();
|
||||
foreach(var tmp in stageList)
|
||||
{
|
||||
//はーつっかえ
|
||||
//int musicID = ViewLauncher.instance.master3dLive.GetMusicIDFromBGID(tmp.bg_id);
|
||||
int musicID = 0;
|
||||
var data = MasterDBManager.instance.GetMusicDataFromID(musicID);
|
||||
tmp.bg_fileid = data.live_bg;
|
||||
if (tmp.bg_fileid != 0)
|
||||
{
|
||||
bgnames.Add(string.Format("live_bg2d_bg_live_{0:00}.unity3d", tmp.bg_fileid));
|
||||
if (!stageDic.ContainsKey(tmp.id))
|
||||
{
|
||||
stageDic.Add(tmp.id, tmp);
|
||||
}
|
||||
}
|
||||
}
|
||||
//コルーチンでDLを投げる
|
||||
StartCoroutine(AssetManager.instance.DownloadFromFilenamesAsync(bgnames));
|
||||
|
||||
//アイコン作成
|
||||
foreach (var tmp in stageList)
|
||||
{
|
||||
if (tmp.bg_fileid != 0)
|
||||
{
|
||||
//並列で実行
|
||||
StartCoroutine(CreateSprite(tmp.bg_fileid));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Spriteを生成し辞書に登録する
|
||||
/// </summary>
|
||||
public IEnumerator CreateSprite(int iconID)
|
||||
{
|
||||
//辞書が存在しない
|
||||
if(iconDic == null)
|
||||
{
|
||||
iconDic = new Dictionary<int, Sprite>();
|
||||
}
|
||||
//既に登録されている
|
||||
if (iconDic.ContainsKey(iconID))
|
||||
{
|
||||
yield break;
|
||||
}
|
||||
else
|
||||
{
|
||||
//先に仮登録
|
||||
iconDic.Add(iconID, null);
|
||||
}
|
||||
|
||||
string name = string.Format("live_bg2d_bg_live_{0:00}.unity3d", iconID);
|
||||
//Localのファイル確認
|
||||
while (!AssetManager.instance.CheckFileFromFilename(name))
|
||||
{
|
||||
yield return null;
|
||||
}
|
||||
//読み込み
|
||||
AssetBundle bundleTex = AssetManager.instance.LoadAssetFromName(name);
|
||||
if (bundleTex == null)
|
||||
{
|
||||
yield break;
|
||||
}
|
||||
Sprite tmpSp = null;
|
||||
Texture2D tex2D = null;
|
||||
foreach (var obj in bundleTex.LoadAllAssets())
|
||||
{
|
||||
if (obj is Texture2D)
|
||||
{
|
||||
tex2D = obj as Texture2D;
|
||||
break;
|
||||
}
|
||||
}
|
||||
Rect rect = new Rect(0, 0, tex2D.width, tex2D.height);
|
||||
tmpSp = Sprite.Create(tex2D, rect, Vector2.zero);
|
||||
|
||||
bundleTex.Unload(false);
|
||||
|
||||
//既に登録されている
|
||||
if (iconDic.ContainsKey(iconID))
|
||||
{
|
||||
if(iconDic[iconID] == null)
|
||||
{
|
||||
iconDic[iconID] = tmpSp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Spriteを取得する
|
||||
/// </summary>
|
||||
public Sprite GetIconSprite(int iconID)
|
||||
{
|
||||
if (iconDic == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
if (iconDic.ContainsKey(iconID))
|
||||
{
|
||||
return iconDic[iconID];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// StageViewを生成し表示
|
||||
/// </summary>
|
||||
public void CreateStageView()
|
||||
{
|
||||
GameObject obj = Instantiate(PhotoStudioStageView);
|
||||
GameObject baseObj = GameObject.Find("Canvas");
|
||||
obj.transform.SetParent(baseObj.transform,false);
|
||||
|
||||
UIPhotoStudioStageView stageView = obj.GetComponent<UIPhotoStudioStageView>();
|
||||
stageView.SetStageList(stageList);
|
||||
}
|
||||
|
||||
|
||||
public SQPhotoStudioStageData GetPSStage()
|
||||
{
|
||||
int stagedata = SaveManager.GetInt("stage", -1);
|
||||
SQPhotoStudioStageData data = null;
|
||||
|
||||
if (stageDic.TryGetValue(stagedata, out data))
|
||||
{
|
||||
return data;
|
||||
}
|
||||
else
|
||||
{
|
||||
return MasterDBManager.instance.GetPhotoStudioStageDataFromID(stagedata);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3fc738af0dc37e24aac554400109a89a
|
||||
timeCreated: 1551224198
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,205 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class UIMusicInfo : MonoBehaviour
|
||||
{
|
||||
private Text title;
|
||||
private Text content;
|
||||
|
||||
private GameObject eventToggle;
|
||||
private GameObject soloToggle;
|
||||
|
||||
private GameObject musicFrame;
|
||||
|
||||
private GameObject UIManager;
|
||||
|
||||
private Sprite[] frameSprites = null;
|
||||
|
||||
private GameObject liveMemberController;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
LoadFrameSprite();
|
||||
|
||||
UIManager = GameObject.Find("UIManager");
|
||||
|
||||
title = base.transform.Find("Header/Title").GetComponent<Text>();
|
||||
content = base.transform.Find("ScrollView/Viewport/Content").GetComponent<Text>();
|
||||
|
||||
musicFrame = base.transform.Find("MusicSelect/Frame").gameObject;
|
||||
|
||||
eventToggle = base.transform.Find("Header/EventToggle").gameObject;
|
||||
soloToggle = base.transform.Find("Header/SoloToggle").gameObject;
|
||||
|
||||
liveMemberController = GameObject.Find("Panel/LiveContent/IdolInfo").gameObject;
|
||||
}
|
||||
|
||||
// Use this for initialization
|
||||
void Start()
|
||||
{
|
||||
int save = SaveManager.GetInt("AnotherSong");
|
||||
eventToggle.GetComponent<Toggle>().isOn = save == 1;
|
||||
|
||||
save = SaveManager.GetInt("SoloSong");
|
||||
soloToggle.GetComponent<Toggle>().isOn = save == 1;
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
}
|
||||
|
||||
private void LoadFrameSprite()
|
||||
{
|
||||
frameSprites = new Sprite[5];
|
||||
frameSprites[0] = Resources.Load<Sprite>("MusicFrame_cute");
|
||||
frameSprites[1] = Resources.Load<Sprite>("MusicFrame_cool");
|
||||
frameSprites[2] = Resources.Load<Sprite>("MusicFrame_passion");
|
||||
frameSprites[3] = Resources.Load<Sprite>("MusicFrame_all");
|
||||
frameSprites[4] = Resources.Load<Sprite>("MusicFrame_other");
|
||||
}
|
||||
|
||||
public void SetData(int musicID)
|
||||
{
|
||||
SQMusicData data = MasterDBManager.instance.GetMusicDataFromID(musicID);
|
||||
if (data.name != null)
|
||||
{
|
||||
SetData(data);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetData(SQMusicData data)
|
||||
{
|
||||
liveMemberController.GetComponent<LiveMemberController>().CheckUnitData(data.id);
|
||||
|
||||
string name = data.name;
|
||||
name = name.Replace("\\n", "");
|
||||
title.text = name;
|
||||
|
||||
string disc = data.discription;
|
||||
disc = disc.Replace("\\n", "\n");
|
||||
content.text = disc;
|
||||
|
||||
if (frameSprites != null && frameSprites[data.liveAttribute - 1] != null)
|
||||
{
|
||||
var image = musicFrame.GetComponent<Image>();
|
||||
image.sprite = frameSprites[data.liveAttribute - 1];
|
||||
musicFrame.SetActive(true);
|
||||
}
|
||||
|
||||
//エイプリルフール曲だけ
|
||||
if(data.chara_all_flag == 2 && data.music_data_id >1900 && data.music_data_id < 1910)
|
||||
{
|
||||
eventToggle.SetActive(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
eventToggle.SetActive(false);
|
||||
}
|
||||
|
||||
CheckSoloSong();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ソロ曲があればボタンを表示
|
||||
/// </summary>
|
||||
public void CheckSoloSong()
|
||||
{
|
||||
int centerChara = SaveManager.GetChara(2); //2 = center
|
||||
int music = SaveManager.GetInt("music");
|
||||
|
||||
//int centerDress = SaveManager.GetInt("dress2");
|
||||
//var dress = UIManager.GetComponent<UIManagerDress>().GetDressDataFromKeyID(centerDress);
|
||||
|
||||
//お願いシンデレラはLiveID=1、musicIDは1001
|
||||
if (music == 1)
|
||||
{
|
||||
string filename = string.Format("song_{0}_{1:D3}.acb", 1001, centerChara);
|
||||
bool isexist = AssetManager.instance.CheckExistFileInManifest(filename);
|
||||
if (isexist)
|
||||
{
|
||||
soloToggle.SetActive(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
soloToggle.SetActive(false);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
soloToggle.SetActive(false);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
/// <summary>
|
||||
/// アナザー用にデータを取得
|
||||
/// </summary>
|
||||
public void SetAnotherMusic(SQMusicData data)
|
||||
{
|
||||
if (select != null && another != null)
|
||||
{
|
||||
if (select.id == data.id || another.id == data.id)
|
||||
{
|
||||
//前回セットされていた曲がselectもしくはanotherにセットされている
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
//全然違う曲が選択された
|
||||
eventToggle.SetActive(false);
|
||||
eventToggle.GetComponent<Toggle>().isOn = false;
|
||||
select = null;
|
||||
another = null;
|
||||
}
|
||||
}
|
||||
|
||||
if (data.chara_all_flag == 2)
|
||||
{
|
||||
SQMusicData[] datas = MasterDBManager.instance.GetMusicDatasFromName(data.name);
|
||||
if (datas.Length > 0)
|
||||
{
|
||||
for (int i = 0; i < datas.Length; i++)
|
||||
{
|
||||
if (datas[i].id != data.id)
|
||||
{
|
||||
select = data;
|
||||
another = datas[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
eventToggle.GetComponent<Toggle>().isOn = false;
|
||||
eventToggle.SetActive(true);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
public void OnChangeEventToggle(bool value)
|
||||
{
|
||||
if (value)
|
||||
{
|
||||
SaveManager.SetInt("AnotherSong", 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
SaveManager.SetInt("AnotherSong", 0);
|
||||
}
|
||||
SaveManager.Save();
|
||||
}
|
||||
|
||||
public void OnChangeSoloToggle(bool value)
|
||||
{
|
||||
if (value)
|
||||
{
|
||||
SaveManager.SetInt("SoloSong", 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
SaveManager.SetInt("SoloSong", 0);
|
||||
}
|
||||
SaveManager.Save();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7a15b8bcc6e4d6145b66e90c141cfc7c
|
||||
timeCreated: 1536407921
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,374 @@
|
||||
using System.Collections;
|
||||
using UnityEngine.UI;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class UIMusicRefine : MonoBehaviour
|
||||
{
|
||||
|
||||
[SerializeField]
|
||||
private bool[] visibleSelect = new bool[] { true, true, true, true, true };
|
||||
private bool[] lastValue = new bool[] { true, true, true, true, true };
|
||||
|
||||
private Toggle Cute = null;
|
||||
private Toggle Cool = null;
|
||||
private Toggle Passion = null;
|
||||
private Toggle ALL = null;
|
||||
private Toggle Other = null;
|
||||
|
||||
private ToggleSwitch pageToggle = null;
|
||||
|
||||
private InputField inputField;
|
||||
private string searchString = "";
|
||||
|
||||
GameObject Select = null;
|
||||
GameObject Search = null;
|
||||
|
||||
private bool enterWait = false;
|
||||
|
||||
// Use this for initialization
|
||||
void Start()
|
||||
{
|
||||
base.name = base.name.Replace("(Clone)", "");
|
||||
|
||||
LoadSavedata();
|
||||
}
|
||||
private void Awake()
|
||||
{
|
||||
var toggles = transform.Find("Content/Select/Type/ContentArea/Cute");
|
||||
if (toggles != null)
|
||||
{
|
||||
Cute = toggles.GetComponent<Toggle>();
|
||||
}
|
||||
toggles = transform.Find("Content/Select/Type/ContentArea/Cool");
|
||||
if (toggles != null)
|
||||
{
|
||||
Cool = toggles.GetComponent<Toggle>();
|
||||
}
|
||||
toggles = transform.Find("Content/Select/Type/ContentArea/Passion");
|
||||
if (toggles != null)
|
||||
{
|
||||
Passion = toggles.GetComponent<Toggle>();
|
||||
}
|
||||
toggles = transform.Find("Content/Select/Type/ContentArea/ALL");
|
||||
if (toggles != null)
|
||||
{
|
||||
ALL = toggles.GetComponent<Toggle>();
|
||||
}
|
||||
toggles = transform.Find("Content/Select/Type/ContentArea/Other");
|
||||
if (toggles != null)
|
||||
{
|
||||
Other = toggles.GetComponent<Toggle>();
|
||||
}
|
||||
var toggleSwitch = transform.Find("Header/MusicRefineSelect");
|
||||
if (toggleSwitch != null)
|
||||
{
|
||||
pageToggle = toggleSwitch.GetComponent<ToggleSwitch>();
|
||||
}
|
||||
var inputfield = transform.Find("Content/Search/InputField");
|
||||
if (inputfield != null)
|
||||
{
|
||||
inputField = inputfield.GetComponent<InputField>();
|
||||
}
|
||||
|
||||
Select = transform.Find("Content/Select").gameObject;
|
||||
Search = transform.Find("Content/Search").gameObject;
|
||||
WindowSizeSetter();
|
||||
}
|
||||
|
||||
private void WindowSizeSetter()
|
||||
{
|
||||
//ウィンドウのサイズを取得
|
||||
Vector2 windowSize = GameObject.Find("Canvas").GetComponent<RectTransform>().sizeDelta;
|
||||
|
||||
//自分のサイズを取得
|
||||
Vector3 mylocalScale = GetComponent<RectTransform>().localScale;
|
||||
Vector2 mysize = GetComponent<RectTransform>().sizeDelta;
|
||||
|
||||
//縦長の場合
|
||||
if (windowSize.y > windowSize.x)
|
||||
{
|
||||
//はみ出すため小さくする
|
||||
mylocalScale.x = 0.8f;
|
||||
mylocalScale.y = 0.8f;
|
||||
}
|
||||
|
||||
GetComponent<RectTransform>().localScale = mylocalScale;
|
||||
GetComponent<RectTransform>().sizeDelta = mysize;
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
LoadSavedata();
|
||||
enterWait = false;
|
||||
if (Search.activeInHierarchy)
|
||||
{
|
||||
inputField.ActivateInputField();
|
||||
}
|
||||
}
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
if (enterWait && Input.GetKeyDown(KeyCode.Return))
|
||||
{
|
||||
OnClickOK();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// セーブデータを読み込んで反映
|
||||
/// </summary>
|
||||
private void LoadSavedata()
|
||||
{
|
||||
visibleSelect = new bool[] { true, true, true, true, true };
|
||||
lastValue = new bool[] { true, true, true, true, true };
|
||||
|
||||
if (SaveManager.GetInt("MusicCuteVisible") == -1)
|
||||
{
|
||||
visibleSelect[0] = lastValue[0] = false;
|
||||
}
|
||||
if (SaveManager.GetInt("MusicCoolVisible") == -1)
|
||||
{
|
||||
visibleSelect[1] = lastValue[1] = false;
|
||||
}
|
||||
if (SaveManager.GetInt("MusicPassionVisible") == -1)
|
||||
{
|
||||
visibleSelect[2] = lastValue[2] = false;
|
||||
}
|
||||
if (SaveManager.GetInt("MusicALLVisible") == -1)
|
||||
{
|
||||
visibleSelect[3] = lastValue[3] = false;
|
||||
}
|
||||
if (SaveManager.GetInt("MusicOtherVisible") == -1)
|
||||
{
|
||||
visibleSelect[4] = lastValue[4] = false;
|
||||
}
|
||||
|
||||
searchString = SaveManager.GetString("SearchMusicString");
|
||||
inputField.text = searchString;
|
||||
|
||||
Select.SetActive(false);
|
||||
Search.SetActive(false);
|
||||
if (SaveManager.GetInt("MusicRefineSelect") == 1)
|
||||
{
|
||||
Select.SetActive(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
Search.SetActive(true);
|
||||
}
|
||||
|
||||
Cute.isOn = visibleSelect[0];
|
||||
Cool.isOn = visibleSelect[1];
|
||||
Passion.isOn = visibleSelect[2];
|
||||
ALL.isOn = visibleSelect[3];
|
||||
Other.isOn = visibleSelect[4];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 属性表示ボタン変更(キュート)
|
||||
/// </summary>
|
||||
/// <param name="b"></param>
|
||||
public void OnToggleChangeCute(bool b)
|
||||
{
|
||||
bool value = Cute.isOn;
|
||||
if (value)
|
||||
{
|
||||
visibleSelect[0] = true;
|
||||
//SaveManager.SetInt("CharaCuteVisible", 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
visibleSelect[0] = false;
|
||||
//SaveManager.SetInt("CharaCuteVisible", -1);
|
||||
}
|
||||
//SaveManager.Save();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 属性表示ボタン変更(クール)
|
||||
/// </summary>
|
||||
/// <param name="b"></param>
|
||||
public void OnToggleChangeCool(bool b)
|
||||
{
|
||||
|
||||
bool value = Cool.isOn;
|
||||
if (value)
|
||||
{
|
||||
visibleSelect[1] = true;
|
||||
//SaveManager.SetInt("CharaCoolVisible", 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
visibleSelect[1] = false;
|
||||
// SaveManager.SetInt("CharaCoolVisible", -1);
|
||||
|
||||
}
|
||||
//SaveManager.Save();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 属性表示ボタン変更(パッション)
|
||||
/// </summary>
|
||||
/// <param name="b"></param>
|
||||
public void OnToggleChangePassion(bool b)
|
||||
{
|
||||
|
||||
bool value = Passion.isOn;
|
||||
if (value)
|
||||
{
|
||||
visibleSelect[2] = true;
|
||||
//SaveManager.SetInt("CharaPassionVisible", 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
visibleSelect[2] = false;
|
||||
//SaveManager.SetInt("CharaPassionVisible", -1);
|
||||
|
||||
}
|
||||
//SaveManager.Save();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 属性表示ボタン変更(全属性他)
|
||||
/// </summary>
|
||||
/// <param name="b"></param>
|
||||
public void OnToggleChangeALL(bool b)
|
||||
{
|
||||
|
||||
bool value = ALL.isOn;
|
||||
if (value)
|
||||
{
|
||||
visibleSelect[3] = true;
|
||||
//SaveManager.SetInt("CharaPassionVisible", 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
visibleSelect[3] = false;
|
||||
//SaveManager.SetInt("CharaPassionVisible", -1);
|
||||
|
||||
}
|
||||
//SaveManager.Save();
|
||||
}
|
||||
/// <summary>
|
||||
/// 属性表示ボタン変更(その他)
|
||||
/// </summary>
|
||||
/// <param name="b"></param>
|
||||
public void OnToggleChangeOther(bool b)
|
||||
{
|
||||
|
||||
bool value = Other.isOn;
|
||||
if (value)
|
||||
{
|
||||
visibleSelect[4] = true;
|
||||
//SaveManager.SetInt("CharaPassionVisible", 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
visibleSelect[4] = false;
|
||||
//SaveManager.SetInt("CharaPassionVisible", -1);
|
||||
|
||||
}
|
||||
//SaveManager.Save();
|
||||
}
|
||||
|
||||
private void Save()
|
||||
{
|
||||
int value = 0;
|
||||
value = visibleSelect[0] ? 1 : -1;
|
||||
if (visibleSelect[0] != lastValue[0]) SaveManager.SetInt("MusicCuteVisible", value);
|
||||
|
||||
value = visibleSelect[1] ? 1 : -1;
|
||||
if (visibleSelect[1] != lastValue[1]) SaveManager.SetInt("MusicCoolVisible", value);
|
||||
|
||||
value = visibleSelect[2] ? 1 : -1;
|
||||
if (visibleSelect[2] != lastValue[2]) SaveManager.SetInt("MusicPassionVisible", value);
|
||||
|
||||
value = visibleSelect[3] ? 1 : -1;
|
||||
if (visibleSelect[3] != lastValue[3]) SaveManager.SetInt("MusicALLVisible", value);
|
||||
|
||||
value = visibleSelect[4] ? 1 : -1;
|
||||
if (visibleSelect[4] != lastValue[4]) SaveManager.SetInt("MusicOtherVisible", value);
|
||||
|
||||
searchString = inputField.text;
|
||||
SaveManager.SetString("SearchMusicString", searchString);
|
||||
|
||||
SaveManager.Save();
|
||||
|
||||
lastValue[0] = visibleSelect[0];
|
||||
lastValue[1] = visibleSelect[1];
|
||||
lastValue[2] = visibleSelect[2];
|
||||
lastValue[3] = visibleSelect[3];
|
||||
lastValue[4] = visibleSelect[4];
|
||||
}
|
||||
|
||||
private void rollback()
|
||||
{
|
||||
//LoadSavedata();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 決定ボタンクリック
|
||||
/// </summary>
|
||||
public void OnClickOK()
|
||||
{
|
||||
Save();
|
||||
|
||||
GameObject obj = GameObject.Find("Canvas/MusicView");
|
||||
obj.GetComponent<UIMusicView>().ReVisible();
|
||||
|
||||
base.gameObject.SetActive(false);
|
||||
}
|
||||
/// <summary>
|
||||
/// 閉じるボタンクリック
|
||||
/// </summary>
|
||||
public void OnClickClose()
|
||||
{
|
||||
rollback();
|
||||
base.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 初期化ボタンをクリック
|
||||
/// </summary>
|
||||
public void OnClickClear()
|
||||
{
|
||||
if(Cute.isOn && Cool.isOn && Passion.isOn && ALL.isOn && Other.isOn && inputField.text == "")
|
||||
{
|
||||
visibleSelect = new bool[] { false, false, false, false, false };
|
||||
}
|
||||
else
|
||||
{
|
||||
visibleSelect = new bool[] { true, true, true, true, true };
|
||||
}
|
||||
Cute.isOn = visibleSelect[0];
|
||||
Cool.isOn = visibleSelect[1];
|
||||
Passion.isOn = visibleSelect[2];
|
||||
ALL.isOn = visibleSelect[3];
|
||||
Other.isOn = visibleSelect[4];
|
||||
|
||||
searchString = "";
|
||||
inputField.text = searchString;
|
||||
}
|
||||
|
||||
public void OnChangePageToggle()
|
||||
{
|
||||
if (pageToggle.isOn)
|
||||
{
|
||||
Select.SetActive(true);
|
||||
Search.SetActive(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
Select.SetActive(false);
|
||||
Search.SetActive(true);
|
||||
inputField.ActivateInputField();
|
||||
}
|
||||
}
|
||||
|
||||
public void OnEndInputText()
|
||||
{
|
||||
enterWait = true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4289763a05626d74da02a248a3c191f2
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,125 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using System.Collections;
|
||||
|
||||
public class UIMusicSelect : MonoBehaviour
|
||||
{
|
||||
private GameObject UIManager = null;
|
||||
|
||||
private UIMusicInfo uIMusicInfo = null;
|
||||
|
||||
public int currentMusic;
|
||||
|
||||
// Use this for initialization
|
||||
void Start()
|
||||
{
|
||||
uIMusicInfo = base.transform.parent.GetComponent<UIMusicInfo>();
|
||||
|
||||
UIManager = GameObject.Find("UIManager");
|
||||
LoadingSavedata();
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
//読みに行く
|
||||
if (UIManager == null)
|
||||
{
|
||||
UIManager = GameObject.Find("UIManager");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// セーブデータからアイコンをセット
|
||||
/// </summary>
|
||||
private void LoadingSavedata()
|
||||
{
|
||||
int music = SaveManager.GetInt("music");
|
||||
int music_jacket = SaveManager.GetInt("music_jacket");
|
||||
if (music != 0 && music_jacket != 0)
|
||||
{
|
||||
currentMusic = music;
|
||||
|
||||
string filename = string.Format("jacket_{0:0000}.unity3d", music_jacket);
|
||||
|
||||
StartCoroutine(AssetManager.instance.DownloadFromFilenameAsync(filename));
|
||||
|
||||
StartCoroutine(MusicIconSetter(music, music_jacket));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ミュージック選択ボタンをクリックした
|
||||
/// </summary>
|
||||
public void OnClickMusicSelect()
|
||||
{
|
||||
GameObject obj = GameObject.Find("Canvas");
|
||||
Transform tf = obj.transform.Find("MusicView");
|
||||
if (tf != null)
|
||||
{
|
||||
tf.gameObject.SetActive(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIManagerMusic mm = UIManager.GetComponent<UIManagerMusic>();
|
||||
if (mm.isLoad)
|
||||
{
|
||||
mm.CreateMusicView();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 曲を選択
|
||||
/// </summary>
|
||||
public IEnumerator MusicIconSetter(int music_data_id, int jacket_id)
|
||||
{
|
||||
if (music_data_id == 0 || jacket_id == 0)
|
||||
{
|
||||
Sprite sprite = Resources.Load<Sprite>("noneMusic");
|
||||
Image img = base.GetComponent<Image>();
|
||||
img.sprite = sprite;
|
||||
|
||||
yield break;
|
||||
}
|
||||
|
||||
UIManagerMusic uIManagerMusic = UIManager.GetComponent<UIManagerMusic>();
|
||||
|
||||
//割り込みで読み込む
|
||||
StartCoroutine(uIManagerMusic.CreateSprite(jacket_id));
|
||||
|
||||
currentMusic = music_data_id;
|
||||
SaveManager.SetInt("music", music_data_id);
|
||||
SaveManager.SetInt("music_jacket", jacket_id);
|
||||
SaveManager.Save();
|
||||
|
||||
Sprite sp = uIManagerMusic.GetIconSprite(jacket_id);
|
||||
if (sp == null)
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
sp = uIManagerMusic.GetIconSprite(jacket_id);
|
||||
if (sp != null)
|
||||
{
|
||||
break;
|
||||
}
|
||||
yield return null;
|
||||
}
|
||||
}
|
||||
|
||||
Image image = base.gameObject.GetComponent<Image>();
|
||||
image.sprite = sp;
|
||||
|
||||
if (uIManagerMusic.isLoad)
|
||||
{
|
||||
//音楽データをセット
|
||||
yield return uIManagerMusic.SetMusicInfo(music_data_id);
|
||||
}
|
||||
else
|
||||
{
|
||||
//まだuIManagerMusicが読み込まれていない場合はDBから直接読み込み
|
||||
uIMusicInfo.SetData(music_data_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6220be155b2fb5248824f751ffb44907
|
||||
timeCreated: 1528613973
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,94 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class UIMusicSort : MonoBehaviour
|
||||
{
|
||||
private RadioButton radioButton = null;
|
||||
private int initValue;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
radioButton = base.GetComponentInChildren<RadioButton>();
|
||||
radioButton.autoSave = false;
|
||||
WindowSizeSetter();
|
||||
}
|
||||
|
||||
private void WindowSizeSetter()
|
||||
{
|
||||
//ウィンドウのサイズを取得
|
||||
Vector2 windowSize = GameObject.Find("Canvas").GetComponent<RectTransform>().sizeDelta;
|
||||
|
||||
//自分のサイズを取得
|
||||
Vector3 mylocalScale = GetComponent<RectTransform>().localScale;
|
||||
Vector2 mysize = GetComponent<RectTransform>().sizeDelta;
|
||||
|
||||
//縦長の場合
|
||||
if (windowSize.y > windowSize.x)
|
||||
{
|
||||
//はみ出すため小さくする
|
||||
mylocalScale.x = 0.8f;
|
||||
mylocalScale.y = 0.8f;
|
||||
}
|
||||
|
||||
GetComponent<RectTransform>().localScale = mylocalScale;
|
||||
GetComponent<RectTransform>().sizeDelta = mysize;
|
||||
}
|
||||
|
||||
// Use this for initialization
|
||||
void Start()
|
||||
{
|
||||
base.name = base.name.Replace("(Clone)", "");
|
||||
|
||||
LoadSavedata();
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
LoadSavedata();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// セーブデータを読み込んで反映
|
||||
/// </summary>
|
||||
private void LoadSavedata()
|
||||
{
|
||||
initValue = SaveManager.GetInt("MusicSortSelect");
|
||||
}
|
||||
|
||||
private void Save()
|
||||
{
|
||||
int nowvalue = radioButton.select;
|
||||
if (initValue != nowvalue)
|
||||
{
|
||||
radioButton.Save();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 決定ボタンクリック
|
||||
/// </summary>
|
||||
public void OnClickOK()
|
||||
{
|
||||
Save();
|
||||
|
||||
GameObject obj = GameObject.Find("Canvas/MusicView");
|
||||
obj.GetComponent<UIMusicView>().ReVisible();
|
||||
|
||||
base.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 閉じるボタンクリック
|
||||
/// </summary>
|
||||
public void OnClickClose()
|
||||
{
|
||||
base.gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bcc8e1654ac2e384791340e63a4561e0
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,569 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections;
|
||||
using System.Linq;
|
||||
|
||||
public class UIMusicView : MonoBehaviour
|
||||
{
|
||||
|
||||
[SerializeField]
|
||||
private GameObject musicIcon;
|
||||
|
||||
private Transform content;
|
||||
|
||||
private List<SQMusicData> musicList = new List<SQMusicData>();
|
||||
|
||||
private bool[] visibleSelect = new bool[] { true, true, true, true, true };
|
||||
|
||||
[SerializeField]
|
||||
private GameObject MusicRefineView;
|
||||
|
||||
[SerializeField]
|
||||
private GameObject MusicSortView;
|
||||
|
||||
private GameObject SortChangeBtn;
|
||||
|
||||
private GameObject SortSelectBtn;
|
||||
|
||||
private Sprite[] icons = null;
|
||||
|
||||
private bool smartmode = false;
|
||||
private string searchString = "";
|
||||
private int sortSelect;
|
||||
private bool sortOrder;
|
||||
|
||||
private Sprite[] frameSprites = null;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
SortChangeBtn = base.transform.Find("Header/SortingButton/RightButton").gameObject;
|
||||
SortSelectBtn = base.transform.Find("Header/SortingButton/LeftButton").gameObject;
|
||||
|
||||
LoadFrameSprite();
|
||||
|
||||
icons = new Sprite[2];
|
||||
icons[0] = Resources.Load<Sprite>("up");
|
||||
icons[1] = Resources.Load<Sprite>("down");
|
||||
|
||||
WindowSizeSetter();
|
||||
}
|
||||
|
||||
private void WindowSizeSetter()
|
||||
{
|
||||
//ウィンドウのサイズを取得
|
||||
Vector2 windowSize = GameObject.Find("Canvas").GetComponent<RectTransform>().sizeDelta;
|
||||
|
||||
//レイアウトを取得
|
||||
GridLayoutGroup gridLayoutGroup = base.GetComponentInChildren<GridLayoutGroup>();
|
||||
float contentXsize = gridLayoutGroup.cellSize.x + gridLayoutGroup.spacing.x;
|
||||
|
||||
//自分のサイズを取得
|
||||
Vector2 mysize = GetComponent<RectTransform>().sizeDelta;
|
||||
|
||||
Vector2 setSize;
|
||||
setSize.x = 30f;
|
||||
|
||||
//横コンテンツ数は最大7個
|
||||
for (int i = 0; i < 7; i++)
|
||||
{
|
||||
if (setSize.x + contentXsize > windowSize.x)
|
||||
{
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
//横幅に余裕があるなら増やしていく
|
||||
setSize.x += contentXsize;
|
||||
}
|
||||
}
|
||||
|
||||
//縦サイズ
|
||||
//デフォルトサイズをセット
|
||||
setSize.y = mysize.y;
|
||||
//縦長の場合
|
||||
if (windowSize.y > windowSize.x)
|
||||
{
|
||||
if (windowSize.y > 1000f)
|
||||
{
|
||||
setSize.y = 950f;
|
||||
}
|
||||
}
|
||||
|
||||
GetComponent<RectTransform>().sizeDelta = setSize;
|
||||
}
|
||||
|
||||
// Use this for initialization
|
||||
void Start()
|
||||
{
|
||||
LoadSavedata();
|
||||
base.name = base.name.Replace("(Clone)", "");
|
||||
StartCoroutine(CreateMusicButtons());
|
||||
ReViewSortSelect();
|
||||
ReViewSortChange();
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// セーブデータを読み込んで反映
|
||||
/// </summary>
|
||||
private void LoadSavedata()
|
||||
{
|
||||
//セーブがオンの時だけ処理
|
||||
if (SaveManager.GetInt("SmartMode") == 1)
|
||||
{
|
||||
smartmode = true;
|
||||
}
|
||||
|
||||
visibleSelect = new bool[] { true, true, true, true, true };
|
||||
if (SaveManager.GetInt("MusicCuteVisible") == -1)
|
||||
{
|
||||
visibleSelect[0] = false;
|
||||
}
|
||||
if (SaveManager.GetInt("MusicCoolVisible") == -1)
|
||||
{
|
||||
visibleSelect[1] = false;
|
||||
}
|
||||
if (SaveManager.GetInt("MusicPassionVisible") == -1)
|
||||
{
|
||||
visibleSelect[2] = false;
|
||||
}
|
||||
if (SaveManager.GetInt("MusicALLVisible") == -1)
|
||||
{
|
||||
visibleSelect[3] = false;
|
||||
}
|
||||
if (SaveManager.GetInt("MusicOtherVisible") == -1)
|
||||
{
|
||||
visibleSelect[4] = false;
|
||||
}
|
||||
searchString = SaveManager.GetString("SearchMusicString");
|
||||
sortSelect = SaveManager.GetInt("MusicSortSelect");
|
||||
var tmp = SaveManager.GetInt("MusicSortOrder"); //デフォルトは昇順
|
||||
sortOrder = tmp != 1; //1がtrue
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 使用するスプライトをロード
|
||||
/// </summary>
|
||||
private void LoadFrameSprite()
|
||||
{
|
||||
frameSprites = new Sprite[5];
|
||||
frameSprites[0] = Resources.Load<Sprite>("MusicFrame_cute");
|
||||
frameSprites[1] = Resources.Load<Sprite>("MusicFrame_cool");
|
||||
frameSprites[2] = Resources.Load<Sprite>("MusicFrame_passion");
|
||||
frameSprites[3] = Resources.Load<Sprite>("MusicFrame_all");
|
||||
frameSprites[4] = Resources.Load<Sprite>("MusicFrame_other");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 音楽ボタンの再描画
|
||||
/// </summary>
|
||||
public void ReVisible()
|
||||
{
|
||||
LoadSavedata();
|
||||
MusicSorting();
|
||||
ChangeVisible();
|
||||
ReViewSortSelect();
|
||||
ReViewSortChange();
|
||||
}
|
||||
|
||||
public void SetMusicList(List<SQMusicData> datalist)
|
||||
{
|
||||
musicList = datalist;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 曲の並び替えを行う
|
||||
/// </summary>
|
||||
private void MusicSorting()
|
||||
{
|
||||
IOrderedEnumerable<SQMusicData> sort = GetSortOrder();
|
||||
if (sort != null)
|
||||
{
|
||||
foreach (var tmp in sort)
|
||||
{
|
||||
//順番に最背面に移動⇒最終的に順番に並ぶ
|
||||
tmp.iconObject.transform.SetAsLastSibling();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 表示の切り替えを行う
|
||||
/// </summary>
|
||||
private void ChangeVisible()
|
||||
{
|
||||
foreach (var tmp in musicList)
|
||||
{
|
||||
GameObject gameObject = tmp.iconObject;
|
||||
if (checkVisible(tmp))
|
||||
{
|
||||
gameObject.SetActive(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// アイコンを表示するかしないかを取得
|
||||
/// </summary>
|
||||
private bool checkVisible(SQMusicData data)
|
||||
{
|
||||
//スマートモードかどうか
|
||||
bool isVisible = true;
|
||||
if (smartmode && !data.smartmode)
|
||||
{
|
||||
isVisible = false;
|
||||
}
|
||||
|
||||
//絞り込みに合致しているか
|
||||
int type = data.liveAttribute - 1;
|
||||
if (type < 5)
|
||||
{
|
||||
if (!visibleSelect[type])
|
||||
{
|
||||
isVisible = false;
|
||||
}
|
||||
}
|
||||
|
||||
//名前検索に合致しているか
|
||||
if (searchString != "")
|
||||
{
|
||||
if (!data.name.Contains(searchString))
|
||||
{
|
||||
if (!data.name_kana.Contains(searchString))
|
||||
{
|
||||
isVisible = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return isVisible;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 閉じるボタンクリック
|
||||
/// </summary>
|
||||
public void OnMusicViewClose()
|
||||
{
|
||||
base.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// スマートモードの切り替え
|
||||
/// </summary>
|
||||
public void OnChangeSmartToggle(bool value)
|
||||
{
|
||||
smartmode = value;
|
||||
|
||||
ChangeVisible();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 絞り込み表示画面の表示
|
||||
/// </summary>
|
||||
public void OnClickRefine()
|
||||
{
|
||||
GameObject obj = GameObject.Find("Canvas");
|
||||
Transform tf = obj.transform.Find("MusicRefineView");
|
||||
if (tf != null)
|
||||
{
|
||||
tf.gameObject.SetActive(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
GameObject obj2 = Instantiate(MusicRefineView);
|
||||
GameObject baseObj = GameObject.Find("Canvas");
|
||||
obj2.transform.SetParent(baseObj.transform, false);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ソート設定画面の表示
|
||||
/// </summary>
|
||||
public void OnClickSortSelect()
|
||||
{
|
||||
switch (sortSelect)
|
||||
{
|
||||
case 0:
|
||||
sortSelect = 1;
|
||||
break;
|
||||
case 1:
|
||||
sortSelect = 0;
|
||||
break;
|
||||
}
|
||||
SaveManager.SetInt("MusicSortSelect", sortSelect);
|
||||
|
||||
SaveManager.Save();
|
||||
|
||||
ReVisible();
|
||||
/*
|
||||
GameObject obj = GameObject.Find("Canvas");
|
||||
Transform tf = obj.transform.Find("MusicSortView");
|
||||
if (tf != null)
|
||||
{
|
||||
tf.gameObject.SetActive(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
GameObject obj2 = Instantiate(MusicSortView);
|
||||
GameObject baseObj = GameObject.Find("Canvas");
|
||||
obj2.transform.SetParent(baseObj.transform, false);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ソートの昇順/降順の切り替え
|
||||
/// </summary>
|
||||
public void OnClickSortChange()
|
||||
{
|
||||
//ひっくり返すよ
|
||||
sortOrder = !sortOrder;
|
||||
|
||||
if (sortOrder)
|
||||
{
|
||||
SaveManager.SetInt("MusicSortOrder", 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
SaveManager.SetInt("MusicSortOrder", 1);
|
||||
}
|
||||
SaveManager.Save();
|
||||
|
||||
ReVisible();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ソート順に並んだLINQイテレータを取得
|
||||
/// </summary>
|
||||
private IOrderedEnumerable<SQMusicData> GetSortOrder()
|
||||
{
|
||||
//セーブからソート順を指定
|
||||
IOrderedEnumerable<SQMusicData> sort = null;
|
||||
if (sortOrder)
|
||||
{
|
||||
switch (sortSelect)
|
||||
{
|
||||
case 0:
|
||||
sort = musicList.OrderBy(x => x.music_data_id);
|
||||
break;
|
||||
case 1:
|
||||
sort = musicList.OrderBy(x => x.name_kana);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (sortSelect)
|
||||
{
|
||||
case 0:
|
||||
sort = musicList.OrderByDescending(x => x.music_data_id);
|
||||
break;
|
||||
case 1:
|
||||
sort = musicList.OrderByDescending(x => x.name_kana);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return sort;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 曲ボタンリストを生成する
|
||||
/// </summary>
|
||||
private IEnumerator CreateMusicButtons()
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
if (musicList != null)
|
||||
{
|
||||
break;
|
||||
}
|
||||
yield return null;
|
||||
}
|
||||
|
||||
//親をセット
|
||||
content = transform.Find("Content/MusicList/Viewport/Content").GetComponent<RectTransform>();
|
||||
|
||||
IOrderedEnumerable<SQMusicData> sort = GetSortOrder();
|
||||
if (sort != null)
|
||||
{
|
||||
//ボタンを生成
|
||||
foreach (var tmp in sort)
|
||||
{
|
||||
GameObject btn = Instantiate(musicIcon);
|
||||
//並列で実行
|
||||
StartCoroutine(MakeButton(tmp, btn));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//ボタンを生成
|
||||
foreach (var tmp in musicList)
|
||||
{
|
||||
GameObject btn = Instantiate(musicIcon);
|
||||
//並列で実行
|
||||
StartCoroutine(MakeButton(tmp, btn));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ボタン生成単体
|
||||
/// </summary>
|
||||
private IEnumerator MakeButton(SQMusicData data, GameObject btn)
|
||||
{
|
||||
btn.name = data.music_data_id.ToString();
|
||||
|
||||
data.iconObject = btn;
|
||||
|
||||
//曲名を整形
|
||||
string text = data.name;
|
||||
//改行を付与
|
||||
text = text.Replace("\\n", "\n");
|
||||
btn.transform.GetComponentInChildren<Text>().text = text;
|
||||
|
||||
//ボタンにアクションを設定
|
||||
Button button = btn.transform.GetComponentInChildren<Button>();
|
||||
AddButtonEvent(button, data);
|
||||
|
||||
if (checkVisible(data))
|
||||
{
|
||||
btn.SetActive(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
btn.SetActive(false);
|
||||
}
|
||||
|
||||
int type = data.liveAttribute - 1;
|
||||
try
|
||||
{
|
||||
if (frameSprites != null && frameSprites[type] != null)
|
||||
{
|
||||
//ボタンアイコン変更
|
||||
Image frame = btn.transform.Find("MusicImage/Frame").GetComponent<Image>();
|
||||
frame.sprite = frameSprites[type];
|
||||
btn.transform.Find("MusicImage/Frame").gameObject.SetActive(true);
|
||||
}
|
||||
}
|
||||
catch (MissingComponentException e)
|
||||
{
|
||||
//ボタンの生成前にMusicViewを閉じた場合エラーをはくため
|
||||
print(e);
|
||||
}
|
||||
|
||||
//親をセット
|
||||
btn.transform.SetParent(content, false);
|
||||
|
||||
//Managerを取得
|
||||
UIManagerMusic md = GameObject.Find("UIManager").GetComponent<UIManagerMusic>();
|
||||
Sprite icondata = null;
|
||||
|
||||
//ICON取得待ち
|
||||
while (true)
|
||||
{
|
||||
icondata = md.GetIconSprite(data.jacket_id);
|
||||
if (icondata != null)
|
||||
{
|
||||
break;
|
||||
}
|
||||
yield return null;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
//ボタンアイコン変更
|
||||
Image img = btn.transform.Find("MusicImage").GetComponent<Image>();
|
||||
img.sprite = icondata;
|
||||
}
|
||||
catch (MissingComponentException e)
|
||||
{
|
||||
//ボタンの生成前にMusicViewを閉じた場合エラーをはくため
|
||||
print(e);
|
||||
}
|
||||
}
|
||||
|
||||
// ボタンに機能を付与する
|
||||
void AddButtonEvent(Button button, SQMusicData data)
|
||||
{
|
||||
button.onClick.AddListener(() =>
|
||||
{
|
||||
this.OnClick(data);
|
||||
base.gameObject.SetActive(false);
|
||||
//Destroy(base.gameObject); //選択したらMusicViewを破棄する
|
||||
});
|
||||
}
|
||||
|
||||
private void OnDisable()
|
||||
{
|
||||
//base.transform.Find("Content/SmartMode").GetComponent<ToggleSwitch>().Save();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// アイコンを選択
|
||||
/// </summary>
|
||||
private void OnClick(SQMusicData data)
|
||||
{
|
||||
SellectMusic(data.id, data.jacket_id);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// メイン画面のアイコンを更新
|
||||
/// </summary>
|
||||
private void SellectMusic(int musicID, int musicIcon = -1)
|
||||
{
|
||||
if (musicIcon == -1)
|
||||
{
|
||||
musicIcon = musicID;
|
||||
}
|
||||
//アイコンセット
|
||||
UIMusicSelect musicselect = GameObject.Find("Canvas/Panel/LiveContent/MusicInfo/MusicSelect").GetComponent<UIMusicSelect>();
|
||||
StartCoroutine(musicselect.MusicIconSetter(musicID, musicIcon));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// SortChangeボタンの表示を変更する
|
||||
/// </summary>
|
||||
private void ReViewSortChange()
|
||||
{
|
||||
Image icon = SortChangeBtn.transform.Find("Image").GetComponent<Image>();
|
||||
Text text = SortChangeBtn.transform.Find("Text").GetComponent<Text>();
|
||||
|
||||
if (sortOrder)
|
||||
{
|
||||
text.text = "昇順";
|
||||
icon.sprite = icons[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
text.text = "降順";
|
||||
icon.sprite = icons[1];
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// SortSelectボタンの表示を変更する
|
||||
/// </summary>
|
||||
private void ReViewSortSelect()
|
||||
{
|
||||
Text text = SortSelectBtn.transform.Find("Text").GetComponent<Text>();
|
||||
|
||||
switch (sortSelect)
|
||||
{
|
||||
case 0:
|
||||
text.text = "ID順";
|
||||
break;
|
||||
case 1:
|
||||
text.text = "五十音順";
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 23358c4833d9fa74aad177c731f22681
|
||||
timeCreated: 1528613987
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,215 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class UIPhotoStudioChara : UIIdolSelect
|
||||
{
|
||||
int chara = -1;
|
||||
int charaIcon = -1;
|
||||
int dress = -1;
|
||||
int dressIcon = -1;
|
||||
|
||||
public GameObject CharaText;
|
||||
|
||||
public GameObject DressText;
|
||||
|
||||
// Use this for initialization
|
||||
void Start()
|
||||
{
|
||||
base.name = base.name.Replace("(Clone)", "");
|
||||
|
||||
//CharaViewの呼び出しに使う番号を付与
|
||||
for (int i = 9; i < 10; i++)
|
||||
{
|
||||
Button button = charas[i].transform.GetComponentInChildren<Button>();
|
||||
AddCharaViewEvent(button, i);
|
||||
}
|
||||
//DressViewの呼び出しに使う番号を付与
|
||||
for (int i = 9; i < 10; i++)
|
||||
{
|
||||
Button button = dresses[i].transform.GetComponentInChildren<Button>();
|
||||
AddDressViewEvent(button, i);
|
||||
}
|
||||
|
||||
UIManager = GameObject.Find("UIManager");
|
||||
|
||||
LoadingSavedata();
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// セーブデータを読み込み
|
||||
/// </summary>
|
||||
private void LoadingSavedata()
|
||||
{
|
||||
chara = SaveManager.GetChara(9);
|
||||
charaIcon = SaveManager.GetCharaIcon(9);
|
||||
dress = SaveManager.GetDress(9);
|
||||
dressIcon = SaveManager.GetDressIcon(9);
|
||||
|
||||
//アイコンファイルを列挙
|
||||
List<string> filelist = new List<string>(4);
|
||||
if (chara != 0)
|
||||
{
|
||||
filelist.Add(string.Format("chara_icon_{0:000}_m.unity3d", charaIcon));
|
||||
}
|
||||
//ドレスアイコン
|
||||
if (dress != 0)
|
||||
{
|
||||
filelist.Add(SQDressData.getIconfilename(dressIcon));
|
||||
}
|
||||
//アイコンファイルをDL
|
||||
StartCoroutine(AssetManager.instance.DownloadFromFilenamesAsync(filelist));
|
||||
|
||||
//アイコンに設定
|
||||
if (dress != 0)
|
||||
{
|
||||
StartCoroutine(CharaIconSetter(chara, charaIcon, 9));
|
||||
StartCoroutine(LoadCharaText(chara));
|
||||
}
|
||||
if (dress != 0)
|
||||
{
|
||||
StartCoroutine(DressIconSetter(dress, dressIcon, 9));
|
||||
StartCoroutine(LoadDressText(dress));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 開いたときに読み込んだセーブで復元する
|
||||
/// </summary>
|
||||
private void RollBackSave()
|
||||
{
|
||||
SaveManager.SetChara(9, chara);
|
||||
SaveManager.SetCharaIcon(9, charaIcon);
|
||||
SaveManager.SetDress(9, dress);
|
||||
SaveManager.SetDressIcon(9, dressIcon);
|
||||
SaveManager.Save();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// セーブを削除して消す
|
||||
/// </summary>
|
||||
private void ResetSave()
|
||||
{
|
||||
SaveManager.SetChara(9, 0);
|
||||
SaveManager.SetCharaIcon(9, 0);
|
||||
SaveManager.SetDress(9, 0);
|
||||
SaveManager.SetDressIcon(9, 0);
|
||||
SaveManager.Save();
|
||||
|
||||
chara= 0;
|
||||
charaIcon = 0;
|
||||
dress = 0;
|
||||
dressIcon = 0;
|
||||
|
||||
StartCoroutine(CharaIconSetter(-1, -1, 9));
|
||||
StartCoroutine(DressIconSetter(-1, -1, 9));
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update () {
|
||||
|
||||
}
|
||||
|
||||
public override void ReLoadIcons()
|
||||
{
|
||||
dress = SaveManager.GetDress(9);
|
||||
dressIcon = SaveManager.GetDressIcon(9);
|
||||
|
||||
//アイコンファイルを列挙
|
||||
List<string> filelist = new List<string>(4);
|
||||
if (dress != 0)
|
||||
{
|
||||
filelist.Add(SQDressData.getIconfilename(dressIcon));
|
||||
}
|
||||
//アイコンファイルをDL
|
||||
StartCoroutine(AssetManager.instance.DownloadFromFilenamesAsync(filelist));
|
||||
|
||||
StartCoroutine(DressIconSetter(dress, dressIcon, 9));
|
||||
StartCoroutine(LoadDressText(dress));
|
||||
}
|
||||
|
||||
public override IEnumerator CharaIconSetter(int charaID, int charaIcon, int charaPlace)
|
||||
{
|
||||
StartCoroutine(LoadCharaText(charaID));
|
||||
|
||||
//キャラクタが変更になった場合、ドレスアイコンを変更
|
||||
int currentChara = SaveManager.GetChara(charaPlace);
|
||||
if (currentChara != charaID)
|
||||
{
|
||||
//dressIcon=1 ※初期ドレスに設定
|
||||
int setDress = 1;
|
||||
switch (charaID)
|
||||
{
|
||||
case 20:
|
||||
setDress = 900001;
|
||||
break;
|
||||
case 48:
|
||||
setDress = 900009;
|
||||
break;
|
||||
case 49:
|
||||
setDress = 900011;
|
||||
break;
|
||||
case 50:
|
||||
setDress = 900013;
|
||||
break;
|
||||
case 83:
|
||||
setDress = 900019;
|
||||
break;
|
||||
}
|
||||
StartCoroutine(LoadDressText(setDress));
|
||||
}
|
||||
|
||||
StartCoroutine(base.CharaIconSetter(charaID, charaIcon, charaPlace));
|
||||
yield return null;
|
||||
}
|
||||
|
||||
public override IEnumerator DressIconSetter(int dressID, int dressIcon, int dressPlace)
|
||||
{
|
||||
StartCoroutine(LoadDressText(dressID));
|
||||
|
||||
StartCoroutine(base.DressIconSetter(dressID, dressIcon, dressPlace));
|
||||
yield return null;
|
||||
}
|
||||
|
||||
public IEnumerator LoadCharaText(int charaId)
|
||||
{
|
||||
if (charaId != 0)
|
||||
{
|
||||
UIManagerChara mc = UIManager.GetComponent<UIManagerChara>();
|
||||
while (true)
|
||||
{
|
||||
if (mc.isLoad)
|
||||
{
|
||||
break;
|
||||
}
|
||||
yield return null;
|
||||
}
|
||||
|
||||
SQCharaData sQCharaData = mc.GetCharaData(charaId);
|
||||
CharaText.GetComponent<Text>().text = sQCharaData.name;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public IEnumerator LoadDressText(int dressId)
|
||||
{
|
||||
if (dressId != 0)
|
||||
{
|
||||
UIManagerDress uIManagerDress = UIManager.GetComponent<UIManagerDress>();
|
||||
while (true)
|
||||
{
|
||||
if (uIManagerDress.isLoad)
|
||||
{
|
||||
break;
|
||||
}
|
||||
yield return null;
|
||||
}
|
||||
SQDressData sqData = uIManagerDress.GetDressDataFromKeyID(dressId);
|
||||
DressText.GetComponent<Text>().text = sqData.dressKeyName;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 70cf1a13dea30ce4785b2870ca561fdd
|
||||
timeCreated: 1551255286
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,129 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public class UIPhotoStudioStageSelect : MonoBehaviour
|
||||
{
|
||||
protected GameObject UIManager = null;
|
||||
|
||||
[SerializeField]
|
||||
public GameObject stage;
|
||||
|
||||
[SerializeField]
|
||||
public int currentStage;
|
||||
|
||||
// Use this for initialization
|
||||
void Start()
|
||||
{
|
||||
currentStage = -1;
|
||||
UIManager = GameObject.Find("UIManager");
|
||||
|
||||
Button button = stage.transform.GetComponentInChildren<Button>();
|
||||
AddCharaViewEvent(button);
|
||||
|
||||
//セーブデータを読み込む
|
||||
LoadingSavedata();
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
//読みに行く
|
||||
if (UIManager == null)
|
||||
{
|
||||
UIManager = GameObject.Find("UIManager");
|
||||
}
|
||||
}
|
||||
|
||||
private void LoadingSavedata()
|
||||
{
|
||||
int stagedata = SaveManager.GetInt("stage", -1);
|
||||
int stageicon = SaveManager.GetInt("stageicon", -1);
|
||||
|
||||
if (stageicon > 0)
|
||||
{
|
||||
List<string> filelist = new List<string>(2);
|
||||
filelist.Add(string.Format("live_bg2d_bg_live_{00}.unity3d", stageicon));
|
||||
|
||||
StartCoroutine(AssetManager.instance.DownloadFromFilenamesAsync(filelist));
|
||||
}
|
||||
|
||||
StartCoroutine(StageIconSetter(stagedata, stageicon));
|
||||
|
||||
}
|
||||
public IEnumerator StageIconSetter(int stagedata, int stageicon)
|
||||
{
|
||||
if (stageicon < 0)
|
||||
{
|
||||
Sprite sprite = Resources.Load<Sprite>("noneStage");
|
||||
Image img = stage.GetComponent<Image>();
|
||||
img.sprite = sprite;
|
||||
}
|
||||
|
||||
if (stagedata < 0)
|
||||
{
|
||||
Text text = stage.GetComponentInChildren<Text>();
|
||||
text.text = "";
|
||||
}
|
||||
|
||||
//データがない場合は終了
|
||||
if (stageicon < 0 && stagedata < 0)
|
||||
{
|
||||
yield break;
|
||||
}
|
||||
|
||||
SaveManager.SetInt("stage", stagedata);
|
||||
SaveManager.SetInt("stageicon", stageicon);
|
||||
SaveManager.Save();
|
||||
|
||||
Sprite sp = UIManager.GetComponent<UIManagerPhotoStudioStage>().GetIconSprite(stageicon);
|
||||
|
||||
if (sp == null)
|
||||
{
|
||||
//割り込みで読み込む
|
||||
yield return UIManager.GetComponent<UIManagerPhotoStudioStage>().CreateSprite(stageicon);
|
||||
|
||||
sp = UIManager.GetComponent<UIManagerPhotoStudioStage>().GetIconSprite(stageicon);
|
||||
if (sp == null)
|
||||
{
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
Image image = stage.GetComponent<Image>();
|
||||
image.sprite = sp;
|
||||
}
|
||||
|
||||
|
||||
public void OnClickPhotoStudioSelect()
|
||||
{
|
||||
Debug.Log("ClickStageSelect");
|
||||
|
||||
GameObject obj = GameObject.Find("Canvas");
|
||||
Transform tf = obj.transform.Find("PhotoStudioStageView");
|
||||
if (tf != null)
|
||||
{
|
||||
//既に1回呼び出している
|
||||
tf.gameObject.SetActive(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIManagerPhotoStudioStage ms = UIManager.GetComponent<UIManagerPhotoStudioStage>();
|
||||
if (ms.isLoad)
|
||||
{
|
||||
ms.CreateStageView();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// キャラボタンにイベントを設置
|
||||
/// </summary>
|
||||
protected void AddCharaViewEvent(Button button)
|
||||
{
|
||||
button.onClick.AddListener(() =>
|
||||
{
|
||||
this.OnClickPhotoStudioSelect();
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bd015047c3764384a923f71d18999b30
|
||||
timeCreated: 1528605768
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,140 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections;
|
||||
|
||||
public class UIPhotoStudioStageView : MonoBehaviour {
|
||||
|
||||
[SerializeField]
|
||||
private GameObject stageIcon;
|
||||
|
||||
private Transform content;
|
||||
|
||||
private List<SQPhotoStudioStageData> stageList = null;
|
||||
|
||||
private List<GameObject> stageBtnList = new List<GameObject>();
|
||||
|
||||
// Use this for initialization
|
||||
void Start ()
|
||||
{
|
||||
base.name = base.name.Replace("(Clone)", "");
|
||||
StartCoroutine(CreateStageButtons());
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update () {
|
||||
|
||||
}
|
||||
|
||||
private IEnumerator CreateStageButtons()
|
||||
{
|
||||
//Selectから渡されるまでまち
|
||||
while (true)
|
||||
{
|
||||
if (stageList != null)
|
||||
{
|
||||
break;
|
||||
}
|
||||
yield return null;
|
||||
}
|
||||
|
||||
//親をセット
|
||||
content = transform.Find("Content/StageList/Viewport/Content").GetComponent<RectTransform>();
|
||||
|
||||
//ボタンを生成
|
||||
foreach (var tmp in stageList)
|
||||
{
|
||||
GameObject btn = Instantiate(stageIcon);
|
||||
stageBtnList.Add(btn);
|
||||
//並列で実行
|
||||
StartCoroutine(MakeButton(tmp, btn));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ボタン生成単体
|
||||
/// </summary>
|
||||
private IEnumerator MakeButton(SQPhotoStudioStageData data, GameObject btn)
|
||||
{
|
||||
btn.name = data.bg_fileid.ToString();
|
||||
|
||||
//曲名を整形
|
||||
string text = data.disp_name;
|
||||
//改行を付与
|
||||
text = text.Replace("\\n", "\n");
|
||||
text = text.Replace("ステージ ", "ステージ\n");
|
||||
text = text.Replace("スクリーン ", "スクリーン\n");
|
||||
btn.transform.GetComponentInChildren<Text>().text = text;
|
||||
|
||||
//ボタンにアクションを設定
|
||||
Button button = btn.transform.GetComponentInChildren<Button>();
|
||||
AddButtonEvent(button, data);
|
||||
|
||||
//親をセット
|
||||
btn.transform.SetParent(content, false);
|
||||
|
||||
//Managerを取得
|
||||
UIManagerPhotoStudioStage md = GameObject.Find("UIManager").GetComponent<UIManagerPhotoStudioStage>();
|
||||
Sprite icondata = null;
|
||||
|
||||
//ICON取得待ち
|
||||
while (true)
|
||||
{
|
||||
icondata = md.GetIconSprite(data.bg_fileid);
|
||||
if (icondata != null)
|
||||
{
|
||||
break;
|
||||
}
|
||||
yield return null;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
//ボタンアイコン変更
|
||||
Image img = btn.transform.Find("IconImage").GetComponent<Image>();
|
||||
img.sprite = icondata;
|
||||
}
|
||||
catch (MissingComponentException e)
|
||||
{
|
||||
//ボタンの生成前にMusicViewを閉じた場合エラーをはくため
|
||||
print(e);
|
||||
}
|
||||
}
|
||||
|
||||
// ボタンに機能を付与する
|
||||
void AddButtonEvent(Button button, SQPhotoStudioStageData data)
|
||||
{
|
||||
button.onClick.AddListener(() => {
|
||||
this.OnClick(data);
|
||||
base.gameObject.SetActive(false);
|
||||
});
|
||||
}
|
||||
|
||||
//Musicが選択されたとき
|
||||
private void OnClick(SQPhotoStudioStageData data)
|
||||
{
|
||||
SelectStage(data.id, data.bg_fileid);
|
||||
}
|
||||
|
||||
public void SetStageList(List<SQPhotoStudioStageData> datalist)
|
||||
{
|
||||
stageList = datalist;
|
||||
}
|
||||
|
||||
|
||||
private void SelectStage(int stageID, int stageIcon = -1)
|
||||
{
|
||||
if (stageIcon == -1)
|
||||
{
|
||||
stageIcon = stageID;
|
||||
}
|
||||
//アイコンセット
|
||||
UIPhotoStudioStageSelect photostudioselect = GameObject.Find("Canvas/Panel/PhotoStudio/PhotoStudioStageSelect").GetComponent<UIPhotoStudioStageSelect>();
|
||||
StartCoroutine(photostudioselect.StageIconSetter(stageID, stageIcon));
|
||||
}
|
||||
|
||||
public void OnViewClose()
|
||||
{
|
||||
base.gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9644d10ed1df51e4d967856c52ddd674
|
||||
timeCreated: 1528613741
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,121 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class UISetting : MonoBehaviour {
|
||||
|
||||
[SerializeField]
|
||||
private GameObject menuSetting;
|
||||
private GameObject menu;
|
||||
private float menuScrollRect = 1f;
|
||||
|
||||
[SerializeField]
|
||||
private GameObject liveSetting;
|
||||
private GameObject live;
|
||||
private float liveScrollRect = 1f;
|
||||
|
||||
private ToggleSwitch settingSwitch;
|
||||
private ScrollRect scrollRect;
|
||||
|
||||
private void WindowSizeSetter()
|
||||
{
|
||||
//ウィンドウのサイズを取得
|
||||
Vector2 windowSize = GameObject.Find("Canvas").GetComponent<RectTransform>().sizeDelta;
|
||||
|
||||
//自分のサイズを取得
|
||||
Vector3 mylocalScale = GetComponent<RectTransform>().localScale;
|
||||
Vector2 mysize = GetComponent<RectTransform>().sizeDelta;
|
||||
|
||||
//縦長の場合
|
||||
if (windowSize.y > windowSize.x)
|
||||
{
|
||||
//はみ出すため小さくする
|
||||
mylocalScale.x = 0.8f;
|
||||
mylocalScale.y = 0.8f;
|
||||
|
||||
if (windowSize.y > 1160f)
|
||||
{
|
||||
mysize.y = 1100f;
|
||||
}
|
||||
}
|
||||
|
||||
GetComponent<RectTransform>().localScale = mylocalScale;
|
||||
GetComponent<RectTransform>().sizeDelta = mysize;
|
||||
}
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
base.name = base.name.Replace("(Clone)", "");
|
||||
Transform transform = base.transform.Find("Content/ScrollView/Viewport/Content");
|
||||
|
||||
settingSwitch = base.transform.Find("Header/SettingSwitch").GetComponent<ToggleSwitch>();
|
||||
|
||||
menu = GameObject.Instantiate(menuSetting);
|
||||
live = GameObject.Instantiate(liveSetting);
|
||||
menu.transform.SetParent(transform, false);
|
||||
live.transform.SetParent(transform, false);
|
||||
|
||||
menu.SetActive(false);
|
||||
live.SetActive(false);
|
||||
|
||||
int save = SaveManager.GetInt("SettingSwitch");
|
||||
|
||||
if (save == 0)
|
||||
{
|
||||
live.SetActive(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
menu.SetActive(true);
|
||||
}
|
||||
|
||||
scrollRect = base.transform.Find("Content/ScrollView").GetComponent<ScrollRect>();
|
||||
|
||||
WindowSizeSetter();
|
||||
}
|
||||
// Use this for initialization
|
||||
void Start()
|
||||
{
|
||||
StartCoroutine(SetScrollRect(1f));
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update () {
|
||||
|
||||
}
|
||||
|
||||
public void OnClickClose()
|
||||
{
|
||||
base.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
public void OnChangePageToggle()
|
||||
{
|
||||
if (settingSwitch.isOn)
|
||||
{
|
||||
liveScrollRect = scrollRect.verticalNormalizedPosition;
|
||||
live.SetActive(false);
|
||||
menu.SetActive(true);
|
||||
StartCoroutine(SetScrollRect(menuScrollRect));
|
||||
}
|
||||
else
|
||||
{
|
||||
menuScrollRect = scrollRect.verticalNormalizedPosition;
|
||||
live.SetActive(true);
|
||||
menu.SetActive(false);
|
||||
StartCoroutine(SetScrollRect(liveScrollRect));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ScrollRectはすぐには変更されないため1フレーム待つ必要がある
|
||||
/// </summary>
|
||||
private IEnumerator SetScrollRect(float pos)
|
||||
{
|
||||
//1フレーム待つ
|
||||
yield return null;
|
||||
|
||||
scrollRect.verticalNormalizedPosition = pos;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 137f0d175f1e2b24a8c91838be7e89fe
|
||||
timeCreated: 1536264966
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,200 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class UISettingContent : MonoBehaviour
|
||||
{
|
||||
|
||||
private ToggleSwitch[] toggleList = null;
|
||||
|
||||
[SerializeField]
|
||||
private GameObject EffectSetting;
|
||||
[SerializeField]
|
||||
GameObject DBNotice;
|
||||
|
||||
bool[] initValue = null;
|
||||
|
||||
// Use this for initialization
|
||||
void Start()
|
||||
{
|
||||
ValueInit();
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 2回目に設定を開いたとき
|
||||
/// </summary>
|
||||
private void OnEnable()
|
||||
{
|
||||
ValueInit();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 設定を閉じたとき
|
||||
/// </summary>
|
||||
private void OnDisable()
|
||||
{
|
||||
CheckChange();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 設定を開いた時点での値を確保する
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private void ValueInit()
|
||||
{
|
||||
toggleList = base.GetComponentsInChildren<ToggleSwitch>();
|
||||
|
||||
if (toggleList != null)
|
||||
{
|
||||
initValue = new bool[toggleList.Length];
|
||||
for (int i = 0; i < toggleList.Length; i++)
|
||||
{
|
||||
initValue[i] = toggleList[i].isOn;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 設定変更によってメニューを更新する処理
|
||||
/// </summary>
|
||||
private void CheckChange()
|
||||
{
|
||||
if (toggleList != null)
|
||||
{
|
||||
for (int i = 0; i < toggleList.Length; i++)
|
||||
{
|
||||
if (initValue[i] != toggleList[i].isOn)
|
||||
{
|
||||
switch (toggleList[i].toggleName)
|
||||
{
|
||||
case "SSRIcon":
|
||||
SQDressData.isPlus = toggleList[i].isOn;
|
||||
ReloadIcons();
|
||||
break;
|
||||
|
||||
case "ScreenMode":
|
||||
OnChangeScreenMode();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ドレスアイコンの更新を反映
|
||||
/// </summary>
|
||||
private void ReloadIcons()
|
||||
{
|
||||
ReLoadDressIcons();
|
||||
|
||||
Transform transform = GameObject.Find("Canvas/Panel").transform;
|
||||
|
||||
Transform idolInfo = transform.Find("LiveContent/IdolInfo");
|
||||
if (idolInfo.gameObject.activeInHierarchy)
|
||||
{
|
||||
idolInfo.GetComponent<UIIdolSelect>().ReLoadIcons();
|
||||
}
|
||||
|
||||
Transform photoStudioIdolSelect = transform.Find("PhotoStudio/PhotoStudioIdolSelect");
|
||||
if (photoStudioIdolSelect.gameObject.activeInHierarchy)
|
||||
{
|
||||
photoStudioIdolSelect.GetComponent<UIPhotoStudioChara>().ReLoadIcons();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// SSRアイコン設定を変更したときに使用
|
||||
/// </summary>
|
||||
public void ReLoadDressIcons()
|
||||
{
|
||||
UIManagerDress dressManager = GameObject.Find("UIManager").GetComponent<UIManagerDress>();
|
||||
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
int dressid = SaveManager.GetDress(i);
|
||||
|
||||
if (dressid == 0) continue; //なにもセットされていない場合
|
||||
|
||||
SQDressData data = dressManager.GetDressDataFromKeyID(dressid);
|
||||
|
||||
if (data.activeDressID > 0 && data.dressIconKey > 0)
|
||||
{
|
||||
SaveManager.SetDress(i, data.activeDressID);
|
||||
SaveManager.SetDressIcon(i, data.dressIconKey);
|
||||
|
||||
SaveManager.Save();
|
||||
}
|
||||
}
|
||||
|
||||
//AppendSSRアイコンの切り替え
|
||||
dressManager.ReloadSSRIcons();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// エフェクト設定を開く
|
||||
/// </summary>
|
||||
public void OnClickEffectSetting()
|
||||
{
|
||||
//prefabを実装
|
||||
GameObject gameObject = GameObject.Instantiate(EffectSetting);
|
||||
|
||||
Transform transform = GameObject.Find("Canvas/ViewSetter").transform;
|
||||
|
||||
//ViewSetter下に実装
|
||||
gameObject.transform.SetParent(transform, false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// DBUpdateボタンを押したときの動作
|
||||
/// </summary>
|
||||
public void OnClickDBUpdateButton()
|
||||
{
|
||||
GameObject obj = Instantiate(DBNotice);
|
||||
GameObject baseObj = GameObject.Find("Canvas");
|
||||
obj.transform.SetParent(baseObj.transform, false);
|
||||
|
||||
var instance = obj.GetComponent<UIDBNotice>();
|
||||
instance.UpdateDatabase();
|
||||
}
|
||||
|
||||
public void OnChangeScreenMode()
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
#elif UNITY_STANDALONE
|
||||
if (toggleList != null)
|
||||
{
|
||||
for (int i = 0; i < toggleList.Length; i++)
|
||||
{
|
||||
if (initValue[i] != toggleList[i].isOn)
|
||||
{
|
||||
switch (toggleList[i].toggleName)
|
||||
{
|
||||
case "ScreenMode":
|
||||
if (toggleList[i].isOn)
|
||||
{
|
||||
SaveManager.SetInt("ScreenWidth", Screen.width);
|
||||
SaveManager.SetInt("ScreenHeight", Screen.height);
|
||||
Screen.SetResolution(Screen.currentResolution.width, Screen.currentResolution.height, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
int width = SaveManager.GetInt("ScreenWidth", 1280);
|
||||
int height = SaveManager.GetInt("ScreenHeight", 720);
|
||||
Screen.SetResolution(width, height, false);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 38a0bb957012e2b4995a28dc548310d3
|
||||
timeCreated: 1537875263
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,433 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
/// <summary>
|
||||
/// MenuからStartを押した際にViewに渡す変数を取りまとめる
|
||||
/// 最終的にViewLancherに引き渡してSceneを呼ぶ
|
||||
/// </summary>
|
||||
public class UIStartManager : MonoBehaviour
|
||||
{
|
||||
protected enum ViewType
|
||||
{
|
||||
LiveView = 0,
|
||||
PhotoStudioView = 1
|
||||
}
|
||||
|
||||
private bool isHighQuality = true;
|
||||
|
||||
private Button StartButton = null;
|
||||
|
||||
// Use this for initialization
|
||||
void Start()
|
||||
{
|
||||
StartCoroutine(firstDownload());
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
if (StartButton == null)
|
||||
{
|
||||
GameObject startButton = GameObject.Find("B_OK");
|
||||
if (startButton == null) { return; }
|
||||
Button button = startButton.GetComponent<Button>();
|
||||
if (button != null)
|
||||
{
|
||||
button.onClick.AddListener(() =>
|
||||
{
|
||||
this.OnClickStart();
|
||||
this.StartButton = null;
|
||||
});
|
||||
StartButton = button;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 必須ファイルの再DL
|
||||
/// </summary>
|
||||
public void ResetData()
|
||||
{
|
||||
StartButton = null;
|
||||
StartCoroutine(firstDownload());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Startボタンを押した時に呼ばれる
|
||||
/// </summary>
|
||||
public void OnClickStart()
|
||||
{
|
||||
//現在の状態をセーブ
|
||||
SaveManager.Save();
|
||||
|
||||
//HQモデル
|
||||
//int save = SaveManager.GetInt("RichModel");
|
||||
int save = 1; //リッチモデルで固定
|
||||
if (save > 0)
|
||||
{
|
||||
isHighQuality = true;
|
||||
ViewLauncher.instance.isRich = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
isHighQuality = false;
|
||||
ViewLauncher.instance.isRich = false;
|
||||
}
|
||||
|
||||
ViewType viewType;
|
||||
int liveSelect = SaveManager.GetInt("ViewSwitch", 1);
|
||||
if (liveSelect == 1)
|
||||
{
|
||||
viewType = ViewType.LiveView;
|
||||
}
|
||||
else
|
||||
{
|
||||
viewType = ViewType.PhotoStudioView;
|
||||
}
|
||||
switch (viewType)
|
||||
{
|
||||
case ViewType.LiveView:
|
||||
StartCoroutine(StartLiveView());
|
||||
break;
|
||||
case ViewType.PhotoStudioView:
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// LiveViewを開始する
|
||||
/// </summary>
|
||||
private IEnumerator StartLiveView()
|
||||
{
|
||||
List<string> filenames = new List<string>();
|
||||
|
||||
UIManagerChara uIManagerChara = base.GetComponent<UIManagerChara>();
|
||||
UIManagerDress uIManagerDress = base.GetComponent<UIManagerDress>();
|
||||
|
||||
//楽曲データ取得
|
||||
UIManagerMusic mm = base.GetComponent<UIManagerMusic>();
|
||||
SQMusicData musicdata = mm.GetCurrentMusic();
|
||||
if (musicdata == null)
|
||||
{
|
||||
print("楽曲が選択されていません");
|
||||
yield break;
|
||||
}
|
||||
|
||||
//メインキャラ取得
|
||||
SQCharaData[] mainCharaDatas = uIManagerChara.GetCurrentCharas();
|
||||
SQDressData[] mainDressDatas = uIManagerDress.GetCurrentDresses();
|
||||
|
||||
//アナザーキャラ取得
|
||||
SQCharaData[] additionCharaDatas = uIManagerChara.GetAnotherCharas();
|
||||
SQDressData[] additionDressDatas = uIManagerDress.GetAnotherDresses();
|
||||
|
||||
SQCharaData[] charaList = new SQCharaData[15];
|
||||
SQDressData[] dressList = new SQDressData[15];
|
||||
|
||||
//並び順を変更する
|
||||
//int[] parse = new int[15] { 2, 1, 3, 0, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 };
|
||||
charaList[0] = mainCharaDatas[2];
|
||||
charaList[1] = mainCharaDatas[1];
|
||||
charaList[2] = mainCharaDatas[3];
|
||||
charaList[3] = mainCharaDatas[0];
|
||||
charaList[4] = mainCharaDatas[4];
|
||||
charaList[5] = additionCharaDatas[0];
|
||||
charaList[6] = additionCharaDatas[1];
|
||||
charaList[7] = additionCharaDatas[2];
|
||||
charaList[8] = additionCharaDatas[3];
|
||||
|
||||
dressList[0] = mainDressDatas[2];
|
||||
dressList[1] = mainDressDatas[1];
|
||||
dressList[2] = mainDressDatas[3];
|
||||
dressList[3] = mainDressDatas[0];
|
||||
dressList[4] = mainDressDatas[4];
|
||||
dressList[5] = additionDressDatas[0];
|
||||
dressList[6] = additionDressDatas[1];
|
||||
dressList[7] = additionDressDatas[2];
|
||||
dressList[8] = additionDressDatas[3];
|
||||
|
||||
//メンバー数だけ使用
|
||||
int membercount = musicdata.member_number;
|
||||
SQCharaData[] finalizeChara = new SQCharaData[membercount];
|
||||
SQDressData[] finalizeDress = new SQDressData[membercount];
|
||||
for (int i = 0; i < membercount; i++)
|
||||
{
|
||||
finalizeChara[i] = charaList[i];
|
||||
if (finalizeChara[i] == null)
|
||||
{
|
||||
finalizeChara[i] = uIManagerChara.GetRandomCharaDataWithoutAprilfool();
|
||||
}
|
||||
|
||||
finalizeDress[i] = dressList[i];
|
||||
if (finalizeDress[i] == null)
|
||||
{
|
||||
List<SQDressData> sQDressDatas;
|
||||
int save = SaveManager.GetInt("RandomMemberSet");
|
||||
switch (save)
|
||||
{
|
||||
case 0: //キャラクタのみ=衣装はデフォルト
|
||||
sQDressDatas = uIManagerDress.GetDressDataFromCharaID(finalizeChara[i].charaID);
|
||||
if (sQDressDatas != null && sQDressDatas.Count > 0)
|
||||
{
|
||||
finalizeDress[i] = sQDressDatas[0]; //先頭の衣装
|
||||
}
|
||||
else
|
||||
{
|
||||
print("衣装が選択されていません");
|
||||
yield break;
|
||||
}
|
||||
break;
|
||||
|
||||
case 1: //全衣装
|
||||
sQDressDatas = uIManagerDress.GetDressDataFromCharaID(finalizeChara[i].charaID);
|
||||
if (sQDressDatas != null && sQDressDatas.Count > 0)
|
||||
{
|
||||
finalizeDress[i] = sQDressDatas[UnityEngine.Random.Range(0, sQDressDatas.Count - 1)];
|
||||
}
|
||||
else
|
||||
{
|
||||
print("衣装が選択されていません");
|
||||
yield break;
|
||||
}
|
||||
break;
|
||||
case 2: //SSRのみ
|
||||
sQDressDatas = uIManagerDress.GetSSRDressesFromCharaID(finalizeChara[i].charaID);
|
||||
if (sQDressDatas != null && sQDressDatas.Count > 0)
|
||||
{
|
||||
finalizeDress[i] = sQDressDatas[UnityEngine.Random.Range(0, sQDressDatas.Count - 1)];
|
||||
}
|
||||
else
|
||||
{
|
||||
//SSRが見つからなかった場合は初期衣装を検索
|
||||
sQDressDatas = uIManagerDress.GetDressDataFromCharaID(finalizeChara[i].charaID);
|
||||
if (sQDressDatas != null && sQDressDatas.Count > 0)
|
||||
{
|
||||
finalizeDress[i] = sQDressDatas[UnityEngine.Random.Range(0, sQDressDatas.Count - 1)];
|
||||
}
|
||||
else
|
||||
{
|
||||
print("衣装が選択されていません");
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (musicdata.music_data_id == 2023) //O-Ku-Ri-Mo-No Sunday!
|
||||
{
|
||||
if (i == 2)
|
||||
{
|
||||
finalizeChara[i] = charaList[0];
|
||||
finalizeDress[i] = dressList[0];
|
||||
}
|
||||
if (i == 3)
|
||||
{
|
||||
finalizeChara[i] = charaList[1];
|
||||
finalizeDress[i] = dressList[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
filenames.AddRange(initLive(musicdata, finalizeChara[0]));
|
||||
filenames.AddRange(ViewLauncher.instance.shaderFiles);
|
||||
|
||||
//Cabinetを読み込み(ライブ終了毎に消えるため毎回読み込む必要がある)
|
||||
yield return MasterDBManager.instance.LoadCabinet();
|
||||
|
||||
for (int i = 0; i < membercount; i++)
|
||||
{
|
||||
filenames.AddRange(initChara(finalizeChara, finalizeDress, musicdata));
|
||||
}
|
||||
|
||||
//ファイルDL
|
||||
yield return AssetManager.instance.DownloadFromFilenames(filenames);
|
||||
|
||||
//DL完了待ち
|
||||
yield return AssetManager.instance.WaitDownloadProgress();
|
||||
|
||||
//ファイルをすべてロード
|
||||
yield return ResourcesManager.instance.LoadAssetGroup(ViewLauncher.instance.GetCommonAssetList());
|
||||
|
||||
//曲のデコード待ち
|
||||
yield return AssetManager.instance.WaitACBDecodeProgress();
|
||||
|
||||
//デバッグの設定を読み込み
|
||||
PostEffectSetting.LoadSave();
|
||||
|
||||
//ステージ系のリソースを読み込み(パーティクルがうまく読み込まれないためここへ戻す)
|
||||
yield return ResourcesManager.instance.LoadAssetGroup(ViewLauncher.instance.GetStageAssetList());
|
||||
|
||||
//DL終了
|
||||
AsyncOperation asyncLoad = SceneManager.LoadSceneAsync("LiveView");
|
||||
|
||||
while (!asyncLoad.isDone)
|
||||
{
|
||||
yield return null;
|
||||
}
|
||||
yield return null;
|
||||
}
|
||||
|
||||
private string[] initChara(SQCharaData[] charas, SQDressData[] dresses, SQMusicData live)
|
||||
{
|
||||
CharaDirector[] charadirector = new CharaDirector[charas.Length];
|
||||
List<string> filenames = new List<string>();
|
||||
|
||||
for (int i = 0; i < charas.Length; i++)
|
||||
{
|
||||
bool isAtt = false;
|
||||
SQCharaData charaData = null;
|
||||
SQDressData dressData = null;
|
||||
|
||||
//ちひろ、最上、ジュリアが共通衣装を着ていた場合はアペンド扱いとなる
|
||||
bool special = false;
|
||||
if(charas[i].charaID == 20 || charas[i].charaID == 313 || charas[i].charaID == 314)
|
||||
{
|
||||
if(dresses[i].dressID < 100)
|
||||
{
|
||||
special = true;
|
||||
}
|
||||
}
|
||||
|
||||
//キャラと衣装が異なる
|
||||
if ((dresses[i].charaID > 0 && charas[i].charaID != dresses[i].charaID) || special)
|
||||
{
|
||||
charaData = GameObject.Find("UIManager").GetComponent<UIManagerChara>().GetCharaData(special ? charas[i].charaID : dresses[i].charaID);
|
||||
//キャラが着れる最初のドレス(基本はスターリースカイブライト。それを着れない特殊キャラ用)
|
||||
var cdress = GameObject.Find("UIManager").GetComponent<UIManagerDress>().GetDressDataFromCharaID(charas[i].charaID);
|
||||
dressData = cdress[0];
|
||||
isAtt = true;
|
||||
}
|
||||
|
||||
if (isAtt)
|
||||
{
|
||||
charadirector[i] = new CharaDirector(charas[i], dressData, charaData, dresses[i], live, i);
|
||||
Character3DBase.GetAssetBundleList(filenames, charas[i].charaID, dressData.activeDressID, dressData.activeDressID);
|
||||
Character3DBase.GetAssetBundleList(filenames, charaData.charaID, dresses[i].activeDressID, dresses[i].activeDressID);
|
||||
}
|
||||
else
|
||||
{
|
||||
charadirector[i] = new CharaDirector(charas[i], dresses[i], live, i);
|
||||
Character3DBase.GetAssetBundleList(filenames, charas[i].charaID, dresses[i].activeDressID, dresses[i].activeDressID);
|
||||
}
|
||||
}
|
||||
|
||||
ViewLauncher.instance.SetValue(charadirector);
|
||||
|
||||
return filenames.ToArray();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 楽曲データから必要なアセットデータファイルを取得する
|
||||
/// </summary>
|
||||
private string[] initLive(SQMusicData live, SQCharaData chara)
|
||||
{
|
||||
LiveDirector liveDirector = null;
|
||||
List<string> filenames = new List<string>();
|
||||
|
||||
if (isHighQuality)
|
||||
{
|
||||
LiveDirectorHQ md = new LiveDirectorHQ(live);
|
||||
|
||||
if (AssetManager.instance.CheckExistFileInManifest(md.stageFile))
|
||||
{
|
||||
liveDirector = md;
|
||||
}
|
||||
else
|
||||
{
|
||||
liveDirector = new LiveDirectorNormal(live);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
liveDirector = new LiveDirectorNormal(live);
|
||||
}
|
||||
|
||||
//縦モード判定
|
||||
int smart = SaveManager.GetInt("SmartMode");
|
||||
if (smart == 1)
|
||||
{
|
||||
liveDirector.SetIsSmartMode(true);
|
||||
bool isexist = AssetManager.instance.CheckExistFileInManifest(liveDirector.cuttFile);
|
||||
//縦モードファイルが無ければオフ
|
||||
if (!isexist)
|
||||
{
|
||||
liveDirector.SetIsSmartMode(false);
|
||||
}
|
||||
}
|
||||
|
||||
//アナザー楽曲判定
|
||||
int another = SaveManager.GetInt("AnotherSong");
|
||||
if (another == 1)
|
||||
{
|
||||
liveDirector.SetAnotherMode(true);
|
||||
bool isexist = AssetManager.instance.CheckExistFileInManifest(liveDirector.musicFile);
|
||||
//アナザーソングファイルが無ければオフ
|
||||
if (!isexist)
|
||||
{
|
||||
liveDirector.SetAnotherMode(false);
|
||||
}
|
||||
}
|
||||
|
||||
//ソロ楽曲判定
|
||||
int solo = SaveManager.GetInt("SoloSong");
|
||||
if (solo == 1)
|
||||
{
|
||||
liveDirector.SetSoloCharaID(chara.charaID);
|
||||
bool isexist = AssetManager.instance.CheckExistFileInManifest(liveDirector.musicFile);
|
||||
//ソロソングファイルが無ければオフ
|
||||
if (!isexist)
|
||||
{
|
||||
liveDirector.SetSoloCharaID(-1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
liveDirector.SetSoloCharaID(-1);
|
||||
}
|
||||
|
||||
ViewLauncher.instance.liveDirector = liveDirector;
|
||||
filenames.AddRange(liveDirector.GetAssetFiles());
|
||||
|
||||
return filenames.ToArray();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// キャラクターがHQモデルに対応しているか確認
|
||||
/// 現状だとエイプリルフール曲だけ非対応?
|
||||
/// </summary>
|
||||
private bool CheckCharaHQ(SQCharaData charas, SQDressData dresses, SQMusicData music)
|
||||
{/*
|
||||
CharaDirectorHQ cd = new CharaDirectorHQ(charas, dresses, music, 0);
|
||||
|
||||
return AssetManager.instance.CheckExistFileInManifest(cd.BodyModel);
|
||||
*/
|
||||
return true;
|
||||
}
|
||||
|
||||
public IEnumerator firstDownload()
|
||||
{
|
||||
while (!AssetManager.instance.isManifestLoad)
|
||||
{
|
||||
if (MasterDBManager.instance.isError || ManifestManager.instance.isError)
|
||||
{
|
||||
yield break;
|
||||
}
|
||||
yield return null;
|
||||
}
|
||||
|
||||
List<string> filenames = new List<string>();
|
||||
filenames.AddRange(ViewLauncher.instance.assetFiles);
|
||||
|
||||
StartCoroutine(AssetManager.instance.DownloadFromFilenamesAsync(filenames));
|
||||
//DL完了待ち
|
||||
yield return AssetManager.instance.WaitDownloadProgress();
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c1667c4adde42fa43a34b5196b613f5d
|
||||
timeCreated: 1529813952
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,120 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class UIUnitPanel : MonoBehaviour
|
||||
{
|
||||
private Text UnitName;
|
||||
|
||||
public GameObject chara0;
|
||||
public GameObject chara1;
|
||||
public GameObject chara2;
|
||||
public GameObject chara3;
|
||||
public GameObject chara4;
|
||||
|
||||
//public Button btUI;
|
||||
public Button btSelect;
|
||||
public Button btDelete;
|
||||
public Button btRename;
|
||||
public Button btUpper;
|
||||
public Button btDowner;
|
||||
|
||||
public InputField inputField;
|
||||
|
||||
private SaveManager.IdolSet _data;
|
||||
|
||||
public SaveManager.IdolSet data
|
||||
{
|
||||
get
|
||||
{
|
||||
return _data;
|
||||
}
|
||||
}
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
base.name = base.name.Replace("(Clone)", "");
|
||||
|
||||
UnitName = base.transform.Find("UI/Header/Title").GetComponent<Text>();
|
||||
|
||||
chara0 = base.transform.Find("UI/Chara0").gameObject;
|
||||
chara1 = base.transform.Find("UI/Chara1").gameObject;
|
||||
chara2 = base.transform.Find("UI/Chara2").gameObject;
|
||||
chara3 = base.transform.Find("UI/Chara3").gameObject;
|
||||
chara4 = base.transform.Find("UI/Chara4").gameObject;
|
||||
|
||||
btSelect = base.transform.Find("Select").GetComponent<Button>();
|
||||
btDelete = base.transform.Find("Delete").GetComponent<Button>();
|
||||
btUpper = base.transform.Find("UP").GetComponent<Button>();
|
||||
btDowner = base.transform.Find("DOWN").GetComponent<Button>();
|
||||
btRename = base.transform.Find("Rename").GetComponent<Button>();
|
||||
|
||||
inputField = base.transform.Find("InputField").GetComponent<InputField>();
|
||||
}
|
||||
|
||||
// Use this for initialization
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void OnClickUpButton()
|
||||
{
|
||||
int place = base.transform.GetSiblingIndex();
|
||||
if (place > 0) place -= 1;
|
||||
base.transform.SetSiblingIndex(place);
|
||||
}
|
||||
|
||||
public void OnClickDownButton()
|
||||
{
|
||||
int place = base.transform.GetSiblingIndex();
|
||||
base.transform.SetSiblingIndex(place + 1);
|
||||
}
|
||||
|
||||
public void OnClickDeleteButton()
|
||||
{
|
||||
Destroy(base.gameObject);
|
||||
}
|
||||
|
||||
private void SetUnitName(string name)
|
||||
{
|
||||
_data.unitname = name;
|
||||
UnitName.text = _data.unitname;
|
||||
}
|
||||
|
||||
public void SetIdolUnit(SaveManager.IdolSet set)
|
||||
{
|
||||
_data = set;
|
||||
SetUnitName(_data.unitname);
|
||||
}
|
||||
|
||||
public void OnClickRename()
|
||||
{
|
||||
inputField.text = UnitName.text;
|
||||
inputField.gameObject.SetActive(true);
|
||||
inputField.ActivateInputField();
|
||||
|
||||
UnitName.gameObject.SetActive(false);
|
||||
btRename.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
public void OnEndEditName()
|
||||
{
|
||||
string text = inputField.text;
|
||||
|
||||
_data.unitname = text;
|
||||
UnitName.text = _data.unitname;
|
||||
|
||||
inputField.gameObject.SetActive(false);
|
||||
UnitName.gameObject.SetActive(true);
|
||||
btRename.gameObject.SetActive(true);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 91b24584e2f77b74e9ad03ae46c1a501
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user