//! Holds the events for when the interactive spatula on the Workbench is clicked public void OnClick() { if (gameController.GetCurrentState() != gameController.gameStates [0]) { MouseState currentState = CursorManager.GetCurrentState(); if (content is Mixture) //TODO:PROVISORIO! { if (currentState == MouseState.ms_default) { (GameObject.Find("GameController").GetComponent <GameController> ().GetCurrentState() as WorkBench).stateUIManager.OpenOptionDialog(this); } else { gameController.sendAlert("Este tipo de interação não está habilitada após uma possível reação"); } } else { switch (currentState) { case MouseState.ms_default: //Default -> Glassware: show the interaction options (GameObject.Find("GameController").GetComponent <GameController> ().GetCurrentState() as WorkBench).stateUIManager.OpenOptionDialog(this); break; case MouseState.ms_pipette: //Pipette -> Glassware: gets the liquid, if there's only liquid inside. So, opens the pipette's interaction box. Pipette pipette = (GameObject.Find("GameController").GetComponent <GameController> ().GetCurrentState() as WorkBench).pipette; if (hasLiquid) { if (pipette.graduated) { pipette.OpenGraduatedFillingBox(currentVolume, this); RefreshContents(); } else { pipette.FillVolumetricPipette(this); RefreshContents(); } } break; case MouseState.ms_filledPipette: // Filled Pipette -> Glassware: pours the pipette's contents into the glassware Pipette filledPipette = (GameObject.Find("GameController").GetComponent <GameController> ().GetCurrentState() as WorkBench).pipette; //filledPipette.UnfillPipette(this); if (filledPipette.graduated) { filledPipette.OpenGraduatedUnfillingBox(maxVolume - currentVolume, this); } else { filledPipette.UnfillVolumetricPipette(this); RefreshContents(); } break; case MouseState.ms_spatula: // Spatula -> Glassware: gets the solids, if there's only solid inside. So, opens the spatula's interaction box Spatula spatula = (GameObject.Find("GameController").GetComponent <GameController> ().GetCurrentState() as WorkBench).spatula; Debug.Log("Spatula clickou no Glassware"); if (content != null) { Debug.Log("Glassware nao esta vazio"); if (content is Compound && (content as Compound).IsSolid) { Debug.Log("Enchendo a espatula"); spatula.FillSpatula(this); } } break; case MouseState.ms_filledSpatula: // Filled Spatula -> Glassware: unloads the spatula into the glassare Spatula filledSpatula = (GameObject.Find("GameController").GetComponent <GameController> ().GetCurrentState() as WorkBench).spatula; //filledSpatula.OpenInteractionBox(maxVolume - currentVolume, this); filledSpatula.UnfillSpatula(maxVolume - currentVolume, this); break; case MouseState.ms_washBottle: // Washe Bottle -> Glassware: pours water into the glassware WashBottle washBottle = (GameObject.Find("GameController").GetComponent <GameController> ().GetCurrentState() as WorkBench).washBottle; washBottle.ActivateWashBottle(this.maxVolume - this.GetLiquidVolume(), this); break; case MouseState.ms_interacting: // Unable to click somewhere else break; } } if (gameController.GetCurrentState() == gameController.gameStates[6]) { (gameController.GetCurrentState().GetEquipmentController() as TurbidimeterController).bucketCanvas.SetActive(false); } } }
//! Holds the events for when the interactive reagent pot on the Workbench is clicked public void OnClick() { if (GameObject.Find("GameController").GetComponent <GameController>().GetCurrentState() != GameObject.Find("GameController").GetComponent <GameController>().gameStates [0]) { MouseState currentState = CursorManager.GetCurrentState(); Spatula spatula = (GameObject.Find("GameController").GetComponent <GameController> ().GetCurrentState() as WorkBench).spatula; Pipette pipette = (GameObject.Find("GameController").GetComponent <GameController> ().GetCurrentState() as WorkBench).pipette; switch (currentState) { case MouseState.ms_default: //Default -> Solid Reagent: open interaction box to take the reagent to the inventory? (GameObject.Find("GameController").GetComponent <GameController> ().GetCurrentState() as WorkBench).stateUIManager.OpenOptionDialog(this); break; case MouseState.ms_pipette: //Pipette -> Solid Reagent: nothing if (!isSolid) { if (reagent.FumeHoodOnly) //In case it should be use at the Fume Hood { if (GameObject.Find("GameController").GetComponent <GameController> ().currentStateIndex != 4) // If it is the FumeHoodState { GameObject.Find("GameController").GetComponent <GameController> ().sendAlert("Este reagente libera gases prejudiciais.\nDirija-se à capela"); } else //Sub-case: being use at the fume hood. { if (pipette.graduated) { pipette.OpenGraduatedFillingBox(this.reagent); } else { pipette.FillVolumetricPipette(this.reagent.Name); } } } else //Case: doesn't need fume hood { if (pipette.graduated) { pipette.OpenGraduatedFillingBox(this.reagent); } else { pipette.FillVolumetricPipette(this.reagent.Name); } } } break; case MouseState.ms_filledPipette: // Filled Spatula -> Solid Reagent: nothing if (pipette.reagentInPipette.Name == this.reagent.Name) { if (pipette.graduated) { pipette.OpenGraduatedUnfillingBox(this.reagent); } else { pipette.UnfillVolumetricPipette(); } } break; case MouseState.ms_spatula: // Spatula -> Solid Reagent: fill the spatula with the reagent clicked //spatula.OpenInteractionBox(true); //spatula.FillSpatula ((Compound)this.reagent.Clone ()); if (isSolid) { if (reagent.FumeHoodOnly) //In case it should be use at the Fume Hood { if (GameObject.Find("GameController").GetComponent <GameController> ().currentStateIndex != 4) // If it is the FumeHoodState { GameObject.Find("GameController").GetComponent <GameController> ().sendAlert("Este reagente libera gases prejudiciais.\nDirija-se à capela"); } else //Sub-case: being use at the fume hood. { spatula.FillSpatula(reagent.Name); } } else //Case: doesn't need fume hood { spatula.FillSpatula(reagent.Name); } } break; case MouseState.ms_filledSpatula: // Filled Spatula -> Solid Reagent: put back the content if it is the same reagent if (spatula.reagentInSpatula.Name == this.reagent.Name) { spatula.UnfillSpatula(); } //else // GameObject.Find("GameController").GetComponent<GameController>().GetCurrentState().GetComponent<WorkBench>().differentReagentErrorBox.SetActive(true); break; case MouseState.ms_washBottle: // Wash Bottle -> Solid Reagent: nothing break; case MouseState.ms_interacting: // Unable to click somewhere else TODO:is this necessary? break; } } }
private void SetupSettingsPanel() { panelSettings = new BaseElement { Width = { Percent = 100 }, Height = { Pixels = -28, Percent = 100 }, Y = { Pixels = 28 } }; UIText textWhitelist = new UIText(Language.GetText("Mods.BaseLibrary.UI.Whitelist")) { Y = { Pixels = 8 } }; panelSettings.Add(textWhitelist); buttonsWhitelist = new UIToggleButton[Container is TileEntities.UltimateTeleporter ? 5 : 4]; for (int i = 0; i < buttonsWhitelist.Length; i++) { buttonsWhitelist[i] = new UIToggleButton(Teleportation.whitelist[i], ScaleMode.Zoom) { Size = new Vector2(40), Y = { Pixels = 36 }, X = { Pixels = 48 * i }, Padding = new Padding(6, 6, 6, 6), Toggled = Container.Whitelist[i], HoverText = Language.GetText($"Mods.Teleportation.UI.Whitelist_{i}") }; int pos = i; buttonsWhitelist[i].OnClick += args => { Container.Whitelist[pos] = !Container.Whitelist[pos]; Net.SendTeleporterWhitelist(Container); }; panelSettings.Add(buttonsWhitelist[i]); } UIText textIcon = new UIText(Language.GetText("Mods.BaseLibrary.UI.Icon")) { Y = { Pixels = 84 } }; panelSettings.Add(textIcon); UIIcon buttonIcon = new UIIcon(Container) { Size = new Vector2(40), Y = { Pixels = 112 }, Padding = new Padding(6, 6, 6, 6), HoverText = Language.GetText("Mods.Teleportation.UI.SetIcon").Format(ModContent.ItemType <Pipette>()) }; buttonIcon.OnClick += args => { Pipette pipette = (Pipette)Main.mouseItem.modItem; if (pipette?.icon == null) { return; } Container.Icon = pipette.icon.Clone(); Net.SendTeleporterIcon(Container); Main.PlaySound(SoundID.MenuTick); }; panelSettings.Add(buttonIcon); }