void DisplayWorldData() { print("Displaying world data..."); var sb = new System.Text.StringBuilder(); sb.AppendLine("AVAILABLE WORLDS"); for (int i = 0; i < worldDatas.Count; i++) { sb.AppendLine($"{worldDatas[i].name}"); GameObject worldButton = Instantiate(worldButtonPrefab, contentViewport); WorldButton wb = worldButton.GetComponent <WorldButton>(); wb.SetWorldName(worldDatas[i].name); wb.SetWorldDate(worldDatas[i].creationDate.ToShortDateString()); if (worldDatas[i].gamemode == 0) { wb.SetWorldGamemode("Survival"); } else if (worldDatas[i].gamemode == 1) { wb.SetWorldGamemode("Creative"); } wb.buttonNumber = i; wb.isNewWorldButton = false; } print(sb); }
public void UiManagerInit() { InviteButton.Setup(); FriendButton.Setup(); WorldButton.Setup(); WorldDownloadStatus.Setup(); HudIcon.Setup(); }
public override void VRChat_OnUiManagerInit() { InviteButton.Setup(); FriendButton.Setup(); WorldButton.Setup(); WorldDownloadStatus.Setup(); HudIcon.Setup(); CacheManager.UpdateDirectories(); }
public override void VRChat_OnUiManagerInit() { GameObject.Find("UserInterface/QuickMenu/QuickModeMenus/QuickModeNotificationsMenu/ScrollRect/ViewPort/Content/NotificationUiPrefab/Row_NotificationActions").AddComponent <SelectedNotificationListener>(); GameObject.Find("UserInterface/QuickMenu/QuickModeMenus/QuickModeInviteResponseMoreOptionsMenu").AddComponent <NotificationMoreListener>(); InviteButton.Setup(); FriendButton.Setup(); WorldButton.Setup(); WorldDownloadStatus.Setup(); HudIcon.Setup(); }
private void Awake() { ApplyCurrentParent(); button = GetComponent <WorldButton>(); button.SubscribeOnClickHandler(this); button.enabled = pickable; if (state == ItemState.Inventory) { PlayerInventory.Instance.AddItem(this); } }
public override void Start() { base.Start(); WorldToLoad.Value = 0; UpdateWorldSelection(); List <ProjectWorldData> userWorlds; if (!ConnectionMgr.OFFLINE_DEBUG) { userWorlds = ConnectionMgr.Instance.GetProjectWorldsByUser(ConnectionMgr.Instance.CurrentAccount.id); DataMgr.Instance.UpdateWorldsList(userWorlds); for (int i = 0; i < userWorlds.Count; i++) { ProjectWorldData world = userWorlds[i]; if (world != null) { Debug.LogFormat("Found user world {0} {1}!", world.name, world.levels.Length); GameObject newWorldButton = GameObject.Instantiate(WorldButtonPrefab); WorldButton button = newWorldButton.GetComponent <WorldButton>(); button.UpdateWorldButton(world.name, world.levels.Length); newWorldButton.transform.SetParent(WorldMenu); newWorldButton.transform.localScale = new Vector3(1f, 1f, 1f); // Need to reset scale back to 1. } } } else { for (int i = 0; i < WorldList.Worlds.Count; i++) { WorldData world = WorldList.Worlds[i]; if (world != null) { Debug.LogFormat("Found user world {0} {1}!", world.name, world.LevelList.Levels.Count); GameObject newWorldButton = GameObject.Instantiate(WorldButtonPrefab); WorldButton button = newWorldButton.GetComponent <WorldButton>(); button.UpdateWorldButton(world.name, world.LevelList.Levels.Count); newWorldButton.transform.SetParent(WorldMenu); newWorldButton.transform.localScale = new Vector3(1f, 1f, 1f); // Need to reset scale back to 1. } } } }
private void Awake() { if (triggerButton == null) { triggerButton = GetComponent<WorldButton>(); } if (triggerButton) { triggerButton.ButtonActivateEvent.AddListener(ToggleOn); triggerButton.ButtonDeactivateEvent.AddListener(ToggleOff); } }
public static void Postfix(IntPtr thisPtr, IntPtr apiWorldPtr, IntPtr apiWorldInstancePtr, byte something1, byte something2, IntPtr additionalJunkPtr) { try { worldInfoSetupDelegate(thisPtr, apiWorldPtr, apiWorldInstancePtr, something1, something2, additionalJunkPtr); if (apiWorldPtr != IntPtr.Zero) { WorldButton.UpdateText(new ApiWorld(apiWorldPtr)); } } catch (Exception e) { MelonLogger.Error($"Something went horribly wrong in WorldInfoSetup Patch, pls report to gompo: {e}"); } }
void FindWorlds() { if (worldListContent.transform.childCount > 0) { for (int i = 0; i < worldListContent.transform.childCount; i++) { Destroy(worldListContent.transform.GetChild(i).gameObject); } } string path = Application.persistentDataPath; if (!Directory.Exists(path + "/Worlds")) { Directory.CreateDirectory(path + "/Worlds"); //Debug.Log (path + "/Worlds"); } string[] worldFilesPathes = Directory.GetFiles(path + "/Worlds/"); int validWorlds = 0; foreach (string worldFilePath in worldFilesPathes) { //Debug.Log (worldFilePath.Substring (worldFilePath.Length - 10, 10)); if (worldFilePath.Substring(worldFilePath.Length - 10, 10) == ".grenworld") { //Debug.Log (worldFilePath + " is a valid world !"); WorldButton wb = Instantiate(worldButtonPrefab, worldListContent.transform).GetComponent <WorldButton> (); string worldName = worldFilePath.Substring(worldFilePath.LastIndexOf("/") + 1, worldFilePath.LastIndexOf(".") - worldFilePath.LastIndexOf("/") - 1); //Debug.Log (worldName); wb.Initialize(worldName, this); validWorlds++; } } worldListContent.SetHeight(validWorlds, worldButtonPrefab.GetComponent <RectTransform> ().rect.height); scrollRect.verticalNormalizedPosition = 1f; }
private static async void OnRecompress() { await TaskUtilities.YieldToMainThread(); CacheManager.CreateInfoFileFor(file); if (ModSettings.showHudMessages) { Utilities.QueueHudMessage("Download Finished"); } if (ModSettings.hideQMStatusWhenInActive) { WorldDownloadStatus.Disable(); } Downloading = false; CacheManager.AddDirectory(CacheManager.ComputeAssetHash(DownloadInfo.ApiWorld.id)); HudIcon.Disable(); InviteButton.UpdateTextDownloadStopped(); FriendButton.UpdateTextDownloadStopped(); WorldButton.UpdateTextDownloadStopped(); WorldDownloadStatus.gameObject.SetText(Constants.DOWNLOAD_STATUS_IDLE_TEXT); switch (DownloadInfo.DownloadType) { case DownloadType.Friend: if (!ModSettings.autoFollowFriends) { if (ModSettings.showPopupsOnComplete) { DisplayFriendPopup(); } } else { Utilities.GoToWorld(DownloadInfo.ApiWorld, DownloadInfo.InstanceIDTags, false); } break; case DownloadType.Invite: if (!ModSettings.autoFollowInvites) { if (ModSettings.showPopupsOnComplete) { DisplayInvitePopup(); } } else { Utilities.GoToWorld(DownloadInfo.ApiWorld, DownloadInfo.InstanceIDTags, true); } break; case DownloadType.World: if (!ModSettings.autoFollowWorlds) { if (ModSettings.showPopupsOnComplete) { DisplayWorldPopup(); } } else { Utilities.GoToWorld(DownloadInfo.ApiWorld, DownloadInfo.InstanceIDTags, false); } break; } }
public static void HandleKeyDown(KeyEventArgs e) { // CHANGE TO SWITCH CASE Keys k = e.KeyCode; //System.Diagnostics.Debug.WriteLine(k); if (k == Keys.Escape) { if (Game.P != null && Game.P.GetInventory().IsOpen()) { Game.P.GetInventory().Close(); } else { Application.Exit(); } } // if on menu, dont handle all keys if (Game.GameState == GameState.MENU) { if (k == Keys.Enter) { WorldButton.LoadSelectedWorld(); } return; } if (k == Keys.Right && !_KeyDown[1]) { _KeyDown[1] = true; // _KeyDown[0] = false; Game.P.VelX = C.PLAYER_SPEED; } else if (k == Keys.Left && !_KeyDown[0]) { _KeyDown[0] = true; //_KeyDown[1] = false; Game.P.VelX = -C.PLAYER_SPEED; } else if (k == Keys.Up && !_KeyDown[2]) { _KeyDown[2] = true; // _KeyDown[0] = false; Game.P.VelY = C.PLAYER_SPEED; } else if (k == Keys.Down && !_KeyDown[3]) { _KeyDown[3] = true; //_KeyDown[1] = false; Game.P.VelY = -C.PLAYER_SPEED; } else if (k == Keys.D && e.Control) { Game.WB.Toggle(); } else if (k == Keys.Menu) { // Game.P.Jump(); e.Handled = true; } else if (k == Keys.E) { Game.P.GetInventory().ToggleOpen(); } }
public void SetLastSelectedWorldSettings(WorldButton wb) { lastSelectedWorldSettings = wb; }
public static void Postfix(ApiWorld __0 = null) => WorldButton.UpdateText(__0);