Exemple #1
0
        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);
        }
        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);
        }