IEnumerator AfterInit(Action <int> process) { process(40); yield return(null); //加载游戏配置数据 Action onGameDataReady = () => { lock (MogoWorld.GameDataLocker) { MogoWorld.IsGameDataReady = true; if (MogoWorld.OnGameDataReady != null) { Driver.Invoke(MogoWorld.OnGameDataReady); } } }; GameDataControler.Init(null, onGameDataReady); process(45); yield return(null); //初始化网络模块 ServerProxy.Instance.Init(); ServerProxy.Instance.BackToChooseServer = MogoWorld.BackToChooseCharacter; process(50); yield return(null); //启动游戏逻辑 MogoWorld.Init(); SoundManager.Init(); MogoWorld.Start(); NPCManager.Init(); }
void Start() { type = "NPC"; theTransform = transform; temp = gameObject; if (AvatarModelData.dataMap == null) { GameDataControler.Init(); } if (!AvatarModelData.dataMap.ContainsKey(mode_i) && mode_i != 150000) { Debug.Log("mode_i wrong: " + mode_i); return; } Debug.Log("mode_i: " + AvatarModelData.dataMap[mode_i].prefabName); if (mode_i != 150000) { AssetCacheMgr.GetNoCacheInstance(AvatarModelData.dataMap[mode_i].prefabName, (prefab, guid, go) => { if (go == null) { Debug.Log("prefabName wrong"); } temp = go as GameObject; temp.transform.position = transform.position; temp.transform.rotation = transform.rotation; }); } else { temp.transform.position = transform.position; temp.transform.rotation = transform.rotation; } mapx_i = temp.transform.position.x; mapy_i = temp.transform.position.z; rotation_l = (new Vector3(transform.rotation.x, transform.rotation.y, transform.rotation.z)).ToString(); }
public void Initialize() { controller = new GameDataControler(); proxy = new GameDataProxy(gameCenter); _userDataProxy = new UserDataProxy(); user1 = new User(1, "test1", "mo", "1234", 0, 5000, "*****@*****.**"); user2 = new User(2, "test2", "no", "1234", 0, 5000, "*****@*****.**"); user3 = new User(3, "test3", "3test", "1234", 0, 5000, "*****@*****.**"); _userDataProxy.AddNewUser(user1); _userDataProxy.AddNewUser(user2); _userDataProxy.AddNewUser(user3); useCommunication = false; roomID = 9999; players = new List <Player>(); player1 = new Player(user1, 1000, roomID); player1.RoundChipBet = 22; players.Add(player1); Decorator deco = SetDecoratoresNoLimitWithSpectatores(); gameRoom = new GameRoom(players, roomID, deco, gameCenter, logControl, replayManager, ses); }
public GameDataProxy(GameCenter gc) { _controller = new GameDataControler(); _gc = gc; }