Ejemplo n.º 1
0
        private void OnResourceUpdateSuccessGameEvent(GameEventBase gameEventBase)
        {
            ResourceUpdateSuccessGameEvent resourceUpdateSuccessGameEvent = (ResourceUpdateSuccessGameEvent)gameEventBase;

            Debug.Log(resourceUpdateSuccessGameEvent.Name + "更新成功!");
            //todo
        }
Ejemplo n.º 2
0
        private void OnMove(GameEventBase gameEventBase)
        {
            InputMoveGameEvent inputMoveGameEvent = (InputMoveGameEvent)gameEventBase;

            switch (inputMoveGameEvent.MoveDir)
            {
            case MoveDir.Left:
                GameEntry.Camera.SetCameraRotate(0, inputMoveGameEvent.Speed);
                break;

            case MoveDir.Right:
                GameEntry.Camera.SetCameraRotate(1, inputMoveGameEvent.Speed);
                break;

            case MoveDir.Up:
                GameEntry.Camera.SetCameraUpAndDown(1);
                break;

            case MoveDir.Down:
                GameEntry.Camera.SetCameraUpAndDown(0);
                break;
            }
            Vector3 targetDir = deltaVec;

            targetDir = targetDir.GetRotateY(GameEntry.Camera.MainCamera.transform.eulerAngles.y);

            m_MoveComponent.ChangeSetInputMoveDirection(targetDir);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 技能攻击点击
        /// </summary>
        /// <param name="gameEventBase"></param>
        private void OnSkillButtonClick(GameEventBase gameEventBase)
        {
            SkillButtonClickGameEvent skillButtonClickGameEvent = (SkillButtonClickGameEvent)gameEventBase;

            ActiveSkillComponent    activeSkillComponent    = Owner.GetUnitComponent <ActiveSkillComponent>();
            CharacterStateComponent characterStateComponent = Owner.GetUnitComponent <CharacterStateComponent>();

            if (activeSkillComponent == null || characterStateComponent == null)
            {
                return;
            }

            //无法控制状态
            if (characterStateComponent.Get(SpecialStateType.NotInControl))
            {
                return;
            }

            if (skillButtonClickGameEvent.IsNormalClick)
            {
                //skillButtonClickGameEvent.SkillId;
                Debug.Log("原地放技能");
                activeSkillComponent.Verify(skillButtonClickGameEvent.SkillId, (PlayerBase)Owner, null, Trigskill, null, Complate);
            }
            else
            {
                Vector3 targetDir = new Vector3(skillButtonClickGameEvent.Postion.x, 0, skillButtonClickGameEvent.Postion.y);
                targetDir = targetDir.GetRotateY(GameEntry.Camera.MainCamera.transform.eulerAngles.y);
                Owner.SelfTransform.rotation = Quaternion.LookRotation(targetDir);
                Debug.Log("改变方向放技能");
                activeSkillComponent.Verify(skillButtonClickGameEvent.SkillId, (PlayerBase)Owner, null, Trigskill, null, Complate);
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 读取Assetbundle资源文件回调事件
        /// </summary>
        /// <param name="gameEventBase"></param>
        private void LoadAssetFileCallBack(GameEventBase gameEventBase)
        {
            LoadAssetFileEvent loadAssetFileEvent = gameEventBase as LoadAssetFileEvent;

            if (loadAssetFileEvent == null)
            {
                return;
            }
            ResourceLoader resourceLoader = loadAssetFileEvent.Sender as ResourceLoader;

            if (resourceLoader == null)
            {
                return;
            }
            if (resourceLoader != this)
            {
                return;
            }

            byte[] buffer = loadAssetFileEvent.Buffer;
            if (loadAssetFileEvent.Success)
            {
                ParseBytes(buffer);
            }
            else
            {
                string erroemessage = string.Format("can't load assetbundle, the name is '{0}'", loadAssetFileEvent.AssetName);
                OnError(LoadResourceStatus.NotExist, erroemessage);
            }
        }
Ejemplo n.º 5
0
        private void OnLoadSceneSuccess(GameEventBase gameEventBase)
        {
            LoadSceneSuccessGameEvent ne = (LoadSceneSuccessGameEvent)gameEventBase;

            //todo
            m_IsChangeSceneComplete = true;
        }
Ejemplo n.º 6
0
        private void OnSkillCD(GameEventBase gameEventBase)
        {
            SkillCDGameEvent skillCDGameEvent = (SkillCDGameEvent)gameEventBase;

            if (skillCDGameEvent.SkillId == m_SkillData.SkillId)
            {
                if (m_SkillData.SkillId == 10010)
                {
                    m_SkillData.SkillId = 10011;
                    BeginValueCD();
                    return;
                }
                else if (m_SkillData.SkillId == 10011)
                {
                    m_SkillData.SkillId = 10012;
                    BeginValueCD();
                    return;
                }
                else if (m_SkillData.SkillId == 10012)
                {
                    m_SkillData.SkillId = 10010;
                    BeginCD(skillCDGameEvent.CD);
                    return;
                }
                BeginCD(skillCDGameEvent.CD);
            }
        }
Ejemplo n.º 7
0
 /// <summary>
 /// 派发事件,这是线程安全的
 /// </summary>
 /// <param name="sender">事件发送者,一般填this即可</param>
 /// <param name="gameEventBase"></param>
 public void Dispatch(object sender, GameEventBase gameEventBase)
 {
     lock (m_Events)
     {
         gameEventBase.Sender = sender;
         m_Events.Enqueue(gameEventBase);
     }
 }
Ejemplo n.º 8
0
        private void OnLoadDataTableFailure(GameEventBase gameEventBase)
        {
            LoadDataTableFailureGameEvent loadDataTableFailureGameEvent = (LoadDataTableFailureGameEvent)gameEventBase;

            if (loadDataTableFailureGameEvent.UserData != this)
            {
                return;
            }

            Log.Error("Can not load data table '{0}' from '{1}' with error message '{2}'.", loadDataTableFailureGameEvent.DataTableName, loadDataTableFailureGameEvent.DataTableAssetName, loadDataTableFailureGameEvent.ErrorMessage);
        }
Ejemplo n.º 9
0
        /// <summary>
        /// 遥感移动
        /// </summary>
        /// <param name="gameEventBase"></param>
        private void OnRockerMove(GameEventBase gameEventBase)
        {
            RockerMoveGameEvent rockerMoveGameEvent = (RockerMoveGameEvent)gameEventBase;

            deltaVec = new Vector3(rockerMoveGameEvent.Postion.x, 0, rockerMoveGameEvent.Postion.y);

            Vector3 targetDir = deltaVec;

            targetDir = targetDir.GetRotateY(GameEntry.Camera.MainCamera.transform.eulerAngles.y);
            m_MoveComponent.SetInputMoveDirection(targetDir, targetDir.magnitude);
        }
Ejemplo n.º 10
0
 /// <summary>
 /// 事件轮询
 /// </summary>
 internal void OnUpdate(float deltaTime, float unscaledDeltaTime)
 {
     lock (m_Events)
     {
         while (m_Events.Count > 0)
         {
             GameEventBase gameEventBase = m_Events.Dequeue();
             DispatchNow(gameEventBase.Sender, gameEventBase);
         }
     }
 }
Ejemplo n.º 11
0
        private void OnLoadSceneUpdate(GameEventBase gameEventBase)
        {
            LoadSceneUpdateGameEvent ne = (LoadSceneUpdateGameEvent)gameEventBase;

            if (ne.UserData != this)
            {
                return;
            }

            Log.Info("Load scene '{0}' update, progress '{1}'.", ne.SceneAssetName, ne.Progress.ToString("P2"));
        }
Ejemplo n.º 12
0
        private void OnLoadSceneFailure(GameEventBase gameEventBase)
        {
            LoadSceneFailureGameEvent ne = (LoadSceneFailureGameEvent)gameEventBase;

            if (ne.UserData != this)
            {
                return;
            }

            Log.Error("Load scene '{0}' failure, error message '{1}'.", ne.SceneAssetName, ne.ErrorMessage);
        }
Ejemplo n.º 13
0
        private void OnLoadSceneDependencyAsset(GameEventBase gameEventBase)
        {
            LoadSceneDependencyAssetGameEvent ne = (LoadSceneDependencyAssetGameEvent)gameEventBase;

            if (ne.UserData != this)
            {
                return;
            }

            Log.Info("Load scene '{0}' dependency asset '{1}', count '{2}/{3}'.", ne.SceneAssetName, ne.DependencyAssetName, ne.LoadedCount.ToString(), ne.TotalCount.ToString());
        }
Ejemplo n.º 14
0
        private void MainSocketConected(GameEventBase gameEventBase)
        {
            SocketConnectedGameEvent socketConnectedGameEvent = (SocketConnectedGameEvent)gameEventBase;

            if (socketConnectedGameEvent.Socket != GameEntry.Socket.MainSocket)
            {
                return;
            }

            GameEntry.Procedure.SetData <VarInt>(Constant.ProcedureData.NextSceneId, (int)SceneType.SelectRole);
            GameEntry.UI.OpenUIForm(UIFormId.Loading);
        }
Ejemplo n.º 15
0
        private void OnLoadDataTableSuccess(GameEventBase gameEventBase)
        {
            LoadDataTableSuccessGameEvent loadDataTableSuccessGameEvent = (LoadDataTableSuccessGameEvent)gameEventBase;

            if (loadDataTableSuccessGameEvent.UserData != this)
            {
                return;
            }

            m_LoadedFlag[TextUtil.Format("DataTable.{0}", loadDataTableSuccessGameEvent.DataTableName)] = true;
            Log.Info("Load data table '{0}' OK.", loadDataTableSuccessGameEvent.DataTableName);
        }
Ejemplo n.º 16
0
 private void OnReturnSelectRole(GameEventBase gameEventBase)
 {
     if (GameEntry.Data.UserData.RoleLists == null || GameEntry.Data.UserData.RoleLists.Count == 0)
     {
         CurrFsm.SetData <VarInt>(Constant.ProcedureData.NextSceneId, (int)SceneType.LogOn);
         GameEntry.UI.OpenUIForm(UIFormId.Loading);
     }
     else
     {
         GameEntry.UI.OpenUIForm(UIFormId.SelectRole);
     }
 }
Ejemplo n.º 17
0
        private void OnLogOnGameServerReturn(GameEventBase gameEventBase)
        {
            LogOnGameServerReturnGameEvent logOnGameServerReturnGameEvent = (LogOnGameServerReturnGameEvent)gameEventBase;

            if (logOnGameServerReturnGameEvent.RoleCount == 0)
            {
                GameEntry.UI.OpenUIForm(UIFormId.CreateRole);
            }
            else
            {
                GameEntry.UI.OpenUIForm(UIFormId.SelectRole);
            }
        }
Ejemplo n.º 18
0
        /// <summary>
        /// 资源更新失败回调
        /// </summary>
        /// <param name="gameEventBase"></param>
        private void OnResourceUpdateFailureGameEvent(GameEventBase gameEventBase)
        {
            ResourceUpdateFailureGameEvent resourceUpdateFailureGameEvent = (ResourceUpdateFailureGameEvent)gameEventBase;

            Log.Error("资源更新失败" + resourceUpdateFailureGameEvent.DownloadUri + resourceUpdateFailureGameEvent.ErrorMessage);
            Debug.LogError("资源更新失败" + resourceUpdateFailureGameEvent.DownloadUri + resourceUpdateFailureGameEvent.ErrorMessage);

            if (m_AllAssetSize.ContainsKey(resourceUpdateFailureGameEvent.Name))
            {
                m_CurrentUpdateZipLength -= m_AllAssetSize[resourceUpdateFailureGameEvent.Name];
                m_AllAssetSize.Remove(resourceUpdateFailureGameEvent.Name);
            }
            //todo
        }
Ejemplo n.º 19
0
        private void OnILRuntimePreload(GameEventBase gameEventBase)
        {
            ILRuntimePreloadGameEvent ilRuntimePreloadGameEvent = (ILRuntimePreloadGameEvent)gameEventBase;

            if (ilRuntimePreloadGameEvent.Success)
            {
                m_HotfixPreload = true;
                Log.Info("Hotfix preload complete");
            }
            else
            {
                Log.Error("Hotfix preload error");
            }
        }
Ejemplo n.º 20
0
        private void OnZoom(GameEventBase gameEventBase)
        {
            InputZoomGameEvent inputZoomGameEvent = (InputZoomGameEvent)gameEventBase;

            switch (inputZoomGameEvent.ZoomType)
            {
            case ZoomType.In:
                GameEntry.Camera.SetCameraZoom(0);
                break;

            case ZoomType.Out:
                GameEntry.Camera.SetCameraZoom(1);
                break;
            }
        }
Ejemplo n.º 21
0
        private void OnResourceUpdateStartGameEvent(GameEventBase gameEventBase)
        {
            ResourceUpdateStartGameEvent resourceUpdateStartGameEvent = (ResourceUpdateStartGameEvent)gameEventBase;

            Debug.Log(resourceUpdateStartGameEvent.Name + "开始更新!");

            if (!m_AllAssetSize.ContainsKey(resourceUpdateStartGameEvent.Name))
            {
                m_CurrentUpdateZipLength += resourceUpdateStartGameEvent.CurrentLength;
                m_AllAssetSize.Add(resourceUpdateStartGameEvent.Name, resourceUpdateStartGameEvent.CurrentLength);
            }


            //todo
        }
Ejemplo n.º 22
0
        /// <summary>
        /// 资源更新变更回调
        /// </summary>
        /// <param name="gameEventBase"></param>
        private void OnResourceUpdateChangedGameEvent(GameEventBase gameEventBase)
        {
            ResourceUpdateChangedGameEvent resourceUpdateChangedGameEvent = (ResourceUpdateChangedGameEvent)gameEventBase;
            //Debug.Log(resourceUpdateChangedGameEvent.Name);

            //Debug.Log("更新变化!");
            VarInt currentsize = null;

            if (m_AllAssetSize.TryGetValue(resourceUpdateChangedGameEvent.Name, out currentsize))
            {
                m_CurrentUpdateZipLength -= currentsize.Value;
                currentsize.Value         = resourceUpdateChangedGameEvent.CurrentLength;
                m_CurrentUpdateZipLength += currentsize.Value;
            }
            //todo
        }
Ejemplo n.º 23
0
        private void OnSceneMove(GameEventBase gameEventBase)
        {
            InputMoveGameEvent inputMoveGameEvent = (InputMoveGameEvent)gameEventBase;

            switch (inputMoveGameEvent.MoveDir)
            {
            case MoveDir.Left:
                if (TranCam != null)
                {
                    TranCam.Rotate(0, -inputMoveGameEvent.Speed * Time.deltaTime, 0);
                    if (TranCam.localEulerAngles.y > 180)
                    {
                        TranCam.localEulerAngles = new Vector3(0, Mathf.Clamp(TranCam.localEulerAngles.y, 330f, 360f), 0);
                    }
                    else
                    {
                        TranCam.localEulerAngles = new Vector3(0, Mathf.Clamp(TranCam.localEulerAngles.y, 0, 30f), 0);
                    }
                }

                break;

            case MoveDir.Right:
                if (TranCam != null)
                {
                    TranCam.Rotate(0, inputMoveGameEvent.Speed * Time.deltaTime, 0);
                    if (TranCam.localEulerAngles.y > 180)
                    {
                        TranCam.localEulerAngles = new Vector3(0, Mathf.Clamp(TranCam.localEulerAngles.y, 330f, 360f), 0);
                    }
                    else
                    {
                        TranCam.localEulerAngles = new Vector3(0, Mathf.Clamp(TranCam.localEulerAngles.y, 0, 30f), 0);
                    }
                }
                break;

            case MoveDir.Up:
                break;

            case MoveDir.Down:
                break;
            }
        }
Ejemplo n.º 24
0
        /// <summary>
        /// 遥感中心点点击
        /// </summary>
        /// <param name="gameEventBase"></param>
        private void OnRockerInClick(GameEventBase gameEventBase)
        {
            RockerInClickGameEvent rockerInClickGameEvent = (RockerInClickGameEvent)gameEventBase;
            MountsComponent        mountsComponent        = Owner.GetUnitComponent <MountsComponent>();

            if (mountsComponent == null)
            {
                return;
            }

            if (mountsComponent.IsRide)
            {
                mountsComponent.HideMounts();
            }
            else
            {
                mountsComponent.ShowMounts(UnityEngine.Random.Range(1, 10));
            }
        }
Ejemplo n.º 25
0
        /// <summary>
        /// 删除角色成功事件
        /// </summary>
        /// <param name="gameEventBase"></param>
        private void OnDeleateRoleSuccess(ZJY.Framework.GameEventBase gameEventBase)
        {
            for (int i = GameEntry.Data.UserData.RoleLists.Count - 1; i >= 0; i--)
            {
                if (GameEntry.Data.UserData.RoleLists[i].RoleId == m_CurrSelectRoleId)
                {
                    GameEntry.Data.UserData.RoleLists.RemoveAt(i);
                }
            }

            if (GameEntry.Data.UserData.RoleLists.Count == 0)
            {
                CreateRole();
            }
            else
            {
                SetUI(GameEntry.Data.UserData.RoleLists);
                SetSelectRole(GameEntry.Data.UserData.RoleLists[0].RoleId);
            }
        }
Ejemplo n.º 26
0
        /// <summary>
        /// 立刻派发事件,这不是线程安全的
        /// </summary>
        /// <param name="sender">事件发送者,一般填this即可</param>
        /// <param name="gameEventBase">事件内容</param>
        public void DispatchNow(object sender, GameEventBase gameEventBase)
        {
            gameEventBase.Sender = sender;
            LinkedList <OnActionHandler> lstHandler = null;

            if (m_EventHandlers.TryGetValue(gameEventBase.Id, out lstHandler) && lstHandler.Count > 0)
            {
                LinkedListNode <OnActionHandler> current = lstHandler.First;
                while (current != null)
                {
                    LinkedListNode <OnActionHandler> next = current.Next;
                    if (current.Value != null)
                    {
                        current.Value(gameEventBase);
                    }
                    current = next;
                }
            }

            GameEntry.Pool.UnSpawnClassObject(gameEventBase);
        }
Ejemplo n.º 27
0
        private void OnLoadSceneSuccess(GameEventBase gameEventBase)
        {
            LoadSceneSuccessGameEvent ne = (LoadSceneSuccessGameEvent)gameEventBase;

            if (ne.UserData != this)
            {
                return;
            }

            Log.Info("Load scene '{0}' OK.", ne.SceneAssetName);

            if (m_BackgroundMusicId > 0)
            {
                GameEntry.Sound.PlayMusic(m_BackgroundMusicId);
            }
            if (InitForm.Instance != null)
            {
                InitForm.Instance.DestroySelf();
            }

            m_IsChangeSceneComplete = true;
        }
Ejemplo n.º 28
0
        /// <summary>
        /// 普通攻击点击
        /// </summary>
        /// <param name="gameEventBase"></param>
        private void OnNormalAttakClick(GameEventBase gameEventBase)
        {
            Debug.Log("普攻");
            CharacterStateComponent characterStateComponent = Owner.GetUnitComponent <CharacterStateComponent>();
            ActiveSkillComponent    activeSkillComponent    = Owner.GetUnitComponent <ActiveSkillComponent>();

            if (characterStateComponent.Get(SpecialStateType.NotInControl))
            {
                return;
            }

            int skillId = 0;

            if (characterStateComponent.Get(SpecialStateType.PowerAttack))
            {
                skillId = m_SkillIndex[powerindex];
                powerindex++;
                if (powerindex > 7)
                {
                    powerindex = 5;
                }
            }
            else
            {
                skillId = m_SkillIndex[index];
                index++;
                if (index > 4)
                {
                    index = 1;
                }
            }



            activeSkillComponent.Verify(skillId, (PlayerBase)Owner, null, Trigskill, null, Complate);
        }
Ejemplo n.º 29
0
        /// <summary>
        /// 改变技能指示器位置
        /// </summary>
        /// <param name="gameEventBase"></param>
        private void OnChangeSkillArea(GameEventBase gameEventBase)
        {
            ChangeSkillAreaGameEvent changeSkillAreaGameEvent = (ChangeSkillAreaGameEvent)gameEventBase;

            deltaVec = new Vector3(changeSkillAreaGameEvent.Postion.x, 0, changeSkillAreaGameEvent.Postion.y);
        }
Ejemplo n.º 30
0
 /// <summary>
 /// 影藏技能指示器
 /// </summary>
 /// <param name="gameEventBase"></param>
 private void OnHideSkillArea(GameEventBase gameEventBase)
 {
     GameEntry.Entity.HideEntity(this);
 }