public void UICreateAction(EventMultiArgs args) { //渐显 TweenAlpha tAlpha = TweenAlpha.Begin(_bg.gameObject, _fadeInTime, 1f); tAlpha.AddOnFinished(OnCreateActoinComplete); }
public void UIDestroyAction(EventMultiArgs args) { _bg.alpha = 1f; TweenAlpha tAlpha = TweenAlpha.Begin(_bg.gameObject, _fadeOutTime, 0f); tAlpha.AddOnFinished(OnDestroyActoinComplete); }
public static bool CreateWin(string name, bool byAction = false, EventMultiArgs actionArgs = null) { ControllerBase contro = GetControler(name); if (contro == null) { Utils.LogSys.LogError("CreateWin Error: ‘" + name + "’cannot find controller"); return(false); } contro._createByActionArgs = actionArgs; autoResetAllRenderQueue(); UILevel eLevel = contro.ELevel; int newWinDepth = GetNextDepth(eLevel); bool res = contro.CreateWin(newWinDepth, byAction); if (res) { RecordShowingWin(name, eLevel); } #if UNITY_EDITOR Utils.LogSys.Log("CreateWin:" + name + ", depth=" + curDepth[eLevel].ToString()); #endif return(res); }
/// <summary> /// 显示提示窗口 /// </summary> /// <param name="text"></param> /// <param name="title"></param> /// <param name="color"></param> /// <param name="alignment">"Left" "Center"</param> /// <param name="okCallbackFunc"></param> /// <param name="cancelCallbackFunc"></param> public void ShowMessageDialog(string text, string color, string alignment, DelegateType.MessageDialogCallback okCallbackFunc, DelegateType.MessageDialogCallback cancelCallbackFunc, bool isShowToggle = false, string okBtnName = "", int closeSecond = 0, bool isShowClose = false) { EventMultiArgs args = new EventMultiArgs(); args.AddArg("text", text); args.AddArg("color", color); args.AddArg("alignment", alignment); args.AddArg("okBtnName", okBtnName); args.AddArg("closeSecond", closeSecond); args.AddArg("showClose", isShowClose); okCallback = okCallbackFunc; cancelCallback = cancelCallbackFunc; int callbackCount = 0; if (okCallback != null) { callbackCount += 1; } if (cancelCallback != null) { callbackCount += 1; } args.AddArg("callbackCount", callbackCount); isShowTip = isShowToggle; CallUIEvent(UIEventID.MESSAGE_DIALOG_SET_TEXT, args); }
/// <summary> /// 模拟点击,新手引导中用 /// </summary> /// <param name="go"></param> public static void VirtualClick(GameObject go) { EventMultiArgs args = new EventMultiArgs(); args.AddArg("target", go); EventSystem.CallEvent(EventID.CLICK_SCENE_TARGET, args, true); }
public void SetMessage(string msg, string color) { EventMultiArgs args = new EventMultiArgs(); args.AddArg("text", msg); args.AddArg("color", color); CallUIEvent(UIEventID.MESSAGE_WIN_SET_TEXT, args); }
//连接socket的回调事件 public void OnEventSocketConnectOK(EventMultiArgs args) { // bool result = args.GetArg<bool> ("result", true); // if (result) // { // HeartBeastSwitch(true); // } }
private void OnUpdateShow(EventMultiArgs args) { uint queue = args.GetArg <uint>("queue"); uint enterSpeed = args.GetArg <uint>("enterSpeed"); CancelInvoke("Repeat"); UpdateQueue(queue, enterSpeed); }
public void UICreateAction(EventMultiArgs args) { ////渐显 _bg.alpha = 0f; TweenAlpha tAlpha = TweenAlpha.Begin(_bg.gameObject, _fadeInTime + 0.2f, 1f); tAlpha.AddOnFinished(_fadeInDel); //Invoke("OnCreateActoinComplete", _fadeInTime); }
public void UIDestroyAction(EventMultiArgs args) { _bg.alpha = 1f; tAlpha = TweenAlpha.Begin(_bg.gameObject, _fadeOutTime, 0f); tAlpha.RemoveOnFinished(_fadeInDel); tAlpha.AddOnFinished(_fadeOutDel); Invoke("OnDestroyActoinComplete", _fadeOutTime + 0.2f); }
public void SetMessage(string iconId, string numStr, MessageWinType type, Vector3 position) { EventMultiArgs args = new EventMultiArgs(); args.AddArg("id", iconId); args.AddArg("num", numStr); args.AddArg("type", (int)type); args.AddArg("position", position); CallUIEvent(UIEventID.SET_MESSAGE_WITH_ICON, args); }
/// <summary> /// 打开界面 /// </summary> /// <param name="args"></param> private void UICreateAction(EventMultiArgs args) { WinBg.localScale = new Vector3(1.0f, 1.0f, 1.0f); Hashtable openArg = new Hashtable(); openArg.Add("time", 0.3f); openArg.Add("scale", new Vector3(0.1f, 0.1f, 1.0f)); openArg.Add("easetype", iTween.EaseType.easeOutBack); iTween.ScaleFrom(WinBg.gameObject, openArg); }
public static bool CreateLuaWin(string name, bool byAction = false, EventMultiArgs actionArgs = null) { ControllerBase contro = GetControler(name); if (contro == null) { contro = new LuaWinController(name); _components.Add(name, contro); } return(CreateWin(name, byAction, actionArgs)); }
//连接socket回调 public void OnEventSocketConnectOK(EventMultiArgs args) { bool result = args.GetArg <bool>("result", true); // bool bReconnect = args.GetArg<bool>("reconnecting", false); bool bFirstWaitShow = false; if (result) { // UtilTools.ShowMessage("Socket登陆成功!!!!"); UtilTools.HideWaitWin(WaitFlag.ConnectSocketFirst); UtilTools.HideWaitWin(WaitFlag.ConnectSocketSecond); if (!GameDataMgr.LOGIN_DATA.IsGetGameServerIP) { GameDataMgr.LOGIN_DATA.IsConnectGamerServer = true; //是否为游客 if (GameDataMgr.PLAYER_DATA.IsTouris) { _playerLoginName = GameDataMgr.LOGIN_DATA.lastLoginDeviceUUID; _playerLoginPassWard = ""; // Login(GameDataMgr.LOGIN_DATA.lastLoginDeviceUUID,""); } else { _playerLoginName = GameDataMgr.LOGIN_DATA.lastLoginAccount; _playerLoginPassWard = GameDataMgr.LOGIN_DATA.lastLoginPassword; } Login(_playerLoginName, _playerLoginPassWard); } else { //连接游戏服务器成功 Utils.LogSys.Log("+++++++++++++++连接游戏服务器成功++++++++++++++++++"); GameDataMgr.LOGIN_DATA.IsConnectGamerServer = true; /*if (GameDataMgr.LOGIN_DATA.IsChangeAccountLogin) * { * //切换帐号的登录流程 * // UIManager.GetControler<ChangeAccountController>().ChangeAccount(); * }*/ } } else { if (!GameDataMgr.LOGIN_DATA.IsGetGameServerIP) { Utils.LogSys.LogError("ConectSocket Failed: Select Server"); } else { Utils.LogSys.LogError("ConectSocket Failed: Game Server"); } return; //socket连接超时不处理, 统一由WaitingController控制 } }
/// <summary> /// 连接回调 /// </summary> /// <param name="ar">Ar.</param> public void ConnectCallback(IAsyncResult ar) { // 从state对象获取socket. Socket client = (Socket)ar.AsyncState; bool result = true; try { ClientNetwork._bLoginOut = false; client.EndConnect(ar); // 完成连接. Utils.LogSys.Log("连接成功!"); result = true; Socket handler = client; recieveState = new MsgStream(); if (isDisposed) { return; } recieveState.workSocket = handler; if (readThreadObj != null) { readThreadObj.toStop = true;//让该线程自然结束 } readThreadObj = new ClientSocketReadThread(); readThreadObj.recieveState = recieveState; readThread = new Thread(new ThreadStart(readThreadObj.BeginListen)); //创建一个新的线程专门用于处理监听 readThread.Start(); } catch (SocketException e) { // 连接失败 // TODO: 展示连接失败 Utils.LogSys.Log("连接失败!" + e.Message); result = false; } if (isDisposed) { return; } EventMultiArgs args = new EventMultiArgs(); args.AddArg("result", result); EventSystem.CallEvent(EventID.SOKECT_CONNECT_RESULT, args); }
private void UIDestroyAction(EventMultiArgs args) { WinBg.localScale = new Vector3(1.0f, 1.0f, 1.0f); Hashtable closeArg = new Hashtable(); closeArg.Add("time", 0.3f); closeArg.Add("scale", new Vector3(0.1f, 0.1f, 1.0f)); closeArg.Add("easetype", iTween.EaseType.easeInBack); closeArg.Add("oncomplete", "OnDestroyActoinComplete"); closeArg.Add("oncompletetarget", gameObject); iTween.ScaleTo(WinBg.gameObject, closeArg); }
/// <summary> /// 打开 /// </summary> public void OpenQueueLogin(uint queue, uint enterSpeed) { if (winObject) { _mono.UpdateQueue(queue, enterSpeed); return; } var msg = new EventMultiArgs(); msg.AddArg("queue", queue); msg.AddArg("enterSpeed", enterSpeed); UIManager.CreateWin(UIName.QUEUE_LOGIN_WIN); CallUIEvent(UPDATE_SHOW, msg); }
// Update 每帧调用一次 void Update() { if (Mathf.Abs(_nTime) <= 0.01f)//若时间太短,不做表现,直接设值。 { float to_value = _startValue + _addValue; to_value -= Mathf.Floor(to_value); _bar.value = to_value; CompleteCallback(); Destroy(this); return; } _runningTime += Time.deltaTime; float percentage = Mathf.Clamp01(_runningTime / _nTime); float tempValue = _startValue + _addValue * percentage; float toValue = tempValue - Mathf.Floor(tempValue); if (tempValue > 0f) { _bar.value = toValue; } else { _bar.value = 1 + toValue; } UpdateCallback(); if (lastValue > 100f) { } else if ((_addValue > 0f && (lastValue - toValue) > 0f) || (_addValue < 0f && (lastValue - toValue) < 0f)) { if (_onFullParams == null) { _onFullParams = new EventMultiArgs(); } EventMultiArgs args = (EventMultiArgs)_onFullParams; args.AddArg("fullTimes", Mathf.FloorToInt(tempValue)); FullCallback(); } lastValue = toValue; if (Mathf.Abs(_runningTime) > Mathf.Abs(_nTime)) { //[[结束]] CompleteCallback(); Destroy(this); } }
/// <summary> /// 执行UI事件 /// </summary> /// <param name="eventID">事件id</param> /// <param name="de">响应函数</param> public void CallUIEvent(short eventID, EventMultiArgs args) { if (args == null) { args = new EventMultiArgs(); } args.AddArg("UI_EVENT_ID", eventID); if (!winObject) { eventCachePool.SaveUIEvent(args); } else { eventCachePool.RunUIEvent(args); } }
public static void DestroyWin(string name, bool byAction = false, EventMultiArgs actionArgs = null) { ControllerBase contro = GetControler(name); UILevel eLevel = contro.ELevel; contro._destroyByActionArgs = actionArgs; if (contro._needSceneHide || contro._needSceneBlur) { AutoSceneHide(name); } if (contro.DestroyWin(byAction)) { UnRecordShowingWin(name, eLevel); contro.UnloadUnusedResources(); //AssetManager.getInstance().UnloadUnusedResourcesAssets(); } }
public void ChangePlatform(object obj) { EventMultiArgs func = obj as EventMultiArgs; string platform = func.GetArg <string>("platform"); _curPlatform = platform; _log = ""; _error = ""; _curVersion = ""; _savedPath = ""; //_strVersionXMLUrl = ""; _sProgramVersion = ""; _sResultDirName = ""; _sResultDirName = platform; _strVersionXMLUrl = string.Format(_strVersionXMLUrl_format, version_dir, platform); Init(_curPlatform); }
void ChangeSpecialType(object param) { EventMultiArgs args = (EventMultiArgs)param; ESpecialType specialType = args.GetArg <ESpecialType>("specialType"); ItemDepthConfig target = args.GetArg <ItemDepthConfig>("target"); target.SetSpecialType(specialType); if (specialType != ESpecialType.Auto) { target.SetIgnor(true); } else { target.SetIgnor(false); } AddItemConfig(target); }
/// <summary> /// 有条件OK了(用于有参数的回调) /// </summary> /// <param name="conditionID"></param> /// <param name="eventCallback"></param> public void ConditionOK(int conditionID, BothCallbackArgs eventCallback, EventMultiArgs args) { if (conditionID == 1) { _bCondition1 = true; } else if (conditionID == 2) { _bCondition2 = true; } if (_bCondition1 && _bCondition2) { if (eventCallback != null) { eventCallback(args); } } }
void OnEventSetText(EventMultiArgs args) { string text = args.GetArg <string>("text"); string color = args.GetArg <string>("color"); string alignment = args.GetArg <string>("alignment"); int callbackCount = args.GetArg <int>("callbackCount"); string toShowText = "[" + color + "]" + text + "[-]"; UIWidget uiWidget = labelTipText.GetComponent <UIWidget>(); if (alignment == "Center") { uiWidget.pivot = UIWidget.Pivot.Top; } else if (alignment == "Left") { uiWidget.pivot = UIWidget.Pivot.TopLeft; } labelTipText.text = toShowText; labelTipText.alignment = (labelTipText.printedSize.y > labelTipText.defaultFontSize + labelTipText.spacingY) ? NGUIText.Alignment.Left : NGUIText.Alignment.Automatic; }
/// <summary> /// 显示 Tips 窗口 /// args 参数内容: /// Name:名称; /// Icon:图标; /// Des:描述; /// 存在 Position,则按 Position 指定位置显示 /// 附加属性 key 以 L 开头,key[1] = 'U' 带下划线,不需要下划线时填非 'U' 字符; /// key[2] = 'L'、'R'、'C' 对齐方式; /// AutoHide:int 存在为自动隐藏; Position:Vector3 位置信息; /// </summary> /// <param name="args"></param> private void OnEventSetContent(EventMultiArgs args) { var dic = args.GetDictionary(); var labels = dic.Where(n => n.Key[0] == 'L' && n.Key != "Level").ToList(); var transObj = dic["TransObj"] as Transform; // TODO: 存在 Position,则按 Position 指定位置显示 object pos; SetContentWithoutIcon(ref dic, ref labels); if (dic.TryGetValue("Position", out pos)) { _itemBg.position = (Vector3)pos; } else { GetPos(transObj); } object offset; if (dic.TryGetValue("OffSet", out offset)) { Vector2 vOffSet = (Vector2)offset; _itemBg.position = new Vector3(_itemBg.position.x + vOffSet.x, _itemBg.position.y + vOffSet.y, _itemBg.position.z); } //TODO: 设置是否自动隐藏自动隐藏 if (dic.ContainsKey("AutoHide")) { _btnClose.SetActive(false); FadeWin(); } var hasIcon = dic.ContainsKey("Icon"); /*if (hasIcon) { * SetContentWithIcon(ref dic, ref labels); * } else { * SetContentWithoutIcon(ref dic, ref labels); * }*/ //StartCoroutine(SetContentAtEndOfFrame(labels, hasIcon)); }
/// <summary> /// 显示提示窗口 /// </summary> /// <param name="text"></param> /// <param name="title"></param> /// <param name="color"></param> /// <param name="alignment">"Left" "Center"</param> /// <param name="okCallbackFunc"></param> /// <param name="cancelCallbackFunc"></param> public void ShowMessageDialog(string text, string color, string alignment, DelegateType.MessageDialogCallback okCallbackFunc, DelegateType.MessageDialogCallback cancleCallbackFunc) { EventMultiArgs args = new EventMultiArgs(); args.AddArg("text", text); args.AddArg("color", color); args.AddArg("alignment", alignment); okCallback = okCallbackFunc; cancleCallback = cancleCallbackFunc; int callbackCount = 0; if (okCallback != null) { callbackCount += 1; } if (cancleCallback != null) { callbackCount += 1; } args.AddArg("callbackCount", callbackCount); CallUIEvent(UIEventID.MESSAGE_DIALOG_SET_TEXT, args); }
private void OnEventSetText(EventMultiArgs args) { string text = args.GetArg <string>("text"); string icon = args.GetArg <string>("icon"); string iconNum = args.GetArg <string>("iconNum"); string alignment = args.GetArg <string>("alignment"); //string type = args.GetArg<string>("moneyKey"); labelTipText.text = text; if (icon.Equals("C104")) { labelTitleText.text = GameText.Format("message_desc2", iconNum); } else if (icon.Equals("C101")) { labelTitleText.text = GameText.Format("message_desc3", iconNum); } else if (icon.Equals("C102")) { labelTitleText.text = GameText.Format("message_desc5", iconNum); } else { labelTitleText.text = GameText.Format("message_desc3", iconNum); } UIWidget uiWidget = labelTipText.GetComponent <UIWidget>(); if (alignment == "Center") { uiWidget.pivot = UIWidget.Pivot.Top; } else if (alignment == "Left") { uiWidget.pivot = UIWidget.Pivot.TopLeft; } }
private void OnEventSetText(EventMultiArgs args) { _showNum++; GameObject go = NGUITools.AddChild(gameObject, _messageBg); string text = args.GetArg <string>("text"); string color = args.GetArg <string>("color"); UILabel label = go.transform.Find("Label").GetComponent <UILabel>(); label.text = color + text; go.GetComponent <UIWidget>().width = (int)label.printedSize.x + 100; go.GetComponent <UIWidget>().height = (int)label.printedSize.y + 21; //以显示的提示向上移动 if (_messageList.Count > 0) { oncomplete(); //GameObject lastGo = _messageList[_messageList.Count - 1].go; //float y = (float)(go.transform.GetComponent<UIWidget>().height + (float)lastGo.GetComponent<UIWidget>().height) / 2 + 4f; //for (int i = 0; i < _messageList.Count; i++) { // MessageInfo item = _messageList[i]; // GameObject oldGo = _messageList[i].go; // float newY = item.y + y; // Hashtable hash = new Hashtable(); // hash.Add("time", 0.3f); // hash.Add("y", newY); // hash.Add("islocal", true); // iTween.MoveTo(oldGo, hash); // item.y = newY; // _messageList[i] = item; //} //_messageList[0].y += 45; } MessageInfo messageInfo = new MessageInfo(go, 0); _messageList.Add(messageInfo); action(go); }
public static void DestroyWinByAction(string name, EventMultiArgs actionArgs = null) { DestroyWin(name, true, actionArgs); }
public static bool CreateWinByAction(string name, EventMultiArgs actionArgs = null) { return(CreateWin(name, true, actionArgs)); }