//Functionality to Set Room Reservation

        protected void gvtwo_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            switch (((Button)e.CommandSource).CommandName)
            {
            case "Reserve":

                String s = e.CommandArgument.ToString();
                int    RoomID;
                int.TryParse(s, out RoomID);

                QMRServiceReference.qmrserviceSoapClient client = new QMRServiceReference.qmrserviceSoapClient();

                client.ReserveRoom(RoomID, true);


                gvtwo.DataSource = client.GetListRooms();
                gvtwo.DataBind();


                Label1.Text = RoomID.ToString();
                break;

            default:

                break;
            }
        }
示例#2
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (RoomID != 0)
            {
                hash ^= RoomID.GetHashCode();
            }
            if (Type != global::AiTankArenaServer.PlayerType.Warrior)
            {
                hash ^= Type.GetHashCode();
            }
            if (MyPlayerName.Length != 0)
            {
                hash ^= MyPlayerName.GetHashCode();
            }
            if (SpawnPointID != 0)
            {
                hash ^= SpawnPointID.GetHashCode();
            }
            hash ^= weapons_.GetHashCode();
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
示例#3
0
        public List <HotelOrderModel> List()
        {
            var Today = DateTime.Now;
            var model = new List <HotelOrderModel>();

            using (var db = new MyAnythingEntities()){
                model = (from order in db.OrderMaster
                         join room in db.Room on order.ProductId equals room.ID
                         join pay in db.PayGo on order.MerchantOrderNo equals pay.MerchantOrderNo into paygo
                         from x in paygo.DefaultIfEmpty()
                         where RoomID.Contains(room.ID) &&
                         (string.IsNullOrEmpty(SearchKey) ||
                          (order.Name.Contains(SearchKey) || order.Tel.Contains(SearchKey) || order.MerchantOrderNo.Contains(SearchKey)))
                         select new HotelOrderModel
                {
                    CheckInDate = order.CheckIn,
                    CheckOutDate = order.CheckOut,
                    ID = order.ID,
                    MerchantOrderNo = order.MerchantOrderNo,
                    OrderTel = order.Tel,
                    OrderName = order.Name,
                    PaymentType = order.PaymentType,
                    PayStatus = (order.ExpireDate != null && order.Status == OrderType.Unpaid.ToString() && DateTime.Compare(order.ExpireDate.Value, Today) < 0)? "超過繳款期限" :
                                (order.Status == OrderType.Paid.ToString() ? "付款完成" : (order.Status == OrderType.Expired.ToString() ? "超過繳款期限" : "未付款")),
                    RoomName = order.ProductName,
                    Created = order.Created,
                    Quantity = order.Quantity,
                    Amt = order.PayAmt,
                    Bonus = order.BonusAmt,
                    OrderAmt = order.Amount
                }).ToList();
            }
            return(model);
        }
示例#4
0
        protected override void LoadComplete()
        {
            base.LoadComplete();

            if (RoomID.Value == null)
            {
                statusElements.ForEach(e => e.FadeOut());
            }

            RoomID.BindValueChanged(id =>
            {
                if (id.NewValue == null)
                {
                    statusElements.ForEach(e => e.FadeOut(100));
                }
                else
                {
                    statusElements.ForEach(e => e.FadeIn(100));
                }
            }, true);

            RoomName.BindValueChanged(name =>
            {
                roomName.Text = name.NewValue ?? "No room selected";
            }, true);
        }
示例#5
0
    public override int GetHashCode()
    {
        int hash = 1;

        if (UserID != 0)
        {
            hash ^= UserID.GetHashCode();
        }
        if (GameID != 0)
        {
            hash ^= GameID.GetHashCode();
        }
        if (RoomID != 0UL)
        {
            hash ^= RoomID.GetHashCode();
        }
        if (Flag != 0)
        {
            hash ^= Flag.GetHashCode();
        }
        hash ^= dstUids_.GetHashCode();
        if (CpProto.Length != 0)
        {
            hash ^= CpProto.GetHashCode();
        }
        return(hash);
    }
示例#6
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (RoomID != 0UL)
            {
                hash ^= RoomID.GetHashCode();
            }
            if (StartTS != 0UL)
            {
                hash ^= StartTS.GetHashCode();
            }
            if (DelayMS != 0)
            {
                hash ^= DelayMS.GetHashCode();
            }
            if (CacheMS != 0)
            {
                hash ^= CacheMS.GetHashCode();
            }
            if (MaxAudiences != 0)
            {
                hash ^= MaxAudiences.GetHashCode();
            }
            if (CurAudiences != 0)
            {
                hash ^= CurAudiences.GetHashCode();
            }
            if (PeakAudiences != 0)
            {
                hash ^= PeakAudiences.GetHashCode();
            }
            hash ^= lastAudiences_.GetHashCode();
            return(hash);
        }
示例#7
0
 void OnTriggerEnter(Collider other)
 {
     if (other.gameObject.isStatic)
     {
         currRoom    = other.gameObject.GetComponent <RoomID> ();
         currRoomNum = currRoom.roomID;
         Debug.Log("Entered room: " + currRoomNum);
     }
 }
示例#8
0
        public void OpenConnection(Direction direction, RoomID toRoom)
        {
            if (!IsInitialized)
            {
                throw new InvalidOperationException(EngineNotInitialized);
            }

            if (!this.player !.CurrentRoom.Connections.ContainsKey(direction))
            {
                this.player !.CurrentRoom.Connections[direction] = this.rooms ![toRoom];
示例#9
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (RoomID != 0)
            {
                hash ^= RoomID.GetHashCode();
            }
            hash ^= rankUsers_.GetHashCode();
            return(hash);
        }
示例#10
0
 /// <summary>
 /// Finds the room object from a room ID
 /// </summary>
 /// <param name="aID">Room ID</param>
 /// <returns>Room object</returns>
 private static Room GetRoomFromID(RoomID aID)
 {
     foreach (Room lRoom in _ListRooms)
     {
         if (lRoom.Id == aID.ID)
         {
             return(lRoom);
         }
     }
     return(null);
 }
示例#11
0
 /// <summary>
 /// room can be comapred with another room or with integer
 /// </summary>
 public int CompareTo(object obj)
 {
     if (obj is Room)
     {
         return(RoomID.CompareTo(((Room)(obj)).RoomID));
     }
     else if (obj is int)
     {
         return(RoomID.CompareTo(obj));
     }
     else
     {
         throw new ArgumentException("obj must be \"Room\"");
     }
 }
示例#12
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (RoomID != 0)
            {
                hash ^= RoomID.GetHashCode();
            }
            hash ^= playerTokens_.GetHashCode();
            if (RoomName.Length != 0)
            {
                hash ^= RoomName.GetHashCode();
            }
            return(hash);
        }
示例#13
0
        /// <summary>
        /// Connects a client to a room as the second player.
        /// </summary>
        /// <param name="aOperationData">Json string for room ID</param>
        /// <param name="aClient">Client to connect as second player</param>
        private static void ConnectToRoomAsSecondPlayer(string aOperationData, TcpServerClient aClient)
        {
            RoomID ID = new RoomID(); //DataProcessor.DeserializeRoomID(aOperationData);

            ID.ID = aOperationData;

            GetRoomFromID(ID).AddSecondPlayer(aClient);

            Thread.Sleep(5);

            if (GetRoomFromID(ID).Status == Room.RoomState.PLAYING)
            {
                SendData(aClient, MESSAGE_CONFIRMED);
            }
            else
            {
                SendData(aClient, MESSAGE_ERROR);
            }
        }
示例#14
0
 public void Clear()
 {
     MapID = 0;
     if (Pos != null)
     {
         Pos.Clear();
     }
     if (Rotation != null)
     {
         Rotation.Clear();
     }
     PosType = 0;
     NodeID  = 0;
     if (RoomID != null)
     {
         RoomID.Clear();
     }
     DynamicEnterType = 0;
 }
示例#15
0
    public override int GetHashCode()
    {
        int hash = 1;

        if (PushType != 0)
        {
            hash ^= PushType.GetHashCode();
        }
        if (GameID != 0)
        {
            hash ^= GameID.GetHashCode();
        }
        if (RoomID != 0UL)
        {
            hash ^= RoomID.GetHashCode();
        }
        hash ^= dstUids_.GetHashCode();
        if (CpProto.Length != 0)
        {
            hash ^= CpProto.GetHashCode();
        }
        return(hash);
    }
        public async void Message(IPlayer player, string message)
        {
            if (player == null)
            {
                throw new ArgumentNullException(nameof(player));
            }
            if (string.IsNullOrEmpty(message))
            {
                return;
            }
            var args = new object[2];

            args[0] = message;
            args[1] = player.Name;
            string action;

            if (RoomID.Contains("LOBBYCHAT"))
            {
                action = "MSG|LOBBY";
            }
            else
            {
                action = "MSG|TABLE";
            }

            //Loop all players and tell a player left
            foreach (var roomPlayer in Players)
            {
                var encoded =
                    Encoding.UTF8.GetBytes(
                        JsonConvert.SerializeObject(new RoomMessage(player.PlayerId, action, args)));
                var buffers = new ArraySegment <Byte>(encoded, 0, encoded.Length);
                await roomPlayer.Socket.SendAsync(buffers, WebSocketMessageType.Text, true,
                                                  CancellationToken.None)
                .ConfigureAwait(false);
            }
        }
示例#17
0
 private GreenCrystal(AnimateID id, RoomID startRoom) : base(id, startRoom)
 {
 }
示例#18
0
 private void load()
 {
     RoomID.BindValueChanged(_ => updateParticipants(), true);
 }
示例#19
0
        private void load(OsuColour colours)
        {
            InternalChildren = new Drawable[]
            {
                new Box
                {
                    RelativeSizeAxes = Axes.Both,
                    Colour           = OsuColour.FromHex(@"343138"),
                },
                new GridContainer
                {
                    RelativeSizeAxes = Axes.Both,
                    RowDimensions    = new[]
                    {
                        new Dimension(GridSizeMode.AutoSize),
                        new Dimension(GridSizeMode.Distributed),
                    },
                    Content = new[]
                    {
                        new Drawable[]
                        {
                            new FillFlowContainer
                            {
                                RelativeSizeAxes = Axes.X,
                                AutoSizeAxes     = Axes.Y,
                                Direction        = FillDirection.Vertical,
                                Children         = new Drawable[]
                                {
                                    new Container
                                    {
                                        RelativeSizeAxes = Axes.X,
                                        Height           = 200,
                                        Masking          = true,
                                        Children         = new Drawable[]
                                        {
                                            new MultiplayerBackgroundSprite {
                                                RelativeSizeAxes = Axes.Both
                                            },
                                            new Box
                                            {
                                                RelativeSizeAxes = Axes.Both,
                                                Colour           = ColourInfo.GradientVertical(Color4.Black.Opacity(0.5f), Color4.Black.Opacity(0)),
                                            },
                                            new Container
                                            {
                                                RelativeSizeAxes = Axes.Both,
                                                Padding          = new MarginPadding(20),
                                                Children         = new Drawable[]
                                                {
                                                    participantCount = new ParticipantCountDisplay
                                                    {
                                                        Anchor = Anchor.TopRight,
                                                        Origin = Anchor.TopRight,
                                                    },
                                                    name = new OsuSpriteText
                                                    {
                                                        Anchor  = Anchor.BottomLeft,
                                                        Origin  = Anchor.BottomLeft,
                                                        Font    = OsuFont.GetFont(size: 30),
                                                        Current = RoomName
                                                    },
                                                },
                                            },
                                        },
                                    },
                                    new StatusColouredContainer(transition_duration)
                                    {
                                        RelativeSizeAxes = Axes.X,
                                        Height           = 5,
                                        Child            = new Box {
                                            RelativeSizeAxes = Axes.Both
                                        }
                                    },
                                    new Container
                                    {
                                        RelativeSizeAxes = Axes.X,
                                        AutoSizeAxes     = Axes.Y,
                                        Children         = new Drawable[]
                                        {
                                            new Box
                                            {
                                                RelativeSizeAxes = Axes.Both,
                                                Colour           = OsuColour.FromHex(@"28242d"),
                                            },
                                            new FillFlowContainer
                                            {
                                                RelativeSizeAxes = Axes.X,
                                                AutoSizeAxes     = Axes.Y,
                                                Direction        = FillDirection.Vertical,
                                                LayoutDuration   = transition_duration,
                                                Padding          = contentPadding,
                                                Spacing          = new Vector2(0f, 5f),
                                                Children         = new Drawable[]
                                                {
                                                    new StatusColouredContainer(transition_duration)
                                                    {
                                                        AutoSizeAxes = Axes.Both,
                                                        Child        = new StatusText
                                                        {
                                                            Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 14),
                                                        }
                                                    },
                                                    beatmapTypeInfo = new BeatmapTypeInfo(),
                                                },
                                            },
                                        },
                                    },
                                    new Container
                                    {
                                        RelativeSizeAxes = Axes.X,
                                        AutoSizeAxes     = Axes.Y,
                                        Padding          = contentPadding,
                                        Children         = new Drawable[]
                                        {
                                            participantInfo = new ParticipantInfo(),
                                        },
                                    },
                                },
                            },
                        },
                        new Drawable[]
                        {
                            new MatchParticipants
                            {
                                RelativeSizeAxes = Axes.Both,
                            }
                        }
                    }
                }
            };

            Status.BindValueChanged(_ => updateStatus(), true);
            RoomID.BindValueChanged(_ => updateStatus(), true);
        }
            private void load(OsuColour colours)
            {
                InternalChildren = new Drawable[]
                {
                    new Box
                    {
                        RelativeSizeAxes = Axes.Both,
                        Colour           = Color4Extensions.FromHex(@"28242d"),
                    },
                    new GridContainer
                    {
                        RelativeSizeAxes = Axes.Both,
                        RowDimensions    = new[]
                        {
                            new Dimension(),
                            new Dimension(GridSizeMode.AutoSize),
                        },
                        Content = new[]
                        {
                            new Drawable[]
                            {
                                new OsuScrollContainer
                                {
                                    Padding = new MarginPadding
                                    {
                                        Horizontal = OsuScreen.HORIZONTAL_OVERFLOW_PADDING,
                                        Vertical   = 10
                                    },
                                    RelativeSizeAxes = Axes.Both,
                                    Children         = new[]
                                    {
                                        new FillFlowContainer
                                        {
                                            RelativeSizeAxes = Axes.X,
                                            AutoSizeAxes     = Axes.Y,
                                            Direction        = FillDirection.Vertical,
                                            Spacing          = new Vector2(0, 10),
                                            Children         = new Drawable[]
                                            {
                                                new Container
                                                {
                                                    Anchor  = Anchor.TopCentre,
                                                    Origin  = Anchor.TopCentre,
                                                    Padding = new MarginPadding {
                                                        Horizontal = WaveOverlayContainer.WIDTH_PADDING
                                                    },
                                                    RelativeSizeAxes = Axes.X,
                                                    AutoSizeAxes     = Axes.Y,
                                                    Children         = new Drawable[]
                                                    {
                                                        new SectionContainer
                                                        {
                                                            Padding = new MarginPadding {
                                                                Right = FIELD_PADDING / 2
                                                            },
                                                            Children = new[]
                                                            {
                                                                new Section("Room name")
                                                                {
                                                                    Child = NameField = new SettingsTextBox
                                                                    {
                                                                        RelativeSizeAxes         = Axes.X,
                                                                        TabbableContentContainer = this,
                                                                    },
                                                                },
                                                                new Section("Room visibility")
                                                                {
                                                                    Alpha = disabled_alpha,
                                                                    Child = AvailabilityPicker = new RoomAvailabilityPicker
                                                                    {
                                                                        Enabled = { Value = false }
                                                                    },
                                                                },
                                                                new Section("Game type")
                                                                {
                                                                    Child = new FillFlowContainer
                                                                    {
                                                                        AutoSizeAxes     = Axes.Y,
                                                                        RelativeSizeAxes = Axes.X,
                                                                        Direction        = FillDirection.Vertical,
                                                                        Spacing          = new Vector2(7),
                                                                        Children         = new Drawable[]
                                                                        {
                                                                            TypePicker = new MatchTypePicker
                                                                            {
                                                                                RelativeSizeAxes = Axes.X,
                                                                            },
                                                                            typeLabel = new OsuSpriteText
                                                                            {
                                                                                Font   = OsuFont.GetFont(size: 14),
                                                                                Colour = colours.Yellow
                                                                            },
                                                                        },
                                                                    },
                                                                },
                                                            },
                                                        },
                                                        new SectionContainer
                                                        {
                                                            Anchor  = Anchor.TopRight,
                                                            Origin  = Anchor.TopRight,
                                                            Padding = new MarginPadding {
                                                                Left = FIELD_PADDING / 2
                                                            },
                                                            Children = new[]
                                                            {
                                                                new Section("Max participants")
                                                                {
                                                                    Alpha = disabled_alpha,
                                                                    Child = MaxParticipantsField = new SettingsNumberTextBox
                                                                    {
                                                                        RelativeSizeAxes         = Axes.X,
                                                                        TabbableContentContainer = this,
                                                                        ReadOnly = true,
                                                                    },
                                                                },
                                                                new Section("Password (optional)")
                                                                {
                                                                    Child = PasswordTextBox = new SettingsPasswordTextBox
                                                                    {
                                                                        RelativeSizeAxes         = Axes.X,
                                                                        TabbableContentContainer = this,
                                                                    },
                                                                },
                                                            }
                                                        }
                                                    },
                                                },
                                                initialBeatmapControl = new BeatmapSelectionControl
                                                {
                                                    Anchor           = Anchor.TopCentre,
                                                    Origin           = Anchor.TopCentre,
                                                    RelativeSizeAxes = Axes.X,
                                                    Width            = 0.5f
                                                }
                                            }
                                        }
                                    },
                                },
                            },
                            new Drawable[]
                            {
                                new Container
                                {
                                    Anchor           = Anchor.BottomLeft,
                                    Origin           = Anchor.BottomLeft,
                                    Y                = 2,
                                    RelativeSizeAxes = Axes.X,
                                    AutoSizeAxes     = Axes.Y,
                                    Children         = new Drawable[]
                                    {
                                        new Box
                                        {
                                            RelativeSizeAxes = Axes.Both,
                                            Colour           = Color4Extensions.FromHex(@"28242d").Darken(0.5f).Opacity(1f),
                                        },
                                        new FillFlowContainer
                                        {
                                            RelativeSizeAxes = Axes.X,
                                            AutoSizeAxes     = Axes.Y,
                                            Direction        = FillDirection.Vertical,
                                            Spacing          = new Vector2(0, 20),
                                            Margin           = new MarginPadding {
                                                Vertical = 20
                                            },
                                            Padding = new MarginPadding {
                                                Horizontal = OsuScreen.HORIZONTAL_OVERFLOW_PADDING
                                            },
                                            Children = new Drawable[]
                                            {
                                                ApplyButton = new CreateOrUpdateButton
                                                {
                                                    Anchor  = Anchor.BottomCentre,
                                                    Origin  = Anchor.BottomCentre,
                                                    Size    = new Vector2(230, 55),
                                                    Enabled = { Value = false },
                                                    Action  = apply,
                                                },
                                                ErrorText = new OsuSpriteText
                                                {
                                                    Anchor = Anchor.BottomCentre,
                                                    Origin = Anchor.BottomCentre,
                                                    Alpha  = 0,
                                                    Depth  = 1,
                                                    Colour = colours.RedDark
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    loadingLayer = new LoadingLayer(true)
                };

                TypePicker.Current.BindValueChanged(type => typeLabel.Text = type.NewValue.GetLocalisableDescription(), true);
                RoomName.BindValueChanged(name => NameField.Text           = name.NewValue, true);
                Availability.BindValueChanged(availability => AvailabilityPicker.Current.Value = availability.NewValue, true);
                Type.BindValueChanged(type => TypePicker.Current.Value = type.NewValue, true);
                MaxParticipants.BindValueChanged(count => MaxParticipantsField.Text = count.NewValue?.ToString(), true);
                RoomID.BindValueChanged(roomId => initialBeatmapControl.Alpha       = roomId.NewValue == null ? 1 : 0, true);
                Password.BindValueChanged(password => PasswordTextBox.Text          = password.NewValue ?? string.Empty, true);

                operationInProgress.BindTo(ongoingOperationTracker.InProgress);
                operationInProgress.BindValueChanged(v =>
                {
                    if (v.NewValue)
                    {
                        loadingLayer.Show();
                    }
                    else
                    {
                        loadingLayer.Hide();
                    }
                });
            }
示例#21
0
 private Lava(AnimateID id, RoomID startRoom) : base(id, startRoom)
 {
 }
示例#22
0
 private HellHound(AnimateID id, RoomID startRoom, int strikeCount) : base(id, startRoom, strikeCount)
 {
 }
示例#23
0
文件: Game.cs 项目: nyteshade/FTLEdit
        public void Update()
        {
            Vector2i mouseScreenPos = Mouse.GetPosition(Program.app);
            Vector2i mouseActualPos = Mouse.GetPosition(Program.app) - new Vector2i((int)Game.ship.LayoutData.X_OFFSET * 35, (int)Game.ship.LayoutData.Y_OFFSET * 35);

            switch (cursorMode)
            {
                case CursorMode.None:
                    if (Mouse.IsButtonPressed(Mouse.Button.Left) && lastLMBState == false)
                    {
                        // Single click somewhere!
                        if (Mouse.GetPosition(Program.app).X >= GUIStartX)
                        {
                            GUIClick(mouseScreenPos);

                        }

                        else
                        {
                            // Single click on the screen!
                            bool clickedADoor = false;
                            foreach (FTLDoor tempDoor in ShipDoors)
                            {
                                if (tempDoor.WasClicked(new Vector2f(mouseActualPos.X, mouseActualPos.Y)))
                                {
                                    clickedADoor = true;
                                    selectedDoor = tempDoor;
                                    cursorMode = CursorMode.DoorSelected;
                                    selectedDoor.selected = true;
                                    break;

                                }
                            }

                            if (clickedADoor == false)
                            {
                                bool clickedARoom = false;
                                foreach (FTLRoom tempRoom in ShipRooms)
                                {

                                    if (tempRoom.WasClicked(new Vector2f(mouseActualPos.X, mouseActualPos.Y)))
                                    {
                                        selectedRoom = tempRoom;
                                        cursorMode = CursorMode.RoomSelected;
                                        selectedRoom.selected = true;
                                        clickedARoom = true;
                                        break;

                                    }
                                }
                                if (clickedARoom == false)
                                {
                                    if (selectedRoom != null)
                                    {
                                        selectedRoom.selected = false;
                                        selectedRoom = null;
                                        cursorMode = CursorMode.None;
                                    }
                                }
                            }
                        }

                    }
                    break;
                case CursorMode.RoomSelected:
                    if (Mouse.IsButtonPressed(Mouse.Button.Right))
                    {
                        // Work out which tile we clicked

                        Vector2i tileClicked = new Vector2i((mouseActualPos.X / 35), (mouseActualPos.Y / 35));
                        Vector2i diff = tileClicked - selectedRoom.position + new Vector2i(1, 1);
                        if (diff.X > 0 && diff.Y > 0)
                        {
                            selectedRoom.size += diff - selectedRoom.size;
                        }
                        else
                        {
                            if (diff.X < 0)
                            {
                                selectedRoom.position.X += diff.X;
                                selectedRoom.size.X -= diff.X;
                            }
                            if (diff.Y < 0)
                            {
                                selectedRoom.position.Y += diff.Y;
                                selectedRoom.size.Y -= diff.Y;
                            }
                        }

                    }

                    if (lastLMBState == true && Mouse.IsButtonPressed(Mouse.Button.Left))
                    {
                        selectedRoom.position = new Vector2i((mouseActualPos.X / 35), (mouseActualPos.Y / 35));

                    }
                    else if (lastLMBState == false && Mouse.IsButtonPressed(Mouse.Button.Left))
                    {
                        // Somewhere was clicked whilst a room was selected

                        // Did we click the current room?
                        if (selectedRoom.WasClicked(new Vector2f(mouseActualPos.X, mouseActualPos.Y)))
                        {
                            cursorMode = CursorMode.RoomSelected;
                        }
                        else
                        {

                            selectedRoom.selected = false;
                            selectedRoom = null;
                            cursorMode = CursorMode.None;
                        }

                    }
                    break;
                case CursorMode.DoorSelected:
                    if (lastLMBState == true && Mouse.IsButtonPressed(Mouse.Button.Left))
                    {
                        selectedDoor.position = new Vector2i(mouseActualPos.X / 35, mouseActualPos.Y / 35);

                    }
                    else if (lastLMBState == false && Mouse.IsButtonPressed(Mouse.Button.Left))
                    {
                        // Somewhere was clicked whilst a room was selected

                        // Did we click the current room?
                        if (selectedDoor.WasClicked(new Vector2f(mouseActualPos.X, mouseActualPos.Y)))
                        {
                            cursorMode = CursorMode.DoorSelected;
                        }
                        else
                        {

                            selectedDoor.selected = false;
                            selectedDoor = null;
                            cursorMode = CursorMode.None;
                        }

                    }
                    break;
                case CursorMode.AddRoom:
                    if (Mouse.IsButtonPressed(Mouse.Button.Left) && lastLMBState == false)
                    {
                        cursorMode = CursorMode.None;
                        FTLRoom newRoom = new FTLRoom(new Vector2i(mouseActualPos.X / 35, mouseActualPos.Y / 35), new Vector2i(1, 1));
                        ShipRooms.Add(newRoom);
                        newRoom.selected = true;
                        if (selectedRoom != null)
                            selectedRoom.selected = false;
                        selectedRoom = newRoom;
                        cursorMode = CursorMode.RoomSelected;

                        if (Mouse.IsButtonPressed(Mouse.Button.Right))
                        {
                            if (selectedRoom != null)
                                selectedRoom.selected = false;
                            selectedRoom = null;
                            cursorMode = CursorMode.None;
                        }
                    }
                    break;
                case CursorMode.AddDoor:

                    if (Mouse.IsButtonPressed(Mouse.Button.Left) && lastLMBState == false)
                    {
                        cursorMode = CursorMode.None;
                        FTLDoor newDoor = new FTLDoor(new Vector2i(mouseActualPos.X / 35, mouseActualPos.Y / 35), DoorHorizontal);
                        ShipDoors.Add(newDoor);
                    }

                    if (Mouse.IsButtonPressed(Mouse.Button.Right))
                    {
                        cursorMode = CursorMode.None;
                    }
                    break;
                case CursorMode.PlacingRoomFunc:

                    if (setRoom == RoomID.None || Mouse.IsButtonPressed(Mouse.Button.Right))
                    {
                        cursorMode = CursorMode.None;
                        break;
                    }
                    if (Mouse.IsButtonPressed(Mouse.Button.Left) && lastLMBState == false)
                    {
                        foreach (FTLRoom tempRoom in ShipRooms)
                        {

                            if (tempRoom.WasClicked(new Vector2f(mouseActualPos.X, mouseActualPos.Y)))
                            {
                                // Are we placing a room?
                                if (setRoom != RoomID.None)
                                {
                                    ship.rooms[Enum.GetName(typeof(RoomID), setRoom)].location = tempRoom;
                                    setRoom = RoomID.None;
                                    break;
                                }
                            }
                        }
                    }
                    break;
                case CursorMode.PlaceBGCursor:
                    bgOffset = new Vector2f((int)mouseScreenPos.X - Game.ship.LayoutData.X_OFFSET * 35, (int)mouseScreenPos.Y - Game.ship.LayoutData.Y_OFFSET * 35);
                    bgOffset -= new Vector2f(BaseTex.TextureRect.Width / 2, BaseTex.TextureRect.Height / 2);
                    if (Mouse.IsButtonPressed(Mouse.Button.Left) && lastLMBState == false)
                    {
                        cursorMode = CursorMode.PlacedBGCursor;
                    }
                    break;
                case CursorMode.PlacedBGCursor:
                    if (Mouse.IsButtonPressed(Mouse.Button.Left) && lastLMBState == false)
                    {
                        cursorMode = CursorMode.None;
                    }
                    if (Keyboard.IsKeyPressed(Keyboard.Key.Return))
                    {
                        cursorMode = CursorMode.None;
                    }
                    break;
                default:
                    break;
            }

            lastLMBState = Mouse.IsButtonPressed(Mouse.Button.Left);
        }
示例#24
0
 private Swelling(AnimateID id, RoomID startRoom) : base(id, startRoom)
 {
 }
示例#25
0
 private Vacuum(AnimateID id, RoomID startRoom) : base(id, startRoom)
 {
 }
示例#26
0
 private Swamp(AnimateID id, RoomID startRoom) : base(id, startRoom)
 {
 }
示例#27
0
文件: Game.cs 项目: nyteshade/FTLEdit
        public void GUIClick(Vector2i mouseScreenPos)
        {
            // Single click on the GUI!
            if (btnAddRoom.WasClicked(mouseScreenPos))
            {
                cursorMode = CursorMode.AddRoom;
            }
            if (btnAddDoor.WasClicked(mouseScreenPos))
            {
                cursorMode = CursorMode.AddDoor;
            }

            if (btnLoadBase.WasClicked(mouseScreenPos))
            {

                OpenFileDialog openTexDia = new OpenFileDialog();

                openTexDia.DefaultExt = ".png";
                openTexDia.Filter = "Base texture png (*.png)|*.png|All files|*.*";
                openTexDia.ShowDialog();
                if (openTexDia.FileName != "")
                {
                    BaseTex = new Sprite(new Texture(openTexDia.FileName));
                    bgSize = new Vector2f(BaseTex.TextureRect.Width, BaseTex.TextureRect.Height);
                    drawBase = true;
                }
                openTexDia.Dispose();

            }
            if (btnOptions.WasClicked(mouseScreenPos))
                optWnd.Show();
            if (btnLoadFloor.WasClicked(mouseScreenPos))
            {

                OpenFileDialog openTexDia = new OpenFileDialog();

                openTexDia.DefaultExt = ".png";
                openTexDia.Filter = "Base texture png (*.png)|*.png|All files|*.*";
                openTexDia.ShowDialog();
                if (openTexDia.FileName != "")
                {
                    FloorTex = new Sprite(new Texture(openTexDia.FileName));
                    drawFloor = true;
                }
                openTexDia.Dispose();
            }

            if (FloorTex != null || BaseTex != null)
                if (btnMoveBG.WasClicked(mouseScreenPos))
                {
                    if (cursorMode == CursorMode.PlacedBGCursor || cursorMode == CursorMode.PlaceBGCursor)
                    {
                        cursorMode = CursorMode.None;
                    }
                    else
                    {
                        cursorMode = CursorMode.PlaceBGCursor;
                    }
                }
            if (BaseTex != null)
                if (btnToggleBase.WasClicked(mouseScreenPos))
                {
                    drawBase = !drawBase;
                }
            if (FloorTex != null)
                if (btnToggleFloor.WasClicked(mouseScreenPos))
                {
                    drawFloor = !drawFloor;
                }

            if (placeRoomCloaking.WasClicked(mouseScreenPos))
                setRoom = RoomID.cloaking;
            if (placeRoomDoors.WasClicked(mouseScreenPos))
                setRoom = RoomID.doors;
            if (placeRoomDrones.WasClicked(mouseScreenPos))
                setRoom = RoomID.drones;
            if (placeRoomEngines.WasClicked(mouseScreenPos))
                setRoom = RoomID.engines;
            if (placeRoomMedbay.WasClicked(mouseScreenPos))
                setRoom = RoomID.medbay;
            if (placeRoomOxygen.WasClicked(mouseScreenPos))
                setRoom = RoomID.oxygen;
            if (placeRoomPilot.WasClicked(mouseScreenPos))
                setRoom = RoomID.pilot;
            if (placeRoomSensors.WasClicked(mouseScreenPos))
                setRoom = RoomID.sensors;
            if (placeRoomShields.WasClicked(mouseScreenPos))
                setRoom = RoomID.shields;
            if (placeRoomTeleporter.WasClicked(mouseScreenPos))
                setRoom = RoomID.teleporter;
            if (placeRoomWeapons.WasClicked(mouseScreenPos))
                setRoom = RoomID.weapons;

            if (setRoom != RoomID.None)
                cursorMode = CursorMode.PlacingRoomFunc;

            if (new FloatRect(ViewOffsetter.Position.X, ViewOffsetter.Position.Y, ViewOffsetter.TextureRect.Width, ViewOffsetter.TextureRect.Height).Contains(Mouse.GetPosition(Program.app).X, Mouse.GetPosition(Program.app).Y))
            {
                float Xdif = ViewOffsetter.Position.X + (ViewOffsetter.TextureRect.Width / 2) - Mouse.GetPosition(Program.app).X;
                float Ydif = ViewOffsetter.Position.Y + (ViewOffsetter.TextureRect.Width / 2) - Mouse.GetPosition(Program.app).Y;

                if (Math.Abs(Xdif) + Math.Abs(Ydif) < 10)
                {
                    //   Offset = new Vector2f(0, 0);
                    Game.ship.LayoutData.X_OFFSET = 0;
                    Game.ship.LayoutData.Y_OFFSET = 0;
                }
                else
                    if (Math.Abs(Xdif) > Math.Abs(Ydif))
                    {
                        if (Xdif > 0)
                            Game.ship.LayoutData.X_OFFSET -= 1;
                        else
                            Game.ship.LayoutData.X_OFFSET += 1;
                    }
                    else
                    {
                        if (Ydif > 0)
                            Game.ship.LayoutData.Y_OFFSET -= 1;
                        else
                            Game.ship.LayoutData.Y_OFFSET += 1;
                    }

            }
        }
示例#28
0
 private Voices(AnimateID id, RoomID startRoom) : base(id, startRoom)
 {
 }
            private void load(OverlayColourProvider colourProvider, OsuColour colours)
            {
                InternalChildren = new Drawable[]
                {
                    new Box
                    {
                        RelativeSizeAxes = Axes.Both,
                        Colour           = colourProvider.Background4
                    },
                    new GridContainer
                    {
                        RelativeSizeAxes = Axes.Both,
                        RowDimensions    = new[]
                        {
                            new Dimension(),
                            new Dimension(GridSizeMode.AutoSize),
                        },
                        Content = new[]
                        {
                            new Drawable[]
                            {
                                new OsuScrollContainer
                                {
                                    Padding = new MarginPadding
                                    {
                                        Horizontal = OsuScreen.HORIZONTAL_OVERFLOW_PADDING,
                                        Vertical   = 10
                                    },
                                    RelativeSizeAxes = Axes.Both,
                                    Children         = new[]
                                    {
                                        new FillFlowContainer
                                        {
                                            RelativeSizeAxes = Axes.X,
                                            AutoSizeAxes     = Axes.Y,
                                            Direction        = FillDirection.Vertical,
                                            Spacing          = new Vector2(0, 10),
                                            Children         = new[]
                                            {
                                                new Container
                                                {
                                                    Anchor  = Anchor.TopCentre,
                                                    Origin  = Anchor.TopCentre,
                                                    Padding = new MarginPadding {
                                                        Horizontal = WaveOverlayContainer.WIDTH_PADDING
                                                    },
                                                    RelativeSizeAxes = Axes.X,
                                                    AutoSizeAxes     = Axes.Y,
                                                    Children         = new Drawable[]
                                                    {
                                                        new SectionContainer
                                                        {
                                                            Padding = new MarginPadding {
                                                                Right = FIELD_PADDING / 2
                                                            },
                                                            Children = new[]
                                                            {
                                                                new Section("Room name")
                                                                {
                                                                    Child = NameField = new OsuTextBox
                                                                    {
                                                                        RelativeSizeAxes         = Axes.X,
                                                                        TabbableContentContainer = this,
                                                                        LengthLimit = 100,
                                                                    },
                                                                },
                                                                // new Section("Room visibility")
                                                                // {
                                                                //     Alpha = disabled_alpha,
                                                                //     Child = AvailabilityPicker = new RoomAvailabilityPicker
                                                                //     {
                                                                //         Enabled = { Value = false }
                                                                //     },
                                                                // },
                                                                new Section("Game type")
                                                                {
                                                                    Child = new FillFlowContainer
                                                                    {
                                                                        AutoSizeAxes     = Axes.Y,
                                                                        RelativeSizeAxes = Axes.X,
                                                                        Direction        = FillDirection.Vertical,
                                                                        Spacing          = new Vector2(7),
                                                                        Children         = new Drawable[]
                                                                        {
                                                                            TypePicker = new MatchTypePicker
                                                                            {
                                                                                RelativeSizeAxes = Axes.X,
                                                                            },
                                                                            typeLabel = new OsuSpriteText
                                                                            {
                                                                                Font   = OsuFont.GetFont(size: 14),
                                                                                Colour = colours.Yellow
                                                                            },
                                                                        },
                                                                    },
                                                                },
                                                                new Section("Queue mode")
                                                                {
                                                                    Child = new Container
                                                                    {
                                                                        RelativeSizeAxes = Axes.X,
                                                                        Height           = 40,
                                                                        Child            = QueueModeDropdown = new OsuEnumDropdown <QueueMode>
                                                                        {
                                                                            RelativeSizeAxes = Axes.X
                                                                        }
                                                                    }
                                                                },
                                                                new Section("Auto start")
                                                                {
                                                                    Child = new Container
                                                                    {
                                                                        RelativeSizeAxes = Axes.X,
                                                                        Height           = 40,
                                                                        Child            = startModeDropdown = new OsuEnumDropdown <StartMode>
                                                                        {
                                                                            RelativeSizeAxes = Axes.X
                                                                        }
                                                                    }
                                                                }
                                                            },
                                                        },
                                                        new SectionContainer
                                                        {
                                                            Anchor  = Anchor.TopRight,
                                                            Origin  = Anchor.TopRight,
                                                            Padding = new MarginPadding {
                                                                Left = FIELD_PADDING / 2
                                                            },
                                                            Children = new[]
                                                            {
                                                                new Section("Max participants")
                                                                {
                                                                    Alpha = disabled_alpha,
                                                                    Child = MaxParticipantsField = new OsuNumberBox
                                                                    {
                                                                        RelativeSizeAxes         = Axes.X,
                                                                        TabbableContentContainer = this,
                                                                        ReadOnly = true,
                                                                    },
                                                                },
                                                                new Section("Password (optional)")
                                                                {
                                                                    Child = PasswordTextBox = new OsuPasswordTextBox
                                                                    {
                                                                        RelativeSizeAxes         = Axes.X,
                                                                        TabbableContentContainer = this,
                                                                        LengthLimit = 255,
                                                                    },
                                                                },
                                                            }
                                                        }
                                                    },
                                                },
                                                playlistContainer = new FillFlowContainer
                                                {
                                                    Anchor           = Anchor.TopCentre,
                                                    Origin           = Anchor.TopCentre,
                                                    RelativeSizeAxes = Axes.X,
                                                    AutoSizeAxes     = Axes.Y,
                                                    Width            = 0.5f,
                                                    Depth            = float.MaxValue,
                                                    Spacing          = new Vector2(5),
                                                    Children         = new Drawable[]
                                                    {
                                                        drawablePlaylist = new DrawableRoomPlaylist
                                                        {
                                                            RelativeSizeAxes = Axes.X,
                                                            Height           = DrawableRoomPlaylistItem.HEIGHT
                                                        },
                                                        new PurpleTriangleButton
                                                        {
                                                            RelativeSizeAxes = Axes.X,
                                                            Height           = 40,
                                                            Text             = "Select beatmap",
                                                            Action           = SelectBeatmap
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    },
                                },
                            },
                            new Drawable[]
                            {
                                new Container
                                {
                                    Anchor           = Anchor.BottomLeft,
                                    Origin           = Anchor.BottomLeft,
                                    Y                = 2,
                                    RelativeSizeAxes = Axes.X,
                                    AutoSizeAxes     = Axes.Y,
                                    Children         = new Drawable[]
                                    {
                                        new Box
                                        {
                                            RelativeSizeAxes = Axes.Both,
                                            Colour           = colourProvider.Background5
                                        },
                                        new FillFlowContainer
                                        {
                                            RelativeSizeAxes = Axes.X,
                                            AutoSizeAxes     = Axes.Y,
                                            Direction        = FillDirection.Vertical,
                                            Spacing          = new Vector2(0, 20),
                                            Margin           = new MarginPadding {
                                                Vertical = 20
                                            },
                                            Padding = new MarginPadding {
                                                Horizontal = OsuScreen.HORIZONTAL_OVERFLOW_PADDING
                                            },
                                            Children = new Drawable[]
                                            {
                                                ApplyButton = new CreateOrUpdateButton
                                                {
                                                    Anchor  = Anchor.BottomCentre,
                                                    Origin  = Anchor.BottomCentre,
                                                    Size    = new Vector2(230, 55),
                                                    Enabled = { Value = false },
                                                    Action  = apply,
                                                },
                                                ErrorText = new OsuSpriteText
                                                {
                                                    Anchor = Anchor.BottomCentre,
                                                    Origin = Anchor.BottomCentre,
                                                    Alpha  = 0,
                                                    Depth  = 1,
                                                    Colour = colours.RedDark
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    loadingLayer = new LoadingLayer(true)
                };

                TypePicker.Current.BindValueChanged(type => typeLabel.Text                     = type.NewValue.GetLocalisableDescription(), true);
                RoomName.BindValueChanged(name => NameField.Text                               = name.NewValue, true);
                Type.BindValueChanged(type => TypePicker.Current.Value                         = type.NewValue, true);
                MaxParticipants.BindValueChanged(count => MaxParticipantsField.Text            = count.NewValue?.ToString(), true);
                RoomID.BindValueChanged(roomId => playlistContainer.Alpha                      = roomId.NewValue == null ? 1 : 0, true);
                Password.BindValueChanged(password => PasswordTextBox.Text                     = password.NewValue ?? string.Empty, true);
                QueueMode.BindValueChanged(mode => QueueModeDropdown.Current.Value             = mode.NewValue, true);
                AutoStartDuration.BindValueChanged(duration => startModeDropdown.Current.Value = (StartMode)(int)duration.NewValue.TotalSeconds, true);

                operationInProgress.BindTo(ongoingOperationTracker.InProgress);
                operationInProgress.BindValueChanged(v =>
                {
                    if (v.NewValue)
                    {
                        loadingLayer.Show();
                    }
                    else
                    {
                        loadingLayer.Hide();
                    }
                });
            }
示例#30
0
文件: Mist.cs 项目: rbergen/R136.NET
 private Mist(AnimateID id, RoomID startRoom) : base(id, startRoom)
 {
 }
示例#31
0
 private RedTroll(AnimateID id, RoomID startRoom) : base(id, startRoom)
 {
 }
示例#32
0
 private Room(RoomID id, string name, string?description, bool isDark, bool isForest)
 => (ID, Name, Description, IsDark, IsForest) = (id, name, description, isDark, isForest);