public void ShowSuperFansInfor() { WarshipConfig warshipConfig = Globals.Instance.MDataTableManager.GetConfig <WarshipConfig>(); List <int> _mWarshipElementList = Globals.Instance.MGameDataManager.MActorData.WarshipList; Dictionary <int, WarshipConfig.WarshipObject> warshipDic = warshipConfig.getWarshipDic(); int warshipCount = 5; if (_mWarshipElementList.Count >= 5) { warshipCount = _mWarshipElementList.Count + 1; } SuperFansLabel.text = "[1f961f]" + _mWarshipElementList.Count + "[-][000000]/" + warshipDic.Count + "[-]"; HelpUtil.DelListInfo(SuperFansUIGrid.transform); for (int i = 0; i < warshipCount; i++) { GameObject superFansItem = GameObject.Instantiate(SuperFansItem) as GameObject; superFansItem.transform.parent = SuperFansUIGrid.transform; superFansItem.transform.localScale = Vector3.one; superFansItem.transform.localPosition = Vector3.zero; UITexture iconTexture = superFansItem.transform.Find("IconTexture").GetComponent <UITexture>(); GameObject fansInfo = superFansItem.transform.Find("FansInfo").gameObject; UILabel nameLabel = fansInfo.transform.Find("NameLabel").GetComponent <UILabel>(); UILabel describeLabel = fansInfo.transform.Find("DescribeLabel").GetComponent <UILabel>(); UILabel fansSayLabel = fansInfo.transform.Find("FansSayLabel").GetComponent <UILabel>(); UILabel unKnownLabel = superFansItem.transform.Find("UnKnownLabel").GetComponent <UILabel>(); WarshipConfig.WarshipObject mPair = null; if (_mWarshipElementList[i] != null && _mWarshipElementList.Count > i && warshipDic.TryGetValue(_mWarshipElementList[i], out mPair)) { iconTexture.mainTexture = Resources.Load("Icon/FansIcon/" + mPair.Fans_Icon, typeof(Texture2D)) as Texture2D; nameLabel.text = mPair.Name; describeLabel.text = mPair.Art_Describe; fansSayLabel.text = mPair.Fans_Say; superFansItem.name = "AAItem" + i; NGUITools.SetActive(unKnownLabel.gameObject, false); NGUITools.SetActive(fansInfo, true); } else { iconTexture.mainTexture = Resources.Load("Icon/FansIcon/UnKnown", typeof(Texture2D)) as Texture2D; NGUITools.SetActive(unKnownLabel.gameObject, true); NGUITools.SetActive(fansInfo, false); superFansItem.name = "BBItem" + i; } } SuperFansUIGrid.sorting = UIGrid.Sorting.Custom; SuperFansUIGrid.repositionNow = true; SuperFansUIScrollView.ResetPosition(); }
public void UpdateGirlInviteList() { HelpUtil.DelListInfo(Table.transform); mGirlCheckList.Clear(); WarshipConfig config = Globals.Instance.MDataTableManager.GetConfig <WarshipConfig>(); WarshipConfig.WarshipObject element = null; Dictionary <long, GirlData> dicWarShipData = Globals.Instance.MGameDataManager.MActorData.GetWarshipDataList(); List <GirlData> TempList = new List <GirlData> (); foreach (GirlData girlData in dicWarShipData.Values) { TempList.Add(girlData); } TempList.Sort(delegate(GirlData datax, GirlData datay) { if (datax.CardBase.CardRare != datay.CardBase.CardRare) { return(datax.CardBase.CardRare > datay.CardBase.CardRare ? -1 : 1); } else if (datax.CardBase.CardRank != datay.CardBase.CardRank) { return(datax.CardBase.CardRank > datay.CardBase.CardRank ? 1 : -1); } return(0); }); Artist_SkillConfig AConfig = Globals.Instance.MDataTableManager.GetConfig <Artist_SkillConfig>(); Artist_SkillConfig.SkillObject Aelement = null; int i = 0; SeleteNum = 0; ItemList.Clear(); SeleteID.Clear(); foreach (GirlData girlData in TempList) { if (girlData.CardBase.CardTypeId != 1230000001) { continue; } i++; GameObject item = GameObject.Instantiate(InviteGirlItem) as GameObject; UIToggle checkbox = item.transform.GetComponent <UIToggle>(); //UIButton NextBtn = item.transform.FindChild("Tween").FindChild("GameObject").FindChild("CheckBtn").GetComponent<UIButton>(); item.name = "GirlInviteSlotItem" + i.ToString(); item.transform.parent = Table.transform; item.transform.localPosition = new Vector3(i, i, -5.0f); item.transform.localScale = Vector3.one; //NextBtn.Data = girlData.roleCardId; UILabel NameLabel = item.transform.Find("AllLabel").Find("NameLabel").GetComponent <UILabel>(); NameLabel.text = girlData.CardBase.CardName; Transform Picture = item.transform.Find("Picture"); //各种参数赋值// UILabel ARTLabel = Picture.Find("ARTSprite").Find("ARTLabel").GetComponent <UILabel>(); ARTLabel.text = girlData.CardBase.cardArtValue.ToString(); UILabel LVLabel = Picture.Find("LVSprite").Find("LVLabel").GetComponent <UILabel>(); LVLabel.text = girlData.CardBase.CardRank.ToString() + "/99"; UILabel REPLabel = Picture.Find("REPSprite").Find("REPLabel").GetComponent <UILabel>(); REPLabel.text = girlData.CardBase.cardArtProfile.ToString(); //HangyeDengjiA UISprite GradeSprite = Picture.Find("GradeSprite").GetComponent <UISprite>(); string name = ""; if (1 == girlData.CardBase.CardRare) { name = "HangyeDengjiS"; } else { name = "HangyeDengji" + ((char)('A' + girlData.CardBase.CardRare - 2)).ToString(); } GradeSprite.spriteName = name; config.GetWarshipElement(girlData.CardBase.CardId, out element); UITexture HeadTexture = Picture.Find("HeadTexture").GetComponent <UITexture>(); // HeadTexture.mainTexture = Resources.Load("Icon/ArtistIcon/" + element.Head_Icon,typeof(Texture2D)) as Texture2D; for (int j = 0; j < girlData.skillLis.Count; ++j) { UITexture Skill = Picture.Find("SkillTexture" + j.ToString()).GetComponent <UITexture>(); AConfig.GetSkillObject(girlData.skillLis[j], out Aelement); string texturePath = "Icon/SkillIcon/" + Aelement.Skill_Icon; Skill.mainTexture = Resources.Load(texturePath, typeof(Texture2D)) as Texture2D; NGUITools.SetActive(Skill.gameObject, true); } //UIEventListener.Get(NextBtn.gameObject).onClick = OnItemPhoneClick; UIToggle SeleteBtn = item.transform.Find("SeleteBtn").GetComponent <UIToggle>(); SeleteBtn.Data = girlData; UIEventListener.Get(SeleteBtn.gameObject).onClick = delegate(GameObject Obj) { UIToggle SeleteBtnIn = item.transform.Find("SeleteBtn").GetComponent <UIToggle>(); GirlData IngirlData = (GirlData)SeleteBtnIn.Data; if (SeleteBtnIn.value) { if (SeleteNum < MaxSeleteNum) { mTotalART += IngirlData.CardBase.cardArtValue; mTotalREP += IngirlData.CardBase.cardArtProfile; SeleteNum++; SeleteID.Add(IngirlData.roleCardId); } if (SeleteNum == MaxSeleteNum) { IsDisplayUnSelete(false); } } else { if (SeleteNum == MaxSeleteNum) { IsDisplayUnSelete(true); } mTotalART -= IngirlData.CardBase.cardArtValue; mTotalREP -= IngirlData.CardBase.cardArtProfile; SeleteNum--; SeleteID.Remove(IngirlData.roleCardId); } }; MyItemData TempData = new MyItemData(); TempData.SeleteBtn = SeleteBtn; TempData.UnDoTextureObj = Picture.Find("UnDoTexture").gameObject; TempData.UnDoLabel = TempData.UnDoTextureObj.transform.Find("UnDoLabel").GetComponent <UILabel>(); TempData.ArtistID = girlData.roleCardId; TempData.ArtistData = girlData; TempData.ItemObj = item; for (int j = 0; j < 3; ++j) { TempData.SequenceObj[j] = Picture.Find("SkillTexture" + j.ToString()).Find("Sprite").gameObject; } ItemList.Add(TempData); } NGUITools.SetActive(NoAtristsFrame, i == 0); Table.repositionNow = true; ScrollView.ResetPosition(); }
public void ShowSuccessReward(sg.GS2C_Task_Complete_Res res) { this.gameObject.SetActive(true); foreach (sg.GS2C_Task_Complete_Res.TaskReward reward in res.rewards) { if (reward.rewardType == (int)TaskRewardTypeEnum.GET_ARTTST) { RewardObj.SetActive(false); FansRewardObj.SetActive(true); WarshipConfig config = Globals.Instance.MDataTableManager.GetConfig <WarshipConfig>(); WarshipConfig.WarshipObject warshipElement = null; config.GetWarshipElement(reward.itemId, out warshipElement); if (warshipElement == null) { return; } FansName.text = warshipElement.Name; FansIcon.mainTexture = Resources.Load("Icon/FansIcon/" + warshipElement.Fans_Icon, typeof(Texture2D)) as Texture2D; return; } } RewardObj.SetActive(true); FansRewardObj.SetActive(false); mCurrentfinishLv = res.finishLv; TaskID = res.taskId; CompleteBtn.Data = res.nextTaskId; TaskConfig task = Globals.Instance.MDataTableManager.GetConfig <TaskConfig>(); bool hasData = task.GetTaskObject(res.taskId, out element); if (!hasData) { return; } ScoreSlider.value = (EliminationMgr.Score * 1f) / EliminationMgr.Instance.star3; float baseX = 630f / EliminationMgr.Instance.star3; float baseX2 = 630f / 2f; float star1X = baseX * EliminationMgr.Instance.star1 - baseX2; Star1Obj.transform.localPosition = new Vector3(star1X, Star1Obj.transform.localPosition.y, Star1Obj.transform.localPosition.z); float star2X = baseX * EliminationMgr.Instance.star2 - baseX2; Star2Obj.transform.localPosition = new Vector3(star2X, Star2Obj.transform.localPosition.y, Star2Obj.transform.localPosition.z); float star3X = baseX * EliminationMgr.Instance.star3 - baseX2; Star3Obj.transform.localPosition = new Vector3(star3X, Star3Obj.transform.localPosition.y, Star3Obj.transform.localPosition.z); if (EliminationMgr.Score >= EliminationMgr.Instance.star1) { Star1Anim.SetActive(true); } if (EliminationMgr.Score >= EliminationMgr.Instance.star2) { Star2Anim.SetActive(true); } if (EliminationMgr.Score >= EliminationMgr.Instance.star3) { Star3Anim.SetActive(true); } CurrentScore.text = EliminationMgr.Score.ToString(); List <string[]> RewardArray = ParsingRewards(element.Rewards); if (RewardArray.Count > 0) { for (int i = 0; i < RewardArray.Count; i++) { switch (StrParser.ParseDecInt(RewardArray[i][0], -1)) { case (int)TaskRewardTypeEnum.ROLE_ATTR: switch (StrParser.ParseDecInt(RewardArray[i][1], -1)) { case (int)BaseRewardType.MONEY: MoneyBaseReward = StrParser.ParseDecInt(RewardArray[i][2], -1); break; case (int)BaseRewardType.DIAMOND: DiamondBaseReward = StrParser.ParseDecInt(RewardArray[i][2], -1); break; } break; case (int)TaskRewardTypeEnum.FANS_NUM: FansBaseReward = StrParser.ParseDecInt(RewardArray[i][2], -1); break; } } } NGUITools.SetActive(RewardItem1.gameObject, false); NGUITools.SetActive(RewardItem2.gameObject, false); int RewardItemState = 0; foreach (sg.GS2C_Task_Complete_Res.TaskReward reward in res.rewards) { switch (reward.rewardType) { case (int)TaskRewardTypeEnum.ITEM: ItemConfig item = Globals.Instance.MDataTableManager.GetConfig <ItemConfig>(); ItemConfig.ItemElement ItemEle = null; bool hasDataItem = item.GetItemElement(reward.itemId, out ItemEle); if (!hasDataItem) { return; } if (RewardItemState == 0) { RewardItemState = 1; NGUITools.SetActive(RewardItem1.gameObject, true); RewardItem1.mainTexture = Resources.Load("Icon/ItemIcon/" + ItemEle.Icon, typeof(Texture2D)) as Texture2D; if (reward.num > 1) { RewardItem1Name.text = Globals.Instance.MDataTableManager.GetWordText(reward.itemId) + "X" + reward.num; } else { RewardItem1Name.text = Globals.Instance.MDataTableManager.GetWordText(reward.itemId); } addItemOne = RewardItem1; addItemNameLabelOne = RewardItem1Name; addMoneyList.Add(1, reward.clothAddMoney); Debug.Log(" 1 -- reward.clothAddMoney = " + reward.clothAddMoney); } else { NGUITools.SetActive(RewardItem2.gameObject, true); RewardItem2.mainTexture = Resources.Load("Icon/ItemIcon/" + ItemEle.Icon, typeof(Texture2D)) as Texture2D; if (reward.num > 1) { RewardItem2Name.text = Globals.Instance.MDataTableManager.GetWordText(reward.itemId) + "X" + reward.num; } else { RewardItem2Name.text = Globals.Instance.MDataTableManager.GetWordText(reward.itemId); } addItemTwo = RewardItem2; addItemNameLabelTwo = RewardItem2Name; addMoneyList.Add(2, reward.clothAddMoney); Debug.Log(" 2 -- reward.clothAddMoney = " + reward.clothAddMoney); } break; case (int)TaskRewardTypeEnum.POSTURE: break; case (int)TaskRewardTypeEnum.ROLE_ATTR: switch (reward.itemId) { case (int)BaseRewardType.MONEY: MoneyAppraisalReward = reward.num - MoneyBaseReward; if (MoneyAppraisalReward > 0) { RewardMoneyNum.text = "[000000]" + MoneyBaseReward + "[-]" + "[00A542]" + " + " + MoneyAppraisalReward.ToString() + "[-]"; } else { RewardMoneyNum.text = "[000000]" + MoneyBaseReward + "[-]"; } break; case (int)BaseRewardType.DIAMOND: DiamondAppraisalReward = reward.num - DiamondBaseReward; if (DiamondAppraisalReward > 0) { RewardDiamondNum.text = "[000000]" + DiamondBaseReward + "[-]" + "[00A542]" + " + " + DiamondAppraisalReward.ToString() + "[-]"; } else { RewardDiamondNum.text = "[000000]" + DiamondBaseReward + "[-]"; } break; case (int)BaseRewardType.ACTING: break; case (int)BaseRewardType.CHARM: break; } break; case (int)TaskRewardTypeEnum.FANS_NUM: FansAppraisalReward = reward.num - FansBaseReward; if (FansAppraisalReward > 0) { RewardFansNum.text = "[000000]" + FansBaseReward.ToString() + "[-]" + "[00A542]" + " + " + FansAppraisalReward.ToString() + "[-]"; } else { RewardFansNum.text = "[000000]" + FansBaseReward.ToString() + "[-]"; } break; case (int)TaskRewardTypeEnum.UNKNOWNTYPE: break; } } addMoney(); }