Example #1
0
        // Function from file: subsystem.dm
        public int close_user_uis(Mob user = null, Wires src_object = null, string ui_key = null)
        {
            int  close_count = 0;
            Tgui ui          = null;


            if (user.open_uis == null || !(user.open_uis is ByTable) || this.open_uis.len == 0)
            {
                return(0);
            }
            close_count = 0;

            foreach (dynamic _a in Lang13.Enumerate(user.open_uis, typeof(Tgui)))
            {
                ui = _a;


                if ((src_object == null || !(src_object == null) && ui.src_object == src_object) && (ui_key == null || !(ui_key == null) && ui.ui_key == ui_key))
                {
                    ui.close();
                    close_count++;
                }
            }
            return(close_count);
        }
Example #2
0
        // Function from file: subsystem.dm
        public int close_uis(Obj src_object = null)
        {
            string  src_object_key = null;
            int     close_count    = 0;
            dynamic ui_key         = null;
            Tgui    ui             = null;

            src_object_key = new Txt().Ref(src_object).ToString();

            if (this.open_uis[src_object_key] == null || !(this.open_uis[src_object_key] is ByTable))
            {
                return(0);
            }
            close_count = 0;

            foreach (dynamic _b in Lang13.Enumerate(this.open_uis[src_object_key]))
            {
                ui_key = _b;


                foreach (dynamic _a in Lang13.Enumerate(this.open_uis[src_object_key][ui_key], typeof(Tgui)))
                {
                    ui = _a;


                    if (ui != null && ui.src_object != null && Lang13.Bool(ui.user) && ui.src_object.ui_host() != null)
                    {
                        ui.close();
                        close_count++;
                    }
                }
            }
            return(close_count);
        }
Example #3
0
        // Function from file: tgui.dm
        public void close(  )
        {
            Tgui child = null;

            Interface13.Browse(this.user, null, "window=" + this.window_id);
            GlobalVars.SStgui.on_close(this);

            foreach (dynamic _a in Lang13.Enumerate(this.children, typeof(Tgui)))
            {
                child = _a;

                child.close();
            }
            this.children.Cut();
            this.state     = null;
            this.master_ui = null;
            GlobalFuncs.qdel(this);
            return;
        }
Example #4
0
        // Function from file: radio.dm
        public override int?ui_act(string action = null, ByTable _params = null, Tgui ui = null, UiState state = null)
        {
            int?_default = null;

            dynamic tune    = null;
            double? adjust  = null;
            string  min     = null;
            string  max     = null;
            dynamic channel = null;


            if (Lang13.Bool(base.ui_act(action, _params, ui, state)))
            {
                return(_default);
            }

            switch ((string)(action))
            {
            case "frequency":

                if (this.freqlock)
                {
                    return(_default);
                }
                tune   = _params["tune"];
                adjust = String13.ParseNumber(_params["adjust"]);

                if (tune == "input")
                {
                    min  = GlobalFuncs.format_frequency((Lang13.Bool(this.freerange) ? 1201 : 1441));
                    max  = GlobalFuncs.format_frequency((Lang13.Bool(this.freerange) ? 1599 : 1489));
                    tune = Interface13.Input("Tune frequency (" + min + "-" + max + "):", this.name, GlobalFuncs.format_frequency(this.frequency), null, null, InputType.Num | InputType.Null);

                    if (!(tune == null) && !Lang13.Bool(base.ui_act(action, _params, ui, state)))
                    {
                        _default = GlobalVars.TRUE;
                    }
                }
                else if (Lang13.Bool(adjust))
                {
                    tune     = (this.frequency ?? 0) + (adjust ?? 0) * 10;
                    _default = GlobalVars.TRUE;
                }
                else if (String13.ParseNumber(tune) != null)
                {
                    tune     = tune * 10;
                    _default = GlobalVars.TRUE;
                }

                if (Lang13.Bool(_default))
                {
                    this.frequency = GlobalFuncs.sanitize_frequency(tune, this.freerange);
                    this.set_frequency(this.frequency);

                    if (this.frequency == this.traitor_frequency && this.hidden_uplink != null)
                    {
                        this.hidden_uplink.interact(Task13.User);
                        ui.close();
                    }
                }
                break;

            case "listen":
                this.listening = !this.listening;
                _default       = GlobalVars.TRUE;
                break;

            case "broadcast":
                this.broadcasting = !this.broadcasting;
                _default          = GlobalVars.TRUE;
                break;

            case "channel":
                channel = _params["channel"];

                if (!this.channels.Contains(channel))
                {
                    return(_default);
                }

                if (Lang13.Bool(this.channels[channel] & 1))
                {
                    this.channels[channel] &= 65534;
                }
                else
                {
                    this.channels[channel] |= GlobalVars.FREQ_LISTENING;
                }
                _default = GlobalVars.TRUE;
                break;

            case "command":
                this.use_command = !this.use_command;
                _default         = GlobalVars.TRUE;
                break;

            case "subspace":

                if (this.subspace_switchable)
                {
                    this.subspace_transmission = !this.subspace_transmission;

                    if (!this.subspace_transmission)
                    {
                        this.channels = new ByTable();
                    }
                    else
                    {
                        this.recalculateChannels();
                    }
                    _default = GlobalVars.TRUE;
                }
                break;
            }
            return(_default);
        }