private void SetResidueDegree(int count, int costType = 0, int costNum = 0) { _residueDegree = count; if (ResidueDegreeLabel == null) { return; } if (count == 0 && RotateBySome) { CostContainer.SetActive(true); ResidueDegreeLabel.gameObject.SetActive(false); if (CostContainer) { YxTools.TrySetComponentValue(CostLabel, string.Format(CostLabelFormat, costNum)); YxTools.TrySetComponentValue(CostLabelAdapter, costNum, costType.ToString(), CostLabelFormat); YxTools.TrySetComponentValue(CostTypeSprite, string.Format(CostSpriteFormat, costType)); } return; } if (CostContainer) { CostContainer.SetActive(false); } ResidueDegreeLabel.text = string.Format(ResidueDegreeFormat, count); }
protected void OnBindDate() { var userInfoModel = UserInfoModel.Instance; var userinfo = userInfoModel.UserInfo; if (Coin != null) { Coin.text = userinfo.CoinA.ToString(CultureInfo.InvariantCulture); } YxTools.TrySetComponentValue(CoinAdapter, userinfo.CoinA, "1"); if (Gold != null) { Gold.text = userinfo.CashA.ToString(CultureInfo.InvariantCulture); } if (Coupon != null) { Coupon.text = userinfo.CouponA.ToString(CultureInfo.InvariantCulture); } var backPack = userInfoModel.BackPack; if (RoomCard != null) { RoomCard.text = backPack.GetItem("item2_q").ToString(CultureInfo.InvariantCulture); } }
private void GetUserData() { if (Data is string) { var manager = App.GetGameManager <Lyzz2DGameManager>(); if (manager) { var USeat = int.Parse(Data.ToString()); var sit = (manager.CurrentSeat + USeat) % manager.PlayerNumber; if (manager.Players != null && (manager.Players.Length > sit)) { var info = manager.Players[sit].UserInfo; UserName.text = name; YxTools.TrySetComponentValue(UserName, info.name); YxTools.TrySetComponentValue(UserID, info.id.ToString()); YxTools.TrySetComponentValue(UserIP, info.ip); if (_userHead) { var texture = manager.Players[sit].CurrentInfoPanel.UserIcon; if (texture) { _userHead.SetTexture(texture.mainTexture); } } } } } }
protected override void OnFreshView() { base.OnFreshView(); var infoData = Data as Dictionary <string, object>; if (infoData != null) { var gameName = infoData["game_name"].ToString(); var str = string.Format("({0})", gameName); YxTools.TrySetComponentValue(GameName, str); var roomId = infoData["room_id"].ToString().Substring(3, 6); YxTools.TrySetComponentValue(RoomId, roomId); var gameCreatTime = infoData["create_dt"].ToString(); YxTools.TrySetComponentValue(GameCreatTime, gameCreatTime); var infos = infoData["overinfo"]; var infoLists = infos as List <object>; if (infoLists != null) { foreach (var infoList in infoLists) { var infoDic = infoList as Dictionary <string, object>; if (infoDic != null) { var item = YxWindowUtils.CreateItem(MahPlayerHeadItem, MahPlayerHeadGrid.transform); item.UpdateView(infoDic); } } MahPlayerHeadGrid.repositionNow = true; } } }
public void SetGold(int num) { if (_userInfo != null) { _userInfo.Gold = num; } YxTools.TrySetComponentValue(Gold, YxUtiles.GetShowNumber(num).ToString()); }
protected void OnUpCoin(object msg = null) { var userinfo = UserInfoModel.Instance.UserInfo; YxTools.TrySetComponentValue(BankCoin, userinfo.BankCoin.ToString()); YxTools.TrySetComponentValue(UserCoin, userinfo.CoinA.ToString()); YxTools.TrySetComponentValue(BankCoinAdapter, userinfo.BankCoin, "1"); YxTools.TrySetComponentValue(UserCoinAdapter, userinfo.CoinA, "1"); }
protected override void OnShow() { if (_cacheInfo != null) { YxTools.TrySetComponentValue(Author, _cacheInfo.Sender); YxTools.TrySetComponentValue(Content, _cacheInfo.Content); YxTools.TrySetComponentValue(Time, _cacheInfo.Time); } }
private void RefreshInfo() { var userInfo = UserInfoModel.Instance.UserInfo; YxTools.TrySetComponentValue(UserGold, userInfo.CoinA.ToString()); YxTools.TrySetComponentValue(UserGoldAdapter, userInfo.CoinA, "1"); YxTools.TrySetComponentValue(UserCash, userInfo.CashA.ToString()); YxTools.TrySetComponentValue(RoomCard, UserInfoModel.Instance.BackPack.GetItem("item2_q").ToString()); }
public void Init(string iconName, int showNum) { if (ShowIcon) { ShowIcon.spriteName = iconName; ShowIcon.MakePixelPerfect(); } YxTools.TrySetComponentValue(ShowNum, string.Format("x{0}", showNum)); YxTools.TrySetComponentValue(ShowNumAdapter, showNum, iconName, "x{0}"); }
protected override void OnEnable() { var CreateRoom = data.CurrentGame.GameRoomType == -1; DessolveButton.gameObject.SetActive(CreateRoom); YxTools.TrySetComponentValue(ReturnButton, !CreateRoom); if (manager.IsInit()) { DessolveButton.GetComponent <BoxCollider>().enabled = manager.SelfPlayer.UserInfo.id == data.CurrentGame.OwnerId; } }
protected virtual void OnBindDate() { var userInfo = UserInfoModel.Instance.UserInfo; var loginName = userInfo.LoginM; if (UserId != null) { UserId.text = string.Format("{0}{1}", IdForm, App.UserId); } if (UserName != null) { UserName.text = string.IsNullOrEmpty(loginName) ? "游客" : loginName; } if (Sex != null) { switch (userInfo.SexI) { case 0: Sex.text = "女"; break; case 1: Sex.text = "男"; break; default: Sex.text = "保密"; break; } } YxTools.TrySetComponentValue(UserCoin, userInfo.CoinA.ToString()); YxTools.TrySetComponentValue(UserGold, userInfo.CashA.ToString()); YxTools.TrySetComponentValue(UserCoinAdapter, userInfo.CoinA, "1"); if (ClienIp != null) { ClienIp.text = userInfo.ClientIP; } if (NikeName != null) { NikeName.text = userInfo.NickM; } if (PhoneNumber != null) { PhoneNumber.text = userInfo.MobileN; } if (SpreadBtn != null) { var needShow = userInfo.Promoter != null && userInfo.Promoter == false; SpreadBtn.SetActive(needShow); } PortraitRes.SetPortrait(userInfo.AvatarX, Portrait, userInfo.SexI); }
public void ShowItem(string roundNum, string selfId) { _curItemData.ShowRoundNum = roundNum; SetItemInfo(_curItemData); SetHeads(_curItemData.HeadDatas); YxTools.TrySetComponentValue(GameName, _curItemData.GameName); float moveY = HeadGrid.cellHeight * ((HeadGrid.GetChildList().Count - 1) / HeadGrid.maxPerLine); if (BgSprite) { BgSprite.height = (int)moveY + BaseHeight; } }
protected override void OnFreshView() { if (Data == null) { return; } if (Data is Dictionary <string, object> ) { var dics = Data as Dictionary <string, object>; long coin_t; YxTools.TryGetValueWitheKey(dics, out coin_t, KeyCoinT); YxTools.TrySetComponentValue(CoinTLabel, coin_t.ToString()); YxTools.TrySetComponentValue(CoinALabel, YxUtiles.GetShowNumber(UserInfoModel.Instance.UserInfo.CoinA).ToString()); } }
/// <summary> /// 设置时间,局数相关信息 /// </summary> /// <param name="data"></param> private void SetItemInfo(RecordDetialItemData data) { YxTools.TrySetComponentValue(Time, data.Time); YxTools.TrySetComponentValue(RoundNum, string.Format(RoundFormat, data.ShowRoundNum)); YxTools.TrySetComponentValue(ReplayBtnParent, PlayBack); var heads = data.HeadDatas; int index = 0; foreach (var item in heads) { var view = YxTools.GetChildView(index++, HeadItemPrefab, HeadGrid.transform); view.UpdateView(item.Value); } HeadGrid.repositionNow = true; }
protected override void OnFreshView() { base.OnFreshView(); var data = Data as SignItemData; if (data == null) { return; } if (SignBtn != null) { SignBtn.isEnabled = data.CanSign; if (NoSignHideBtn) { SignBtn.gameObject.SetActive(data.CanSign); } } name = data.Day.ToString(); if (DateSprite != null) { DateSprite.spriteName = string.Format(CurDayFormat, data.Day); } else if (DateLabel != null) { DateLabel.text = string.Format(CurDayFormat, data.Day); } if (BackGround != null) { BackGround.spriteName = data.BgName; } if (SignStateSprite != null) { SignStateSprite.gameObject.SetActive(!string.IsNullOrEmpty(data.SignState)); SignStateSprite.spriteName = data.SignState; SignStateSprite.MakePixelPerfect(); } else if (SignStateLabel != null) { SignStateLabel.text = data.SignState; } YxTools.TrySetComponentValue(RewardLabel, data.Reward.ToString()); YxTools.TrySetComponentValue(RewardLabelAdapter, data.Reward, "1"); if (RewardType != null) { RewardType.spriteName = string.Format("{0}{1}", RewardTypePrefix, data.RewardType); } }
protected override void OnFreshView() { base.OnFreshView(); var userInfos = Data as Dictionary <string, object>; if (userInfos != null) { var userGold = userInfos["gold"].ToString(); YxTools.TrySetComponentValue(UserGold, userGold); var userName = userInfos["name"].ToString(); YxTools.TrySetComponentValue(UserName, userName); if (userInfos.ContainsKey("owner")) { var owner = bool.Parse(userInfos["owner"].ToString()); YxTools.TrySetComponentValue(OwnerIcon, owner); } } }
private void RefreshItem(Dictionary <string, object> dic) { _data = new HeadData(dic); YxTools.TrySetComponentValue(ShowUserName, _data.UserName); YxTools.TrySetComponentValue(ShowId, _data.UserId); YxTools.TrySetComponentValue(ShowTotalScore, _data.UserScore); if (SelfSpecialColorl) { if (_data.UserId.Equals(App.UserId)) { if (ShowUserName) { ShowUserName.color = SelfColor; } } } PortraitRes.SetPortrait(_data.HeadUrl, ShowHead, _data.UserSex); }
public void SetResultInfo(ISFSObject data, MahjongPlayer player, List <int> handCards, List <int> huList) { #region data int type; long totalGold; ISFSArray Groups; GameTools.TryGetValueWitheKey(data, out type, RequestKey.KeyType); GameTools.TryGetValueWitheKey(data, out _huNum, RequestKey.KeyHuNum); GameTools.TryGetValueWitheKey(data, out _gangNum, RequestKey.KeyGangNum); GameTools.TryGetValueWitheKey(data, out _fanName, RequestKey.KeyHuName); GameTools.TryGetValueWitheKey(data, out _totalNum, RequestKey.KeyGold); GameTools.TryGetValueWitheKey(data, out totalGold, RequestKey.KeyTotalGold); GameTools.TryGetValueWitheKey(data, out Groups, RequestKey.KeyGroups); var groups = GameTools.GetGroupData(Groups); YxDebug.Log("手牌总长度是:" + handCards.Count); _isWiner = type > 0; if (type == 2) //目前自摸情况下,会把胡的那张牌从手牌中带回来,这里删掉。目前只有一个胡牌,所以这么删,待扩展 { handCards.Remove(huList[0]); } YxDebug.Log("手牌实际长度是:" + handCards.Count); #endregion #region UI LabelUserName.text = player.UserInfo.name; ZhuangSprite.SetActive(player.IsZhuang); LabelFanName.text = _fanName; YxTools.TrySetComponentValue(LabelHuScore, YxUtiles.GetShowNumber(_huNum).ToString()); YxTools.TrySetComponentValue(LabelGangNum, YxUtiles.GetShowNumber(_gangNum).ToString()); YxTools.TrySetComponentValue(LabelTotalScore, YxUtiles.GetShowNumber(_totalNum).ToString()); HeadTexture.mainTexture = player.CurrentInfoPanel.UserIcon.mainTexture; player.UserInfo.Gold = totalGold; player.CurrentInfoPanel.SetGold((int)totalGold); HuLogo.SetActive(IsWiner); #endregion _resultCards.Init(groups, handCards, huList, _isWiner); LabelFanName.ProcessText(); NGUIText.Update(); }
public void RefreshView() { YxTools.TrySetComponentValue(TimeLabel, _curData.Time); YxTools.TrySetComponentValue(TitleLabel, _curData.Title); var state = _curData.Status; if (ReadState != null) { var lenth = ReadState.Length; if (lenth > state) { for (int i = 0; i < lenth; i++) { ReadState[i].SetActive(false); } ReadState[state].SetActive(true); } } }
protected virtual void ShowMainUi() { if (_curData != null) { YxTools.TrySetComponentValue(Title, _curData.Title); YxTools.TrySetComponentValue(StartTime, _curData.StartTime); YxTools.TrySetComponentValue(EndTime, _curData.EndTime); if (StateGroup != null) { int state = (int)_curData.State; if (StateGroup.Length > state) { for (int i = 0, count = StateGroup.Length; i < count; i++) { StateGroup[i].SetActive(false); } StateGroup[state].SetActive(true); } } } }
protected override void OnFreshView() { base.OnFreshView(); var data = Data as Dictionary <string, object>; if (data == null) { return; } int type; YxTools.TryGetValueWitheKey(data, out type, _keyType); long coin; YxTools.TryGetValueWitheKey(data, out coin, "coin_num_a"); var tempFormat = type > 0? "玩家【{0}】赠送给您":"您赠送给玩家【{0}】"; LogLabel.text = string.Format(tempFormat, data["nick_m"]); DateLabel.text = data["create_dt"].ToString(); YxTools.TrySetComponentValue(CoinLabel, string.Format("x{0}金币", coin)); YxTools.TrySetComponentValue(CoinLabelAdapter, coin, "1", "x{0}金币"); }
private void ShowDetailInfo() { MatchDetailData detailData = new MatchDetailData(Data, typeof(MatchRewardData)); if (detailData.MatchState != _curData.State) { _curData.State = detailData.MatchState; if (Target) { Target.SendMessage(OnStateChangeFunc, new object[] { this, _curData } , SendMessageOptions.RequireReceiver); } } if (YxTools.TrySetComponentValue(SelfContainer, !string.IsNullOrEmpty(detailData.SelfInfo))) { YxTools.TrySetComponentValue(SelfInfo, detailData.SelfInfo); } if (Grid) { bool stateChange = !detailData.MatchState.Equals(_curData.State); bool exist = Grid.transform.childCount != 0; if (!exist) { FreshGrid(detailData.DataItems); } else { if (stateChange) { FreshGrid(detailData.DataItems); } } } }
public void InitInfo(OverData userData) { _windner.SetActive(userData.isYingJia); _loser.SetActive(userData.isPaoShou); // 房卡模式中seat为0的就是房主?好像是的,第一个进入的就是 if (userData.seat == 0 && App.GetGameData <Lyzz2DGlobalData>().CurrentGame.GameRoomType == -1) { _houseOwner.SetActive(true); } else { _houseOwner.SetActive(false); } _head.mainTexture = App.GetGameManager <Lyzz2DGameManager>().Players[userData.seat].CurrentInfoPanel.UserIcon.mainTexture; _playerName.text = userData.nick; _ziMoNumber.text = userData.zimo.ToString(); _jiePaoNumber.text = userData.hu.ToString(); _dianPaoNumber.text = userData.pao.ToString(); _anGangUiLabelNumber.text = userData.anGang.ToString(); _mingGangNumber.text = userData.anGang.ToString(); YxTools.TrySetComponentValue(_totalNumber, YxUtiles.GetShowNumber(userData.gold).ToString()); _idNum.text = string.Format("ID:{0}", userData.id); }
protected void DealPageData(PageRequestData data) { var showState = data.DataCount != 0; YxTools.TrySetComponentValue(NoDataSign, !showState); YxTools.TrySetComponentValue(Table.gameObject, showState); if (_isFirst) { _totalCount = data.TotalCount; _perPageCount = data.PageCount; StartCoroutine(YxTools.WaitExcuteCalls(OnFirstAction)); _isFirst = false; } _curCount += data.DataCount; var list = data.DataItems; RefreshView(list, Items.Count); Items.AddRange(list); if (CouldNotDrad() && data.ExistPageNum) { _curPage = data.PageNumber; } _request = false; }
protected override void OnFreshView() { if (Data == null) { return; } var rankData = Data as RankItemData; if (rankData == null) { return; } if (Medal != null) { var isSpecialRank = rankData.RankNum <= FirstFew && rankData.RankNum != 0; if (isSpecialRank) { if (!string.IsNullOrEmpty(SpecialRankBg)) { Medal.spriteName = string.Format("{0}{1}", SpecialRankBg, rankData.RankNum); } Medal.gameObject.SetActive(true); Medal.MakePixelPerfect(); if (SpecialRankNeedLabel) { RankNum.gameObject.SetActive(true); RankNum.text = rankData.RankNum <= TotalCount && rankData.RankNum != 0 ? string.Format(FormatRank, rankData.RankNum) : SpecialRankNotice; } else { RankNum.gameObject.SetActive(false); } } else { if (!string.IsNullOrEmpty(NormalRankBg)) { Medal.spriteName = NormalRankBg; } Medal.gameObject.SetActive(false); Medal.MakePixelPerfect(); RankNum.gameObject.SetActive(true); RankNum.text = rankData.RankNum <= TotalCount && rankData.RankNum != 0 ? string.Format(FormatRank, rankData.RankNum) : SpecialRankNotice; } } else { RankNum.gameObject.SetActive(true); RankNum.text = rankData.RankNum <= TotalCount && rankData.RankNum != 0 ? string.Format(FormatRank, rankData.RankNum) : SpecialRankNotice; } Nick.text = rankData.Nick; YxTools.TrySetComponentValue(Value, rankData.Value.ToString(FormatCoin)); YxTools.TrySetComponentValue(ValueAdapter, rankData.Value, RankType); if (ID) { ID.text = rankData.ID; } if (RankIcon) { RankIcon.spriteName = RankType; } if (Protrail != null) { PortraitRes.SetPortrait(rankData.Avator, Protrail, rankData.Sex); } if (ItemNoticeLabel) { if (!string.IsNullOrEmpty(ItemNotice)) { ItemNoticeLabel.text = ItemNotice; } } if (AffiliateNoticeLabel) { if (rankData.Affiliate == 0) { AffiliateNoticeLabel.text = NoAffiliateContent; } else { AffiliateNoticeLabel.text = string.Format("{0}{1}", AffiliateFormat, rankData.Affiliate); } } }
/// <summary> /// 设置显示版本号信息 /// </summary> /// <param name="label"></param> public void ShowVersion(UILabel label) { YxTools.TrySetComponentValue(label, Application.version); }