private void Update() { if (_gameViewBoundsProvider.Hwnd != IntPtr.Zero) { Interop.SetWindow(_gameViewBoundsProvider.Hwnd); if (!_isConnected) { Interop.Start(false); _gazePointDataProvider.Disconnect(); _headPoseDataProvider.Disconnect(); _isConnected = true; } } SyncData(); var gameViewBounds = _gameViewBoundsProvider .GetGameViewClientAreaNormalizedBounds(); _gameViewInfo = new GameViewInfo(gameViewBounds); _gazeFocus.UpdateGazeFocus(); StartCoroutine(DoEndOfFrameCleanup()); }
private void OpenMainView(object arg) { Dictionary <string, GameObject> dicNodeName = arg as Dictionary <string, GameObject>; string playerPrefabName = "Blade_Warrior_Prefab"; GameObject playerObj = dicNodeName[playerPrefabName]; ModelAttackRoleData data = new ModelAttackRoleData(GetModel <MPlayerData>().PlayerHP, 0.5f, 30); m_player = new ModelPlayer(playerObj, data); m_monsterScaleFlag = GameSceneManager.DistanceToCamera(playerObj.transform.position); m_cameraTrans = dicNodeName[GameConst.PlayerCamera].transform; m_cameraRotationY = m_cameraTrans.rotation.eulerAngles.y; m_cameraHeight = m_cameraTrans.position.y - GameConfig.CameraHeightFix; m_cameraToPlayerDis = m_player.transform.position.z - m_cameraTrans.position.z; m_cameraToPlayerDisVec3 = m_player.transform.position - m_cameraTrans.position; GameView viewType = GameView.MainView; ViewManager.Open(GameViewInfo.GetViewName(Moudle, GameView.MainView), (GameObject gameObject) => { m_playerView = new PlayerView(Moudle, viewType, gameObject.GetComponent <UIPrefab>()); Vector3 position = GameSceneManager.ToScreenPoint(playerObj.transform.position); position.y += ModelRoleManager.GetModelRoleHpPosY(playerPrefabName); m_playerView.CreateHPProcess(playerPrefabName, position, 1, true); } ); EventManager.Register(GameEvent.Type.FrameUpdate, FrameUpdate); }
private void GetPlayerViewImpl(GetPlayerViewReq req, GetPlayerViewResp resp) { GameViewInfo gv = Server.GameManager.GetPlayerView(req.PlayerId, req.Auth.GetClientCode()); resp.Index = gv.PlayerIndex; resp.GameState = gv.GameState.ToString(); resp.Turn = gv.Turn; resp.PlayerStates = gv.PlayerStates.Select(p => new EnPlayerState(p)).ToList(); resp.Map = new EnMapData(gv.Map); }
public static GameViewInfo GetViewInfo(GameMoudle moudle, GameView view) { string name = GameViewInfo.GetViewName(moudle, view); if (!dicViewNameInfo.ContainsKey(name)) { DebugTool.LogError("ViewManager::view info is not exit view name\t" + name); } return(dicViewNameInfo[name]); }
private void StartObservingImpl(StartObservingReq req, StartObservingResp resp) { Team team = Server.TeamRegistry.GetTeam(req.Auth.TeamName); GameDetails gd = Server.GameManager.GetGameDetails(req.GameId, team); GameViewInfo gv = Server.GameManager.StartObserving(req.ObserverId, req.GameId, req.Auth.GetClientCode(), team); resp.GameDetails = new EnGameDetails(gd); resp.Turn = gv.Turn; resp.MapData = new EnMapData(gv.Map); resp.PlayerStates = gv.PlayerStates.Select(ps => new EnPlayerState(ps)).ToArray(); }
public void OpenMainView(object arg) { GameView viewType = GameView.MainView; ViewManager.Open(GameViewInfo.GetViewName(Moudle, GameView.MainView), (GameObject gameObject) => { m_selectView = new SelectView(Moudle, viewType, gameObject.GetComponent <UIPrefab>()); m_selectView.ShowSelectScene(GetModel <MSelectData>().Scenes); } ); }
public static void Init() { GameViewInfo info = new GameViewInfo(GameMoudle.Loading, GameView.MainView); dicViewNameInfo.Add(info.Name, info); info = new GameViewInfo(GameMoudle.Select, GameView.MainView); dicViewNameInfo.Add(info.Name, info); info = new GameViewInfo(GameMoudle.VirtualButton, GameView.MainView); dicViewNameInfo.Add(info.Name, info); info = new GameViewInfo(GameMoudle.Player, GameView.MainView); dicViewNameInfo.Add(info.Name, info); }
private void GetPlayerViewImpl(GetPlayerViewReq req, GetPlayerViewResp resp) { GameViewInfo gv = Server.GameManager.GetPlayerView(req.PlayerId, req.Auth.GetClientCode()); resp.GameUid = gv.GameUid.ToString(); resp.Turn = gv.Turn; resp.Mode = gv.PlayerStates[gv.PlayerIndex].Mode.ToString(); resp.Map = new EnMapData(gv.Map); resp.TecmanPosition = new EnPoint(gv.Map.TecmanPosition); resp.GhostPositions = gv.Map.GhostPosition.Select(p => new EnPoint(p)).ToList(); resp.PreviousTecmanPosition = new EnPoint(gv.PreviousTecmanPosition); resp.PreviousGhostPositions = gv.PreviousGhostPosition.Select(p => new EnPoint(p)).ToList(); }
public void OpenMainView(object arg) { if (m_virtualButtonView == null) { GameView viewType = GameView.MainView; ViewManager.Open(GameViewInfo.GetViewName(Moudle, viewType), (GameObject gameObject) => m_virtualButtonView = new VirtualButtonView(Moudle, viewType, gameObject.GetComponent <UIPrefab>()) ); } else { m_virtualButtonView.Show(); } }
protected void LoadItem(string itemName, Transform parent, int count, System.Action <UIPrefab> callback = null) { IsHaveItem = true; ViewManager.LoadItem(GameViewInfo.GetViewName(m_moudle, m_view), itemName, (GameObject gameObject) => { for (int i = 0; i < count; i++) { GameObject item = Object.Instantiate(gameObject) as GameObject; item.transform.SetParent(parent); int index = AddItem(itemName, item.GetComponent <UIPrefab>()); callback?.Invoke(GetItem(itemName, index)); } } ); }
public static void Open(string viewName, Action <GameObject> callback) { GameViewInfo viewInfo = GetViewInfo(viewName); AssetBundleManager.Load(viewInfo.AssetBundleName, viewInfo.Name, (GameObject gameObj) => { GameObject view = UnityEngine.Object.Instantiate(gameObj) as GameObject; GameObject parent = GameSceneManager.GetNode(viewInfo.ParentName); if (parent == null) { DebugTool.LogError(string.Format("view name : {0}, parent node name : {1} not exit", viewName, viewInfo.ParentName)); } view.transform.SetParent(parent.transform, false); callback(view); } ); }
private static void InitCache() { dicAssetBundle = new Dictionary <string, AssetBundle>(); dicDelAssetBundle = new Dictionary <string, AssetBundle>(); dicCacheAssetBundleName = new Dictionary <string, bool>(); dicAssetBundleObject = new Dictionary <string, Dictionary <string, Object> >(); dicCacheObjectName = new Dictionary <string, string>(); dicCacheAssetBundleName.Add(PathConfig.AssetBundlePlatformPath, true); dicCacheAssetBundleName.Add(PathConfig.AssetBundleNumberAtlasPath, true); dicCacheAssetBundleName.Add(PathConfig.AssetBundleNumberPrefabPath, true); GameViewInfo viewInfo = ViewManager.GetViewInfo(GameMoudle.Loading, GameView.MainView); dicCacheObjectName.Add(viewInfo.AssetBundleName, viewInfo.Name); viewInfo = ViewManager.GetViewInfo(GameMoudle.Select, GameView.MainView); dicCacheObjectName.Add(viewInfo.AssetBundleName, viewInfo.Name); viewInfo = ViewManager.GetViewInfo(GameMoudle.VirtualButton, GameView.MainView); dicCacheObjectName.Add(viewInfo.AssetBundleName, viewInfo.Name); }
public void OpenMainView(object arg) { if (m_loadingView == null) { GameView viewType = GameView.MainView; ViewManager.Open(GameViewInfo.GetViewName(Moudle, viewType), (GameObject gameObject) => { m_loadingView = new LoadingView(Moudle, viewType, gameObject.GetComponent <UIPrefab>()); EventManager.Register(GameEvent.Type.FrameUpdate, OnStartGameFrameUpdate); m_startTime = Time.time; } ); } else { m_loadingView.Show(); EventManager.Register(GameEvent.Type.FrameUpdate, OnFrameUpdate); } }
public static void CreatConfig() { Object[] arr = Selection.GetFiltered(typeof(GameViewAbstract), SelectionMode.TopLevel); var GameConfig = ScriptableObject.CreateInstance <GameViewConfig>(); List <GameViewInfo> gameInfos = new List <GameViewInfo>(); foreach (var item in arr) { var a = new GameViewInfo(); a.View = (GameViewAbstract)item; a.Table = item.name; gameInfos.Add(a); } GameConfig.GameViewList = gameInfos; GameConfig.ConfigName = "defaultConfig"; if (arr.Length > 0) { var filePath = AssetDatabase.GetAssetPath(arr[0]).Replace(arr[0].name + ".prefab", "viewConfig.asset"); AssetDatabase.CreateAsset(GameConfig, filePath); Debug.LogFormat("Create Config : {0}", filePath); } AssetDatabase.Refresh(); }
public static void LoadItem(string viewName, string objName, Action <GameObject> callback) { GameViewInfo viewInfo = GetViewInfo(viewName); AssetBundleManager.Load(viewInfo.AssetBundleName, objName, callback); }