Exemplo n.º 1
0
 internal void ModesChanged()
 {
     if (OnModeChanged != null)
     {
         OnModeChanged.Invoke(this);
     }
 }
Exemplo n.º 2
0
    public void ChangeGameMode(int i)
    {
        switch (i)
        {
        case 1:
            OnModeChanged?.Invoke(GameMode.MainGame);
            _currentMode = GameMode.MainGame;
            _buildingStateMachine.SetWallBuildingMode(4);
            _roadBuildingPanel.SetActive(false);
            break;

        case 2:
            OnModeChanged?.Invoke(GameMode.BuildingMode);
            _roadBuildingPanel.SetActive(true);
            _currentMode = GameMode.BuildingMode;
            break;
        }
    }
Exemplo n.º 3
0
 public FilterModeSelector()
 {
     InitializeComponent();
     rb1.CheckedChanged += (sender, e) =>
     {
         if (!rb1.Checked)
         {
             return;
         }
         rb2.Checked = false;
         OnModeChanged?.Invoke();
     };
     rb2.CheckedChanged += (sender, e) =>
     {
         if (!rb2.Checked)
         {
             return;
         }
         rb1.Checked = false;
         OnModeChanged?.Invoke();
     };
 }
Exemplo n.º 4
0
        public void Write(ushort address, byte value)
        {
            if (value != Memory[address])
            {
                switch (address)
                {
                case CONTROL_ADDR:
                    value           = HandleClearScreen(value);
                    Memory[address] = value;
                    OnControlChanged?.Invoke(this, value);
                    break;

                case MODE_ADDR:
                    Memory[address] = value;
                    OnModeChanged?.Invoke(this, value);
                    break;

                default:     // Cursor
                    Memory[address] = value;
                    OnCursorMoved?.Invoke(this, new CursorPosition(Memory[CURSOR_X_ADDR], Memory[CURSOR_Y_ADDR]));
                    break;
                }
            }
        }
Exemplo n.º 5
0
 public void InvokeModeChanged(string mode)
 {
     OnModeChanged?.Invoke(mode);
 }
Exemplo n.º 6
0
        internal void SetModes(User u, string modes)
        {
            //  Parameters: <channel> {[+|-]|o|p|s|i|t|n|b|v} [<limit>] [<user>] [<ban mask>]
            Trace.WriteLine("Adding Modes: " + modes);
            try
            {
                bool plusMode = false;
                int argc = 1;
                if (modes.StartsWith("+") || modes.StartsWith("-"))
                {
                    string[] pa = modes.Split(' ');

                    for (int i = 0; i < pa[0].Length; i++)
                    {
                        char c = pa[0][i];
                        if (c == '+')
                        {
                            plusMode = true;
                        }
                        else if (c == '-')
                        {
                            plusMode = false;
                        }
                        else
                        {
                            // parse the mode
                            if (Server.ChannelModes.SymbolForMode(c.ToString()) != "")
                            {
                                // this is a user mode in PREFIX
                                // and requires an argument
                                if (argc < pa.Length)
                                {
                                    string arg = pa[argc];

                                    User ua = FindUser(arg);

                                    if (ua != null)
                                    {

                                        if (plusMode)
                                        {
                                            Trace.WriteLine("Adding Mode " + c + " to user " + ua);
                                            ua.Modes.Add(c.ToString());
                                        }
                                        else
                                        {
                                            Trace.WriteLine("Removing Mode " + c + " from user " + ua);
                                            ua.Modes.Remove(c.ToString());
                                        }
                                        ua.ModesChanged();
                                    }
                                    else
                                    {
                                        Trace.WriteLine("Couldn't find user: "******"Can't parse mode, missing expected target");
                                }
                            }
                            else
                            {
                                // channel modes!
                                if (plusMode)
                                {
                                    Modes.Add(c.ToString());
                                }
                                else
                                {
                                    if (Modes.Contains(c.ToString()))
                                    {
                                        Modes.Remove(c.ToString());
                                    }
                                    else
                                    {
                                        Trace.WriteLine("IRC/Channel/SetModes: Attempted to remove mode that chanel doesn't have: " + c);
                                    }
                                }
                            }
                        }
                    }
                }
                else
                {
                    Trace.WriteLine("IRC/Channel/Invalid Mode: " + modes);
                }
            }
            catch (Exception ex)
            {
                Trace.WriteLine("Error Setting Modes: " + ex);
            }


            if (OnModeChanged != null)
            {
                OnModeChanged.Invoke(u, modes);
            }
        }