public override void Start() { canvas = GameObject.Find("Canvas"); camera = GameObject.Find("Main Camera").GetComponent <DynamicCamera>(); tabs = Auxiliary.FindObject(canvas, "Tabs"); toolbar = Auxiliary.FindObject(canvas, "MainToolbar"); changeRobotPanel = Auxiliary.FindObject(canvas, "ChangeRobotPanel"); robotListPanel = Auxiliary.FindObject(changeRobotPanel, "RobotListPanel"); changePanel = Auxiliary.FindObject(canvas, "ChangePanel"); addPanel = Auxiliary.FindObject(canvas, "AddPanel"); changeFieldPanel = Auxiliary.FindObject(canvas, "ChangeFieldPanel"); pointImpulsePanel = Auxiliary.FindObject(canvas, "PointImpulsePanel"); resetDropdown = GameObject.Find("ResetRobotDropdown"); multiplayerPanel = Auxiliary.FindObject(canvas, "MultiplayerPanel"); stopwatchWindow = Auxiliary.FindObject(canvas, "StopwatchPanel"); statsWindow = Auxiliary.FindObject(canvas, "StatsPanel"); rulerWindow = Auxiliary.FindObject(canvas, "RulerPanel"); // To access instatiate classes within a state, use the StateMachine.SceneGlobal toolkit = StateMachine.SceneGlobal.GetComponent <Toolkit>(); multiplayer = StateMachine.SceneGlobal.GetComponent <LocalMultiplayer>(); simUI = StateMachine.SceneGlobal.GetComponent <SimUI>(); menuUI = StateMachine.SceneGlobal.GetComponent <MenuUI>(); robotCameraGUI = StateMachine.SceneGlobal.GetComponent <RobotCameraGUI>(); sensorManagerGUI = StateMachine.SceneGlobal.GetComponent <SensorManagerGUI>(); State = StateMachine.SceneGlobal.CurrentState as MainState; cameraViewDropdown = Auxiliary.FindObject(canvas, "CameraDropdown").GetComponent <Dropdown>(); dynamicCamera = UnityEngine.Camera.main.transform.GetComponent <DynamicCamera>(); }
private void loadClientOptions() { Action action = delegate { StartupPreferences startupPreferences = new StartupPreferences(); startupPreferences.loadPreferences(async: false, applyLanguage: false); if (Game1.game1.IsMainInstance) { Game1.options = startupPreferences.clientOptions; } else { Game1.options = new Options(); } Game1.initializeVolumeLevels(); }; if (LocalMultiplayer.IsLocalMultiplayer()) { action(); } else { new Task(action).Start(); } }
public override void UpdateButtons() { base.UpdateButtons(); if (LocalMultiplayer.IsLocalMultiplayer() && !Game1.game1.IsMainInstance && backButton != null) { backButton.visible = false; } }
void Awake() { networkManager = NetworkManager.singleton as LocalNetworkManager; networkManager.GetComponent <DebugGUI>().enabled = false; networkManager.playerPrefab = Resources.Load("Character") as GameObject; local = FindObjectOfType(typeof(LocalMultiplayer)) as LocalMultiplayer; BinaryFormatter bf = new BinaryFormatter(); FileStream file = File.Open(Application.persistentDataPath + "/ndata.sav", FileMode.Open); Globals.networkData = (NetwrokData)bf.Deserialize(file); file.Close(); }
public override void OnStartClient() { local = FindObjectOfType(typeof(LocalMultiplayer)) as LocalMultiplayer; networkManager = NetworkManager.singleton as LocalNetworkManager; if (networkManager) { networkManager.lobbySlots[slot] = this; OnClientEnterLobby(); } else { Debug.LogError("LocalPlayer could not find the NetworkManager."); } }
protected virtual void startListPopulation() { if (LocalMultiplayer.IsLocalMultiplayer()) { addSaveFiles(FindSaveGames()); saveFileScanComplete(); return; } _initTask = new Task <List <Farmer> >(delegate { Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; return(FindSaveGames()); }); _initTask.Start(); }
private void Update() { if (toolkit == null) { camera = GameObject.Find("Main Camera").GetComponent <DynamicCamera>(); toolkit = GetComponent <Toolkit>(); multiplayer = GetComponent <LocalMultiplayer>(); sensorManagerGUI = GetComponent <SensorManagerGUI>(); FindElements(); } else if (camera == null) { camera = GameObject.Find("Main Camera").GetComponent <DynamicCamera>(); } else { UpdateWindows(); if (UnityEngine.Input.GetKeyDown(KeyCode.Escape) && !InputControl.freeze) { if (!exitPanel.activeSelf) { if (GameObject.Find("Dropdown List")) { GameObject.Destroy(GameObject.Find("Dropdown List")); } MainMenuExit("open"); } else { MainMenuExit("cancel"); } } if (KeyButton.Binded() && inputPanelOn) { ShowBindedInfoPanel(); } } HighlightTabs(); if (State.isEmulationDownloaded) { emulationTab.SetActive(true); } }
void Awake() { if (FindObjectOfType(typeof(LocalMultiplayer)) && NetworkManager.singleton) { networkManager = NetworkManager.singleton as LocalNetworkManager; networkManager.GetComponent <DebugGUI>().enabled = true; networkManager.playerPrefab = Resources.Load("PlayerProfile") as GameObject; local = FindObjectOfType(typeof(LocalMultiplayer)) as LocalMultiplayer; } //BinaryFormatter bf = new BinaryFormatter(); //FileStream file = File.Open(Application.persistentDataPath + "/ndata.sav", FileMode.Open); //Globals.networkData = (NetwrokData)bf.Deserialize(file); //file.Close(); ConfigNetworkScript.LoadNData(); }
private void Update() { if (main == null) { main = StateMachine.Instance.FindState <MainState>(); } else if (dpm == null) { camera = GameObject.Find("Main Camera").GetComponent <DynamicCamera>(); toolkit = GetComponent <Toolkit>(); dpm = GetComponent <DriverPracticeMode>(); multiplayer = GetComponent <LocalMultiplayer>(); sensorManagerGUI = GetComponent <SensorManagerGUI>(); FindElements(); } else if (camera == null) { camera = GameObject.Find("Main Camera").GetComponent <DynamicCamera>(); } else { UpdateWindows(); if (Input.GetKeyDown(KeyCode.Escape)) { if (StateMachine.Instance.CurrentState.GetType().Equals(typeof(MainState))) { if (!exitPanel.activeSelf) { MainMenuExit("open"); } else { MainMenuExit("cancel"); } } } if (Input.GetKey(KeyCode.LeftControl) && Input.GetKeyDown(KeyCode.H)) { TogglePanel(toolbar); } } }
private void Update() { if (InputControl.GetButtonDown(new KeyMapping("Hide Menu", KeyCode.H, Input.Enums.KeyModifier.Ctrl), true)) { tabs.SetActive(!tabs.activeSelf); tabStateMachine.CurrentState.ToggleHidden(); } if (toolkit == null) { camera = GameObject.Find("Main Camera").GetComponent <DynamicCamera>(); toolkit = GetComponent <Toolkit>(); multiplayer = GetComponent <LocalMultiplayer>(); sensorManagerGUI = GetComponent <SensorManagerGUI>(); FindElements(); } else if (camera == null) { camera = GameObject.Find("Main Camera").GetComponent <DynamicCamera>(); } else { UpdateWindows(); if (UnityEngine.Input.GetKeyDown(KeyCode.Escape)) { if (!exitPanel.activeSelf) { if (GameObject.Find("Dropdown List")) { GameObject.Destroy(GameObject.Find("Dropdown List")); } MainMenuExit("open"); } else { MainMenuExit("cancel"); } } } UpdateJoystickStates(); HighlightTabs(); }
public override void Start() { canvas = GameObject.Find("Canvas"); camera = GameObject.Find("Main Camera").GetComponent <DynamicCamera>(); tabs = Auxiliary.FindObject(canvas, "Tabs"); toolbar = Auxiliary.FindObject(canvas, "MainToolbar"); helpMenu = Auxiliary.FindObject(canvas, "Help"); overlay = Auxiliary.FindObject(canvas, "Overlay"); helpBodyText = Auxiliary.FindObject(canvas, "BodyText").GetComponent <Text>(); changeRobotPanel = Auxiliary.FindObject(canvas, "ChangeRobotPanel"); robotListPanel = Auxiliary.FindObject(changeRobotPanel, "RobotListPanel"); changePanel = Auxiliary.FindObject(canvas, "ChangePanel"); addPanel = Auxiliary.FindObject(canvas, "AddPanel"); changeFieldPanel = Auxiliary.FindObject(canvas, "ChangeFieldPanel"); resetDropdown = GameObject.Find("ResetRobotDropdown"); multiplayerPanel = Auxiliary.FindObject(canvas, "MultiplayerPanel"); stopwatchWindow = Auxiliary.FindObject(canvas, "StopwatchPanel"); statsWindow = Auxiliary.FindObject(canvas, "StatsPanel"); rulerWindow = Auxiliary.FindObject(canvas, "RulerPanel"); inputManagerPanel = Auxiliary.FindObject(canvas, "InputManagerPanel"); bindedKeyPanel = Auxiliary.FindObject(canvas, "BindedKeyPanel"); checkSavePanel = Auxiliary.FindObject(canvas, "CheckSavePanel"); // To access instatiate classes within a state, use the StateMachine.SceneGlobal toolkit = StateMachine.SceneGlobal.GetComponent <Toolkit>(); multiplayer = StateMachine.SceneGlobal.GetComponent <LocalMultiplayer>(); simUI = StateMachine.SceneGlobal.GetComponent <SimUI>(); robotCameraGUI = StateMachine.SceneGlobal.GetComponent <RobotCameraGUI>(); sensorManagerGUI = StateMachine.SceneGlobal.GetComponent <SensorManagerGUI>(); State = StateMachine.SceneGlobal.CurrentState as MainState; Button helpButton = Auxiliary.FindObject(helpMenu, "CloseHelpButton").GetComponent <Button>(); helpButton.onClick.RemoveAllListeners(); helpButton.onClick.AddListener(CloseHelpMenu); }
public bool CanShortcutPlay(Vector2 position, SoundContext sound_context) { if (!LocalMultiplayer.IsLocalMultiplayer(is_local_only: true)) { return(false); } if (Game1.eventUp && sound_context == SoundContext.NPC) { return(false); } if ((location == null || location == Game1.currentLocation) && CanHear(position)) { return(true); } bool someone_can_hear = false; if (location != null) { foreach (Game1 gameInstance in GameRunner.instance.gameInstances) { if (gameInstance.instanceGameLocation == location) { someone_can_hear = true; break; } } if (someone_can_hear && position != Vector2.Zero) { someone_can_hear = false; GameRunner.instance.ExecuteForInstances(delegate { if (!someone_can_hear && location == Game1.currentLocation && CanHear(position)) { someone_can_hear = true; } }); } return(someone_can_hear); } return(true); }
public void Awake() { if (GameObject.Find("btnCancel")) { btnCancel = GameObject.Find("btnCancel").GetComponent <Button>(); btnCancel.onClick.AddListener(() => { local.Cancel(); ShowGUI = true; }); btnCancel.gameObject.SetActive(false); } if (GameObject.Find("btnHost") && GameObject.Find("btnJoin")) { btnHost = GameObject.Find("btnHost").GetComponent <Button>(); btnHost.onClick.AddListener(() => { local.StartHosting(); ShowGUI = false; }); btnJoin = GameObject.Find("btnJoin").GetComponent <Button>(); btnJoin.onClick.AddListener(() => { local.StartJoining(); ShowGUI = false; }); btnHost.gameObject.SetActive(false); } local = FindObjectOfType(typeof(LocalMultiplayer)) as LocalMultiplayer; networkManager = GetComponent <LocalNetworkManager>(); }
public override void update(GameTime time) { if (quit) { if (Game1.activeClickableMenu.Equals(this) && Game1.PollForEndOfNewDaySync()) { Game1.exitActiveMenu(); } return; } base.update(time); if (Game1.client != null && Game1.client.timedOut) { quit = true; if (Game1.activeClickableMenu.Equals(this)) { Game1.exitActiveMenu(); } return; } _ellipsisDelay -= (float)time.ElapsedGameTime.TotalSeconds; if (_ellipsisDelay <= 0f) { _ellipsisDelay += 0.75f; _ellipsisCount++; if (_ellipsisCount > 3) { _ellipsisCount = 1; } } if (loader != null) { loader.MoveNext(); if (loader.Current >= 100) { margin -= time.ElapsedGameTime.Milliseconds; if (margin <= 0) { complete(); } } } else if (hasDrawn && completePause == -1) { if (Game1.IsMasterGame) { if (Game1.saveOnNewDay) { Game1.player.team.endOfNightStatus.UpdateState("ready"); if (Game1.newDaySync.readyForSave()) { Game1.multiplayer.saveFarmhands(); Game1.game1.IsSaving = true; loader = SaveGame.Save(); } } else { margin = -1; if (Game1.newDaySync.readyForSave()) { Game1.game1.IsSaving = true; complete(); } } } else { if (LocalMultiplayer.IsLocalMultiplayer()) { LocalMultiplayer.SaveOptions(); } if (!_hasSentFarmhandData) { _hasSentFarmhandData = true; Game1.multiplayer.sendFarmhand(); } Game1.multiplayer.UpdateLate(); Program.sdk.Update(); Game1.multiplayer.UpdateEarly(); Game1.newDaySync.readyForSave(); Game1.player.team.endOfNightStatus.UpdateState("ready"); if (Game1.newDaySync.hasSaved()) { saveClientOptions(); complete(); } } } if (completePause >= 0) { completePause -= time.ElapsedGameTime.Milliseconds; saveText.update(time); if (completePause < 0) { quit = true; completePause = -9999; } } }
public override void OnInspectorGUI() { serializedObject.Update(); LocalMultiplayer cm = (LocalMultiplayer)target; EditorGUILayout.Space(); EditorGUILayout.PropertyField(broadcastIdentifierProperty); EditorGUILayout.HelpBox("Your game will only connect to games matching the same Broadcast Identifier (eg. \'Spaceteam\' for Spaceteam games). Usually you should use the name of your own game here.", MessageType.None); // Check for errors if (cm.broadcastIdentifier == "Spaceteam" || cm.broadcastIdentifier == "") { GUI.color = Color.yellow; EditorGUILayout.HelpBox("Please choose a different identifier", MessageType.Warning); GUI.color = Color.white; } EditorGUILayout.PropertyField(minPlayersProperty); EditorGUILayout.HelpBox("The minimum number of players needed to start a game (eg. 2 for Spaceteam). You can change this to 1 for testing purposes.", MessageType.None); EditorGUILayout.PropertyField(maxPlayersProperty); EditorGUILayout.HelpBox("The maximum number of players supported (eg. 8 for Spaceteam).", MessageType.None); EditorGUILayout.PropertyField(playerPrefabProperty); EditorGUILayout.HelpBox("An object of this type will get created for each player that joins a game.", MessageType.None); // Check for errors if (playerPrefabProperty.objectReferenceValue == null) { GUI.color = Color.red; EditorGUILayout.HelpBox("Please choose a player prefab", MessageType.Error); GUI.color = Color.white; } EditorGUILayout.PropertyField(countdownDurationProperty); EditorGUILayout.HelpBox("The delay (in seconds) before starting a game once all players are ready.", MessageType.None); EditorGUILayout.PropertyField(listenerProperty); EditorGUILayout.HelpBox("The object that will receive messages like: JoinedLobby, StartGame, etc.", MessageType.None); // Check for errors if (listenerProperty.objectReferenceValue == null) { GUI.color = Color.red; EditorGUILayout.HelpBox("Please choose a listener", MessageType.Error); GUI.color = Color.white; } EditorGUILayout.PropertyField(verboseLoggingProperty); EditorGUILayout.HelpBox("Show lots of log messages for debugging.", MessageType.None); EditorGUILayout.PropertyField(useDebugGUIProperty); EditorGUILayout.HelpBox("Show a Debug GUI for testing connections.", MessageType.None); EditorGUILayout.PropertyField(forceServerProperty); EditorGUILayout.HelpBox("Force this device to be the server", MessageType.None); serializedObject.ApplyModifiedProperties(); }
public OptionsPage(int x, int y, int width, int height) : base(x, y, width, height) { upArrow = new ClickableTextureComponent(new Rectangle(xPositionOnScreen + width + 16, yPositionOnScreen + 64, 44, 48), Game1.mouseCursors, new Rectangle(421, 459, 11, 12), 4f); downArrow = new ClickableTextureComponent(new Rectangle(xPositionOnScreen + width + 16, yPositionOnScreen + height - 64, 44, 48), Game1.mouseCursors, new Rectangle(421, 472, 11, 12), 4f); scrollBar = new ClickableTextureComponent(new Rectangle(upArrow.bounds.X + 12, upArrow.bounds.Y + upArrow.bounds.Height + 4, 24, 40), Game1.mouseCursors, new Rectangle(435, 463, 6, 10), 4f); scrollBarRunner = new Rectangle(scrollBar.bounds.X, upArrow.bounds.Y + upArrow.bounds.Height + 4, scrollBar.bounds.Width, height - 128 - upArrow.bounds.Height - 8); for (int i = 0; i < 7; i++) { optionSlots.Add(new ClickableComponent(new Rectangle(xPositionOnScreen + 16, yPositionOnScreen + 80 + 4 + i * ((height - 128) / 7) + 16, width - 32, (height - 128) / 7 + 4), string.Concat(i)) { myID = i, downNeighborID = ((i < 6) ? (i + 1) : (-7777)), upNeighborID = ((i > 0) ? (i - 1) : (-7777)), fullyImmutable = true }); } options.Add(new OptionsElement(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11233"))); options.Add(new OptionsCheckbox(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11234"), 0)); options.Add(new OptionsCheckbox(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11235"), 7)); options.Add(new OptionsCheckbox(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11236"), 8)); options.Add(new OptionsCheckbox(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11237"), 11)); options.Add(new OptionsCheckbox(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11238"), 12)); if (Game1.game1.IsMainInstance) { options.Add(new OptionsDropDown(Game1.content.LoadString("Strings\\UI:Options_GamepadMode"), 38)); } options.Add(new OptionsDropDown(Game1.content.LoadString("Strings\\UI:Options_StowingMode"), 28)); options.Add(new OptionsDropDown(Game1.content.LoadString("Strings\\UI:Options_SlingshotMode"), 41)); options.Add(new OptionsCheckbox(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11239"), 27)); options.Add(new OptionsCheckbox(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11240"), 14)); options.Add(new OptionsCheckbox(Game1.content.LoadString("Strings\\UI:Options_GamepadStyleMenus"), 29)); options.Add(new OptionsCheckbox(Game1.content.LoadString("Strings\\UI:Options_ShowAdvancedCraftingInformation"), 34)); bool show_local_coop_options = false; if (Game1.game1.IsMainInstance && Game1.game1.IsLocalCoopJoinable()) { show_local_coop_options = true; } if (Game1.multiplayerMode == 2 || show_local_coop_options) { options.Add(new OptionsElement(Game1.content.LoadString("Strings\\UI:OptionsPage_MultiplayerSection"))); } if (Game1.multiplayerMode == 2 && Game1.server != null && !Game1.server.IsLocalMultiplayerInitiatedServer()) { options.Add(new OptionsDropDown(Game1.content.LoadString("Strings\\UI:GameMenu_ServerMode"), 31)); options.Add(new OptionsCheckbox(Game1.content.LoadString("Strings\\UI:OptionsPage_IPConnections"), 30)); options.Add(new OptionsCheckbox(Game1.content.LoadString("Strings\\UI:OptionsPage_FarmhandCreation"), 32)); } if (Game1.multiplayerMode == 2 && Game1.server != null) { options.Add(new OptionsDropDown(Game1.content.LoadString("Strings\\UI:GameMenu_MoveBuildingPermissions"), 40)); } if (Game1.multiplayerMode == 2 && Game1.server != null && !Game1.server.IsLocalMultiplayerInitiatedServer() && Program.sdk.Networking != null) { options.Add(new OptionsButton(Game1.content.LoadString("Strings\\UI:GameMenu_ServerInvite"), delegate { offerInvite(); })); if (Program.sdk.Networking.SupportsInviteCodes()) { options.Add(new OptionsButton(Game1.content.LoadString("Strings\\UI:OptionsPage_ShowInviteCode"), delegate { showInviteCode(); })); } } if (show_local_coop_options) { options.Add(new OptionsButton(Game1.content.LoadString("Strings\\UI:StartLocalMulti"), delegate { exitThisMenu(playSound: false); Game1.game1.ShowLocalCoopJoinMenu(); })); } if (Game1.IsMultiplayer) { options.Add(new OptionsCheckbox(Game1.content.LoadString("Strings\\UI:OptionsPage_ShowReadyStatus"), 35)); } options.Add(new OptionsElement(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11241"))); if (Game1.game1.IsMainInstance) { options.Add(new OptionsSlider(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11242"), 1)); options.Add(new OptionsSlider(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11243"), 2)); options.Add(new OptionsSlider(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11244"), 20)); options.Add(new OptionsSlider(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11245"), 21)); } options.Add(new OptionsDropDown(Game1.content.LoadString("Strings\\StringsFromCSFiles:BiteChime"), 42)); options.Add(new OptionsCheckbox(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11246"), 3)); options.Add(new OptionsCheckbox(Game1.content.LoadString("Strings\\StringsFromCSFiles:Options_ToggleAnimalSounds"), 43)); options.Add(new OptionsElement(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11247"))); if (!Game1.conventionMode && Game1.game1.IsMainInstance) { options.Add(new OptionsDropDown(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11248"), 13)); options.Add(new OptionsDropDown(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11251"), 6)); } if (Game1.game1.IsMainInstance) { options.Add(new OptionsCheckbox(Game1.content.LoadString("Strings\\UI:Options_Vsync"), 37)); } List <string> zoom_options = new List <string>(); for (int zoom2 = 75; zoom2 <= 150; zoom2 += 5) { zoom_options.Add(zoom2 + "%"); } options.Add(new OptionsPlusMinus(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage_UIScale"), 39, zoom_options, zoom_options)); zoom_options = new List <string>(); for (int zoom = 75; zoom <= 200; zoom += 5) { zoom_options.Add(zoom + "%"); } options.Add(new OptionsCheckbox(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11252"), 9)); options.Add(new OptionsCheckbox(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11253"), 15)); options.Add(new OptionsPlusMinus(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11254"), 18, zoom_options, zoom_options)); options.Add(new OptionsCheckbox(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11266"), 19)); if (Game1.game1.IsMainInstance) { options.Add(new OptionsPlusMinus(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11267"), 25, new List <string> { "Low", "Med.", "High" }, new List <string> { Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11268"), Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11269"), Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11270") })); } options.Add(new OptionsSlider(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11271"), 23)); options.Add(new OptionsCheckbox(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11272"), 24)); if (!LocalMultiplayer.IsLocalMultiplayer()) { options.Add(new OptionsCheckbox(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11273"), 26)); } options.Add(new OptionsElement(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11274"))); options.Add(new OptionsCheckbox(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11275"), 16)); options.Add(new OptionsCheckbox(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11276"), 22)); if (Game1.game1.IsMainInstance) { options.Add(new OptionsInputListener(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11277"), -1, optionSlots[0].bounds.Width)); options.Add(new OptionsInputListener(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11278"), 7, optionSlots[0].bounds.Width)); options.Add(new OptionsInputListener(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11279"), 10, optionSlots[0].bounds.Width)); options.Add(new OptionsInputListener(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11280"), 15, optionSlots[0].bounds.Width)); options.Add(new OptionsInputListener(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11281"), 18, optionSlots[0].bounds.Width)); options.Add(new OptionsInputListener(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11282"), 19, optionSlots[0].bounds.Width)); options.Add(new OptionsInputListener(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11283"), 11, optionSlots[0].bounds.Width)); options.Add(new OptionsInputListener(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11284"), 14, optionSlots[0].bounds.Width)); options.Add(new OptionsInputListener(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11285"), 13, optionSlots[0].bounds.Width)); options.Add(new OptionsInputListener(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11286"), 12, optionSlots[0].bounds.Width)); options.Add(new OptionsInputListener(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11287"), 17, optionSlots[0].bounds.Width)); options.Add(new OptionsInputListener(Game1.content.LoadString("Strings\\UI:Input_EmoteButton"), 33, optionSlots[0].bounds.Width)); options.Add(new OptionsInputListener(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11288"), 16, optionSlots[0].bounds.Width)); options.Add(new OptionsInputListener(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.toolbarSwap"), 32, optionSlots[0].bounds.Width)); options.Add(new OptionsInputListener(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11289"), 20, optionSlots[0].bounds.Width)); options.Add(new OptionsInputListener(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11290"), 21, optionSlots[0].bounds.Width)); options.Add(new OptionsInputListener(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11291"), 22, optionSlots[0].bounds.Width)); options.Add(new OptionsInputListener(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11292"), 23, optionSlots[0].bounds.Width)); options.Add(new OptionsInputListener(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11293"), 24, optionSlots[0].bounds.Width)); options.Add(new OptionsInputListener(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11294"), 25, optionSlots[0].bounds.Width)); options.Add(new OptionsInputListener(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11295"), 26, optionSlots[0].bounds.Width)); options.Add(new OptionsInputListener(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11296"), 27, optionSlots[0].bounds.Width)); options.Add(new OptionsInputListener(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11297"), 28, optionSlots[0].bounds.Width)); options.Add(new OptionsInputListener(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11298"), 29, optionSlots[0].bounds.Width)); options.Add(new OptionsInputListener(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11299"), 30, optionSlots[0].bounds.Width)); options.Add(new OptionsInputListener(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11300"), 31, optionSlots[0].bounds.Width)); } if (!Game1.game1.CanTakeScreenshots()) { return; } options.Add(new OptionsElement(Game1.content.LoadString("Strings\\UI:OptionsPage_ScreenshotHeader"))); int index = options.Count; if (!Game1.game1.CanZoomScreenshots()) { Action action = delegate { OptionsElement e = options[index]; Game1.flashAlpha = 1f; Console.WriteLine("{0}.greyedOut = {1}", e.label, true); e.greyedOut = true; Action onDone = delegate { Console.WriteLine("{0}.greyedOut = {1}", e.label, false); e.greyedOut = false; }; string text2 = Game1.game1.takeMapScreenshot(null, null, onDone); if (text2 != null) { Game1.addHUDMessage(new HUDMessage(text2, 6)); } Game1.playSound("cameraNoise"); }; OptionsButton btn = new OptionsButton(Game1.content.LoadString("Strings\\UI:OptionsPage_ScreenshotHeader").Replace(":", ""), action); if (Game1.game1.ScreenshotBusy) { btn.greyedOut = true; } options.Add(btn); } else { options.Add(new OptionsPlusMinusButton(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11254"), 36, new List <string> { "25%", "50%", "75%", "100%" }, new List <string> { "25%", "50%", "75%", "100%" }, Game1.mouseCursors2, new Rectangle(72, 31, 18, 16), delegate(string selection) { Game1.flashAlpha = 1f; selection = selection.Substring(0, selection.Length - 1); int result = 25; if (!int.TryParse(selection, out result)) { result = 25; } string text = Game1.game1.takeMapScreenshot((float)result / 100f, null, null); if (text != null) { Game1.addHUDMessage(new HUDMessage(text, 6)); } Game1.playSound("cameraNoise"); })); } if (Game1.game1.CanBrowseScreenshots()) { options.Add(new OptionsButton(Game1.content.LoadString("Strings\\UI:OptionsPage_OpenFolder"), delegate { Game1.game1.BrowseScreenshots(); })); } }
public void Awake() { lp = FindObjectOfType(typeof(LocalMultiplayer)) as LocalMultiplayer; }
public override void receiveLeftClick(int x, int y, bool playSound = true) { if (timerToLoad > 0 || loading || deleting) { return; } if (deleteConfirmationScreen) { if (cancelDeleteButton.containsPoint(x, y)) { deleteConfirmationScreen = false; selectedForDelete = -1; Game1.playSound("smallSelect"); if (Game1.options.snappyMenus && Game1.options.gamepadControls) { currentlySnappedComponent = getComponentWithID(0); snapCursorToCurrentSnappedComponent(); } } else if (okDeleteButton.containsPoint(x, y)) { deleting = true; if (LocalMultiplayer.IsLocalMultiplayer()) { deleteFile(selectedForDelete); deleting = false; } else { _deleteTask = new Task(delegate { Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; deleteFile(selectedForDelete); }); _deleteTask.Start(); } deleteConfirmationScreen = false; if (Game1.options.snappyMenus && Game1.options.gamepadControls) { currentlySnappedComponent = getComponentWithID(0); snapCursorToCurrentSnappedComponent(); } Game1.playSound("trashcan"); } return; } base.receiveLeftClick(x, y, playSound); if (downArrow.containsPoint(x, y) && currentItemIndex < Math.Max(0, MenuSlots.Count - 4)) { downArrowPressed(); } else if (upArrow.containsPoint(x, y) && currentItemIndex > 0) { upArrowPressed(); } else if (scrollBar.containsPoint(x, y)) { scrolling = true; } else if (!downArrow.containsPoint(x, y) && x > xPositionOnScreen + width && x < xPositionOnScreen + width + 128 && y > yPositionOnScreen && y < yPositionOnScreen + height) { scrolling = true; leftClickHeld(x, y); releaseLeftClick(x, y); } if (selected == -1) { for (int i = 0; i < deleteButtons.Count; i++) { if (deleteButtons[i].containsPoint(x, y) && i < MenuSlots.Count && !deleteConfirmationScreen) { deleteConfirmationScreen = true; Game1.playSound("drumkit6"); selectedForDelete = currentItemIndex + i; if (Game1.options.snappyMenus && Game1.options.gamepadControls) { currentlySnappedComponent = getComponentWithID(803); snapCursorToCurrentSnappedComponent(); } return; } } } if (!deleteConfirmationScreen) { for (int j = 0; j < slotButtons.Count; j++) { if (!slotButtons[j].containsPoint(x, y) || j >= MenuSlots.Count) { continue; } SaveFileSlot menu_save_slot; if ((menu_save_slot = (MenuSlots[currentItemIndex + j] as SaveFileSlot)) != null && menu_save_slot.versionComparison < 0) { menu_save_slot.redTimer = Game1.currentGameTime.TotalGameTime.TotalSeconds + 1.0; Game1.playSound("cancel"); continue; } Game1.playSound("select"); timerToLoad = MenuSlots[currentItemIndex + j].ActivateDelay; if (timerToLoad > 0) { loading = true; selected = currentItemIndex + j; } else { MenuSlots[currentItemIndex + j].Activate(); } return; } } currentItemIndex = Math.Max(0, Math.Min(MenuSlots.Count - 4, currentItemIndex)); }