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

            renderTexture              = new RenderTexture(MMW.RenderResolution);
            renderTexture.MagFilter    = TextureMagFilter.Linear;
            renderTexture.MinFilter    = TextureMinFilter.Linear;
            renderTexture.ColorFormat0 = MMW.Configuration.DefaultPixelFormat;
            renderTexture.Load();

            ccShader = (GLSLShader)MMW.GetAsset <Shader>("Color Collect");
            if (ccShader == null)
            {
                ccShader = new ColorCollectShader();
                MMW.RegistAsset(ccShader);
            }

            loc_con        = ccShader.GetUniformLocation("contrast");
            loc_sat        = ccShader.GetUniformLocation("saturation");
            loc_brt        = ccShader.GetUniformLocation("brightness");
            loc_resolution = ccShader.GetUniformLocation("resolutionInverse");
            loc_mvp        = ccShader.GetUniformLocation("MVP");

            if (GameObject != null)
            {
                Camera        = GameObject.GetComponent <Camera>();
                RenderTexture = Camera.TargetTexture;
            }

            orthoMatrix = Matrix4.CreateOrthographicOffCenter(-1, 1, -1, 1, -1, 1);
        }
Ejemplo n.º 2
0
        protected internal override void OnLoad()
        {
            base.OnLoad();

            renderTexture              = new RenderTexture(MMW.RenderResolution);
            renderTexture.MagFilter    = TextureMagFilter.Linear;
            renderTexture.MinFilter    = TextureMinFilter.Linear;
            renderTexture.WrapMode     = TextureWrapMode.MirroredRepeat;
            renderTexture.ColorFormat0 = MMW.Configuration.DefaultPixelFormat;
            renderTexture.Load();

            dofShader = (BokehDoFShader)MMW.GetAsset <Shader>("Bokeh DoF");
            if (dofShader == null)
            {
                dofShader = new BokehDoFShader();
                MMW.RegistAsset(dofShader);
            }

            if (GameObject != null)
            {
                Camera        = GameObject.GetComponent <Camera>();
                RenderTexture = Camera.TargetTexture;
            }

            orthoMatrix = Matrix4.CreateOrthographicOffCenter(-1, 1, -1, 1, -1, 1);
        }
Ejemplo n.º 3
0
        public SelectWorldPanel(WorldInfo info)
        {
            Info         = info;
            defBackImage = Resources.mmw_defaultbackpanel;

            texImage = MMW.GetAsset <Texture2D>("default back panel");
            if (texImage == null)
            {
                texImage      = new Texture2D(defBackImage);
                texImage.Name = "default back panel";
                MMW.RegistAsset(texImage);
            }
            if (!texImage.Loaded)
            {
                texImage.Load();
            }

            Clicked += (s, e) => SelectedPanel = this;

            timer = new Timer((t) =>
            {
                var data = NetworkUtil.QueryWorldInfoUdp(info.HostName, info.Port);
                ReceivedServerDesc(data);
            }, null, 0, 3000);
        }
Ejemplo n.º 4
0
        protected internal override void OnLoad()
        {
            base.OnLoad();

            renderTexture              = new RenderTexture(MMW.RenderResolution);
            renderTexture.MagFilter    = TextureMagFilter.Linear;
            renderTexture.MinFilter    = TextureMinFilter.Linear;
            renderTexture.ColorFormat0 = PixelFormat;
            renderTexture.Load();

            fxaaShader = (FXAAShader)MMW.GetAsset <Shader>("FXAA");
            if (fxaaShader == null)
            {
                fxaaShader = new FXAAShader();
                MMW.RegistAsset(fxaaShader);
            }

            if (GameObject != null)
            {
                Camera           = GameObject.GetComponent <Camera>();
                DstRenderTexture = Camera.TargetTexture;
            }

            orthoMatrix = Matrix4.CreateOrthographicOffCenter(-1, 1, -1, 1, -1, 1);
        }
Ejemplo n.º 5
0
        protected internal override void OnLoad()
        {
            base.OnLoad();

            var size = MMW.RenderResolution.Mul(1.0f / Reduct);

            if (RenderTexture != null)
            {
                size = RenderTexture.Size.Mul(1.0f / Reduct);
            }

            glareRT              = new RenderTexture(size);
            glareRT.MagFilter    = TextureMagFilter.Linear;
            glareRT.MinFilter    = TextureMinFilter.Linear;
            glareRT.WrapMode     = TextureWrapMode.ClampToEdge;
            glareRT.ColorFormat0 = MMW.Configuration.DefaultPixelFormat;
            glareRT.Load();

            glareLineShader = (GlareLineShader)MMW.GetAsset <Shader>("Glare Line");
            if (glareLineShader == null)
            {
                glareLineShader = new GlareLineShader();
                MMW.RegistAsset(glareLineShader);
            }

            glarePlusShader = (GlarePlusShader)MMW.GetAsset <Shader>("Glare Plus");
            if (glarePlusShader == null)
            {
                glarePlusShader = new GlarePlusShader();
                MMW.RegistAsset(glarePlusShader);
            }

            glareStarShader = (GlareStarShader)MMW.GetAsset <Shader>("Glare Star");
            if (glareStarShader == null)
            {
                glareStarShader = new GlareStarShader();
                MMW.RegistAsset(glareStarShader);
            }

            if (GameObject != null)
            {
                Camera        = GameObject.GetComponent <Camera>();
                RenderTexture = Camera.TargetTexture;
            }

            orthoMatrix = Matrix4.CreateOrthographicOffCenter(-1, 1, -1, 1, -1, 1);
        }
Ejemplo n.º 6
0
        protected internal override void OnLoad()
        {
            base.OnLoad();

            var size = MMW.RenderResolution.Mul(1.0f / Reduct);

            if (RenderTexture != null)
            {
                size = RenderTexture.Size.Mul(1.0f / Reduct);
            }

            renderTextureV              = new RenderTexture(size);
            renderTextureV.MagFilter    = TextureMagFilter.Linear;
            renderTextureV.MinFilter    = TextureMinFilter.Linear;
            renderTextureV.WrapMode     = TextureWrapMode.Repeat;
            renderTextureV.ColorFormat0 = PixelFormat;
            renderTextureV.Load();

            renderTextureH              = new RenderTexture(size);
            renderTextureH.MagFilter    = TextureMagFilter.Linear;
            renderTextureH.MinFilter    = TextureMinFilter.Linear;
            renderTextureH.WrapMode     = TextureWrapMode.Repeat;
            renderTextureH.ColorFormat0 = PixelFormat;
            renderTextureH.Load();

            blurVShader = (BlurVShader)MMW.GetAsset <Shader>("Blur Vertical");
            if (blurVShader == null)
            {
                blurVShader = new BlurVShader();
                MMW.RegistAsset(blurVShader);
            }

            blurHShader = (BlurHShader)MMW.GetAsset <Shader>("Blur Horizontal");
            if (blurHShader == null)
            {
                blurHShader = new BlurHShader();
                MMW.RegistAsset(blurHShader);
            }

            if (GameObject != null)
            {
                Camera        = GameObject.GetComponent <Camera>();
                RenderTexture = Camera.TargetTexture;
            }

            orthoMatrix = Matrix4.CreateOrthographicOffCenter(-1, 1, -1, 1, -1, 1);
        }
Ejemplo n.º 7
0
        protected internal override void OnLoad()
        {
            base.OnLoad();

            renderTexture = new RenderTexture(MMW.RenderResolution);
            renderTexture.ColorFormat0 = MMW.Configuration.DefaultPixelFormat;
            renderTexture.Load();

            ssaoShader = (SSAOUE4Shader)MMW.GetAsset <Shader>("SSAO UE4");
            if (ssaoShader == null)
            {
                ssaoShader = new SSAOUE4Shader();
                MMW.RegistAsset(ssaoShader);
            }

            if (GameObject != null)
            {
                Camera        = GameObject.GetComponent <Camera>();
                RenderTexture = Camera.TargetTexture;
            }

            orthoMatrix = Matrix4.CreateOrthographicOffCenter(-1, 1, -1, 1, -1, 1);
        }
Ejemplo n.º 8
0
        protected internal override void OnLoad()
        {
            base.OnLoad();

            // 書き出しRT
            glareRT              = new RenderTexture(MMW.RenderResolution);
            glareRT.MagFilter    = TextureMagFilter.Linear;
            glareRT.MinFilter    = TextureMinFilter.Linear;
            glareRT.ColorFormat0 = MMW.Configuration.DefaultPixelFormat;
            glareRT.Load();

            // HDR抽出RT
            hdrRT              = new RenderTexture(MMW.RenderResolution);
            hdrRT.MagFilter    = TextureMagFilter.Linear;
            hdrRT.MinFilter    = TextureMinFilter.Linear;
            hdrRT.ColorFormat0 = MMW.Configuration.DefaultPixelFormat;
            hdrRT.Load();

            // Blur適用RT
            blurRT1s = new RenderTexture[BlurNum];
            blurRT2s = new RenderTexture[BlurNum];
            blurRT3s = new RenderTexture[BlurNum];
            blurs    = new GlareBlur[BlurNum];
            var blurSizes = new Size[]
            {
                new Size(MMW.RenderResolution.Width / 4, MMW.RenderResolution.Height / 4),
                new Size(MMW.RenderResolution.Width / 8, MMW.RenderResolution.Height / 8),
                new Size(MMW.RenderResolution.Width / 16, MMW.RenderResolution.Height / 16),
            };
            var reduct = 1.0f;

            for (var i = 0; i < BlurNum; i++)
            {
                var size = blurSizes[i];
                if (size.Width < 128)
                {
                    size.Width = 128;
                }
                if (size.Height < 128)
                {
                    size.Height = 128;
                }

                blurRT1s[i]              = new RenderTexture(size);
                blurRT1s[i].MagFilter    = TextureMagFilter.Linear;
                blurRT1s[i].MinFilter    = TextureMinFilter.Linear;
                blurRT1s[i].WrapMode     = TextureWrapMode.ClampToEdge;
                blurRT1s[i].ColorFormat0 = MMW.Configuration.DefaultPixelFormat;
                blurRT1s[i].Load();

                blurRT2s[i]              = new RenderTexture(size);
                blurRT2s[i].MagFilter    = TextureMagFilter.Linear;
                blurRT2s[i].MinFilter    = TextureMinFilter.Linear;
                blurRT2s[i].WrapMode     = TextureWrapMode.ClampToEdge;
                blurRT2s[i].ColorFormat0 = MMW.Configuration.DefaultPixelFormat;
                blurRT2s[i].Load();

                blurRT3s[i]              = new RenderTexture(size);
                blurRT3s[i].MagFilter    = TextureMagFilter.Linear;
                blurRT3s[i].MinFilter    = TextureMinFilter.Linear;
                blurRT3s[i].WrapMode     = TextureWrapMode.ClampToEdge;
                blurRT3s[i].ColorFormat0 = MMW.Configuration.DefaultPixelFormat;
                blurRT3s[i].Load();

                blurs[i] = new GlareBlur(3.0f * reduct, Direction, GlareBlur.GlareType.Line);
                blurs[i].RenderTexture = blurRT1s[i];
                blurs[i].OnLoad();
                reduct *= 2.0f;
            }

            // HDR抽出シェーダ
            hdrShader = (ExtractHDRShader)MMW.GetAsset <Shader>("Extract HDR");
            if (hdrShader == null)
            {
                hdrShader = new ExtractHDRShader();
                MMW.RegistAsset(hdrShader);
            }

            // Bloomシェーダ
            glareShader = (GlareShader)MMW.GetAsset <Shader>("Glare");
            if (glareShader == null)
            {
                glareShader = new GlareShader();
                MMW.RegistAsset(glareShader);
            }

            if (GameObject != null)
            {
                Camera        = GameObject.GetComponent <Camera>();
                RenderTexture = Camera.TargetTexture;
            }

            orthoMatrix = Matrix4.CreateOrthographicOffCenter(-1, 1, -1, 1, -1, 1);
        }
Ejemplo n.º 9
0
        protected internal override void OnLoad()
        {
            base.OnLoad();

            // 書き出しRT
            toneRT = new RenderTexture(MMW.RenderResolution);
            toneRT.Load();

            // 平均輝度RT
            aveRT = new RenderTexture(MMW.RenderResolution.Mul(0.5f));
            aveRT.Load();

            // 縮小RT
            var size = 256;
            var rts  = new List <RenderTexture>();

            while (size >= 1)
            {
                var rt = new RenderTexture(size, size);
                rt.Load();
                rts.Add(rt);
                size /= 4;
            }
            shrinkRTs = rts.ToArray();

            // 平均輝度抽出シェーダ
            aveShader = (AverageBrightShader)MMW.GetAsset <Shader>("Average Bright");
            if (aveShader == null)
            {
                aveShader = new AverageBrightShader();
                MMW.RegistAsset(aveShader);
            }

            // 縮小シェーダ
            shrinkShader = (ShrinkShader)MMW.GetAsset <Shader>("Shrink");
            if (shrinkShader == null)
            {
                shrinkShader = new ShrinkShader();
                MMW.RegistAsset(shrinkShader);
            }

            // トーンマッピングシェーダ
            toneShader = (ToneMappingShader)MMW.GetAsset <Shader>("Tone Mapping");
            if (toneShader == null)
            {
                toneShader = new ToneMappingShader();
                MMW.RegistAsset(toneShader);
            }

            if (GameObject != null)
            {
                Camera        = GameObject.GetComponent <Camera>();
                RenderTexture = Camera.TargetTexture;
            }

            orthoMatrix = Matrix4.CreateOrthographicOffCenter(-1, 1, -1, 1, -1, 1);

            GL.GenBuffers(1, out ssbo_lum);
            GL.BindBuffer(BufferTarget.ShaderStorageBuffer, ssbo_lum);
            GL.BufferData(BufferTarget.ShaderStorageBuffer, 16, new float[] { 1.0f, 0.7f, 1.0f, 0.7f }, BufferUsageHint.StaticDraw);
            GL.BindBuffer(BufferTarget.ShaderStorageBuffer, 0);
        }
Ejemplo n.º 10
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);
                        });
                    }
                });
            };
        }
Ejemplo n.º 11
0
        public override void OnTcpReceived(int dataType, byte[] dt)
        {
            if (dataType != DataType.LoginResult)
            {
                return;
            }

            var res = -1;

            Buffer.Read(dt, br =>
            {
                res = br.ReadInt32();
                if (res >= 0)
                {
                    Server.SessionID = res;
                }
            });

            if (res >= 0)
            {
                var ls = MMW.FindGameComponent <LoadingScript>();
                ls.StartLoading((mes) =>
                {
                    MMW.DestroyGameObjects(o => o.Tags.Contains("title"));

                    mes.mes  = "Download Data...";
                    var desc = Server.RequestJson <NwWorldDataDesc>(Walker.DataType.RequestDataDesc, null, Walker.DataType.ResponseDataDesc, 8000);

                    if (desc == null)
                    {
                        return(null);
                    }

                    var data = new NwWorldData();

                    data.Worlds = new NwWorld[desc.Worlds.Length];
                    for (var i = 0; i < desc.Worlds.Length; i++)
                    {
                        mes.mes = $"Download World...({i + 1}/{desc.Worlds.Length})";

                        var world = Server.RequestCompJson <NwWorld>(Walker.DataType.RequestWorld, new NwRequest(desc.Worlds[i].Hash), Walker.DataType.ResponseWorld, 10 * 60 * 1000);
                        if (world == null)
                        {
                            return(null);
                        }
                        world.Hash     = desc.Worlds[i].Hash;
                        data.Worlds[i] = world;
                    }

                    data.Characters = new NwCharacter[desc.Characters.Length];
                    for (var i = 0; i < desc.Characters.Length; i++)
                    {
                        mes.mes = $"Download Character...({i + 1}/{desc.Characters.Length})";

                        var ch = Server.RequestCompJson <NwCharacter>(Walker.DataType.RequestCharacter, new NwRequest(desc.Characters[i].Hash), Walker.DataType.ResponseCharacter, 3 * 60 * 1000);
                        if (ch == null)
                        {
                            return(null);
                        }
                        ch.Hash            = desc.Characters[i].Hash;
                        data.Characters[i] = ch;
                    }

                    data.Objects = new NwObject[desc.Objects.Length];
                    for (var i = 0; i < desc.Objects.Length; i++)
                    {
                        mes.mes = $"Download Object...({i + 1}/{desc.Objects.Length})";

                        var obj = Server.RequestCompJson <NwObject>(Walker.DataType.RequestObject, new NwRequest(desc.Objects[i].Hash), Walker.DataType.ResponseObject, 3 * 60 * 1000);
                        if (obj == null)
                        {
                            return(null);
                        }
                        obj.Hash        = desc.Objects[i].Hash;
                        data.Objects[i] = obj;
                    }

                    data.GameObjectScripts = new NwGameObjectScript[desc.GameObjectScripts.Length];
                    for (var i = 0; i < desc.GameObjectScripts.Length; i++)
                    {
                        mes.mes = $"Download Scripts...({i + 1}/{desc.GameObjectScripts.Length})";

                        var bytes = Server.Request(Walker.DataType.RequestGameObjectScript, new NwRequest(desc.GameObjectScripts[i].Hash), Walker.DataType.ResponseGameObjectScript, 60 * 1000);
                        if (bytes == null)
                        {
                            return(null);
                        }
                        data.GameObjectScripts[i] = new NwGameObjectScript()
                        {
                            Assembly = bytes,
                            Hash     = desc.GameObjectScripts[i].Hash,
                        };
                    }

                    // ゲームオブジェクトを取得
                    var objects      = Server.RequestJson <NwGameObjects>(Walker.DataType.RequestGameObjects, new byte[0], Walker.DataType.ResponseGameObjects, 3 * 60 * 1000);
                    data.GameObjects = objects.GameObjects;

                    mes.mes = "Creating a world...";
                    Thread.Sleep(10);
                    return(data);
                },
                                (arg) =>
                {
                    if (arg == null)
                    {
                    }
                    MMW.RegistAsset(Server);
                    var go = new GameObject("Walker");
                    go.Tags.Add("walker");
                    go.Tags.Add("system");
                    go.AddComponent <WalkerScript>((NwWorldData)arg);

                    MMW.RegistGameObject(go);

                    return(true);
                });
            }
            else
            {
                AcceptInput     = true;
                labelInfo.Text  = "Login Failed";
                labelInfo.Brush = Brushes.Red;
            }
        }
Ejemplo n.º 12
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));
        }