コード例 #1
0
ファイル: UIPerk.cs プロジェクト: GoodMan56/Roll-your-doner
    void PerkWindow()
    {
        GUI.depth = 0;

        int winWidth  = 575;
        int winHeight = 470;

        int startX = Screen.width / 2 - winWidth / 2;
        int startY = Screen.height / 2 - winHeight / 2;
        //~ int width=120;
        //~ int height=50;

        int row    = 0;
        int column = 0;

        GUI.BeginGroup(new Rect(startX, startY, winWidth + 50, winHeight + 50));
        for (int i = 0; i < 2; i++)
        {
            GUI.Box(new Rect(0, 0, winWidth, winHeight), "");
        }

        GUIStyle styleT = new GUIStyle();

        styleT.padding          = new RectOffset(0, 0, 0, 0);
        styleT.normal.textColor = new Color(0, 1, 1, 1f);
        styleT.alignment        = TextAnchor.MiddleCenter;
        styleT.fontStyle        = FontStyle.Bold;
        styleT.fontSize         = 18;
        GUI.Label(new Rect(winWidth / 2 - 70, 10, 140, 25), "Perk Menu", styleT);

        if (showPerkPoint)
        {
            styleT.alignment = TextAnchor.MiddleRight;
            styleT.fontStyle = FontStyle.Normal;
            styleT.fontSize  = 14;
            GUI.Label(new Rect(winWidth - 130, 20, 120, 25), "Perk point: " + PerkManager.perkPoint, styleT);
        }

        //~ for(int i=0; i<2; i++) GUI.Box(new Rect(winWidth/2-53, winHeight+5, 106, 31), "");
        //~ if(GUI.Button(new Rect(winWidth+10, 10, 25, 25), "X")){
        //~ showWindow=false;
        //~ }
        //~ if(GUI.Button(new Rect(winWidth/2-50, winHeight+8, 100, 25), "Close")){
        if (GUI.Button(new Rect(10, 10, 40, 25), "X "))
        {
            showWindow = false;
            if (onPerkWindowE != null)
            {
                onPerkWindowE(showWindow);
            }
            if (camControl != null)
            {
                camControl.enabled = true;
            }
        }


        for (int i = 0; i < 4; i++)
        {
            GUI.Box(new Rect(10, 50, winWidth - 20, 310), "");
        }
        scrollPosition = GUI.BeginScrollView(new Rect(10, 50, winWidth - 20, 310), scrollPosition, new Rect(0, 0, winWidth - 50, scrollAreaLength));

        //~ GUI.Box(new Rect(5+column*60, 5+row*60, 60, 60), "");


        GUIStyle style = new GUIStyle();

        style.padding          = new RectOffset(0, 0, 0, 0);
        style.normal.textColor = new Color(1, 1, 1, 1f);
        style.alignment        = TextAnchor.MiddleCenter;

        int groupCount        = 0;
        int currentGroupCount = 0;
        int tierOffset        = 0;

        for (int ID = 0; ID < PerkManager.GetAllPerks().Count; ID++)
        {
            Perk perk = PerkManager.GetAllPerks()[ID];
            int  avai = perk.IsAvailable();

            if (perk.enableInlvl)
            {
                if (perk.unlocked)
                {
                    style.normal.textColor = new Color(0, 1, 0, 1f);
                }
                else if (avai == 0)
                {
                    style.normal.textColor = new Color(1, 1, 1, 1f);
                }
                else
                {
                    style.normal.textColor = new Color(1, 0, 0, 1f);
                }

                if (selectedID == ID)
                {
                    style.fontStyle = FontStyle.Bold;
                    style.fontSize  = 14;
                    if (avai == 0)
                    {
                        style.normal.textColor = new Color(0, 1, 1, 1f);
                    }
                }

                bool flag = false;

                if (iconOnly)
                {
                    if (!perk.unlocked)
                    {
                        flag = GUI.Button(new Rect(10 + column * (50 + spaceX), 10 + tierOffset + row * (50 + spaceY), 50, 50), "");
                    }
                    else
                    {
                        GUI.Box(new Rect(10 + column * (50 + spaceX), 10 + tierOffset + row * (50 + spaceY), 50, 50), "");
                        flag = GUI.Button(new Rect(10 + column * 60, 10 + tierOffset + row * (50 + spaceY), 50, 50), "", style);
                    }

                    if (perk.icon == null)
                    {
                        GUI.Box(new Rect(14 + column * (50 + spaceX), 14 + tierOffset + row * (50 + spaceY), 42, 42), "");
                    }
                    else
                    {
                        Texture icon = null;
                        if (perk.unlocked)
                        {
                            icon = perk.iconUnlocked;
                        }
                        else if (avai == 0)
                        {
                            icon = perk.icon;
                        }
                        else
                        {
                            icon = perk.iconUnavailable;
                        }

                        GUI.Label(new Rect(14 + column * (50 + spaceX), 14 + tierOffset + row * (50 + spaceY), 42, 42), icon, style);
                    }
                }
                else
                {
                    if (!perk.unlocked)
                    {
                        flag = GUI.Button(new Rect(10 + column * (160 + spaceX), 10 + tierOffset + row * (50 + spaceY), 160, 50), "");
                    }
                    else
                    {
                        GUI.Box(new Rect(10 + column * (160 + spaceX), 10 + tierOffset + row * (50 + spaceY), 160, 50), "");
                        flag = GUI.Button(new Rect(10 + column * (160 + spaceX), 10 + tierOffset + row * (50 + spaceY), 160, 50), "", style);
                    }

                    if (perk.icon == null)
                    {
                        GUI.Box(new Rect(15 + column * (160 + spaceX), 14 + tierOffset + row * (50 + spaceY), 42, 42), "");
                    }
                    else
                    {
                        Texture icon = null;
                        if (perk.unlocked)
                        {
                            icon = perk.iconUnlocked;
                        }
                        else if (avai == 0)
                        {
                            icon = perk.icon;
                        }
                        else
                        {
                            icon = perk.iconUnavailable;
                        }

                        GUI.Label(new Rect(15 + column * (160 + spaceX), 14 + tierOffset + row * (50 + spaceY), 42, 42), icon, style);
                    }

                    GUI.Label(new Rect(60 + column * (160 + spaceX), 10 + tierOffset + row * (50 + spaceY), 100, 50), perk.name, style);
                }

                if (flag)
                {
                    selectedID = ID;
                }

                style.fontSize = 12;
                if (selectedID == ID)
                {
                    style.fontStyle = FontStyle.Normal;
                }
                if (avai == 0)
                {
                    style.normal.textColor = new Color(1, 1, 1, 1f);
                }
                else
                {
                    style.normal.textColor = new Color(1, 1, 1, 1f);
                }


                if (perkGroups != null && perkGroups.Length > 0 && perkGroups.Length > groupCount)
                {
                    currentGroupCount += 1;
                    if (currentGroupCount >= perkGroups[groupCount].itemCount)
                    {
                        GUIStyle style1 = new GUIStyle();
                        style1.normal.textColor = new Color(1, 1, 0, 1f);
                        style1.fontStyle        = FontStyle.Bold;
                        GUI.Label(new Rect(10, 60 + tierOffset + row * (50 + spaceY), 500, 20), perkGroups[groupCount].label, style1);

                        groupCount       += 1;
                        currentGroupCount = 0;
                        column            = maxItemPerRow - 1;
                        tierOffset       += groupSpacing;
                    }
                }


                column += 1;
                if (column == maxItemPerRow)
                {
                    column = 0;
                    row   += 1;
                }
            }
        }


        GUI.EndScrollView();


        int panelWidth  = winWidth - 20;
        int panelHeight = 90;

        GUI.BeginGroup(new Rect(10, winHeight - 100, panelWidth, panelHeight));
        for (int i = 0; i < 4; i++)
        {
            GUI.Box(new Rect(0, 0, panelWidth, panelHeight), "");
        }

        Perk selectedPerk = PerkManager.GetAllPerks()[selectedID];
        int  perkAvai     = selectedPerk.IsAvailable();



        style = new GUIStyle();
        style.normal.textColor = new Color(1, 1, 0, 1f);
        style.fontStyle        = FontStyle.Bold;
        style.fontSize         = 14;
        string status = "";

        if (perkAvai > 0)
        {
            status = " (Unavailable)";
            style.normal.textColor = new Color(1, 0, 0, 1f);
        }
        if (selectedPerk.unlocked)
        {
            status = " (Unlocked)";
            style.normal.textColor = new Color(0, 1, 0, 1f);
        }
        GUI.Label(new Rect(5, 5, 500, 30), selectedPerk.name + status, style);
        GUI.Label(new Rect(5, 25, 500, 30), selectedPerk.desp);

        style = new GUIStyle();
        style.normal.textColor = new Color(1, 0, 0, 1f);
        float subStartX = 5; float subStartY = panelHeight - 25; float widthMin = 0f; float widthMax = 0f;

        if (perkAvai == 0)
        {
            if (selectedPerk.RequireResource())
            {
                Resource[] resourceList = GameControl.GetResourceList();

                GUI.Label(new Rect(subStartX, subStartY + 2, 70f, 25f), "Cost:");
                subStartX += 50;

                //display all the resource
                for (int i = 0; i < Mathf.Min(selectedPerk.costs.Length, resourceList.Length); i++)
                {
                    if (selectedPerk.costs[i] > 0)
                    {
                        //if an icon has been assigned to that particular resource type
                        if (resourceList[i].icon != null)
                        {
                            GUI.Label(new Rect(subStartX, subStartY, 20f, 25f), resourceList[i].icon);
                            subStartX += 20;
                            GUI.Label(new Rect(subStartX, subStartY + 2, 40, 25), selectedPerk.costs[i].ToString());
                            subStartX += 40;
                        }
                        //if not icon, just show the text
                        else
                        {
                            GUIContent labelRsc = new GUIContent(selectedPerk.costs[i].ToString() + resourceList[i].name);
                            GUI.skin.GetStyle("Label").CalcMinMaxWidth(labelRsc, out widthMin, out widthMax);
                            GUI.Label(new Rect(subStartX, subStartY + 2, widthMax, 25), labelRsc);
                            subStartX += widthMax + 20;
                        }
                    }
                }
            }
        }
        //pre-req perk not unlocked
        else if (perkAvai == 1)
        {
            GUI.Label(new Rect(subStartX, subStartY + 2, 70f, 25f), "Require: ", style);
            subStartX += 60;
            List <int> list = selectedPerk.prereq;
            foreach (int ID in list)
            {
                GUIContent label = new GUIContent(PerkManager.GetAllPerks()[ID].name.ToString());
                GUI.skin.GetStyle("Label").CalcMinMaxWidth(label, out widthMin, out widthMax);
                GUI.Label(new Rect(subStartX, subStartY + 2, widthMax + 5, 25), label, style);
                subStartX += widthMax + 10;
            }
        }
        //min wave req not reach
        else if (perkAvai == 2)
        {
            GUI.Label(new Rect(subStartX, subStartY + 2, panelWidth, 25f), "Available at wave " + selectedPerk.waveMin, style);
        }
        //min perk point not reach
        else if (perkAvai == 3)
        {
            GUI.Label(new Rect(subStartX, subStartY + 2, panelWidth, 25f), "Require " + selectedPerk.perkMin + " perk points", style);
        }

        style           = new GUIStyle();
        style.alignment = TextAnchor.MiddleCenter;
        style.fontStyle = FontStyle.Bold;


        if (perkAvai == 0)
        {
            if (!selectedPerk.unlocked)
            {
                if (GUI.Button(new Rect(panelWidth - 105, panelHeight - 35, 100, 30), "Unlock"))
                {
                    PerkManager.Unlock(selectedID);
                }
            }
            //~ else{
            //~ GUI.Box(new Rect(panelWidth-105, panelHeight-30, 100, 25), "");
            //~ style.normal.textColor=new Color(0, 1, 0, 1f);
            //~ GUI.Label(new Rect(panelWidth-105, panelHeight-30, 100, 25), "Unlocked", style);
            //~ }
        }
        //~ else{
        //~ GUI.Box(new Rect(panelWidth-105, panelHeight-30, 100, 25), "");
        //~ style.normal.textColor=new Color(1, 0, 0, 1f);
        //~ GUI.Label(new Rect(panelWidth-105, panelHeight-30, 100, 25), "Unavailable", style);
        //~ }

        GUI.EndGroup();

        GUI.EndGroup();
        //~ GUI.Box(new Rect(10, 200, 150,150), PerkManager.GetAllPerks()[0].icon);
    }
コード例 #2
0
        private void RefreshActivePerksGrid()
        {
            if (this.activePerksGrid == null)
            {
                this.activePerksGrid = this.screen.GetElement <UXGrid>("GridActSlotsPerks");
                this.activePerksGrid.SetTemplateItem("TemplateActSlotPerks");
            }
            this.activePerkTimerLabels.Clear();
            IDataController          dataController    = Service.Get <IDataController>();
            Lang                     lang              = Service.Get <Lang>();
            PerkManager              perkManager       = Service.Get <PerkManager>();
            List <ActivatedPerkData> playerActivePerks = perkManager.GetPlayerActivePerks();
            Squad                    currentSquad      = Service.Get <SquadController>().StateManager.GetCurrentSquad();

            if (currentSquad == null)
            {
                return;
            }
            string           squadLevelUIDFromSquad = GameUtils.GetSquadLevelUIDFromSquad(currentSquad);
            int              availableSlotsCount    = perkManager.GetAvailableSlotsCount(squadLevelUIDFromSquad);
            int              squadLevelMax          = perkManager.SquadLevelMax;
            List <UXElement> list = new List <UXElement>();
            int              num  = -1;
            int              i    = 1;
            int              num2 = 0;

            while (i <= squadLevelMax)
            {
                string       squadLevelUIDFromLevel = GameUtils.GetSquadLevelUIDFromLevel(i);
                SquadLevelVO squadLevelVO           = dataController.Get <SquadLevelVO>(squadLevelUIDFromLevel);
                int          slots = squadLevelVO.Slots;
                if (num != slots)
                {
                    bool      flag         = slots > availableSlotsCount;
                    bool      flag2        = num2 < playerActivePerks.Count && !flag;
                    int       level        = squadLevelVO.Level;
                    string    itemUid      = "PerkSlot_" + slots.ToString();
                    UXElement uXElement    = base.FetchPerkGridItem(this.activePerksGrid, itemUid);
                    UXElement subElement   = this.activePerksGrid.GetSubElement <UXElement>(itemUid, "AvailableSlotGroupPerks");
                    UXLabel   subElement2  = this.activePerksGrid.GetSubElement <UXLabel>(itemUid, "LabelAvActSlotPerks");
                    UXElement subElement3  = this.activePerksGrid.GetSubElement <UXElement>(itemUid, "ActivatedSlotGroupPerks");
                    UXElement subElement4  = this.activePerksGrid.GetSubElement <UXElement>(itemUid, "LockedSlotGroupPerks");
                    UXLabel   subElement5  = this.activePerksGrid.GetSubElement <UXLabel>(itemUid, "LabelPerkTitleActSlotPerks");
                    UXLabel   subElement6  = this.activePerksGrid.GetSubElement <UXLabel>(itemUid, "LabelPerkLvlActSlotPerks");
                    UXLabel   subElement7  = this.activePerksGrid.GetSubElement <UXLabel>(itemUid, "LabelPerkMessageTimerActSlotPerks");
                    UXLabel   subElement8  = this.activePerksGrid.GetSubElement <UXLabel>(itemUid, "LabelPerkTimerActSlotPerks");
                    UXButton  subElement9  = this.activePerksGrid.GetSubElement <UXButton>(itemUid, "BtnRemoveActSlotPerks");
                    UXTexture subElement10 = this.activePerksGrid.GetSubElement <UXTexture>(itemUid, "TexturePerkArtActSlotPerks");
                    UXButton  uXButton     = uXElement as UXButton;
                    if (flag)
                    {
                        uXButton.Enabled    = false;
                        subElement.Visible  = false;
                        subElement4.Visible = true;
                        subElement3.Visible = false;
                        subElement9.Visible = false;
                        UXLabel subElement11 = this.activePerksGrid.GetSubElement <UXLabel>(itemUid, "LabelSquadLvlLockedSlotPerks");
                        subElement11.Text = level.ToString();
                        UXLabel subElement12 = this.activePerksGrid.GetSubElement <UXLabel>(itemUid, "LabelSquadLvlLockedSlotPerks");
                        subElement12.Text = lang.Get("PERK_ACTIVATE_UPGRADE_CARD_LVL_REQ", new object[]
                        {
                            level
                        });
                    }
                    else if (flag2)
                    {
                        subElement.Visible  = false;
                        subElement4.Visible = false;
                        subElement3.Visible = true;
                        subElement9.Visible = true;
                        ActivatedPerkData  activatedPerkData  = playerActivePerks[num2++];
                        string             perkId             = activatedPerkData.PerkId;
                        PerkViewController perkViewController = Service.Get <PerkViewController>();
                        PerkVO             perkVO             = dataController.Get <PerkVO>(perkId);
                        subElement5.Text = perkViewController.GetPerkNameForGroup(perkVO.PerkGroup);
                        subElement6.Text = StringUtils.GetRomanNumeral(perkVO.PerkTier);
                        perkViewController.SetPerkImage(subElement10, perkVO);
                        subElement7.Text = lang.Get("PERK_ACTIVE_SLOT_ACTIVE_TIMER_DESC", new object[0]);
                        this.UpdateLabelTimeRemaining(subElement8, lang, "PERK_ACTIVE_SLOT_ACTIVE_TIMER", activatedPerkData.EndTime);
                        subElement8.Tag = activatedPerkData;
                        this.activePerkTimerLabels.Add(subElement8);
                        uXButton.Enabled      = true;
                        uXButton.Tag          = perkVO;
                        uXButton.OnClicked    = new UXButtonClickedDelegate(this.OnPerkSlotButtonClicked);
                        subElement9.Tag       = perkId;
                        subElement9.Visible   = true;
                        subElement9.OnClicked = new UXButtonClickedDelegate(this.OnRemoveButtonClicked);
                    }
                    else
                    {
                        uXButton.Enabled    = false;
                        subElement4.Visible = false;
                        subElement3.Visible = false;
                        subElement9.Visible = false;
                        subElement.Visible  = true;
                        subElement2.Text    = lang.Get("PERK_ACTIVE_SLOT_TITLE", new object[0]);
                    }
                    list.Add(uXElement);
                    num = slots;
                }
                i++;
            }
            this.activePerksGrid.ClearWithoutDestroy();
            int j     = 0;
            int count = list.Count;

            while (j < count)
            {
                this.activePerksGrid.AddItem(list[j], j);
                j++;
            }
            this.activePerksGrid.RepositionItems();
            list.Clear();
        }
コード例 #3
0
        public static void CalculateContractCost(string productUid, DeliveryType deliveryType, BuildingTypeVO buildingVO, List <string> contractPerkIds, out int credits, out int materials, out int contraband)
        {
            credits    = 0;
            materials  = 0;
            contraband = 0;
            switch (deliveryType)
            {
            case DeliveryType.Infantry:
            case DeliveryType.Vehicle:
            case DeliveryType.Hero:
            case DeliveryType.Champion:
            case DeliveryType.Mercenary:
            {
                TroopTypeVO troopTypeVO = Service.StaticDataController.Get <TroopTypeVO>(productUid);
                credits    = troopTypeVO.Credits;
                materials  = troopTypeVO.Materials;
                contraband = troopTypeVO.Contraband;
                goto IL_1B1;
            }

            case DeliveryType.Starship:
            {
                SpecialAttackTypeVO specialAttackTypeVO = Service.StaticDataController.Get <SpecialAttackTypeVO>(productUid);
                credits    = specialAttackTypeVO.Credits;
                materials  = specialAttackTypeVO.Materials;
                contraband = specialAttackTypeVO.Contraband;
                goto IL_1B1;
            }

            case DeliveryType.UpgradeBuilding:
            {
                BuildingTypeVO buildingTypeVO = Service.StaticDataController.Get <BuildingTypeVO>(productUid);
                credits    = buildingTypeVO.UpgradeCredits;
                materials  = buildingTypeVO.UpgradeMaterials;
                contraband = buildingTypeVO.UpgradeContraband;
                goto IL_1B1;
            }

            case DeliveryType.SwapBuilding:
            {
                BuildingTypeVO buildingTypeVO2 = Service.StaticDataController.Get <BuildingTypeVO>(productUid);
                credits    = buildingTypeVO2.SwapCredits;
                materials  = buildingTypeVO2.SwapMaterials;
                contraband = buildingTypeVO2.SwapContraband;
                goto IL_1B1;
            }

            case DeliveryType.UpgradeTroop:
            {
                TroopTypeVO troopTypeVO2 = Service.StaticDataController.Get <TroopTypeVO>(productUid);
                credits    = troopTypeVO2.UpgradeCredits;
                materials  = troopTypeVO2.UpgradeMaterials;
                contraband = troopTypeVO2.UpgradeContraband;
                goto IL_1B1;
            }

            case DeliveryType.UpgradeStarship:
            {
                SpecialAttackTypeVO specialAttackTypeVO2 = Service.StaticDataController.Get <SpecialAttackTypeVO>(productUid);
                credits    = specialAttackTypeVO2.UpgradeCredits;
                materials  = specialAttackTypeVO2.UpgradeMaterials;
                contraband = specialAttackTypeVO2.UpgradeContraband;
                goto IL_1B1;
            }

            case DeliveryType.UpgradeEquipment:
                goto IL_1B1;

            case DeliveryType.ClearClearable:
            {
                BuildingTypeVO buildingTypeVO3 = Service.StaticDataController.Get <BuildingTypeVO>(productUid);
                credits    = buildingTypeVO3.Credits;
                materials  = buildingTypeVO3.Materials;
                contraband = buildingTypeVO3.Contraband;
                goto IL_1B1;
            }
            }
            Service.Logger.Error("DeliveryType has no cost: " + deliveryType);
IL_1B1:
            ContractType contractType = ContractUtils.GetContractType(deliveryType);

            if (ContractUtils.IsTroopType(contractType) && buildingVO != null && contractPerkIds != null && contractPerkIds.Count > 0)
            {
                PerkManager perkManager = Service.PerkManager;
                float       contractCostMultiplierForPerks = perkManager.GetContractCostMultiplierForPerks(buildingVO, contractPerkIds);
                GameUtils.MultiplyCurrency(contractCostMultiplierForPerks, ref credits, ref materials, ref contraband);
            }
        }
コード例 #4
0
ファイル: DemoCampaign.cs プロジェクト: Hengle/TBTKPrototype
    void Awake()
    {
        instance = this;

        PerkManager perkManager = (PerkManager)FindObjectOfType(typeof(PerkManager));

        if (perkManager != null)
        {
            perkManager.Init();
        }

        AbilityManagerUnit abManagerUnit = (AbilityManagerUnit)FindObjectOfType(typeof(AbilityManagerUnit));

        if (abManagerUnit != null)
        {
            abManagerUnit.Init();
        }


        availableUnitList = new List <Unit>(UnitDB.Load());             //load the unit from DB, you manually assign this if you want

        //since we are loading from DB, we dont want the AI unit, which started from 6 (so we remove them)
        while (availableUnitList.Count > 9)
        {
            availableUnitList.RemoveAt(availableUnitList.Count - 1);
        }

        //if this there isn't any save
        if (!PlayerPrefs.HasKey("TBTK_Demo"))
        {
            //for demo purpose, we are using perk currency as the universal currency
            //so we set the perk currency to our starting value and let PerkManager keep track of it
            PerkManager.SetPerkCurrency(startingCurrency);

            PlayerPrefs.SetInt("TBTK_Demo", 1);
        }
        else
        {
            //check with data to see if the scene is loaded from a battle
            if (TBData.BattleEndDataExist())
            {
                List <TBDataUnit> dataList = TBData.GetEndData(0);              //get the data, the ID is zero, since we start the battle with 0
                //note that the faction in the battle scene is configured to load data from 0 too

                if (dataList != null)                   //add the unit based on the dataList
                {
                    for (int i = 0; i < dataList.Count; i++)
                    {
                        selectedUnitList.Add(dataList[i].unit);
                    }
                }

                for (int i = 0; i < selectedUnitList.Count; i++)                        //fill up the availableUnitMapList (for saving)
                {
                    bool match = false;
                    for (int n = 0; n < availableUnitList.Count; n++)                           //find the corresponding unit in availableList and add the index to selectedUnitMapList
                    {
                        if (selectedUnitList[i] == availableUnitList[n])
                        {
                            selectedUnitMapList.Add(n);
                            match = true;
                            break;
                        }
                    }
                    //if there's no match in availableUnitList, unit no longer available in game, remove it from selected list
                    if (!match)
                    {
                        selectedUnitList.RemoveAt(i);
                        i -= 1;
                    }
                }

                _SaveLoadOut();
            }
            else                //if we are not loading the scene from a battle, load the selectedUnitList from previous save in stead of getting it from data
            {
                _LoadLoadOut();
            }
        }
    }
コード例 #5
0
        private void RefreshAvailablePerksGrid()
        {
            this.cooldownTimerLabels.Clear();
            this.cooldownCostLabels.Clear();
            this.perkBadgeMap.Clear();
            IDataController    dataController     = Service.Get <IDataController>();
            Lang               lang               = Service.Get <Lang>();
            PerkManager        perkManager        = Service.Get <PerkManager>();
            PerkViewController perkViewController = Service.Get <PerkViewController>();
            Squad              currentSquad       = Service.Get <SquadController>().StateManager.GetCurrentSquad();

            if (currentSquad == null)
            {
                return;
            }
            Dictionary <string, string> available = currentSquad.Perks.Available;
            int level             = currentSquad.Level;
            List <UXElement> list = new List <UXElement>();

            foreach (PerkVO current in dataController.GetAll <PerkVO>())
            {
                string uid              = current.Uid;
                string perkGroup        = current.PerkGroup;
                int    perkTier         = current.PerkTier;
                int    squadLevelUnlock = current.SquadLevelUnlock;
                bool   flag             = perkManager.IsPerkLevelLocked(current, level);
                bool   flag2            = perkManager.IsPerkReputationLocked(current, level, available);
                bool   flag3            = flag | flag2;
                bool   flag4            = perkManager.IsPerkGroupActive(perkGroup);
                bool   flag5            = perkManager.IsPerkGroupInCooldown(perkGroup);
                if ((!available.ContainsKey(perkGroup) || !(available[perkGroup] != current.Uid)) && (!flag3 || perkTier == 1))
                {
                    string    text      = "PerkItem_" + perkGroup;
                    UXElement uXElement = base.FetchPerkGridItem(this.perksGrid, text);
                    uXElement.Tag = current;
                    UXElement subElement  = this.perksGrid.GetSubElement <UXElement>(text, "CoolDownGroupAvActCardPerks");
                    UXElement subElement2 = this.perksGrid.GetSubElement <UXElement>(text, "LockedGroupAvActCardPerks");
                    UXElement subElement3 = this.perksGrid.GetSubElement <UXElement>(text, "CostAvActPerkTop");
                    subElement3.Visible = false;
                    UXElement subElement4 = this.perksGrid.GetSubElement <UXElement>(text, "CostAvActPerkBot");
                    subElement4.Visible = false;
                    UXLabel subElement5 = this.perksGrid.GetSubElement <UXLabel>(text, "LabelPerkTitleAvActCardPerks");
                    subElement5.Text = perkViewController.GetPerkNameForGroup(perkGroup);
                    UXLabel subElement6 = this.perksGrid.GetSubElement <UXLabel>(text, "LabelPerkLvlAvActCardPerks");
                    subElement6.Text    = StringUtils.GetRomanNumeral(current.PerkTier);
                    subElement6.Visible = !flag3;
                    UXTexture subElement7 = this.perksGrid.GetSubElement <UXTexture>(text, "TexturePerkArtAvActCardPerks");
                    perkViewController.SetPerkImage(subElement7, current);
                    UXButton subElement8 = this.perksGrid.GetSubElement <UXButton>(text, "BtnAvActCardPerks");
                    subElement8.Tag       = current;
                    subElement8.OnClicked = new UXButtonClickedDelegate(this.OnPerkButtonClicked);
                    uXElement.Visible     = true;
                    if (flag3)
                    {
                        subElement.Visible  = false;
                        subElement2.Visible = true;
                        UXLabel subElement9 = this.perksGrid.GetSubElement <UXLabel>(text, "LabelSquadLvlLockedAvActCardPerks");
                        if (flag)
                        {
                            subElement9.Text = lang.Get("PERK_ACTIVATE_UPGRADE_CARD_LVL_REQ", new object[]
                            {
                                squadLevelUnlock
                            });
                        }
                        else
                        {
                            subElement9.Text = lang.Get("PERK_ACTIVATE_POPUP_REP_REQ", new object[0]);
                        }
                    }
                    else if (flag4)
                    {
                        uXElement.Visible = false;
                    }
                    else if (flag5)
                    {
                        subElement.Visible  = true;
                        subElement2.Visible = false;
                        UXLabel subElement10 = this.activePerksGrid.GetSubElement <UXLabel>(text, "LabelReadyNowAvActCardPerks");
                        subElement10.Text = lang.Get("PERK_ACTIVE_CARD_COOLDOWN_CTA", new object[0]);
                        UXLabel subElement11 = this.activePerksGrid.GetSubElement <UXLabel>(text, "LabelCoolDownAvActCardPerks");
                        uint    num          = perkManager.GetPlayerPerkGroupCooldowns()[perkGroup];
                        this.UpdateLabelTimeRemaining(subElement11, lang, "PERK_ACTIVE_CARD_COOLDOWN_TIMER", num);
                        subElement11.Tag = num;
                        this.cooldownTimerLabels.Add(subElement11);
                        UXLabel subElement12 = this.activePerksGrid.GetSubElement <UXLabel>(text, "CostReadyNowPerksLabel");
                        subElement12.Tag = uid;
                        this.cooldownCostLabels.Add(subElement12);
                        this.UpdateGridItemCooldownSkipCost(subElement12, uid);
                        subElement8.OnClicked = new UXButtonClickedDelegate(this.OnCooldownButtonClicked);
                    }
                    else if (!flag4 && !flag5)
                    {
                        subElement.Visible  = false;
                        subElement2.Visible = false;
                        Dictionary <string, int> hQScaledCostForPlayer = GameUtils.GetHQScaledCostForPlayer(current.ActivationCost);
                        int      count            = hQScaledCostForPlayer.Count;
                        string[] costElementNames = (count == 2) ? SquadAdvancementActivateTab.dualCostElementNames : SquadAdvancementActivateTab.singleCostElementName;
                        UXUtils.SetupMultiCostElements(this.screen, costElementNames, text, current.ActivationCost, count);
                    }
                    base.SetupPerkBadge(current, text, "ActCardPerks");
                    list.Add(uXElement);
                }
            }
            list.Sort(new Comparison <UXElement>(this.SortAvailableList));
            this.perksGrid.ClearWithoutDestroy();
            int i      = 0;
            int count2 = list.Count;

            while (i < count2)
            {
                this.perksGrid.AddItem(list[i], i);
                i++;
            }
            this.perksGrid.RepositionItemsFrameDelayed(new UXDragDelegate(base.OnRepositionComplete));
            list.Clear();
            list = null;
        }
コード例 #6
0
ファイル: DemoCampaign.cs プロジェクト: Hengle/TBTKPrototype
 //reset demo, clear all saved data
 public static void ResetDemo()
 {
     DeleteLoadOut();
     PlayerPrefs.DeleteKey("TBTK_Demo");
     PerkManager.ClearPerkProgress();
 }
コード例 #7
0
    public static void SendEvent(Events e, GameObject other)
    {
        switch (e)
        {
        case Events.LIGHT_SWING:
            //AudioManager.instance.PlaySound("Light_Slash");
            Debug.Log("Light Swing");
            break;

        case Events.LIGHT_HIT:
            //AudioManager.instance.PlaySound("Stab_2");
            //AudioManager.instance.PlaySound("Impact");
            Debug.Log("Light Hit");

            // If our player hits an enemy with no weapon, he loses the BFA perk unlock
            if (player == null)
            {
                player = GameObject.Find("Player");
            }
            if (player.GetComponent <Attack>().emptyHanded)
            {
                PerkManager.axe_bfa_to_be_unlocked = false;
            }
            break;

        case Events.LIGHT_KILL:
            Debug.Log("Light Kill");
            PerkManager.axe_slugger_to_be_unlocked = false;
            PerkManager.enemiesKilled++;
            break;

        case Events.HEAVY_SWING:
            //AudioManager.instance.PlaySound("Heavy_Slash");
            Debug.Log("Heavy Swing");
            break;

        case Events.HEAVY_HIT:
            Debug.Log("Heavy Hit");
            //AudioManager.instance.PlaySound("Stab_2");
            //AudioManager.instance.PlaySound("Hit_Crack");
            PerkManager.PerformPerkEffects(Perk.PerkCategory.AXE);

            // If our player hits an enemy with no weapon, he loses the BFA perk unlock
            if (player == null)
            {
                player = GameObject.Find("Player");
            }
            if (player.GetComponent <Attack>().emptyHanded)
            {
                PerkManager.axe_bfa_to_be_unlocked = false;
            }
            break;

        case Events.HEAVY_KILL:
            Debug.Log("Heavy Kill");
            PerkManager.enemiesKilled++;
            GameObject.Find("Player").GetComponent <PlayerHealth>().executionsPerformed++;
            break;

        case Events.WEAPON_THROW:
            Debug.Log("Weapon Throw");
            if ((other != null) && (PerkManager.activeHatPerk != null) && (PerkManager.activeHatPerk.perkName == "Hat_StickyFingers"))
            {
                other.GetComponent <BoxCollider2D>().size   = new Vector2(6.0f, 1.0f);
                other.GetComponent <BoxCollider2D>().offset = new Vector2(0.75f, 0.5f);
            }
            break;

        case Events.WEAPON_THROW_KILL:
            Debug.Log("Weapon Throw Kill");
            PerkManager.axe_slugger_to_be_unlocked = false;
            break;

        case Events.GUN_FIRE_KILL:
            Debug.Log("Gun Fire Kill");
            PerkManager.axe_slugger_to_be_unlocked = false;
            break;

        case Events.ENEMY_GRAB:
            Debug.Log("Enemy Grab");
            break;

        case Events.ENEMY_THROW:
            Debug.Log("Enemy Throw");
            break;

        case Events.ITEM_PICKUP:
            Debug.Log("Item Pickup");
            if (other != null && other.GetComponent <Item>() != null && other.GetComponent <Item>().type == Item.Type.HEALTH)
            {
                // If we pickup a health pickup then it cancels out the ability to get the mary todd's lockette perk
                PerkManager.trinket_maryToddsLockette_to_be_unlocked = false;
            }
            break;

        case Events.WEAPON_PICKUP:
            Debug.Log("Weapon Pickup");
            //If the player picks up a certain amount of weapons then the Sticky Fingers perk will be unlocked
            amountOfWeaponPickUp++;
            if (amountOfWeaponPickUp == goalToUnlockSFPerk)
            {
                PerkManager.UpdatePerkStatus(PerkManager.hat_stickyFingers_name, 1);
                Debug.Log("Sticky Fingers perk is unlocked");
            }

            // If the player picks up any weapons other than the axe, cancel out the BFA perk unlock
            // The axe is considered a perk, so will not trigger a WEAPON_PICKUP event
            PerkManager.axe_bfa_to_be_unlocked = false;
            break;

        case Events.PERK_PICKUP:
            Debug.Log("Perk Pickup");

            if (other != null && other.GetComponent <Perk>() != null)
            {
                // Activate the perk
                // If the perk is not one that needs to be activated,
                //     then this will have no effect
                other.GetComponent <Perk>().Activate();
            }
            break;

        case Events.LEVEL_WIN:
            Debug.Log("Level Win");
            Perk.trinketTimeStamp          = Time.time;
            Perk.performMaryToddsTimeStamp = Time.time;
            if (other != null && other.GetComponent <Boss>() != null && other.GetComponent <Boss>().bossName == "Officer-Boss")
            {
                GameObject.Find("UI").GetComponent <UIManager>().cutsceneManager.ChangeCutscene(CutsceneManager.Cutscenes.MID);
            }
            else if (other != null && other.GetComponent <Boss>() != null && other.GetComponent <Boss>().bossName == "Bear")
            {
                GameObject.Find("UI").GetComponent <UIManager>().cutsceneManager.ChangeCutscene(CutsceneManager.Cutscenes.BEAR);
            }
            break;

        case Events.LEVEL_NEXT:
            GameObject.Find("GameManager").GetComponent <LevelManager>().currentScene++;
            break;

        case Events.GAME_WIN:
            Debug.Log("Game Win");
            PerkManager.UpdatePerkStatus(PerkManager.axe_dtVampirism_name, 1);
            GameObject.Find("GameManager").GetComponent <GameManager>().Win();
            GameObject.Find("UI").GetComponent <UIManager>().cutsceneManager.ChangeCutscene(CutsceneManager.Cutscenes.END);
            break;

        case Events.GAME_LOSE:
            Debug.Log("Game Lose");
            Perk.trinketTimeStamp          = Time.time;
            Perk.performMaryToddsTimeStamp = Time.time;
            if (player == null)
            {
                player = GameObject.Find("Player");
            }
            player.GetComponent <PlayerMotor>().enabled    = false;
            player.GetComponent <PlayerControls>().enabled = false;
            GameObject.Find("UI").GetComponent <UIManager>().ActivateLoseUI();
            break;

        case Events.JUMP:
            Debug.Log("Jump");
            //AudioManager.instance.PlaySound("Jump");
            break;

        case Events.LAND:
            //AudioManager.instance.PlaySound("Land");
            Debug.Log("Land");
            break;

        case Events.BEAR_HIT:
            Debug.Log("BEAR HIT");
            // When we hit the bear, check to see if we have an Attack component (other == Player G.O.)
            if (other != null && other.GetComponent <Attack>() != null)
            {
                // Every time we hit the bear, see if we're hitting him empty-handed
                if (!other.GetComponent <Attack>().emptyHanded)
                {
                    // If we hit him with a weapon, cancel out the ability to earn the perk
                    PerkManager.hat_bearHands_to_be_unlocked = false;
                }
            }
            break;

        case Events.BEAR_HIT_THROWN:
            PerkManager.hat_bearHands_to_be_unlocked = false;
            break;

        case Events.ROBERT_E_LEE_KILL:
            Debug.Log("Killed Robert E. Lee");
            if (GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerHealth>().health >= 80)
            {
                PerkManager.UpdatePerkStatus(PerkManager.trinket_agressionBuddy_name, 1);
            }
            break;

        case Events.STEP:
            //AudioManager.instance.PlayFootstep();
            break;

        case Events.ENEMY_CLOSE_TO_STEAL_WEAPON:
            if ((other != null) && (PerkManager.activeHatPerk != null) && (PerkManager.activeHatPerk.perkName == "Hat_StickyFingers"))
            {
                Debug.Log("Enemy is enough to steal weapon");
                BoxCollider2D gunBoxCollider = other.transform.FindContainsInChildren("Musket").GetComponent <BoxCollider2D>();

                if (gunBoxCollider != null)
                {
                    gunBoxCollider.size   = new Vector2(25.0f, 20.0f);
                    gunBoxCollider.offset = new Vector2(3.5f, 2.0f);
                }
            }
            break;

        case Events.BUTTON_CLICK:
            Debug.Log("clicked a menu button");
            MenuSoundPlayer.PlayMenuSound();
            break;
        }
    }
コード例 #8
0
    void Update()
    {
        if (!UIManager.updateActive || CutsceneManager.cutsceneActive)
        {
            return;
        }

        InputManager.Action mobileAction = InputManager.GetAction();

        if (_grab.state == Grabber.State.Hold)
        {
            if (mobileAction == InputManager.Action.LightAttack || mobileAction == InputManager.Action.PickupOrGrab)
            {
                _grab.Punch();
            }
            else if (mobileAction == InputManager.Action.HeavyAttack)
            {
                _grab.Throw();
            }
            else if (mobileAction == InputManager.Action.Throw)
            {
                _grab.Throw();
            }
            return;
        }
        if (_grab.state != Grabber.State.Null)
        {
            return;
        }

        if (mobileAction == InputManager.Action.LightAttack)
        {
            _attack.LightAttack();
            justClicked = true;
        }

        if (mobileAction == InputManager.Action.HeavyAttack)
        {
            _attack.HeavyAttack();
        }

        if (mobileAction == InputManager.Action.PickupOrGrab)
        {
            if (_motor.isOnItem)
            {
                justClicked  = true;
                heldComplete = true;
            }
            else
            {
                _grab.StartGrab();
            }
        }

        if (mobileAction == InputManager.Action.Grab)
        {
            _grab.StartGrab();
        }

        if (mobileAction == InputManager.Action.Jump)
        {
            _jump.StartJump();
        }

        if (mobileAction == InputManager.Action.Throw)
        {
            _throw.StartThrow();
        }

        if (Input.GetKeyDown(KeyCode.R))
        {
            PerkManager.PerformPerkEffects(Perk.PerkCategory.TRINKET);
        }
    }
コード例 #9
0
        public override void RefreshPerkStates()
        {
            Lang lang = Service.Get <Lang>();

            this.perkBadgeMap.Clear();
            List <UXElement>   list               = new List <UXElement>();
            PerkManager        perkManager        = Service.Get <PerkManager>();
            PerkViewController perkViewController = Service.Get <PerkViewController>();
            IDataController    dataController     = Service.Get <IDataController>();
            Squad squad = Service.Get <CurrentPlayer>().Squad;

            if (squad == null)
            {
                return;
            }
            Dictionary <string, string> available  = squad.Perks.Available;
            Dictionary <string, int>    inProgress = squad.Perks.InProgress;

            foreach (PerkVO current in dataController.GetAll <PerkVO>())
            {
                string uid   = current.Uid;
                bool   flag  = perkManager.IsPerkMaxTier(current) && available.ContainsValue(uid);
                bool   flag2 = perkManager.IsPerkLevelLocked(current, squad.Level);
                if (perkManager.HasPrerequistesUnlocked(current, available) && (flag || !available.ContainsValue(uid)))
                {
                    string    perkGroup = current.PerkGroup;
                    string    text      = "PerkItem_" + perkGroup;
                    UXElement uXElement = base.FetchPerkGridItem(this.perkGrid, text);
                    uXElement.Tag = current;
                    UXElement subElement  = this.perkGrid.GetSubElement <UXElement>(text, "LockedGroupUpCardPerks");
                    UXElement subElement2 = this.perkGrid.GetSubElement <UXElement>(text, "MaxLvlGroupUpCardPerks");
                    UXButton  subElement3 = this.perkGrid.GetSubElement <UXButton>(text, "BtnUpCardPerks");
                    subElement3.Tag       = current;
                    subElement3.OnClicked = new UXButtonClickedDelegate(this.OnPerkClicked);
                    int     reputationCost       = current.ReputationCost;
                    int     squadLevelUnlock     = current.SquadLevelUnlock;
                    int     perkInvestedProgress = perkManager.GetPerkInvestedProgress(current, inProgress);
                    string  text2       = reputationCost.ToString();
                    UXLabel subElement4 = this.perkGrid.GetSubElement <UXLabel>(text, "LabelPerkTitleUpCardPerks");
                    subElement4.Text = perkViewController.GetPerkNameForGroup(current.PerkGroup);
                    UXLabel subElement5 = this.perkGrid.GetSubElement <UXLabel>(text, "LabelCostUpPerk");
                    subElement5.Text = text2;
                    UXSprite subElement6 = this.perkGrid.GetSubElement <UXSprite>(text, "CostUpPerkReputationIcon");
                    string   text3       = perkInvestedProgress.ToString();
                    UXLabel  subElement7 = this.perkGrid.GetSubElement <UXLabel>(text, "LabelpBarUpInvestAmtPerks");
                    subElement7.Text = text3 + "/" + text2;
                    UXSlider subElement8 = this.perkGrid.GetSubElement <UXSlider>(text, "pBarUpInvestAmtPerks");
                    subElement8.Value = (float)perkInvestedProgress / (float)reputationCost;
                    UXLabel subElement9 = this.perkGrid.GetSubElement <UXLabel>(text, "LabelPerkLvlUpCardPerks");
                    string  text4       = string.Empty;
                    if (current.PerkTier > 1)
                    {
                        text4 = StringUtils.GetRomanNumeral(current.PerkTier - 1);
                    }
                    else
                    {
                        text4 = lang.Get("PERK_UPGRADE_CARD_UNLOCK_TIER", new object[0]);
                    }
                    subElement9.Text = text4;
                    UXTexture subElement10 = this.perkGrid.GetSubElement <UXTexture>(text, "TexturePerkArtUpCardPerks");
                    perkViewController.SetPerkImage(subElement10, current);
                    bool visible = !flag2 && !flag;
                    subElement8.Visible = visible;
                    subElement7.Visible = visible;
                    subElement5.Visible = visible;
                    subElement6.Visible = visible;
                    subElement9.Visible = visible;
                    subElement2.Visible = flag;
                    subElement.Visible  = (flag2 && !flag);
                    if (flag2)
                    {
                        UXLabel subElement11 = this.perkGrid.GetSubElement <UXLabel>(text, "LabelSquadLvlLockedUpCardPerks");
                        subElement11.Text = current.SquadLevelUnlock.ToString();
                        UXLabel subElement12 = this.perkGrid.GetSubElement <UXLabel>(text, "LabelSquadLvlLockedUpCardPerks");
                        subElement12.Text = lang.Get("PERK_ACTIVATE_UPGRADE_CARD_LVL_REQ", new object[]
                        {
                            squadLevelUnlock
                        });
                    }
                    else if (flag)
                    {
                        UXLabel subElement13 = this.perkGrid.GetSubElement <UXLabel>(text, "LabelMaxLvlUpCardPerks");
                        subElement13.Text = lang.Get("PERK_UPGRADE_MAX_TIER", new object[0]);
                    }
                    base.SetupPerkBadge(current, text, "UpCardPerks");
                    list.Add(uXElement);
                }
            }
            list.Sort(new Comparison <UXElement>(this.SortUpgradeList));
            UXUtils.SortListForTwoRowGrids(list, this.perkGrid);
            int count = list.Count;

            this.perkGrid.ClearWithoutDestroy();
            for (int i = 0; i < count; i++)
            {
                this.perkGrid.AddItem(list[i], i);
            }
            this.perkGrid.RepositionItemsFrameDelayed(new UXDragDelegate(base.OnRepositionComplete));
            base.RefreshPerkStates();
        }
コード例 #10
0
        protected override void InitUI()
        {
            base.InitUI();
            Lang lang = Service.Lang;
            PerkViewController perkViewController = Service.PerkViewController;
            PerkManager        perkManager        = Service.PerkManager;
            Squad currentSquad = Service.SquadController.StateManager.GetCurrentSquad();

            if (currentSquad == null)
            {
                return;
            }
            Dictionary <string, string> available = currentSquad.Perks.Available;
            int      level            = currentSquad.Level;
            int      squadLevelUnlock = this.targetPerkVO.SquadLevelUnlock;
            UXButton element          = this.squadScreen.GetElement <UXButton>("BtnContinuePerkUpgradeCeleb");

            element.Visible = false;
            UXLabel element2 = this.squadScreen.GetElement <UXLabel>("LabelModalTitlePerks");

            element2.Text = lang.Get("PERK_ACTIVATE_POPUP_TITLE", new object[]
            {
                perkViewController.GetPerkNameForGroup(this.targetPerkVO.PerkGroup),
                this.targetPerkVO.PerkTier
            });
            UXLabel element3 = this.squadScreen.GetElement <UXLabel>("LabelModalStoryPerks");

            element3.Text = perkViewController.GetPerkDescForGroup(this.targetPerkVO.PerkGroup);
            perkViewController.SetupStatGridForPerk(this.targetPerkVO, this.statGrid, "TemplateModalStatsPerks", "LabelModalStatsInfoPerks", "LabelModalStatsValuePerks", false);
            UXTexture element4 = this.squadScreen.GetElement <UXTexture>("TexturePerkArtModalCardPerks");

            perkViewController.SetPerkImage(element4, this.targetPerkVO);
            this.activationTimerLabel = this.squadScreen.GetElement <UXLabel>("LabelTickerModalPerks");
            UXButton element5 = this.squadScreen.GetElement <UXButton>("BtnModalOneCurrencyPerks");
            UXButton element6 = this.squadScreen.GetElement <UXButton>("BtnModalTwoCurrencyPerks");

            this.activationTimerLabel.Visible = false;
            element5.Visible = false;
            element6.Visible = false;
            bool flag = !available.ContainsKey(this.targetPerkVO.PerkGroup);

            if (flag)
            {
                bool flag2 = perkManager.IsPerkLevelLocked(this.targetPerkVO, level);
                if (flag2)
                {
                    UXLabel element7 = this.squadScreen.GetElement <UXLabel>("LabelPrimaryLvlLockedModalPerks");
                    UXLabel element8 = this.squadScreen.GetElement <UXLabel>("LabelSquadLvlLockedModalPerks");
                    UXLabel element9 = this.squadScreen.GetElement <UXLabel>("LabelSecondaryLvlLockedModalPerks");
                    element7.Text = lang.Get("PERK_UPGRADE_POPUP_LVL_REQ", new object[0]);
                    element8.Text = squadLevelUnlock.ToString();
                    element9.Text = lang.Get("PERK_UPGRADE_POPUP_LVL_REQ2", new object[0]);
                    this.levelLockedGroup.Visible = true;
                }
                else
                {
                    UXLabel element10 = this.squadScreen.GetElement <UXLabel>("LabelPrimaryRepLockedModalPerks");
                    this.repLockedGroup.Visible = true;
                    element10.Text = lang.Get("PERK_ACTIVATE_POPUP_REP_REQ", new object[0]);
                }
            }
            if (this.isActivation && !flag)
            {
                Dictionary <string, int> hQScaledCostForPlayer = GameUtils.GetHQScaledCostForPlayer(this.targetPerkVO.ActivationCost);
                int  count = hQScaledCostForPlayer.Count;
                bool flag3 = count == 2;
                element5.Visible = !flag3;
                element6.Visible = flag3;
                UXButton uXButton = (!flag3) ? element5 : element6;
                uXButton.OnClicked        = new UXButtonClickedDelegate(this.OnActivateButtonClicked);
                this.rootInfoView.Visible = true;
                string[] costElementNames = (!flag3) ? SquadScreenActivationInfoView.singleCostElementNames : SquadScreenActivationInfoView.dualCostElementNames;
                UXUtils.SetupMultiCostElements(this.squadScreen, costElementNames, null, this.targetPerkVO.ActivationCost, count);
                this.rootInfoView.Visible = false;
            }
            if (perkManager.IsPerkActive(this.targetPerkVO.Uid))
            {
                this.activatedPerkData = Service.PerkManager.GetPlayerPerk(this.targetPerkVO.Uid);
                if (this.activatedPerkData != null)
                {
                    this.activationTimerLabel.Visible = true;
                    this.UpdateActivationTimeRemaining();
                    Service.ViewTimeEngine.RegisterClockTimeObserver(this, 1f);
                }
            }
        }