Example #1
0
        public override void Init()
        {
            const float maxangle     = 50;
            const float defaultangle = 30;
            UIH         ui           = new UIH(this);

            Applies.To(this, "Person");
            LookAtWithLimits[] lookatwithlimits = containingAtom.gameObject.GetComponentsInChildren <LookAtWithLimits>();
            var L = lookatwithlimits[0];
            var R = lookatwithlimits[1];

            ui.BoolCheckbox(ref LEnabled, "Right enabled", true, b => L.enabled = b, true);
            ui.BoolCheckbox(ref REnabled, "Left enabled", true, b => R.enabled  = b, false);

            ui.FloatSlider(ref LfollowSpeed, "Left followSpeed", defaultangle, f => setLRValue(f, ref R.smoothFactor, ref RfollowSpeed), 5, maxangle, false, true);
            ui.FloatSlider(ref RfollowSpeed, "Right followSpeed", defaultangle, f => setLRValue(f, ref L.smoothFactor, ref LfollowSpeed), 5, maxangle, true, true);

            ui.FloatSlider(ref LMaxUp, "Left max up", defaultangle, f => setValues(f, ref L.MaxUp, ref RMaxUp, ref LMaxDown, ref RMaxDown), 5, maxangle, false, true);
            ui.FloatSlider(ref RMaxUp, "Right max up", defaultangle, f => setValues(f, ref R.MaxUp, ref LMaxUp, ref RMaxDown, ref LMaxDown), 5, maxangle, true, true);
            ui.FloatSlider(ref LMaxDown, "Left max down", defaultangle, f => setValues(f, ref L.MaxDown, ref RMaxDown, ref LMaxUp, ref RMaxUp), 5, maxangle, false, true);
            ui.FloatSlider(ref RMaxDown, "Right max down", defaultangle, f => setValues(f, ref R.MaxDown, ref LMaxDown, ref RMaxUp, ref LMaxUp), 5, maxangle, true, true);

            ui.BoolCheckbox(ref syncLeftRightEnabled, "sync Left and Right", true);
            ui.BoolCheckbox(ref syncUpDownEnabled, "sync Up and Down", true);

            /* use this if you ever need to force disabling,
             * e.g. if switching from Person To Target in the Auto Behaviour. But preferably manage the gaze target.
             * JSONStorableAction ForceDisabling = new JSONStorableAction("force disabling", () => { R.enabled = L.enabled = false; });
             * RegisterAction(ForceDisabling);
             */
        }
Example #2
0
        static TypeInfo TypeFactory(UIB interchangeHeader, UIH messageHeader)
        {
            if (messageHeader.MESSAGEIDENTIFIER_01.MessageVersionNumber_02 == "010" && messageHeader.MESSAGEIDENTIFIER_01.MessageReleaseNumber_03 == "006")
            {
                if (messageHeader.MESSAGEIDENTIFIER_01.MessageFunction_04 == "NEWRX")
                {
                    return(typeof(TSNEWRX).GetTypeInfo());
                }
            }

            throw new Exception("Message is not supported.");
        }
Example #3
0
    public static void TimeSpentDialog(System.Action action, string logPrefix = "Time", bool logMessage = true)
    {
        string successMsg;

        System.Diagnostics.Stopwatch watch = new System.Diagnostics.Stopwatch();
        watch.Start();

        action();

        watch.Stop();
        string secondStr = watch.Elapsed.TotalSeconds.ToString("0.00");

        successMsg = string.Format("Done in {0}s", secondStr);

        if (logMessage)
        {
            Debug.Log("[" + logPrefix + "] " + successMsg);
        }

        UIH.Dialog("Success", successMsg, "OK");
    }
Example #4
0
        public static void InitClaws()
        {
            if (initialized)
            {
                return;
            }
            initialized = true;
            Type MPF = Main.LocalPlayer.GetModPlayer(ModLoader.GetMod("WeaponOut"), "ModPlayerFists")?.GetType();

            if (MPF == null)
            {
                return;
            }
            clawType = MPF.GetField("useStyle").GetValue(null) as int?;
            //MPF.GetMethod("RegisterComboEffectID").Invoke(null, new Action<Player, Item, bool>[]{ComboEffects});//ComboEffects
            MPFUseItemHitbox  = Delegate.CreateDelegate(typeof(UIH), MPF.GetMethod("UseItemHitbox")) as UIH;                                                                   //UseItemHitbox
            UseItemGraphicbox = Delegate.CreateDelegate(typeof(Func <Player, int, int, Rectangle>), MPF.GetMethod("UseItemGraphicbox")) as Func <Player, int, int, Rectangle>; //UseItemGraphicbox
            GetFistVelocity   = Delegate.CreateDelegate(typeof(Func <Player, Vector2>), MPF.GetMethod("GetFistVelocity")) as Func <Player, Vector2>;                           //GetFistVelocity
            DashOnMovement    = MPF.GetMethod("SetDashOnMovement");
            //SetDashOnMovement = Delegate.CreateDelegate(typeof(Func<ModPlayer, float, float, float, float, bool, int, bool> ),MPF.GetMethod("SetDashOnMovement")) as Func<ModPlayer, float, float, float, float, bool, int, bool>;//SetDashOnMovement
            //ModifyTooltips
        }