Ejemplo n.º 1
0
    public void OnConfirm(int button)
    {
        switch ((PanelMessageBox.BUTTON)button)
        {
        case PanelMessageBox.BUTTON.YES:
        {
            var pi = CommandManager.Instance.CurrentExecuter;
            if (pi == null || !pi.CurrentActor)
            {
                string msg = $"没有选中任何部队!";
                UIManager.Instance.SystemTips(msg, PanelSystemTips.MessageType.Error);
                return;
            }
            {
                var av = pi.CurrentActor;
                if (av)
                {
                    ActorRemove output = new ActorRemove()
                    {
                        RoomId  = av.RoomId,
                        OwnerId = av.OwnerId,
                        ActorId = av.ActorId,
                    };
                    GameRoomManager.Instance.SendMsg(ROOM.ActorRemove, output.ToByteArray());
                }
            }
        }
        break;

        case PanelMessageBox.BUTTON.NO:
            break;
        }

        Stop();
    }
Ejemplo n.º 2
0
    bool AskDestroyUnit()
    {
        HexCell cell = GetCellUnderCursor();

        if (cell && cell.Unit)
        {
            HexUnit hu = cell.Unit;
            var     av = hu.gameObject.GetComponent <ActorVisualizer>();
            if (av != null)
            {
                ActorRemove output = new ActorRemove()
                {
                    RoomId  = GameRoomManager.Instance.RoomId,
                    OwnerId = GameRoomManager.Instance.CurrentPlayer.TokenId,
                    ActorId = av.ActorId,
                };
                GameRoomManager.Instance.SendMsg(ROOM.ActorRemove, output.ToByteArray());
                return(true);
            }
        }

        return(false);
    }