示例#1
0
 public static void AddGameLogReference(PUI_GameEventLog log)
 {
     if (gameLogs == null)
     {
         gameLogs = new List <PUI_GameEventLog>();
     }
     gameLogs.Add(log);
 }
示例#2
0
 private static void TryLog(string message, Color c, PUI_GameEventLog gameLog)
 {
     if (gameLog == null || !gameLog.gameObject.activeSelf)
     {
         return;
     }
     foreach (string item in message.Split(Environment.NewLine.ToCharArray()))
     {
         if (item.Trim().Length < 1)
         {
             continue;
         }
         gameLog.AddLogItem("<color=#" + ColorExt.ToHex(c) + "> > " + "DiffTweaker" + "</color>: " + item, eGameEventChatLogType.IncomingChat);
     }
 }
        static void Postfix(PlayerGuiLayer __instance, PUI_Inventory ___Inventory, PUI_LocalPlayerStatus ___m_playerStatus, PUI_WardenIntel ___m_wardenIntel, PUI_GameEventLog ___m_gameEventLog, PUI_Compass ___m_compass, PUI_GameObjectives ___m_wardenObjective)
        {
            ___Inventory.SetPosition(new Vector2(-500f, -250f));
            ___Inventory.transform.localScale *= .0f;

            ___m_compass.SetPosition(new Vector2(0.0f, -250f));

            ___m_compass.transform.localScale *= .75f;

            if (VRSettings.disableCompass)
            {
                ___m_compass.transform.localScale *= .0f;
            }

            ___m_gameEventLog.SetPosition(new Vector2(150f, 100f));
            ___m_gameEventLog.transform.localScale *= .0f;

            ___m_wardenIntel.SetPosition(new Vector2(0, 0f));
            ___m_wardenIntel.transform.localScale *= .5f;
            ___m_wardenIntel.SetAnchor(GuiAnchor.MidCenter);

            ___m_wardenObjective.SetPosition(new Vector2(625f, -475f));
            ___m_wardenObjective.transform.localScale *= .0f;

            ___m_playerStatus.SetPosition(new Vector2(0.0f, 180f));
            ___m_playerStatus.transform.localScale *= 0f;


            PlayerVR.SetPlayerGUIInstance(__instance);
        }
示例#4
0
 static void Prefix(PUI_GameEventLog __instance)
 {
     LoggerWrapper.AddGameLogReference(__instance);
 }
示例#5
0
        public static bool PreFix()
        {
            if (!(PlayerChatManager.Current.m_currentValue.Length > 2))
            {
                return(true);
            }
            if (!PlayerChatManager.Current.m_currentValue.StartsWith("/"))
            {
                return(true);
            }
            PlayerChatManager.Current.m_currentValue = PlayerChatManager.Current.m_currentValue.Remove(0, 1);
            string[]         args = PlayerChatManager.Current.m_currentValue.Split(" ");
            PUI_GameEventLog chat = UnityEngine.Object.FindObjectOfType <PUI_GameEventLog>();

            if (chat == null)
            {
                Log.Error($"TextChatHook invoked, but PUI_GameEventLog cannot be found");
                return(true);
            }
            SoundPlayerScript soundPlayer = UnityEngine.Object.FindObjectOfType <SoundPlayerScript>();

            if (soundPlayer == null)
            {
                Log.Error($"TextChatHook invoked, but SoundPlayerScript cannot be found");
                return(true);
            }
            switch (args[0].ToLower())
            {
            case "clear":
            case "cls":
                for (int i = 0; i < chat.m_logItemsMax; i++)
                {
                    chat.AddLogItem("", eGameEventChatLogType.IncomingChat);
                }
                PlayerChatManager.Current.m_currentValue = "";
                PlayerChatManager.Current.ExitChatMode();
                return(false);

            case "changesound":
            case "editsound":
            case "sound":
            case "s":
                if (!uint.TryParse(args[1], out uint eventId))
                {
                    PropertyInfo[] properties = typeof(EVENTS).GetProperties();
                    PropertyInfo[] matches    = properties.Where((x) => x.Name.ToLower().Contains(args[1].ToLower())).ToArray();
                    if (matches.Length == 0)
                    {
                        chat.AddLogItem($"<color=#1ac725>Couldn't find a sound with name {args[1]}</color>", eGameEventChatLogType.IncomingChat);
                        PlayerChatManager.Current.m_currentValue = "";
                        PlayerChatManager.Current.ExitChatMode();
                        return(false);
                    }
                    if (matches.Length > 1)
                    {
                        string log = $"<color=#1ac725>Found more than one sounds that match {args[1]}:\n";
                        for (int i = 0; i < matches.Length; i++)
                        {
                            log += $"\t{matches[i].Name}: {matches[i].GetValue(null)}";
                            if (i < matches.Length - 1)
                            {
                                log += "\n";
                            }
                        }
                        log += $"</color>";
                        chat.AddLogItem(log, eGameEventChatLogType.IncomingChat);
                        PlayerChatManager.Current.m_currentValue = "";
                        PlayerChatManager.Current.ExitChatMode();
                        return(false);
                    }
                    eventId = (uint)matches[0].GetValue(null);
                }

                chat.AddLogItem($"<color=#1ac725>Changing sound to {eventId}</color>", eGameEventChatLogType.IncomingChat);
                soundPlayer.SoundId = eventId;
                PlayerChatManager.Current.m_currentValue = "";
                PlayerChatManager.Current.ExitChatMode();
                return(false);
            }

            return(true);
        }