public void ClickChest(int chestPosition) { DungeonStarData dungeonStarData = DungeonStarData.GetDungeonStarData(_currentSelectDungeonType, _currentSelectChapterData.Id, chestPosition); LuaTable chapterControllerLuaTable = (LuaTable)LuaScriptMgr.Instance.CallLuaFunction("gamemanager.GetCtrl", "chapter_controller")[0]; chapterControllerLuaTable.GetLuaFunction("OpenDungeonStarBoxDetailView").Call(dungeonStarData.id); }
private void RefreshStarChests() { int playerGainChapterStarCount = DungeonProxy.instance.GetPlayerGainStarCountOfChapterOfDungeonType(_currentSelectDungeonType, _currentSelectChapterData.Id); int chapterTotalStarCount = DungeonProxy.instance.GetTotalStarCountOfChapterOfDungeonType(_currentSelectDungeonType, _currentSelectChapterData.Id); chapterStarCountText.text = string.Format(Localization.Get("common.value/max"), playerGainChapterStarCount, chapterTotalStarCount); DungeonStarData chest1DungeonStarData = DungeonStarData.GetDungeonStarData(_currentSelectDungeonType, _currentSelectChapterData.Id, 1); DungeonStarData chest2DungeonStarData = DungeonStarData.GetDungeonStarData(_currentSelectDungeonType, _currentSelectChapterData.Id, 2); DungeonStarData chest3DungeonStarData = DungeonStarData.GetDungeonStarData(_currentSelectDungeonType, _currentSelectChapterData.Id, 3); chest1GameObject.SetActive(chest1DungeonStarData != null); chest2GameObject.SetActive(chest2DungeonStarData != null); chest3GameObject.SetActive(chest3DungeonStarData != null); chest1CanDrawFXGameObject.SetActive(false); chest2CanDrawFXGameObject.SetActive(false); chest3CanDrawFXGameObject.SetActive(false); LuaTable chapterModelLuaTable = (LuaTable)LuaScriptMgr.Instance.CallLuaFunction("gamemanager.GetModel", "chapter_model")[0]; if (chest1DungeonStarData != null) { chest1NameText.text = chest1DungeonStarData.starNumber.ToString(); bool hasReceived = chapterModelLuaTable.GetLuaFunction("DungeonStarBoxHasReceived").Call(chest1DungeonStarData.id)[0].ToString().ToBoolean(); if (hasReceived) { chest1Image.sprite = ResMgr.instance.LoadSprite("sprite/main_ui/jdtbox2_2"); } else { chest1Image.sprite = ResMgr.instance.LoadSprite("sprite/main_ui/jdtbox2_1"); } chest1Image.SetNativeSize(); chest1CanDrawFXGameObject.SetActive(playerGainChapterStarCount >= chest1DungeonStarData.starNumber && !hasReceived); } if (chest2DungeonStarData != null) { chest2NameText.text = chest2DungeonStarData.starNumber.ToString(); bool hasReceived = chapterModelLuaTable.GetLuaFunction("DungeonStarBoxHasReceived").Call(chest2DungeonStarData.id)[0].ToString().ToBoolean(); if (hasReceived) { chest2Image.sprite = ResMgr.instance.LoadSprite("sprite/main_ui/jdtbox3_2"); } else { chest2Image.sprite = ResMgr.instance.LoadSprite("sprite/main_ui/jdtbox3_1"); } chest2Image.SetNativeSize(); chest2CanDrawFXGameObject.SetActive(playerGainChapterStarCount >= chest2DungeonStarData.starNumber && !hasReceived); } if (chest3DungeonStarData != null) { chest3NameText.text = chest3DungeonStarData.starNumber.ToString(); bool hasReceived = chapterModelLuaTable.GetLuaFunction("DungeonStarBoxHasReceived").Call(chest3DungeonStarData.id)[0].ToString().ToBoolean(); if (hasReceived) { chest3Image.sprite = ResMgr.instance.LoadSprite("sprite/main_ui/jdtbox4_2"); } else { chest3Image.sprite = ResMgr.instance.LoadSprite("sprite/main_ui/jdtbox4_1"); } chest3Image.SetNativeSize(); chest3CanDrawFXGameObject.SetActive(playerGainChapterStarCount >= chest3DungeonStarData.starNumber && !hasReceived); } RefreshChapterStarCollectSlider(); }