public static CommonEvent GenerateCommonEvent005() { var result = new CommonEvent { Id = 5, BootCondition = new CommonEventBootCondition { CommonEventBootType = CommonEventBootType.Auto, LeftSide = 2000004, Operation = CriteriaOperator.Above, RightSide = 10 }, NumberArgsLength = 0, StrArgsLength = 0, Name = "コモンイベント005", EventCommands = new EventCommandList( new List <IEventCommand> { EventCommandFactory.CreateCommandString("[0][0,0]<0>()()"), }), Description = "", Memo = "", LabelColor = CommonEventLabelColor.Green, FooterString = "", }; return(result); }
public void removeListener() { SocketEventHandle.getInstance().cardChangeNotice -= cardChangeNotice; CommonEvent.getInstance().DisplayBroadcast -= gameBroadcastNotice; SocketEventHandle.getInstance().contactInfoResponse -= contactInfoResponse; // SocketEventHandle.getInstance ().gameBroadcastNotice -= gameBroadcastNotice; }
void OnApplicationPause(bool pauseStatus) { GameManager.Instance.EnableDelayCheck(!pauseStatus); if (pauseStatus) { AppPauseBeforeScene = Application.loadedLevelName; isLoadingScene = StageMgr.Loading; Application.targetFrameRate = 1; leaveTime_ = Time.realtimeSinceStartup; CommonEvent.ExcuteAppPause(); } else { Application.targetFrameRate = 30; CommonEvent.ExcuteAppResume(); if (StageMgr.Loading) { StageMgr.OnSceneLoaded += CheckReconnection; } else { CheckReconnection(StageMgr.Scene_name); } } }
void Start() { SocketEventHandle.getInstance().giftResponse += giftResponse; CommonEvent.getInstance().prizeCountChange += prizeCountChange; CustomSocket.getInstance().sendMsg(new GetGiftRequest("0")); choujiangNum.text = GlobalDataScript.loginResponseData.account.prizecount + ""; }
/// <summary> /// 初始化好友、群组、消息列表 /// kind=1: 好友 /// kind=2:群组 /// kind=3:消息 /// </summary> private void RunVirtualMessage() { CommonEvent.EmitAddNewFriendEvent("好友1", "*****@*****.**", new Bitmap(System.Environment.CurrentDirectory + "\\initImage.png"), true); CommonEvent.EmitAddNewFriendEvent("好友2", "*****@*****.**", new Bitmap(System.Environment.CurrentDirectory + "\\initImage.png"), true); CommonEvent.EmitAddNewFriendEvent("好友3", "*****@*****.**", new Bitmap(System.Environment.CurrentDirectory + "\\initImage.png"), true); CommonEvent.EmitAddNewFriendEvent("好友4", "*****@*****.**", new Bitmap(System.Environment.CurrentDirectory + "\\initImage.png"), true); CommonEvent.EmitAddNewFriendEvent("好友5", "*****@*****.**", new Bitmap(System.Environment.CurrentDirectory + "\\initImage.png"), true); CommonEvent.EmitAddNewFriendEvent("好友6", "*****@*****.**", new Bitmap(System.Environment.CurrentDirectory + "\\initImage.png"), true); CommonEvent.EmitAddNewFriendEvent("好友7", "*****@*****.**", new Bitmap(System.Environment.CurrentDirectory + "\\initImage.png"), true); CommonEvent.EmitAddNewFriendEvent("好友8", "*****@*****.**", new Bitmap(System.Environment.CurrentDirectory + "\\initImage.png"), true); CommonEvent.EmitAddNewFriendEvent("好友9", "*****@*****.**", new Bitmap(System.Environment.CurrentDirectory + "\\initImage.png"), true); CommonEvent.EmitAddNewGroupEvent("群聊1", "215204", new Bitmap(System.Environment.CurrentDirectory + "\\initImage.png")); CommonEvent.EmitAddNewGroupEvent("群聊2", "537783", new Bitmap(System.Environment.CurrentDirectory + "\\initImage.png")); CommonEvent.EmitAddNewGroupEvent("群聊3", "5664563", new Bitmap(System.Environment.CurrentDirectory + "\\initImage.png")); CommonEvent.EmitAddNewGroupEvent("群聊4", "2456556", new Bitmap(System.Environment.CurrentDirectory + "\\initImage.png")); CommonEvent.EmitAddNewGroupEvent("群聊5", "21525647", new Bitmap(System.Environment.CurrentDirectory + "\\initImage.png")); CommonEvent.EmitAddNewGroupEvent("群聊6", "21525383", new Bitmap(System.Environment.CurrentDirectory + "\\initImage.png")); CommonEvent.EmitAddNewGroupEvent("群聊7", "215335613", new Bitmap(System.Environment.CurrentDirectory + "\\initImage.png")); CommonEvent.EmitAddNewGroupEvent("群聊8", "215368813", new Bitmap(System.Environment.CurrentDirectory + "\\initImage.png")); CommonEvent.EmitAddNewGroupEvent("群聊9", "215863563", new Bitmap(System.Environment.CurrentDirectory + "\\initImage.png")); CommonEvent.EmitAddNewGroupEvent("群聊10", "21553855", new Bitmap(System.Environment.CurrentDirectory + "\\initImage.png")); CommonEvent.EmitAddNewFriendMessageEvent("*****@*****.**", "你好1", "2018-10-08 21:50:22"); CommonEvent.EmitAddNewFriendMessageEvent("*****@*****.**", "你好2", "2018-10-08 21:50:23"); CommonEvent.EmitAddNewGroupMessageEvent("好友1", "*****@*****.**", "你好1", "2018-10-08 21:50:21", new Bitmap(System.Environment.CurrentDirectory + "\\initImage.png"), "215204"); CommonEvent.EmitAddNewGroupMessageEvent("好友2", "*****@*****.**", "你好2", "2018-10-08 21:50:22", new Bitmap(System.Environment.CurrentDirectory + "\\initImage.png"), "215204"); //好友2不在线 CommonEvent.EmitOnlineChangeEvent("*****@*****.**", false); //好友3不在线 CommonEvent.EmitOnlineChangeEvent("*****@*****.**", false); }
public static void SetReturnValueNoneTest() { var instance = new CommonEvent(); var changedPropertyList = new List <string>(); instance.PropertyChanged += (sender, args) => { changedPropertyList.Add(args.PropertyName); }; var errorOccured = false; try { instance.SetReturnValueNone(); } catch (Exception ex) { logger.Exception(ex); errorOccured = true; } // エラーが発生しないこと Assert.AreEqual(errorOccured, false); // 意図したとおりプロパティ変更通知が発火していること Assert.AreEqual(changedPropertyList.Count, 2); Assert.IsTrue(changedPropertyList[0].Equals(nameof(CommonEvent.ReturnVariableIndex))); Assert.IsTrue(changedPropertyList[1].Equals(nameof(CommonEvent.IsReturnValue))); }
public void reStratGame() { if (GlobalDataScript.isOverByPlayer) { //TipsManagerScript.getInstance ().setTips ("房间已解散,不能重新开始游戏"); closeDialog(); return; } if (GlobalDataScript.surplusTimes > 0) { if (GlobalDataScript.roomVo.gameType == 0) { CustomSocket.getInstance().sendMsg(new GameReadyRequest()); CommonEvent.getInstance().readyGame(); } closeDialog(); } else { //TipsManagerScript.getInstance ().setTips ("游戏局数已经用完,无法重新开始游戏"); closeDialog(); } SoundCtrl.getInstance().playSoundByActionButton(1); }
/// <summary> /// コモンイベント名 /// </summary> /// <param name="readStatus">読み込み経過状態</param> /// <param name="commonEvent">結果格納インスタンス</param> private void ReadCommonEventName(BinaryReadStatus readStatus, CommonEvent commonEvent) { var commonEventName = readStatus.ReadString(); commonEvent.Name = commonEventName.String; readStatus.AddOffset(commonEventName.ByteLength); }
/// <summary> /// メモ /// </summary> /// <param name="readStatus">読み込み経過状態</param> /// <param name="commonEvent">結果格納インスタンス</param> private void ReadMemo(BinaryReadStatus readStatus, CommonEvent commonEvent) { var str = readStatus.ReadString(); commonEvent.Memo = str.String; readStatus.AddOffset(str.ByteLength); }
protected override void OnAwake() { base.OnAwake(); m_EventManager = new EventManager(); SocketEvent = m_EventManager.SocketEvent; CommonEvent = m_EventManager.CommonEvent; }
/// <summary> /// 引数特殊指定 /// </summary> /// <param name="readStatus">読み込み経過状態</param> /// <param name="commonEvent">結果格納インスタンス</param> /// <exception cref="InvalidOperationException">データが仕様と異なる場合</exception> private void ReadSpecialArgDesc(BinaryReadStatus readStatus, CommonEvent commonEvent) { try { var specialArgDescReader = new SpecialArgDescReader(); specialArgDescReader.Read(readStatus); UpdateSpecialNumberArgDesc( specialArgDescReader.NumberArgNameList, specialArgDescReader.NumberArgTypeList, specialArgDescReader.NumberArgStringParamsList, specialArgDescReader.NumberArgNumberParamsList, specialArgDescReader.NumberArgInitValueList, commonEvent ); UpdateSpecialStringArgDesc( specialArgDescReader.StringArgNameList, commonEvent ); } catch (Exception ex) { throw new InvalidOperationException( $"引数特殊指定データが仕様と異なります。(offset:{readStatus.Offset})", ex); } }
public void openFinalOverPanl() { SoundCtrl.getInstance().playSoundUI(); if (GlobalDataScript.finalGameEndVo != null && GlobalDataScript.finalGameEndVo.totalInfo != null && GlobalDataScript.finalGameEndVo.totalInfo.Count > 0) { GameObject obj = PrefabManage.loadPerfab("prefab/Panel_Game_Over"); obj.GetComponent <GameOverScript>().setDisplaContent(1, GlobalDataScript.roomAvatarVoList); obj.transform.SetSiblingIndex(2); if (GlobalDataScript.singalGameOverList.Count > 0) { for (int i = 0; i < GlobalDataScript.singalGameOverList.Count; i++) { //GlobalDataScript.singalGameOverList [i].GetComponent<GameOverScript> ().closeDialog (); Destroy(GlobalDataScript.singalGameOverList [i].GetComponent <GameOverScript>()); Destroy(GlobalDataScript.singalGameOverList [i]); } //int count = GlobalDataScript.singalGameOverList.Count; //for (int i = 0; i < count; i++) { // GlobalDataScript.singalGameOverList.RemoveAt (0); //} GlobalDataScript.singalGameOverList.Clear(); } if (CommonEvent.getInstance().closeGamePanel != null) { CommonEvent.getInstance().closeGamePanel(); } } }
/// <summary> /// メモ前の文字列 /// </summary> /// <param name="readStatus">読み込み経過状態</param> /// <param name="commonEvent">結果格納インスタンス</param> private void ReadBeforeMemoString(BinaryReadStatus readStatus, CommonEvent commonEvent) { var str = readStatus.ReadString(); commonEvent.Description = str.String; readStatus.AddOffset(str.ByteLength); }
public static void SelfVariableNameListTest(bool isNull, bool isError) { var instance = new CommonEvent(); var changedPropertyList = new List <string>(); instance.PropertyChanged += (sender, args) => { changedPropertyList.Add(args.PropertyName); }; var nameList = isNull ? null : new CommonEventSelfVariableNameList(); var errorOccured = false; try { instance.SelfVariableNameList = nameList; } catch (Exception ex) { logger.Exception(ex); errorOccured = true; } // エラーフラグが一致すること Assert.AreEqual(errorOccured, isError); // 意図したとおりプロパティ変更通知が発火していること if (errorOccured) { Assert.AreEqual(changedPropertyList.Count, 0); } else { Assert.AreEqual(changedPropertyList.Count, 1); Assert.IsTrue(changedPropertyList[0].Equals(nameof(CommonEvent.SelfVariableNameList))); } }
/// <summary> /// 检查timing是否合法. /// </summary> public static void Examine(this EventContainer container) { var events = container.EventList.GroupBy(k => k.EventType); foreach (var kv in events) { var list = kv.ToArray(); for (var i = 0; i < list.Length - 1; i++) { CommonEvent objNext = list[i + 1]; CommonEvent objNow = list[i]; if (objNow.StartTime > objNow.EndTime) { var info = $"{{{objNow}}}:\r\n" + $"Start time should not be larger than end time."; var arg = new ErrorEventArgs() { Message = info }; container.OnErrorOccured?.Invoke(container, arg); if (!arg.Continue) { return; } ; } if (objNext.StartTime < objNow.EndTime) { var info = $"{{{objNow}}} to {{{objNext}}}:\r\n" + $"The previous object's end time should be larger than the next object's start time."; var arg = new ErrorEventArgs { Message = info }; container.OnErrorOccured?.Invoke(container, arg); if (!arg.Continue) { return; } } } } if (!(container is Element e)) { return; } foreach (var item in e.LoopList) { Examine(item); } foreach (var item in e.TriggerList) { Examine(item); } }
protected override void OnAwake() { base.OnAwake(); GameEntry.RegisterBaseComponent(this); m_EventManager = new EventManager(); CommonEvent = m_EventManager.CommonEvent; SocketEvent = m_EventManager.SocketEvent; }
/// <summary> /// 返戻セルフ変数インデックス /// </summary> /// <param name="readStatus">読み込み経過状態</param> /// <param name="commonEvent">結果格納インスタンス</param> private void ReadReturnVariableIndex(BinaryReadStatus readStatus, CommonEvent commonEvent) { var index = readStatus.ReadInt(); readStatus.IncreaseIntOffset(); commonEvent.SetReturnVariableIndex(index); }
/// <summary> /// 返戻値の意味 /// </summary> /// <param name="readStatus">読み込み経過状態</param> /// <param name="commonEvent">結果格納インスタンス</param> private void ReadReturnValueDescription(BinaryReadStatus readStatus, CommonEvent commonEvent) { var description = readStatus.ReadString(); readStatus.AddOffset(description.ByteLength); commonEvent.ReturnValueDescription = description.String; }
/// <summary> /// 返戻値 /// </summary> /// <param name="readStatus">読み込み経過状態</param> /// <param name="commonEvent">結果格納インスタンス</param> private void ReadReturnValue(BinaryReadStatus readStatus, CommonEvent commonEvent) { // 返戻値の意味 ReadReturnValueDescription(readStatus, commonEvent); // 返戻セルフ変数インデックス ReadReturnVariableIndex(readStatus, commonEvent); }
/// <summary> /// フッタ文字列 /// </summary> /// <param name="readStatus">読み込み経過状態</param> /// <param name="commonEvent">結果格納インスタンス</param> private void ReadFooterString(BinaryReadStatus readStatus, CommonEvent commonEvent) { var footerString = readStatus.ReadString(); readStatus.AddOffset(footerString.ByteLength); commonEvent.FooterString = footerString.String; }
/// <summary> /// ラベル色 /// </summary> /// <param name="readStatus">読み込み経過状態</param> /// <param name="commonEvent">結果格納インスタンス</param> private void ReadLabelColor(BinaryReadStatus readStatus, CommonEvent commonEvent) { var colorNumber = readStatus.ReadInt(); readStatus.IncreaseIntOffset(); commonEvent.LabelColor = CommonEventLabelColor.FromInt(colorNumber); }
/// <summary> /// 返戻値 /// </summary> /// <param name="status">読み込み経過状態</param> /// <param name="commonEvent">結果格納インスタンス</param> private void ReadReturnValue(FileReadStatus status, CommonEvent commonEvent) { // 返戻値の意味 ReadReturnValueDescription(status, commonEvent); // 返戻セルフ変数インデックス ReadReturnVariableIndex(status, commonEvent); }
/// <summary> /// 文字列引数の数 /// </summary> /// <param name="status">読み込み経過状態</param> /// <param name="commonEvent">結果格納インスタンス</param> private void ReadStringArgLength(FileReadStatus status, CommonEvent commonEvent) { commonEvent.StrArgsLength = status.ReadByte(); status.IncreaseByteOffset(); Logger.Debug(FileIOMessage.SuccessRead(typeof(CommonEventReader), "文字列引数の数", commonEvent.StrArgsLength)); }
/// <summary> /// コモンイベントID /// </summary> /// <param name="status">読み込み経過状態</param> /// <param name="commonEvent">結果格納インスタンス</param> private void ReadCommonEventId(FileReadStatus status, CommonEvent commonEvent) { commonEvent.Id = status.ReadInt(); status.IncreaseIntOffset(); Logger.Debug(FileIOMessage.SuccessRead(typeof(CommonEventReader), "コモンイベントID", commonEvent.Id)); }
private void SetEventCommandsAndMoveEventCommands(CommonEvent commonEvent) { EventCommandsStr eventCommandsStr = new EventCommandsStr(); eventCommandsStr.SetEventCommandsAndMoveEventCommands(commonEvent.EventCommandList, (int)commonEvent.NumEventCommand); EventCommands = eventCommandsStr.EventCommands; MoveEventCommands = eventCommandsStr.MoveEventCommands; }
public void removeListener() { SocketEventHandle.getInstance().cardChangeNotice -= cardChangeNotice; CommonEvent.getInstance().DisplayBroadcast -= gameBroadcastNotice; SocketEventHandle.getInstance().contactInfoResponse -= contactInfoResponse; // SocketEventHandle.getInstance ().gameBroadcastNotice -= gameBroadcastNotice; //SocketEventHandle.getInstance().otherUserJointRoomCallBack -= otherUserJointRoom; SocketEventHandle.getInstance().StartPrepareGameCallBack -= StartPrepareGame; }
void OnDestroy() { NetConnection.Instance.disconnect(); NetConnection.Instance.OnSocketError -= SocketHandler; VersionManager.Instance.finishDownFileEvent -= OnFinishDownFileEvent; VersionManager.Instance.CopyEvent -= OnCopyEvent; ConfigLoader.Instance.parseDataFin_ -= ParseDataFinish; CommonEvent.ExcuteAccountChange(CommonEvent.DefineAccountOperate.LOGOUT); }
//增加服务器返沪数据监听 public void addListener() { SocketEventHandle.getInstance().RoomBackResponse += RoomBackResponse; SocketEventHandle.getInstance().cardChangeNotice += cardChangeNotice; SocketEventHandle.getInstance().contactInfoResponse += contactInfoResponse; // SocketEventHandle.getInstance ().gameBroadcastNotice += gameBroadcastNotice; CommonEvent.getInstance().DisplayBroadcast += gameBroadcastNotice; }
/// <summary> /// イベントコマンド /// </summary> /// <param name="readStatus">読み込み経過状態</param> /// <param name="commonEvent">結果格納インスタンス</param> private void ReadEventCommand(BinaryReadStatus readStatus, CommonEvent commonEvent) { var length = readStatus.ReadInt(); readStatus.IncreaseIntOffset(); var reader = new EventCommandListReader(); commonEvent.EventCommands = reader.Read(readStatus, length); }
private void hostUpdateDrawResponse(ClientResponse response) { int giftTimes = int.Parse(response.message); GlobalDataScript.loginResponseData.account.prizecount = giftTimes; if (CommonEvent.getInstance().prizeCountChange != null) { CommonEvent.getInstance().prizeCountChange(); } }
/// <summary> /// 去除事件绑定 /// </summary> public void DetachEvent(eEventsKey strEventKey, CommonEvent attachEvent) { if (m_dicEvents.ContainsKey(strEventKey)) { //Debug.Log("去除事件绑定 : " + strEventKey); m_dicEvents[strEventKey] -= attachEvent; } else { Debug.LogError("没有这个定义的事件:" + strEventKey); } }
public static async Task FireEvent(CommonEvent json_payload) { Trace.WriteLine($"event {json_payload}"); await Client.SendAsync(new EventData(ASCIIEncoding.ASCII.GetBytes(JsonConvert.SerializeObject(json_payload)))); }