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); }
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> 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); }
/// <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); }
/// <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="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); }
/// <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); }
// 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> /// 显示提示窗口 /// </summary> /// <param name="text">提示内容</param> /// <param name="icon">游戏币图标名称</param> /// <param name="iconNum">游戏币数量</param> /// <param name="alignment">"Left" "Center"</param> /// <param name="okCallbackFunc"></param> /// <param name="cancelCallbackFunc"></param> public void ShowMessageDialog(string text, MoneyType _type, string iconNum, string alignment, DelegateType.MessageDialogUseMoneyCallBack okCallbackFunc, DelegateType.MessageDialogUseMoneyCallBack cancelCallbackFunc, UseType useType) { EventMultiArgs args = new EventMultiArgs(); useflag = useType; args.AddArg("text", text); args.AddArg("iconNum", iconNum); args.AddArg("alignment", alignment); string icon = "C100"; switch (_type) { case MoneyType.GLOD: icon = "C102"; moneyKey = 102; if (GameDataMgr.PLAYER_DATA.Gold >= ulong.Parse(iconNum)) { isEnough = true; } else { isEnough = false; } break; case MoneyType.DIAMOND: icon = "C104"; moneyKey = 104; if (GameDataMgr.PLAYER_DATA.Diamond >= int.Parse(iconNum)) { isEnough = true; } else { isEnough = false; } break; case MoneyType.SILVER: icon = "C101"; moneyKey = 101; if (GameDataMgr.PLAYER_DATA.Gold >= ulong.Parse(iconNum)) { isEnough = true; } else { isEnough = false; } break; } if (!isEnough) { ItemBaseConfigItem item = ConfigDataMgr.getInstance().ItemBaseConfig.GetDataByKey(moneyKey); if (item != null) { UtilTools.MessageDialog(GameText.Format("message_desc4", item.name)); } return; } okCallback = okCallbackFunc; cancelCallback = cancelCallbackFunc; if (useType != UseType.DefaultType) { string flag = PlayerPrefs.GetString("CheckIsShow" + (int)useType); if (!string.IsNullOrEmpty(flag)) { if (flag == "1") { OnClickOK(); return; } } } UIManager.CreateWinByAction(UIName.MESSAGE_DIALOG_USE_MONEY); args.AddArg("icon", icon); //int callbackCount = 0; //if (okCallback != null) // callbackCount += 1; //if (cancelCallback != null) // callbackCount += 1; //args.AddArg("callbackCount", callbackCount); CallUIEvent(UIEventID.MESSAGE_DIALOG_SET_TEXT, args); }
public virtual void Update() { TimerManager.GetInstance().Trigger(); MsgCallManager.Run(); EventSystem.update(); if (sceneCamera != null) { //点击波纹 if (nguiCamera != null && Input.GetMouseButtonUp(0)) { Vector3 p = Input.mousePosition; if (_clickEffect != null) { Ray uiRay = nguiCamera.ScreenPointToRay(Input.mousePosition); RaycastHit uiHit = new RaycastHit(); if (Physics.Raycast(uiRay, out uiHit, 1000, 1 << LayerMask.NameToLayer("ValidViewArea"))) { _clickEffect.layer = LayerMask.NameToLayer("UI"); _clickEffect.transform.position = uiHit.point; _clickEffect.GetComponent <ParticleSystem>().Play(); } } } if (bCanDrag || bCanClick) { if (_bPressed) { Vector3 mousePose = Input.mousePosition;//cam.ScreenToWorldPoint(Input.mousePosition);//hitt.transform.position; // float offsetX = mousePose.x - _pressedMousePos.x; if (Mathf.Abs(offsetX) >= 10f) { _bDraging = true; } } if (Input.GetMouseButtonDown(0))//点下去 { _pressedMousePos = Input.mousePosition; _bPressed = false; _bDraging = false; clickTarget = null; if (!ClickUI()) //没点到UI { if (bCanClick) { /*if (UIManager.IsWinShow(UIName.BATTLE_SCENE_2D_WIN)) * { * clickTarget = ClickSeaHorizontal(out temp_pos); * } * else * { * clickTarget = ClickScene(out temp_pos); * }*/ clickTarget = ClickScene(out temp_pos); EventMultiArgs args = new EventMultiArgs(); if (clickTarget != null)//有点到东西 { args.AddArg("target", clickTarget); args.AddArg("hitPos", temp_pos); } args.AddArg("mousePos", _pressedMousePos); EventSystem.CallEvent(EventID.PRESS_SCENE_TARGET, args, true); } _bPressed = true; } } else if (Input.GetMouseButtonUp(0))//弹起 { if (!bCanClick) { //不用处理点击事件 } else if (clickTarget == null) { //没点到东西 EventSystem.CallEvent(EventID.PRESS_CANCEL_PRESS, new EventMultiArgs(), true); } else if (!bCanDrag && _bDraging) { //手指正在拖动,不用触发点击事件 EventSystem.CallEvent(EventID.PRESS_CANCEL_PRESS, new EventMultiArgs(), true); } else if (bCanDrag && _dragPath != null && _dragPath.IsDraged()) { //正在拖动,不用触发点击事件 } else if (bCanDrag && _dragInRect != null && _dragInRect.IsDraged()) { //正在拖动,不用触发点击事件 } else { EventMultiArgs args = new EventMultiArgs(); args.AddArg("target", clickTarget); EventSystem.CallEvent(EventID.CLICK_SCENE_TARGET, args, true); } EventSystem.CallEvent(EventID.PRESS_REBOUND_PRESS, new EventMultiArgs(), true); clickTarget = null; _bPressed = false; _bDraging = false; } } } }
//打印panel中的一个atlas的一个sprite void DrawOneItem(ref ItemDepthConfig depthConfig) { float height = 25f; GameObject PanelObj = depthConfig.panel; GameObject obj = depthConfig.target; bool bSelect = !depthConfig.bIgnor; int iDepth = depthConfig.idepth; string sSpecialType = depthConfig.specialType; ESpecialType eSpecial = depthConfig.eSpecial; GUILayout.BeginHorizontal(); GUILayout.Space(30f); bool bSelectNow = EditorGUILayout.Toggle("", bSelect, GUILayout.Width(25f)); if (bSelectNow != bSelect) { depthConfig.SetIgnor(!bSelectNow);//此数据是复制的,不能直接调 AddItemConfig(depthConfig); } bool bPush1 = GUILayout.Button(obj.transform.name, "AS TextArea", GUILayout.Width(120f)); bool bPush2 = GUILayout.Button(depthConfig.strContent, "AS TextArea", GUILayout.Width(200f)); if (bPush1 || bPush2) { GameObject[] objs = new GameObject[1]; objs[0] = obj; Selection.objects = objs; } if (eSpecial == ESpecialType.Other) { string sdepth = GUILayout.TextArea(iDepth.ToString(), GUILayout.Width(60f)); int int_depth = int.Parse(sdepth); if (int_depth != depthConfig.idepth) { depthConfig.SetDepth(int_depth); AddItemConfig(depthConfig); } } else { GUILayout.Box(iDepth.ToString(), GUILayout.Width(60f)); } //特殊处理下拉菜单 if (GUILayout.Button(GetSpecialTypeName(eSpecial), EditorStyles.layerMaskField, GUILayout.Width(250f), GUILayout.MinHeight(height))) { bool isSelect = false; GenericMenu menu = new GenericMenu(); EventMultiArgs args = new EventMultiArgs(); args.AddArg("target", depthConfig); args.AddArg("specialType", ESpecialType.Auto); if (sSpecialType == "Auto") { isSelect = true; } menu.AddItem(new GUIContent("Auto"), isSelect, ChangeSpecialType, args); isSelect = false; if (sSpecialType == "Depth-1") { isSelect = true; } EventMultiArgs args2 = new EventMultiArgs(); args2.AddArg("target", depthConfig); args2.AddArg("specialType", ESpecialType.Depth0); menu.AddItem(new GUIContent("-1:最底"), isSelect, ChangeSpecialType, args2); isSelect = false; if (sSpecialType == "Depth99") { isSelect = true; } EventMultiArgs args3 = new EventMultiArgs(); args3.AddArg("target", depthConfig); args3.AddArg("specialType", ESpecialType.Depth99); menu.AddItem(new GUIContent("99:Common_1顶层"), isSelect, ChangeSpecialType, args3); isSelect = false; if (sSpecialType == "Depth199") { isSelect = true; } EventMultiArgs args4 = new EventMultiArgs(); args4.AddArg("target", depthConfig); args4.AddArg("specialType", ESpecialType.Depth199); menu.AddItem(new GUIContent("199:界面图集顶层"), isSelect, ChangeSpecialType, args4); isSelect = false; if (sSpecialType == "Depth299") { isSelect = true; } EventMultiArgs args5 = new EventMultiArgs(); args5.AddArg("target", depthConfig); args5.AddArg("specialType", ESpecialType.Depth299); menu.AddItem(new GUIContent("299:Common_2顶层"), isSelect, ChangeSpecialType, args5); isSelect = false; if (sSpecialType == "Depth399") { isSelect = true; } EventMultiArgs args6 = new EventMultiArgs(); args6.AddArg("target", depthConfig); args6.AddArg("specialType", ESpecialType.Depth399); menu.AddItem(new GUIContent("399:图标图集顶层"), isSelect, ChangeSpecialType, args6); isSelect = false; if (sSpecialType == "Depth499") { isSelect = true; } EventMultiArgs args7 = new EventMultiArgs(); args7.AddArg("target", depthConfig); args7.AddArg("specialType", ESpecialType.Depth499); menu.AddItem(new GUIContent("499:Common_3顶层"), isSelect, ChangeSpecialType, args7); isSelect = false; if (sSpecialType == "Other") { isSelect = true; } EventMultiArgs args8 = new EventMultiArgs(); args8.AddArg("target", depthConfig); args8.AddArg("specialType", ESpecialType.Other); menu.AddItem(new GUIContent("Other"), isSelect, ChangeSpecialType, args8); menu.ShowAsContext(); } GUILayout.Space(30f); GUILayout.EndHorizontal(); }
//绘制窗口时调用 void OnGUI() { GUILayout.Space(20f); GUILayout.BeginHorizontal(); GUILayout.Label("选择平台:"); //不同平台 if (GUILayout.Button(_curPlatform, EditorStyles.layerMaskField, GUILayout.MaxWidth(450f), GUILayout.MinHeight(30f))) { if (_bIniting) { return; } if (_bSaving) { return; } bool isSelect = false; GenericMenu menu = new GenericMenu(); for (int i = 0; i < _listPlatform.Count; i++) { isSelect = false; EventMultiArgs args = new EventMultiArgs(); args.AddArg("platform", _listPlatform[i]); if (_curPlatform != null && _curPlatform.Equals(_listPlatform[i])) { isSelect = true; } menu.AddItem(new GUIContent(_listPlatform[i]), isSelect, ChangePlatform, args); } menu.ShowAsContext(); } GUILayout.EndHorizontal(); //输入框控件 //GUILayout.Space(5f); GUILayout.Label("外部版本号:" + _sProgramVersion + " 本地版本号:" + ClientDefine.LOCAL_PROGRAM_VERSION, GUILayout.MinHeight(30f)); //输入框控件 //GUILayout.Space(5f); GUILayout.Label("资源包编号:" + _curVersion, GUILayout.MinHeight(30f)); //开始生成目录 if (_savedPath == null) { _savedPath = ""; } //GUILayout.Space(5f); GUILayout.BeginHorizontal(); GUILayout.Label("资源包生成目录:"); if (GUILayout.Button("打开", GUILayout.MinHeight(20f), GUILayout.MaxWidth(100f))) { if (_savedPath != "") { System.IO.Directory.CreateDirectory(_savedPath); System.IO.File.SetAttributes(_savedPath, FileAttributes.Normal); EditorUtility.RevealInFinder(_savedPath); } } GUILayout.EndHorizontal(); GUILayout.TextArea(_savedPath, GUILayout.MinHeight(50f)); //打Log if (_log == null) { _log = ""; } GUILayout.Space(20f); GUILayout.Label("LOG:"); GUILayout.TextArea(_log, GUILayout.MinHeight(50f)); //打Log if (_error == null) { _error = ""; } GUILayout.Space(20f); GUILayout.Label("错误:"); GUIStyle style = new GUIStyle(); style.normal.textColor = new Color(1, 0, 0); //设置字体颜色的 style.wordWrap = true; style.fixedWidth = 480f; style.contentOffset = new Vector2(10f, 0f); style.fontSize = 20; GUILayout.TextArea(_error, style, GUILayout.MinHeight(140f)); //开始生成 GUILayout.Space(20f); if (GUILayout.Button("开始生成", GUILayout.MinHeight(30f))) { if (_bIniting) { return; } if (_bSaving) { return; } if (_error != null && _error != "") { this.ShowNotification(new GUIContent("请先处理错误!")); return; } if (_curPlatform == null || _curPlatform == "") { this.ShowNotification(new GUIContent("请先选择平台!")); return; } if (!Directory.Exists(GetBakeUpAssetsPath())) { System.IO.Directory.CreateDirectory(GetBakeUpAssetsPath()); // _error = "备份目录不存在: " + GetBakeUpAssetsPath(); // this.ShowNotification(new GUIContent("备份目录不存在!")); // return; } string[] files = Directory.GetFiles(GetBakeUpAssetsPath(), "*.*", SearchOption.AllDirectories); if (files.Length <= 99) { _error = "备份目录是空的, 或者备份不完整: " + GetBakeUpAssetsPath(); this.ShowNotification(new GUIContent("备份目录是空的, 或者备份不完整!")); return; } //清除names //customer.clearAllAssetbundlesName(); //生成差异文件的names //customer.collectXMLAssetsPath(); // //customer.collectUITextureAssetsPath(); //打包assetbundles //customer.collectAllAssetbundles(); //生成内更资源目录 customer.createPersistentPathXML(); AssetDatabase.Refresh(); //开始生成版本包 StartCreatePackage(); } //文本框显示鼠标在窗口的位置 // EditorGUILayout.LabelField("鼠标在窗口的位置", Event.current.mousePosition.ToString()); // // if (GUILayout.Button("关闭窗口", GUILayout.Width(200))) // { // //关闭窗口 // this.Close(); // } }