public void ClearImagesAndText() { Canvas.Remove(Join); Canvas.Remove(Back); Canvas.Remove(TextBoxIP); Canvas.Remove(TextBoxPort); Canvas.Remove(ConnectingText); Canvas.Remove(IPText); Canvas.Remove(PortText); Canvas.Remove(IP); Canvas.Remove(Port); Canvas.Remove(Caret); UserSettings.AddOrUpdateAppSetting("LastUsedIP", IPText.text); }
void voidAnnouncerToggler(bool toggle) { //dumpa koden här för att sätta på och stänga av använd toggle för av och på. if (toggle) { Audio.SetVoiceVolume(1); } else { Audio.SetVoiceVolume(0); } string Update; Update = toggle.ToString(); UserSettings.AddOrUpdateAppSetting("Announcer", Update); }
void BackbuttonClicked() { if (ActivatedfromExitmenu) { CameraMaster.instance.SetState(CAM_STATE.EXIT_MENU); ActivatedfromExitmenu = false; } else { CameraMaster.instance.SetState(CAM_STATE.MAIN_MENU); } // string Update; Update = Wcontroller.GetFullscreen().ToString(); UserSettings.AddOrUpdateAppSetting("Fullscreen", Update); Update = Wcontroller.GetBorderless().ToString(); UserSettings.AddOrUpdateAppSetting("Borderless", Update); if (ImageBar != null) { Update = ImageBar[(int)ImageBarstate.MasterVolume_image].numbervalue.ToString(); UserSettings.AddOrUpdateAppSetting("Master", Update); Update = ImageBar[(int)ImageBarstate.Movement].numbervalue.ToString(); // save from this call to Movement LastMousePosition here UserSettings.AddOrUpdateAppSetting("Move", Update); Update = ImageBar[(int)ImageBarstate.sfxBar_Image].numbervalue.ToString(); // save from this call to sfxBar_Image LastMousePosition here UserSettings.AddOrUpdateAppSetting("Sfx", Update); Update = ImageBar[(int)ImageBarstate.MUSICBar_IMAGE].numbervalue.ToString(); // save from this call to MUSICBar_IMAGE LastMousePosition here UserSettings.AddOrUpdateAppSetting("Music", Update); Update = ImageBar[(int)ImageBarstate.AIM].numbervalue.ToString(); // save from this call to aim LastMousePosition here UserSettings.AddOrUpdateAppSetting("Aim", Update); } }
public override void OnDestroy() { //MORGAN SPARA HÄR /* * if(Imagebar != null) * { * ImageBar[(int)ImageBarstate.Movement].LastMousePosition; // save from this call to Movement LastMousePosition here * ImageBar[(int)ImageBarstate.sfxBar_Image].LastMousePosition; // save from this call to sfxBar_Image LastMousePosition here * ImageBar[(int)ImageBarstate.MUSICBar_IMAGE].LastMousePosition; // save from this call to MUSICBar_IMAGE LastMousePosition here * ImageBar[(int)ImageBarstate.AIM].LastMousePosition; // save from this call to aim LastMousePosition here * } */ // ClearImagesAndText(); string Update; Update = Wcontroller.GetFullscreen().ToString(); UserSettings.AddOrUpdateAppSetting("Fullscreen", Update); Update = Wcontroller.GetBorderless().ToString(); UserSettings.AddOrUpdateAppSetting("Borderless", Update); if (ImageBar != null) { Update = ImageBar[(int)ImageBarstate.MasterVolume_image].numbervalue.ToString(); UserSettings.AddOrUpdateAppSetting("Master", Update); Update = ImageBar[(int)ImageBarstate.Movement].numbervalue.ToString(); // save from this call to Movement LastMousePosition here UserSettings.AddOrUpdateAppSetting("Move", Update); Update = ImageBar[(int)ImageBarstate.sfxBar_Image].numbervalue.ToString(); // save from this call to sfxBar_Image LastMousePosition here UserSettings.AddOrUpdateAppSetting("Sfx", Update); Update = ImageBar[(int)ImageBarstate.MUSICBar_IMAGE].numbervalue.ToString(); // save from this call to MUSICBar_IMAGE LastMousePosition here UserSettings.AddOrUpdateAppSetting("Music", Update); Update = ImageBar[(int)ImageBarstate.AIM].numbervalue.ToString(); // save from this call to aim LastMousePosition here UserSettings.AddOrUpdateAppSetting("Aim", Update); } }
public override void Update() { if (Canvas.isRendering) { Play.color = Unselected; HostGame.color = Unselected; Options.color = Unselected; Credits.color = Unselected; Exit.color = Unselected; RandomHat.color = Unselected; if (Play.Hovered()) { Play.color = Selected; } else if (HostGame.Hovered()) { HostGame.color = Selected; } else if (Options.Hovered()) { Options.color = Selected; } else if (Credits.Hovered()) { Credits.color = Selected; } else if (Exit.Hovered()) { Exit.color = Selected; } else if (RandomHat.Hovered()) { RandomHat.color = Selected; } if (Input.GetMouseButtonDown(Input.MouseButtons.LEFT)) { if (ChadArea.Hovered()) { Input.SetMouseMode(Input.MouseMode.POSITION_RELATIVE); _RotateChad = true; } } if (MyNameSticker.Clicked()) { TakeName = true; if (Blink == null) { Blink = CaretBlink(); StartCoroutine(Blink); } if (ClearName) { PlayerName.text = ""; ClearName = false; } } else if (Input.GetMouseButtonUp(Input.MouseButtons.LEFT)) { Input.SetMouseMode(Input.MouseMode.POSITION_ABSOLUTE); _RotateChad = false; TakeName = false; if (Blink != null) { StopCoroutine(Blink); Blink = null; } Caret.text = ""; } #region Clicked if (Play.Clicked() && PlayerName.text != "") { CameraMaster.instance.SetState(CAM_STATE.JOIN_HOST); TakeName = false; UserSettings.AddOrUpdateAppSetting("Hat", CameraMaster.instance.SelectedHat.ToString()); UserSettings.AddOrUpdateAppSetting("PlayerName", PlayerName.text); } else if (HostGame.Clicked()) { CameraMaster.instance.SetState(CAM_STATE.HOST_MENU); TakeName = false; UserSettings.AddOrUpdateAppSetting("Hat", CameraMaster.instance.SelectedHat.ToString()); UserSettings.AddOrUpdateAppSetting("PlayerName", PlayerName.text); } else if (Exit.Clicked()) { ThomasWrapper.IssueShutdown(); } else if (SelectHatRight.Clicked()) { CameraMaster.instance.SelectedHat += 1; AnnouncerSoundManager.Instance.Announce(ANNOUNCEMENT_TYPE.HAT); } else if (SelectHatLeft.Clicked()) { CameraMaster.instance.SelectedHat -= 1; AnnouncerSoundManager.Instance.Announce(ANNOUNCEMENT_TYPE.HAT); } else if (RandomHat.Clicked()) { CameraMaster.instance.SelectedHat = (int)(Random.Range(0.0f, 1.0f) * (HatManager.Instance.Hats.Count - 2)) + 1; AnnouncerSoundManager.Instance.Announce(ANNOUNCEMENT_TYPE.HAT); } else if (Options.Clicked()) { CameraMaster.instance.SetState(CAM_STATE.OPTIONS_MENU); } #endregion if (TakeName) { string playerString = PlayerName.text; GUIInput.AppendString(ref playerString, 9); PlayerName.text = playerString; } RotateChad(); Caret.position = PlayerName.position + new Vector2(PlayerName.size.x / 2 - 0.005f, CaretOffset + PlayerName.size.x * NameRotation); } }
public override void Start() { #region Init GUI if (Camera == null) { Debug.Log("Camera Master cannot find camera"); } JoinHost = gameObject.GetComponent <GUIJoinHost>(); if (JoinHost == null) { Debug.Log("Camera Master cannot find GUI script for join/host"); } MainMenu = gameObject.GetComponent <GUIMainMenu>(); if (MainMenu == null) { Debug.Log("Camera master could not find GUI script for main menu"); } SelectTeam = gameObject.GetComponent <GUISelectTeam>(); if (SelectTeam == null) { Debug.Log("Camera Master cannot find GUI script for select"); } ExitMenu = gameObject.GetComponent <GUIExitMenu>(); if (ExitMenu == null) { Debug.Log("Camera Master cannot find GUI script for exit"); } HostMenu = gameObject.GetComponent <GUIHostMenu>(); if (HostMenu == null) { Debug.Log("Camera Master cannot find GUI script for host"); } OptionsMenu = gameObject.GetComponent <GUIOptionsMenu>(); if (OptionsMenu == null) { Debug.Log("Camera Master cannot find GUI script for Options"); } LoadingScreen = gameObject.GetComponent <GUILoadingScreen>(); if (LoadingScreen == null) { Debug.Log("Camera Maser cannot find GUI script for loading screen"); } ChadCam = gameObject.GetComponent <ChadCam>(); if (ChadCam == null) { Debug.Log("Camera Master cannot find ChadCam"); } else { ChadCam.enabled = false; } SpectatorCam = gameObject.GetComponent <SpectatorCam>(); if (SpectatorCam == null) { Debug.Log("Camera Master cannot find SpectatorCam"); } else { SpectatorCam.enabled = false; } Hud = gameObject.GetComponent <ChadHud>(); if (Hud == null) { Debug.Log("Camera Master could not find Hud"); } ReplayCam = gameObject.GetComponent <ReplayCamera>(); ReplayCam.enabled = false; #endregion #region Chad Hats string settingsHat = UserSettings.GetSetting("Hat"); if (settingsHat != null) { SelectedHat = System.Convert.ToInt32(settingsHat); } else { SelectedHat = (int)(Random.Range(0.0f, 1.0f) * (HatManager.Instance.Hats.Count - 2)) + 1; settingsHat = SelectedHat.ToString(); UserSettings.AddOrUpdateAppSetting("Hat", settingsHat); } if (ChadMainMenu != null) { ChadMMHat = ChadMainMenu.GetComponent <Hatter>(); ChadMMHat.SetHat(SelectedHat); } if (ChadTeam1 != null) { ChadT1Hat = ChadTeam1.GetComponent <Hatter>(); ChadT1Hat.SetHat(SelectedHat); } if (ChadTeam1 != null) { ChadT2Hat = ChadTeam2.GetComponent <Hatter>(); ChadT2Hat.SetHat(SelectedHat); } #endregion SetState(CAM_STATE.MAIN_MENU); }
public override void Update() { Join.color = Color.FloralWhite; Back.color = Color.FloralWhite; if (TakeIP) { string str = IPText.text; GUIInput.AppendString(ref str, 15); IPText.text = str; Caret.position = IPText.position + new Vector2(IPText.size.x / 2 - 0.005f, CaretOffset); } if (TakePort) { string str = PortText.text; GUIInput.AppendString(ref str, 5); PortText.text = str; Caret.position = PortText.position + new Vector2(PortText.size.x / 2 - 0.005f, CaretOffset); } if (Input.GetMouseButtonUp(Input.MouseButtons.LEFT)) { TakePort = false; TakeIP = false; TextBoxIP.color = Color.Black; TextBoxPort.color = Color.Black; if (Blink == null) { Blink = CaretBlink(); StartCoroutine(Blink); } } if (Join.Clicked()) { TakeIP = false; TakePort = false; ConnectingText.text = ""; System.Net.IPAddress ipaddress; UserSettings.AddOrUpdateAppSetting("LastUsedIP", IPText.text); try { ipaddress = NetUtils.ResolveAddress(IPText.text); } catch (Exception e) { ConnectingText.text = e.Message; return; } if (PortText.text != "") { try { if (IPText.text == "127.0.0.1") { MatchSystem.instance.LocalPort = 0; } else { MatchSystem.instance.LocalPort = Convert.ToInt32(PortText.text); } MatchSystem.instance.TargetPort = Convert.ToInt32(PortText.text); MatchSystem.instance.TargetIP = IPText.text; MatchSystem.instance.Listener.AllPeersConnectedEvent += Listener_AllPeersConnectedEvent; MatchSystem.instance.Listener.PeerDisconnectedEvent += Listener_PeerDisconnectedEvent; MatchSystem.instance.Init(); MatchSystem.instance.Connect(); ConnectingText.text = "Connecting"; ConnectingText.scale = new Vector2(1); ConnectingText.position = new Vector2(0.75f, 0.9f); Connect = Connecting(); StartCoroutine(Connect); Join.interactable = false; return; } catch (Exception e) //Hopefully this catches the exception thrown in ServerInfoEventHandler { ConnectingText.text = e.Message; Join.interactable = true; StopCoroutine(Connect); } } else { if (IPText.text == "") { TextBoxIP.color = Color.Red; } if (PortText.text == "") { TextBoxPort.color = Color.Red; } } } if (Back.Clicked()) { TakeIP = false; TakePort = false; CameraMaster.instance.SetState(CAM_STATE.MAIN_MENU); ConnectingText.text = ""; UserSettings.AddOrUpdateAppSetting("LastUsedIP", IPText.text); } if (TextBoxIP.Clicked()) { ConnectingText.text = ""; TakeIP = true; if (ClearIP) { IPText.text = ""; ClearIP = false; } } else if (TextBoxPort.Clicked()) { ConnectingText.text = ""; TakePort = true; if (ClearPort) { PortText.text = ""; ClearPort = false; } } else if (Input.GetMouseButtonUp(Input.MouseButtons.LEFT)) { if (Blink != null) { StopCoroutine(Blink); Blink = null; Caret.text = ""; } } if (Join.Hovered()) { Join.color = Color.IndianRed; } else if (Back.Hovered()) { Back.color = Color.IndianRed; } }