Ejemplo n.º 1
0
        private void CreateResult()
        {
            VersusTowerParam versusTowerParam = MonoSingleton <GameManager> .Instance.GetCurrentVersusTowerParam(-1);

            if (versusTowerParam == null || !Object.op_Inequality((Object)this.template, (Object)null))
            {
                return;
            }
            for (int idx = 0; idx < versusTowerParam.SeasonIteminame.Length; ++idx)
            {
                GameObject gameObject = (GameObject)Object.Instantiate <GameObject>((M0)this.template);
                if (Object.op_Inequality((Object)gameObject, (Object)null))
                {
                    DataSource.Bind <VersusTowerParam>(gameObject, versusTowerParam);
                    gameObject.SetActive(true);
                    if (this.SetData(idx, false, gameObject))
                    {
                        if (Object.op_Inequality((Object)this.parent, (Object)null))
                        {
                            gameObject.get_transform().SetParent(this.parent.get_transform(), false);
                        }
                    }
                    else
                    {
                        gameObject.SetActive(false);
                    }
                }
            }
            this.template.SetActive(false);
            this.item.SetActive(false);
        }
Ejemplo n.º 2
0
        private void SetData(int idx, bool bPlay = false, GameObject obj = null)
        {
            GameManager      instance         = MonoSingleton <GameManager> .Instance;
            GameObject       gameObject       = !Object.op_Inequality((Object)obj, (Object)null) ? this.item : obj;
            VersusTowerParam versusTowerParam = instance.GetCurrentVersusTowerParam(-1);

            if (versusTowerParam != null && versusTowerParam.SeasonIteminame != null && (!string.IsNullOrEmpty((string)versusTowerParam.SeasonIteminame[idx]) && Object.op_Inequality((Object)gameObject, (Object)null)))
            {
                gameObject.SetActive(true);
                VersusTowerRewardItem component = (VersusTowerRewardItem)gameObject.GetComponent <VersusTowerRewardItem>();
                if (Object.op_Inequality((Object)component, (Object)null))
                {
                    component.SetData(VersusTowerRewardItem.REWARD_TYPE.Season, idx);
                }
                if (bPlay)
                {
                    this.ReqAnim(this.openAnim);
                }
                this.SetRewardName(idx, versusTowerParam);
            }
            if (!Object.op_Inequality((Object)this.arrival, (Object)null))
            {
                return;
            }
            this.arrival.SetActive(false);
        }
Ejemplo n.º 3
0
        private void SetRewardName(int idx, VersusTowerParam param)
        {
            GameManager      instance       = MonoSingleton <GameManager> .Instance;
            int              num            = (int)param.SeasonItemnum[idx];
            string           key            = (string)param.SeasonIteminame[idx];
            VERSUS_ITEM_TYPE versusItemType = param.SeasonItemType[idx];

            if (!Object.op_Inequality((Object)this.rewardTxt, (Object)null))
            {
                return;
            }
            string str = string.Empty;

            switch (versusItemType)
            {
            case VERSUS_ITEM_TYPE.item:
                ItemParam itemParam = instance.GetItemParam(key);
                if (itemParam != null)
                {
                    str = itemParam.name + string.Format(LocalizedText.Get("sys.CROSS_NUM"), (object)num);
                    break;
                }
                break;

            case VERSUS_ITEM_TYPE.gold:
                str = num.ToString() + LocalizedText.Get("sys.GOLD");
                break;

            case VERSUS_ITEM_TYPE.coin:
                str = string.Format(LocalizedText.Get("sys.CHALLENGE_REWARD_COIN"), (object)num);
                break;

            case VERSUS_ITEM_TYPE.unit:
                UnitParam unitParam = instance.GetUnitParam(key);
                if (unitParam != null)
                {
                    str = unitParam.name;
                    break;
                }
                break;

            case VERSUS_ITEM_TYPE.artifact:
                ArtifactParam artifactParam = instance.MasterParam.GetArtifactParam(key);
                if (artifactParam != null)
                {
                    str = artifactParam.name;
                    break;
                }
                break;
            }
            this.rewardTxt.set_text(string.Format(LocalizedText.Get("sys.MULTI_VERSUS_REWARD_NAME"), (object)str));
        }
Ejemplo n.º 4
0
        public void Refresh(VersusTowerRewardItem.REWARD_TYPE type = VersusTowerRewardItem.REWARD_TYPE.Arrival, int idx = 0)
        {
            VersusTowerParam dataOfClass = DataSource.FindDataOfClass <VersusTowerParam>(((Component)this).get_gameObject(), (VersusTowerParam)null);

            if (dataOfClass == null)
            {
                return;
            }
            if (Object.op_Inequality((Object)this.rewardFloor, (Object)null))
            {
                this.rewardFloor.set_text(GameUtility.HalfNum2FullNum(dataOfClass.Floor.ToString()) + LocalizedText.Get("sys.MULTI_VERSUS_FLOOR"));
            }
            this.SetData(type, idx);
        }
Ejemplo n.º 5
0
        private void SetupRewardItem()
        {
            GameManager          instance           = MonoSingleton <GameManager> .Instance;
            VsTowerMatchEndParam towerMatchEndParam = instance.GetVsTowerMatchEndParam();
            VersusTowerParam     versusTowerParam   = instance.GetCurrentVersusTowerParam(towerMatchEndParam.floor);

            if (versusTowerParam == null || string.IsNullOrEmpty((string)versusTowerParam.ArrivalIteminame) || UnityEngine.Object.op_Equality((UnityEngine.Object) this.rewardObj, (UnityEngine.Object)null))
            {
                return;
            }
            DataSource.Bind <VersusTowerParam>(this.rewardObj, versusTowerParam);
            VersusTowerRewardItem component = (VersusTowerRewardItem)this.rewardObj.GetComponent <VersusTowerRewardItem>();

            if (!UnityEngine.Object.op_Inequality((UnityEngine.Object)component, (UnityEngine.Object)null))
            {
                return;
            }
            component.Refresh(VersusTowerRewardItem.REWARD_TYPE.Arrival, 0);
        }
Ejemplo n.º 6
0
        private void Refresh()
        {
            if (Object.op_Equality((Object)this.Keytemplate, (Object)null))
            {
                return;
            }
            GameManager      instance         = MonoSingleton <GameManager> .Instance;
            int              versusTowerKey   = instance.Player.VersusTowerKey;
            VersusTowerParam versusTowerParam = instance.GetCurrentVersusTowerParam(-1);

            if (versusTowerParam == null)
            {
                return;
            }
            int num = 0;

            while (num < (int)versusTowerParam.RankupNum)
            {
                GameObject gameObject = (GameObject)Object.Instantiate <GameObject>((M0)this.Keytemplate);
                if (!Object.op_Equality((Object)gameObject, (Object)null))
                {
                    gameObject.SetActive(true);
                    if (Object.op_Inequality((Object)this.parent, (Object)null))
                    {
                        gameObject.get_transform().SetParent(this.parent.get_transform(), false);
                    }
                    Transform child1 = gameObject.get_transform().FindChild("on");
                    Transform child2 = gameObject.get_transform().FindChild("off");
                    if (Object.op_Inequality((Object)child1, (Object)null))
                    {
                        ((Component)child1).get_gameObject().SetActive(versusTowerKey > 0);
                    }
                    if (Object.op_Inequality((Object)child2, (Object)null))
                    {
                        ((Component)child2).get_gameObject().SetActive(versusTowerKey <= 0);
                    }
                }
                ++num;
                --versusTowerKey;
            }
            this.Keytemplate.SetActive(false);
        }
Ejemplo n.º 7
0
        public void Refresh()
        {
            if (Object.op_Equality((Object)this.template, (Object)null))
            {
                return;
            }
            VersusTowerParam dataOfClass = DataSource.FindDataOfClass <VersusTowerParam>(((Component)this).get_gameObject(), (VersusTowerParam)null);

            if (dataOfClass != null)
            {
                while (this.mItems.Count < dataOfClass.SeasonIteminame.Length)
                {
                    GameObject gameObject = (GameObject)Object.Instantiate <GameObject>((M0)this.template);
                    if (Object.op_Inequality((Object)gameObject, (Object)null))
                    {
                        if (Object.op_Inequality((Object)this.parent, (Object)null))
                        {
                            gameObject.get_transform().SetParent(this.parent.get_transform(), false);
                        }
                        this.mItems.Add(gameObject);
                    }
                }
                for (int idx = 0; idx < dataOfClass.SeasonIteminame.Length; ++idx)
                {
                    GameObject mItem = this.mItems[idx];
                    if (Object.op_Inequality((Object)mItem, (Object)null))
                    {
                        DataSource.Bind <VersusTowerParam>(mItem, dataOfClass);
                        mItem.SetActive(true);
                        VersusTowerRewardItem component = (VersusTowerRewardItem)mItem.GetComponent <VersusTowerRewardItem>();
                        if (Object.op_Inequality((Object)component, (Object)null))
                        {
                            component.Refresh(VersusTowerRewardItem.REWARD_TYPE.Season, idx);
                        }
                    }
                }
            }
            this.template.SetActive(false);
        }
Ejemplo n.º 8
0
        public void SetData(VersusTowerRewardItem.REWARD_TYPE type, int idx = 0)
        {
            GameManager      instance    = MonoSingleton <GameManager> .Instance;
            VersusTowerParam dataOfClass = DataSource.FindDataOfClass <VersusTowerParam>(((Component)this).get_gameObject(), (VersusTowerParam)null);
            int versusTowerFloor         = instance.Player.VersusTowerFloor;

            if (dataOfClass == null)
            {
                return;
            }
            VERSUS_ITEM_TYPE versusItemType = VERSUS_ITEM_TYPE.item;
            string           str            = string.Empty;
            int num = 0;

            if (type == VersusTowerRewardItem.REWARD_TYPE.Arrival)
            {
                versusItemType = dataOfClass.ArrivalItemType;
                str            = (string)dataOfClass.ArrivalIteminame;
                num            = (int)dataOfClass.ArrivalItemNum;
            }
            else if (idx >= 0 && idx < dataOfClass.SeasonIteminame.Length)
            {
                versusItemType = dataOfClass.SeasonItemType[idx];
                str            = (string)dataOfClass.SeasonIteminame[idx];
                num            = (int)dataOfClass.SeasonItemnum[idx];
            }
            if (Object.op_Inequality((Object)this.itemObj, (Object)null))
            {
                this.itemObj.SetActive(true);
            }
            if (Object.op_Inequality((Object)this.amountObj, (Object)null))
            {
                this.amountObj.SetActive(true);
            }
            if (Object.op_Inequality((Object)this.unitObj, (Object)null))
            {
                this.unitObj.SetActive(false);
            }
            switch (versusItemType)
            {
            case VERSUS_ITEM_TYPE.item:
                if (Object.op_Inequality((Object)this.itemObj, (Object)null) && Object.op_Inequality((Object)this.amountObj, (Object)null))
                {
                    ArtifactIcon componentInChildren = (ArtifactIcon)this.itemObj.GetComponentInChildren <ArtifactIcon>();
                    if (Object.op_Inequality((Object)componentInChildren, (Object)null))
                    {
                        ((Behaviour)componentInChildren).set_enabled(false);
                    }
                    this.itemObj.SetActive(true);
                    DataSource component1 = (DataSource)this.itemObj.GetComponent <DataSource>();
                    if (Object.op_Inequality((Object)component1, (Object)null))
                    {
                        component1.Clear();
                    }
                    DataSource component2 = (DataSource)this.amountObj.GetComponent <DataSource>();
                    if (Object.op_Inequality((Object)component2, (Object)null))
                    {
                        component2.Clear();
                    }
                    ItemParam itemParam = instance.GetItemParam(str);
                    DataSource.Bind <ItemParam>(this.itemObj, itemParam);
                    ItemData data = new ItemData();
                    data.Setup(0L, itemParam, num);
                    DataSource.Bind <ItemData>(this.amountObj, data);
                    Transform child = this.itemObj.get_transform().FindChild("icon");
                    if (Object.op_Inequality((Object)child, (Object)null))
                    {
                        GameParameter component3 = (GameParameter)((Component)child).GetComponent <GameParameter>();
                        if (Object.op_Inequality((Object)component3, (Object)null))
                        {
                            ((Behaviour)component3).set_enabled(true);
                        }
                    }
                    GameParameter.UpdateAll(this.itemObj);
                    if (Object.op_Inequality((Object)this.iconParam, (Object)null))
                    {
                        this.iconParam.UpdateValue();
                    }
                    if (Object.op_Inequality((Object)this.frameParam, (Object)null))
                    {
                        this.frameParam.UpdateValue();
                    }
                    if (Object.op_Inequality((Object)this.rewardName, (Object)null))
                    {
                        this.rewardName.set_text(itemParam.name + string.Format(LocalizedText.Get("sys.CROSS_NUM"), (object)num));
                        break;
                    }
                    break;
                }
                break;

            case VERSUS_ITEM_TYPE.gold:
                if (Object.op_Inequality((Object)this.itemTex, (Object)null))
                {
                    GameParameter component = (GameParameter)((Component)this.itemTex).GetComponent <GameParameter>();
                    if (Object.op_Inequality((Object)component, (Object)null))
                    {
                        ((Behaviour)component).set_enabled(false);
                    }
                    this.itemTex.set_texture(this.goldTex);
                }
                if (Object.op_Inequality((Object)this.frameTex, (Object)null) && Object.op_Inequality((Object)this.goldBase, (Object)null))
                {
                    this.frameTex.set_sprite(this.goldBase);
                }
                if (Object.op_Inequality((Object)this.rewardName, (Object)null))
                {
                    this.rewardName.set_text(num.ToString() + LocalizedText.Get("sys.GOLD"));
                }
                if (Object.op_Inequality((Object)this.amountObj, (Object)null))
                {
                    this.amountObj.SetActive(false);
                    break;
                }
                break;

            case VERSUS_ITEM_TYPE.coin:
                if (Object.op_Inequality((Object)this.itemTex, (Object)null))
                {
                    GameParameter component = (GameParameter)((Component)this.itemTex).GetComponent <GameParameter>();
                    if (Object.op_Inequality((Object)component, (Object)null))
                    {
                        ((Behaviour)component).set_enabled(false);
                    }
                    this.itemTex.set_texture(this.coinTex);
                }
                if (Object.op_Inequality((Object)this.frameTex, (Object)null) && Object.op_Inequality((Object)this.coinBase, (Object)null))
                {
                    this.frameTex.set_sprite(this.coinBase);
                }
                if (Object.op_Inequality((Object)this.rewardName, (Object)null))
                {
                    this.rewardName.set_text(string.Format(LocalizedText.Get("sys.CHALLENGE_REWARD_COIN"), (object)num));
                }
                if (Object.op_Inequality((Object)this.amountObj, (Object)null))
                {
                    this.amountObj.SetActive(false);
                    break;
                }
                break;

            case VERSUS_ITEM_TYPE.unit:
                if (Object.op_Inequality((Object)this.unitObj, (Object)null))
                {
                    if (Object.op_Inequality((Object)this.itemObj, (Object)null))
                    {
                        this.itemObj.SetActive(false);
                    }
                    this.unitObj.SetActive(true);
                    UnitParam unitParam = instance.GetUnitParam(str);
                    DebugUtility.Assert(unitParam != null, "Invalid unit:" + str);
                    UnitData data = new UnitData();
                    data.Setup(str, 0, 1, 0, (string)null, 1, EElement.None, 0);
                    DataSource.Bind <UnitData>(this.unitObj, data);
                    GameParameter.UpdateAll(this.unitObj);
                    if (Object.op_Inequality((Object)this.rewardName, (Object)null))
                    {
                        this.rewardName.set_text(string.Format(LocalizedText.Get("sys.MULTI_VERSUS_REWARD_UNIT"), (object)unitParam.name));
                        break;
                    }
                    break;
                }
                break;

            case VERSUS_ITEM_TYPE.artifact:
                if (Object.op_Inequality((Object)this.itemObj, (Object)null))
                {
                    DataSource component = (DataSource)this.itemObj.GetComponent <DataSource>();
                    if (Object.op_Inequality((Object)component, (Object)null))
                    {
                        component.Clear();
                    }
                    ArtifactParam artifactParam = instance.MasterParam.GetArtifactParam(str);
                    DataSource.Bind <ArtifactParam>(this.itemObj, artifactParam);
                    ArtifactIcon componentInChildren = (ArtifactIcon)this.itemObj.GetComponentInChildren <ArtifactIcon>();
                    if (Object.op_Inequality((Object)componentInChildren, (Object)null))
                    {
                        ((Behaviour)componentInChildren).set_enabled(true);
                        componentInChildren.UpdateValue();
                        if (Object.op_Inequality((Object)this.rewardName, (Object)null))
                        {
                            this.rewardName.set_text(string.Format(LocalizedText.Get("sys.MULTI_VERSUS_REWARD_ARTIFACT"), (object)artifactParam.name));
                        }
                        if (Object.op_Inequality((Object)this.amountObj, (Object)null))
                        {
                            this.amountObj.SetActive(false);
                            break;
                        }
                        break;
                    }
                    break;
                }
                break;

            case VERSUS_ITEM_TYPE.award:
                if (Object.op_Inequality((Object)this.itemObj, (Object)null) && Object.op_Inequality((Object)this.amountObj, (Object)null))
                {
                    ArtifactIcon componentInChildren = (ArtifactIcon)this.itemObj.GetComponentInChildren <ArtifactIcon>();
                    if (Object.op_Inequality((Object)componentInChildren, (Object)null))
                    {
                        ((Behaviour)componentInChildren).set_enabled(false);
                    }
                    this.itemObj.SetActive(true);
                    AwardParam awardParam = instance.GetAwardParam(str);
                    Transform  child      = this.itemObj.get_transform().FindChild("icon");
                    if (Object.op_Inequality((Object)child, (Object)null))
                    {
                        IconLoader iconLoader = GameUtility.RequireComponent <IconLoader>(((Component)child).get_gameObject());
                        if (!string.IsNullOrEmpty(awardParam.icon))
                        {
                            iconLoader.ResourcePath = AssetPath.ItemIcon(awardParam.icon);
                        }
                        GameParameter component = (GameParameter)((Component)child).GetComponent <GameParameter>();
                        if (Object.op_Inequality((Object)component, (Object)null))
                        {
                            ((Behaviour)component).set_enabled(false);
                        }
                    }
                    if (Object.op_Inequality((Object)this.frameTex, (Object)null) && Object.op_Inequality((Object)this.coinBase, (Object)null))
                    {
                        this.frameTex.set_sprite(this.coinBase);
                    }
                    if (Object.op_Inequality((Object)this.amountObj, (Object)null))
                    {
                        this.amountObj.SetActive(false);
                        break;
                    }
                    break;
                }
                break;
            }
            this.mType      = type;
            this.mSeasonIdx = idx;
            if (type == VersusTowerRewardItem.REWARD_TYPE.Arrival)
            {
                if (Object.op_Inequality((Object)this.currentMark, (Object)null))
                {
                    this.currentMark.SetActive((int)dataOfClass.Floor - 1 == versusTowerFloor);
                }
                if (Object.op_Inequality((Object)this.current_fil, (Object)null))
                {
                    this.current_fil.SetActive((int)dataOfClass.Floor - 1 == versusTowerFloor);
                }
            }
            else
            {
                if (Object.op_Inequality((Object)this.currentMark, (Object)null))
                {
                    this.currentMark.SetActive((int)dataOfClass.Floor == versusTowerFloor);
                }
                if (Object.op_Inequality((Object)this.current_fil, (Object)null))
                {
                    this.current_fil.SetActive((int)dataOfClass.Floor == versusTowerFloor);
                }
            }
            if (Object.op_Inequality((Object)this.clearMark, (Object)null))
            {
                this.clearMark.SetActive((int)dataOfClass.Floor - 1 < versusTowerFloor);
            }
            if (!Object.op_Inequality((Object)this.cleared_fil, (Object)null))
            {
                return;
            }
            this.cleared_fil.SetActive((int)dataOfClass.Floor - 1 < versusTowerFloor);
        }
Ejemplo n.º 9
0
        public void OnDetailClick()
        {
            GameManager      instance    = MonoSingleton <GameManager> .Instance;
            VersusTowerParam dataOfClass = DataSource.FindDataOfClass <VersusTowerParam>(((Component)this).get_gameObject(), (VersusTowerParam)null);

            if (dataOfClass == null)
            {
                return;
            }
            VERSUS_ITEM_TYPE versusItemType = VERSUS_ITEM_TYPE.item;
            string           key            = string.Empty;
            int num = 0;

            if (this.mType == VersusTowerRewardItem.REWARD_TYPE.Arrival)
            {
                versusItemType = dataOfClass.ArrivalItemType;
                key            = (string)dataOfClass.ArrivalIteminame;
            }
            else if (this.mSeasonIdx >= 0 && this.mSeasonIdx < dataOfClass.SeasonIteminame.Length)
            {
                versusItemType = dataOfClass.SeasonItemType[this.mSeasonIdx];
                key            = (string)dataOfClass.SeasonIteminame[this.mSeasonIdx];
                num            = (int)dataOfClass.SeasonItemnum[this.mSeasonIdx];
            }
            string str1 = string.Empty;
            string str2 = string.Empty;

            switch (versusItemType)
            {
            case VERSUS_ITEM_TYPE.item:
                ItemParam itemParam = instance.GetItemParam(key);
                if (itemParam != null)
                {
                    str1 = itemParam.name;
                    str2 = itemParam.Expr;
                    break;
                }
                break;

            case VERSUS_ITEM_TYPE.gold:
                str1 = LocalizedText.Get("sys.GOLD");
                str2 = num.ToString() + LocalizedText.Get("sys.GOLD");
                break;

            case VERSUS_ITEM_TYPE.coin:
                str1 = LocalizedText.Get("sys.COIN");
                str2 = string.Format(LocalizedText.Get("sys.CHALLENGE_REWARD_COIN"), (object)num);
                break;

            case VERSUS_ITEM_TYPE.unit:
                str1 = string.Format(LocalizedText.Get("sys.MULTI_VERSUS_REWARD_UNIT"), (object)instance.GetUnitParam(key).name);
                break;

            case VERSUS_ITEM_TYPE.artifact:
                ArtifactParam artifactParam = instance.MasterParam.GetArtifactParam(key);
                if (artifactParam != null)
                {
                    str1 = string.Format(LocalizedText.Get("sys.MULTI_VERSUS_REWARD_ARTIFACT"), (object)artifactParam.name);
                    str2 = artifactParam.Expr;
                    break;
                }
                break;

            case VERSUS_ITEM_TYPE.award:
                AwardParam awardParam = instance.GetAwardParam(key);
                if (awardParam != null)
                {
                    str1 = awardParam.name;
                    str2 = awardParam.expr;
                    break;
                }
                break;
            }
            if (Object.op_Inequality((Object)this.rewardDetailName, (Object)null))
            {
                this.rewardDetailName.set_text(str1);
            }
            if (Object.op_Inequality((Object)this.rewardDetailInfo, (Object)null))
            {
                this.rewardDetailInfo.set_text(str2);
            }
            if (Object.op_Inequality((Object)this.pos, (Object)null))
            {
                ((Transform)this.pos).set_position(((Component)this).get_gameObject().get_transform().get_position());
            }
            FlowNode_TriggerLocalEvent.TriggerLocalEvent((Component)this, "OPEN_DETAIL");
        }
Ejemplo n.º 10
0
        private void RefreshData()
        {
            GameManager       instance       = MonoSingleton <GameManager> .Instance;
            PlayerData        player         = instance.Player;
            List <GameObject> gameObjectList = new List <GameObject>();
            int versusTowerKey = player.VersusTowerKey;
            VersusTowerParam versusTowerParam = instance.GetCurrentVersusTowerParam(-1);

            if (versusTowerParam != null)
            {
                int num = 0;
                while (num < (int)versusTowerParam.RankupNum)
                {
                    GameObject gameObject = (GameObject)UnityEngine.Object.Instantiate <GameObject>((M0)this.template);
                    if (!UnityEngine.Object.op_Equality((UnityEngine.Object)gameObject, (UnityEngine.Object)null))
                    {
                        gameObject.SetActive(true);
                        if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.parent, (UnityEngine.Object)null))
                        {
                            gameObject.get_transform().SetParent(this.parent.get_transform(), false);
                        }
                        Transform child1 = gameObject.get_transform().FindChild("on");
                        Transform child2 = gameObject.get_transform().FindChild("off");
                        if (UnityEngine.Object.op_Inequality((UnityEngine.Object)child1, (UnityEngine.Object)null))
                        {
                            ((Component)child1).get_gameObject().SetActive(versusTowerKey > 0);
                        }
                        if (UnityEngine.Object.op_Inequality((UnityEngine.Object)child2, (UnityEngine.Object)null))
                        {
                            ((Component)child2).get_gameObject().SetActive(versusTowerKey <= 0);
                        }
                        gameObjectList.Add(gameObject);
                    }
                    ++num;
                    --versusTowerKey;
                }
                this.template.SetActive(false);
                if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.nowKey, (UnityEngine.Object)null))
                {
                    this.nowKey.set_text(GameUtility.HalfNum2FullNum(player.VersusTowerKey.ToString()));
                }
                if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.maxKey, (UnityEngine.Object)null))
                {
                    this.maxKey.set_text(GameUtility.HalfNum2FullNum(versusTowerParam.RankupNum.ToString()));
                }
                if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.floor, (UnityEngine.Object)null))
                {
                    this.floor.set_text(player.VersusTowerFloor.ToString());
                }
                if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.winbonus, (UnityEngine.Object)null))
                {
                    this.winbonus.SetActive(player.VersusTowerWinBonus > 1);
                }
                if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.keyrateup, (UnityEngine.Object)null))
                {
                    this.keyrateup.SetActive(player.VersusTowerWinBonus > 0 && (int)versusTowerParam.RankupNum > 0);
                }
                if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.bonusRate, (UnityEngine.Object)null) && player.VersusTowerWinBonus > 0 && (int)versusTowerParam.WinNum > 0)
                {
                    this.bonusRate.set_text((((int)versusTowerParam.WinNum + (int)versusTowerParam.BonusNum) / (int)versusTowerParam.WinNum).ToString());
                }
                if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.winCnt, (UnityEngine.Object)null))
                {
                    this.winCnt.set_text(player.VersusTowerWinBonus.ToString());
                }
                if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.endAt, (UnityEngine.Object)null))
                {
                    DateTime dateTime = TimeManager.FromUnixTime(instance.VersusTowerMatchEndAt);
                    this.endAt.set_text(string.Format(LocalizedText.Get("sys.MULTI_VERSUS_END_AT"), (object)dateTime.Year, (object)dateTime.Month, (object)dateTime.Day, (object)dateTime.Hour, (object)dateTime.Minute));
                }
                if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.keyinfo, (UnityEngine.Object)null))
                {
                    this.keyinfo.SetActive((int)versusTowerParam.RankupNum != 0);
                }
                if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.keyname, (UnityEngine.Object)null))
                {
                    this.keyname.SetActive((int)versusTowerParam.RankupNum != 0);
                }
                if (!UnityEngine.Object.op_Inequality((UnityEngine.Object) this.lastfloor, (UnityEngine.Object)null))
                {
                    return;
                }
                this.lastfloor.SetActive((int)versusTowerParam.RankupNum == 0 && instance.VersusTowerMatchBegin);
            }
            else
            {
                if (!UnityEngine.Object.op_Inequality((UnityEngine.Object) this.lastfloor, (UnityEngine.Object)null))
                {
                    return;
                }
                this.lastfloor.SetActive(false);
            }
        }
Ejemplo n.º 11
0
        private void RefreshData()
        {
            GameManager          instance1          = MonoSingleton <GameManager> .Instance;
            PlayerData           player             = instance1.Player;
            PartyData            partyOfType        = player.FindPartyOfType(PlayerPartyTypes.Versus);
            VsTowerMatchEndParam towerMatchEndParam = instance1.GetVsTowerMatchEndParam();

            if (towerMatchEndParam == null)
            {
                return;
            }
            if (partyOfType != null)
            {
                UnitData unitDataByUniqueId = player.FindUnitDataByUniqueID(partyOfType.GetUnitUniqueID(partyOfType.LeaderIndex));
                if (unitDataByUniqueId != null)
                {
                    DataSource.Bind <UnitData>(((Component)this).get_gameObject(), unitDataByUniqueId);
                }
            }
            int versusTowerFloor = player.VersusTowerFloor;

            if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.floortxt, (UnityEngine.Object)null))
            {
                this.floortxt.set_text(versusTowerFloor.ToString());
            }
            if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.floorEfftxt, (UnityEngine.Object)null))
            {
                this.floorEfftxt.set_text(versusTowerFloor.ToString());
            }
            int versusTowerKey = player.VersusTowerKey;

            if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.key, (UnityEngine.Object)null))
            {
                VersusTowerParam versusTowerParam = instance1.GetCurrentVersusTowerParam(-1);
                if (versusTowerParam != null)
                {
                    int num1 = 0;
                    while (num1 < (int)versusTowerParam.RankupNum)
                    {
                        GameObject go = (GameObject)UnityEngine.Object.Instantiate <GameObject>((M0)this.key);
                        if (UnityEngine.Object.op_Inequality((UnityEngine.Object)go, (UnityEngine.Object)null))
                        {
                            if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.parent, (UnityEngine.Object)null))
                            {
                                go.get_transform().SetParent(this.parent.get_transform(), false);
                            }
                            if (versusTowerKey > 0)
                            {
                                GameUtility.SetAnimatorTrigger(go, this.keyDefAnim);
                            }
                            this.mCreateKey.Add(go);
                        }
                        ++num1;
                        --versusTowerKey;
                    }
                    this.key.SetActive(false);
                    SceneBattle instance2 = SceneBattle.Instance;
                    if (UnityEngine.Object.op_Inequality((UnityEngine.Object)instance2, (UnityEngine.Object)null))
                    {
                        BattleCore battle = instance2.Battle;
                        if (battle != null)
                        {
                            BattleCore.Record questRecord = battle.GetQuestRecord();
                            if (questRecord.result == BattleCore.QuestResult.Win)
                            {
                                int num2 = !towerMatchEndParam.rankup ? towerMatchEndParam.key : (int)versusTowerParam.RankupNum;
                                this.mAnimKeyIndex = player.VersusTowerKey;
                                this.mMaxKeyCount  = Mathf.Min(num2, (int)versusTowerParam.RankupNum);
                                this.mUpdateFloor  = towerMatchEndParam.rankup;
                                this.mBattleRes    = VersusTowerKey.RESULT.WIN;
                                if (this.mUpdateFloor)
                                {
                                    if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.arrivalNumText, (UnityEngine.Object)null))
                                    {
                                        this.arrivalNumText.set_text(towerMatchEndParam.floor.ToString() + LocalizedText.Get("sys.MULTI_VERSUS_FLOOR"));
                                    }
                                    if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.arrivalEffNumText, (UnityEngine.Object)null))
                                    {
                                        this.arrivalEffNumText.set_text(towerMatchEndParam.floor.ToString() + LocalizedText.Get("sys.MULTI_VERSUS_FLOOR"));
                                    }
                                }
                            }
                            else if (questRecord.result == BattleCore.QuestResult.Lose && (int)versusTowerParam.LoseNum > 0)
                            {
                                this.mAnimKeyIndex = player.VersusTowerKey - 1;
                                this.mMaxKeyCount  = Math.Max(towerMatchEndParam.key, 0);
                                this.mUpdateFloor  = this.mAnimKeyIndex < 0 && (int)versusTowerParam.DownFloor > 0;
                                this.mBattleRes    = VersusTowerKey.RESULT.LOSE;
                                if (this.mUpdateFloor && UnityEngine.Object.op_Inequality((UnityEngine.Object) this.arrivalNumText, (UnityEngine.Object)null))
                                {
                                    this.arrivalNumText.set_text(Math.Max(towerMatchEndParam.floor, 1).ToString());
                                }
                            }
                            else
                            {
                                this.mBattleRes = VersusTowerKey.RESULT.DRAW;
                            }
                        }
                    }
                    if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.infoText, (UnityEngine.Object)null))
                    {
                        this.infoText.SetActive(this.mBattleRes == VersusTowerKey.RESULT.WIN && (int)versusTowerParam.RankupNum > 0);
                    }
                }
            }
            if (!this.mUpdateFloor)
            {
                return;
            }
            this.SetButtonText(true);
        }
Ejemplo n.º 12
0
        public override void OnActivate(int pinID)
        {
            GameManager instance = MonoSingleton <GameManager> .Instance;

            switch (pinID)
            {
            case 100:
                GlobalVars.SelectedMultiPlayVersusType = VERSUS_TYPE.Free;
                break;

            case 101:
                GlobalVars.SelectedMultiPlayVersusType = VERSUS_TYPE.Tower;
                break;

            case 102:
                GlobalVars.SelectedMultiPlayVersusType = VERSUS_TYPE.Friend;
                break;

            case 103:
                if (GlobalVars.SelectedMultiPlayVersusType == this.type)
                {
                    if (this.type == VERSUS_TYPE.Tower)
                    {
                        if (instance.VersusTowerMatchBegin)
                        {
                            this.ActivateOutputLinks(201);
                            return;
                        }
                    }
                    else
                    {
                        this.ActivateOutputLinks(201);
                        return;
                    }
                }
                this.ActivateOutputLinks(202);
                return;

            case 104:
                if (instance.VersusTowerMatchBegin)
                {
                    this.ActivateOutputLinks(201);
                    return;
                }
                this.ActivateOutputLinks(202);
                return;

            case 105:
                if (instance.VersusTowerMatchReceipt)
                {
                    this.ActivateOutputLinks(201);
                    return;
                }
                this.ActivateOutputLinks(202);
                return;

            case 106:
                if (instance.Player.VersusSeazonGiftReceipt)
                {
                    this.ActivateOutputLinks(201);
                    return;
                }
                this.ActivateOutputLinks(202);
                return;

            case 107:
                VsTowerMatchEndParam towerMatchEndParam = instance.GetVsTowerMatchEndParam();
                if (towerMatchEndParam != null)
                {
                    VersusTowerParam versusTowerParam = instance.GetCurrentVersusTowerParam(towerMatchEndParam.floor);
                    if (versusTowerParam != null && (int)versusTowerParam.RankupNum == 0 && !towerMatchEndParam.rankup)
                    {
                        this.ActivateOutputLinks(201);
                        return;
                    }
                }
                this.ActivateOutputLinks(202);
                return;

            case 108:
                if (instance.AudienceMode)
                {
                    this.ActivateOutputLinks(201);
                    return;
                }
                this.ActivateOutputLinks(202);
                return;

            case 109:
                if (instance.IsVSCpuBattle)
                {
                    this.ActivateOutputLinks(201);
                    return;
                }
                this.ActivateOutputLinks(202);
                return;

            case 110:
                instance.IsVSCpuBattle = true;
                break;

            case 111:
                long matchExpiredTime = instance.RankMatchExpiredTime;
                long num = TimeManager.FromDateTime(TimeManager.ServerTime);
                instance.RankMatchBegin = num < matchExpiredTime;
                if (instance.RankMatchBegin)
                {
                    this.ActivateOutputLinks(201);
                    return;
                }
                this.ActivateOutputLinks(202);
                return;

            case 112:
                GlobalVars.SelectedMultiPlayVersusType = VERSUS_TYPE.RankMatch;
                break;

            case 113:
                if (instance.VSDraftType == VersusDraftType.Draft)
                {
                    this.ActivateOutputLinks(201);
                    return;
                }
                this.ActivateOutputLinks(202);
                return;

            case 114:
                if (instance.VSDraftType == VersusDraftType.Draft || instance.VSDraftType == VersusDraftType.DraftFriend)
                {
                    this.ActivateOutputLinks(201);
                    return;
                }
                this.ActivateOutputLinks(202);
                return;
            }
            this.ActivateOutputLinks(200);
        }
        public override void OnActivate(int pinID)
        {
            GameManager instance = MonoSingleton <GameManager> .Instance;

            if (pinID == this.FREE)
            {
                GlobalVars.SelectedMultiPlayVersusType = VERSUS_TYPE.Free;
            }
            else if (pinID == this.TOWER)
            {
                GlobalVars.SelectedMultiPlayVersusType = VERSUS_TYPE.Tower;
            }
            else if (pinID == this.FRIEND)
            {
                GlobalVars.SelectedMultiPlayVersusType = VERSUS_TYPE.Friend;
            }
            else
            {
                if (pinID == this.CHECK)
                {
                    if (GlobalVars.SelectedMultiPlayVersusType == this.type)
                    {
                        if (this.type == VERSUS_TYPE.Tower)
                        {
                            if (instance.VersusTowerMatchBegin)
                            {
                                this.ActivateOutputLinks(201);
                                return;
                            }
                        }
                        else
                        {
                            this.ActivateOutputLinks(201);
                            return;
                        }
                    }
                    this.ActivateOutputLinks(202);
                    return;
                }
                if (pinID == this.CHECK_TOWER)
                {
                    if (instance.VersusTowerMatchBegin)
                    {
                        this.ActivateOutputLinks(201);
                        return;
                    }
                    this.ActivateOutputLinks(202);
                    return;
                }
                if (pinID == this.CHECK_RECEIPT)
                {
                    if (instance.VersusTowerMatchReceipt)
                    {
                        this.ActivateOutputLinks(201);
                        return;
                    }
                    this.ActivateOutputLinks(202);
                    return;
                }
                if (pinID == this.CHECK_SEASONGIFT)
                {
                    if (instance.Player.VersusSeazonGiftReceipt)
                    {
                        this.ActivateOutputLinks(201);
                        return;
                    }
                    this.ActivateOutputLinks(202);
                    return;
                }
                if (pinID == this.CHECK_TOPFLOOR)
                {
                    VsTowerMatchEndParam towerMatchEndParam = instance.GetVsTowerMatchEndParam();
                    if (towerMatchEndParam != null)
                    {
                        VersusTowerParam versusTowerParam = instance.GetCurrentVersusTowerParam(towerMatchEndParam.floor);
                        if (versusTowerParam != null && (int)versusTowerParam.RankupNum == 0 && !towerMatchEndParam.rankup)
                        {
                            this.ActivateOutputLinks(201);
                            return;
                        }
                    }
                    this.ActivateOutputLinks(202);
                    return;
                }
                if (pinID == this.CHECK_AUDIENCE)
                {
                    if (instance.AudienceMode)
                    {
                        this.ActivateOutputLinks(201);
                        return;
                    }
                    this.ActivateOutputLinks(202);
                    return;
                }
            }
            this.ActivateOutputLinks(200);
        }
Ejemplo n.º 14
0
        public void SetData(VersusTowerRewardItem.REWARD_TYPE type, int idx = 0)
        {
            GameManager      instance    = MonoSingleton <GameManager> .Instance;
            VersusTowerParam dataOfClass = DataSource.FindDataOfClass <VersusTowerParam>(((Component)this).get_gameObject(), (VersusTowerParam)null);

            if (dataOfClass == null)
            {
                return;
            }
            VERSUS_ITEM_TYPE versusItemType = VERSUS_ITEM_TYPE.item;
            string           str            = string.Empty;
            int num = 0;

            if (type == VersusTowerRewardItem.REWARD_TYPE.Arrival)
            {
                versusItemType = dataOfClass.ArrivalItemType;
                str            = (string)dataOfClass.ArrivalIteminame;
                num            = (int)dataOfClass.ArrivalItemNum;
            }
            else if (idx >= 0 && idx < dataOfClass.SeasonIteminame.Length)
            {
                versusItemType = dataOfClass.SeasonItemType[idx];
                str            = (string)dataOfClass.SeasonIteminame[idx];
                num            = (int)dataOfClass.SeasonItemnum[idx];
            }
            if (Object.op_Inequality((Object)this.itemObj, (Object)null))
            {
                this.itemObj.SetActive(true);
            }
            if (Object.op_Inequality((Object)this.unitObj, (Object)null))
            {
                this.unitObj.SetActive(false);
            }
            switch (versusItemType)
            {
            case VERSUS_ITEM_TYPE.item:
                if (!Object.op_Inequality((Object)this.itemObj, (Object)null) || !Object.op_Inequality((Object)this.amountObj, (Object)null))
                {
                    break;
                }
                ArtifactIcon componentInChildren1 = (ArtifactIcon)this.itemObj.GetComponentInChildren <ArtifactIcon>();
                if (Object.op_Inequality((Object)componentInChildren1, (Object)null))
                {
                    ((Behaviour)componentInChildren1).set_enabled(false);
                }
                this.itemObj.SetActive(true);
                ItemParam itemParam = instance.GetItemParam(str);
                DataSource.Bind <ItemParam>(this.itemObj, itemParam);
                ItemData data1 = new ItemData();
                data1.Setup(0L, itemParam, num);
                DataSource.Bind <ItemData>(this.amountObj, data1);
                GameParameter.UpdateAll(this.itemObj);
                if (Object.op_Inequality((Object)this.iconParam, (Object)null))
                {
                    this.iconParam.UpdateValue();
                }
                if (Object.op_Inequality((Object)this.frameParam, (Object)null))
                {
                    this.frameParam.UpdateValue();
                }
                if (!Object.op_Inequality((Object)this.rewardName, (Object)null))
                {
                    break;
                }
                this.rewardName.set_text(itemParam.name + string.Format(LocalizedText.Get("sys.CROSS_NUM"), (object)num));
                break;

            case VERSUS_ITEM_TYPE.gold:
                if (Object.op_Inequality((Object)this.itemTex, (Object)null))
                {
                    GameParameter component = (GameParameter)((Component)this.itemTex).GetComponent <GameParameter>();
                    if (Object.op_Inequality((Object)component, (Object)null))
                    {
                        ((Behaviour)component).set_enabled(false);
                    }
                    this.itemTex.set_texture(this.goldTex);
                }
                if (Object.op_Inequality((Object)this.frameTex, (Object)null) && Object.op_Inequality((Object)this.goldBase, (Object)null))
                {
                    this.frameTex.set_sprite(this.goldBase);
                }
                if (Object.op_Inequality((Object)this.rewardName, (Object)null))
                {
                    this.rewardName.set_text(num.ToString() + LocalizedText.Get("sys.GOLD"));
                }
                if (!Object.op_Inequality((Object)this.amountObj, (Object)null))
                {
                    break;
                }
                this.amountObj.SetActive(false);
                break;

            case VERSUS_ITEM_TYPE.coin:
                if (Object.op_Inequality((Object)this.itemTex, (Object)null))
                {
                    GameParameter component = (GameParameter)((Component)this.itemTex).GetComponent <GameParameter>();
                    if (Object.op_Inequality((Object)component, (Object)null))
                    {
                        ((Behaviour)component).set_enabled(false);
                    }
                    this.itemTex.set_texture(this.coinTex);
                }
                if (Object.op_Inequality((Object)this.frameTex, (Object)null) && Object.op_Inequality((Object)this.coinBase, (Object)null))
                {
                    this.frameTex.set_sprite(this.coinBase);
                }
                if (Object.op_Inequality((Object)this.rewardName, (Object)null))
                {
                    this.rewardName.set_text(string.Format(LocalizedText.Get("sys.CHALLENGE_REWARD_COIN"), (object)num));
                }
                if (!Object.op_Inequality((Object)this.amountObj, (Object)null))
                {
                    break;
                }
                this.amountObj.SetActive(false);
                break;

            case VERSUS_ITEM_TYPE.unit:
                if (!Object.op_Inequality((Object)this.unitObj, (Object)null))
                {
                    break;
                }
                if (Object.op_Inequality((Object)this.itemObj, (Object)null))
                {
                    this.itemObj.SetActive(false);
                }
                this.unitObj.SetActive(true);
                UnitParam unitParam = instance.GetUnitParam(str);
                DebugUtility.Assert(unitParam != null, "Invalid unit:" + str);
                UnitData data2 = new UnitData();
                data2.Setup(str, 0, 1, 0, (string)null, 1, EElement.None);
                DataSource.Bind <UnitData>(this.unitObj, data2);
                GameParameter.UpdateAll(this.unitObj);
                if (!Object.op_Inequality((Object)this.rewardName, (Object)null))
                {
                    break;
                }
                this.rewardName.set_text(unitParam.name);
                break;

            case VERSUS_ITEM_TYPE.artifact:
                if (!Object.op_Inequality((Object)this.itemObj, (Object)null))
                {
                    break;
                }
                ArtifactParam artifactParam = instance.MasterParam.GetArtifactParam(str);
                DataSource.Bind <ArtifactParam>(this.itemObj, artifactParam);
                ArtifactIcon componentInChildren2 = (ArtifactIcon)this.itemObj.GetComponentInChildren <ArtifactIcon>();
                if (!Object.op_Inequality((Object)componentInChildren2, (Object)null))
                {
                    break;
                }
                ((Behaviour)componentInChildren2).set_enabled(true);
                componentInChildren2.UpdateValue();
                if (Object.op_Inequality((Object)this.rewardName, (Object)null))
                {
                    this.rewardName.set_text(artifactParam.name);
                }
                if (!Object.op_Inequality((Object)this.amountObj, (Object)null))
                {
                    break;
                }
                this.amountObj.SetActive(false);
                break;
            }
        }