private void CreateConditionsItems(UnitData unitData, TobiraConditionParam[] condition_params) { List <ConditionsResult> conditionsResultList = TobiraUtility.TobiraConditionsCheck(unitData, condition_params); int num = Mathf.Max(this.mTobiraConditions.Count, conditionsResultList.Count); for (int index = 0; index < num; ++index) { if (this.mTobiraConditions.Count <= index) { UnitTobiraConditionsItem component = (UnitTobiraConditionsItem)((GameObject)UnityEngine.Object.Instantiate <GameObject>((M0)((Component)this.mTobiraConditionsTemplate).get_gameObject())).GetComponent <UnitTobiraConditionsItem>(); ((Component)component).get_transform().SetParent(((Component)this.mTobiraConditionsContent).get_transform(), false); this.mTobiraConditions.Add(component); } UnitTobiraConditionsItem mTobiraCondition = this.mTobiraConditions[index]; if (conditionsResultList.Count <= index) { ((Component)mTobiraCondition).get_gameObject().SetActive(false); } else { mTobiraCondition.Setup(conditionsResultList[index]); ((Component)mTobiraCondition).get_gameObject().SetActive(true); } } }
public void Setup(TobiraData tobiraData) { if (tobiraData == null) { DebugUtility.LogError("tobiraDataがnullの時はSetup(TobiraParam param)を使用してください"); } else { this.m_Category = tobiraData.Param.TobiraCategory; this.m_TextTobiraName.set_text(TobiraParam.GetCategoryName(this.m_Category)); this.m_IconTobira.ImageIndex = (int)this.m_Category; if (tobiraData.IsLearnedLeaderSkill) { TobiraLearnSkill listItem = this.CreateListItem(); SkillData skill = new SkillData(); skill.Setup(tobiraData.LearnedLeaderSkillIname, 1, 1, (MasterParam)null); listItem.Setup(skill); } List <AbilityData> newAbilitys = new List <AbilityData>(); List <AbilityData> oldAbilitys = new List <AbilityData>(); TobiraUtility.TryCraeteAbilityData(tobiraData.Param, tobiraData.Lv, newAbilitys, oldAbilitys, false); for (int index = 0; index < newAbilitys.Count; ++index) { this.CreateListItem().Setup(newAbilitys[index]); } BaseStatus add = new BaseStatus(); BaseStatus scale = new BaseStatus(); TobiraUtility.CalcTobiraParameter(tobiraData.Param.UnitIname, this.m_Category, tobiraData.Lv, ref add, ref scale); this.m_StatusList.SetValues(add, scale, false); GameUtility.SetGameObjectActive(this.m_ObjectDetail, true); GameUtility.SetGameObjectActive(this.m_ObjectLock, false); GameUtility.SetGameObjectActive(this.m_ObjectCommingSoon, false); } }
private void Start() { if (UnityEngine.Object.op_Equality((UnityEngine.Object) this.mConditionObjectTemplate, (UnityEngine.Object)null)) { return; } this.mConditionObjectTemplate.SetActive(false); UnitData unitDataByUniqueId = MonoSingleton <GameManager> .Instance.Player.FindUnitDataByUniqueID((long)GlobalVars.SelectedUnitUniqueID); TobiraParam.Category unitTobiraCategory = (TobiraParam.Category)GlobalVars.PreBattleUnitTobiraCategory; if (unitDataByUniqueId == null || unitTobiraCategory <= TobiraParam.Category.START || unitTobiraCategory >= TobiraParam.Category.MAX) { return; } this.mLayoutObjects = new GameObject[6]; this.mLayoutObjects[1] = this.mLayout_UnitLevel; this.mLayoutObjects[2] = this.mLayout_UnitAwake; this.mLayoutObjects[3] = this.mLayout_JobLevel; this.mLayoutObjects[4] = this.mLayout_TobiraLevel; this.mLayoutObjects[5] = this.mLayout_TobiraOpen; this.mLayoutObjects[0] = this.mLayout_None; TobiraConditionParam[] conditionsForUnit = MonoSingleton <GameManager> .Instance.MasterParam.GetTobiraConditionsForUnit(unitDataByUniqueId.UnitID, unitTobiraCategory); List <ConditionsResult> conditionsResultList = TobiraUtility.TobiraConditionsCheck(unitDataByUniqueId, conditionsForUnit); for (int index = 0; index < conditionsResultList.Count; ++index) { this.CreateLayout(conditionsResultList[index]); } }
public void Refresh(UnitData unitData, TobiraData tobiraData, TobiraParam tobiraParam) { if (UnityEngine.Object.op_Equality((UnityEngine.Object) this.TobiraTitleText, (UnityEngine.Object)null)) { return; } this.TobiraTitleText.set_text(TobiraParam.GetCategoryName(tobiraParam.TobiraCategory)); if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.AdditionalLevelCap, (UnityEngine.Object)null)) { this.AdditionalLevelCap.set_text(MonoSingleton <GameManager> .Instance.MasterParam.FixParam.TobiraUnitLvCapBonus.ToString()); } if (tobiraData == null) { this.TobiraParamIconEnable.SetActive(false); this.TobiraParamIconDisable.SetActive(true); Array.ForEach <UnitTobiraParamLevel>(this.TobiraParamIconLevels, (Action <UnitTobiraParamLevel>)(paramLevel => paramLevel.Refresh(0))); this.LockView(unitData, tobiraParam); this.mTobiraParameters.ForEach((Action <GameObject>)(paramGO => UnityEngine.Object.Destroy((UnityEngine.Object)paramGO))); this.mTobiraParameters.Clear(); BaseStatus add = new BaseStatus(); BaseStatus scale = new BaseStatus(); TobiraUtility.CalcTobiraParameter(unitData.UnitID, tobiraParam.TobiraCategory, 1, ref add, ref scale); this.Status.SetValues(add, scale, true); TobiraConditionParam[] conditionsForUnit = MonoSingleton <GameManager> .Instance.MasterParam.GetTobiraConditionsForUnit(unitData.UnitID, tobiraParam.TobiraCategory); this.CreateConditionsItems(unitData, conditionsForUnit); } else { if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.TobiraIcons, (UnityEngine.Object)null)) { this.TobiraIcons.ImageIndex = (int)tobiraData.Param.TobiraCategory; } this.TobiraParamIconEnable.SetActive(tobiraData.IsUnlocked); this.TobiraParamIconDisable.SetActive(!tobiraData.IsUnlocked); int level = tobiraData.ViewLv; Array.ForEach <UnitTobiraParamLevel>(this.TobiraParamIconLevels, (Action <UnitTobiraParamLevel>)(paramLevel => paramLevel.Refresh(level))); if (tobiraData.IsUnlocked) { this.UnlockView(unitData, tobiraData); } else { this.LockView(unitData, tobiraParam); } this.mTobiraParameters.ForEach((Action <GameObject>)(paramGO => UnityEngine.Object.Destroy((UnityEngine.Object)paramGO))); this.mTobiraParameters.Clear(); BaseStatus add = new BaseStatus(); BaseStatus scale = new BaseStatus(); TobiraUtility.CalcTobiraParameter(unitData.UnitID, tobiraData.Param.TobiraCategory, tobiraData.Lv, ref add, ref scale); this.Status.SetValues(add, scale, false); this.SetActiveConditionsItems(false); } this.SetMasterBonusText(tobiraParam); }
private void LockView(UnitData unitData, TobiraParam tobiraParam) { this.TobiraOpenButtonText.set_text(string.Format(LocalizedText.Get("sys.TOBIRA_INVENTORY_OPEN_TITLE"), (object)TobiraParam.GetCategoryName(tobiraParam.TobiraCategory))); this.mLockedLayout.SetActive(true); this.mTobiraConditionsLayout.SetActive(true); this.mUnlockedLayout.SetActive(false); this.mTobiraMasterBonusLayout.SetActive(false); this.mTobiraMasterEbaleLayout.SetActive(false); bool isEnable = TobiraUtility.IsClearAllToboraConditions(unitData, tobiraParam.TobiraCategory); ((Selectable)this.TobiraOpenButton.GetComponent <Button>()).set_interactable(isEnable); UnitTobiraParamWindow.SetHilightAnimationEnable(this.TobiraOpenButton, isEnable); }
public static bool IsClearAllToboraRecipe(UnitData unit_data, TobiraParam.Category tobira_category, int tobiraLv) { bool flag = true; List <ConditionsResult> conditionsResultList = TobiraUtility.TobiraRecipeCheck(unit_data, tobira_category, tobiraLv); for (int index = 0; index < conditionsResultList.Count; ++index) { if (!conditionsResultList[index].isClear) { flag = false; break; } } return(flag); }
public void Setup(TobiraParam param) { this.m_Category = param.TobiraCategory; this.m_TextTobiraName.set_text(TobiraParam.GetCategoryName(this.m_Category)); this.m_IconTobira.ImageIndex = (int)this.m_Category; if (param.Enable) { BaseStatus add = new BaseStatus(); BaseStatus scale = new BaseStatus(); TobiraUtility.CalcTobiraParameter(param.UnitIname, this.m_Category, 1, ref add, ref scale); this.m_StatusList.SetValues(add, scale, true); } GameUtility.SetGameObjectActive(this.m_ObjectDetail, param.Enable); GameUtility.SetGameObjectActive(this.m_ObjectLock, param.Enable); GameUtility.SetGameObjectActive(this.m_ObjectCommingSoon, !param.Enable); }
public bool Setup(string unit_iname, TobiraParam.Category category, int lv) { this.mLv = lv; this.mTobiraParam = MonoSingleton <GameManager> .Instance.MasterParam.GetTobiraParam(unit_iname, category); if (this.mTobiraParam == null) { return(false); } this.mParameterBuffSkill = TobiraUtility.CreateParameterBuffSkill(this.mTobiraParam, this.mLv); if (this.mTobiraParam.HasLeaerSkill && lv >= this.mTobiraParam.OverwriteLeaderSkillLevel) { this.mLearnedLeaderSkillIname = this.mTobiraParam.OverwriteLeaderSkillIname; } return(this.mParameterBuffSkill != null); }
public void Refresh() { Button component = (Button)((Component)this).GetComponent <Button>(); if (UnityEngine.Object.op_Equality((UnityEngine.Object)component, (UnityEngine.Object)null) || this.mCategory <= TobiraParam.Category.START || TobiraParam.Category.MAX <= this.mCategory) { ((Component)this).get_gameObject().SetActive(false); } this.TobiraEnableImages.ImageIndex = (int)(this.mCategory - 1); this.TobiraDisableImages.ImageIndex = (int)(this.mCategory - 1); this.mParam = MonoSingleton <GameManager> .Instance.MasterParam.GetTobiraParam(this.mUnit.UnitID, this.mCategory); if (this.mParam == null || !this.mParam.Enable) { ((Selectable)component).set_interactable(false); this.LockGO.SetActive(true); } else { TobiraData tobiraData = this.mUnit.TobiraData.Find((Predicate <TobiraData>)(tobira => tobira.Param.TobiraCategory == this.mCategory)); bool flag = tobiraData != null && tobiraData.IsUnlocked; if (!flag) { bool isEnable = TobiraUtility.IsClearAllToboraConditions(this.mUnit, this.mCategory); this.DisableGO.SetActive(true); this.SetHilightAnimationEnable(isEnable); this.EnableGO.SetActive(false); } else { this.DisableGO.SetActive(false); this.SetHilightAnimationEnable(false); this.EnableGO.SetActive(true); } if (this.LevelIconGOList == null || this.LevelIconGOList.Length == 0 || !flag) { return; } for (int index = 0; index < this.LevelIconGOList.Length; ++index) { if (!UnityEngine.Object.op_Equality((UnityEngine.Object) this.LevelIconGOList[index], (UnityEngine.Object)null)) { this.LevelIconGOList[index].SetActive(index < tobiraData.ViewLv); } } } }
public static bool IsClearAllToboraConditions(UnitData unit_data, TobiraParam.Category tobira_category) { TobiraConditionParam[] conditionsForUnit = MonoSingleton <GameManager> .Instance.MasterParam.GetTobiraConditionsForUnit(unit_data.UnitID, tobira_category); if (conditionsForUnit == null) { return(true); } bool flag = true; List <ConditionsResult> conditionsResultList = TobiraUtility.TobiraConditionsCheck(unit_data, conditionsForUnit); for (int index = 0; index < conditionsResultList.Count; ++index) { if (!conditionsResultList[index].isClear) { flag = false; break; } } return(flag); }
private void UnlockView(UnitData unitData, TobiraData tobiraData) { this.TobiraLevelUpButtonText.set_text(string.Format(LocalizedText.Get("sys.TOBIRA_INVENTORY_BTN_LV_UP"), (object)TobiraParam.GetCategoryName(tobiraData.Param.TobiraCategory))); this.TobiraLevelUpButton.SetActive(true); this.mLockedLayout.SetActive(!tobiraData.IsUnlocked); this.mTobiraConditionsLayout.SetActive(!tobiraData.IsUnlocked); this.mUnlockedLayout.SetActive(tobiraData.IsUnlocked); this.mTobiraMasterBonusLayout.SetActive(tobiraData.IsUnlocked); if (tobiraData.IsMaxLv) { this.TobiraLevelUpButton.SetActive(false); this.mTobiraMasterEbaleLayout.SetActive(true); } else { this.TobiraLevelUpButton.SetActive(true); this.mTobiraMasterEbaleLayout.SetActive(false); bool isEnable = TobiraUtility.IsClearAllToboraRecipe(unitData, tobiraData.Param.TobiraCategory, tobiraData.Lv); ((Selectable)this.TobiraOpenButton.GetComponent <Button>()).set_interactable(isEnable); UnitTobiraParamWindow.SetHilightAnimationEnable(this.TobiraLevelUpButton, isEnable); } }
private void SetMasterBonusText(TobiraParam tobiraParam) { if (UnityEngine.Object.op_Equality((UnityEngine.Object) this.TobiraMasterEffectText, (UnityEngine.Object)null) || UnityEngine.Object.op_Equality((UnityEngine.Object) this.TobiraMasterEffectDescText, (UnityEngine.Object)null)) { return; } int tobiraLvCap = (int)MonoSingleton <GameManager> .Instance.MasterParam.FixParam.TobiraLvCap; this.TobiraMasterEffectText.set_text(string.Empty); this.TobiraMasterEffectDescText.set_text(string.Empty); List <AbilityData> newAbilitys = new List <AbilityData>(); List <AbilityData> oldAbilitys = new List <AbilityData>(); TobiraUtility.TryCraeteAbilityData(tobiraParam, tobiraLvCap, newAbilitys, oldAbilitys, true); if (newAbilitys.Count > 0) { AbilityParam abilityParam = oldAbilitys[0] == null ? (AbilityParam)null : oldAbilitys[0].Param; if (abilityParam != null) { this.TobiraMasterEffectText.set_text(string.Format(LocalizedText.Get("sys.TOBIRA_MASTER_OVERRIDE_NEW_ABILITY_TEXT"), (object)abilityParam.name, (object)newAbilitys[0].Param.name)); this.TobiraMasterEffectDescText.set_text(string.Format(LocalizedText.Get("sys.TOBIRA_MASTER_TEXT_DESC"), (object)newAbilitys[0].Param.expr)); } else { this.TobiraMasterEffectText.set_text(string.Format(LocalizedText.Get("sys.TOBIRA_MASTER_NEW_ABILITY_TEXT"), (object)newAbilitys[0].Param.name)); this.TobiraMasterEffectDescText.set_text(string.Format(LocalizedText.Get("sys.TOBIRA_MASTER_TEXT_DESC"), (object)newAbilitys[0].Param.expr)); } } SkillData skillData = (SkillData)null; TobiraUtility.TryCraeteLeaderSkill(tobiraParam, tobiraLvCap, ref skillData, true); if (skillData == null) { return; } this.TobiraMasterEffectText.set_text(string.Format(LocalizedText.Get("sys.TOBIRA_MASTER_NEW_LEADER_SKILL_TEXT"), (object)skillData.SkillParam.name)); this.TobiraMasterEffectDescText.set_text(string.Format(LocalizedText.Get("sys.TOBIRA_MASTER_TEXT_DESC"), (object)skillData.SkillParam.expr)); }
public void DisplaySlotType(EAbilitySlot slotType, bool hideEquipped = false, bool showDerivedAbility = false) { this.mLastDisplayMode = UnitAbilityList.RefreshTypes.DisplayAll; this.mLastDisplaySlot = slotType; for (int index = 0; index < this.mItems.Count; ++index) { UnityEngine.Object.Destroy((UnityEngine.Object)((Component)this.mItems[index]).get_gameObject()); } this.mItems.Clear(); if (this.Unit == null) { this.Unit = DataSource.FindDataOfClass <UnitData>(((Component)this).get_gameObject(), (UnitData)null); } if (this.Unit == null) { return; } List <AbilityData> abilityDataList = !showDerivedAbility?this.Unit.GetAllLearnedAbilities(false) : this.Unit.GetAllLearnedAbilities(true); Transform transform = ((Component)this).get_transform(); if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.Item_Normal, (UnityEngine.Object)null)) { for (int index1 = 0; index1 < abilityDataList.Count; ++index1) { AbilityData abilityData = abilityDataList[index1]; if ((slotType == ~EAbilitySlot.Action || slotType == abilityData.SlotType) && (this.ShowFixedAbilities || !abilityData.Param.is_fixed) && (this.ShowMasterAbilities || !(this.Unit.UnitParam.ability == abilityData.AbilityID) && !this.Unit.IsQuestClearUnlocked(abilityData.Param.iname, QuestClearUnlockUnitDataParam.EUnlockTypes.MasterAbility)) && (this.Unit.MapEffectAbility != abilityData && (this.ShowMasterAbilities || !this.Unit.TobiraMasterAbilitys.Contains(abilityData))) && (!abilityData.IsDerivedAbility || (this.ShowFixedAbilities || !abilityData.DeriveBaseAbility.Param.is_fixed) && (this.ShowMasterAbilities || !(this.Unit.UnitParam.ability == abilityData.DeriveBaseAbility.AbilityID) && !this.Unit.IsQuestClearUnlocked(abilityData.DeriveBaseAbility.Param.iname, QuestClearUnlockUnitDataParam.EUnlockTypes.MasterAbility)) && (this.Unit.MapEffectAbility != abilityData.DeriveBaseAbility && (this.ShowMasterAbilities || !this.Unit.TobiraMasterAbilitys.Contains(abilityData.DeriveBaseAbility))))) { if (hideEquipped) { bool flag = false; for (int index2 = 0; index2 < this.Unit.CurrentJob.AbilitySlots.Length; ++index2) { if (this.Unit.CurrentJob.AbilitySlots[index2] == abilityData.UniqueID) { flag = true; break; } } if (flag) { continue; } } UnitAbilityListItemEvents abilityListItemEvents = (UnitAbilityListItemEvents)UnityEngine.Object.Instantiate <UnitAbilityListItemEvents>((M0)this.Item_Normal); this.mItems.Add(abilityListItemEvents); ((Component)abilityListItemEvents).get_transform().SetParent(transform, false); ((Component)abilityListItemEvents).get_gameObject().SetActive(true); AbilityDeriveList component = (AbilityDeriveList)((Component)abilityListItemEvents).get_gameObject().GetComponent <AbilityDeriveList>(); if (UnityEngine.Object.op_Equality((UnityEngine.Object)component, (UnityEngine.Object)null)) { DataSource.Bind <AbilityData>(((Component)abilityListItemEvents).get_gameObject(), abilityData); abilityListItemEvents.OnSelect = new ListItemEvents.ListItemEvent(this._OnAbilitySelect); abilityListItemEvents.OnRankUp = new ListItemEvents.ListItemEvent(this._OnAbilityRankUp); abilityListItemEvents.OnOpenDetail = new ListItemEvents.ListItemEvent(this._OnAbilityDetail); abilityListItemEvents.OnRankUpBtnPress = new ListItemEvents.ListItemEvent(this._OnRankUpBtnPress); abilityListItemEvents.OnRankUpBtnUp = new ListItemEvents.ListItemEvent(this._OnRankUpBtnUp); JobData job; int rank; if (this.GetAbilitySource(abilityData.AbilityID, out job, out rank)) { DataSource.Bind <AbilityUnlockInfo>(((Component)abilityListItemEvents).get_gameObject(), new AbilityUnlockInfo() { JobName = job.Name, Rank = rank }); } } else if (abilityData.IsDerivedAbility) { component.SetupWithAbilityData(abilityData.DeriveBaseAbility, new List <AbilityData>() { abilityData }); // ISSUE: method pointer component.AddDetailOpenEventListener(new UnityAction <GameObject>((object)this, __methodptr(_OnAbilityDetail))); // ISSUE: method pointer component.AddSelectEventListener(new UnityAction <GameObject>((object)this, __methodptr(_OnAbilitySelect))); // ISSUE: method pointer component.AddRankUpEventListener(new UnityAction <GameObject>((object)this, __methodptr(_OnAbilityRankUp))); // ISSUE: method pointer component.AddRankUpBtnPressEventListener(new UnityAction <GameObject>((object)this, __methodptr(_OnRankUpBtnPress))); // ISSUE: method pointer component.AddRankUpBtnUpEventListener(new UnityAction <GameObject>((object)this, __methodptr(_OnRankUpBtnUp))); } else { component.SetupWithAbilityData(abilityData, (List <AbilityData>)null); // ISSUE: method pointer component.AddDetailOpenEventListener(new UnityAction <GameObject>((object)this, __methodptr(_OnAbilityDetail))); // ISSUE: method pointer component.AddSelectEventListener(new UnityAction <GameObject>((object)this, __methodptr(_OnAbilitySelect))); // ISSUE: method pointer component.AddRankUpEventListener(new UnityAction <GameObject>((object)this, __methodptr(_OnAbilityRankUp))); // ISSUE: method pointer component.AddRankUpBtnPressEventListener(new UnityAction <GameObject>((object)this, __methodptr(_OnRankUpBtnPress))); // ISSUE: method pointer component.AddRankUpBtnUpEventListener(new UnityAction <GameObject>((object)this, __methodptr(_OnRankUpBtnUp))); } } } } if (slotType != ~EAbilitySlot.Action && UnityEngine.Object.op_Inequality((UnityEngine.Object) this.Item_SlotMismatch, (UnityEngine.Object)null)) { for (int index = 0; index < abilityDataList.Count; ++index) { AbilityData data = abilityDataList[index]; if (slotType != data.SlotType && (this.ShowFixedAbilities || !data.Param.is_fixed) && (this.ShowMasterAbilities || !(this.Unit.UnitParam.ability == data.AbilityID) && !this.Unit.IsQuestClearUnlocked(data.Param.iname, QuestClearUnlockUnitDataParam.EUnlockTypes.MasterAbility)) && (this.Unit.MapEffectAbility != data && (this.ShowMasterAbilities || !this.Unit.TobiraMasterAbilitys.Contains(data)))) { UnitAbilityListItemEvents abilityListItemEvents = (UnitAbilityListItemEvents)UnityEngine.Object.Instantiate <UnitAbilityListItemEvents>((M0)this.Item_SlotMismatch); this.mItems.Add(abilityListItemEvents); DataSource.Bind <AbilityData>(((Component)abilityListItemEvents).get_gameObject(), data); abilityListItemEvents.OnRankUp = new ListItemEvents.ListItemEvent(this._OnAbilityRankUp); abilityListItemEvents.OnOpenDetail = new ListItemEvents.ListItemEvent(this._OnAbilityDetail); abilityListItemEvents.OnRankUpBtnPress = new ListItemEvents.ListItemEvent(this._OnRankUpBtnPress); abilityListItemEvents.OnRankUpBtnUp = new ListItemEvents.ListItemEvent(this._OnRankUpBtnUp); ((Component)abilityListItemEvents).get_transform().SetParent(transform, false); ((Component)abilityListItemEvents).get_gameObject().SetActive(true); JobData job; int rank; if (this.GetAbilitySource(data.AbilityID, out job, out rank)) { DataSource.Bind <AbilityUnlockInfo>(((Component)abilityListItemEvents).get_gameObject(), new AbilityUnlockInfo() { JobName = job.Name, Rank = rank }); } } } } List <string> overwrittenAbilitys = TobiraUtility.GetOverwrittenAbilitys(this.Unit); if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.Item_Locked, (UnityEngine.Object)null)) { GameManager instanceDirect = MonoSingleton <GameManager> .GetInstanceDirect(); for (int index1 = 0; index1 < this.Unit.Jobs.Length; ++index1) { if (this.ShowLockedJobAbilities || this.Unit.Jobs[index1].Rank > 0) { RarityParam rarityParam = instanceDirect.GetRarityParam((int)this.Unit.UnitParam.raremax); for (int lv = this.Unit.Jobs[index1].Rank + 1; lv <= JobParam.MAX_JOB_RANK; ++lv) { OString[] learningAbilitys = this.Unit.Jobs[index1].Param.GetLearningAbilitys(lv); if (learningAbilitys != null && (int)rarityParam.UnitJobLvCap >= lv) { for (int index2 = 0; index2 < learningAbilitys.Length; ++index2) { string key = (string)learningAbilitys[index2]; if (!string.IsNullOrEmpty(key)) { AbilityParam abilityParam = instanceDirect.GetAbilityParam(key); if ((this.ShowFixedAbilities || !abilityParam.is_fixed) && !overwrittenAbilitys.Contains(abilityParam.iname)) { UnitAbilityListItemEvents abilityListItemEvents = (UnitAbilityListItemEvents)UnityEngine.Object.Instantiate <UnitAbilityListItemEvents>((M0)this.Item_Locked); this.mItems.Add(abilityListItemEvents); DataSource.Bind <AbilityParam>(((Component)abilityListItemEvents).get_gameObject(), abilityParam); abilityListItemEvents.OnSelect = new ListItemEvents.ListItemEvent(this._OnAbilitySelect); abilityListItemEvents.OnRankUp = new ListItemEvents.ListItemEvent(this._OnAbilityRankUp); abilityListItemEvents.OnOpenDetail = new ListItemEvents.ListItemEvent(this._OnAbilityDetail); abilityListItemEvents.OnRankUpBtnPress = new ListItemEvents.ListItemEvent(this._OnRankUpBtnPress); abilityListItemEvents.OnRankUpBtnUp = new ListItemEvents.ListItemEvent(this._OnRankUpBtnUp); ((Component)abilityListItemEvents).get_transform().SetParent(transform, false); ((Component)abilityListItemEvents).get_gameObject().SetActive(true); DataSource.Bind <AbilityUnlockInfo>(((Component)abilityListItemEvents).get_gameObject(), new AbilityUnlockInfo() { JobName = this.Unit.Jobs[index1].Name, Rank = lv }); } } } } } } } if (this.ShowMasterAbilities && !string.IsNullOrEmpty(this.Unit.UnitParam.ability) && (this.Unit.LearnAbilitys.Find((Predicate <AbilityData>)(p => p.AbilityID == this.Unit.UnitParam.ability)) == null && !overwrittenAbilitys.Exists((Predicate <string>)(abil => abil == this.Unit.UnitParam.ability)))) { AbilityParam abilityParam = instanceDirect.GetAbilityParam(this.Unit.UnitParam.ability); UnitAbilityListItemEvents abilityListItemEvents = (UnitAbilityListItemEvents)UnityEngine.Object.Instantiate <UnitAbilityListItemEvents>((M0)this.Item_Locked); this.mItems.Add(abilityListItemEvents); DataSource.Bind <AbilityParam>(((Component)abilityListItemEvents).get_gameObject(), abilityParam); abilityListItemEvents.OnSelect = new ListItemEvents.ListItemEvent(this._OnAbilitySelect); abilityListItemEvents.OnRankUp = new ListItemEvents.ListItemEvent(this._OnAbilityRankUp); abilityListItemEvents.OnOpenDetail = new ListItemEvents.ListItemEvent(this._OnAbilityDetail); abilityListItemEvents.OnRankUpBtnPress = new ListItemEvents.ListItemEvent(this._OnRankUpBtnPress); abilityListItemEvents.OnRankUpBtnUp = new ListItemEvents.ListItemEvent(this._OnRankUpBtnUp); ((Component)abilityListItemEvents).get_transform().SetParent(transform, false); ((Component)abilityListItemEvents).get_gameObject().SetActive(true); } } this.ResetScrollPos(); }
private void Refresh() { if (!this._CheckNullReference()) { return; } ((Component)this.MainPanelCloseBtn).get_gameObject().SetActive(true); this.SubPanel.SetActive(false); GameManager instanceDirect = MonoSingleton <GameManager> .GetInstanceDirect(); if (UnityEngine.Object.op_Equality((UnityEngine.Object)instanceDirect, (UnityEngine.Object)null)) { return; } this.mCurrentUnit = instanceDirect.Player.FindUnitDataByUniqueID((long)GlobalVars.SelectedUnitUniqueID); if (this.mCurrentUnit == null) { return; } GameUtility.DestroyGameObjects(this.mItems); GameUtility.DestroyGameObjects(this.mBoxs); this.mItems.Clear(); this.mBoxs.Clear(); DataSource.Bind <UnitData>(((Component)this).get_gameObject(), this.mCurrentUnit); GameParameter.UpdateAll(((Component)this).get_gameObject()); string errMsg = (string)null; List <UnitData.TobiraConditioError> errors = (List <UnitData.TobiraConditioError>)null; bool flag1 = this.mCurrentUnit.CanUnlockTobira() && this.mCurrentUnit.MeetsTobiraConditions(TobiraParam.Category.START, out errors); int condsLv = TobiraUtility.GetTobiraUnlockLevel(this.mCurrentUnit.UnitParam.iname); TobiraRecipeParam currentRecipe = this.GetCurrentRecipe(); if (currentRecipe == null) { return; } DataSource.Bind <TobiraRecipeParam>(((Component)this).get_gameObject(), currentRecipe); if (errors.Count > 0) { errors.Find((Predicate <UnitData.TobiraConditioError>)(error => { if (error.Type != UnitData.TobiraConditioError.ErrorType.UnitLevel) { return(false); } errMsg = LocalizedText.Get("sys.TOBIRA_CONDS_ERR_UNIT_LV", new object[1] { (object)condsLv }); return(true); })); } else if (currentRecipe.Cost > instanceDirect.Player.Gold) { errMsg = LocalizedText.Get("sys.GOLD_NOT_ENOUGH"); flag1 = false; } int length = currentRecipe.Materials.Length; if (currentRecipe.UnitPieceNum > 0) { ++length; } if (currentRecipe.ElementNum > 0) { ++length; } if (currentRecipe.UnlockElementNum > 0) { ++length; } if (currentRecipe.UnlockBirthNum > 0) { ++length; } GridLayoutGroup component = (GridLayoutGroup)this.ItemSlotBox.GetComponent <GridLayoutGroup>(); if (UnityEngine.Object.op_Equality((UnityEngine.Object)component, (UnityEngine.Object)null)) { DebugUtility.LogWarning("UnitEvolutionWindow.cs => Refresh2():gridlayout is Not Component [GridLayoutGroup]!"); } else { int num1 = length / component.get_constraintCount() + 1; for (int index = 0; index < num1; ++index) { GameObject gameObject = (GameObject)UnityEngine.Object.Instantiate <GameObject>((M0)this.ItemSlotBox); gameObject.get_transform().SetParent(this.ItemSlotRoot.get_transform(), false); gameObject.SetActive(true); this.mBoxs.Add(gameObject); } int num2 = 0; int index1 = 0; if (currentRecipe.UnitPieceNum > 0) { GameObject gameObject = (GameObject)UnityEngine.Object.Instantiate <GameObject>((M0)this.ItemSlotTemplate); gameObject.get_transform().SetParent(this.mBoxs[index1].get_transform(), false); gameObject.SetActive(true); this.mItems.Add(gameObject.get_gameObject()); ItemParam itemParam = instanceDirect.GetItemParam(this.mCurrentUnit.UnitParam.piece); if (itemParam == null) { DebugUtility.LogWarning("UnitEvolutionWindow.cs => Refresh():item_param is Null References!"); return; } DataSource.Bind <ItemParam>(gameObject.get_gameObject(), itemParam); DataSource.Bind <UnlockTobiraRecipe>(gameObject.get_gameObject(), new UnlockTobiraRecipe() { Amount = instanceDirect.Player.GetItemAmount(itemParam.iname), RequiredAmount = currentRecipe.UnitPieceNum, Index = num2 }); if (flag1 && currentRecipe.UnitPieceNum > instanceDirect.Player.GetItemAmount(this.mCurrentUnit.UnitParam.piece)) { flag1 = false; errMsg = LocalizedText.Get("sys.ITEM_NOT_ENOUGH"); } ++num2; } int index2 = num2 / component.get_constraintCount(); if (currentRecipe.ElementNum > 0) { GameObject gameObject = (GameObject)UnityEngine.Object.Instantiate <GameObject>((M0)this.ItemSlotTemplate); gameObject.get_transform().SetParent(this.mBoxs[index2].get_transform(), false); gameObject.SetActive(true); this.mItems.Add(gameObject.get_gameObject()); ItemParam elementPieceParam = this.mCurrentUnit.GetElementPieceParam(); if (elementPieceParam == null) { DebugUtility.LogWarning("UnitEvolutionWindow.cs => Refresh():item_param is Null References!"); return; } DataSource.Bind <ItemParam>(gameObject.get_gameObject(), elementPieceParam); DataSource.Bind <UnlockTobiraRecipe>(gameObject.get_gameObject(), new UnlockTobiraRecipe() { Amount = instanceDirect.Player.GetItemAmount(elementPieceParam.iname), RequiredAmount = currentRecipe.ElementNum, Index = num2 }); if (flag1 && currentRecipe.ElementNum > instanceDirect.Player.GetItemAmount(elementPieceParam.iname)) { flag1 = false; errMsg = LocalizedText.Get("sys.ITEM_NOT_ENOUGH"); } ++num2; } int index3 = num2 / component.get_constraintCount(); if (currentRecipe.UnlockElementNum > 0) { GameObject gameObject = (GameObject)UnityEngine.Object.Instantiate <GameObject>((M0)this.ItemSlotTemplate); gameObject.get_transform().SetParent(this.mBoxs[index3].get_transform(), false); gameObject.SetActive(true); this.mItems.Add(gameObject.get_gameObject()); ItemParam itemParam = instanceDirect.GetItemParam(this.mCurrentUnit.GetUnlockTobiraElementID()); if (itemParam == null) { DebugUtility.LogWarning("UnitEvolutionWindow.cs => Refresh():item_param is Null References!"); return; } DataSource.Bind <ItemParam>(gameObject.get_gameObject(), itemParam); DataSource.Bind <UnlockTobiraRecipe>(gameObject.get_gameObject(), new UnlockTobiraRecipe() { Amount = instanceDirect.Player.GetItemAmount(itemParam.iname), RequiredAmount = currentRecipe.UnlockElementNum, Index = num2 }); if (flag1 && currentRecipe.UnlockElementNum > instanceDirect.Player.GetItemAmount(this.mCurrentUnit.GetUnlockTobiraElementID())) { flag1 = false; errMsg = LocalizedText.Get("sys.ITEM_NOT_ENOUGH"); } ++num2; } int index4 = num2 / component.get_constraintCount(); if (currentRecipe.UnlockBirthNum > 0) { GameObject gameObject = (GameObject)UnityEngine.Object.Instantiate <GameObject>((M0)this.ItemSlotTemplate); gameObject.get_transform().SetParent(this.mBoxs[index4].get_transform(), false); gameObject.SetActive(true); this.mItems.Add(gameObject.get_gameObject()); ItemParam itemParam = instanceDirect.GetItemParam(this.mCurrentUnit.GetUnlockTobiraBirthID()); if (itemParam == null) { DebugUtility.LogWarning("UnitEvolutionWindow.cs => Refresh():item_param is Null References!"); return; } DataSource.Bind <ItemParam>(gameObject.get_gameObject(), itemParam); DataSource.Bind <UnlockTobiraRecipe>(gameObject.get_gameObject(), new UnlockTobiraRecipe() { Amount = instanceDirect.Player.GetItemAmount(itemParam.iname), RequiredAmount = currentRecipe.UnlockBirthNum, Index = num2 }); if (flag1 && currentRecipe.UnlockBirthNum > instanceDirect.Player.GetItemAmount(this.mCurrentUnit.GetUnlockTobiraBirthID())) { flag1 = false; errMsg = LocalizedText.Get("sys.ITEM_NOT_ENOUGH"); } ++num2; } foreach (TobiraRecipeMaterialParam material in currentRecipe.Materials) { if (material != null && !string.IsNullOrEmpty(material.Iname)) { int index5 = num2 / component.get_constraintCount(); GameObject gameObject = (GameObject)UnityEngine.Object.Instantiate <GameObject>((M0)this.ItemSlotTemplate); gameObject.get_transform().SetParent(this.mBoxs[index5].get_transform(), false); gameObject.SetActive(true); this.mItems.Add(gameObject.get_gameObject()); ItemParam itemParam = instanceDirect.GetItemParam(material.Iname); if (itemParam == null) { DebugUtility.LogWarning("UnitEvolutionWindow.cs => Refresh():item_param is Null References!"); return; } DataSource.Bind <ItemParam>(gameObject.get_gameObject(), itemParam); DataSource.Bind <UnlockTobiraRecipe>(gameObject.get_gameObject(), new UnlockTobiraRecipe() { Amount = instanceDirect.Player.GetItemAmount(itemParam.iname), RequiredAmount = material.Num, Index = num2 }); if (flag1 && material.Num > instanceDirect.Player.GetItemAmount(material.Iname)) { flag1 = false; errMsg = LocalizedText.Get("sys.ITEM_NOT_ENOUGH"); } ++num2; } } if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.HelpText, (UnityEngine.Object)null)) { bool flag2 = !string.IsNullOrEmpty(errMsg); ((Component)this.HelpText).get_gameObject().SetActive(flag2); if (flag2) { this.HelpText.set_text(errMsg); } } if (!UnityEngine.Object.op_Inequality((UnityEngine.Object) this.UnlockTobiraButton, (UnityEngine.Object)null)) { return; } ((Selectable)this.UnlockTobiraButton).set_interactable(flag1); } }