Exemplo n.º 1
0
        protected override void OnLoad()
        {
            base.OnLoad();

            Layer = LayerUI + 3;

            Task.Factory.StartNew(() =>
            {
                //Thread.Sleep(1500);

                //text = "hello";

                Thread.Sleep(1500);

                text = "hello world";

                Thread.Sleep(3000);

                MMW.Invoke(() =>
                {
                    MMW.DestroyGameObject(GameObject);
                    MMW.Window.CursorVisible = true;

                    var objs = MMW.FindGameObjects(g => true);
                    foreach (var obj in objs)
                    {
                        obj.Enabled = true;
                    }
                });
            });
        }
Exemplo n.º 2
0
 public void OnClear()
 {
     MMW.Invoke(() =>
     {
         MMW.DestroyGameObject(gameObj);
         gameObj = null;
     });
 }
Exemplo n.º 3
0
        public void OnObjectLoaded(NwObject obj)
        {
            var wo = AssetConverter.FromNwObject(obj);

            MMW.Invoke(() =>
            {
                wo.Load();

                var go = CreateGameObject(wo, wo.Name, "Deferred Physical");
                go.AddComponent <CollisionRenderer>();
                MMW.RegistGameObject(go);

                gameObj = go;
            });
        }
Exemplo n.º 4
0
        public void OnCharacterLoaded(NwCharacter ch)
        {
            var chara = AssetConverter.FromNwCharacter(ch);

            MMW.Invoke(() =>
            {
                chara.Load();

                var go = CreateGameObject(chara, chara.Name, "Deferred Physical");
                go.AddComponent <CollisionRenderer>();
                MMW.RegistGameObject(go);

                gameObj = go;
            });
        }
Exemplo n.º 5
0
        private void LeavePlayer(WalkerPlayer player)
        {
            MMW.Invoke(() =>
            {
                try
                {
                    Players.Remove(Players.Find(p => (int)p.Properties["sessionID"] == player.SessionID));
                    worldData.Players.Remove(player);

                    MMW.BroadcastMessage("log", $"player \"{player.Name}\" left");
                }
                catch (Exception ex)
                {
                    MMW.BroadcastMessage("log", $"[ERROR] player \"{player.Name}\" leave failed");
                }
            });
        }
Exemplo n.º 6
0
        public void SetTexture(int matIndex, string paramName, Bitmap bitmap)
        {
            if (gameObj == null)
            {
                return;
            }

            var mr  = gameObj.GetComponent <MeshRenderer>();
            var mat = mr.GetMaterial(matIndex);
            var bm  = (Bitmap)bitmap.Clone();

            MMW.Invoke(() =>
            {
                var tex = new Texture2D(bm, false);
                tex.Load();

                mat.TrySetParam(paramName, tex);
            });
        }
Exemplo n.º 7
0
        public void ItemUse(NwWalkerGameObject go, WalkerPlayer player, bool sync)
        {
            MMW.Invoke(() =>
            {
                try
                {
                    if (!Players.Exists(p => (string)p.Properties["userID"] == player.UserID))
                    {
                        return;
                    }

                    var wo = Resources.Objects[go.ObjectHash];
                    if (!wo.Loaded)
                    {
                        wo.Load();
                    }

                    var g = GameObjectFactory.CreateItem(go, wo, player, "item", wo.Bones != null ? "Deferred Physical Skin" : "Deferred Physical");

                    g.Properties["user"]      = player;
                    g.Properties["userID"]    = player.UserID;
                    g.Properties["sessionID"] = player.SessionID;
                    g.Hash             = go.Hash;
                    g.Transform.Parent = Players.Find(p => (string)p.Properties["userID"] == player.UserID).Transform;
                    g.Transform.UpdatePhysicalTransform();

                    MMW.RegistGameObject(g);
                    if (sync)
                    {
                        SyncWorldObjects.Add(g);
                    }
                    else
                    {
                        WorldObjects.Add(g);
                    }
                }
                catch
                {
                    MMW.BroadcastMessage("log", $"[ERROR] failed to use item \"{go.Name}\"");
                }
            });
        }
Exemplo n.º 8
0
        public void RemoveGameObject(GameObject go)
        {
            MMW.Invoke(() =>
            {
                try
                {
                    SyncWorldObjects.Remove(go);
                    WorldObjects.Remove(go);
                    if (go != null)
                    {
                        MMW.DestroyGameObject(go);
                    }

                    MMW.BroadcastMessage("log", $"object \"{go.Name}\" removed");
                }
                catch
                {
                }
            });
        }
Exemplo n.º 9
0
        public void ReceivedServerDesc(WorldInfo info)
        {
            if (info == null || info.GameType != 1)
            {
                Connected = false;
                MMW.Invoke(() =>
                {
                    if (texIcon != null && texIcon.Loaded)
                    {
                        texIcon.Unload();
                        texIcon        = null;
                        Info.WorldIcon = null;
                    }
                });
                return;
            }

            if (info != null)
            {
                Connected      = true;
                Info.WorldName = info.WorldName;
                Info.WorldIcon = info.WorldIcon;
                if (Info.WorldIcon != null)
                {
                    MMW.Invoke(() =>
                    {
                        if (texIcon != null && texIcon.Loaded)
                        {
                            texIcon.Unload();
                            texIcon = null;
                        }
                        var bitmap = Util.FromBitmapString(Info.WorldIcon);
                        if (bitmap != null)
                        {
                            texIcon = new Texture2D(bitmap);
                            texIcon.Load();
                        }
                    });
                }
            }
        }
Exemplo n.º 10
0
 protected override void OnReceivedMessage(string message, params object[] args)
 {
     if (message == "picture chat")
     {
         if ((int)args[0] != (int)GameObject.Properties["sessionID"])
         {
             return;
         }
         var data  = (Color[, ])args[1];
         var bytes = new byte[64 * 64 * 4];
         for (var y = 0; y < 64; y++)
         {
             for (var x = 0; x < 64; x++)
             {
                 var c = data[y, x];
                 bytes[((y * 64) + x) * 4 + 0] = data[y, x].R;
                 bytes[((y * 64) + x) * 4 + 1] = data[y, x].G;
                 bytes[((y * 64) + x) * 4 + 2] = data[y, x].B;
                 bytes[((y * 64) + x) * 4 + 3] = data[y, x].A;
             }
         }
         MMW.Invoke(() =>
         {
             picTex.Update(bytes, OpenTK.Graphics.OpenGL4.PixelFormat.Rgba, OpenTK.Graphics.OpenGL4.PixelType.UnsignedByte);
             showTime = ShowTime;
             flipY    = true;
         });
     }
     else if (message == "stamp")
     {
     }
     else if (message == "enable popup")
     {
         Enabled = true;
     }
     else if (message == "disable popup")
     {
         Enabled = false;
     }
 }
Exemplo n.º 11
0
        public void PutGameObject(NwWalkerGameObject go, bool sync)
        {
            MMW.Invoke(() =>
            {
                try
                {
                    var wo = Resources.Objects[go.ObjectHash];
                    if (!wo.Loaded)
                    {
                        wo.Load();
                    }

                    var g  = GameObjectFactory.CreateGameObject(go, wo, wo.Name, wo.Bones != null ? "Deferred Physical Skin" : "Deferred Physical");
                    g.Hash = go.Hash;
                    g.Transform.Position = go.Position.FromVec3f();
                    g.Transform.Rotate   = go.Rotation.FromVec3f();
                    if (go.Scale != null)
                    {
                        g.Transform.Scale = go.Scale.FromVec3f();
                    }
                    g.Transform.UpdatePhysicalTransform();

                    MMW.RegistGameObject(g);
                    if (sync)
                    {
                        SyncWorldObjects.Add(g);
                    }
                    else
                    {
                        WorldObjects.Add(g);
                    }
                }
                catch
                {
                    MMW.BroadcastMessage("log", $"[ERROR] object \"{go.Name}\" entry failed");
                }
            });
        }
Exemplo n.º 12
0
        private void JoinPlayer(WalkerPlayer player)
        {
            MMW.Invoke(() =>
            {
                try
                {
                    var c = Resources.Characters[player.CharacterHash];
                    if (!c.Loaded)
                    {
                        c.Load();
                    }

                    var ch = GameObjectFactory.CreateCharacter(c, player.Name, c.Bones != null ? "Deferred Physical Skin" : "Deferred Physical");
                    ch.Properties["sessionID"] = player.SessionID;
                    ch.Properties["userID"]    = player.UserID;
                    ch.Properties["user"]      = player;
                    ch.AddComponent <CharacterInfo>(c, player);
                    ch.AddComponent <CharacterTransformResolver>(player);
                    ch.AddComponent <CharacterPopupResolver>();
                    ch.AddComponent <CharacterNameResolver>();
                    ch.Transform.Position = player.Position.FromVec3f();
                    ch.Transform.Rotate   = player.Rotation.FromVec3f();
                    ch.Transform.UpdatePhysicalTransform();

                    MMW.RegistGameObject(ch);
                    Players.Add(ch);
                    worldData.Players.Add(player);

                    MMW.BroadcastMessage("log", $"player \"{player.Name}\" joined");
                }
                catch (Exception ex)
                {
                    MMW.BroadcastMessage("log", $"[ERROR] player \"{player.Name}\" join failed");
                }
            });
        }
Exemplo n.º 13
0
        protected override void OnReceivedMessage(string message, params object[] args)
        {
            if (message == "chat")
            {
                showtime = ShowTime;

                var chat = (NwChat)args[0];
                MMW.Invoke(() =>
                {
                    var player = worldData.Players.Find(p => p.SessionID == chat.From);
                    var panel  = new LogPanel()
                    {
                        text     = chat.Text,
                        from     = chat.From,
                        tex      = Drawer.CreateStringTexture((player == null ? "" : player.Name + ": ") + chat.Text, Font, (int)Size.X - 24),
                        position = new Vector2(800.0f, 0.0f),
                        color    = Color4.White,
                    };
                    logs.Add(panel);
                });
            }
            else if (message == "log")
            {
                showtime = ShowTime;

                MMW.Invoke(() =>
                {
                    var panel = new LogPanel()
                    {
                        text     = (string)args[0],
                        tex      = Drawer.CreateStringTexture((string)args[0], Font, (int)Size.X - 24),
                        position = new Vector2(800.0f, 0.0f),
                        color    = Color4.White,
                    };
                    logs.Add(panel);
                });
            }
            else if (message == "log showtime")
            {
                try { ShowTime = (double)args[0]; }
                catch { }
            }
            else if (message == "log font")
            {
                try { Font = (Font)args[0]; }
                catch { }
            }
            else if (message == "hud show")
            {
                showtime = ShowTime;
            }
            else if (message == "hud hide")
            {
                showtime = 0;
            }
            else if (message == "enable log")
            {
                Enabled = true;
            }
            else if (message == "disable log")
            {
                Enabled = false;
            }
        }
Exemplo n.º 14
0
        protected override void OnLoad()
        {
            base.OnLoad();

            MMW.FindGameComponent <BackgroundScript>().Trans(new Color4(148, 222, 148, 255), 0.25);

            input       = new MenuInputResolver();
            input.Up    = Key.W;
            input.Down  = Key.S;
            input.Right = Key.D;
            input.Left  = Key.A;

            transit = new TransitControl();
            transit.LocalLocation = new Vector2(MMW.ClientSize.Width * 2.0f, 0);
            transit.Size          = new Vector2(MMW.ClientSize.Width, MMW.ClientSize.Height);
            transit.Target        = Vector2.Zero;

            var label = new Label()
            {
                Parent        = transit,
                Alignment     = ContentAlignment.TopCenter,
                Text          = "WORLD SELECT",
                Font          = new Font("Yu Gothic UI Light", 40.0f),
                LocalLocation = new Vector2(0.0f, 32.0f),
            };

            Controls.Add(label);

            var frame = new SelectWorldFrame(transit, MMW.ClientSize.Height - 120 - 100, new Vector2((MMW.ClientSize.Width - 760) * 0.5f, 120));

            Controls.Add(frame);
            foreach (var desc in MMW.GetAsset <UserData>().SignupServers)
            {
                frame.AddWorld(desc);
            }

            var signupBtn = new Button(frame, "SignUp World", new Vector2(70, MMW.ClientSize.Height - 120 - 100 + 20), new Vector2(140, 32), "click");

            Controls.Add(signupBtn);

            var editBtn = new Button(signupBtn, "Edit", new Vector2(160, 0), new Vector2(140, 32), "click");

            editBtn.Enabled = false;
            Controls.Add(editBtn);

            var delBtn = new Button(editBtn, "Delete", new Vector2(160, 0), new Vector2(140, 32), "click");

            delBtn.Enabled = false;
            Controls.Add(delBtn);

            var directBtn = new Button(delBtn, "Direct Connect", new Vector2(160, 0), new Vector2(140, 32), "click");

            Controls.Add(directBtn);

            signupBtn.Clicked += (s, b) =>
            {
                if (!signupBtn.Enabled)
                {
                    return;
                }
                trans          = true;
                transit.Target = new Vector2(-MMW.ClientSize.Width * 2.0f, 0.0f);
                GameObject.AddComponent <SignUpServerScript>();
            };

            editBtn.Clicked += (s, b) =>
            {
                if (!editBtn.Enabled)
                {
                    return;
                }
                trans          = true;
                transit.Target = new Vector2(-MMW.ClientSize.Width * 2.0f, 0.0f);
                GameObject.AddComponent <ServerEditScript>(frame.WorldInfo);
            };

            delBtn.Clicked += (s, b) =>
            {
                if (!delBtn.Enabled)
                {
                    return;
                }
                var res = System.Windows.Forms.MessageBox.Show(System.Windows.Forms.NativeWindow.FromHandle(MMW.Window.WindowInfo.Handle), "よろしいですか?\n(サーバ元のワールドは削除されません)", "ワールドを削除", System.Windows.Forms.MessageBoxButtons.OKCancel);
                if (res == System.Windows.Forms.DialogResult.OK)
                {
                    MMW.GetAsset <UserData>().SignupServers.Remove(frame.WorldInfo);
                    frame.RemoveWorld(frame.WorldInfo);
                    frame.WorldInfo = null;
                    editBtn.Enabled = false;
                    delBtn.Enabled  = false;
                }
            };

            directBtn.Clicked += (s, b) =>
            {
                if (!directBtn.Enabled)
                {
                    return;
                }
                trans          = true;
                transit.Target = new Vector2(-MMW.ClientSize.Width * 2.0f, 0.0f);
                GameObject.AddComponent <DirectConnectScript>();
            };

            frame.ServerClicked += (s, e) =>
            {
                editBtn.Enabled = true;
                delBtn.Enabled  = true;
            };
            frame.ServerSelected += (s, e) =>
            {
                MMW.GetAsset <Sound>("click").Play();
                var desc = frame.WorldInfo;
                Task.Factory.StartNew(() =>
                {
                    AcceptInput = false;
                    Thread.Sleep(100);

                    var server = NetworkUtil.Connect(desc.HostName, desc.Port);
                    if (server == null)
                    {
                        return;
                    }

                    server.Load();

                    var info = server.RequestJson <WorldInfo>(DataType.RequestWorldInfo, 1, DataType.ResponseWorldInfo, 3000);

                    if (info == null || info.GameType != 1 || (int)info.Version != (int)MMW.GetAsset <GameData>().Version)
                    {
                        AcceptInput = true;
                    }
                    else
                    {
                        MMW.Invoke(() =>
                        {
                            MMW.RegistAsset(server);
                            trans          = true;
                            transit.Target = new Vector2(-MMW.ClientSize.Width * 2.0f, 0.0f);
                            GameObject.AddComponent <ServerInfoScript>(info);
                        });
                    }
                });
            };
        }
Exemplo n.º 15
0
        protected override void OnLoad()
        {
            base.OnLoad();

            server = MMW.GetAsset <Server>();

            userData = MMW.GetAsset <UserData>();
            //userData.ArchiveIndex = 6;
            //userData.UserID = "MikuMikuWorldOrg0001";

            MMW.RegistAsset(worldData = new WorldData());

            Resources = new WorldResources(nwWorldData);
            MMW.RegistAsset(Resources);

            // アイテムの整理

            var world = Resources.Worlds.First().Value;

            world.Load();

            var ch = Resources.Characters.First().Value;

            ch.Load();

            MMW.Window.CursorVisible = false;

            worldGO = GameObjectFactory.CreateWorld(world, "world", "Deferred Physical");
            worldGO.AddComponent <CoinSpown>();
            MMW.RegistGameObject(worldGO);

            playerGO = GameObjectFactory.CreatePlayer(ch, "player", ch.Bones != null ? "Deferred Physical Skin" : "Deferred Physical");
            playerGO.Properties["sessionID"] = server.SessionID;
            playerGO.Properties["userID"]    = userData.UserID;
            ch.EyePosition.Z = 0.1f;
            var rb = playerGO.GetComponent <RigidBody>();

            rb.Collide += Rb_Collide;
            rb.Collide += (s, e) =>
            {
                if (e.GameObject.Tags.Contains("coin") && e.GameObject.Tags.Contains("98df1d6abbc7"))
                {
                    e.GameObject.Tags.Remove("coin");
                    e.GameObject.Tags.Remove("98df1d6abbc7");
                    MMW.Invoke(() =>
                    {
                        MMW.DestroyGameObject(e.GameObject);
                        if (e.GameObject.Tags.Contains("cupper coin"))
                        {
                            userData.AddCoin(1);
                        }
                        else if (e.GameObject.Tags.Contains("silver coin"))
                        {
                            userData.AddCoin(5);
                        }
                        else if (e.GameObject.Tags.Contains("gold coin"))
                        {
                            userData.AddCoin(20);
                        }
                    });
                }
            };
            MMW.RegistGameObject(playerGO);
            Players.Add(playerGO);

            cameraTarget = new GameObject("camera target");
            cameraTarget.Transform.Parent   = playerGO.Transform;
            cameraTarget.Transform.Position = new Vector3(0.0f, ch.EyePosition.Y, ch.EyePosition.Z);
            MMW.RegistGameObject(cameraTarget);

            var wp = new WalkerPlayer()
            {
                Name          = userData.UserName,
                SessionID     = server.SessionID,
                ArchiveIndex  = userData.ArchiveIndex,
                CharacterHash = Resources.Characters.First().Key,
                Achivements   = userData.Achivements.ToList(),
                Rank          = userData.Rank,
                LikesCount    = userData.Likes.Count,
                LikedCount    = userData.ReceiveLikes.Count,
                UserID        = userData.UserID,
                Comment       = userData.Comment,
                IsAdmin       = false,
            };

            worldData.Players.Add(wp);

            playerGO.AddComponent <CharacterInfo>(ch, wp);
            playerGO.AddComponent <PlayerMoveController>();
            var cam = playerGO.AddComponent <PlayerCameraController>();

            cam.Target = cameraTarget.Transform;
            playerGO.AddComponent <PlayerRayResolver>();
            playerGO.AddComponent <PlayerHotbarItemResolver>();
            playerGO.AddComponent <UdpSender>();
            playerGO.AddComponent <CharacterPopupResolver>();
            playerGO.AddComponent <CharacterNameResolver>();
            playerGO.AddComponent <DoFResolver>();
            playerGO.AddComponent <WalkerGameObjectScript>(playerGO, new BigHead(), null);

            var env = nwWorldData.Worlds[0].Environments[0];

            MMW.GlobalAmbient = env.Ambient.FromColor4f();
            MMW.DirectionalLight.Intensity = env.DirLight.Intensity;
            MMW.DirectionalLight.Color     = env.DirLight.Color.FromColor4f();
            MMW.DirectionalLight.Direction = env.DirLight.Direction.FromVec3f().Normalized();

            MMW.MainCamera.ShadowMapping = true;
            MMW.MainCamera.GameObject.AddComponent <AudioListener>();
            var effs = MMW.MainCamera.GameObject.GetComponents <ImageEffect>();

            foreach (var eff in effs)
            {
                eff.Enabled = true;
            }

            blur        = MMW.MainCamera.GameObject.AddComponent <Blur>();
            blur.Radius = 0.0f;

            hudGO = new GameObject("hud", "system", "hud");
            //go.Layer = GameObject.LayerUI + 1;
            hudGO.AddComponent <HotBar>();
            hudGO.AddComponent <Aiming>();
            hudGO.AddComponent <CoinResolver>();
            hudGO.AddComponent <ScriptResolver>();
            hudGO.AddComponent <LogResolver>();
            hudGO.AddComponent <ChatResolver>();
            hudGO.AddComponent <PictureChatResolver>();
            hudGO.AddComponent <MenuResolver>();
            hudGO.AddComponent <PublicAchivementResolver>();
            hudGO.AddComponent <LeaveResolver>();
            hudGO.AddComponent <InventiryResolver>();
            MMW.RegistGameObject(hudGO);

            server.BeforeCmds.Add(new CmdAllTransform(this));

            /*
             * foreach (var g in nwWorldData.GameObjects)
             * {
             *  try
             *  {
             *      var wo = Resources.Objects[g.ObjectHash];
             *      if (wo.ItemType == "Put") PutGameObject(g, true);
             *  }
             *  catch { }
             * }
             */

            userData.SessionID     = server.SessionID;
            userData.CharacterHash = Resources.Characters.First().Key;

            server.Disconnected += Server_Disconnected;
            server.SendTcp(Walker.DataType.ResponseReady, Util.SerializeJson(wp));
        }
Exemplo n.º 16
0
        protected override void OnLoad()
        {
            base.OnLoad();

            MMW.FindGameComponent <BackgroundScript>().Trans(new Color4(148, 222, 148, 255), 0.25);

            input       = new MenuInputResolver();
            input.Up    = Key.W;
            input.Down  = Key.S;
            input.Right = Key.D;
            input.Left  = Key.A;

            transit = new TransitControl();
            transit.LocalLocation = new Vector2(MMW.ClientSize.Width * 2.0f, 0);
            transit.Size          = new Vector2(MMW.ClientSize.Width, MMW.ClientSize.Height);
            transit.Target        = Vector2.Zero;

            var label = new Label()
            {
                Parent        = transit,
                Alignment     = ContentAlignment.TopCenter,
                Text          = "DIRECT CONNECT",
                Font          = new Font("Yu Gothic UI Light", 40.0f),
                LocalLocation = new Vector2(0.0f, 32.0f),
            };

            Controls.Add(label);

            var labelHost = new Label(transit, "Host", new Vector2(MMW.Width * 0.5f - 160.0f, 300.0f + 2.0f));

            Controls.Add(labelHost);
            var labelPort = new Label(labelHost, "Port", new Vector2(0, 50.0f));

            Controls.Add(labelPort);

            var textBoxHost = new TextBox2(transit, "localhost", new Vector2(MMW.Width * 0.5f - 100.0f, 300.0f), new Vector2(360.0f, 32.0f));

            textBoxHost.MaxLength = 64;
            Controls.Add(textBoxHost);

            var textBoxPort = new TextBox2(textBoxHost, "39393", new Vector2(0, 50.0f), new Vector2(72.0f, 32.0f));

            textBoxPort.MaxLength = 5;
            Controls.Add(textBoxPort);

            var backBtn = new Button(transit, "Back", new Vector2(-70.0f - 20.0f, 440.0f), "back");

            backBtn.Alignment = ContentAlignment.TopCenter;
            backBtn.Clicked  += (s, e) =>
            {
                trans          = true;
                transit.Target = new Vector2(-MMW.ClientSize.Width * 2.0f, 0.0f);
                GameObject.AddComponent <ServerSelectScript>();
            };
            Controls.Add(backBtn);

            var labelInfo = new Label(transit, "", new Vector2(0.0f, 500.0f));

            labelInfo.Alignment = ContentAlignment.TopCenter;
            Controls.Add(labelInfo);

            var connectBtn = new Button(transit, "Connect", new Vector2(70.0f + 20.0f, 440.0f), "click");

            connectBtn.Alignment = ContentAlignment.TopCenter;
            connectBtn.Clicked  += (s, e) =>
            {
                AcceptInput = false;

                labelInfo.Brush = Brushes.White;
                labelInfo.Text  = "Connecting...";

                var host = textBoxHost.Text;
                var port = int.Parse(textBoxPort.Text);

                Task.Factory.StartNew(() =>
                {
                    Thread.Sleep(100);
                    var server = NetworkUtil.Connect(host, port);

                    if (server == null)
                    {
                        labelInfo.Brush = Brushes.Red;
                        labelInfo.Text  = "Host not Found.";
                        AcceptInput     = true;
                    }
                    else
                    {
                        labelInfo.Text = "Downloading World info...";

                        var info = server.RequestJson <WorldInfo>(DataType.RequestWorldInfo, 1, DataType.ResponseWorldInfo, 5000);

                        if (info.GameType != 1)
                        {
                            labelInfo.Brush = Brushes.Red;
                            labelInfo.Text  = "Host not Found.";
                            AcceptInput     = true;
                        }
                        else if ((int)info.Version != (int)MMW.GetAsset <GameData>().Version)
                        {
                            labelInfo.Brush = Brushes.Red;
                            labelInfo.Text  = $"Wrong version. Host ver.{info.Version:0.0}";
                            AcceptInput     = true;
                        }
                        else
                        {
                            MMW.Invoke(() =>
                            {
                                trans          = true;
                                transit.Target = new Vector2(-MMW.ClientSize.Width * 2.0f, 0.0f);
                                GameObject.AddComponent <ServerInfoScript>(server, info);
                            });
                        }
                    }
                });
            };
            Controls.Add(connectBtn);
        }