コード例 #1
0
    public void initBuildingLinkCard(string id)
    {
        BuildingId = id;
        BasicSubMenuPanel P = null;

        for (int i = 0; i < MCP.homeScene.AllSubMenus.Length; i++)
        {
            if (MCP.homeScene.AllSubMenus[i] == null)
            {
                continue;
            }
            P = MCP.homeScene.AllSubMenus[i].GetComponent <BasicSubMenuPanel>();
            if (P.buildingId == BuildingId)
            {
                IndexInHS = i;
                thisTag   = (HomeScene.HomeSceneSubMenu)i;
                //buildingImg
                //NPCImg
                NameText.text = thisTag.ToString() + "·" + SDGameManager.T("Lv.")
                                + P.Level;
                break;
            }
        }
        if (P == null)
        {
            return;
        }
        bool flag = P.CheckIfCanLvUp();

        lvUpBtn.interactable = flag;
    }
コード例 #2
0
ファイル: HomeScene.cs プロジェクト: tuita520/RL_CardGame
    public void lvUpBtnTapped()
    {
        BasicSubMenuPanel P = AllSubMenus[(int)CurrentSubMenuType].GetComponent <BasicSubMenuPanel>();

        if (P.CheckIfCanLvUp())
        {
            P.BtnToLvUp();
        }
    }
コード例 #3
0
ファイル: HomeScene.cs プロジェクト: tuita520/RL_CardGame
    public void resetOneSubMenu(HomeSceneSubMenu type)
    {
        BasicSubMenuPanel panel = AllSubMenus[(int)type].GetComponent <BasicSubMenuPanel>();

        if (panel.thisMenuOpened)
        {
            panel.commonBackAction();
        }
    }
コード例 #4
0
    public void ExtraBtnTapped()
    {
        BasicSubMenuPanel P = MCP.homeScene.AllSubMenus[(int)thisTag]
                              .GetComponent <BasicSubMenuPanel>();
        bool flag = P.CheckIfCanLvUp();

        if (flag)
        {
            P.BtnToLvUp();
        }
    }
コード例 #5
0
ファイル: HomeScene.cs プロジェクト: tuita520/RL_CardGame
    public void checkLvUpBtn()
    {
        BasicSubMenuPanel P = AllSubMenus[(int)CurrentSubMenuType].GetComponent <BasicSubMenuPanel>();

        if (P.CheckIfCanLvUp())
        {
            int lv = P.Level;
            SubMenuLvUpBtn.GetComponentInChildren <Text>().text
                = "升级 </n> 当前等级" + lv;
            SubMenuLvUpBtn.gameObject.SetActive(true);
        }
        else
        {
            SubMenuLvUpBtn.gameObject.SetActive(false);
        }
    }
コード例 #6
0
ファイル: HomeScene.cs プロジェクト: tuita520/RL_CardGame
 private void Awake()
 {
     //建筑Id设置
     for (int i = 0; i < AllSubMenus.Length; i++)
     {
         if (AllSubMenus[i] == null)
         {
             continue;
         }
         BasicSubMenuPanel panel = AllSubMenus[i].GetComponent <BasicSubMenuPanel>();
         if (panel)
         {
             panel.buildingId = "BUILD#" + (i + 1);
         }
     }
 }
コード例 #7
0
ファイル: HomeScene.cs プロジェクト: tuita520/RL_CardGame
    public void WhenChangingSubMenu
        (HomeSceneSubMenu oldOne, HomeSceneSubMenu newOne)
    {
        if (oldOne != HomeSceneSubMenu.End && newOne == HomeSceneSubMenu.End)
        {
            //返回城镇大街页面
            changeToHomeScene();
        }
        else if (newOne != HomeSceneSubMenu.End)
        {
            //进入功能建筑页面
            BasicSubMenuPanel P = AllSubMenus[(int)newOne].GetComponent <BasicSubMenuPanel>();
            changeToSubMenuScene(P.AboveOuterMenuIsShowing);
        }

        if (oldOne != HomeSceneSubMenu.End)
        {
            AllSubMenus[(int)oldOne].GetComponent <BasicSubMenuPanel>()._canvas.sortingOrder = -1;
        }
        if (newOne != HomeSceneSubMenu.End)
        {
            AllSubMenus[(int)newOne].GetComponent <BasicSubMenuPanel>()._canvas.sortingOrder = 0;
        }

        if (oldOne == HomeSceneSubMenu.BattleTeam && newOne != oldOne)
        {
            _BattleTeamPanel.GetComponent <BattleTeamPanel>()
            .changeSpriterenderersStatus(true);
        }
        else if (newOne == HomeSceneSubMenu.BattleTeam && newOne != oldOne)
        {
            _BattleTeamPanel.GetComponent <BattleTeamPanel>()
            .changeSpriterenderersStatus(false);
        }

        //
        RefreshDataInOuterMenu();
    }
コード例 #8
0
 public void refreshAllBuildingsInfor()
 {
     AllBuildings.Clear();
     for (int i = 0; i < homeScene.AllSubMenus.Length; i++)
     {
         if (homeScene.AllSubMenus[i] == null)
         {
             continue;
         }
         if (homeScene.AllSubMenus[i].GetComponent <BasicSubMenuPanel>() &&
             homeScene.AllSubMenus[i].GetComponent <BasicSubMenuPanel>().LvUpEnable)
         {
             AllBuildings.Add(homeScene.AllSubMenus[i].GetComponent <BasicSubMenuPanel>());
         }
     }
     LvUpEnableBuildingCount = AllBuildings.Count;
     //建筑升级存档数量修正
     if (SDDataManager.Instance.PlayerData.buildingsOwned.Count < AllBuildings.Count)
     {
         for (int i = 0; i < AllBuildings.Count; i++)
         {
             BasicSubMenuPanel Menu = AllBuildings[i];
             bool flag = true;
             foreach (GDEtownBuildingData B in SDDataManager.Instance.PlayerData.buildingsOwned)
             {
                 if (B.id == Menu.buildingId)
                 {
                     flag = false; break;
                 }
             }
             if (flag)
             {
                 SDDataManager.Instance.PlayerData.buildingsOwned.Add
                     (new GDEtownBuildingData(GDEItemKeys.townBuilding_newTownBuilding)
                 {
                     id    = Menu.buildingId,
                     level = 0,
                     NPC   = null,
                 });
                 SDDataManager.Instance.PlayerData.Set_buildingsOwned();
             }
         }
     }
     for (int i = 0; i < AllBuildings.Count; i++)
     {
         foreach (GDEtownBuildingData b in SDDataManager.Instance.PlayerData.buildingsOwned)
         {
             if (b.id == AllBuildings[i].buildingId)
             {
                 AllBuildings[i].Level = b.level;
                 if (AllBuildings[i].ShowNPC && AllBuildings[i].RepresentNPC != null)
                 {
                     if (b.NPC == null)
                     {
                         b.NPC = new GDENPCData(GDEItemKeys.NPC_noone)
                         {
                             id = AllBuildings[i].RepresentNPC.TalkerID,
                         };
                         SDDataManager.Instance.PlayerData.Set_buildingsOwned();
                     }
                     else if (b.NPC.id != AllBuildings[i].RepresentNPC.TalkerID)
                     {
                         b.NPC.id = AllBuildings[i].RepresentNPC.TalkerID;
                         SDDataManager.Instance.PlayerData.Set_buildingsOwned();
                     }
                 }
                 else
                 {
                     if (b.NPC != null)
                     {
                         b.NPC = null;
                         SDDataManager.Instance.PlayerData.Set_buildingsOwned();
                     }
                 }
                 break;
             }
         }
     }
 }