private static bool IntegrateValidate() { bl_Lobby km = GameObject.FindObjectOfType <bl_Lobby>(); bl_LevelPreview gm = GameObject.FindObjectOfType <bl_LevelPreview>(); return(km != null && gm == null); }
// [MenuItem("MFPS/Addons/Localization/Integrate", true)] private static bool InstegrateValidate() { bl_Lobby lb = GameObject.FindObjectOfType <bl_Lobby>(); bl_LanguageSelector ls = GameObject.FindObjectOfType <bl_LanguageSelector>(); return(lb != null && ls == null); }
private static void Instegrate() { #if PVOICE GameObject p1 = bl_GameData.Instance.Player1; if (p1.GetComponent <PhotonVoiceView>() == null) { p1.AddComponent <PhotonVoiceView>().UsePrimaryRecorder = true; } if (p1.GetComponent <Speaker>() == null) { p1.AddComponent <Speaker>(); } p1 = bl_GameData.Instance.Player2; if (p1.GetComponent <PhotonVoiceView>() == null) { p1.AddComponent <PhotonVoiceView>().UsePrimaryRecorder = true; } if (p1.GetComponent <Speaker>() == null) { p1.AddComponent <Speaker>(); } if (AssetDatabase.IsValidFolder("Assets/MFPS/Scenes")) { EditorSceneManager.SaveCurrentModifiedScenesIfUserWantsTo(); string path = "Assets/MFPS/Scenes/MainMenu.unity"; EditorSceneManager.OpenScene(path, OpenSceneMode.Single); bl_Lobby lb = FindObjectOfType <bl_Lobby>(); if (lb != null) { if (FindObjectOfType <PhotonVoiceNetwork>() == null) { GameObject nobj = new GameObject("PhotonVoice"); PhotonVoiceNetwork pvs = nobj.AddComponent <PhotonVoiceNetwork>(); pvs.AutoConnectAndJoin = true; pvs.AutoLeaveAndDisconnect = true; pvs.ApplyDontDestroyOnLoad = true; Recorder r = nobj.AddComponent <Recorder>(); r.MicrophoneType = Recorder.MicType.Unity; r.TransmitEnabled = false; r.VoiceDetection = false; pvs.PrimaryRecorder = r; nobj.AddComponent <bl_PhotonAudioDisabler>().isGlobal = true; EditorUtility.SetDirty(nobj); EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene()); } Debug.Log("Photon Voice Integrated, enable it on GameData."); } else { Debug.Log("Can't found Menu scene."); } } else { Debug.LogWarning("Can't complete the integration of the addons because MFPS folder structure has been change, please do the manual integration."); } #else Debug.LogWarning("Enable Photon Voice addon before integrate."); #endif }
private static bool IntegrateValidate() { bl_Lobby km = GameObject.FindObjectOfType <bl_Lobby>(); bl_ShopManager gm = GameObject.FindObjectOfType <bl_ShopManager>(); return(km != null && gm == null); }
// [MenuItem("MFPS/Addons/InputManager/Lobby Integration")] private static void Instegrate() { GameObject inp = AssetDatabase.LoadAssetAtPath("Assets/Addons/InputManager/Content/Prefabs/UI/Input UI [1.8].prefab", typeof(GameObject)) as GameObject; if (inp != null) { if (SceneManager.sceneCountInBuildSettings > 0) { if (!EditorSceneManager.GetActiveScene().name.Contains("MainMenu")) { EditorSceneManager.OpenScene("Assets/MFPS/Scenes/MainMenu.unity", OpenSceneMode.Single); } GameObject inputWindow = PrefabUtility.InstantiatePrefab(inp, EditorSceneManager.GetActiveScene()) as GameObject; bl_Lobby lb = FindObjectOfType <bl_Lobby>(); if (lb != null) { GameObject ccb = lb.AddonsButtons[1]; if (ccb != null) { inputWindow.transform.SetParent(ccb.transform, false); inputWindow.transform.SetAsLastSibling(); if (lb.AddonsButtons[8] != null) { lb.AddonsButtons[8].SetActive(false); EditorUtility.SetDirty(lb.AddonsButtons[8]); } EditorUtility.SetDirty(ccb); EditorUtility.SetDirty(inputWindow); EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene()); Debug.Log("<color=green>InputManager integrated in lobby!</color>"); } } else { //use U login } } else { Debug.LogWarning("Scenes has not been added in Build Settings, Can't integrate CC Add-on."); } } else { Debug.Log("Can't found prefab!"); } }
/// <summary> /// /// </summary> /// <param name="info"></param> public void GetInfo(RoomInfo info) { Lobby = FindObjectOfType <bl_Lobby>(); cacheInfo = info; RoomNameText.text = info.Name; MapNameText.text = (string)info.CustomProperties[PropertiesKeys.CustomSceneName]; GameModeText.text = (string)info.CustomProperties[PropertiesKeys.GameModeKey]; PlayersText.text = info.PlayerCount + "/" + info.MaxPlayers; MaxKillText.text = string.Format("{0} Kills", (int)info.CustomProperties[PropertiesKeys.RoomMaxKills]); PingText.text = ((int)info.CustomProperties[PropertiesKeys.MaxPing]).ToString() + " ms"; bool _active = (info.PlayerCount < info.MaxPlayers) ? true : false; PrivateUI.SetActive((string.IsNullOrEmpty((string)cacheInfo.CustomProperties[PropertiesKeys.RoomPassworld]) == false)); JoinButton.SetActive(_active); FullText.SetActive(!_active); }
private static void Instegrate() { if (AssetDatabase.IsValidFolder("Assets/MFPS/Scenes")) { EditorSceneManager.SaveCurrentModifiedScenesIfUserWantsTo(); GameObject inp = AssetDatabase.LoadAssetAtPath("Assets/Addons/LevelSystem/Content/Prefabs/LevelProgress [Lobby].prefab", typeof(GameObject)) as GameObject; if (inp != null) { if (EditorSceneManager.sceneCountInBuildSettings > 0) { EditorSceneManager.OpenScene("Assets/MFPS/Scenes/MainMenu.unity", OpenSceneMode.Single); bl_Lobby lb = Object.FindObjectOfType <bl_Lobby>(); if (lb != null) { if (inp != null) { GameObject pr = PrefabUtility.InstantiatePrefab(inp, EditorSceneManager.GetActiveScene()) as GameObject; GameObject ccb = lb.AddonsButtons[5]; if (ccb != null) { pr.transform.SetParent(ccb.transform, false); } EditorUtility.SetDirty(pr); EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene()); Debug.Log("Level System integrate!"); } else { Debug.Log("Can't found the Level Manager prefab."); } } } else { Debug.LogWarning("Scenes has not been added in Build Settings, Can't integrate Level System Add-on."); } } else { Debug.Log("Can't found prefab!"); } } else { Debug.LogWarning("Can't integrate the addons because MFPS folder structure has been change, please do the manual integration."); } }
private static void Instegrate() { if (SceneManager.sceneCountInBuildSettings > 0) { Scene menuScene = EditorSceneManager.OpenScene("Assets/MFPS/Scenes/MainMenu.unity", OpenSceneMode.Single); GameObject prefab = AssetDatabase.LoadAssetAtPath("Assets/Addons/ULoginSystemPro/Content/Prefabs/UI/Profile [MFPS].prefab", typeof(GameObject)) as GameObject; GameObject rankingprefab = AssetDatabase.LoadAssetAtPath("Assets/Addons/ULoginSystemPro/Content/Prefabs/UI/Ranking [MFPS].prefab", typeof(GameObject)) as GameObject; bl_Lobby lb = FindObjectOfType <bl_Lobby>(); if (lb != null) { if (FindObjectOfType <bl_UserProfile>() == null) { GameObject inst = PrefabUtility.InstantiatePrefab(prefab, menuScene) as GameObject; GameObject ccb = lb.AddonsButtons[4]; if (ccb != null) { inst.transform.SetParent(ccb.transform, false); inst.GetComponent <RectTransform>().anchoredPosition = Vector2.zero; EditorUtility.SetDirty(inst); EditorUtility.SetDirty(lb); EditorSceneManager.MarkSceneDirty(menuScene); } inst = PrefabUtility.InstantiatePrefab(rankingprefab, menuScene) as GameObject; ccb = lb.AddonsButtons[5]; inst.transform.SetParent(ccb.transform, false); EditorUtility.SetDirty(inst); Debug.Log("ULogin Pro successfully integrated"); } else { Debug.Log("ULogin Pro is already integrated"); } } else { Debug.LogWarning("Can't found the MainMenu scene, that could be cause a change in the default structure of the MFPS folders."); } } else { Debug.LogWarning("Scenes has not been added in Build Settings, Can't integrate ULogin Pro"); } }
private static void InstegrateInLobby() { GameObject prefab = AssetDatabase.LoadAssetAtPath("Assets/Addons/PlayerSelector/Content/Prefabs/UI/OperatorsUI.prefab", typeof(GameObject)) as GameObject; if (prefab != null) { GameObject g = PrefabUtility.InstantiatePrefab(prefab, UnityEditor.SceneManagement.EditorSceneManager.GetActiveScene()) as GameObject; bl_Lobby l = FindObjectOfType <bl_Lobby>(); g.transform.SetParent(l.AddonsButtons[11].transform, false); EditorUtility.SetDirty(g); bl_PlayerSelectorData.Instance.PlayerSelectorMode = bl_PlayerSelectorData.PSType.InLobby; EditorUtility.SetDirty(bl_PlayerSelectorData.Instance); EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene()); Debug.Log("<color=green>Player Selector</color> integrate!"); } else { Debug.Log("Can't found prefab!"); } }
// [MenuItem("MFPS/Addons/Localization/Integrate")] private static void Instegrate() { if (AssetDatabase.IsValidFolder("Assets/MFPS/Scenes")) { GameObject selector = AssetDatabase.LoadAssetAtPath("Assets/Addons/Localization/Content/Prefabs/UI/LanguageSelector[1.8].prefab", typeof(GameObject)) as GameObject; if (selector != null) { if (EditorSceneManager.GetActiveScene() == null || EditorSceneManager.GetActiveScene().name != "MainMenu") { EditorSceneManager.SaveCurrentModifiedScenesIfUserWantsTo(); string path = "Assets/MFPS/Scenes/MainMenu.unity"; EditorSceneManager.OpenScene(path, OpenSceneMode.Single); } bl_Lobby lb = GameObject.FindObjectOfType <bl_Lobby>(); if (lb != null) { GameObject ccb = lb.AddonsButtons[6]; if (ccb != null) { GameObject inst = PrefabUtility.InstantiatePrefab(selector, EditorSceneManager.GetActiveScene()) as GameObject; inst.transform.SetParent(ccb.transform, false); inst.transform.SetAsLastSibling(); EditorUtility.SetDirty(inst); EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene()); Debug.Log("Localization integrate!"); } } else { Debug.Log("Can't found Menu scene."); } } else { Debug.Log("Can't found selector prefab."); } } }
private static bool IntegrateValidateInLobby() { bl_Lobby l = FindObjectOfType <bl_Lobby>(); return(l != null); }