Пример #1
0
        protected virtual void Clear()
        {
            NextButtonID    = 1;
            NextSwitchID    = 0;
            NextTextInputID = 0;

            Buttons.Clear();
            TileButtons.Clear();
            Switches.Clear();
            Radios.Clear();
            TextInputs.Clear();
            LimitedTextInputs.Clear();

            Entries.Clear();
            Entries.TrimExcess();

            if (Layout == null)
            {
                Layout = new SuperGumpLayout();
            }
            else
            {
                Layout.Clear();
            }
        }
Пример #2
0
 public void SwitchesLoop(bool begin)
 {
     // TODO: LMAOOOOOOOOO
     if (begin)
     {
         Switches.Clear();
         StandBy.Clear();
         PositionStandBy.Clear();
     }
     else
     {
         _switchesRequired--;
     }
     if (_switchesRequired == 0)
     {
         new Thread(() => PBEBattle.SelectSwitchesIfValid(_trainer, Switches))
         {
             Name = ThreadName
         }.Start();
     }
     else
     {
         AddMessage($"You must send in {_switchesRequired} Pokémon.");
         //BattleView.Actions.DisplaySwitches();
     }
 }
Пример #3
0
 public void Clear()
 {
     Arguments.Clear();
     Switches.Clear();
     ArgumentMap.Clear();
     SwitchMap.Clear();
 }
Пример #4
0
 public void TestInit()
 {
     _switches8.Clear();
     _switches16.Clear();
     _invertPwr.Off();
     _invertPwr16.Off();
 }
Пример #5
0
        /// <summary>
        /// Parses all passed arguments and fills PassedSwitches with switches and their values
        /// </summary>
        /// <param name="args">Arguments array (string)</param>
        /// <returns>Indicates whether or not parse was successful</returns>
        private bool ParseArgs(string[] args)
        {
            Switch sw = null;

            foreach (string arg in args)
            {
                switch (arg.Substring(0, 1))
                {
                case "/":
                case "-":
                    // Check for subvalues
                    Regex    re     = new Regex(":|=");
                    string[] arrArg = re.Split(arg.Substring(1).ToLower());

                    sw = PassedSwitches[arrArg[0]];
                    if (sw == null)
                    {
                        // Check if help screen is called
                        // or switch is in PossibleSwitches
                        if (arrArg[0] == "?" || arrArg[0] == "help" || !SwitchOk(arrArg[0]))
                        {
                            PassedSwitches.Clear();
                            return(false);
                        }
                        sw = new Switch(arrArg[0]);
                        PassedSwitches.Add(sw);
                    }

                    // Add values
                    for (int i = 1; i < arrArg.Length; i++)
                    {
                        sw.SwitchValues.Add(arrArg[i]);
                    }

                    break;

                default:
                    // Value of switch when seperated by space
                    if (sw != null)
                    {
                        sw.SwitchValues.Add(arg);
                        break;
                    }
                    else
                    {
                        // Switch-less value
                        sw = PassedSwitches[""];
                        if (sw == null)
                        {
                            sw = new Switch("");
                            PassedSwitches.Add(sw);
                        }
                        sw.SwitchValues.Add(arg);
                        break;
                    }
                }
            }
            return(true);
        }
 public void TestInit()
 {
     _8BitsNumber1Switches.Clear();
     _8BitsNumber2Switches.Clear();
     _turnSub8Bits.Off();
     _16BitsNumber1Switches.Clear();
     _16BitsNumber2Switches.Clear();
     _turnSub16Bits.Off();
 }
Пример #7
0
 public void TestInit()
 {
     _8BitsNumber1Switches.Clear();
     _8BitsNumber2Switches.Clear();
     _16BitsNumber1Switches.Clear();
     _16BitsNumber2Switches.Clear();
     _carryInPowerFor8Bits.Off();
     _carryInPowerFor16Bits.Off();
 }
Пример #8
0
        public void Dispose()
        {
            if (IsDisposed)
            {
                return;
            }

            IsDisposed = true;

            //Console.WriteLine("SuperGump Disposing: {0} (0x{1:X})", GetType(), Serial);

            //GC.SuppressFinalize(this);

            VitaNexCore.TryCatch(OnDispose);

            VitaNexCore.TryCatch(UnregisterInstance);

            NextButtonID    = 1;
            NextSwitchID    = 0;
            NextTextInputID = 0;

            if (InstancePoller != null)
            {
                VitaNexCore.TryCatch(InstancePoller.Dispose);

                InstancePoller = null;
            }

            VitaNexCore.TryCatch(
                () =>
            {
                Buttons.Clear();
                TileButtons.Clear();
                Switches.Clear();
                Radios.Clear();
                TextInputs.Clear();
                LimitedTextInputs.Clear();
                Entries.Clear();
                Entries.TrimExcess();
                Layout.Clear();
            });

            VitaNexCore.TryCatch(() => Linked.AsEnumerable().ForEach(Unlink));
            VitaNexCore.TryCatch(() => Children.AsEnumerable().ForEach(RemoveChild));

            IsOpen = false;
            Hidden = false;

            Parent = null;
            User   = null;

            VitaNexCore.TryCatch(OnDisposed);
        }
Пример #9
0
        public static void Set(this Switches switches, String binaryValue)
        {
            if (switches == null)
            {
                throw new ArgumentException("Switches are empty or have null object.");
            }
            if (binaryValue.Any(c => c != '1' && c != '0'))
            {
                throw new ArgumentException("Value contains invalid binaryValue (not 0 or 1)");
            }

            if (String.IsNullOrWhiteSpace(binaryValue))
            {
                switches.Clear();
            }
            else
            {
                var switchesOn = binaryValue.Select(c => (c == '1') ? true : false).Reverse().ToArray();
                switches.Set(switchesOn);
            }
        }
Пример #10
0
 public void SwitchesLoop(bool begin)
 {
     if (begin)
     {
         Switches.Clear();
         StandBy.Clear();
         PositionStandBy.Clear();
     }
     else
     {
         _switchesRequired--;
     }
     if (_switchesRequired == 0)
     {
         OnSwitchesReady();
     }
     else
     {
         BattleView.AddMessage($"You must send in {_switchesRequired} Pokémon.", messageLog: false);
         BattleView.Actions.DisplaySwitches();
     }
 }
Пример #11
0
 public void TestInit()
 {
     _switches.Clear();
 }
Пример #12
0
        public void Dispose()
        {
            if (IsDisposed)
            {
                return;
            }

            //Console.WriteLine("SuperGump Disposing: {0} (0x{1:X})", GetType(), Serial);
            //GC.SuppressFinalize(this);

            IsDisposed = true;
            IsOpen     = Hidden = false;

            VitaNexCore.TryCatch(OnDispose);
            VitaNexCore.TryCatch(UnregisterInstance);

            VitaNexCore.TryCatch(
                () =>
            {
                if (Linked != null)
                {
                    Linked.ForEachReverse(Unlink);
                    Linked.Free(true);
                }
            });

            VitaNexCore.TryCatch(
                () =>
            {
                if (Children != null)
                {
                    Children.ForEachReverse(RemoveChild);
                    Children.Free(true);
                }
            });

            VitaNexCore.TryCatch(
                () =>
            {
                if (InstancePoller != null)
                {
                    InstancePoller.Dispose();
                }
            });

            VitaNexCore.TryCatch(
                () =>
            {
                if (Entries != null)
                {
                    Entries.ForEachReverse(
                        e =>
                    {
                        if (e is IDisposable)
                        {
                            VitaNexCore.TryCatch(((IDisposable)e).Dispose);
                        }
                    });
                }
            });

            VitaNexCore.TryCatch(OnDisposed);

            VitaNexCore.TryCatch(
                () =>
            {
                if (Buttons != null)
                {
                    Buttons.Clear();
                }

                if (TileButtons != null)
                {
                    TileButtons.Clear();
                }

                if (Switches != null)
                {
                    Switches.Clear();
                }

                if (Radios != null)
                {
                    Radios.Clear();
                }

                if (TextInputs != null)
                {
                    TextInputs.Clear();
                }

                if (LimitedTextInputs != null)
                {
                    LimitedTextInputs.Clear();
                }

                if (Entries != null)
                {
                    Entries.Free(true);
                }

                if (Layout != null)
                {
                    Layout.Clear();
                }
            });

            NextButtonID    = 1;
            NextSwitchID    = 0;
            NextTextInputID = 0;

            OnActionSend        = null;
            OnActionClose       = null;
            OnActionHide        = null;
            OnActionRefresh     = null;
            OnActionDispose     = null;
            OnActionClick       = null;
            OnActionDoubleClick = null;

            LastButtonClicked = null;

            Buttons       = null;
            ButtonHandler = null;

            TileButtons       = null;
            TileButtonHandler = null;

            Switches      = null;
            SwitchHandler = null;

            Radios       = null;
            RadioHandler = null;

            TextInputs       = null;
            TextInputHandler = null;

            LimitedTextInputs       = null;
            LimitedTextInputHandler = null;

            Layout = null;

            Linked   = null;
            Children = null;

            Parent = null;
            User   = null;

            InstancePoller = null;
        }