123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308 |
- using System;
- using System.Collections.Generic;
- using I2.Loc;
- using MaidStatus;
- using UnityEngine;
- using Yotogis;
- public class YotogiSkillUnit : MonoBehaviour
- {
- public void Awake()
- {
- this.icon_ = UTY.GetChildObject(base.gameObject, "Icon", false).GetComponent<YotogiSkillIcon>();
- this.new_icon_ = UTY.GetChildObject(base.gameObject, "IconNew", false).GetComponent<UISprite>();
- UTY.GetChildObject(base.gameObject, "levelup", false).SetActive(false);
- GameObject childObject = UTY.GetChildObject(base.gameObject, "Description", false);
- this.gauge_obj_ = UTY.GetChildObject(childObject, "Gauge", false);
- this.name_obj_ = UTY.GetChildObject(childObject, "Name", false);
- this.stargroup_obj_ = UTY.GetChildObject(childObject, "StarGroup", false);
- GameObject childObject2 = UTY.GetChildObject(childObject, "UnderGroup", false);
- this.acquired_experience_obj = UTY.GetChildObject(UTY.GetChildObject(childObject2, "AcquiredExperience", false), "Value", false);
- this.cost_of_hp_obj = UTY.GetChildObject(UTY.GetChildObject(childObject2, "CostOfHp", false), "Value", false);
- this.button_ = UTY.GetChildObject(base.gameObject, "Button", false).GetComponent<UIButton>();
- this.mouseEventObject = UTY.GetChildObject(base.gameObject, "OverHit", false);
- UIEventTrigger component = this.mouseEventObject.GetComponent<UIEventTrigger>();
- EventDelegate.Add(component.onHoverOver, new EventDelegate.Callback(this.OnHoverOverItem));
- EventDelegate.Add(component.onHoverOut, new EventDelegate.Callback(this.OnHoverOutItem));
- EventDelegate.Add(component.onRelease, new EventDelegate.Callback(this.OnHoverOutItem));
- this.mouseEventObject.SetActive(false);
- }
- public void SetConditionsPanel(GameObject conditionsObject)
- {
- this.conditionsObject = conditionsObject;
- this.conditionList = conditionsObject.GetComponentInChildren<UIWFConditionList>();
- NDebug.AssertNull(this.conditionList != null);
- this.conditionBG = UTY.GetChildObject(conditionsObject, "BG", false).GetComponent<UIWidget>();
- this.conditionTitleLabel = UTY.GetChildObject(conditionsObject, "Condition/Title/Name", false).GetComponent<UILabel>();
- this.initCondtionTitleFontSize = this.conditionTitleLabel.fontSize;
- conditionsObject.SetActive(false);
- }
- public bool isEnabled
- {
- get
- {
- return this.button_.isEnabled;
- }
- set
- {
- if (this.lock_unit_ != null)
- {
- this.lock_unit_.enabled = value;
- }
- this.button_.isEnabled = value;
- if (!value)
- {
- this.new_icon_.color = new Color(0.5f, 0.5f, 0.5f, this.new_icon_.color.a);
- this.icon_.color = Color.gray;
- }
- else
- {
- this.new_icon_.color = new Color(1f, 1f, 1f, this.new_icon_.color.a);
- this.icon_.color = Color.white;
- if (this.lock_unit_ != null)
- {
- this.lock_unit_.SetSkillData(this.param_data_);
- }
- }
- this.mouseEventObject.SetActive(!value);
- }
- }
- public void SetSkillData(Maid maid, Skill.Data set_skill_data, YotogiSkillData param_data, YotogiSkillLockUnit lock_unit, KeyValuePair<string[], bool>[] conditionDatas = null)
- {
- this.maid_ = maid;
- this.skill_data_ = set_skill_data;
- this.param_data_ = param_data;
- this.lock_unit_ = lock_unit;
- this.conditionDatas_ = null;
- if (this.lock_unit_ != null)
- {
- this.lock_unit_.SetSkillData(param_data);
- }
- this.name_obj_.GetComponent<UILabel>().text = this.skill_data_.name;
- this.name_obj_.GetComponent<Localize>().SetTerm(this.skill_data_.termName);
- this.acquired_experience_obj.GetComponent<UILabel>().text = this.skill_data_.add_yotogi_class_exp.ToString();
- this.cost_of_hp_obj.GetComponent<UILabel>().text = this.skill_data_.exec_need_hp.ToString();
- this.icon_.SetSkillData(this.skill_data_);
- if (this.param_data_ == null || 0u < this.param_data_.playCount)
- {
- this.new_icon_.gameObject.SetActive(false);
- }
- else
- {
- this.new_icon_.gameObject.SetActive(true);
- }
- this.UpdateGage((this.param_data_ == null) ? null : this.param_data_.expSystem);
- if (this.param_data_ == null)
- {
- if (conditionDatas != null && 0 < conditionDatas.Length)
- {
- this.conditionDatas_ = new KeyValuePair<string[], Color>[conditionDatas.Length];
- int num = 0;
- foreach (KeyValuePair<string[], bool> keyValuePair in conditionDatas)
- {
- this.conditionDatas_[num++] = new KeyValuePair<string[], Color>(keyValuePair.Key, (!keyValuePair.Value) ? Color.gray : Color.white);
- }
- }
- this.isEnabled = false;
- }
- }
- public void SetExpAnime(int start_total_exp, int add_exp, float anime_time)
- {
- if (anime_time <= 0f)
- {
- return;
- }
- this.result_anime_exp_system_ = (SimpleExperienceSystem)this.param_data_.expSystem.Clone();
- this.result_anime_exp_system_.SetTotalExp(start_total_exp + add_exp);
- add_exp = this.result_anime_exp_system_.GetTotalExp() - start_total_exp;
- if (add_exp <= 0)
- {
- return;
- }
- this.result_anime_exp_system_.SetTotalExp(start_total_exp);
- this.UpdateGage(this.result_anime_exp_system_);
- this.anime_event_ = delegate()
- {
- iTween.ValueTo(this.gameObject, iTween.Hash(new object[]
- {
- "from",
- start_total_exp,
- "to",
- start_total_exp + add_exp,
- "time",
- anime_time,
- "onupdate",
- "UpdateValue"
- }));
- };
- }
- public void StartAnime()
- {
- if (this.anime_event_ != null)
- {
- this.anime_event_();
- this.anime_event_ = null;
- }
- }
- public void UpdateValue(int value)
- {
- if (this.result_anime_exp_system_ == null)
- {
- return;
- }
- int currentLevel = this.result_anime_exp_system_.GetCurrentLevel();
- this.result_anime_exp_system_.SetTotalExp(value);
- if (currentLevel < this.result_anime_exp_system_.GetCurrentLevel() && !UTY.GetChildObject(base.gameObject, "levelup", false).activeSelf)
- {
- GameMain.Instance.SoundMgr.PlaySystem("SE008.ogg");
- UTY.GetChildObject(base.gameObject, "levelup", false).SetActive(true);
- }
- this.UpdateGage(this.result_anime_exp_system_);
- }
- public void UpdateGage(IExperienceSystem exp_system)
- {
- if (this.skill_data_ == null)
- {
- return;
- }
- int num = 0;
- if (exp_system != null)
- {
- num = exp_system.GetCurrentLevel();
- }
- GameObject[] array = new GameObject[3];
- for (int i = 0; i < array.Length; i++)
- {
- array[i] = UTY.GetChildObject(this.stargroup_obj_, "Star" + i.ToString(), false);
- array[i].SetActive(i <= num - 1);
- }
- float num2 = 0f;
- if (exp_system != null && exp_system.GetNextLevelExp(num) != 0)
- {
- num2 = (float)exp_system.GetCurrentExp() / (float)exp_system.GetNextLevelExp(num);
- }
- if (float.IsNaN(num2))
- {
- num2 = 0f;
- }
- else if (float.IsInfinity(num2))
- {
- num2 = 1f;
- }
- this.gauge_obj_.GetComponent<Transform>().localScale = new Vector3(num2, 1f, 1f);
- }
- private void OnHoverOverItem()
- {
- if (this.conditionsObject == null)
- {
- return;
- }
- if (this.conditionDatas_ == null)
- {
- this.OnHoverOutItem();
- return;
- }
- this.conditionTitleLabel.text = this.skill_data_.name + " 習得条件";
- if (Product.SPP)
- {
- Localize component = this.conditionTitleLabel.GetComponent<Localize>();
- if (component != null)
- {
- string termName = this.skill_data_.termName;
- Localize.ArgsPair[] termArgs = new Localize.ArgsPair[]
- {
- Localize.ArgsPair.Create(" {0}", false),
- Localize.ArgsPair.Create("System/取得条件", true)
- };
- component.TermArgs = termArgs;
- component.SetTerm(termName);
- }
- }
- else if (20 < this.conditionTitleLabel.text.Length)
- {
- this.conditionTitleLabel.fontSize = 20;
- }
- else
- {
- this.conditionTitleLabel.fontSize = this.initCondtionTitleFontSize;
- }
- this.conditionList.SetTexts(this.conditionDatas_, -1);
- this.conditionBG.height = 90 + this.conditionList.height;
- this.conditionsObject.SetActive(true);
- }
- private void OnHoverOutItem()
- {
- if (this.conditionsObject == null)
- {
- return;
- }
- this.conditionsObject.SetActive(false);
- }
- public Skill.Data skill_data
- {
- get
- {
- return this.skill_data_;
- }
- }
- public YotogiSkillData skill_param_data
- {
- get
- {
- return this.param_data_;
- }
- }
- private Maid maid_;
- private Skill.Data skill_data_;
- private YotogiSkillData param_data_;
- private YotogiSkillLockUnit lock_unit_;
- private UIButton button_;
- private YotogiSkillIcon icon_;
- private UISprite new_icon_;
- private GameObject gauge_obj_;
- private GameObject name_obj_;
- private GameObject stargroup_obj_;
- private GameObject acquired_experience_obj;
- private GameObject cost_of_hp_obj;
- private GameObject mouseEventObject;
- private KeyValuePair<string[], Color>[] conditionDatas_;
- private GameObject conditionsObject;
- private UILabel conditionTitleLabel;
- private UIWFConditionList conditionList;
- private UIWidget conditionBG;
- private int initCondtionTitleFontSize;
- private IExperienceSystem result_anime_exp_system_;
- private Action anime_event_;
- }
|