/// <summary> /// Closes the character edit panel. /// Triggers transitions. /// Sets the CharacterWander script values. /// </summary> public void CloseCharacterEdit() { if (wanderToEdit != null) { if (charEditWanderToggleGroup.ActiveToggles().ToArray()[0].name == "Idle") { wanderToEdit.dropPoint = activeChar.transform.position; wanderToEdit.localWanderCenter = activeChar.transform.position; selectedMode = (CharacterWander.WanderMode) 0; } else if (charEditWanderToggleGroup.ActiveToggles().ToArray()[0].name == "Patrol") { if (float.Parse(radiusInput.text) > .5f) { selectedMode = (CharacterWander.WanderMode) 1; wanderToEdit.localWanderCenter = activeChar.transform.position; wanderToEdit.localWanderRadius = float.Parse(radiusInput.text); } else { selectedMode = (CharacterWander.WanderMode) 0; } } else if (charEditWanderToggleGroup.ActiveToggles().ToArray()[0].name == "Explore") { selectedMode = (CharacterWander.WanderMode) 2; } } iTween.MoveBy(charInfoPanel.gameObject, iTween.Hash("y", -Screen.height, "easeType", "easeInOutExpo", "time", .5f)); charEditPanel.gameObject.SetActive(false); }
public void Start() { selectedLanguage = toggleGroup.ActiveToggles().FirstOrDefault().name; foreach (Transform transformToggle in gameObject.transform) { var toggle = transformToggle.GetComponent <Toggle>(); if (toggle == null) { continue; } toggle.onValueChanged.AddListener((isSelected) => { if (!isSelected) { return; } var activeToggle = toggleGroup.ActiveToggles().FirstOrDefault(); onValueChange(activeToggle); }); } onValueChange += (newActive) => { selectedLanguage = newActive.name; }; }
private void Update() { if (canvas.enabled) { if (selectedToggle != toggleGroup.ActiveToggles().FirstOrDefault <Toggle>()) { selectedToggle = toggleGroup.ActiveToggles().FirstOrDefault <Toggle>(); selectedFacilityInfo = facilityList.GetFacilityByName(selectedToggle.transform.Find("Name").GetComponent <Text>().text); } if (selectedToggle != null) { if (playerStats.GetCompanyFunds() >= selectedFacilityInfo.costToBuy && selectedFacility.CheckFacilitySize(selectedFacilityInfo)) { confirmButton.interactable = true; } else { confirmButton.interactable = false; } } else { confirmButton.interactable = false; } } }
public void SwitchToResultScreen() { if (!ValidateSubmitAllOfFactors()) { panelAlert.SetActive(true); return; } oneYearSurvivalProbability.text = (CaliculateOneYearSurvivalProbability( int.Parse(initialPSA.text), initialMetastasis.ActiveToggles().First().GetComponentsInChildren <Localization.LocalizedText>().First(t => t.name == "Text").GetKey == "m1", int.Parse(gleasonScore.ActiveToggles().First().GetComponentsInChildren <Localization.LocalizedText>().First(t => t.name == "Text").GetKey), int.Parse(timeToCRPC.text), chemotherapy.ActiveToggles().First().GetComponentsInChildren <Localization.LocalizedText>().First(t => t.name == "Text").GetKey == "yes", int.Parse(currentAge.text), int.Parse(currentPSA.text), int.Parse(currentALP.text), int.Parse(currentLDH.text) ) * 100).ToString("f1"); twoYearSurvivalProbability.text = (CaliculateTwoYearSurvivalProbability( int.Parse(initialPSA.text), initialMetastasis.ActiveToggles().FirstOrDefault().GetComponentsInChildren <Localization.LocalizedText>().First(t => t.name == "Text").GetKey == "m1", int.Parse(gleasonScore.ActiveToggles().FirstOrDefault().GetComponentsInChildren <Text>().First(t => t.name == "Text").text), int.Parse(timeToCRPC.text), chemotherapy.ActiveToggles().FirstOrDefault().GetComponentsInChildren <Localization.LocalizedText>().First(t => t.name == "Text").GetKey == "yes", int.Parse(currentAge.text), int.Parse(currentPSA.text), int.Parse(currentALP.text), int.Parse(currentLDH.text) ) * 100).ToString("f1"); inputScreen.SetActive(false); resultScreen.SetActive(true); }
/// <summary> /// Raised when the player joins a room. /// </summary> void OnJoinedRoom() { _chat.enabled = true; _chat.InMenu = true; Debug.Log("Joined a room"); GameObject.Find("WaitForGameStartCanvas").GetComponent <Canvas>().enabled = true; if (!GameObject.Find("SettingsManager").GetComponent <Settings>().OnlineMode) { GameObject.Find("WaitForGameStartCanvas/Text").GetComponent <Text>().text = "START THE GAME"; } GameObject.Find("MatchmakingCanvas").GetComponent <Canvas>().enabled = false; if (!PhotonNetwork.isMasterClient) { _waitingForGameStartText.text = PhotonNetwork.room.PlayerCount + " players are in the room."; } Constants.ROBOT_IDS robotID; if (_robotSelect.ActiveToggles().FirstOrDefault() == _talltoggle) { robotID = Constants.ROBOT_IDS.ROBOT_1; } if (_robotSelect.ActiveToggles().FirstOrDefault() == _shorttoggle) { robotID = Constants.ROBOT_IDS.ROBOT_2; } else { robotID = Constants.ROBOT_IDS.ROBOT_1; } _engine = new GameEngine(_mapID, robotID); }
public void UpdateRankingViews() { ClearRankingRecords(); var playerName = GameMaster.gameMaster.settings.name; var id = tggMode.ActiveToggles().FirstOrDefault().GetComponent <ModeElementForRanking>().id; var direction = tggDirection.ActiveToggles().FirstOrDefault().GetComponent <DirectionElementForRanking>().directionType; var category = tggCategory.ActiveToggles().FirstOrDefault().GetComponent <CategoryElementForRanking>().category; txtName.text = "Your Name:" + playerName; //rankingManager.fetchRank(playerName, id, direction,SetPlayerRank); switch (category) { case CategoryElementForRanking.categorys.TOP: rankingManager.getRankingTop(id, direction, CreateRankingRecords); break; case CategoryElementForRanking.categorys.RIVAL: rankingManager.getRankingNeighbors(playerName, id, direction, CreateRankingRecords); break; default: break; } }
// Update is called once per frame void Update() { bool maySaveSceneName = sessionToggleGroup != null && sessionToggleGroup.ActiveToggles().FirstOrDefault() != null; if (maySaveSceneName) { selectedScene = sessionToggleGroup .ActiveToggles().FirstOrDefault() .GetComponentInChildren <Text>().text; } bool maySaveAiCount = aiDropDown != null && tempScene != selectedScene; if (maySaveAiCount) { ChangeDropdownOptions(); } if (aiDropDown != null) { selectedAiCount = aiDropDown.captionText.text; } tempScene = selectedScene; }
/// <summary> /// 依据主列带副列表选项显隐物品 /// </summary> void ShowItemByMianItem() { //print("1--" + viceToggleGroup.ActiveToggles().First()); if (0 != viceToggleGroup.ActiveToggles().Count()) { viceActiveToggle = viceToggleGroup.ActiveToggles().First(); } if (null != viceActiveToggle) //当前副列表有某项被激活 { MainItemType mainEnumType = (MainItemType)Enum.Parse(typeof(MainItemType), mainActiveToggle.name, true); //获取总列表当前激活的那一项对应枚举 switch (mainEnumType) { case MainItemType.Equip: ViceEquipItemType equipEnum = (ViceEquipItemType)Enum.Parse(typeof(ViceEquipItemType), viceActiveToggle.name, true); //获取副列表当前激活的那一项对应枚举 ShowItemByViceItem(equipEnum); break; case MainItemType.Drug: ShowItemByViceItem("未实现"); break; default: ShowItemByViceItem("未实现"); break; } } }
public void MaskGraphic(bool isOn) { if (tabs.AnyTogglesOn()) { ArtTab currTab = tabs.ActiveToggles().First().GetComponent <ArtTab>(); currTab.artLayer.ApplyMask(isOn); if (currTab.artLayer == art) { data.mainArt.masked = isOn; Save(); return; } else { for (int i = 0; i < foregroundLayers.Count; i++) { if (currTab.artLayer == foregroundLayers[i]) { data.foregroundLayers[i].masked = isOn; Save(); return; } } for (int i = 0; i < backgroundLayers.Count; i++) { if (currTab.artLayer == backgroundLayers[i]) { data.backgroundLayers[i].masked = isOn; Save(); return; } } } } }
/// <summary> /// Verifica qual item do painel de seleção foi escolhido no click do mouse /// </summary> /// <param name="pointerClick"></param> public void OnPointerClick(PointerEventData pointerClick) { // Pega o nome do primeir item selecionado no painel // Como o painel só pode ter um selecionado ao mesmo tempo, pega o único escolhido string tempToggleName = toggleGroup.ActiveToggles().FirstOrDefault().name; // Junta o nome do selecionado com Selected pra chamar a função responsável por aquela aba tempToggleName = string.Concat(tempToggleName, "Selected"); Invoke(tempToggleName, 0); }
void Update() { if (armorToggleGroup.ActiveToggles().FirstOrDefault() != null) { currArmorObject = armorToggleGroup.ActiveToggles().FirstOrDefault().gameObject; } if (weaponToggleGroup.ActiveToggles().FirstOrDefault() != null) { currWeaponObject = weaponToggleGroup.ActiveToggles().FirstOrDefault().gameObject; } }
private void SavedDeckMenu_FillSavedDeck() { ToggleGroup tg = savedDeckDeckList.GetComponent <ToggleGroup>(); tg.ActiveToggles().GetEnumerator().MoveNext(); Toggle selectedDeck = tg.ActiveToggles().FirstOrDefault(); Transform panel = selectedDeck.transform; string deckPath = panel.Find("DeckPath").GetComponent <Text>().text; string deckName = panel.Find("DeckName").GetComponent <Text>().text; deckName = deckName.Split('.')[0]; SavedDeckMenu_LoadDeckFromXml(deckPath, deckName); }
// conditions keep the camera from going off-map, leaving a margin for zoom-in/out private void MoveCameraWithButtons() { if (navigationButtonsToggleGroup.ActiveToggles().Any()) { Origin = transform.position; Diference = new Vector3(); transform.position += new Vector3(cameraSpeedX, cameraSpeedY, 0); float x = Mathf.Clamp(transform.position.x, westMin, eastMax); float y = Mathf.Clamp(transform.position.y, southMin, northMax); transform.position = new Vector3(x, y, 0); } }
/// <summary> /// Determines whether this instance has selected toggle. /// </summary> /// <returns><c>true</c> if this instance has selected toggle; otherwise, <c>false</c>.</returns> public bool HasSelectedToggle() { Toggle numberToggles = toggleGroup.ActiveToggles().FirstOrDefault(); if (numberToggles != null) { Toggle selected = toggleGroup.ActiveToggles().First(); if (selected != null) { return(true); } } return(false); }
public void groupInteractable(bool _bool) { foreach (var it in toggles.ActiveToggles()) { it.interactable = _bool; } }
public void OnBonusElementToggleValueChanged(MapViewBonusElement bonusElement, bool isChecked) { ToggleGroup component = base.GetComponent <ToggleGroup>(); if (!isChecked) { if (!component.AnyTogglesOn()) { this.selectedBonusElement = null; this.onSelectedBonusElementChanged(this.selectedBonusElement); } } else { this.selectedBonusElement = bonusElement; this.onSelectedBonusElementChanged(this.selectedBonusElement); foreach (Toggle toggle in component.ActiveToggles()) { if (toggle != this.selectedBonusElement.Toggle) { toggle.isOn = false; } } if (isChecked) { UISoundEffectController.UITransformRoot.GetComponent <DailyBonusScreenSoundsRoot>().dailyBonusSoundsBehaviour.PlayClick(); } } }
// Update is called once per frame public void CameraChange() { //Toggle currentView; _currentView = ViewToggleGroup.ActiveToggles().FirstOrDefault()?.gameObject.name; switch (_currentView) { case "Free": ActiveCam = FreeCam; FreeCam.gameObject.SetActive(true); TopCam.gameObject.SetActive(false); LeftCam.gameObject.SetActive(false); break; case "Left": ActiveCam = LeftCam; FreeCam.gameObject.SetActive(false); TopCam.gameObject.SetActive(false); LeftCam.gameObject.SetActive(true); break; case "Top": ActiveCam = TopCam; FreeCam.gameObject.SetActive(false); TopCam.gameObject.SetActive(true); LeftCam.gameObject.SetActive(false); break; } }
public void OnChangeDifficulty(bool selected) { if (!selected) { return; } string toggleName = DifficultyToggleGroup.ActiveToggles().First().name; if (toggleName == "Easy") { difficulty = Difficulty.Easy; DifficultyText.text = "简单"; } else if (toggleName == "Medium") { difficulty = Difficulty.Medium; DifficultyText.text = "中等"; } else if (toggleName == "Hard") { difficulty = Difficulty.Hard; DifficultyText.text = "困难"; } InitGame(); }
public void GetValues() { foreach (var item in gendergroup.ActiveToggles()) { g = item.name; break; } //Debug.Log ("signup pressed "+cnic.text); Debug.Log("signup pressed " + name.text); Debug.Log("signup pressed " + g); Debug.Log("signup pressed " + age.text); Debug.Log("signup pressed " + num_siblings.text); Debug.Log("signup pressed " + medical_info.text); WWW www; WWWForm form = new WWWForm(); //form.AddField ("id", cnic.text); form.AddField("uid", LoginScript.userid); //add login id later LoginScript.userid form.AddField("name", name.text); form.AddField("gender", g); form.AddField("age", age.text); form.AddField("medicondition", medical_info.text); form.AddField("sib", num_siblings.text); www = new WWW(POSTAddUserURL, form); StartCoroutine(WaitForRequest(www)); }
void SetMode() { string n = modeGroup.ActiveToggles().First().name; ResourceSystem.ResMode = (ResourceSystem.Mode)Enum.Parse(typeof(ResourceSystem.Mode), n); ResLog.Log("Current mode: " + n); }
public void BigButton() { foreach (Toggle toggle in groupToggle.ActiveToggles()) { dificultyText.text = ("Dificulty mode: " + toggle.name); Debug.Log("Dificulty mode: " + toggle.name); } Debug.Log("Music volume: " + Mathf.RoundToInt(Music.value * 100) + "%"); Debug.Log("Audio effects volume: " + Mathf.RoundToInt(sound.value * 100) + "%"); soundText.text = ("Music volume: " + Mathf.RoundToInt(Music.value * 100) + "%"); audioText.text = ("Audio effects volume: " + Mathf.RoundToInt(sound.value * 100) + "%"); Debug.Log(dropDown.value + "is the dropdown value"); if (dropDown.value == 0) { fullScreenText.text = ("Screen mode: FullScreen"); Screen.fullScreenMode = FullScreenMode.FullScreenWindow; } else if (dropDown.value == 1) { fullScreenText.text = ("Screen mode: Windowed"); Screen.fullScreenMode = FullScreenMode.Windowed; } gameObject.SetActive(false); }
public void Retrieve_Difficulty() { ToggleGroup toggleGroup = GameObject.Find("ToggleGroup_Difficulty").GetComponent <ToggleGroup>(); string toggleName = "Toggle_Difficulty_Easy"; foreach (Toggle toggle in toggleGroup.ActiveToggles()) { // Active toggle toggleName = toggle.name; } switch (toggleName) { case "Toggle_Difficulty_Easy": gameSetupData.Difficulty = Enum_Difficulty.EASY; SetTimeLimit(0); break; case "Toggle_Difficulty_Medium": gameSetupData.Difficulty = Enum_Difficulty.MEDIUM; SetTimeLimit(1); break; case "Toggle_Difficulty_Hard": gameSetupData.Difficulty = Enum_Difficulty.HARD; SetTimeLimit(2); break; default: break; } }
public void ReturnSurvey() { string feedback = ""; int q1 = int.Parse(q1Tog.ActiveToggles().FirstOrDefault().name); int q2 = int.Parse(q2Tog.ActiveToggles().FirstOrDefault().name); int q3 = int.Parse(q3Tog.ActiveToggles().FirstOrDefault().name); int q4 = int.Parse(q4Tog.ActiveToggles().FirstOrDefault().name); int q5 = int.Parse(q5Tog.ActiveToggles().FirstOrDefault().name); int q6 = int.Parse(q6Tog.ActiveToggles().FirstOrDefault().name); feedback += "Q1: " + q1 + " comment: " + q1In.text + "\n"; feedback += "Q2: " + q2 + " comment: " + q2In.text + "\n"; feedback += "Q3: " + q3 + " comment: " + q3In.text + "\n"; feedback += "Q4: " + q4 + " comment: " + q4In.text + "\n"; feedback += "Q5: " + q5 + " comment: " + q5In.text + "\n"; feedback += "Q6: " + q6 + " comment: " + q6In.text + "\n"; feedback += "Q7: comment: " + q7In.text + "\n"; feedback += "Q8: comment: " + q8In.text + "\n\n"; if (sendData == true) { StartCoroutine(SendToFile(control.instance.current, feedback)); } //form.SetActive(false); control.instance.Back(); }
public int GetActiveToggle() { toggles = toggleGroup.ActiveToggles(); foreach (Toggle toggle in toggles) { selectedStageName = toggle.name; } int idx = 0; // ステージ名をインデックスに変換 switch (selectedStageName) { case "Stage1": idx = 1; break; case "Stage2": idx = 2; break; case "Stage3": idx = 3; break; default: break; } return(idx); }
// This function is called by the EventSystem when the player clicks on the PerformActionButton. public void TakeAction() { // Compute the screen position 2 units above the unit and place the talkBox. Vector3 pos = selectedUnit.transform.position + Vector3.up * 2; pos = Camera.main.WorldToScreenPoint(pos); talkBox.transform.position = pos; // Figure out which toggle button is selected in the action select toggleGroup // and store the text value of the button in a string. IEnumerable <Toggle> activeToggles = actionSelectToggleGroup.ActiveToggles(); string action = ""; foreach (Toggle t in activeToggles) { if (t.IsActive()) { action = t.gameObject.GetComponentInChildren <Text>().text; } } // This registers a function with Unity's coroutine system (see notes above the function definition) if (action == "Chuck Norris Joke") { StartCoroutine(displayTalkBoxMessages(norrisJokes)); } else if (action == "Fire") { fireCat(); } }
public void onClick() { //Get the label in activated toggles string selectedLabel = toggleGroup.ActiveToggles() .First().GetComponentsInChildren <Text>() .First(t => t.name == "Label").text; Debug.Log("selected " + selectedLabel); name = InputManager.getInputValue(); string gaku = toggleGroup2.ActiveToggles() .First().GetComponentsInChildren <Text>() .First(t => t.name == "Label").text; StreamWriter streamWriter; FileInfo fileInfo; fileInfo = new FileInfo(Application.dataPath + "/" + filepathname + "/" + name + ".csv"); streamWriter = fileInfo.AppendText(); streamWriter.WriteLine(selectedLabel + "," + 0); streamWriter.WriteLine(gaku + "," + 0); streamWriter.Flush(); streamWriter.Close(); SceneManager.LoadScene("stage1"); }
public int GetShowingPage() { if (_TagPanels.Count > 0) { var toggle = _ToggleGroup.ActiveToggles(); for (int i = 0; i < _TagPanels.Count; ++i) { if (_TagPanels[i].activeInHierarchy) { return(i); } } return(-1); } else { for (int i = 0; i < _Tags.Count; ++i) { if (_Tags[i].isOn == true) { return(i); } } return(-1); } }
private void Update() { Toggle active = toggleGroup.ActiveToggles().FirstOrDefault(x => x.isOn); if (active == null) { selectionErrorText.text = "Please Select at least one save file."; return; } else { selectionErrorText.text = ""; } FileData data = active.GetComponent <FileData>(); if (data == selected) { return; } selected = data; inputField.text = Path.GetFileNameWithoutExtension(selected.Info.Name); loadButton.interactable = true; }
/// <summary> /// Stops recording audio for each speech-to-text service widget if already recording. Also schedules a wrap-up of the /// current comparison session to happen after the responses timeout. /// </summary> void StopRecording() { if (m_IsRecording) { m_IsRecording = false; // Disable all UI interaction until all responses have been received or after the specified timeout. DisableAllUIInteraction(); m_RecordButtonImage.color = m_NotRecordingButtonColor; Invoke("FinishComparisonSession", m_ResponsesTimeoutInSeconds); // If a phrase is selected, pass it to the SpeechToTextServiceWidget. string comparisonPhrase = null; if (m_PhrasesToggleGroup.AnyTogglesOn()) { IEnumerator <Toggle> toggleEnum = m_PhrasesToggleGroup.ActiveToggles().GetEnumerator(); toggleEnum.MoveNext(); comparisonPhrase = toggleEnum.Current.gameObject.GetComponentInChildren <Text>().text; } foreach (var serviceWidget in m_SpeechToTextServiceWidgets) { serviceWidget.StopRecording(comparisonPhrase); } } }
private void OnToggleChangeValue(bool value) { List <Toggle> activeToggles = new List <Toggle>(toggleGroup.ActiveToggles()); if (activeToggles.Count > 1) { Debug.LogError("Error on selected toggles"); return; } if (activeToggles.Count != 0) { int index = toggleList.IndexOf(activeToggles[0]); if (index == -1) { Debug.LogWarning("Configuration error on item/toggles relation in " + this.name); SelectedItem = null; return; } SelectedItem = items[index]; } else { SelectedItem = null; } }