private void Awake() { if (Instance == null) { Instance = this; } else if (Instance != this) { Destroy(gameObject); } }
void Awake() { if (instance != null) { Destroy(gameObject); } else { instance = this; } }
private void Awake() { god_ModeAction = GetComponent <God_Mode>(); animator = GetComponent <Animator>(); joysticVibrationMan = GetComponent <JoysticVibration_Manager>(); camera_ShakeMan = Camera.main.GetComponent <Camere_Shake_Manager>(); blinking_Effect = GetComponent <Blinking_Effect>(); pause = Camera.main.GetComponent <Menu_Manager>(); manager = Camera.main.GetComponent <GameManager>(); sprite = GetComponent <SpriteRenderer>(); trail = GetComponent <TrailRenderer>(); }
// Use this for initialization void Start() { canvasVarious = new canvasVariousFunctions(); GameObject tmp = GameObject.Find(s_canvasMainMenu); if (tmp) { menu_Manager = tmp.GetComponent <Menu_Manager> (); } tmp = GameObject.Find(s_eventSystem); if (tmp) { eventSys = tmp.GetComponent <EventSystem> (); } tmp = GameObject.Find(s_mainMenuManager); if (tmp) { mainMenuManager = tmp.GetComponent <MainMenu> (); } tmp = GameObject.Find(s_InputManager); if (tmp) { inputsManager = tmp.GetComponent <MM_MenuInputs> (); } tmp = GameObject.Find(s_loadMenuManager); if (tmp) { loadMenuManager = tmp.GetComponent <LoadAndCreateMenu> (); } tmp = GameObject.Find(s_newGameMenuManager); if (tmp) { newGameMenuManager = tmp.GetComponent <LoadAndCreateMenu> (); } }
public void Initialize() { Menu = new Menu_Manager(this, ClientBounds, inputs); Auction = new Auction_Manager(this, ClientBounds, inputs); Boxing = new Boxing_Manager(ClientBounds, inputs); }
public void MM_GoToOtherPage(Menu_Manager canvasMainMenu, CanvasGroup newCanvas) { canvasMainMenu.GoToOtherPage(newCanvas); }
public override void OnInspectorGUI() { SeeInspector = EditorGUILayout.Foldout(SeeInspector, "Inspector"); if (SeeInspector) // If true Default Inspector is drawn on screen { DrawDefaultInspector(); } Menu_Manager myScript = (Menu_Manager)target; serializedObject.Update(); //GUIStyle style_Red = new GUIStyle(GUI.skin.box); style_Red.normal.background = Tex_01; GUIStyle style_Yellow_Pastel = new GUIStyle(GUI.skin.box); style_Yellow_Pastel.normal.background = Tex_02; GUIStyle style_YellowHard = new GUIStyle(GUI.skin.box); style_YellowHard.normal.background = Tex_03; GUILayout.Label(""); // --> Button to setup Menu for Mobile or Desktop. We don't need the same option for Mobile and desktop if (b_DesktopOrMobile.boolValue) { EditorGUILayout.BeginHorizontal(); GUILayout.Label("Menu is ready for Mobile : ", GUILayout.Width(160)); if (GUILayout.Button("Press button to setup Menu for Desktop")) { b_DesktopOrMobile.boolValue = false; for (int m = 0; m < List_GroupCanvas.arraySize; m++) { for (int i = 0; i < list_gameObjectByPage.GetArrayElementAtIndex(m).FindPropertyRelative("listOfMenuGameobject").arraySize; i++) { if (!list_gameObjectByPage.GetArrayElementAtIndex(m).FindPropertyRelative("listOfMenuGameobject").GetArrayElementAtIndex(i).FindPropertyRelative("Desktop").boolValue) { if (list_gameObjectByPage.GetArrayElementAtIndex(m).FindPropertyRelative("listOfMenuGameobject").GetArrayElementAtIndex(i).FindPropertyRelative("objList").objectReferenceValue) { SerializedObject serializedObject3 = new UnityEditor.SerializedObject(list_gameObjectByPage.GetArrayElementAtIndex(m).FindPropertyRelative("listOfMenuGameobject").GetArrayElementAtIndex(i).FindPropertyRelative("objList").objectReferenceValue); serializedObject3.Update(); SerializedProperty tmpSer2 = serializedObject3.FindProperty("m_IsActive"); tmpSer2.boolValue = false; serializedObject3.ApplyModifiedProperties(); } } else { if (list_gameObjectByPage.GetArrayElementAtIndex(m).FindPropertyRelative("listOfMenuGameobject").GetArrayElementAtIndex(i).FindPropertyRelative("objList").objectReferenceValue) { SerializedObject serializedObject3 = new UnityEditor.SerializedObject(list_gameObjectByPage.GetArrayElementAtIndex(m).FindPropertyRelative("listOfMenuGameobject").GetArrayElementAtIndex(i).FindPropertyRelative("objList").objectReferenceValue); serializedObject3.Update(); SerializedProperty tmpSer2 = serializedObject3.FindProperty("m_IsActive"); tmpSer2.boolValue = true; serializedObject3.ApplyModifiedProperties(); } } } } } EditorGUILayout.EndHorizontal(); } else { EditorGUILayout.BeginHorizontal(); GUILayout.Label("Menu is ready for Desktop : ", GUILayout.Width(160)); if (GUILayout.Button("Press button to setup Menu for Mobile")) { b_DesktopOrMobile.boolValue = true; for (int m = 0; m < List_GroupCanvas.arraySize; m++) { for (int i = 0; i < list_gameObjectByPage.GetArrayElementAtIndex(m).FindPropertyRelative("listOfMenuGameobject").arraySize; i++) { if (!list_gameObjectByPage.GetArrayElementAtIndex(m).FindPropertyRelative("listOfMenuGameobject").GetArrayElementAtIndex(i).FindPropertyRelative("Mobile").boolValue) { if (list_gameObjectByPage.GetArrayElementAtIndex(m).FindPropertyRelative("listOfMenuGameobject").GetArrayElementAtIndex(i).FindPropertyRelative("objList").objectReferenceValue) { SerializedObject serializedObject3 = new UnityEditor.SerializedObject(list_gameObjectByPage.GetArrayElementAtIndex(m).FindPropertyRelative("listOfMenuGameobject").GetArrayElementAtIndex(i).FindPropertyRelative("objList").objectReferenceValue); serializedObject3.Update(); SerializedProperty tmpSer2 = serializedObject3.FindProperty("m_IsActive"); tmpSer2.boolValue = false; serializedObject3.ApplyModifiedProperties(); } } else { if (list_gameObjectByPage.GetArrayElementAtIndex(m).FindPropertyRelative("listOfMenuGameobject").GetArrayElementAtIndex(i).FindPropertyRelative("objList").objectReferenceValue) { SerializedObject serializedObject3 = new UnityEditor.SerializedObject(list_gameObjectByPage.GetArrayElementAtIndex(m).FindPropertyRelative("listOfMenuGameobject").GetArrayElementAtIndex(i).FindPropertyRelative("objList").objectReferenceValue); serializedObject3.Update(); SerializedProperty tmpSer2 = serializedObject3.FindProperty("m_IsActive"); tmpSer2.boolValue = true; serializedObject3.ApplyModifiedProperties(); } } } } } EditorGUILayout.EndHorizontal(); } GUILayout.Label(""); GUILayout.Label(""); EditorGUILayout.BeginVertical(); for (int m = 0; m < List_GroupCanvas.arraySize; m++) { EditorGUILayout.BeginVertical(style_Yellow_Pastel); if (myScript.List_GroupCanvas [m].alpha == 1) { EditorGUILayout.BeginHorizontal(style_YellowHard); } else { EditorGUILayout.BeginHorizontal(); } // --> Use to activate or deactivate a specific Menu part string b_State = "Off"; if (myScript.List_GroupCanvas[m].alpha == 1) { b_State = "On"; } if (GUILayout.Button(b_State, GUILayout.Width(40))) { Undo.RegisterCompleteObjectUndo(myScript, "All Property Modif " + myScript.gameObject.name); for (int p = 0; p < myScript.List_GroupCanvas.Count; p++) { if (p == m) { Undo.RegisterCompleteObjectUndo(myScript.List_GroupCanvas [m], "All Property Modif" + List_GroupCanvas.GetArrayElementAtIndex(m).objectReferenceValue.name); myScript.List_GroupCanvas [m].alpha = 1; myScript.List_GroupCanvas [m].gameObject.SetActive(true); CurrentPage.intValue = m; } else { Undo.RegisterCompleteObjectUndo(myScript.List_GroupCanvas [p], "All Property Modif" + List_GroupCanvas.GetArrayElementAtIndex(p).objectReferenceValue.name); myScript.List_GroupCanvas [p].alpha = 0; myScript.List_GroupCanvas [p].gameObject.SetActive(false); } } } // --> the Canvas (Menu) EditorGUILayout.PropertyField(List_GroupCanvas.GetArrayElementAtIndex(m), new GUIContent(""), GUILayout.Width(160)); GUILayout.Label("", GUILayout.Width(10)); if (!b_MoreOptions.GetArrayElementAtIndex(m).boolValue) { if (GUILayout.Button("Options +", GUILayout.Width(70))) { b_MoreOptions.GetArrayElementAtIndex(m).boolValue = true; } } else { if (GUILayout.Button("Options -", GUILayout.Width(70))) { b_MoreOptions.GetArrayElementAtIndex(m).boolValue = false; } } GUILayout.Label("", GUILayout.Width(20)); // --> Delete a Menu page if (GUILayout.Button("Delete page", GUILayout.Width(80))) { b_DeletePage = true; whichCanvasToDelete = m; break; } GUILayout.Label(""); EditorGUILayout.EndHorizontal(); // --> Section to add gameobject you want to activate or deactivate if you are on Mobile or on desktop if (b_MoreOptions.GetArrayElementAtIndex(m).boolValue) { GUILayout.Label(""); EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("Add a new gameObject", GUILayout.Width(160))) { if (list_gameObjectByPage.GetArrayElementAtIndex(m).FindPropertyRelative("listOfMenuGameobject").arraySize == 0) // Check if the array is == to zero { list_gameObjectByPage.GetArrayElementAtIndex(m).FindPropertyRelative("listOfMenuGameobject").InsertArrayElementAtIndex(0); } else { list_gameObjectByPage.GetArrayElementAtIndex(m).FindPropertyRelative("listOfMenuGameobject").InsertArrayElementAtIndex(list_gameObjectByPage.GetArrayElementAtIndex(m).FindPropertyRelative("listOfMenuGameobject").arraySize - 1); } list_gameObjectByPage.GetArrayElementAtIndex(m).FindPropertyRelative("listOfMenuGameobject").GetArrayElementAtIndex(list_gameObjectByPage.GetArrayElementAtIndex(m).FindPropertyRelative("listOfMenuGameobject").arraySize - 1).FindPropertyRelative("objList").objectReferenceValue = null; list_gameObjectByPage.GetArrayElementAtIndex(m).FindPropertyRelative("listOfMenuGameobject").GetArrayElementAtIndex(list_gameObjectByPage.GetArrayElementAtIndex(m).FindPropertyRelative("listOfMenuGameobject").arraySize - 1).FindPropertyRelative("Desktop").boolValue = true; list_gameObjectByPage.GetArrayElementAtIndex(m).FindPropertyRelative("listOfMenuGameobject").GetArrayElementAtIndex(list_gameObjectByPage.GetArrayElementAtIndex(m).FindPropertyRelative("listOfMenuGameobject").arraySize - 1).FindPropertyRelative("Mobile").boolValue = true; } EditorGUILayout.EndHorizontal(); if (list_gameObjectByPage.arraySize > m && list_gameObjectByPage.GetArrayElementAtIndex(m).FindPropertyRelative("listOfMenuGameobject").arraySize > 0) { EditorGUILayout.BeginHorizontal(); GUILayout.Label("GameObject activated on : ", GUILayout.Width(150)); GUILayout.Label("Desktop", GUILayout.Width(70)); GUILayout.Label("Mobile", GUILayout.Width(70)); EditorGUILayout.EndHorizontal(); for (int i = 0; i < list_gameObjectByPage.GetArrayElementAtIndex(m).FindPropertyRelative("listOfMenuGameobject").arraySize; i++) { EditorGUILayout.BeginHorizontal(); EditorGUILayout.PropertyField(list_gameObjectByPage.GetArrayElementAtIndex(m).FindPropertyRelative("listOfMenuGameobject").GetArrayElementAtIndex(i).FindPropertyRelative("objList"), new GUIContent(""), GUILayout.Width(100)); GUILayout.Label("", GUILayout.Width(60)); EditorGUILayout.PropertyField(list_gameObjectByPage.GetArrayElementAtIndex(m).FindPropertyRelative("listOfMenuGameobject").GetArrayElementAtIndex(i).FindPropertyRelative("Desktop"), new GUIContent(""), GUILayout.Width(20)); GUILayout.Label("", GUILayout.Width(50)); EditorGUILayout.PropertyField(list_gameObjectByPage.GetArrayElementAtIndex(m).FindPropertyRelative("listOfMenuGameobject").GetArrayElementAtIndex(i).FindPropertyRelative("Mobile"), new GUIContent(""), GUILayout.Width(20)); GUILayout.Label("", GUILayout.Width(50)); if (GUILayout.Button("-", GUILayout.Width(20))) { if (list_gameObjectByPage.GetArrayElementAtIndex(m).FindPropertyRelative("listOfMenuGameobject").arraySize > 0) // Check if the array is == to zero { list_gameObjectByPage.GetArrayElementAtIndex(m).FindPropertyRelative("listOfMenuGameobject").DeleteArrayElementAtIndex(i); } } EditorGUILayout.EndHorizontal(); } } GUILayout.Label(""); GUILayout.Label(""); } EditorGUILayout.EndVertical(); } EditorGUILayout.EndVertical(); GUILayout.Label(""); GUILayout.Label(""); // --> Button to Create a new Page if (GUILayout.Button("Create a new Menu page")) { b_CreatePage = true; } GUILayout.Label(""); GUILayout.Label(""); // --> Create a new page if (b_CreatePage) { b_CreatePage = false; for (int m = 0; m < List_GroupCanvas.arraySize; m++) { Undo.RegisterCompleteObjectUndo(myScript.List_GroupCanvas [m], "All Property Modif Player Sprite " + myScript.List_GroupCanvas [m].gameObject.name); //SerializedObject serializedObject0 = new UnityEditor.SerializedObject (myScript.List_GroupCanvas [m]); myScript.List_GroupCanvas [m].alpha = 0; } Undo.RegisterCompleteObjectUndo(myScript, "All Property Modif Player Sprite " + myScript.gameObject.name); GameObject NewGO = new GameObject("MyGO", typeof(RectTransform)); NewGO.transform.SetParent(myScript.gameObject.transform); Undo.RegisterCreatedObjectUndo(NewGO, "NewGO"); NewGO.AddComponent <CanvasRenderer>(); NewGO.AddComponent <CanvasGroup>(); NewGO.name = "Page_" + List_GroupCanvas.arraySize; NewGO.GetComponent <RectTransform>().offsetMin = new Vector2(0, 0); NewGO.GetComponent <RectTransform>().offsetMax = new Vector2(0, 0); NewGO.GetComponent <RectTransform>().anchorMin = new Vector2(0, 0); NewGO.GetComponent <RectTransform>().anchorMax = new Vector2(1, 1); NewGO.GetComponent <RectTransform>().pivot = new Vector2(0, 0.5f); NewGO.GetComponent <RectTransform>().localScale = new Vector3(1, 1, 1); List_GroupCanvas.arraySize = List_GroupCanvas.arraySize + 1; List_GroupCanvas.GetArrayElementAtIndex(List_GroupCanvas.arraySize - 1).objectReferenceValue = NewGO.GetComponent <CanvasGroup>(); b_MoreOptions.InsertArrayElementAtIndex(b_MoreOptions.arraySize - 1); b_MoreOptions.GetArrayElementAtIndex(b_MoreOptions.arraySize - 1).boolValue = false; list_gameObjectByPage.InsertArrayElementAtIndex(list_gameObjectByPage.arraySize - 1); list_gameObjectByPage.GetArrayElementAtIndex(list_gameObjectByPage.arraySize - 1).FindPropertyRelative("listOfMenuGameobject").ClearArray(); } // --> delete last page if (b_DeletePage) { b_DeletePage = false; Undo.RegisterCompleteObjectUndo(myScript, "All Property Modif Player Sprite " + myScript.gameObject.name); List <CanvasGroup> tmpList = new List <CanvasGroup>(); for (int i = 0; i < List_GroupCanvas.arraySize; i++) { if (i != whichCanvasToDelete) { tmpList.Add((CanvasGroup)List_GroupCanvas.GetArrayElementAtIndex(i).objectReferenceValue); } else { Undo.DestroyObjectImmediate(myScript.List_GroupCanvas [i].gameObject); b_MoreOptions.DeleteArrayElementAtIndex(whichCanvasToDelete); list_gameObjectByPage.DeleteArrayElementAtIndex(whichCanvasToDelete); } } List_GroupCanvas.arraySize = List_GroupCanvas.arraySize - 1; for (int i = 0; i < tmpList.Count; i++) { List_GroupCanvas.GetArrayElementAtIndex(i).objectReferenceValue = tmpList[i]; } } serializedObject.ApplyModifiedProperties(); }
public bool initIngameGlobalManageVariables() { //Debug.Log("here Init"); // LevelManager GameObject tmpObj = GameObject.Find("LevelManager"); if (tmpObj) { _levelManager = tmpObj.GetComponent <LevelManager> (); saveAndLoadManager._levelManager = _levelManager; } // cameraViewer3D tmpObj = GameObject.Find("CamShowObject"); if (tmpObj) { cameraViewer3D = tmpObj.GetComponent <investigationCam> (); } // canvasPlayerInfos tmpObj = GameObject.Find("Canvas_PlayerInfos"); if (tmpObj) { canvasPlayerInfos = tmpObj.GetComponent <UIVariousFunctions> (); // Reticule tmpObj = GameObject.Find("Reticule"); if (tmpObj) { if (!b_DesktopInputs) { // Deactivate Reticule if Mobile input are used tmpObj.SetActive(false); reticule = null; } else { tmpObj.SetActive(true); reticule = tmpObj; } } tmpObj = GameObject.Find("ReticuleJoystick"); if (tmpObj) { reticuleJoystick = tmpObj; reticuleJoystickImage = reticuleJoystick.transform.GetChild(0); _joystickReticule = reticuleJoystick.GetComponent <JoystickReticule>(); if (!b_DesktopInputs && reticuleJoystickImage && reticuleJoystickImage.gameObject.activeSelf) { reticuleJoystickImage.gameObject.SetActive(false); } } StartCoroutine(InitCanvasMenu()); } // canvasMainMenu tmpObj = GameObject.Find("Canvas_MainMenu"); if (tmpObj) { canvasMainMenu = tmpObj.GetComponent <Menu_Manager> (); } switchKeyboardJoystick(); // canvasLoadingScreen tmpObj = GameObject.Find("Canvas_LoadingScreen"); if (tmpObj) { canvasLoadingScreen = tmpObj.GetComponent <Menu_Manager> (); } // Game_ObjectReader tmpObj = GameObject.Find("Game_ObjectReaderConnect"); if (tmpObj) { Game_ObjectReader = tmpObj.GetComponent <ObjectReaderConnect>().Game_ObjectReaderConnect.GetComponent <ingameMultiPageText> (); } // canvasMobileInputs GameObject tmpMobileCanvas = GameObject.Find("mobileCanvas"); if (tmpMobileCanvas) { canvasMobileInputs = tmpMobileCanvas.GetComponent <canvasMobileConnect>().canvas_Mobile; if (b_DesktopInputs) { canvasMobileInputs.SetActive(false); } // Deactivate Mobile canvas if Desktop input are used else { canvasMobileInputs.SetActive(true); } } lastUIButtonSelected = null; navigationButtonList.Clear(); // Find the event System GameObject tmpEventSys = GameObject.Find("EventSystem"); if (tmpEventSys) { eventSys = tmpEventSys.GetComponent <EventSystem> (); } // InitInputs initInputsValues(); // inputListOfStringGamepad // audioMenu tmpObj = GameObject.Find("audioMenu"); if (tmpObj) { audioMenu = tmpObj.GetComponent <AudioSource> (); } // audioMenuClips tmpObj = GameObject.Find("audioMenu"); if (tmpObj) { audioMenuClips = tmpObj.GetComponent <audioMenuClipList> (); } // voiceOverManager tmpObj = GameObject.Find("VoiceOver_Manager"); if (tmpObj) { voiceOverManager = tmpObj.GetComponent <VoiceOver_Manager> (); } currentPlayerDiaryList.Clear(); currentPlayerInventoryList.Clear(); currentPlayerInventoryObjectVisibleList.Clear(); // Connect script mobileInputsFingerMovement to canvasMobileInputs if (GetComponent <mobileInputsFingerMovement> () && !b_DesktopInputs) { //Debug.Log ("Here Ok"); if (canvasMobileInputs) { GetComponent <mobileInputsFingerMovement> ().m_Raycaster = canvasMobileInputs.GetComponent <GraphicRaycaster> (); } if (canvasPlayerInfos) { GetComponent <mobileInputsFingerMovement> ().listRaycaster[0] = canvasPlayerInfos.GetComponent <GraphicRaycaster> (); } if (canvasMobileInputs) { GetComponent <mobileInputsFingerMovement> ().listRaycaster[1] = canvasMobileInputs.GetComponent <GraphicRaycaster> (); } if (canvasMainMenu) { GetComponent <mobileInputsFingerMovement> ().listRaycaster[2] = canvasMainMenu.GetComponent <GraphicRaycaster> (); } } // currentPlayer b_bodyMovement = true; tmpObj = GameObject.Find("Character"); if (tmpObj) { currentPlayer = tmpObj; } if (tmpMobileCanvas && tmpMobileCanvas.GetComponent <canvasMobileConnect> ()) { tmpMobileCanvas.GetComponent <canvasMobileConnect>().initializedCanvasMobile(); } gameObject.GetComponent <focusCamEffect> ().Init(); // language Choice tmpObj = GameObject.Find("OptionsManager"); if (tmpObj) { tmpObj.GetComponent <GameOptionsManager>().initData(); } return(true); }
public void SplashStopAnim() { Menu_Manager.Instance().SplashScreen(); }