//获取脚本实例 public static SettingScript getInstance(Transform parent) { //每个parent 中只有一个SettingScript, 说白了就是单例 if (parent == null) { Debug.LogError("========parent must not be null========"); return(null); } SettingScript listener = parent.gameObject.GetComponent <SettingScript>(); GameObject itemObj = null; if (listener == null) { listener = parent.gameObject.AddComponent <SettingScript>(); GameObject o = Resources.Load("Prefabs/SettingPrefab", typeof(GameObject)) as GameObject; itemObj = (GameObject)Instantiate(o, parent); itemObj.name = "settingPanel"; } else { itemObj = parent.Find("settingPanel").gameObject; } //放在最外层 itemObj.transform.SetSiblingIndex(itemObj.transform.parent.GetChildCount() - 1); listener.settingO = itemObj; return(listener); }
// Update is called once per frame void Update() { if (pauseUI.activeSelf) { Time.timeScale = 0f; } abc = pauseUI.activeSelf; if (FPSCon.GetComponent <MyStatus>().GetHp() > 0) { if (Input.GetKeyDown(KeyCode.Escape) && !SettingScript.Settingpause()) { if (!GametoTitle.GetNoMove()) { // ポーズUIのアクティブ、非アクティブを切り替え pauseUI.SetActive(!pauseUI.activeSelf); } // ポーズUIが表示されてる時は停止 if (pauseUI.activeSelf) { Time.timeScale = 0f; // ポーズUIが表示されてなければ通常通り進行 } else { Time.timeScale = 1f; } } } }
// Update is called once per frame private void Update() { // if (Input.GetKey(KeyCode.Return)) // { m_MouseLook.Init(transform, m_Camera.transform); // //m_Camera.transform.rotation = Quaternion.identity; // } if (!PauseScript.pause() && !SettingScript.Settingpause()) { if (FPSCon.GetComponent <MyStatus>().GetHp() > 1) { RotateView(); // the jump state needs to read here to make sure it is not missed if (!m_Jump) { m_Jump = CrossPlatformInputManager.GetButtonDown("Jump"); } if (!m_PreviouslyGrounded && m_CharacterController.isGrounded) { StartCoroutine(m_JumpBob.DoBobCycle()); PlayLandingSound(); m_MoveDir.y = 0f; m_Jumping = false; } if (!m_CharacterController.isGrounded && !m_Jumping && m_PreviouslyGrounded) { m_MoveDir.y = 0f; } m_PreviouslyGrounded = m_CharacterController.isGrounded; } } }
/** * 打开设置对话框 */ public void openGameSettingDialog() { SoundCtrl.getInstance().playSoundByActionButton(1); loadPerfab("Prefab/Panel_Setting"); SettingScript ss = panelCreateDialog.GetComponent <SettingScript>(); ss.jiesanBtn.GetComponentInChildren <Text>().text = "退出游戏"; ss.type = 1; }
void Awake() { if (instance == null) { instance = this; } //Initialise(); _mousePanToggle.isOn = MousePanEnabled; _mouseZoomToggle.isOn = MouseZoomEnabled; _panSpeedSlider.value = CameraPanSpeed; _zoomSpeedSlider.value = CameraZoomSpeed; _riskLevelSlider.value = RiskLevel; _unitPriorityDropDown.value = UnitPriority; }
public void clickSetting() { SettingScript.getInstance(rootView).toogleActiveState(true); }