public static void Init(string logPath, string dataPath) { s_IsInited = true; s_LogicLogger.Init(logPath); HomePath.CurHomePath = dataPath; GlobalVariables.Instance.IsDebug = false; FileReaderProxy.MakeSureAllHandlerRegistered(); LogSystem.OnOutput = (Log_Type type, string msg) => { s_LogicLogger.Log("{0}", msg); }; // GfxSystem GfxSystem.Init(); GfxSystem.SetLogicInvoker(s_LogicThread); GfxSystem.SetLogicLogCallback((bool isError, string format, object[] args) => { if (isError) { LogSystem.Error(format, args); } else { LogSystem.Info(format, args); } }); LogicSystem.LogFromGfx("GameControler.Init"); GfxSystem.SetGameLogicNotification(GameLogicNotification.Instance); GfxModule.Skill.GfxSkillSystem.Instance.Init(); }
public void Execute(int actor_id) { if (!WorldSystem.Instance.IsPureClientScene()) { return; } SharedGameObjectInfo share_info = LogicSystem.GetSharedGameObjectInfo(actor_id); if (share_info == null) { return; } Vector3 actor_pos = new Vector3(share_info.X, share_info.Y, share_info.Z); Vector3 assit_pos = CaclEndPos(actor_pos); UnityEngine.Vector3 end_pos = new UnityEngine.Vector3(assit_pos.X, assit_pos.Y, assit_pos.Z); bool ret = IsFadeIn(end_pos); if (ret) { TriggerLogic(share_info.LinkId); } else { m_CurNpcActorId = share_info.m_ActorId; LogicSystem.SendStoryMessage("playermovetopos", end_pos.x, end_pos.y, end_pos.z); } }
public static void StopLogic() { LogicSystem.LogFromGfx("GameControler.StopLogic"); s_LogicThread.Stop(); LobbyNetworkSystem.Instance.QuitClient(); NetworkSystem.Instance.QuitClient(); }
public static void Release() { LogicSystem.LogFromGfx("GameControler.Release"); WorldSystem.Instance.Release(); EntityManager.Instance.Release(); NetworkSystem.Instance.Release(); GfxSystem.Release(); s_LogicLogger.Dispose(); }
public void UpdateIpAndChannelAndDeviceid(string ip, string channel, string deviceid) { LogicSystem.PublishLogicEvent("ge_set_ip_and_channel", "client", ip, channel); if (channel.Length > 0) { info.gamechannel = channel; } if (deviceid.Length > 0) { info.deviceid = deviceid; } }
public void Publish(string ev_name, string group, params object[] parameters) { try { if (RunInLogicThread) { LogSystem.Debug("Publish {0} {1}", ev_name, group); } else { LogicSystem.LogFromLogic("Publish {0} {1}", ev_name, group); } Delegate d; string key = group + '#' + ev_name; if (subscribers_.TryGetValue(key, out d)) { if (null == d) { if (RunInLogicThread) { LogSystem.Error("Publish {0} {1}, Subscriber is null, Remove it", ev_name, group); } else { LogicSystem.LogErrorFromLogic("Publish {0} {1}, Subscriber is null, Remove it", ev_name, group); } subscribers_.Remove(key); } else { d.DynamicInvoke(parameters); } } } catch (Exception ex) { if (RunInLogicThread) { LogSystem.Error("PublishSubscribe.Publish({0},{1}) exception:{2}\n{3}", ev_name, group, ex.Message, ex.StackTrace); } else { LogicSystem.LogErrorFromLogic("PublishSubscribe.Publish({0},{1}) exception:{2}\n{3}", ev_name, group, ex.Message, ex.StackTrace); } } }
public void Tick() { if (m_CurNpcActorId > 0) { SharedGameObjectInfo share_info = LogicSystem.GetSharedGameObjectInfo(m_CurNpcActorId); if (share_info != null) { ArkCrossEngine.Vector3 actor_pos = new ArkCrossEngine.Vector3(share_info.X, share_info.Y, share_info.Z); ArkCrossEngine.Vector3 assit_pos = CaclEndPos(actor_pos); UnityEngine.Vector3 end_pos = new UnityEngine.Vector3(assit_pos.X, assit_pos.Y, assit_pos.Z); bool ret = IsFadeIn(end_pos); if (ret) { m_CurNpcActorId = 0; TriggerLogic(share_info.LinkId); } } } }
public void ProxyPublish(string ev_name, string group, params object[] parameters) { ProxyPublishData arg = new ProxyPublishData(); arg.m_EventName = ev_name; arg.m_Group = group; arg.m_Args = parameters; if (RunInLogicThread) { LogSystem.Debug("ProxyPublish {0} {1}", ev_name, group); } else { LogicSystem.LogFromLogic("ProxyPublish {0} {1}", ev_name, group); } Publish(c_proxy_ev_name, c_proxy_group, arg); }
internal void Init(int resId) { m_SceneResId = resId; LoadSceneData(resId); WorldSystem.Instance.SceneContext.SceneResId = resId; WorldSystem.Instance.SceneContext.IsRunWithRoomServer = (IsPvp || IsMultiPve); m_IsWaitSceneLoad = true; m_IsWaitRoomServerConnect = true; m_IsNoticeException = false; m_IsSuccessEnter = false; Data_Unit unit = m_SceneStaticData.ExtractData(DataMap_Type.DT_Unit, GlobalVariables.GetUnitIdByCampId(NetworkSystem.Instance.CampId)) as Data_Unit; if (null != unit) { m_CameraLookAtX = unit.m_Pos.X; m_CameraLookAtY = unit.m_Pos.Y; m_CameraLookAtZ = unit.m_Pos.Z; } CalculateDropOut(); LogicSystem.LogFromLogic("SceneResource.Init {0}", resId); }
public static void InitLogic() { LogicSystem.LogFromGfx("GameControler.InitLogic"); EntityManager.Instance.Init(); WorldSystem.Instance.Init(); ArkProfiler.Start("WorldSystem.Instance.LoadData"); WorldSystem.Instance.LoadData(); ArkProfiler.Stop("WorldSystem.Instance.LoadData"); GfxModule.Impact.GfxImpactSystem.Instance.Init(); ClientScriptSystem.Instance.Init(); //GmCommands.ClientGmStorySystem.Instance.Init(); PlayerControl.Instance.Init(); LobbyNetworkSystem.Instance.Init(s_LogicThread); NetworkSystem.Instance.Init(); AiViewManager.Instance.Init(); SceneLogicViewManager.Instance.Init(); ImpactViewManager.Instance.Init(); }
internal void Release() { LogicSystem.LogFromLogic("SceneResource.Release"); }
internal void CleanupResourcePool() { for (LinkedListNode <UsedResourceInfo> node = m_UsedResources.FirstValue; null != node;) { UsedResourceInfo resInfo = node.Value; if (!m_PreloadResources.Contains(resInfo.m_ResId)) { node = node.Next; RemoveFromUsedResources(resInfo.m_ObjId); resInfo.Recycle(); } else { node = node.Next; } } foreach (KeyValuePair <int, Queue <Object> > pair in m_UnusedResources) { int key = pair.Key; if (m_PreloadResources.Contains(key)) { continue; } Queue <Object> queue = pair.Value; queue.Clear(); } foreach (KeyValuePair <string, Object> pair in m_LoadedPrefabs) { string key = pair.Key; Object obj = pair.Value; if (null != obj) { try { int instId = obj.GetInstanceID(); if (!m_PreloadResources.Contains(instId)) { m_WaitDeleteLoadedPrefabEntrys.Add(key); } } catch (System.Exception ex) { m_WaitDeleteLoadedPrefabEntrys.Add(key); LogicSystem.LogErrorFromLogic("Exception:{0} stack:{1}", ex.Message, ex.StackTrace); } } else { m_WaitDeleteLoadedPrefabEntrys.Add(key); } } for (int i = 0; i < m_WaitDeleteLoadedPrefabEntrys.Count; i++) { m_LoadedPrefabs.Remove(m_WaitDeleteLoadedPrefabEntrys[i]); } /* * foreach (string key in m_WaitDeleteLoadedPrefabEntrys) { * m_LoadedPrefabs.Remove(key); * }*/ m_WaitDeleteLoadedPrefabEntrys.Clear(); Resources.UnloadUnusedAssets(); }
private void TouchHandle(int what, GestureArgs e) { try { UserInfo playerself = WorldSystem.Instance.GetPlayerSelf(); if (null == playerself || null == e) { return; } CharacterView view = EntityManager.Instance.GetUserViewById(playerself.GetId()); if (null != playerself.SkillController && playerself.SkillController.GetSkillControlMode() != SkillControlMode.kTouch) { return; } if ((int)TouchEvent.Cesture == what) { string ename = e.name; if (GestureEvent.OnSingleTap.ToString() == ename) { if (EnableMoveInput) { if (WorldSystem.Instance.IsPureClientScene() || WorldSystem.Instance.IsPveScene()) { if (e.selectedObjID < 0) { playerself.SkillController.AddBreakSkillTask(); if (InputType.Touch == e.inputType) { FindPath(new Vector3(e.airWelGamePosX, e.airWelGamePosY, e.airWelGamePosZ)); } else if (InputType.Joystick == e.inputType) { UpdateMoveState(playerself, new Vector3(e.airWelGamePosX, e.airWelGamePosY, e.airWelGamePosZ), e.towards); } UpdateTowards(playerself, e.towards); } else { Combat(playerself, e.selectedObjID, e.attackRange); } m_lastSelectObjId = e.selectedObjID; /// // GfxSystem.PublishGfxEvent("Op_InputEffect", "Input", GestureEvent.OnSingleTap, e.airWelGamePosX, e.airWelGamePosY, e.airWelGamePosZ, e.selectedObjID < 0 ? false : true, true); } else if (WorldSystem.Instance.IsPvpScene() || WorldSystem.Instance.IsMultiPveScene()) { if (e.selectedObjID < 0) { if (InputType.Touch == e.inputType) { NetworkSystem.Instance.SyncPlayerMoveToPos(new Vector3(e.airWelGamePosX, e.airWelGamePosY, e.airWelGamePosZ)); } else if (InputType.Joystick == e.inputType) { UpdateMoveState(playerself, new Vector3(e.airWelGamePosX, e.airWelGamePosY, e.airWelGamePosZ), e.towards); playerself.SkillController.AddBreakSkillTask(); } } else { NetworkSystem.Instance.SyncPlayerMoveToAttack(e.selectedObjID, e.attackRange); } } } } else if (GestureEvent.OnFingerMove.ToString() == ename) { if (EnableMoveInput) { if (view.ObjectInfo.IsGfxMoveControl && !view.ObjectInfo.IsGfxRotateControl) { UpdateTowards(playerself, e.towards); } } } else if (GestureEvent.OnSkillStart.ToString() == ename) { if (null != playerself) { UserAiStateInfo info = playerself.GetAiStateInfo(); if ((int)AiStateId.Move == info.CurState) { StopFindPath(playerself, info); } } } else if (GestureEvent.OnEasyGesture.ToString() == ename) { Vector3 targetpos = new Vector3(e.startGamePosX, e.startGamePosY, e.startGamePosZ); if (Vector3.Zero != targetpos) { PushSkill(playerself, targetpos, e.attackRange); } } } } catch (Exception ex) { LogicSystem.LogFromGfx("[Error]:Exception:{0}\n{1}", ex.Message, ex.StackTrace); } }
public static void StartLogic() { LogicSystem.LogFromGfx("GameControler.StartLogic"); s_LogicThread.Start(); }