protected override void Refresh() { if (UnityEngine.Object.op_Equality((UnityEngine.Object) this.ItemTemplate, (UnityEngine.Object)null)) { return; } for (int index = this.mItems.Count - 1; index >= 0; --index) { UnityEngine.Object.Destroy((UnityEngine.Object) this.mItems[index]); } QuestParam dataOfClass = DataSource.FindDataOfClass <QuestParam>(((Component)this).get_gameObject(), (QuestParam)null); if (dataOfClass == null) { return; } Transform transform = ((Component)this).get_transform(); List <TowerRewardItem> towerRewardItem = MonoSingleton <GameManager> .Instance.FindTowerReward(MonoSingleton <GameManager> .Instance.FindTowerFloor(dataOfClass.iname).reward_id).GetTowerRewardItem(); for (int index = 0; index < towerRewardItem.Count; ++index) { TowerRewardItem item = towerRewardItem[index]; if (item.visible && item.type != TowerRewardItem.RewardType.Gold) { GameObject gameObject = (GameObject)UnityEngine.Object.Instantiate <GameObject>((M0)this.ItemTemplate); gameObject.get_transform().SetParent(transform, false); gameObject.get_transform().set_localScale(this.ItemTemplate.get_transform().get_localScale()); DataSource.Bind <TowerRewardItem>(gameObject, item); gameObject.SetActive(true); foreach (GameParameter componentsInChild in (GameParameter[])gameObject.GetComponentsInChildren <GameParameter>()) { componentsInChild.Index = index; } TowerRewardUI componentInChildren1 = (TowerRewardUI)gameObject.GetComponentInChildren <TowerRewardUI>(); if (UnityEngine.Object.op_Inequality((UnityEngine.Object)componentInChildren1, (UnityEngine.Object)null)) { componentInChildren1.Refresh(); } if (item.type == TowerRewardItem.RewardType.Artifact) { ArtifactParam artifactParam = MonoSingleton <GameManager> .Instance.MasterParam.GetArtifactParam(item.iname); DataSource.Bind <ArtifactParam>(gameObject, artifactParam); ArtifactIcon componentInChildren2 = (ArtifactIcon)gameObject.GetComponentInChildren <ArtifactIcon>(); if (UnityEngine.Object.op_Equality((UnityEngine.Object)componentInChildren2, (UnityEngine.Object)null)) { break; } ((Behaviour)componentInChildren2).set_enabled(true); componentInChildren2.UpdateValue(); if (MonoSingleton <GameManager> .Instance.Player.Artifacts.Find((Predicate <ArtifactData>)(x => x.ArtifactParam.iname == item.iname)) != null) { break; } item.is_new = true; break; } } } }
private QuestParam ConvertQuestParam(QuestParam original) { if (original == null) { return((QuestParam)null); } JSON_QuestParam json = new JSON_QuestParam(); json.iname = this.iname; json.title = this.title; json.name = this.name; json.expr = this.expr; json.cond = this.cond; json.cond_quests = new string[1] { this.cond_quest }; json.map = new JSON_MapParam[this.map.Count]; json.rdy_cnd = this.rdy_cnd; json.lv = (int)this.lv; json.pt = (int)this.pt; for (int index = 0; index < this.map.Count; ++index) { json.map[index] = new JSON_MapParam() { set = this.map[index].mapSetName, scn = this.map[index].mapSceneName, bgm = this.map[index].bgmName, btl = this.map[index].battleSceneName, ev = this.map[index].eventSceneName } } ; json.area = original.ChapterID; json.type = 7; json.notcon = 1; json.notitm = 1; json.gold = 0; TowerRewardParam towerReward = MonoSingleton <GameManager> .Instance.FindTowerReward(this.reward_id); if (towerReward != null) { List <TowerRewardItem> towerRewardItem1 = towerReward.GetTowerRewardItem(); for (int index = 0; index < towerRewardItem1.Count; ++index) { TowerRewardItem towerRewardItem2 = towerRewardItem1[index]; if (towerRewardItem2 != null && towerRewardItem2.type == TowerRewardItem.RewardType.Gold) { json.gold = towerRewardItem2.num; } } } QuestParam questParam = new QuestParam(); questParam.Deserialize(json); return(questParam); }
public void Deserialize(JSON_TowerRewardParam json) { if (json == null) { throw new InvalidJSONException(); } this.iname = json.iname; if (json.rewards == null) { return; } this.mTowerRewardItems = new List <TowerRewardItem>(); for (int index = 0; index < json.rewards.Length; ++index) { TowerRewardItem towerRewardItem = new TowerRewardItem(); towerRewardItem.Deserialize(json.rewards[index]); this.mTowerRewardItems.Add(towerRewardItem); } }
public void Refresh() { ((Behaviour)this.ItemIcon).set_enabled(false); TowerRewardItem dataOfClass = DataSource.FindDataOfClass <TowerRewardItem>(((Component)this).get_gameObject(), (TowerRewardItem)null); if (dataOfClass == null) { return; } this.NumText.text = dataOfClass.num.ToString(); switch (dataOfClass.type) { case TowerRewardItem.RewardType.Item: ((Behaviour)this.ItemIcon).set_enabled(true); this.ItemIcon.UpdateValue(); break; case TowerRewardItem.RewardType.Gold: this.BaseImage.set_texture(this.GoldImage); break; case TowerRewardItem.RewardType.Coin: this.BaseImage.set_texture(this.CoinImage); break; case TowerRewardItem.RewardType.ArenaCoin: this.BaseImage.set_texture(this.ArenaCoinImage); break; case TowerRewardItem.RewardType.MultiCoin: this.BaseImage.set_texture(this.MultiCoinImage); break; case TowerRewardItem.RewardType.KakeraCoin: this.BaseImage.set_texture(this.KakeraCoinImage); break; } }
private void SetRewards(TowerRewardParam rewardParam) { if (rewardParam == null || UnityEngine.Object.op_Equality((UnityEngine.Object) this.RewardText, (UnityEngine.Object)null)) { return; } GameUtility.SetGameObjectActive(this.ItemRoot, false); GameUtility.SetGameObjectActive(this.ArtifactRoot, false); GameUtility.SetGameObjectActive(this.CoinRoot, false); GameManager instanceDirect = MonoSingleton <GameManager> .GetInstanceDirect(); using (List <TowerRewardItem> .Enumerator enumerator = rewardParam.GetTowerRewardItem().GetEnumerator()) { while (enumerator.MoveNext()) { TowerRewardItem current = enumerator.Current; if (current.visible && current.type != TowerRewardItem.RewardType.Gold) { string str = string.Empty; switch (current.type) { case TowerRewardItem.RewardType.Item: ItemParam itemParam = instanceDirect.GetItemParam(current.iname); if (itemParam != null) { str = itemParam.name; } DataSource.Bind <ItemParam>(this.ItemRoot, itemParam); GameUtility.SetGameObjectActive(this.ItemRoot, true); GameParameter.UpdateAll(this.ItemRoot); break; case TowerRewardItem.RewardType.Coin: str = LocalizedText.Get("sys.COIN"); this.CoinRoot.get_gameObject().SetActive(true); break; case TowerRewardItem.RewardType.ArenaCoin: str = LocalizedText.Get("sys.ARENA_COIN"); break; case TowerRewardItem.RewardType.MultiCoin: str = LocalizedText.Get("sys.MULTI_COIN"); break; case TowerRewardItem.RewardType.KakeraCoin: str = LocalizedText.Get("sys.PIECE_POINT"); break; case TowerRewardItem.RewardType.Artifact: ArtifactParam artifactParam = instanceDirect.MasterParam.GetArtifactParam(current.iname); if (artifactParam != null) { str = artifactParam.name; } DataSource.Bind <ArtifactParam>(this.ArtifactRoot, artifactParam); GameUtility.SetGameObjectActive(this.ArtifactRoot, true); GameParameter.UpdateAll(this.ArtifactRoot); break; } this.RewardText.set_text(string.Format("{0} × {1}", (object)str, (object)current.num)); break; } } } }
private QuestParam ConvertQuestParam(QuestParam original) { if (original == null) { return((QuestParam)null); } GameManager instance = MonoSingleton <GameManager> .Instance; JSON_QuestParam json = new JSON_QuestParam(); json.iname = this.tower_id + "_" + this.floor.ToString(); json.title = this.title; json.name = this.name; json.expr = this.expr; json.cond = this.cond; if (this.cond_floor != 0) { QuestParam quest = instance.FindQuest(this.tower_id + "_" + (object)this.cond_floor); if (quest != null) { json.cond_quests = new string[1] { quest.iname } } ; } json.map = new JSON_MapParam[this.map.Count]; json.lv = (int)this.lv; json.pt = (int)this.pt; for (int index = 0; index < this.map.Count; ++index) { json.map[index] = new JSON_MapParam() { set = this.map[index].mapSetName, scn = this.map[index].mapSceneName, bgm = this.map[index].bgmName, btl = this.map[index].battleSceneName, ev = this.map[index].eventSceneName } } ; json.area = original.ChapterID; json.type = (int)original.type; json.notcon = (int)this.notcon; json.notitm = 1; json.pnum = (int)original.playerNum; json.gold = 0; json.is_unit_chg = 0; json.multi = 1; json.me_id = this.me_id; json.is_wth_no_chg = this.is_wth_no_chg; json.wth_set_id = this.wth_set_id; TowerRewardParam towerReward = MonoSingleton <GameManager> .Instance.FindTowerReward(this.reward_id); if (towerReward != null) { List <TowerRewardItem> towerRewardItem1 = towerReward.GetTowerRewardItem(); for (int index = 0; index < towerRewardItem1.Count; ++index) { TowerRewardItem towerRewardItem2 = towerRewardItem1[index]; if (towerRewardItem2 != null && towerRewardItem2.type == TowerRewardItem.RewardType.Gold) { json.gold = towerRewardItem2.num; } } } QuestParam questParam = new QuestParam(); questParam.Deserialize(json); questParam.EntryCondition = original.EntryCondition; questParam.unitNum = (OShort)this.unitnum; return(questParam); }
private void SetTowerResult(Transform parent, GameObject ItemObject, List <ItemData> data = null) { if (this.mCurrentQuest.type != QuestTypes.Tower) { return; } List <TowerRewardItem> towerRewardItemList = new List <TowerRewardItem>((IEnumerable <TowerRewardItem>)MonoSingleton <GameManager> .Instance.FindTowerReward(MonoSingleton <GameManager> .Instance.FindTowerFloor(GlobalVars.SelectedQuestID).reward_id).GetTowerRewardItem()); if (data != null) { for (int index = 0; index < data.Count; ++index) { ItemData itemData = data[index]; if (itemData != null) { towerRewardItemList.Add(new TowerRewardItem() { iname = itemData.Param.iname, type = TowerRewardItem.RewardType.Item, num = data[index].Num, visible = true, is_new = data[index].IsNew }); } } } for (int index = 0; index < towerRewardItemList.Count; ++index) { TowerRewardItem item = towerRewardItemList[index]; if (item.visible && item.type != TowerRewardItem.RewardType.Gold) { GameObject gameObject = (GameObject)UnityEngine.Object.Instantiate <GameObject>((M0)ItemObject); gameObject.get_transform().SetParent(parent, false); this.mTowerListItems.Add(gameObject); gameObject.get_transform().set_localScale(ItemObject.get_transform().get_localScale()); DataSource.Bind <TowerRewardItem>(gameObject, towerRewardItemList[index]); gameObject.SetActive(true); foreach (GameParameter componentsInChild in (GameParameter[])gameObject.GetComponentsInChildren <GameParameter>()) { componentsInChild.Index = index; } TowerRewardUI componentInChildren1 = (TowerRewardUI)gameObject.GetComponentInChildren <TowerRewardUI>(); if (UnityEngine.Object.op_Inequality((UnityEngine.Object)componentInChildren1, (UnityEngine.Object)null)) { componentInChildren1.Refresh(); } if (item.type == TowerRewardItem.RewardType.Artifact) { ArtifactParam artifactParam = MonoSingleton <GameManager> .Instance.MasterParam.GetArtifactParam(item.iname); DataSource.Bind <ArtifactParam>(gameObject, artifactParam); ArtifactIcon componentInChildren2 = (ArtifactIcon)gameObject.GetComponentInChildren <ArtifactIcon>(); if (!UnityEngine.Object.op_Equality((UnityEngine.Object)componentInChildren2, (UnityEngine.Object)null)) { ((Behaviour)componentInChildren2).set_enabled(true); componentInChildren2.UpdateValue(); if (MonoSingleton <GameManager> .Instance.Player.Artifacts.Find((Predicate <ArtifactData>)(x => x.ArtifactParam.iname == item.iname)) == null) { item.is_new = true; break; } break; } break; } if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.Prefab_NewItemBadge, (UnityEngine.Object)null) && item.is_new) { RectTransform transform = ((GameObject)UnityEngine.Object.Instantiate <GameObject>((M0)this.Prefab_NewItemBadge)).get_transform() as RectTransform; ((Component)transform).get_gameObject().SetActive(true); transform.set_anchoredPosition(Vector2.get_zero()); ((Transform)transform).SetParent(gameObject.get_transform(), false); } } } ItemObject.SetActive(false); }
public void Refresh() { ((Behaviour)this.ItemIcon).set_enabled(false); TowerRewardItem dataOfClass = DataSource.FindDataOfClass <TowerRewardItem>(((Component)this).get_gameObject(), (TowerRewardItem)null); if (dataOfClass == null) { return; } this.NumText.text = dataOfClass.num.ToString(); if (Object.op_Inequality((Object)this.ItemFrameObj, (Object)null)) { this.ItemFrameObj.SetActive(true); } switch (dataOfClass.type) { case TowerRewardItem.RewardType.Item: ((Behaviour)this.ItemIcon).set_enabled(true); this.ItemIcon.UpdateValue(); ItemParam itemParam = MonoSingleton <GameManager> .Instance.GetItemParam(dataOfClass.iname); if (itemParam == null || !Object.op_Inequality((Object)this.ItemName, (Object)null)) { break; } this.ItemName.set_text(itemParam.name); break; case TowerRewardItem.RewardType.Gold: this.BaseImage.set_texture(this.GoldImage); if (!Object.op_Inequality((Object)this.ItemName, (Object)null)) { break; } this.ItemName.set_text(LocalizedText.Get("sys.GOLD")); break; case TowerRewardItem.RewardType.Coin: this.BaseImage.set_texture(this.CoinImage); if (!Object.op_Inequality((Object)this.ItemName, (Object)null)) { break; } this.ItemName.set_text(LocalizedText.Get("sys.COIN")); break; case TowerRewardItem.RewardType.ArenaCoin: this.BaseImage.set_texture(this.ArenaCoinImage); if (!Object.op_Inequality((Object)this.ItemName, (Object)null)) { break; } this.ItemName.set_text(LocalizedText.Get("sys.ARENA_COIN")); break; case TowerRewardItem.RewardType.MultiCoin: this.BaseImage.set_texture(this.MultiCoinImage); if (!Object.op_Inequality((Object)this.ItemName, (Object)null)) { break; } this.ItemName.set_text(LocalizedText.Get("sys.MULTI_COIN")); break; case TowerRewardItem.RewardType.KakeraCoin: this.BaseImage.set_texture(this.KakeraCoinImage); if (!Object.op_Inequality((Object)this.ItemName, (Object)null)) { break; } this.ItemName.set_text(LocalizedText.Get("sys.KakeraCoin")); break; case TowerRewardItem.RewardType.Artifact: if (Object.op_Inequality((Object)this.ItemFrameObj, (Object)null)) { this.ItemFrameObj.SetActive(false); } ArtifactParam artifactParam = MonoSingleton <GameManager> .Instance.MasterParam.GetArtifactParam(dataOfClass.iname); if (artifactParam == null || !Object.op_Inequality((Object)this.ItemName, (Object)null)) { break; } this.ItemName.set_text(artifactParam.name); break; } }