void Update() { if (Input.GetKeyDown(KeyCode.Escape) && _curMsgBox == null) { if (App.GameKey == App.Skin.Hall) { if (App.History.CurrentHistory() < YxEHistoryPathType.Hall || !App.Config.QuitToLogin) { _curMsgBox = ShowQuitMessagebox(); } else { if (ResourceManager.HasRes(App.Skin.Hall, "QuitWindow")) { _curMsgBox = ShowQuitWindow(); } else { _curMsgBox = ShowQuitMessagebox(); } } } else { _curMsgBox = App.QuitGameWithMsgBox(); } } }
protected virtual void OnChageTab(YxView view, TabData tabData) { if (view == null) { return; } view.ShowWithData(tabData); }
protected override void OnChageTab(YxView view, TabData tabData) { if (view == null) { return; } view.ShowWithData(tabData.Data); }
/// <summary> /// 移动筹码到指定位置 /// </summary> /// <param name="view"></param> /// <param name="from"></param> /// <param name="to"></param> /// <param name="time"></param> private void TweenFromTo(YxView view, Vector3 from, Vector3 to, float time) { var tween = view.GetComponent <TweenPosition>() ?? view.gameObject.AddComponent <TweenPosition>(); tween.@from = from; tween.duration = time; tween.to = to; tween.ResetToBeginning(); tween.PlayForward(); }
/// <summary> /// 获取对应父级的子物体 /// </summary> /// <param name="index"></param> /// <param name="prefabView"></param> /// <param name="tranParent"></param> /// <returns></returns> public static YxView GetChildView(int index, YxView prefabView, Transform tranParent) { if (tranParent.childCount > index) { var returnView = tranParent.GetChild(index).GetComponent <YxView>(); returnView.gameObject.SetActive(true); return(returnView); } return(YxWindowUtils.CreateItem(prefabView, tranParent)); }
protected override void OnChageTab(YxView view, TabData tabData) { if (view == null) { return; } var parm = new Dictionary <string, object>(); parm["type"] = tabData.Id; CurTwManager.SendAction(TabActionName, parm, view.UpdateView); }
private void UpdateItemView(RuleInfo info, YxView itemView) { if (info == null) { return; } _selectedGameKey = info.GameKey; _selectedRuleId = info.Id; _curRuleInfo = info; _selectedGameName = info.Name; itemView.UpdateView(info); }
private void SetPrice(YxView view, string consumeId, string price) { if (view == null) { return; } var data = new YxKeyValueData { IconUrl = consumeId, Value = price }; view.UpdateView(data); }
/// <summary> /// 打开窗口并传递数据 /// </summary> /// <param name="mainView">主窗口</param> /// <param name="windowName">打开窗口名称</param> /// <param name="data">传递数据</param> /// <param name="callBack">数据回调</param> public static YxWindow OpenWindowWithData(this YxView mainView, string windowName, object data, Action <object> callBack = null) { if (string.IsNullOrEmpty(windowName)) { return(null); } var mainWindow = mainView as YxWindow; var window = mainWindow ? mainWindow.CreateChildWindow(windowName) : YxWindowManager.OpenWindow(windowName); if (window) { window.UpdateViewWithCallBack(data, callBack); } return(window); }
/// <summary> /// /// </summary> public void ShowTip() { if (_curView == this) { UITooltip.Hide(); _curView = null; return; } _curView = this; var itemData = GetData <ItemData>(); if (itemData == null) { return; } UITooltip.Show(itemData.Tip); }
/// <summary> /// 获取对应父级的子物体 /// </summary> /// <param name="index"></param> /// <param name="prefabView"></param> /// <param name="tranParent"></param> /// <returns></returns> public static YxView GetChildView(this Transform tranParent, int index, YxView prefabView) { if (tranParent.childCount > index) { var returnView = tranParent.GetChild(index).GetComponent <YxView>(); if (returnView) { returnView.gameObject.SetActive(true); } else { YxDebug.LogError(string.Format("Child Item is not a YxView,index is :{0},please check again!", index)); returnView = YxWindowUtils.CreateItem(prefabView, tranParent); } return(returnView); } return(YxWindowUtils.CreateItem(prefabView, tranParent)); }
/// <summary> /// 刷新页面 /// </summary> /// <param name="info"></param> /// <param name="itemView"></param> private void UpdateItemView(CreateRoomRuleInfo info, YxView itemView) { if (info == null) { return; } SelectedGameKey = info.GameKey; SelectedRuleId = info.Id; CurRuleInfo = info; info.Reset(); SelectedGameName = info.Name; // if (_curRuleInfo != null) // { // var cArgs = _curRuleInfo.CreateArgs; // var allCreateData = GetAllRp(cArgs); // UpdataAllState(allCreateData, cArgs); // } itemView.UpdateView(info); }
protected override void OnAwake() { var gdata = App.GameData; if (gdata == null)//空 隐藏所有 { ShowLineView(); if (MorePView != null) { MorePView.gameObject.SetActive(false); } if (BackGround != null) { BackGround.SetActive(false); } return; } var count = gdata.SeatTotalCount; var lineCount = LinePViews.Length; if (count >= (lineCount + MinPlayerCount))//更多模式 { if (MorePView != null) { ShowLineView(); MorePView.gameObject.SetActive(true); _curView = MorePView; return; } } if (lineCount < 1)//todo 全屏连线模式 { if (BackGround != null) { BackGround.SetActive(false); } return; } //连线模式 _curView = ShowLineView(count - MinPlayerCount); }
private YxView ShowLineView(int index = -1) { YxView view = null; var len = LinePViews.Length; for (var i = 0; i < len; i++) { var v = LinePViews[i]; if (v == null) { continue; } var flag = i == index; v.gameObject.SetActive(flag); if (flag) { view = v; } } return(view); }
private void ShowPreviewListView() { YxView view = PreviewGameListView; var gm = GameListModel.Instance; var gGroup = gm.GetGroup(0); if (PreviewGameListView != null) { var arr = PreviewGameListView.SpecialDataFormat; var arrCount = arr.Length; var groups = gm.Groups; var groupCount = groups.Count; if (groupCount > 1)//多个组 { var gmSgroup = gm.GetSpecialGroup(); var gmGroupCount = gmSgroup.Length; if (arrCount > 0)//是不是支持group { if (gmGroupCount < 1) { PreviewGameListView.SpecialDataFormat = new int[0]; PreviewGameListView.StartDataIndex = 0; } else { if (GameListStartIndex > 0) { PreviewGameListView.StartDataIndex = GameListStartIndex - arrCount + gmGroupCount; } PreviewGameListView.SpecialDataFormat = gmSgroup; } } else//只显示一个组 { PreviewGameListView.StartDataIndex = GameListStartIndex; PreviewGameListView.SpecialDataFormat = new int[0]; } } else//一个组 { PreviewGameListView.StartDataIndex = GameListStartIndex; if (arrCount > 0) { PreviewGameListView.SpecialDataFormat = new int[0]; } } } else if (PreviewListView != null) { view = PreviewListView; } else { return; } IList list = null; if (gGroup != null) { list = gGroup.GameListModels; } view.UpdateView(list); }