public static CCameraManager Instance() { IntPtr cPtr = testPINVOKE.CCameraManager_Instance(); CCameraManager ret = (cPtr == IntPtr.Zero) ? null : new CCameraManager(cPtr, false); return(ret); }
void SetCamera() { // will be landscape camera or portrait CCameraManager m_currentCamera = CMainMenuManager.Instance.m_CurrentActiveCamera; float totalcoveredwidth, totalcoveredheight; // will decide to draw grid by horizontall or vertically // Considering by width wise if ((m_currentCamera.m_Camera.aspect * m_VerticalGridLength / m_HorizontalGridLength) <= 1) { totalcoveredwidth = m_CDrawGrid.SpriteWidth * m_HorizontalGridLength; // 1.28*8 = 10.24 totalcoveredwidth += (m_HorizontalGridLength + 1) * offset; m_currentCamera.SetOrthoGraphicSize(totalcoveredwidth / (m_currentCamera.m_Camera.aspect * 2)); m_CDrawGrid.DrawGrid(); } //Considering by height wise else { totalcoveredheight = m_CDrawGrid.SpriteWidth * m_VerticalGridLength; // 1.28*12 = 15.36 totalcoveredheight += (m_VerticalGridLength + 1) * offset; m_currentCamera.SetOrthoGraphicSize(totalcoveredheight / 2); m_CDrawGrid.DrawGrid(false); } LudoManager.Instance.BasicLayOut(); }
void Start() { m_CameraManager = cam; //if(m_LocalPlayer != null) //{ // // 카메라 셋업 // m_CameraManager.Setup(m_LocalPlayer.GetPlayerAnchor()); // // 카메라 셋업을 하고 로컬 플레이어에게 카메라 매니저 전달 // //m_LocalPlayer.SetMainCamera(m_CameraManager); //} //// 로컬 플레이어 컨트롤러 //m_LocalPlayerController = m_LocalPlayer.GetComponent<CPlayerContoller>(); //m_LocalPlayerController.SetMainCamera(m_CameraManager.GetMainCamera()); }
internal static HandleRef getCPtr(CCameraManager obj) { return((obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr); }
/// <summary> /// Game startup. /// </summary> public CGame(CUnityInterface Interface, string CommandLineArgs) { _cmdArgs = CommandLineArgs.Split(' '); string[] parms; #if !UNITY_EDITOR DataDirectory = Application.dataPath + "/Data/"; PersistentDataDirectory = Application.persistentDataPath + "/"; #else DataDirectory = "Data/"; PersistentDataDirectory = "SaveData/"; #endif Config = new CConfig(PersistentDataDirectory + "config.txt"); Config.Load(); #if !UNITY_EDITOR DataDirectory = Application.dataPath + "/Data/"; PersistentDataDirectory = Application.persistentDataPath + "/"; if (_CheckArg("dev", out parms)) { Screen.SetResolution(1280, 720, false); } else { string resType = Config.GetString("ResolutionType"); if (resType == "default") { Resolution r = Screen.resolutions[Screen.resolutions.Length - 1]; Screen.SetResolution(r.width, r.height, true); } else if (resType == "fullscreen" || resType == "windowed") { Resolution r = Screen.resolutions[Screen.resolutions.Length - 1]; int resX = (int)Config.GetFloat("ResolutionWidth"); int resY = (int)Config.GetFloat("ResolutionHeight"); Screen.SetResolution(resX, resY, (resType == "fullscreen")); } } #endif CUtility.MakeDirectory(PersistentDataDirectory + SAVES_DIRECTORY); CUtility.MakeDirectory(PersistentDataDirectory + REPLAYS_DIRECTORY); PrimaryResources = Interface.GetComponent <CPrimaryResources>(); WorldResources = Interface.GetComponent <CWorldResources>(); UIResources = Interface.GetComponent <CUIResources>(); ToolkitUI = Interface.GetComponent <CToolkitUI>(); GameUIStyle = Interface.GetComponent <CGameUIStyle>(); Console = new CConsole(); Debug.Log("Save game directory: " + PersistentDataDirectory); Debug.Log("Data directory: " + DataDirectory); VarShowGrid = Console.CreateVar("show_grid", false); VarShowVisLines = Console.CreateVar("show_los", false); VarShowDDATest = Console.CreateVar("show_ddatest", false); VarShowArcTest = Console.CreateVar("show_arctest", false); VarShowBounds = Console.CreateVar("show_bounds", false); VarShowDebugStats = Console.CreateVar("show_debugstats", false); VarShowMobility = Console.CreateVar("show_mobility", 0, 0, CWorld.MAX_PLAYERS); VarShowSolidity = Console.CreateVar("show_solidity", 0, 0, CWorld.MAX_PLAYERS + 1); VarShowProfiler = Console.CreateVar("show_profiler", false); VarNoFow = Console.CreateVar("no_fow", false); VarPlaceItemDirect = Console.CreateVar("place_item_direct", false); VarShowComfort = Console.CreateVar("show_comfort", false); VarShowEfficiency = Console.CreateVar("show_efficiency", false); VarShowPathing = Console.CreateVar("pathing", false); VarShowFlowField = Console.CreateVar("show_flowfield", false); VarShowNavMesh = Console.CreateVar("show_navmesh", false); VarShowNavRect = Console.CreateVar("show_navrect", 0, 0, CWorld.MAX_PLAYERS); VarShowProxies = Console.CreateVar("show_proxies", 0, 0, CWorld.MAX_PLAYERS); VarFreePurchases = Console.CreateVar("freebuy", true); Console.CreateCommand("gameui", (Params) => { UIManager.ToggleUIActive(); }); Console.CreateCommand("quit", (Params) => { ExitApplication(); }); Console.CreateCommand("exit", (Params) => { ExitApplication(); }); Console.CreateCommand("set_owed", (Params) => { if (_gameSession == null) { return; } _gameSession.SetOwed(1000); }); Console.CreateCommand("set_stamina", (Params) => { if (_gameSession == null) { return; } _gameSession.SetStamina(10.0f); }); Console.CreateCommand("set_hunger", (Params) => { if (_gameSession == null) { return; } _gameSession.SetHunger(80); }); Console.CreateCommand("rebuild_icons", (Params) => { IconBuilder.RebuildItemIcons(true); }); Game = this; Steam = new CSteam(); PrimaryThreadProfiler = new CProfiler(); SimThreadProfiler = new CProfiler(); DebugLevels = new CDebugLevels(); UniversalRandom = new CRandomStream(); AssetManager = new CAssetManager(); Net = new CNet(); Resources = new CResources(); CameraManager = new CCameraManager(); UIManager = new CUIManager(ToolkitUI, GameUIStyle); CDebug.StaticInit(); AssetManager.Init(); ProfilerManager = new CProfilerManager(); ProfilerManager.Init(); IconBuilder = new CIconBuilder(); IconBuilder.Init(); _inputState = new CInputState(); Console.Hide(); Analytics.SetUserId(Steam.mSteamID.ToString()); // TODO: Backquote is not ~, investigate. // TOOD: Allow the same command to have multiple keys associated with it. _inputState.RegisterCommand("console", Config.GetString("KeyConsole"), true); _inputState.RegisterCommand("escape", Config.GetString("KeyEscape")); _inputState.RegisterCommand("focusOnSpawn", Config.GetString("KeyFocusOnSpawn")); _inputState.RegisterCommand("camForward", Config.GetString("KeyCamForward")); _inputState.RegisterCommand("camLeft", Config.GetString("KeyCamLeft")); _inputState.RegisterCommand("camBackward", Config.GetString("KeyCamBackward")); _inputState.RegisterCommand("camRight", Config.GetString("KeyCamRight")); _inputState.RegisterCommand("camRotateLeft", KeyCode.Delete); _inputState.RegisterCommand("camRotateRight", KeyCode.PageDown); _inputState.RegisterCommand("itemPlaceRotate", Config.GetString("KeyPlaceRotate")); _inputState.RegisterCommand("itemPlaceRepeat", Config.GetString("KeyPlaceRepeat")); _inputState.RegisterCommand("action1", Config.GetString("KeyAction1")); _inputState.RegisterCommand("action2", Config.GetString("KeyAction2")); _inputState.RegisterCommand("action3", Config.GetString("KeyAction3")); _inputState.RegisterCommand("action4", Config.GetString("KeyAction4")); _inputState.RegisterCommand("openOptions", Config.GetString("KeyOptionsMenu")); _inputState.RegisterCommand("reload", KeyCode.F5); _inputState.RegisterCommand("space", KeyCode.Space); _inputState.RegisterCommand("editorDelete", Config.GetString("KeyEditorDelete")); _inputState.RegisterCommand("editorDuplicate", Config.GetString("KeyEditorDuplicate")); _inputState.RegisterCommand("editorUndo", Config.GetString("KeyEditorUndo")); _inputState.RegisterCommand("editorRedo", Config.GetString("KeyEditorRedo")); _inputState.RegisterCommand("editorSave", Config.GetString("KeyEditorSave")); // Apply default settings //Application.targetFrameRate = 60; //QualitySettings.antiAliasing // Volume range: 0.0 - -80.0 // TODO: Volume in DB is exponential, making 0 to 1 range for config ineffective. UIResources.MasterMixer.SetFloat("MasterVolume", CMath.MapRangeClamp(Config.GetFloat("MasterVolume"), 0, 1, -80, -12)); UIResources.MasterMixer.SetFloat("MusicVolume", CMath.MapRangeClamp(Config.GetFloat("MusicVolume"), 0, 1, -80, 0)); UIResources.MasterMixer.SetFloat("SoundsVolume", CMath.MapRangeClamp(Config.GetFloat("SoundsVolume"), 0, 1, -80, 0)); UIResources.MasterMixer.SetFloat("UISoundsVolume", CMath.MapRangeClamp(Config.GetFloat("UISoundsVolume"), 0, 1, -80, 0)); // NOTE: BE SUPER CAREFUL WITH THIS // You can corrupt ALL the item assets if not careful. // Saves asset to disk, but asset currently in memory won't reflect new version. //_resaveAllItemAssetsToLastestVersion(); // TODO: This bootstraps all model assets on startup. // If the model asset is first loaded by the sim thread, then it will crash as it tries to generate the meshes. // Should probably only generate meshes when they are pulled in by the main thread. _testItemAssetVersion(); if (_CheckArg("toolkit", out parms)) { StartAssetToolkit(); } else if (_CheckArg("map", out parms)) { if (parms != null && parms.Length > 0) { CGameSession.CStartParams startParams = new CGameSession.CStartParams(); startParams.mPlayType = CGameSession.EPlayType.SINGLE; startParams.mUserPlayerIndex = 0; // Will be set by the level when loaded. startParams.mLevelName = parms[0]; StartGameSession(startParams); } } else { UIManager.AddInterface(new CMainMenuUI()); } }
public void SetMainCamera(CCameraManager _camera) { m_MainCamera = _camera; }
public void EnableLandScapeMode() { m_LandscapeCamera.gameObject.SetActive(true); m_CurrentActiveCamera = m_LandscapeCamera.GetComponent <CCameraManager>(); }
public void EnablePortraitMode() { m_PortraitCamera.gameObject.SetActive(true); m_CurrentActiveCamera = m_PortraitCamera.GetComponent <CCameraManager>(); }