コード例 #1
0
        public Tile(TileData Data)
        {
            int Index   = Data.Indexes[JRandom.Next(Data.Indexes.Length)];
            int XLength = WBGame.TileSheet.Width / 8;

            Sprite    = new Sprite(WBGame.TileSheet, new Rectangle(Index % XLength * 8, Index / XLength * 8, 8, 8));
            Type      = Data.Type;
            MainColor = GetMainColor(Type, Sprite.Source);
        }
コード例 #2
0
        public ActionResult Image()
        {
            var random = new JRandom();

            Session[c_code] = random.Next();

            MemoryStream stream = new MemoryStream();

            PsHelper.Text2Image(stream, random.Content);
            return(File(stream.ToArray(), "image/jpeg"));
        }
コード例 #3
0
        public MainScene(Location Size) : base(Size)
        {
            ConnectionClient Connection = new ConnectionClient();

            Connection.Connect((Port) =>
            {
                if (Port != 0)
                {
                    Logger.Log("Connecting on Port " + Port);
                    Client = new Client(Port);
                }
                else
                {
                    Logger.Log("Failed to connect to remote host");
                }
                Connection.Dispose();
            });

            Player       = new Player();
            Player.Scale = 10;
            Player.Layer = 10;
            AddChild(Player);
            Players.Add(Player);

            Tiles       = new TileManager(2048, 2048, ClansGame.TestTileTexture, 8);
            Tiles.Scale = 5;

            for (int Y = 0; Y < Tiles.Height; Y++)
            {
                for (int X = 0; X < Tiles.Width; X++)
                {
                    Tiles.Set(X, Y, 3 + JRandom.Next(3), 0, 1, 0);
                }
            }

            Tiles.Layer = -1;
            AddChild(Tiles);

            Camera.Target = Player;

            Snow           = new SnowEffect(2);
            Snow.Intensity = 0;
            UI.AddChild(Snow);

            Info               = new LabelNode(Font.Default, "WASD to move + and - to change the bleeding", 20);
            Info.Position      = new Location(Size.X / 2, Size.Y * 0.3);
            Info.AnchorPoint.X = 0.5;
            Info.Color         = new Color(128, 128, 130);
            UI.AddChild(Info);

            Input.ListenForKey(Keys.I, this);
            Input.ListenForKey(Keys.O, this);
            Input.ListenForKey(Keys.P, this);
        }