Ejemplo n.º 1
0
        public static void Set(Form primaryForm, CharacterSelection initialScene)
        {
            host = primaryForm;
            DrivingCharacter = initialScene.CentralCharacter;
            playScene = new PlayScene();
            playScene.Location = new Point(padding, padding);
            playScene.Size = new Size(host.ClientRectangle.Width - padding * 2, host.ClientRectangle.Height - padding * 2);
            host.Resize += host_Resize;
            if(!_eventsInitialized)
            {
                _eventsInitialized = true;
                if (DrivingCharacter.IsGM)
                {
                    host.KeyDown += playScene_DM_KeyDown;
                    playScene.TileSelected += playScene_DM_TileSelected;
                }
                else
                {
                    host.KeyDown += playScene_KeyDown;
                    playScene.TileSelected += playScene_TileSelected;
                }
            }
            playScene.ViewCenterX = initialScene.CentralCharacter.LocationX;
            playScene.ViewCenterY = initialScene.CentralCharacter.LocationY;
            playScene.ViewCenterZ = initialScene.CentralCharacter.LocationZ;

            host.Controls.Add(playScene);
            playScene.Add(initialScene.visibleTiles);
            playScene.Add(initialScene.visibleCharacters);

            Updater = new BackgroundWorker();
            Updater.DoWork += Updater_DoWork;
            Updater.RunWorkerCompleted += Updater_RunWorkerCompleted;
            Updater.RunWorkerAsync();
        }
Ejemplo n.º 2
0
        public TileViewer()
        {
            InitializeComponent();
            scene = new PlayScene();

            currentMap.Name = "World";

            editPane = new TileEditPane(null);
            editPane.Size = new Size(200, this.ClientRectangle.Height);
            editPane.Location = new Point(this.ClientRectangle.Width - 200, 0);
            editPane.X.ValueChanged += X_ValueChanged;
            editPane.Y.ValueChanged += Y_ValueChanged;
            editPane.Z.ValueChanged += Z_ValueChanged;
            editPane.Set.SelectedValueChanged += Set_SelectedValueChanged;
            editPane.TileHeight.SelectedValueChanged += TileHeight_SelectedValueChanged;
            editPane.TileDirection.SelectedValueChanged += TileDirection_SelectedValueChanged;
            editPane.AddTile.Click += AddTile_Click;
            editPane.RemoveTile.Click += RemoveTile_Click;
            this.Controls.Add(editPane);

            scene.Size = new Size(this.ClientRectangle.Width - 200, this.ClientRectangle.Height);
            scene.TileSelected += scene_TileSelected;
            scene.ViewCenterX = 20000002;
            scene.ViewCenterY = 19999993;
            scene.ViewCenterZ = 0;

            currentMap.LoadNearby(scene.ViewCenterX, scene.ViewCenterY, scene.ViewCenterZ);
            for(int X = scene.ViewCenterX - 40; X < scene.ViewCenterX + 40; X++)
            {
                if (!currentMap.Tiles.ContainsKey(X)) continue;
                for (int Y = scene.ViewCenterY - 40; Y < scene.ViewCenterY + 40; Y++)
                {
                    if (!currentMap.Tiles[X].ContainsKey(Y)) continue;
                    for (int Z = scene.ViewCenterZ - 40; Z < scene.ViewCenterZ + 40; Z++)
                    {
                        if (!currentMap.Tiles[X][Y].ContainsKey(Z)) continue;
                        drawnTiles.Add(currentMap.Tiles[X][Y][Z]);
                    }
                }
            }
            scene.Add(drawnTiles);

            scene.Add(new DisplayCharacter("") { CharacterId = 1, Height = 4, x = 20000002, y = 19999992, z = 8, Facing = Direction.North, CharacterRace = 0, Sex = 0, Hair = 1, SkinColor = 0, HairColor = 3, Clothes = 0, ClothColorA = 7, ClothColorB = 0 });
            scene.Add(new DisplayCharacter("") { CharacterId = 1, Height = 4, x = 20000003, y = 19999992, z = 8, Facing = Direction.North, CharacterRace = 0, Sex = 0, Hair = 1, SkinColor = 0, HairColor = 3, Clothes = 1, ClothColorA = 7, ClothColorB = 0 });
            scene.Add(new DisplayCharacter("") { CharacterId = 1, Height = 4, x = 20000004, y = 19999992, z = 8, Facing = Direction.North, CharacterRace = 0, Sex = 0, Hair = 1, SkinColor = 0, HairColor = 3, Clothes = 2, ClothColorA = 7, ClothColorB = 0 });
            scene.Add(new DisplayCharacter("") { CharacterId = 1, Height = 4, x = 20000005, y = 19999992, z = 8, Facing = Direction.North, CharacterRace = 0, Sex = 0, Hair = 1, SkinColor = 0, HairColor = 3, Clothes = 3, ClothColorA = 7, ClothColorB = 0 });
            //scene.Add(new DisplayCharacter("") { CharacterId = 1, Height = 4, x = 6, y = -6, z = 0, Facing = Direction.North, Race = 0, Sex = 1, Hair = 2, SkinColor = 0, HairColor = 4 });
            //scene.Add(new DisplayCharacter("") { CharacterId = 1, Height = 4, x = 5, y = -6, z = 0, Facing = Direction.North, Race = 1, Sex = 0, Hair = 2, SkinColor = 0, HairColor = 1 });
            //scene.Add(new DisplayCharacter("") { CharacterId = 1, Height = 4, x = 4, y = -6, z = 0, Facing = Direction.North, Race = 1, Sex = 1, Hair = 2, SkinColor = 0, HairColor = 1 });
            //scene.Add(new DisplayCharacter("") { CharacterId = 1, Height = 3, x = 3, y = -6, z = 0, Facing = Direction.North, Race = 2, Sex = 0, Hair = 1, SkinColor = 0, HairColor = 2 });
            //scene.Add(new DisplayCharacter("") { CharacterId = 1, Height = 3, x = 2, y = -6, z = 0, Facing = Direction.North, Race = 2, Sex = 1, Hair = 1, SkinColor = 0, HairColor = 2 });
            //scene.Add(new DisplayCharacter("") { CharacterId = 1, Height = 2, x = 1, y = -6, z = 0, Facing = Direction.North, Race = 3, Sex = 0, Hair = 1, SkinColor = 0, HairColor = 3 });
            //scene.Add(new DisplayCharacter("") { CharacterId = 1, Height = 2, x = 0, y = -6, z = 0, Facing = Direction.North, Race = 3, Sex = 1, Hair = 1, SkinColor = 0, HairColor = 3 });

            // Uncomment to check for clipping
            //scene.Add(new DisplayCharacter("") { CharacterId = 1, Height = 4, x = 7, y = -5, z = 0, Facing = Direction.South, Race = 0, Sex = 0 });
            //scene.Add(new DisplayCharacter("") { CharacterId = 1, Height = 4, x = 6, y = -5, z = 0, Facing = Direction.South, Race = 0, Sex = 1 });
            //scene.Add(new DisplayCharacter("") { CharacterId = 1, Height = 4, x = 5, y = -5, z = 0, Facing = Direction.South, Race = 1, Sex = 0 });
            //scene.Add(new DisplayCharacter("") { CharacterId = 1, Height = 4, x = 4, y = -5, z = 0, Facing = Direction.South, Race = 1, Sex = 1 });
            //scene.Add(new DisplayCharacter("") { CharacterId = 1, Height = 3, x = 3, y = -5, z = 0, Facing = Direction.South, Race = 2, Sex = 0 });
            //scene.Add(new DisplayCharacter("") { CharacterId = 1, Height = 3, x = 2, y = -5, z = 0, Facing = Direction.South, Race = 2, Sex = 1 });
            //scene.Add(new DisplayCharacter("") { CharacterId = 1, Height = 2, x = 1, y = -5, z = 0, Facing = Direction.South, Race = 3, Sex = 0 });
            //scene.Add(new DisplayCharacter("") { CharacterId = 1, Height = 2, x = 0, y = -5, z = 0, Facing = Direction.South, Race = 3, Sex = 1 });

            // Uncomment to check for standing in formation.
            //scene.Add(new DisplayCharacter("") { CharacterId = 1, Height = 4, x = 7, y = -5, z = 0, Facing = Direction.North, Race = 0, Sex = 1, Hair = 1, SkinColor = 0, HairColor = 0 });
            //scene.Add(new DisplayCharacter("") { CharacterId = 1, Height = 4, x = 6, y = -5, z = 0, Facing = Direction.North, Race = 0, Sex = 1, Hair = 1, SkinColor = 0, HairColor = 0 });
            //scene.Add(new DisplayCharacter("") { CharacterId = 1, Height = 4, x = 5, y = -5, z = 0, Facing = Direction.North, Race = 0, Sex = 1, Hair = 1, SkinColor = 0, HairColor = 0 });
            //scene.Add(new DisplayCharacter("") { CharacterId = 1, Height = 4, x = 4, y = -5, z = 0, Facing = Direction.North, Race = 0, Sex = 1, Hair = 1, SkinColor = 0, HairColor = 0 });
            //scene.Add(new DisplayCharacter("") { CharacterId = 1, Height = 4, x = 3, y = -5, z = 0, Facing = Direction.North, Race = 0, Sex = 1, Hair = 1, SkinColor = 0, HairColor = 0 });
            //scene.Add(new DisplayCharacter("") { CharacterId = 1, Height = 4, x = 2, y = -5, z = 0, Facing = Direction.North, Race = 0, Sex = 1, Hair = 1, SkinColor = 0, HairColor = 0 });
            //scene.Add(new DisplayCharacter("") { CharacterId = 1, Height = 4, x = 1, y = -5, z = 0, Facing = Direction.North, Race = 0, Sex = 1, Hair = 1, SkinColor = 0, HairColor = 0 });
            //scene.Add(new DisplayCharacter("") { CharacterId = 1, Height = 4, x = 0, y = -5, z = 0, Facing = Direction.North, Race = 0, Sex = 1, Hair = 1, SkinColor = 0, HairColor = 0 });
            //scene.Add(new DisplayCharacter("") { CharacterId = 1, Height = 4, x = 7, y = -4, z = 0, Facing = Direction.North, Race = 0, Sex = 1, Hair = 1, SkinColor = 0, HairColor = 0 });
            //scene.Add(new DisplayCharacter("") { CharacterId = 1, Height = 4, x = 6, y = -4, z = 0, Facing = Direction.North, Race = 0, Sex = 1, Hair = 1, SkinColor = 0, HairColor = 0 });
            //scene.Add(new DisplayCharacter("") { CharacterId = 1, Height = 4, x = 5, y = -4, z = 0, Facing = Direction.North, Race = 0, Sex = 1, Hair = 1, SkinColor = 0, HairColor = 0 });
            //scene.Add(new DisplayCharacter("") { CharacterId = 1, Height = 4, x = 4, y = -4, z = 0, Facing = Direction.North, Race = 0, Sex = 1, Hair = 1, SkinColor = 0, HairColor = 0 });
            //scene.Add(new DisplayCharacter("") { CharacterId = 1, Height = 4, x = 3, y = -4, z = 0, Facing = Direction.North, Race = 0, Sex = 1, Hair = 1, SkinColor = 0, HairColor = 0 });
            //scene.Add(new DisplayCharacter("") { CharacterId = 1, Height = 4, x = 2, y = -4, z = 0, Facing = Direction.North, Race = 0, Sex = 1, Hair = 1, SkinColor = 0, HairColor = 0 });
            //scene.Add(new DisplayCharacter("") { CharacterId = 1, Height = 4, x = 1, y = -4, z = 0, Facing = Direction.North, Race = 0, Sex = 1, Hair = 1, SkinColor = 0, HairColor = 0 });
            //scene.Add(new DisplayCharacter("") { CharacterId = 1, Height = 4, x = 0, y = -4, z = 0, Facing = Direction.North, Race = 0, Sex = 1, Hair = 1, SkinColor = 0, HairColor = 0 });

            this.Controls.Add(scene);

            this.Resize += new EventHandler(TileViewer_Resize);
        }