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(); this.new_icon_ = UTY.GetChildObject(base.gameObject, "IconNew", false).GetComponent(); 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(); this.mouseEventObject = UTY.GetChildObject(base.gameObject, "OverHit", false); UIEventTrigger component = this.mouseEventObject.GetComponent(); 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(); NDebug.AssertNull(this.conditionList != null); this.conditionBG = UTY.GetChildObject(conditionsObject, "BG", false).GetComponent(); this.conditionTitleLabel = UTY.GetChildObject(conditionsObject, "Condition/Title/Name", false).GetComponent(); 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[] 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().text = this.skill_data_.name; this.name_obj_.GetComponent().SetTerm(this.skill_data_.termName); this.acquired_experience_obj.GetComponent().text = this.skill_data_.add_yotogi_class_exp.ToString(); this.cost_of_hp_obj.GetComponent().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[conditionDatas.Length]; int num = 0; foreach (KeyValuePair keyValuePair in conditionDatas) { this.conditionDatas_[num++] = new KeyValuePair(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().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.supportMultiLanguage) { Localize component = this.conditionTitleLabel.GetComponent(); 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[] 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_; }