void InitSweepAwardInfo(Tab_StoryCopyScene tBook, int nCount) { if (tBook == null) { return; } int nSweepAwardID = tBook.SweepReward; Tab_StoryCopySceneAward tSweepAward = TableManager.GetStoryCopySceneAwardByID(nSweepAwardID, 0); if (tSweepAward == null) { return; } // 金币 UpdateSweepAwardCoin(tSweepAward, nCount); // 经验 UpdateSweepAwardExp(); // 宠物经验 UpdateSweepAwardFellowExp(); // 经验数字 UpdateSweepAwardExp_Num(tSweepAward, nCount); // 宠物经验数字 UpdateSweepAwardFellowExp_Num(tSweepAward, nCount); }
//private int m_nCopySceneByID; public void Init(int nChapterIdx, int nCopySceneByID) //public void Init(string strName,string strTexture,bool bGetStar1,bool bGetStar2,bool bGetStar3,int nChapterIdx,bool bLocked,int nAwardItem,int nTuijianZhanli,int nExp) { var storyCopySceneLevelTable = TableManager.GetStoryCopySceneByID(nCopySceneByID, 0); if (storyCopySceneLevelTable == null) { return; } Tab_StoryCopySceneAward tabAward = TableManager.GetStoryCopySceneAwardByID(storyCopySceneLevelTable.PassReward, 0); if (tabAward == null) { return; } // int nStarCount = GameManager.gameManager.PlayerDataPool.JuQingCopySceneData.GetLevelByLevelID(nCopySceneByID).GetStarCount(); // int nDayCount = GameManager.gameManager.PlayerDataPool.JuQingCopySceneData.GetLevelByLevelID(nCopySceneByID).m_nDayCount; bool bLocked = GameManager.gameManager.PlayerDataPool.JuQingCopySceneData.IsStoryCopySceneLocked(nCopySceneByID); bool bGetStar1 = GameManager.gameManager.PlayerDataPool.JuQingCopySceneData.GetLevelByLevelID(nCopySceneByID).IsGetStar1(); bool bGetStar2 = GameManager.gameManager.PlayerDataPool.JuQingCopySceneData.GetLevelByLevelID(nCopySceneByID).IsGetStar2(); bool bGetStar3 = GameManager.gameManager.PlayerDataPool.JuQingCopySceneData.GetLevelByLevelID(nCopySceneByID).IsGetStar3(); LevelNameLevel.text = storyCopySceneLevelTable.LevelName; m_TuijianZhanli.text = storyCopySceneLevelTable.CombatValue.ToString(); m_Exp.text = tabAward.Exp.ToString(); SetTexture(storyCopySceneLevelTable.LevelTexture); SetStar(bGetStar1, bGetStar2, bGetStar3); SetLock(nChapterIdx, bLocked); SetItem(tabAward.GetItemIDbyIndex(0)); if (bLocked) { SetTextureGray(ref LevelTexture); Start1Obj.SetActive(false); Start2Obj.SetActive(false); Start3Obj.SetActive(false); ZhanliObj.SetActive(false); ExpObj.SetActive(false); //ItemObj.SetActive(false); } else { SetTextureHigh(ref LevelTexture); Start1Obj.SetActive(true); Start2Obj.SetActive(true); Start3Obj.SetActive(true); ZhanliObj.SetActive(true); ExpObj.SetActive(true); //ItemObj.SetActive(true); } }
public void UpdatePassAward(Tab_StoryCopyScene tBook) { if (m_PassAwardItem == null) { return; } int nPassAwardID = tBook.PassReward; Tab_StoryCopySceneAward tPassAward = TableManager.GetStoryCopySceneAwardByID(nPassAwardID, 0); if (tPassAward != null) { int mRewardIndex = 0; if (tPassAward.Coin > 0) { SetPassRewardItem(mRewardIndex, StoryCopyAwardItemType.ITEM_MONEY, -1, tPassAward.Coin); mRewardIndex++; } if (tPassAward.Exp > 0) { SetPassRewardItem(mRewardIndex, StoryCopyAwardItemType.ITEM_EXP, -1, tPassAward.Exp); mRewardIndex++; } if (tPassAward.BindYuanBao > 0) { SetPassRewardItem(mRewardIndex, StoryCopyAwardItemType.ITEM_BDYUANBAO, -1, tPassAward.BindYuanBao); mRewardIndex++; } if (tPassAward.FellowExp > 0) { SetPassRewardItem(mRewardIndex, StoryCopyAwardItemType.ITEM_FELLOWEXP, -1, tPassAward.FellowExp); mRewardIndex++; } for (int k = 0; k < 4; k++) { if (tPassAward.GetItemIDbyIndex(k) > 0) { SetPassRewardItem(mRewardIndex, StoryCopyAwardItemType.ITEM_ITEM, tPassAward.GetItemIDbyIndex(k), tPassAward.getItemIDCount()); mRewardIndex++; } } for (int i = mRewardIndex; i < m_PassAwardItem.Length; i++) { m_PassAwardItem[i].gameObject.SetActive(false); } } }
void UpdateSweepAwardFellowExp_Num(Tab_StoryCopySceneAward tSweepAward, int nCount) { if (tSweepAward == null) { return; } int nAwardFellowExp = tSweepAward.FellowExp; int FellowExpFromNum = 0; int FellowExpToNum = nAwardFellowExp * nCount; m_FellowExp.text = "0"; m_FellowExpTweenNumLable = TweenNumber.Begin(m_FellowExp.gameObject, 2, FellowExpFromNum, FellowExpToNum); m_FellowExpTweenNumLable.onUpdatingNum = RefreshFellowExpLabelText; }
void UpdateSweepAwardCoin(Tab_StoryCopySceneAward tSweepAward, int nCount) { if (tSweepAward == null) { return; } int nAwardCoin = tSweepAward.Coin; int CoinFromNum = 0; int CoinToNum = nAwardCoin * nCount; m_Coin.text = "0"; m_TweenNumLable = TweenNumber.Begin(m_Coin.gameObject, 2, CoinFromNum, CoinToNum); m_TweenNumLable.onUpdatingNum = RefreshCoinLabelText; }
public void UpdateStarAward(Tab_StoryCopyScene tBook) { for (int nIndex = 0; nIndex < tBook.getStarRewardCount(); ++nIndex) { int nAwardID = tBook.GetStarRewardbyIndex(nIndex); Tab_StoryCopySceneAward tStarAward = TableManager.GetStoryCopySceneAwardByID(nAwardID, 0); if (tStarAward != null) { int nItemID = tStarAward.GetItemIDbyIndex(0); if (nItemID > 0) { m_BonusItem[nIndex].SetShowItem(nItemID, 1, true, true); } } } }
void UpdateChestRewards(Tab_StoryCopySceneAward award) { int mRewardIndex = 0; if (award.Coin > 0) { SetRewardItem(mRewardIndex, ItemType.ITEM_MONEY, -1, award.Coin); mRewardIndex++; } if (award.Exp > 0) { SetRewardItem(mRewardIndex, ItemType.ITEM_EXP, -1, award.Exp); mRewardIndex++; } if (award.BindYuanBao > 0) { SetRewardItem(mRewardIndex, ItemType.ITEM_BDYUANBAO, -1, award.BindYuanBao); mRewardIndex++; } if (award.FellowExp > 0) { SetRewardItem(mRewardIndex, ItemType.ITEM_FELLOWEXP, -1, award.FellowExp); mRewardIndex++; } // if (award.AwardReputation > 0) // { // SetRewardItem(mRewardIndex, ItemType.ITEM_REPUTATION, -1, award.AwardReputation); // mRewardIndex++; // } for (int k = 0; k < 4; k++) { if (award.GetItemIDbyIndex(k) > 0) { SetRewardItem(mRewardIndex, ItemType.ITEM_ITEM, award.GetItemIDbyIndex(k), award.getItemIDCount()); mRewardIndex++; } } for (int i = mRewardIndex; i < rewards.Length; i++) { rewards[i].gameObject.SetActive(false); } rewardGrid.repositionNow = true; }
void InitStarAward(Tab_StoryCopyScene tBook, bool bWin) { bool[] bPreStarGot = new bool[3]; StoryCopySceneLevelInfo levelInfo = GameManager.gameManager.PlayerDataPool.JuQingCopySceneData.GetLevelByLevelID(tBook.Id); bPreStarGot[0] = levelInfo.IsPreGetStar1(); bPreStarGot[1] = levelInfo.IsPreGetStar2(); bPreStarGot[2] = levelInfo.IsPreGetStar3(); int nAwardCount = 0; if (!bWin) { return; } for (int nIndex = 0; nIndex < tBook.getStarRewardCount(); ++nIndex) { int nAward = tBook.GetStarRewardbyIndex(nIndex); Tab_StoryCopySceneAward tSCS = TableManager.GetStoryCopySceneAwardByID(nAward, 0); if (tSCS != null) { for (int nAwardIndex = 0; nAwardIndex < tSCS.getItemIDCount() && nAwardIndex < tSCS.getItemNumCount(); ++nAwardIndex) { int nID = tSCS.GetItemIDbyIndex(nAwardIndex); int nNum = tSCS.GetItemNumbyIndex(nAwardIndex); if (nID > 0 && nNum > 0) { if (nAwardCount >= 0 && nAwardCount < m_BonusItem.Length && nIndex < m_StarGot.Length && m_StarGot[nIndex]) { m_BonusItem[nIndex].gameObject.SetActive(true); m_BonusItem[nIndex].SetShowItem(nID, nNum, m_StarGot[nIndex], bPreStarGot[nIndex]); nAwardCount++; break; } } } } } }
Tab_StoryCopySceneAward GetChapterAwardTab() { Tab_StoryCopySceneChapter tabChapter = TableManager.GetStoryCopySceneChapterByID(m_ChapterId, 0); if (tabChapter == null) { return(null); } int nAwardId = GlobeVar.INVALID_ID; if (m_AwardIndex < 0 || m_AwardIndex >= tabChapter.getAwardCount()) { return(null); } nAwardId = tabChapter.GetAwardbyIndex(m_AwardIndex); Tab_StoryCopySceneAward tabAward = TableManager.GetStoryCopySceneAwardByID(nAwardId, 0); return(tabAward); }
void OpenChest() { if (m_juqingwindow != null) { m_juqingwindow.GetComponent <JuQingWindow>().m_nChapterId = m_ChapterId; m_juqingwindow.GetComponent <JuQingWindow>().m_nAwardIndex = m_AwardIndex; } if (m_bCanGet) { btnClaim.GetComponent <UIImageButton>().isEnabled = true; } else { btnClaim.GetComponent <UIImageButton>().isEnabled = false; } Tab_StoryCopySceneAward tabAward = GetChapterAwardTab(); UpdateChestRewards(tabAward); chestDialog.SetActive(true); if (NewPlayerGuidLogic.Instance()) { NewPlayerGuidLogic.CloseWindow(); } }
public void ShowStarBoxTip(int chapterid, int awardindex, BoxType type) { Tab_StoryCopySceneChapter tabChapter = TableManager.GetStoryCopySceneChapterByID(chapterid, 0); if (tabChapter == null) { return; } int nAwardId = GlobeVar.INVALID_ID; if (type == BoxType.ChapterAward) { if (awardindex < 0 || awardindex >= tabChapter.getAwardCount()) { return; } nAwardId = tabChapter.GetAwardbyIndex(awardindex); } else if (type == BoxType.LevelAward) { if (awardindex < 0 || awardindex >= tabChapter.getLevelAwardCount()) { return; } nAwardId = tabChapter.GetLevelAwardbyIndex(awardindex); } Tab_StoryCopySceneAward tabAward = TableManager.GetStoryCopySceneAwardByID(nAwardId, 0); if (tabAward == null) { return; } m_StarBoxTip.SetActive(true); for (int i = 0; i < m_StarBoxTipItem.Length; i++) { m_StarBoxTipItem[i].ClearInfo(); m_StarBoxTipItem[i].gameObject.SetActive(false); } // 和任务奖励一样顺序 物品(最多4个) 玩家经验 宠物经验 金钱 int nItemIndex = 0; // 物品 if (tabAward.getItemIDCount() > 0) { for (int i = 0; i < tabAward.getItemIDCount(); i++) { Tab_CommonItem tabItem = TableManager.GetCommonItemByID(tabAward.GetItemIDbyIndex(i), 0); if (tabItem != null && tabAward.GetItemNumbyIndex(i) > 0 && nItemIndex < m_StarBoxTipItem.Length) { int nItemCount = tabAward.GetItemNumbyIndex(i); m_StarBoxTipItem[nItemIndex].gameObject.SetActive(true); m_StarBoxTipItem[nItemIndex].InitInfo_Item(tabItem.Id, null, nItemCount > 1 ? nItemCount.ToString() : "", nItemCount > 1); nItemIndex += 1; } } } // 玩家经验 if (tabAward.Exp > 0 && nItemIndex < m_StarBoxTipItem.Length) { m_StarBoxTipItem[nItemIndex].gameObject.SetActive(true); m_StarBoxTipItem[nItemIndex].InitInfo_PlayerExp(tabAward.Exp.ToString()); nItemIndex += 1; } // 宠物经验 if (tabAward.FellowExp > 0 && nItemIndex < m_StarBoxTipItem.Length) { m_StarBoxTipItem[nItemIndex].gameObject.SetActive(true); m_StarBoxTipItem[nItemIndex].InitInfo_FellowExp(tabAward.FellowExp.ToString()); nItemIndex += 1; } // 金钱 if (tabAward.Coin > 0 && nItemIndex < m_StarBoxTipItem.Length) { m_StarBoxTipItem[nItemIndex].gameObject.SetActive(true); m_StarBoxTipItem[nItemIndex].InitInfo_Coin(null, tabAward.Coin.ToString(), true); nItemIndex += 1; } if (tabAward.BindYuanBao > 0 && nItemIndex < m_StarBoxTipItem.Length) { m_StarBoxTipItem[nItemIndex].gameObject.SetActive(true); m_StarBoxTipItem[nItemIndex].InitInfo_YuanbaoBind(null, tabAward.BindYuanBao.ToString(), true); nItemIndex += 1; } if (m_StarBoxTipItemGrid.GetComponent <UIGrid>() != null) { m_StarBoxTipItemGrid.GetComponent <UIGrid>().Reposition(); } // grid一排显示4个 根据奖励数量动态调tips位置和大小 if (nItemIndex > 4) { m_StarBoxTipBG.height = 200; m_StarBoxTipBG.transform.localPosition = Vector3.zero; if (type == BoxType.ChapterAward) { m_StarBoxTip.transform.localPosition = new Vector3(StarBoxTipPosX_ChapterAward[awardindex], -100, 0); } else if (type == BoxType.LevelAward) { m_StarBoxTip.transform.localPosition = new Vector3(StarBoxTipPosX_LevelAward[awardindex], 150, 0); } } else { m_StarBoxTipBG.height = 134; m_StarBoxTipBG.transform.localPosition = new Vector3(0, 33, 0); if (type == BoxType.ChapterAward) { m_StarBoxTip.transform.localPosition = new Vector3(StarBoxTipPosX_ChapterAward[awardindex], -166, 0); } else if (type == BoxType.LevelAward) { m_StarBoxTip.transform.localPosition = new Vector3(StarBoxTipPosX_LevelAward[awardindex], 84, 0); } } }
void InitLeft(Tab_StoryCopyScene tBook, bool bWin) { if (!bWin) { return; } int nAwardExp = 0; int nAwardCoin = 0; int nAwardFExp = 0; // int nAwardYB = 0; Tab_StoryCopySceneAward tabPassReward = TableManager.GetStoryCopySceneAwardByID(tBook.PassReward, 0); if (null != tabPassReward) { nAwardCoin = tabPassReward.Coin; nAwardExp = tabPassReward.Exp; nAwardFExp = tabPassReward.FellowExp; // nAwardYB = tabPassReward.BindYuanBao; for (int nIndex = 0; nIndex < tabPassReward.getItemIDCount(); ++nIndex) { int nPassIndex = nIndex + 3; if (m_BonusItem.Length <= nPassIndex) { break; } int nPassRewardItemID = tabPassReward.GetItemIDbyIndex(nIndex); int nPassRewardItemNum = tabPassReward.GetItemNumbyIndex(nIndex); if (0 < nPassRewardItemID && 0 < nPassRewardItemNum) { m_BonusItem[nPassIndex].gameObject.SetActive(true); m_BonusItem[nPassIndex].SetShowItem(nPassRewardItemID, nPassRewardItemNum, true, true); //nAwardCount++; } else { break; } } } int CoinFromNum = 0; int CoinToNum = nAwardCoin; float FexpFromValue = GetCurLevelBattleFellowTotalExp() == 0 ? 0 : (float)(GetCurBattleFellowExp() - nAwardFExp) / GetCurLevelBattleFellowTotalExp(); float FexpToValue = GetCurLevelBattleFellowTotalExp() == 0 ? 0 : (float)GetCurBattleFellowExp() / GetCurLevelBattleFellowTotalExp(); float ExpFromValue = (float)(GetCurPlayerExp() - nAwardExp) / GetCurLevelPlayerTotalExp(); float ExpToValue = (float)(GetCurPlayerExp()) / GetCurLevelPlayerTotalExp(); //因为宠物经验在目前游戏计算有问题,所以按照策划意思,先写死,有个效果 FexpFromValue = 0.4f; FexpToValue = 0.7f; m_TweenNumLable = TweenNumber.Begin(m_Coin.gameObject, 2, CoinFromNum, CoinToNum); m_TweenNumLable.onUpdatingNum = RefreshLabelText; m_ExpSlider.value = getSliderValue(ExpFromValue); m_TweenSlider1 = TweenNumber.Begin(m_ExpSlider.gameObject, 2, ExpFromValue, ExpToValue); m_TweenSlider1.onUpdatingNum = RefreshSlider1; m_FexpSlider.value = getSliderValue(FexpFromValue); m_TweenSlider2 = TweenNumber.Begin(m_FexpSlider.gameObject, 2, FexpFromValue, FexpToValue); m_TweenSlider2.onUpdatingNum = RefreshSlider2; //m_Coin.text = nAwardCoin.ToString(); //m_Exp.text = nAwardExp.ToString(); //m_FExp.text = nAwardFExp.ToString(); //m_BindYuanbao.text = nAwardYB.ToString(); }