123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149 |
- using System;
- using System.Collections.Generic;
- using UnityEngine;
- using Yotogis;
- public class YotogiSkillSelectSpecialCondition : MonoBehaviour
- {
- public Skill.Data.SpecialConditionType[] checkBoxTypes
- {
- get
- {
- List<Skill.Data.SpecialConditionType> list = new List<Skill.Data.SpecialConditionType>();
- foreach (YotogiSkillSelectSpecialCondition.CheckBoxButtonData checkBoxButtonData in this.checkBoxButtonDatas)
- {
- list.Add(checkBoxButtonData.type);
- }
- return list.ToArray();
- }
- }
- public Skill.Data.SpecialConditionType selectedType
- {
- get
- {
- return this.selectedType_;
- }
- set
- {
- YotogiSkillSelectSpecialCondition.CheckBoxButtonData checkBoxButtonData = null;
- foreach (YotogiSkillSelectSpecialCondition.CheckBoxButtonData checkBoxButtonData2 in this.checkBoxButtonDatas)
- {
- if (checkBoxButtonData2.type == value)
- {
- checkBoxButtonData = checkBoxButtonData2;
- break;
- }
- }
- for (int j = 0; j < this.checkBoxButtonDatas.Length; j++)
- {
- YotogiSkillSelectSpecialCondition.CheckBoxButtonData checkBoxButtonData3 = this.checkBoxButtonDatas[j];
- if (checkBoxButtonData3.checkBox.enabled)
- {
- bool flag = checkBoxButtonData3 == checkBoxButtonData;
- if (flag)
- {
- this.selectedType_ = checkBoxButtonData3.type;
- }
- checkBoxButtonData3.checkBox.check = (checkBoxButtonData3 == checkBoxButtonData);
- checkBoxButtonData3.checkBox.Button.GetComponent<BoxCollider>().enabled = !checkBoxButtonData3.checkBox.check;
- }
- }
- if (this.onChangeSelectedTypeEvent != null)
- {
- this.onChangeSelectedTypeEvent(this.selectedType_);
- }
- }
- }
- public void Awake()
- {
- foreach (YotogiSkillSelectSpecialCondition.CheckBoxButtonData checkBoxButtonData in this.checkBoxButtonDatas)
- {
- checkBoxButtonData.type = (Skill.Data.SpecialConditionType)Enum.Parse(typeof(Skill.Data.SpecialConditionType), checkBoxButtonData.specialConditionName);
- checkBoxButtonData.checkBox.check = false;
- checkBoxButtonData.checkBox.Button.GetComponent<BoxCollider>().enabled = !checkBoxButtonData.checkBox.check;
- checkBoxButtonData.checkBox.onClick.Add(new Action<WFCheckBox>(this.OnClickCheckBox));
- }
- this.SetTypeCheckBoxEnabled(Skill.Data.SpecialConditionType.Mask, false);
- }
- public void SetTypeCheckBoxEnabled(Skill.Data.SpecialConditionType type, bool enabled)
- {
- if (type != Skill.Data.SpecialConditionType.Null)
- {
- foreach (YotogiSkillSelectSpecialCondition.CheckBoxButtonData checkBoxButtonData in this.checkBoxButtonDatas)
- {
- if (checkBoxButtonData.type == type)
- {
- WFCheckBox checkBox = checkBoxButtonData.checkBox;
- if (!enabled)
- {
- checkBox.check = false;
- checkBoxButtonData.checkBox.Button.GetComponent<BoxCollider>().enabled = false;
- UTY.GetChildObject(checkBox.CheckMarkOffObject, "Button", false).GetComponent<UISprite>().color = new Color(0.5f, 0.5f, 0.5f, 0.68f);
- }
- else
- {
- checkBox.enabled = true;
- checkBoxButtonData.checkBox.Button.GetComponent<BoxCollider>().enabled = true;
- UTY.GetChildObject(checkBox.CheckMarkOffObject, "Button", false).GetComponent<UISprite>().color = new Color(1f, 1f, 1f, 0.68f);
- }
- break;
- }
- }
- }
- }
- private void OnClickCheckBox(WFCheckBox clickCheckBox)
- {
- if (clickCheckBox.check)
- {
- foreach (YotogiSkillSelectSpecialCondition.CheckBoxButtonData checkBoxButtonData in this.checkBoxButtonDatas)
- {
- checkBoxButtonData.checkBox.check = (checkBoxButtonData.checkBox == clickCheckBox);
- checkBoxButtonData.checkBox.Button.GetComponent<BoxCollider>().enabled = !checkBoxButtonData.checkBox.check;
- }
- }
- int j;
- for (j = 0; j < this.checkBoxButtonDatas.Length; j++)
- {
- if (this.checkBoxButtonDatas[j].checkBox.check)
- {
- break;
- }
- }
- if (j + 1 > this.checkBoxButtonDatas.Length)
- {
- this.selectedType_ = Skill.Data.SpecialConditionType.Null;
- }
- else
- {
- this.selectedType_ = this.checkBoxButtonDatas[j].type;
- }
- if (this.onChangeSelectedTypeEvent != null)
- {
- this.onChangeSelectedTypeEvent(this.selectedType_);
- }
- }
- [SerializeField]
- private YotogiSkillSelectSpecialCondition.CheckBoxButtonData[] checkBoxButtonDatas;
- public Action<Skill.Data.SpecialConditionType> onChangeSelectedTypeEvent;
- private Skill.Data.SpecialConditionType selectedType_;
- [Serializable]
- private class CheckBoxButtonData
- {
- [SerializeField]
- public WFCheckBox checkBox;
- [SerializeField]
- public string specialConditionName;
- [NonSerialized]
- public Skill.Data.SpecialConditionType type;
- }
- }
|