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; } } }
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 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); } }
protected override void ParseData(Dictionary <string, object> dic) { YxTools.TryGetValueWitheKey(dic, out _replayId, KeyReplayId); YxTools.TryGetValueWitheKey(dic, out _userInfoHeads, KeyHeads); YxTools.TryGetValueWitheKey(dic, out _createTime, KeyTime); YxTools.TryGetValueWitheKey(dic, out _url, KeyUrl); }
protected override void ParseData(Dictionary <string, object> dic) { YxTools.TryGetValueWitheKey(dic, out _title, KeyTitle); YxTools.TryGetValueWitheKey(dic, out _time, KeyTime); YxTools.TryGetValueWitheKey(dic, out _mailId, KeyId); YxTools.TryGetValueWitheKey(dic, out _status, KeyStatus); }
protected virtual void TryGetDic(Dictionary <string, object> dic) { Dictionary <string, object> dataDic; YxTools.TryGetValueWitheKey(dic, out dataDic, KeyData); Dic = GetDatas(dataDic); }
private void ShootScreen(SharePlat sharePlat) { if (gameObject.activeInHierarchy) { StartCoroutine(YxTools.ShareSceenImage(sharePlat, waitForScreen)); } }
protected virtual void TryGetList(Dictionary <string, object> dic) { List <object> list; YxTools.TryGetValueWitheKey(dic, out list, KeyData); Items = GetDatas(list); }
protected override void OnHide() { if (gameObject.activeInHierarchy) { StartCoroutine(YxTools.WaitExcuteCalls(OnHideAction)); } }
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); }
/// <summary> /// 查找茶馆房间 /// </summary> /// <param name="teaId">茶馆ID</param> /// <param name="msgBoxName">提示框名称</param> /// <param name="successCall">成功回调</param> /// <param name="openTeapanel"></param> /// <param name="defTeaHouseName">默认茶馆窗口名称</param> public static void FindTeaHouse(string teaId, string msgBoxName = null, TwCallBack successCall = null, bool openTeapanel = true, string defTeaHouseName = KeyDefTeaHouseName) { var dic = new Dictionary <string, object>(); dic[KeyTeaId] = teaId; Facade.Instance <TwManager>().SendAction(KeyFindTeaHouseAction, dic, message => { if (successCall != null) { successCall(message); } if (openTeapanel) { Dictionary <string, object> successDic = (Dictionary <string, object>)message; YxWindow window = YxWindowManager.GetWindowInstance <TeaPanel>(defTeaHouseName); if (window == null) { window = YxTools.OpenWindowWithData(null, defTeaHouseName, successDic); } else { window.UpdateView(successDic); } if (window) { TeaPanel panel = window.GetComponent <TeaPanel>(); panel.SetTeaCode(int.Parse(teaId)); Util.SetString(KeySaveTeaKey, teaId); } } }); }
protected override void ParseData(Dictionary <string, object> dic) { base.ParseData(dic); YxTools.TryGetValueWitheKey(dic, out _dataCount, KeyCount); YxTools.TryGetValueWitheKey(dic, out _pageCount, KeyPageCount); YxTools.TryGetValueWitheKey(dic, out _pageNum, KeyPageNumber); YxTools.TryGetValueWitheKey(dic, out _totalCount, KeyTotalCount); }
public void SetGold(int num) { if (_userInfo != null) { _userInfo.Gold = num; } YxTools.TrySetComponentValue(Gold, YxUtiles.GetShowNumber(num).ToString()); }
/// <summary> /// 点击邀请好友按钮 /// </summary> public void OnClickInviteBtn() { YxTools.ShareFriend ( GameData.RoomInfo.CreateRoomInfo.RoomId.ToString(), GameData.RoomInfo.Rule ); }
void AddOnClick() { ////添加返回大厅按钮的OnClick事件 _bcakButton.onClick.Add(new EventDelegate(() => { YxMessageBox.Show(new YxMessageBoxData { Msg = "确定要返回大厅吗?", IsTopShow = true, BtnStyle = YxMessageBox.LeftBtnStyle | YxMessageBox.RightBtnStyle, Listener = (box, btnName) => { if (btnName == YxMessageBox.BtnLeft) { App.QuitGame(); } }, }); } )); //微信邀请 _invitButton.onClick.Add(new EventDelegate(() => { YxTools.ShareFriend(_roomId.ToString(), _ruleInfo); })); //分享战绩 _shareButton.onClick.Add(new EventDelegate(() => { YxWindowManager.ShowWaitFor(); Facade.Instance <WeChatApi>().InitWechat(); UserController.Instance.GetShareInfo(info => { YxWindowManager.HideWaitFor(); _img.DoScreenShot(new Rect(0, 0, Screen.width, Screen.height), imageUrl => { if (Application.platform == RuntimePlatform.Android) { imageUrl = "file://" + imageUrl; } info.ImageUrl = imageUrl; info.ShareType = ShareType.Image; Facade.Instance <WeChatApi>().ShareContent(info); }); }); })); _agreeBtn.onClick.Add(new EventDelegate(() => { App.GetRServer <TexasGameServer>().DismissRoom(3); SetMannerBtn(false); })); _disagreeBtn.onClick.Add(new EventDelegate(() => { App.GetRServer <TexasGameServer>().DismissRoom(-1); SetMannerBtn(false); })); _closeBtn.onClick.Add(new EventDelegate(() => { DismissRoom.transform.GetChild(0).gameObject.SetActive(false); })); }
protected override void ParseData(Dictionary <string, object> dic) { base.ParseData(dic); YxTools.TryGetValueWitheKey(dic, out _selfInfo, _keySelf); if (dic.ContainsKey(_keyStatus)) { _status = (EnumMatchState)Enum.Parse(typeof(EnumMatchState), dic[_keyStatus].ToString()); } }
public void OnRoomClick(string index) { var room = RoomListModel.Instance.RoomUnitModel[int.Parse(index)]; YxTools.GoldJoinRoom(room.GameKey, room.TypeId, delegate { RoomListController.Instance.OnDirectGame(room); }); }
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 OnClickWeiChatBtn() { var CurrentGame = Manager.Data.CurrentGame; if (CurrentGame != null) { YxTools.ShareFriend(CurrentGame.ShowRoomId.ToString(), CurrentGame.RuleInfo); } }
protected override void OnShow() { if (_cacheInfo != null) { YxTools.TrySetComponentValue(Author, _cacheInfo.Sender); YxTools.TrySetComponentValue(Content, _cacheInfo.Content); YxTools.TrySetComponentValue(Time, _cacheInfo.Time); } }
/// <summary> /// 设置头像相关信息 /// </summary> /// <param name="heads"></param> private void SetHeads(List <object> heads) { for (int i = 0, lenth = heads.Count; i < lenth; i++) { var view = YxTools.GetChildView(i, HeadItemPrefab, HeadGrid.transform); view.UpdateView(heads[i]); } HeadGrid.repositionNow = true; }
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 ParseData(Dictionary <string, object> dic) { YxTools.TryGetValueWitheKey(dic, out _status, KeyStatus); YxTools.TryGetValueWitheKey(dic, out _content, KeyContent); YxTools.TryGetValueWitheKey(dic, out _mid, KeyMid); YxTools.TryGetValueWitheKey(dic, out _title, KeyTitle); YxTools.TryGetValueWitheKey(dic, out _sender, KeySender); YxTools.TryGetValueWitheKey(dic, out _time, KeyCreateTime); }
protected override void TryGetList(Dictionary <string, object> dic) { base.TryGetList(dic); if (dic.ContainsKey(_keyDetail)) { List <object> list; YxTools.TryGetValueWitheKey(dic, out list, _keyDetail); Items = GetDatas(list); } }
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}"); }
public void ShowDetailInfo(string id, MailItem Item) { selectItem = Item; var dic = new Dictionary <string, object>() { { KeyParamId, id } }; YxTools.SendActionWithCacheKey(ActionName, dic, SuccessCall, YxTools.GetCacahKey(ActionName, dic)); }
private void OnOpenQuickGame() { RoomUnitModel model = new RoomUnitModel(null); model.TypeId = _curData.GameType.ToString(); model.GameKey = _curData.GameKey; YxTools.GoldJoinRoom(model.GameKey, model.TypeId, delegate { RoomListController.Instance.OnDirectGame(model); }); }
protected virtual void RefreshView(List <YxData> data, int startIndex = 0) { for (int i = startIndex, endIndex = data.Count + startIndex; i < endIndex; i++) { var view = YxTools.GetChildView(i, ListItem, Table.transform); var itemData = data[i - startIndex]; view.Id = (IdAntitone? _totalCount - i :i + 1).ToString(); view.UpdateView(itemData); } Table.repositionNow = true; }
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 SendActionWithPage() { string cacaheKey = ""; SetActionDic(); if (ActionWithCacheKey) { cacaheKey = YxTools.GetCacahKey(ActionName, ActionParam); } YxTools.SendActionWithCacheKey(ActionName, ActionParam, UpdateView, cacaheKey); }