コード例 #1
0
    public override void HandleMessage(EuiMessageBase msg)
    {
        if (msg is SpawnExplosionEuiMsg.Close)
        {
            Close();
            return;
        }

        if (msg is not SpawnExplosionEuiMsg.PreviewRequest request)
        {
            return;
        }

        if (request.TotalIntensity <= 0 || request.IntensitySlope <= 0)
        {
            return;
        }

        var explosion = EntitySystem.Get <ExplosionSystem>().GenerateExplosionPreview(request);

        if (explosion == null)
        {
            Logger.Error("Failed to generate explosion preview.");
            return;
        }

        SendMessage(new SpawnExplosionEuiMsg.PreviewData(explosion, request.IntensitySlope, request.TotalIntensity));
    }
コード例 #2
0
                public override void HandleMessage(EuiMessageBase msg)
                {
                    switch (msg)
                    {
                    case AdminAddReagentEuiMsg.Close:
                        Close();
                        break;

                    case AdminAddReagentEuiMsg.DoAdd doAdd:
                        // Double check that user wasn't de-adminned in the mean time...
                        // Or the target was deleted.
                        if (!_adminManager.HasAdminFlag(Player, ReqFlags) || _target.Deleted)
                        {
                            Close();
                            return;
                        }

                        _target.TryAddReagent(doAdd.ReagentId, doAdd.Amount, out _);
                        StateDirty();

                        if (doAdd.CloseAfter)
                        {
                            Close();
                        }

                        break;
                    }
                }
コード例 #3
0
 public override void HandleMessage(EuiMessageBase msg)
 {
     switch (msg)
     {
     case EditSolutionsEuiMsg.Close:
         Close();
         break;
     }
 }
コード例 #4
0
ファイル: BaseEui.cs プロジェクト: tmtmtl30/space-station-14
        protected void SendMessage(EuiMessageBase msg)
        {
            var netMsg = _netManager.CreateNetMessage <MsgEuiMessage>();

            netMsg.Id      = Id;
            netMsg.Message = msg;

            _netManager.ClientSendMessage(netMsg);
        }
コード例 #5
0
ファイル: BaseEui.cs プロジェクト: tmtmtl30/space-station-14
        public void SendMessage(EuiMessageBase message)
        {
            var netMgr = IoCManager.Resolve <IServerNetManager>();
            var msg    = netMgr.CreateNetMessage <MsgEuiMessage>();

            msg.Id      = Id;
            msg.Message = message;

            netMgr.ServerSendMessage(msg, Player.ConnectedClient);
        }
コード例 #6
0
        public override void ReadFromBuffer(NetIncomingMessage buffer)
        {
            Id = buffer.ReadUInt32();

            var ser    = IoCManager.Resolve <IRobustSerializer>();
            var len    = buffer.ReadVariableInt32();
            var stream = buffer.ReadAlignedMemory(len);

            Message = ser.Deserialize <EuiMessageBase>(stream);
        }
コード例 #7
0
        public override void HandleMessage(EuiMessageBase msg)
        {
            base.HandleMessage(msg);

            switch (msg)
            {
            case MakeGhostRoleWindowClosedMessage _:
                Closed();
                break;
            }
        }
コード例 #8
0
        public override void HandleMessage(EuiMessageBase msg)
        {
            base.HandleMessage(msg);

            if (msg is not AcceptCloningChoiceMessage choice ||
                choice.Button == AcceptCloningUiButton.Deny ||
                _newMob.Deleted)
            {
                Close();
                return;
            }

            Player.ContentData()?.Mind?.TransferTo(_newMob);
            Close();
        }
コード例 #9
0
        public override void HandleMessage(EuiMessageBase msg)
        {
            base.HandleMessage(msg);

            switch (msg)
            {
            case GhostRoleTakeoverRequestMessage req:
                EntitySystem.Get <GhostRoleSystem>().Takeover(Player, req.Identifier);
                break;

            case GhostRoleWindowCloseMessage _:
                Closed();
                break;
            }
        }
コード例 #10
0
        public override void HandleMessage(EuiMessageBase msg)
        {
            base.HandleMessage(msg);

            if (msg is not AcceptCloningChoiceMessage choice ||
                choice.Button == AcceptCloningUiButton.Deny ||
                !EntitySystem.TryGet <CloningSystem>(out var cloningSystem))
            {
                Close();
                return;
            }

            cloningSystem.TransferMindToClone(_mind);
            Close();
        }
コード例 #11
0
        public override void HandleMessage(EuiMessageBase msg)
        {
            switch (msg)
            {
            case AdminAddReagentEuiMsg.Close:
                Close();
                break;

            case AdminAddReagentEuiMsg.DoAdd doAdd:
                // Double check that user wasn't de-adminned in the mean time...
                // Or the target was deleted.
                if (!_adminManager.HasAdminFlag(Player, AdminFlags.Fun) || _target.Deleted)
                {
                    Close();
                    return;
                }

                var id           = doAdd.ReagentId;
                var amount       = doAdd.Amount;
                var solutionsSys = EntitySystem.Get <SolutionContainerSystem>();

                if (_target.TryGetComponent(out InjectableSolutionComponent? injectable) &&
                    solutionsSys.TryGetSolution(_target, injectable.Name, out var targetSolution))
                {
                    var solution = new Solution(id, amount);
                    solutionsSys.Inject(_target.Uid, targetSolution, solution);
                }
                else
                {
                    //TODO decide how to find the solution
                    if (solutionsSys.TryGetSolution(_target, "default", out var solution))
                    {
                        solutionsSys.TryAddReagent(_target.Uid, solution, id, amount, out _);
                    }
                }

                StateDirty();

                if (doAdd.CloseAfter)
                {
                    Close();
                }

                break;
            }
コード例 #12
0
    public override void HandleMessage(EuiMessageBase msg)
    {
        base.HandleMessage(msg);

        switch (msg)
        {
        case NewLogs {
                Replace: true
        } newLogs:
            LogsControl.SetLogs(newLogs.Logs);
            break;

        case NewLogs {
                Replace: false
        } newLogs:
            LogsControl.AddLogs(newLogs.Logs);
            break;
        }
    }
コード例 #13
0
    public override void HandleMessage(EuiMessageBase msg)
    {
        base.HandleMessage(msg);

        switch (msg)
        {
        case NewLogs newLogs:
            if (newLogs.Replace)
            {
                LogsControl.SetLogs(newLogs.Logs);
            }
            else
            {
                LogsControl.AddLogs(newLogs.Logs);
            }

            LogsControl.NextButton.Disabled = !newLogs.HasNext;
            break;
        }
    }
コード例 #14
0
            public override void HandleMessage(EuiMessageBase msg)
            {
                switch (msg)
                {
                case AdminAddReagentEuiMsg.Close:
                    Close();
                    break;

                case AdminAddReagentEuiMsg.DoAdd doAdd:
                    // Double check that user wasn't de-adminned in the mean time...
                    // Or the target was deleted.
                    if (!_adminManager.HasAdminFlag(Player, ReqFlags) || _target.Deleted)
                    {
                        Close();
                        return;
                    }

                    var id     = doAdd.ReagentId;
                    var amount = doAdd.Amount;

                    if (_target.TryGetComponent(out SolutionContainerComponent? container))
                    {
                        container.TryAddReagent(id, amount, out _);
                    }
                    else if (_target.TryGetComponent(out ISolutionInteractionsComponent? interactions))
                    {
                        var solution = new Solution(id, amount);
                        interactions.Inject(solution);
                    }

                    StateDirty();

                    if (doAdd.CloseAfter)
                    {
                        Close();
                    }

                    break;
                }
            }
コード例 #15
0
    /// <summary>
    ///     Receive explosion preview data and add a client-side explosion preview overlay
    /// </summary>
    /// <param name="msg"></param>
    public override void HandleMessage(EuiMessageBase msg)
    {
        if (msg is not SpawnExplosionEuiMsg.PreviewData data)
        {
            return;
        }

        if (_debugOverlay == null)
        {
            _debugOverlay = new();
            _overlayManager.AddOverlay(_debugOverlay);
        }

        _debugOverlay.Tiles          = data.Explosion.Tiles;
        _debugOverlay.SpaceTiles     = data.Explosion.SpaceTiles;
        _debugOverlay.Intensity      = data.Explosion.Intensity;
        _debugOverlay.Slope          = data.Slope;
        _debugOverlay.TotalIntensity = data.TotalIntensity;
        _debugOverlay.Map            = data.Explosion.Epicenter.MapId;
        _debugOverlay.SpaceMatrix    = data.Explosion.SpaceMatrix;
        _debugOverlay.SpaceTileSize  = data.Explosion.SpaceTileSize;
    }
コード例 #16
0
        public override void HandleMessage(EuiMessageBase msg)
        {
            switch (msg)
            {
            case AdminAnnounceEuiMsg.Close:
                Close();
                break;

            case AdminAnnounceEuiMsg.DoAnnounce doAnnounce:
                if (!_adminManager.HasAdminFlag(Player, AdminFlags.Admin))
                {
                    Close();
                    break;
                }

                switch (doAnnounce.AnnounceType)
                {
                case AdminAnnounceType.Server:
                    _chatManager.DispatchServerAnnouncement(doAnnounce.Announcement);
                    break;

                // TODO: Per-station announcement support
                case AdminAnnounceType.Station:
                    _chatSystem.DispatchGlobalAnnouncement(doAnnounce.Announcement, doAnnounce.Announcer, colorOverride: Color.Gold);
                    break;
                }

                StateDirty();

                if (doAnnounce.CloseAfter)
                {
                    Close();
                }

                break;
            }
        }
コード例 #17
0
        public override void HandleMessage(EuiMessageBase msg)
        {
            switch (msg)
            {
            case AdminAnnounceEuiMsg.Close:
                Close();
                break;

            case AdminAnnounceEuiMsg.DoAnnounce doAnnounce:
                if (!_adminManager.HasAdminFlag(Player, AdminFlags.Admin))
                {
                    Close();
                    break;
                }

                switch (doAnnounce.AnnounceType)
                {
                case AdminAnnounceType.Server:
                    _chatManager.DispatchServerAnnouncement(doAnnounce.Announcement);
                    break;

                case AdminAnnounceType.Station:
                    _chatManager.DispatchStationAnnouncement(doAnnounce.Announcement, doAnnounce.Announcer);
                    break;
                }

                StateDirty();

                if (doAnnounce.CloseAfter)
                {
                    Close();
                }

                break;
            }
        }
コード例 #18
0
ファイル: BaseEui.cs プロジェクト: tmtmtl30/space-station-14
 public virtual void HandleMessage(EuiMessageBase msg)
 {
 }