public void Swap(CUIGroup newGroup, bool instant = false) { if (newGroup == activeGroup) { return; } if (activeGroup) { if (instant) { CUIManager.SwapAnimate(activeGroup, newGroup, -1f, CUIAnimation.InstantOut, CUIAnimation.InstantIn); } else { CUIManager.SwapAnimate(activeGroup, newGroup); } } else { if (instant) { CUIManager.Animate(newGroup, CUIAnimation.InstantIn); } else { CUIManager.Animate(newGroup, true); } } activeGroup = newGroup; }
private void OnInteractedWith(bool interacting) { if (interacting) { foreach (WristBubble bubble in WristBubble.bubbles) { CUIManager.Animate(bubble.cuiGroup, true); } } else { foreach (WristBubble bubble in WristBubble.bubbles) { if (!bubble.isPinned) { CUIManager.Animate(bubble.cuiGroup, false); } } } if (interacting) { CUIManager.SwapAnimate(songScrollerCUI, mediaControlButtonsCUI); } else { CUIManager.SwapAnimate(mediaControlButtonsCUI, songScrollerCUI); } }
public void OnUnitDestroyed(CUnit unit) { switch (unit.GetUnitType()) { case UNIT_TYPE.PLAYER: { mPlayer = null; Debug.Log("on player destroyed"); CUIManager.GetInstance().OnUnitDestroyed(unit); } break; case UNIT_TYPE.ENEMY: { mEnemy = null; Debug.Log("on enemy destroyed"); CUIManager.GetInstance().OnUnitDestroyed(unit); } break; } }
// Use this for initialization void Start() { mTransform = gameObject.GetComponent <RectTransform>(); mBarTransform = mBar.GetComponent <RectTransform>(); mTransform.SetParent(CUIManager.GetInstance().GetTransform()); }
private void Awake() { if (!_instance) { _instance = this; } }
private void ShowRestartWarning(string change, Action callback) { restartWarningChange.SetText("Change: " + change); CUIManager.Animate(restartWarningGroup, true); currentRestartWarningCallback = callback; }
public override void Init(CUIManager Context) { base.Init(Context); CToolkitUI ui = CGame.ToolkitUI; _base = ui.CreateElement(CGame.UIManager.mMenuLayer, "mainMenuBase"); _base.AddComponent <Image>().color = new Color(0.2f, 0.2f, 0.2f, 1.0f); ui.SetRectFillParent(_base); logo = ui.CreateElement(_base, "logo"); Image logoImage = logo.AddComponent <Image>(); logoImage.sprite = CGame.PrimaryResources.Sprites[1]; //logoImage.SetNativeSize(); logoImage.preserveAspect = true; logoImage.color = new Color(1.0f, 1.0f, 1.0f); //logo.GetComponent<RectTransform>().anchoredPosition = new Vector2(0, 0); logo.GetComponent <RectTransform>().anchorMin = new Vector2(0.5f, 0.0f); logo.GetComponent <RectTransform>().anchorMax = new Vector2(0.5f, 1.0f); logo.GetComponent <RectTransform>().pivot = new Vector2(0.5f, 0.5f); logo.GetComponent <RectTransform>().sizeDelta = new Vector2(256, 256); logo.GetComponent <RectTransform>().anchoredPosition = new Vector2(0, 0); _splashBase = ui.CreateElement(CGame.UIManager.mMenuLayer, "splashBase"); _splashBase.AddComponent <Image>().color = new Color(0.2f, 0.2f, 0.2f, 0.0f); ui.SetRectFillParent(_splashBase); CGame.UIManager.PlayMusic(0); }
private void Awake() { if (instance == null) { instance = this; } }
public void TakeDamage(int iAmount) { //Make sure player if player is alive or not to prevent complete //earrape when they aren't if (m_bInvincibility == false && m_bDead == false) { m_iCurrentHP -= iAmount; DamageTakenEffect(); if (GetGlimmer() != null) { GetGlimmer().OnDamageTakenFlash(m_fDamageFlashingDuration); } if (m_iCurrentHP <= 0) { Death(); } //Update health UI else { if (m_bIsAI == false) { CSoundBank.Instance.PlayerTakeDamage(gameObject); CUIManager.UpdateHealthUI(); CAmbienceController.Instance.SetHeartbeatParameter((float)m_iCurrentHP / m_iMaxHP); Shader.SetGlobalFloat("_CurrentHP", m_iCurrentHP / m_iMaxHP); } else { CSoundBank.Instance.AITakeDamage(m_eAIType, gameObject); } } } //print(gameObject.name + " took " + iAmount + " damage. " + m_iCurrentHP + " HP remaining."); }
public bool bDoComputation = false; // Debugging. private void Awake() { textureLoader = FindObjectOfType <CTextureLoader_Layers>(); evalSimple = FindObjectOfType <EvaluateSimple>(); UI = FindObjectOfType <CUIManager>(); button = FindObjectOfType <VRTrigger>(); pointAtManager = FindObjectOfType <CPointAtManager>(); }
private IEnumerator RevealAnimate(bool show = true) { foreach (var child in childrenGroups) { CUIManager.Animate(child, show); yield return(new WaitForSeconds(delayBetweenReveal)); } }
public override void Init() { instance = new CUIManager(); dicUI = new Dictionary <int, CUIBase>(); openedStack = new Stack <int>(); uiFrequency = new Dictionary <int, int>(); closedList = new List <int>(); }
private void ShowGamesGrid() { if (activeGroup != gridView) { CUIManager.SwapAnimate(activeGroup, gridView); activeGroup = gridView; } gridDisplayGroup.MakeGames(); }
public void StartGame() { _introControl.SetActive(false); Vector3 randomPos = new Vector3(Random.Range(-10, 10), 0, Random.Range(-10, 10)); GameObject localPlyer = PhotonNetwork.Instantiate("PlayerControl", randomPos, Quaternion.identity, 0); uiManager = localPlyer.GetComponent <CUIManager>(); characterManager = localPlyer.GetComponent <CCharacterManager>(); _gamePanel.SetActive(false); StartCoroutine("ShowTimer"); _monsterGenerator.StartCoroutine("MonsterGenCoroutine"); }
public void Heal(int iAmount) { if (m_bDead == false && m_bIsAI == false) { m_iCurrentHP += iAmount; if (m_iCurrentHP > m_iMaxHP) { m_iCurrentHP = m_iMaxHP; } CUIManager.UpdateHealthUI(); CAmbienceController.Instance.SetHeartbeatParameter((float)m_iCurrentHP / m_iMaxHP); Shader.SetGlobalFloat("_CurrentHP", m_iCurrentHP / m_iMaxHP); } }
public void Resurrect() { GetCollider().enabled = true; GetRigidbody().isKinematic = false; GetRigidbody().useGravity = true; m_bDead = false; m_iCurrentHP = m_iMaxHP; GetAnimator().SetBool("Dead", m_bDead); CUIManager.UpdateHealthUI(); CAmbienceController.Instance.SetHeartbeatParameter((float)m_iCurrentHP / m_iMaxHP); Shader.SetGlobalFloat("_CurrentHP", m_iCurrentHP / m_iMaxHP); GetStatusEffects().SetMoveSpeedMultiplier(1.0f); //print(gameObject.name + " was Resurrected"); }
public void Button_Home() { // if (isShowingGameDetails) HideGameDetails(); if (activeGroup == welcomeView) { return; } CUIManager.SwapAnimate(activeGroup, welcomeView); activeGroup = welcomeView; favoritesDispalyGroup.MakeGames(); }
private void Start() { OverlayManager.onInitialized += OnOverlaysInitialized; StartCoroutine(LoadBuiltInApps()); SteamVRManager.I.onHeadsetStateChanged.AddListener(OnHeadsetStateChanged); blackoutDP.onInitialized += delegate { blackoutDP.SetOverlayTransform(new Vector3(0f, 0f, 0.13f), Vector3.zero, true, true); }; closeDP.onInteractedWith += delegate(bool b) { if (b) { closeDP.TransitionOverlayWidth(0.07f, 0.3f); } else { closeDP.TransitionOverlayWidth(0.065f, 0.2f); } }; DPSettings.OnLoad((() => { SetBlackoutOpacity(DPSettings.config.dimGameAmount); })); gameArtDP.onInteractedWith += delegate(bool b) { CUIManager.Animate(gameHoverGroup, b); if (b) { gameArtDP.TransitionOverlayWidth(0.205f, 0.2f); } else { gameArtDP.TransitionOverlayWidth(0.2f, 0.1f); } }; WindowListButton.onPress += LaunchAppToMainSnap; WindowListButton.onHeldClose += CloseApp; LoadAllSnapPoints(); }
private void OnLookShowing(bool visible) { WristBubble.wristVisible = !visible; CUIManager.Animate(songScrollerCUI, CUIAnimation.FadeOut); if (!visible) { CUIManager.Animate(mediaCUI, CUIAnimation.FadeInDown, 0.5f); CUIManager.Animate(songScrollerCUI, CUIAnimation.FadeIn); } else { CUIManager.Animate(mediaCUI, CUIAnimation.FadeOutUp); CUIManager.Animate(songScrollerCUI, CUIAnimation.FadeOut); } }
public override bool Deactivate(bool instant = false, bool force = false) { if (!base.Deactivate(instant, force)) { return(false); } bool showing = false; if (invertShowingHiding) { showing = true; } CUIManager.Animate(group, showing, -1f, instant); return(true); }
private void Start() { // Singleton 선언해놓은 클래스들 받는 변수 _playerUi = CUIManager.instance; gameEvent = CGameEvent.instance; _camera = CMouseFollower.instance; if (player != null) { _playerControl = player.GetComponent <CCntl>(); SetControlCharacter(player); previousPlayerPos = player.transform.position; StartCoroutine("MoveTracer"); } // Callback 전달 CWindowFacade.instance.SetControlLockCallback = SetControlLock; }
private void ClearUiForms() { DictionaryView <int, CUIFormScript> .Enumerator enumerator = this.m_uiFormMap.GetEnumerator(); while (enumerator.MoveNext()) { CUIManager instance = Singleton <CUIManager> .GetInstance(); KeyValuePair <int, CUIFormScript> current = enumerator.Current; instance.CloseForm(current.get_Value()); } this.m_uiFormMap.Clear(); this.m_curUiForm = null; if (this.m_curUiFormPortrait != null) { Singleton <CUIManager> .GetInstance().CloseForm(this.m_curUiFormPortrait); this.m_curUiFormPortrait = null; } }
// Use this for initialization void Start() { mInstance = this; mTransform = gameObject.GetComponent <RectTransform>(); mScaler = gameObject.GetComponent <CanvasScaler>(); mMinimap = mTransform.GetComponentInChildren <CMinimap>(); if (mMinimap == null) { Debug.Log("minimap controller not found."); } mExitButton = mTransform.Find("ExitButton").gameObject; mExitButton.SetActive(false); ScaleUI(); Debug.Log(string.Format("design info : {0} X {1}, scale = {2}, scaletype = {3}", GetDesignWidth(), GetDesignHeight(), GetScaleFactor(), mScaleType)); }
// Update is called once per frame void Update() { if (mTarget.GetStatus() == CUnit.UNIT_STATUS.US_DYING) { Destroy(gameObject); return; } Vector3 pos = mTarget.GetPos() * CGameScaller.GetInstance().GetScale(); pos -= CGameManager.GetInstance().GetPos(); pos.z = 1.0f; pos *= 1.0f / CUIManager.GetInstance().GetScaleFactor(); pos.y += 25; SetPos(pos.x, pos.y); SetValue(mTarget.GetHpPercent()); }
public override void OnInit() { base.OnInit(); //StartCoroutine(LibraryHelper.I.LoadGameLibraryImages(false)); LibraryHelper.I.PopulateDPGamesLibrary(false); //CUIManager.Animate(welcomeView, CUIAnimation.FadeIn); // activeGroup = welcomeView; // welcomePanel.Show(); // gridPanel.Hide(true); // StartCoroutine(LoadLibraryGameImages()); CUIManager.Animate(welcomeView, CUIAnimation.FadeIn); activeGroup = welcomeView; StartCoroutine(favoritesDispalyGroup.MakeGamesDelayed()); //favoritesDispalyGroup./ }
private void Start() { DPSettings.OnLoad((() => { if (DPSettings.config.isFirstTime) { DPSettings.config.isFirstTime = false; CUIManager.Animate(firstGroup, true); } })); version.SetText("ver." + Application.version + ""); SteamVRManager.I.onHeadsetStateChanged.AddListener(OnHeadsetStateChanged); /* * dpMain.overlay.visibilityUpdatedEvent += b => { * CalculateShouldBeActive(); * }; */ StartCoroutine(LoopCheckShouldBeActive()); }
private void Update() { float yay = (float)player.time / (float)player.length; if (yay <= 0f) { return; } if (float.IsNaN(yay)) { return; } //Debug.Log(yay); slider.SetValueWithoutNotify(yay); if (Input.GetKeyDown(KeyCode.A)) { CUIManager.SwapAnimate(myGroup, myGroup2); } }
/// <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 virtual void Init(CUIManager Context) { _context = Context; }
public void OnEnemyAwake(CEnemy enemy) { mEnemy = enemy; CUIManager.GetInstance().OnUnitCreated(enemy); }