Exemplo n.º 1
0
        private static ConfigEntry <string> BindStringDropdown(ConfigFile file, string section, string key, string defaultVal, string description, string title, string[] possibleValues)
        {
            AcceptableValueList <string> acceptableValues = new AcceptableValueList <string>(possibleValues);
            ConfigDefinition             def = new ConfigDefinition(section, key);
            ConfigDescription            cd  = new ConfigDescription(description, acceptableValues);
            var entry = BindConfig(file, def, cd, defaultVal);

            VRSettings.Add(new BepinGTFOSettingString(title, eSettingInputType.StringArrayDropdown, (eCellSettingID)baseVRConfigID, entry, defaultVal, possibleValues));
            return(entry);
        }
Exemplo n.º 2
0
        private static object[] AcceptableValueListHelper <T>(AcceptableValueList <T> list) where T : IEquatable <T>
        {
            var objs = new object[list.AcceptableValues.Length];

            for (var i = 0; i < list.AcceptableValues.Length; i++)
            {
                objs[i] = list.AcceptableValues[i];
            }

            return(objs);
        }
Exemplo n.º 3
0
        // Awake is called once when both the game and the plug-in are loaded
        void Awake()
        {
            DistanceLOS          = Config.Bind("Line of Sight", "Custom Line of Sight", false);
            LOSDistance          = Config.Bind("Line of Sight", "Distance", 10.0f);
            lineOfSiteFocusAlias = new AcceptableValueList <String>(new String[] { "Not Set" });
            lineLater            = Config.Bind("Line of Sight", "Focused Character", "Not Set", new ConfigDescription("Select the alias to focus on. If not set all characters are in line of sight.", lineOfSiteFocusAlias));
            //lineLater = Config.Bind("test", "test", "Test", new ConfigDescription("Description", lineOfSiteFocusAlias));

            ShowHandout      = Config.Bind("Hotkeys", "Handout Shortcut", new KeyboardShortcut(KeyCode.P, KeyCode.LeftControl));
            BringPlayersToMe = Config.Bind("Hotkeys", "Bring Players to my Board Shortcut", new KeyboardShortcut(KeyCode.M, KeyCode.LeftControl));

            instance = this;
            Logger.LogInfo("In Awake for Handouts Plug-in");

            UnityEngine.Debug.Log("Handouts Plug-in loaded");
            ModdingTales.ModdingUtils.Initialize(this, Logger);
        }
Exemplo n.º 4
0
        void Update()
        {
            var board = BoardSessionManager.Board;
            var flags = BindingFlags.Public | BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Static;

            //Debug.Log("LOS Enabled: " + DistanceLOS.Value);
            if (board != null && DistanceLOS.Value)
            {
                Dictionary <NGuid, CreatureData> creatures = (Dictionary <NGuid, CreatureData>)board.GetType().GetField("_creatures", flags).GetValue(board);
                foreach (KeyValuePair <NGuid, CreatureData> focusCreature in creatures)
                {
                    if (focusCreature.Value.Alias == lineLater.Value)
                    {
                        //Debug.Log("Found Focus");
                        foreach (KeyValuePair <NGuid, CreatureData> entry in creatures)
                        {
                            CreatureBoardAsset creatureBoardAsset;
                            if (PhotonSimpleSingletonBehaviour <CreatureManager> .Instance.TryGetAsset(entry.Value.CreatureId, out creatureBoardAsset))
                            {
                                float distance = Vector3.Distance(entry.Value.Position, focusCreature.Value.Position);
                                //Debug.Log("Distance: " + distance + " Alias: " + entry.Value.Alias + "Pos: " + entry.Value.Position + " FCPos: " + focusCreature.Value.Position);
                                if (distance < LOSDistance.Value)
                                {
                                    creatureBoardAsset.InLineOfSight = true;
                                }
                                else
                                {
                                    creatureBoardAsset.InLineOfSight = false;
                                }
                            }
                        }
                    }
                }
            }
            ModdingUtils.OnUpdate();
            var diffInSeconds = (DateTime.Now - lastCheck).TotalSeconds;

            if (diffInSeconds > 3)
            {
                lastCheck = DateTime.Now;
                CheckOOB();
            }
            var diffInHandoutSeconds = (DateTime.Now - lastHandout).TotalSeconds;

            if (handout && handout.activeSelf && diffInHandoutSeconds > 10)
            {
                handout.SetActive(false);
            }

            if (board != null)
            {
                //Debug.Log("onboard");
                Dictionary <NGuid, CreatureData> creatures = (Dictionary <NGuid, CreatureData>)board.GetType().GetField("_creatures", flags).GetValue(board);
                if (creatures.Count + 1 != lineOfSiteFocusAlias.AcceptableValues.Length && creatures.Count > 0)
                {
                    List <string> charAliases = new List <string>();
                    charAliases.Add("Not Set");
                    foreach (KeyValuePair <NGuid, CreatureData> focusCreature in creatures)
                    {
                        charAliases.Add(focusCreature.Value.Alias);
                    }
                    string tmpVal = lineLater.Value;
                    Config.Remove(lineLater.Definition);
                    lineOfSiteFocusAlias = new AcceptableValueList <String>(charAliases.ToArray());
                    lineLater            = Config.Bind("Line of Sight", "Focused Character", "Not Set", new ConfigDescription("Select the alias to focus on. If not set all characters are in line of sight.", lineOfSiteFocusAlias));
                    lineLater.Value      = tmpVal;
                }
            }

            if (BringPlayersToMe.Value.IsUp())
            {
                PartyManager.SummonAllOnlinePlayersToThisBoard(true, CameraController.Position);
            }

            if (ShowHandout.Value.IsUp())
            {
                SystemMessage.AskForTextInput("Handout URL", "Enter the Handout URL (PNG or JPG Image Only)", "OK", delegate(string name)
                {
                    ModdingUtils.SendOOBMessage("{\"sessionid\": \"" + CampaignSessionManager.Info.CampaignId + "\", \"type\": \"put\", \"handoutUrl\": \"" + name + "\"}", null);
                }, delegate
                {
                }, "Cancel", delegate
                {
                });
            }
        }