コード例 #1
0
ファイル: GameManager.cs プロジェクト: JivinBian/game_project
 private void InitManager()
 {
     LogManager.Init();
     CoroutineUtil.Init(_gameController);
     ResourceManager.GetInstance().Init();
     DataConfigManager.GetInstance().Init();
     TimeManager.GetInstance().Init();
     ObjectManager.GetInstance().Init();
     InteractiveManager.GetInstance().Init();
     GameSceneManager.GetInstance().Init();
 }
コード例 #2
0
        public NPC CreatNPC(NPCData pNpcData)
        {
            if (_NPCList.ContainsKey(pNpcData.Guid))
            {
                LogManager.Error("duplicate player, guid:" + pNpcData.Guid);
                return(_NPCList[pNpcData.Guid]);
            }
            NPC tNPC = new NPC(pNpcData, DataConfigManager.GetInstance(), ResourceManager.GetInstance());

            tNPC.Create();
            _NPCList[pNpcData.Guid] = tNPC;
            _sceneObjectList.Add(tNPC);

            return(tNPC);
        }
コード例 #3
0
 /// <summary>
 /// 从SceneInfo配置中加载一个场景,这个场景一定是Unity场景
 /// 所有场景都以异步形式加载
 /// </summary>
 /// <param name="pSceneInfoID"></param>
 public void LoadScene(int pSceneID)
 {
     _sceneInfo = DataConfigManager.GetInstance().GetConfigData <SceneInfo>(DataConfigDefine.SceneInfo, pSceneID);
     if (_sceneInfo != null)
     {
         if (_asyncOperation != null)
         {
             CoroutineUtil.StopCoroutine(StartLoadSceneAsync());
             TimeManager.GetInstance().UpdateEvent -= Update;
         }
         TimeManager.GetInstance().UpdateEvent += Update;
         CoroutineUtil.StartCoroutine(StartLoadSceneAsync());
     }
     else
     {
         LogManager.Error("Load scene data is null:" + pSceneID);
     }
 }
コード例 #4
0
        /// <summary>
        /// 创建一个玩家
        /// </summary>
        /// <param name="pData"></param>
        /// <returns></returns>
        public CommonPlayer CreatePlayer(PlayerData pData)
        {
            if (_playerList.ContainsKey(pData.Guid))
            {
                LogManager.Error("duplicate player, guid:" + pData.Guid);
                return(_playerList[pData.Guid]);
            }
            CommonPlayer tPlayer = new CommonPlayer(pData, DataConfigManager.GetInstance(), ResourceManager.GetInstance());

            tPlayer.Create();
            _playerList[pData.Guid] = tPlayer;
            _sceneObjectList.Add(tPlayer);
            if (CreatePlayerCompleteEvent != null)
            {
                CreatePlayerCompleteEvent(pData.Guid);
            }
            return(tPlayer);
        }
コード例 #5
0
        /////////////////////////////////////////////////////////////////////////////////////////////////
        ///
        public void Test()
        {
            var tPlayerData = new PlayerData(DataConfigManager.GetInstance(), 1)
            {
                Guid     = 1,
                HP       = 30,
                MP       = 30,
                Position = new Vector3(0, 0, 0)
            };

            CreatePlayer(tPlayerData);

            for (int i = 0; i < 0; i++)
            {
                tPlayerData = new PlayerData(DataConfigManager.GetInstance(), 1)
                {
                    Guid     = (uint)(2 + i),
                    HP       = 30,
                    MP       = 30,
                    Position = new Vector3(10f * (float)Math.Cos(i * 1f), 0, 10f * (float)Math.Sin(i * 1f))
                };
                CreatePlayer(tPlayerData);
            }

            GameSceneManager.GetInstance().SetCameraObject(Self);
            var tNPCData = new NPCData(DataConfigManager.GetInstance(), 1)
            {
                Guid     = 1,
                Position = new Vector3(15, 0, 15)
            };

            CreatNPC(tNPCData);
            tNPCData = new NPCData(DataConfigManager.GetInstance(), 1)
            {
                Guid     = 2,
                Position = new Vector3(0, 0, 0)
            };
            CreatNPC(tNPCData);
        }
コード例 #6
0
ファイル: GameManager.cs プロジェクト: JivinBian/game_project
 public void Init()
 {
     InitManagementObject();
     InitManager();
     DataConfigManager.GetInstance().ConfigDataLoadedCompleteEvent += EnterGame;
 }
コード例 #7
0
 public void CreateSelf(PlayerData pData)
 {
     Self = new Player(pData, DataConfigManager.GetInstance(), ResourceManager.GetInstance());
     Self.Create();
 }