public void ResetBoxDropdown() { BoxDropdown.ClearOptions(); BoxDropdown.AddOptions(BoxDropdownOptions); BoxDropdown.RefreshShownValue(); }
void Init() { // load all languages (must happen before courses load so they can pull from the dictionary) DirectoryInfo languageDirInfo = new DirectoryInfo(configFolderPath + "Languages/"); if (!languageDirInfo.Exists || languageDirInfo.GetFiles().Length == 0) { input.text = "No languages were found."; return; } languages.Clear(); foreach (FileInfo file in languageDirInfo.GetFiles()) { if (file.Extension == ".lang") { try { string contents = File.ReadAllText(file.FullName); Language newLang = Language.ParseConfig(contents); input.text += newLang.Name + '\n'; languages.Add(newLang.Name, newLang); } catch (Exception e) { // includes language parse errors input.text = "Error on file: " + file.FullName + "\n" + e.ToString(); return; } } } courses.Clear(); courseDropdown.ClearOptions(); List <string> courseOptions = new List <string>(); DirectoryInfo info = new DirectoryInfo(configFolderPath + "Courses/"); DirectoryInfo[] dirInfo = info.GetDirectories(); if (dirInfo.Length == 0) { input.text = "No courses were found."; return; } // loops through course directories foreach (DirectoryInfo directory in dirInfo) { try { Course course = new Course(directory.Name); courseOptions.Add(course.Name); courses.Add(course.Name, course); } catch (Exception e) { courseOptions.Add(e.Message); print(e.ToString()); } } courseDropdown.AddOptions(courseOptions); // load default config OnCourseDropDownChange(); }
private void Awake() { _languageDropdown.ClearOptions(); _languageDropdown.AddOptions(Localization.Languages.Select(l => l.NativeName).ToList()); _languageDropdown.value = _languageDropdown.options.FindIndex(l => l.text == Localization.SelectedLanguage.NativeName); }
void Awake() { SpriteState sprState; Dropdown.OptionData data1, data2, data3, data4; List <Dropdown.OptionData> datas = new List <Dropdown.OptionData>(); if (Application.systemLanguage == SystemLanguage.Portuguese) { score = "PONTUAÇÃO:"; applyingText = "APLICANDO \n "; noCoinsError = "Você não tem BioCoins suficientes"; daysLeftText = "dias restantes"; objectiveTextPt1 = "OBJETIVO\n"; objectiveTextPt2 = " mg/Kg DE CONCENTRAÇÃO"; moistureLow = "BAIXA"; moistureMedium = "MÉDIO"; moistureHigh = "ALTA"; day = "DIA "; attenuation = "ATENUAÇÃO NATURAL "; bioestimulation = "BIOESTIMULAÇÃO "; bioaumentation = "BIOAUMENTAÇÃO "; background.sprite = backgroundPT; calendar.sprite = calendarPT; textWin.text = "VOCE VENCEU"; textLose.text = "VOCE PERDEU"; selectActionText.text = "SELECIONE UMA AÇÃO"; lastResultText.text = "ULTIMO RESULTADO"; scoreText.text = "Pontuação:"; removedText.text = "Removido:"; levelContaminationText.text = "Nivel de\nContaminação"; quantityText.text = "Porcentagem atual"; objectiveGraphText.text = "OBJETIVO"; viewEveryText.text = "Ver a cada"; dropdown.ClearOptions(); data1 = new Dropdown.OptionData(); data1.text = "5 dias"; datas.Add(data1); data2 = new Dropdown.OptionData(); data2.text = "20 dias"; datas.Add(data2); data3 = new Dropdown.OptionData(); data3.text = "50 dias"; datas.Add(data3); data4 = new Dropdown.OptionData(); data4.text = "100 dias"; datas.Add(data4); foreach (Dropdown.OptionData item in datas) { dropdown.options.Add(item); } sprState.pressedSprite = button1PT[1]; button1.GetComponent <Image>().sprite = button1PT[0]; button1.GetComponent <Button>().spriteState = sprState; sprState.pressedSprite = button2PT[1]; button2.GetComponent <Image>().sprite = button2PT[0]; button2.GetComponent <Button>().spriteState = sprState; sprState.pressedSprite = button3PT[1]; button3.GetComponent <Image>().sprite = button3PT[0]; button3.GetComponent <Button>().spriteState = sprState; sprState.pressedSprite = button4PT[1]; sprState.disabledSprite = button4PT[2]; button4.GetComponent <Image>().sprite = button4PT[0]; button4.GetComponent <Button>().spriteState = sprState; sprState.pressedSprite = button5PT[1]; sprState.disabledSprite = button5PT[2]; button5.GetComponent <Image>().sprite = button5PT[0]; button5.GetComponent <Button>().spriteState = sprState; sprState.pressedSprite = vizualizeResultPT[1]; vizualizeResult.GetComponent <Image>().sprite = vizualizeResultPT[0]; vizualizeResult.GetComponent <Button>().spriteState = sprState; raking.text = "Classificação"; sprState.pressedSprite = nextPhasePT[1]; nextPhase.GetComponent <Image>().sprite = nextPhasePT[0]; nextPhase.GetComponent <Button>().spriteState = sprState; sprState.pressedSprite = tryAgainPT[1]; tryAgain.GetComponent <Image>().sprite = tryAgainPT[0]; tryAgain.GetComponent <Button>().spriteState = sprState; sprState.pressedSprite = exitPT[1]; exit.GetComponent <Image>().sprite = exitPT[0]; exit.GetComponent <Button>().spriteState = sprState; } }
void initializeTimeDelay() { m_Dropdown_TimeDelay.ClearOptions(); m_Dropdown_TimeDelay.AddOptions(timedelay_list); }
private void Start() { m_dpdEventList.ClearOptions(); m_dpdEventList.onValueChanged.AddListener(delegate { SelectEvent(m_dpdEventList.value); }); //绑定添加事件的监听 Button buttonNewEvent = m_objNewEvent.transform.Find("Btn_confirm").GetComponent <Button>(); Dropdown dropdown = m_objNewEvent.transform.Find("EventType").GetComponentInChildren <Dropdown>(); buttonNewEvent.onClick.AddListener(delegate { AddEvent(dropdown.captionText.text); }); //添加删除事件的监听 if (m_objEventAttribute.transform.Find("Btn_Delete") != null) { Button buttonDeleteEvent = m_objEventAttribute.transform.Find("Btn_Delete").GetComponent <Button>(); buttonDeleteEvent.onClick.AddListener(delegate { DeleteEvent(m_dpdEventList.value); }); } //绑定出生事件的各个控件监听 InputField inputField00 = m_objBirthEvent.transform.Find("CD").GetComponentInChildren <InputField>(); inputField00.onEndEdit.AddListener(delegate { SetBirthCD(inputField00.text); }); InputField inputField01 = m_objBirthEvent.transform.Find("Time").GetComponentInChildren <InputField>(); inputField01.onEndEdit.AddListener(delegate { SetBirthTime(inputField01.text); }); Toggle toggle0 = m_objBirthEvent.transform.Find("IsInfinite").GetComponentInChildren <Toggle>(); toggle0.onValueChanged.AddListener(delegate { SetBirthISF(toggle0.isOn); }); //绑定爆炸事件的各个控件监听 InputField inputField10 = m_objBombEvent.transform.Find("Delay").GetComponentInChildren <InputField>(); inputField10.onEndEdit.AddListener(delegate { SetBombDelay(inputField10.text); }); InputField inputField11 = m_objBombEvent.transform.Find("Hurt").GetComponentInChildren <InputField>(); inputField11.onEndEdit.AddListener(delegate { SetBombHurt(inputField11.text); }); Toggle toggle1 = m_objBombEvent.transform.Find("IsDestroy").GetComponentInChildren <Toggle>(); toggle1.onValueChanged.AddListener(delegate { SetBombISD(toggle1.isOn); }); //绑定速度事件的各个控件监听 InputField inputField20 = m_objSpeedEvent.transform.Find("Speed").GetComponentInChildren <InputField>(); inputField20.onEndEdit.AddListener(delegate { SetSpeedSpeed(inputField20.text); }); InputField inputField21 = m_objSpeedEvent.transform.Find("Time").GetComponentInChildren <InputField>(); inputField21.onEndEdit.AddListener(delegate { SetSpeedTime(inputField21.text); }); Toggle toggle2 = m_objSpeedEvent.transform.Find("IsInfinite").GetComponentInChildren <Toggle>(); toggle2.onValueChanged.AddListener(delegate { SetSpeedISF(toggle2.isOn); }); //绑定传送事件的各个控件监听 InputField inputField30 = m_objTeleportEvent.transform.Find("TeleportID").GetComponentInChildren <InputField>(); inputField30.onEndEdit.AddListener(delegate { SetTeleportID(inputField30.text); }); InputField inputField31 = m_objTeleportEvent.transform.Find("CD").GetComponentInChildren <InputField>(); inputField31.onEndEdit.AddListener(delegate { SetTeleportCD(inputField31.text); }); InputField inputField32 = m_objTeleportEvent.transform.Find("Time").GetComponentInChildren <InputField>(); inputField32.onEndEdit.AddListener(delegate { SetTeleportTime(inputField32.text); }); Toggle toggle3 = m_objTeleportEvent.transform.Find("IsInfinite").GetComponentInChildren <Toggle>(); toggle3.onValueChanged.AddListener(delegate { SetTeleportISF(toggle3.isOn); }); }
//Ariel //The following loads a save file . public void LoadData() { ClearStage(); SceneList = new List <Scene>(); SaveableSceneList = new List <SaveableScene>(); //------------------------------------------Load the saved actors and props Save data = SaveSystem.loadData(); int LoadIndex = 0; while (LoadIndex <= data.numObjectsSave - 1) { float[] loadPosArray = new float[3]; loadPosArray[0] = data.vec3PositionsAsFloat[LoadIndex, 0]; loadPosArray[1] = data.vec3PositionsAsFloat[LoadIndex, 1]; loadPosArray[2] = data.vec3PositionsAsFloat[LoadIndex, 2]; //Debug.Log("Load Data ActorOrProp Object: " + data.actorOrProp[LoadIndex]); if (data.actorOrProp[LoadIndex].Equals("Player")) { if (data.BlueOrPink[LoadIndex] == 0) { GameObject newObject = Instantiate(actorDrop.prefabList[0], new Vector3(loadPosArray[0], loadPosArray[1], loadPosArray[2]), actorDrop.prefabList[0].transform.rotation); //------------------------ Add selection circle to object GameObject newSelectionCircle = Instantiate(selectionCirclePrefab); newSelectionCircle.transform.SetParent(newObject.transform); newSelectionCircle.SetActive(false); //------------------------ objectList.Add(newObject); actorOrProp.Add("Actor"); BlueOrPink.Add(0); } else if (data.BlueOrPink[LoadIndex] == 1) { GameObject newObject = Instantiate(actorDrop.prefabList[1], new Vector3(loadPosArray[0], loadPosArray[1], loadPosArray[2]), actorDrop.prefabList[1].transform.rotation); //------------------------ Add selection circle to object GameObject newSelectionCircle = Instantiate(selectionCirclePrefab); newSelectionCircle.transform.SetParent(newObject.transform); newSelectionCircle.SetActive(false); //------------------------ objectList.Add(newObject); actorOrProp.Add("Actor"); BlueOrPink.Add(1); } } else if (data.actorOrProp[LoadIndex].Equals("Props")) { GameObject newObject = Instantiate(propDrop.prefabList[0], new Vector3(loadPosArray[0], loadPosArray[1], loadPosArray[2]), propDrop.prefabList[0].transform.rotation); //------------------------ Add selection circle to object GameObject newSelectionCircle = Instantiate(selectionCirclePrefab); newSelectionCircle.transform.SetParent(newObject.transform); newSelectionCircle.SetActive(false); //------------------------ objectList.Add(newObject); actorOrProp.Add("Props"); BlueOrPink.Add(-1); } else { Debug.Log("Instantiating a null Game Object?"); } LoadIndex++; } //--------------------------Reinstantiating the SceneList SaveableSceneList = data.scenes; foreach (SaveableScene scene in SaveableSceneList) { Scene tempScene = new Scene(); tempScene.saveableScenesIntoScenes(scene, this); int actorCount = 0; foreach (List <Vector3> pos in tempScene.positions) { foreach (Vector3 pos2 in pos) { Debug.Log("[LOAD] Actor " + actorCount + " Scene Pos: " + pos2); if (actorCount >= tempScene.objects.Count - 1) { actorCount = 0; } else { actorCount++; } } } actorCount = 0; foreach (List <float[, ]> pos in scene.savePositions) { foreach (float[,] pos2 in pos) { Debug.Log("[LOAD] Actor " + actorCount + " Saveable Scene Pos: (" + pos2[0, 0] + ", " + pos2[0, 1] + ", " + pos2[0, 2] + ")"); if (actorCount >= tempScene.objects.Count - 1) { actorCount = 0; } else { actorCount++; } } } SceneList.Add(tempScene); } //-------------------------------------Resetting the dropdown dropdown = GameObject.Find("SceneDropdown").GetComponent <Dropdown>(); dropdown.ClearOptions(); List <string> dropStrings = new List <string>(); dropStrings.Add("No Scene"); for (int dropIndex = 0; dropIndex < SaveableSceneList.Count; dropIndex++) { dropStrings.Add("Scene " + (dropIndex + 1)); } dropdown.AddOptions(dropStrings); //-------------------------------------Reinstantiating SetList setList = new List <GameObject>(); setPieceDropdownIndexes = new List <int>(); int setListLoadIndex = 0; while (setListLoadIndex < data.numSetList) { float[] setListPosArray = new float[3]; setListPosArray[0] = data.vec3PosForSetPieces[setListLoadIndex, 0]; setListPosArray[1] = data.vec3PosForSetPieces[setListLoadIndex, 1]; setListPosArray[2] = data.vec3PosForSetPieces[setListLoadIndex, 2]; GameObject newObject = Instantiate(buildFuncs.props.prefabList[data.setPieceDropdownIndexes[setListLoadIndex]], new Vector3(setListPosArray[0], setListPosArray[1], setListPosArray[2]), Quaternion.identity); setList.Add(newObject); setPieceDropdownIndexes.Add(setListLoadIndex); } }
// Use this for initialization void Start() { exampleApp.logD("ButtonClick Start is called!"); GameObject go = GameObject.Find("ApiList"); Dropdown dd = go.GetComponent <Dropdown>(); dd.ClearOptions(); List <string> options = new List <string>(); options.Add("GetSdkVersion"); options.Add("SetChannelProfile"); options.Add("EnableDualStreamMode"); options.Add("GetCallId"); options.Add("SetVideoProfile"); options.Add("SetClientRole"); options.Add("Pause"); options.Add("Resume"); options.Add("SwitchCamera"); options.Add("MuteLocalVideoStream"); options.Add("MuteAllRemoteVideoStreams"); options.Add("SetDefaultMuteAllRemoteAudioStreams"); options.Add("SetDefaultMuteAllRemoteVideoStreams"); options.Add("MuteRemoteVideoStream"); options.Add("SetRemoteVideoStreamType"); options.Add("EnableVideo"); options.Add("DisableVideo"); options.Add("EnableLocalVideo"); options.Add("StartPreview"); options.Add("StopPreview"); options.Add("SetLocalVoicePitch"); options.Add("SetRemoteVoicePosition"); options.Add("SetVoiceOnlyMode"); options.Add("EnableLocalAudio"); options.Add("SetEnableSpeakerPhone"); options.Add("IsSpeakerPhoneEnabled"); options.Add("SetDefaultAudioRouteToSpeakerphone"); options.Add("EnableAudioVolumeIndication"); options.Add("MuteLocalAudioStream"); options.Add("MuteAllRemoteAudioStreams"); options.Add("MuteRemoteAudioStream"); options.Add("AdjustRecordingSignalVolume"); options.Add("AdjustPlaybackSignalVolume"); options.Add("EnableVideoObserver"); options.Add("DisableVideoObserver"); options.Add("EnableAudio"); options.Add("DisableAudio"); dd.AddOptions(options); go = GameObject.Find("VIDEOPROFILE"); dd = go.GetComponent <Dropdown>(); dd.ClearOptions(); options = new List <string>(); options.Add("-1 Invalid"); options.Add("0 120P true (160x120)"); options.Add("0 120P false (160x120)"); #if UNITY_IPHONE options.Add("2 120P_3 true (120x120)"); options.Add("2 120P_3 false (120x120)"); options.Add("10 180P true (320x180)"); options.Add("10 180P false (320x180)"); options.Add("12 180P_3 true (180x180)"); options.Add("12 180P_3 false (180x180)"); options.Add("13 180P_4 true (240x180)"); options.Add("13 180P_4 false (240x180)"); #endif options.Add("20 240P true (320x240)"); options.Add("20 240P false (320x240)"); #if UNITY_IPHONE options.Add("22 240P_3 true (240x240)"); options.Add("22 240P_3 false (240x240)"); options.Add("23 240P_4 true (420x240)"); options.Add("23 240P_4 false (420x240)"); #endif options.Add("30 360P true (640x360)"); options.Add("30 360P false (640x360)"); #if UNITY_IPHONE options.Add("32 360P_3 true (360x360)"); options.Add("32 360P_3 false (360x360)"); #endif options.Add("33 360P_4 true (640x360)"); options.Add("33 360P_4 false (640x360)"); options.Add("35 360P_6 true (360x360)"); options.Add("35 360P_6 false (360x360)"); options.Add("36 360P_7 true (480x360)"); options.Add("36 360P_7 false (480x360)"); options.Add("37 360P_8 true (480x360)"); options.Add("37 360P_8 false (480x360)"); options.Add("38 360P_9 true (640x360)"); options.Add("38 360P_9 false (640x360)"); options.Add("39 360P_10 true (640x360)"); options.Add("39 360P_10 false (640x360)"); options.Add("100 360P_11 true (640x360)"); options.Add("100 360P_11 false (640x360)"); options.Add("40 480P true (640x480)"); options.Add("40 480P false (640x480)"); #if UNITY_IPHONE options.Add("42 480P_3 true (480x480)"); options.Add("42 480P_3 false (480x480)"); #endif options.Add("43 480P_4 true (640x480)"); options.Add("43 480P_4 false (640x480)"); options.Add("45 480P_6 true (480x480)"); options.Add("45 480P_6 false (480x480)"); options.Add("47 480P_8 true (840x480)"); options.Add("47 480P_8 false (840x480)"); options.Add("48 480P_9 true (840x480)"); options.Add("48 480P_9 false (840x480)"); options.Add("49 480P_10 true (640x480)"); options.Add("49 480P_10 false (640x480)"); options.Add("50 720P true (1280x720)"); options.Add("50 720P false (1280x720)"); options.Add("52 720P_3 true (1280x720)"); options.Add("52 720P_3 false (1280x720)"); options.Add("54 720P_5 true (960x720)"); options.Add("54 720P_5 false (960x720)"); options.Add("55 720P_6 true (960x720)"); options.Add("55 720P_6 false (960x720)"); dd.AddOptions(options); }
// Update is called once per frame void Update() { dropdownMenu.ClearOptions(); dropdownMenu.AddOptions(dropdownList); }
public void Init() { //honestly don't know why I put if statements since I could just set the default value to max //read from player prefs volumes float temp = -1; temp = PlayerPrefs.GetFloat("musicvol", -1); if (temp >= 0) { musicSlider.value = temp; } temp = PlayerPrefs.GetFloat("sfxvol", -1); if (temp >= 0) { soundSlider.value = temp; initialised = true; } //create all resolutions possible for (int i = 0; i < Screen.resolutions.Length; i++) { bool addRes = true; //check for duplicate resolutions (fps means there are more) if (allResolutions.Count > 0) { if (Screen.resolutions[i].height == allResolutions[allResolutions.Count - 1].height && Screen.resolutions[i].width == allResolutions[allResolutions.Count - 1].width) { addRes = false; } } if (addRes) { //add resolution to options allResolutions.Add(Screen.resolutions[i]); allResOptions.Add(allResolutions[allResolutions.Count - 1].width + "x" + allResolutions[allResolutions.Count - 1].height); } } //set dropdown options resDropdown.ClearOptions(); resDropdown.AddOptions(allResOptions); //check the res we are at now (this will be overwritten when using local data) for (int i = 0; i < allResolutions.Count; i++) { if (Screen.width == allResolutions[i].width && Screen.height == allResolutions[i].height) { resDropdown.value = i; } } //set fullscreen to start isFullscreen = Screen.fullScreen; fullscreenToggle.isOn = isFullscreen; //Init settings to wanted, reading player prefs for preferences int Res = -1, FOV = -1, FPS = -1; Res = PlayerPrefs.GetInt("RES", -1); if (Res >= 0 && Res < allResolutions.Count) { resDropdown.value = Res; } FOV = PlayerPrefs.GetInt("FOV", -1); if (FOV >= 0 && FOV < fovDropdown.options.Count) { fovDropdown.value = FOV; } FPS = PlayerPrefs.GetInt("FPS", -1); if (FPS >= 0 && FPS < fpsDropdown.options.Count) { fpsDropdown.value = FPS; } //set to settings wanted ChangeFOV(); ChangeFPS(); ChangeRes(); }
public void UpdateOptions() { dropDown.ClearOptions(); dropDown.AddOptions(GetNonOptions()); }
private void Start() { modeSelectObject.SetActive(true); playerNameInputField.onEndEdit.AddListener((name) => { bool interactable = !string.IsNullOrEmpty(name); hostButton.interactable = interactable; joinButton.interactable = interactable; }); // Host hostObject.SetActive(false); hostButton.interactable = false; hostButton.onClick.AddListener(() => { modeSelectObject.SetActive(false); hostObject.SetActive(true); chatObject.SetActive(true); advertiseButton.interactable = false; stopButton.interactable = false; backButton.interactable = true; var host = new BleSock.HostPeer(); host.onReady += () => { Log("初期化が完了しました"); advertiseButton.interactable = true; sendInputField.interactable = true; }; host.onBluetoothRequire += () => { Log("Bluetoothを有効にしてください"); }; host.onFail += () => { Log("失敗しました"); }; host.onPlayerJoin += (player) => { Log("{0} が参加しました", player.PlayerName); }; host.onPlayerLeave += (player) => { Log("{0} が離脱しました", player.PlayerName); }; host.onReceive += (message, messageSize, sender) => { Log("{0}: {1}", sender.PlayerName, Encoding.UTF8.GetString(message, 0, messageSize)); }; try { host.Initialize(PROTOCOL_IDENTIFIER, playerNameInputField.text); } catch (Exception e) { Debug.LogException(e); Log("初期化できません"); return; } Log("初期化しています.."); mPeer = host; }); advertiseButton.onClick.AddListener(() => { try { ((BleSock.HostPeer)mPeer).StartAdvertising(playerNameInputField.text); } catch (Exception e) { Debug.LogException(e); Log("アドバタイズ開始できません"); return; } Log("アドバタイズしています.."); advertiseButton.interactable = false; stopButton.interactable = true; }); stopButton.onClick.AddListener(() => { ((BleSock.HostPeer)mPeer).StopAdvertising(); Log("アドバタイズを停止しました"); advertiseButton.interactable = true; stopButton.interactable = false; }); // Guest guestObject.SetActive(false); joinButton.interactable = false; joinButton.onClick.AddListener(() => { modeSelectObject.SetActive(false); guestObject.SetActive(true); chatObject.SetActive(true); devicesDropdown.interactable = false; connectButton.interactable = false; disconnectButton.interactable = false; backButton.interactable = true; var guest = new BleSock.GuestPeer(); guest.onBluetoothRequire += () => { Log("Bluetoothを有効にしてください"); }; guest.onReady += () => { Log("初期化が完了しました"); try { guest.StartScan(); } catch (Exception e) { Debug.LogException(e); Log("スキャン開始できません"); return; } Log("デバイスを探索しています.."); devicesDropdown.ClearOptions(); }; guest.onFail += () => { Log("失敗しました"); }; guest.onDiscover += (deviceName, deviceId) => { Log("デバイスを発見: {0} [{1}]", deviceName, deviceId); devicesDropdown.options.Add(new DeviceOptionData(deviceName, deviceId)); if (!devicesDropdown.interactable) { devicesDropdown.interactable = true; devicesDropdown.value = 0; devicesDropdown.RefreshShownValue(); connectButton.interactable = true; } }; guest.onConnect += () => { Log("接続されました"); foreach (var player in guest.Players) { Log(player.PlayerName); } sendInputField.interactable = true; }; guest.onDisconnect += () => { Log("切断されました"); sendInputField.interactable = false; disconnectButton.interactable = false; }; guest.onPlayerJoin += (player) => { Log("{0} が参加しました", player.PlayerName); }; guest.onPlayerLeave += (player) => { Log("{0} が離脱しました", player.PlayerName); }; guest.onReceive += (message, messageSize, sender) => { Log("{0}: {1}", sender.PlayerName, Encoding.UTF8.GetString(message, 0, messageSize)); }; try { guest.Initialize(PROTOCOL_IDENTIFIER, playerNameInputField.text); } catch (Exception e) { Debug.LogException(e); Log("初期化できません"); return; } Log("初期化しています.."); mPeer = guest; }); connectButton.onClick.AddListener(() => { var optionData = (DeviceOptionData)devicesDropdown.options[devicesDropdown.value]; try { ((BleSock.GuestPeer)mPeer).Connect(optionData.deviceId); } catch (Exception e) { Debug.LogException(e); Log("エラー"); return; } Log("デバイスに接続しています.."); devicesDropdown.interactable = false; connectButton.interactable = false; disconnectButton.interactable = true; }); disconnectButton.onClick.AddListener(() => { ((BleSock.GuestPeer)mPeer).Disconnect(); }); // Chat chatObject.SetActive(false); sendInputField.interactable = false; sendInputField.onEndEdit.AddListener((text) => { var bytes = Encoding.UTF8.GetBytes(text); try { mPeer.Send(bytes, bytes.Length, BleSock.Address.All); } catch (Exception e) { Debug.LogException(e); Log("エラー"); return; } sendInputField.text = ""; }); backButton.interactable = false; backButton.onClick.AddListener(() => { if (mPeer != null) { mPeer.Dispose(); mPeer = null; } mLogs.Clear(); modeSelectObject.SetActive(true); hostObject.SetActive(false); guestObject.SetActive(false); chatObject.SetActive(false); }); }
public void Start() { Instance = this; // doc setup DocLinks.Language = DocLinks.Languages.English; DocLinks.Product = DocLinks.Products.Pun; DocLinks.Version = DocLinks.Versions.V2; // ModalWindow.gameObject.SetActive(false); MaximalCanvasGroup.gameObject.SetActive(true); this.UserIdText.text = ""; this.StateText.text = ""; this.StateText.gameObject.SetActive(true); this.UserIdText.gameObject.SetActive(true); this.Title.gameObject.SetActive(true); this.ConnectingLabel.SetActive(false); this.LobbyPanel.SetActive(false); this.GamePanel.SetActive(false); if (string.IsNullOrEmpty(UserId)) { UserId = "user" + System.Environment.TickCount % 99; //made-up username } PlayerTtlField.SetValue(this.PlayerTtl); EmptyRoomTtlField.SetValue(this.EmptyRoomTtl); MaxPlayersField.SetValue(this.MaxPlayers); PluginsField.SetValue(this.Plugins); PublishUserIdField.SetValue(this.PublishUserId); IsVisibleField.SetValue(this.IsVisible); IsOpenField.SetValue(this.IsOpen); CleanupCacheOnLeaveField.SetValue(this.CleanupCacheOnLeave); //CheckUserOnJoinField.SetValue (this.CheckUserOnJoin); DeleteNullPropertiesField.SetValue(this.DeleteNullProperties); // prefill dropdown selection of users ConnectAsDropDown.ClearOptions(); ConnectAsDropDown.AddOptions(FriendsList.Select(x => x.NickName).ToList()); // check the current network status if (PhotonNetwork.IsConnected) { if (PhotonNetwork.Server == ServerConnection.GameServer) { this.OnJoinedRoom(); } else if (PhotonNetwork.Server == ServerConnection.MasterServer || PhotonNetwork.Server == ServerConnection.NameServer) { if (PhotonNetwork.InLobby) { this.OnJoinedLobby(); } else { this.OnConnectedToMaster(); } } } else { this.SwitchToSimpleConnection(); if (!Embedded) { MinimizeButton.SetActive(false); SwitchtoMaximalPanel(); } else { this.Title.text = EmbeddedGameTitle; SwitchtoMinimalPanel(); } } }
void Start() { matSetter = mat[0]; Mdropdown.ClearOptions(); PopulateDropDown(); }
public void UpdateMapsAndMenu() { if (!Application.isEditor) { allLoadedBundles.ForEach(b => b.Unload(false)); allLoadedBundles.Clear(); } MapDropdown.ClearOptions(); loadableSceneNames.Clear(); MapSprites.Clear(); int selectedMapIndex = 0; var selectedMapName = PlayerPrefs.GetString("SELECTED_MAP", null); #if UNITY_EDITOR if (assetBundleManager != null) { foreach (var map in assetBundleManager.assetBundleSettings.maps) { var scn = map.sceneAsset as UnityEditor.SceneAsset; if (scn != null) { var sceneName = scn.name; if (Application.CanStreamedLevelBeLoaded(sceneName) && !loadableSceneNames.Contains(sceneName)) { if (sceneName == selectedMapName) { selectedMapIndex = loadableSceneNames.Count; } loadableSceneNames.Add(sceneName); MapSprites.Add(map.spriteImg); } } } MapDropdown.AddOptions(loadableSceneNames); } #endif if (!Application.isEditor) { var bundleRoot = Path.Combine(Application.dataPath, "..", "AssetBundles"); var files = Directory.GetFiles(bundleRoot); foreach (var f in files) { if (Path.HasExtension(f)) { continue; } var filename = Path.GetFileName(f); if (filename.StartsWith("map_")) { var mapName = filename.Substring("map_".Length); var bundle = AssetBundle.LoadFromFile(f); //will take long with many scenes so change to async later if (bundle != null) { allLoadedBundles.Add(bundle); } string[] scenes = bundle.GetAllScenePaths(); //assume each bundle has at most one scene if (scenes.Length > 0) { string sceneName = Path.GetFileNameWithoutExtension(scenes[0]); if (sceneName == selectedMapName) { selectedMapIndex = loadableSceneNames.Count; } loadableSceneNames.Add(sceneName); Sprite spriteImg = null; var spriteBundleFile = f.Replace($"map_{mapName}", $"mapimage_{mapName}"); if (File.Exists(spriteBundleFile)) { var spriteBundle = AssetBundle.LoadFromFile(spriteBundleFile); if (spriteBundle != null) { allLoadedBundles.Add(spriteBundle); spriteImg = spriteBundle.LoadAsset <Sprite>($"mapimage_{mapName}"); } } MapSprites.Add(spriteImg); } } } MapDropdown.AddOptions(loadableSceneNames); } MapDropdown.value = selectedMapIndex; ChangeMapImage(); }
/// <summary> /// Заполняет выпадающий список /// </summary> private static void FillDrowdown(Dropdown dropdown, List <string> values) { dropdown.ClearOptions(); dropdown.AddOptions(values); }
//------------------------------------- //MANAGE DISPLAY OF INFOBOX void DisplayInfoBox() { GameObject _raycastObject = GameScapeReferencesHandler.ins.raycastObjSelected; if (_raycastObject != null) { if (_raycastObject.GetComponent <GameScapeObjType>() != null) { Debug.Log(_raycastObject.GetComponent <GameScapeObjType>().objClass.ToString()); if (GameScapeReferencesHandler.ins.infoBoxOpen != true) { infoBox.SetActive(true); //DROPDOWN REFRESHNER infoBoxDropdown1List = _raycastObject.GetComponent <GameScapeObjType>().objDropdown1Text; infoBoxDropdown1.ClearOptions(); infoBoxDropdown1.AddOptions(infoBoxDropdown1List); infoBoxDropdown1.value = 0; infoBoxDropdown1.Select(); // optional infoBoxDropdown1.RefreshShownValue(); // this is the key //TITLE TEXT infoBoxTitle.GetChild(0).GetComponent <Text>().text = _raycastObject.GetComponent <GameScapeObjType>().objTitleText; //ICON SPRITE infoBoxSprite.GetComponent <Image>().sprite = _raycastObject.GetComponent <GameScapeObjType>().objIconSprite; //DESCRIPTION TEXT infoBoxDescriptionBox.GetChild(0).GetComponent <Text>().text = _raycastObject.GetComponent <GameScapeObjType>().objDescriptionText; if (_raycastObject.GetComponent <GameScapeObjType>().objClass == typeof(Room)) { ShowWorkerAble(_raycastObject.GetComponent <GameScapeObjType>().objListActive); } else if (_raycastObject.GetComponent <GameScapeObjType>().objClass == typeof(Character)) { ShowRoomAble(_raycastObject.GetComponent <GameScapeObjType>().objListActive); } else { ShowRoomAble(false);//to be able to close and clean listing when passing to obj witout listing } if (finishedCoroutine) { rt = (RectTransform)infoBox.transform; coroutineMove = MoveInfoBox(infoBox, 0, (int)(-Screen.height / 2 + (rt.rect.height / 2)), false, false); StopCoroutine(coroutineMove); StartCoroutine(coroutineMove); finishedCoroutine = false; } GameScapeReferencesHandler.ins.disableGameScapeMovement = true; } } //DISABLES MOVEMENT OF GAMESCAPE bool infoBoxOpenAlready = GameScapeReferencesHandler.ins.infoBoxOpen; foreach (GameObject _go in GameScapeReferencesHandler.ins.raycastObjList) { if (_go.GetComponent <GameScapeObjType>() != null) { GameScapeReferencesHandler.ins.infoBoxOpen = true; break; } else if (_go.name == "BUILDING" || _go.name == "GameScapeInfoBox")//CHANGE THIS! make building have a component to identify it { GameScapeReferencesHandler.ins.infoBoxOpen = infoBoxOpenAlready; break; } else { GameScapeReferencesHandler.ins.infoBoxOpen = false; } } //DELETES INFOBOX if (GameScapeReferencesHandler.ins.infoBoxOpen == false) { if (finishedCoroutine) { rt = (RectTransform)infoBox.transform; coroutineMove = MoveInfoBox(infoBox, (int)(-Screen.height / 2 + (rt.rect.height / 2)), 300, true, false); StopCoroutine(coroutineMove); StartCoroutine(coroutineMove); finishedCoroutine = false; } GameScapeReferencesHandler.ins.disableGameScapeMovement = false; } } }
// Use this for initialization void Start() { nome.enabled = false; indice_Aluno = drop_Alunos.value; //drop_Alunos.ClearOptions(); Firebase.FirebaseApp.CheckAndFixDependenciesAsync().ContinueWith(task => { var dependencyStatus = task.Result; if (dependencyStatus == Firebase.DependencyStatus.Available) { FirebaseApp app = FirebaseApp.DefaultInstance; FirebaseApp.DefaultInstance.SetEditorDatabaseUrl("https://tcc-gamificacao.firebaseio.com"); reference = FirebaseDatabase.DefaultInstance.RootReference; } else { UnityEngine.Debug.LogError(System.String.Format("Could not resolve all Firebase dependencies: {0}", dependencyStatus)); // Firebase Unity SDK is not safe to use here. } }); FirebaseDatabase.DefaultInstance.GetReference("Turmas").OrderByChild("Professor").ValueChanged += (object sender2, ValueChangedEventArgs e2) => { if (e2.DatabaseError != null) { Debug.LogError(e2.DatabaseError.Message); return; } Debug.Log("Received values for teachers."); if (e2.Snapshot != null && e2.Snapshot.ChildrenCount > 0) { foreach (var childSnapshot in e2.Snapshot.Children) //percorre o snapshot do inicio ao fim { if (childSnapshot.Child("Professor") == null || childSnapshot.Child("Professor").Value == null) { Debug.LogError("Bad data in sample. Did you forget to call SetEditorDatabaseUrl with your project id?"); break; } else { Debug.Log("Leaders entry : " + childSnapshot.Child("Professor").Value.ToString() + " - " + childSnapshot.Child("Horario").Value.ToString() + " - " + childSnapshot.Child("Identificacao").Value.ToString()); s = childSnapshot.Child("Identificacao").Value.ToString(); listaTurma.Add(s); //adiciona nom da turma a lista } } //apaga itens do dropdown drop_Turmas.ClearOptions(); // adiciona as turmas que estao casdastrados no banco ao dropdown drop_Turmas.AddOptions(listaTurma); } }; FirebaseDatabase.DefaultInstance.GetReference("Alunos").OrderByChild("id").ValueChanged += (object sender2, ValueChangedEventArgs e2) => { if (e2.DatabaseError != null) { Debug.LogError(e2.DatabaseError.Message); return; } Debug.Log("Received values"); vet = new List <Aluno>(); if (e2.Snapshot != null && e2.Snapshot.ChildrenCount > 0) { foreach (var childSnapshot in e2.Snapshot.Children) //percorre o snapshot do inicio ao fim { if (childSnapshot.Child("Nome") == null || childSnapshot.Child("Nome").Value == null) { Debug.LogError("Bad data in sample. Did you forget to call SetEditorDatabaseUrl with your project id?"); break; } else { vet.Add(new Aluno() { nome_aluno = childSnapshot.Child("Nome").Value.ToString(), idade_aluno = Convert.ToInt32(childSnapshot.Child("Idade").Value.ToString()), turma_aluno = childSnapshot.Child("Turma").Value.ToString(), data_nascimento = childSnapshot.Child("DataNascimento").Value.ToString(), sexo_aluno = childSnapshot.Child("Sexo").Value.ToString() }); } } drop_Alunos.ClearOptions(); foreach (Aluno aluno in vet) { drop_Alunos.options.Add(new Dropdown.OptionData() { text = aluno.nome_aluno }); } } }; }
public void ControllaOrari() { List <string> Orari = CallWebService.MMS.CheckDisponibilita("AAA", ContentCreator.Restaurant, Data.text, Comanda.C5.ordini.Capacity.ToString()); if (Orari.Capacity >= 1 && Orari != null) { DropdownOrari.ClearOptions(); foreach (string o in Orari) { ResultText.gameObject.SetActive(false); ResultText.text = ""; DropdownOrari.options.Add(new Dropdown.OptionData() { text = o }); } PanelOrari.SetActive(true); Comunicazione.gameObject.SetActive(true); if (ContentCreator.currentMode == "Dlv" || ContentCreator.currentMode == "Cin") { DataService ds = new DataService("DatiCliente.db"); IEnumerable <DatiCliente> Dci; Dci = ds.GetDatiCliente(); if (ContentCreator.currentMode == "Dlv") { Indirizzo.gameObject.SetActive(true); Citta.gameObject.SetActive(true); Comune.gameObject.SetActive(true); Provincia.gameObject.SetActive(true); PosizInterna.gameObject.SetActive(false); ControllaIndirizzo.SetActive(true); } else { Indirizzo.gameObject.SetActive(false); Citta.gameObject.SetActive(false); Comune.gameObject.SetActive(false); Provincia.gameObject.SetActive(false); PosizInterna.gameObject.SetActive(true); ControllaIndirizzo.SetActive(true); } foreach (DatiCliente D in Dci) { if (D.Id == 1) { Indirizzo.text = D.Indirizzo; Citta.text = D.Citta; try { if (ContentCreator.sala.Length > 3) { PosizInterna.text += ContentCreator.sala + " "; PosizInterna.readOnly = true; } } catch { } try { if (ContentCreator.seat.Length > 3) { PosizInterna.text += ContentCreator.seat + " "; PosizInterna.readOnly = true; } } catch { } } } } if (ContentCreator.pagaConsegnaAbilitata) { PagaConsegna.gameObject.SetActive(true); } if (ContentCreator.PinPagOn || ContentCreator.Key.Length > 10) { Pagamenti.gameObject.SetActive(true); } if (ContentCreator.PinPagOn) { ButtonPinpag.gameObject.SetActive(true); } if (ContentCreator.Key.Length > 10) { ButtonPaypal.gameObject.SetActive(true); } ButtonConsegna.gameObject.SetActive(true); } else { ResultText.gameObject.SetActive(true); ResultText.text = "Nessuna disponibilità per la data indicata!"; } }
void initializeMelderart() { m_Dropdown_Melderart.ClearOptions(); m_Dropdown_Melderart.AddOptions(melderart_list); }
void Start() { myDropdown = this.GetComponent <Dropdown>(); myDropdown.ClearOptions(); Dropdown.OptionData op1 = new Dropdown.OptionData(); op1.text = "SeedImage1"; Dropdown.OptionData op2 = new Dropdown.OptionData(); op2.text = "SeedImage2"; Dropdown.OptionData op3 = new Dropdown.OptionData(); op3.text = "SeedImage3"; Dropdown.OptionData op4 = new Dropdown.OptionData(); op4.text = "SeedImage4"; Dropdown.OptionData op5 = new Dropdown.OptionData(); op5.text = "SeedImage5"; Dropdown.OptionData op6 = new Dropdown.OptionData(); op6.text = "SeedImage6"; Dropdown.OptionData op7 = new Dropdown.OptionData(); op7.text = "SeedImage7"; Dropdown.OptionData op8 = new Dropdown.OptionData(); op8.text = "SeedImage8"; Dropdown.OptionData op9 = new Dropdown.OptionData(); op9.text = "SeedImage9"; Dropdown.OptionData op10 = new Dropdown.OptionData(); op10.text = "SeedImage10"; Dropdown.OptionData op11 = new Dropdown.OptionData(); op11.text = "SeedImage11"; Dropdown.OptionData op12 = new Dropdown.OptionData(); op12.text = "SeedImage12"; Dropdown.OptionData op13 = new Dropdown.OptionData(); op13.text = "SeedImage13"; Dropdown.OptionData op14 = new Dropdown.OptionData(); op14.text = "SeedImage14"; Dropdown.OptionData op15 = new Dropdown.OptionData(); op15.text = "SeedImage15"; Dropdown.OptionData op16 = new Dropdown.OptionData(); op16.text = "SeedImage16"; Dropdown.OptionData op17 = new Dropdown.OptionData(); op17.text = "SeedImage17"; Dropdown.OptionData op18 = new Dropdown.OptionData(); op18.text = "SeedImage18"; myDropdown.options.Add(op1); myDropdown.options.Add(op2); myDropdown.options.Add(op3); myDropdown.options.Add(op4); myDropdown.options.Add(op5); myDropdown.options.Add(op6); myDropdown.options.Add(op7); myDropdown.options.Add(op8); myDropdown.options.Add(op9); myDropdown.options.Add(op10); myDropdown.options.Add(op11); myDropdown.options.Add(op12); myDropdown.options.Add(op13); myDropdown.options.Add(op14); myDropdown.options.Add(op15); myDropdown.options.Add(op16); myDropdown.options.Add(op17); myDropdown.options.Add(op18); myDropdown.onValueChanged.AddListener(ClickDropdown); myDropdown.captionText.text = "SeedImage"; }
private void ShowUISentence(Sprite[] sprites, UISentenceCallback callback, List <string> subjectOverrides = null, List <string> objectOverrides = null) { // Show the Journal, so that the player can give a good clue ShowJournal(); // Make the UI visible transform.Find("dialogView").gameObject.SetActive(true); transform.Find("dialogView/V overlay/dialog").gameObject.SetActive(false); transform.Find("dialogView/V overlay/H buttons").gameObject.SetActive(false); transform.Find("dialogView/V overlay/H sentenceBuilder").gameObject.SetActive(true); // Display sprites // Hide extra sprites and create new sprites as needed Transform spriteContainer = transform.Find("dialogView/H images"); for (int i = 0; i < Mathf.Max(sprites.Length, spriteContainer.childCount); i++) { Image image; if (i < spriteContainer.childCount) { image = spriteContainer.GetChild(i).GetComponent <Image>(); } else { image = Instantiate(spriteContainer.GetChild(0), spriteContainer).GetComponent <Image>(); } image.gameObject.SetActive(i < sprites.Length); if (i < sprites.Length) { // A null sprite can take up space image.color = sprites[i] == null ? new Color(0, 0, 0, 0) : Color.white; // Update a visible sprite image.sprite = null; // clear sprite to reset size information image.sprite = sprites[i]; } } // Set the list of options to the list of discovered words. // Default to having discovered the hair colors of people other than yourself. List <Noun> knownWords = GameState.Get().Player.knowledge.KnownWords.ToList(); knownWords.Sort(); List <string> knownWordStrings = knownWords.ConvertAll <string>(noun => noun.ToString()); Transform sentenceBuilder = transform.Find("dialogView/V overlay/H sentenceBuilder"); Dropdown subjectDropdown = sentenceBuilder.Find("Subject").GetComponent <Dropdown>(); subjectDropdown.ClearOptions(); if (subjectOverrides != null) { subjectDropdown.AddOptions(subjectOverrides); } else { subjectDropdown.AddOptions(knownWordStrings); } subjectDropdown.RefreshShownValue(); Dropdown objectDropdown = sentenceBuilder.Find("DirectObject").GetComponent <Dropdown>(); objectDropdown.ClearOptions(); if (objectOverrides != null) { objectDropdown.AddOptions(objectOverrides); } else { List <string> tmp = new List <string>(); tmp.Add(UNSELECTED_DROPDOWN_VALUE); objectDropdown.AddOptions(tmp); objectDropdown.AddOptions(knownWordStrings); } objectDropdown.RefreshShownValue(); mSentenceCallback = callback; EventSystem.current.GetComponent <EventSystem>().SetSelectedGameObject(subjectDropdown.gameObject); }