private IEnumerator InitUI() { PopupRoomInstance[] pris; while ((pris = Resources.FindObjectsOfTypeAll <PopupRoomInstance>()).Length == 0) { yield return(null); } PopupRoomInstance pri = pris[0]; RectTransform nameTextRT = pri.transform.Find("Popup/NameText").GetComponent <RectTransform>(); nameTextRT.GetComponent <Text>().alignment = TextAnchor.MiddleLeft; byte[] data = Properties.Resources.dropdown; AssetBundleCreateRequest request = AssetBundle.LoadFromMemoryAsync(data); while (!request.isDone) { yield return(null); } if (request.assetBundle == null) { MelonLogger.Error("Unable to load dropdown Assetbundle"); yield break; } //Load main prefab AssetBundleRequest abrMain = request.assetBundle.LoadAssetWithSubAssetsAsync("Assets/Prefabs/Dropdown.prefab"); while (!abrMain.isDone) { yield return(null); } if (abrMain.asset == null) { MelonLogger.Error("Unable to load Dropdown prefab from Assetbundle (prefab is null)"); yield break; } Dropdown prefab = abrMain.asset.Cast <GameObject>().GetComponent <Dropdown>(); if (prefab == null) { MelonLogger.Error("Invalid Dropdown prefab: Missing Dropdown script"); yield break; } Log("Dropdown prefab is valid"); serverDropdown = GameObject.Instantiate(prefab, pri.GetComponent <RectTransform>()); RectTransform ddRT = serverDropdown.GetComponent <RectTransform>(); ddRT.localPosition += new Vector3(250, 150); ddRT.sizeDelta += new Vector2(200, 0); //defaultServer.appVersion = GameObject.FindObjectOfType<VRCApplicationSetup>().Method_Public_String_2(); defaultServer.appVersion = GameObject.FindObjectOfType <VRCApplicationSetup>().appVersion; serverList = new List <ServerDef> { defaultServer, ServerDef.DedicatedServer("Slaynash EUW Server", "31.204.91.102", 5055) /*, ServerDef.DedicatedServer("Local Server", "127.0.0.1", 5055)*/ }; serverDropdown.ClearOptions(); Il2CppSystem.Collections.Generic.List <string> options = new Il2CppSystem.Collections.Generic.List <string>(serverList.Count); foreach (ServerDef serverdef in serverList) { options.Add(serverdef.name); } serverDropdown.AddOptions(options); }
private static void GetNewInstancePrefix(ref string tags) { MelonLogger.Msg("Mono Stacktrace:\n" + new StackTrace().ToString()); MelonLogger.Msg("Il2Cpp Stacktrace:\n" + new Il2CppSystem.Diagnostics.StackTrace().ToString()); ServerDef targetServer; if (new StackTrace().GetFrame(2).GetMethod().DeclaringType == typeof(PopupRoomInstance)) { targetServer = serverList[serverDropdown.value]; } else { targetServer = ss.AppSettings.UseNameServer ? ServerDef.CloudServer("", ss.AppSettings.FixedRegion, ss.AppSettings.AppIdRealtime, ss.AppSettings.AppVersion) : ServerDef.DedicatedServer("", ss.AppSettings.Server, ss.AppSettings.Port); } if (targetServer != defaultServer) { if (targetServer.cloud) { tags += "~cloud(" + targetServer.region + "," + targetServer.appId + "," + targetServer.appVersion + ")"; } else { tags += "~server(" + targetServer.address + "," + targetServer.port + ")"; } } MelonLogger.Msg("generated instance id: " + tags); }
private static void GetNewInstancePrefix(ref string tags) { ServerDef targetServer; if (new StackTrace().GetFrame(2).GetMethod().DeclaringType == typeof(PopupRoomInstance)) { targetServer = serverList[serverDropdown.value]; } else { targetServer = ss.AppSettings.UseNameServer ? ServerDef.CloudServer("", ss.AppSettings.FixedRegion, ss.AppSettings.AppIdRealtime, ss.AppSettings.AppVersion) : ServerDef.DedicatedServer("", ss.AppSettings.Server, ss.AppSettings.Port); } if (targetServer != defaultServer) { if (targetServer.cloud) { tags += "~cloud(" + targetServer.region + "," + targetServer.appId + "," + targetServer.appVersion + ")"; } else { tags += "~server(" + targetServer.address + "," + targetServer.port + ")"; } } }