Example #1
0
        public void Select(ClientComponent client)
        {
            if (SelectedItem == client)
            {
                return;
            }

            if (SelectedItem != null)
            {
                SelectedItem.Selected = false;
            }

            Entity entity;

            if (client != null)
            {
                client.Selected        = true;
                entity                 = client.Owner;
                Main.ClientMenu.Header = client.Name;
                Main.SearchKeyword.Focus();
            }
            else
            {
                entity = null;
                Main.ClientMenu.Header = Constant.None;
            }

            Entity = entity;

            SearchController.Select(entity);
            BrowseController.Select(entity);
        }
Example #2
0
        private void Download(IEnumerable items, string folder)
        {
            foreach (BrowseComponent browse in items)
            {
                if (browse.File)
                {
                    Download(browse);
                }
                else if (browse.Folder)
                {
                    ClientComponent client    = MenuController.SelectedItem;
                    string          subfolder = Path.Combine(folder, browse.Name);
                    string          path      = Path.Combine(client.Download, subfolder);
                    if (!DirectoryUtil.Exists(path))
                    {
                        DirectoryUtil.Create(path);
                    }

                    IEnumerable children = browse.GetChildren(browse);
                    if (children != null && !folder.Equals(subfolder))
                    {
                        Download(children, subfolder);
                    }
                }
            }
        }
        public override void Dispose()
        {
            if (this.IsDisposed)
            {
                return;
            }
            base.Dispose();

            //移除连接组件
            Game.Scene.RemoveComponent <SessionComponent>();
            ETModel.Game.Scene.RemoveComponent <ETModel.SessionComponent>();

            //释放本地玩家对象
            ClientComponent clientComponent = ETModel.Game.Scene.GetComponent <ClientComponent>();

            if (clientComponent.User != null)
            {
                clientComponent.User.Dispose();
                clientComponent.User = null;
            }

            //游戏关闭,不用回到登录界面
            UIComponent ui = Game.Scene.GetComponent <UIComponent>();

            if (ui == null || ui.IsDisposed)
            {
                return;
            }

            //跳转到登录界面,并删除大厅和房间的UI
        }
Example #4
0
        public void Add(ClientComponent client, ServerComponent server, GroupComponent group)
        {
            Entity entity = new Entity();

            entity.Add(client);

            ClientOptionsComponent options = new ClientOptionsComponent();

            entity.Add(options);

            entity.Add(server);

            entity.Add(group);

            FolderListComponent folderList = new FolderListComponent();

            entity.Add(folderList);

            FileMapComponent fileMap = new FileMapComponent();

            entity.Add(fileMap);

            FolderMapComponent folderMap = new FolderMapComponent();

            entity.Add(folderMap);

            ClientMachineComponent machine = new ClientMachineComponent();

            entity.Add <MachineComponent>(machine);

            SessionComponent session = new SessionComponent();

            entity.Add(session);

            FileComponent file = new FileComponent();

            entity.Add(file);

            SearchListComponent search = new SearchListComponent(SearchController.Dispatcher);

            entity.Add(search);

            BrowseComponent browse = new BrowseComponent();

            entity.Add(browse);

            DownloadListComponent download = new DownloadListComponent(DownloadController.Dispatcher);

            entity.Add(download);

            UploadListComponent upload = new UploadListComponent(UploadController.Dispatcher);

            entity.Add(upload);
#if DEBUG
            LogComponent log = new LogComponent(LogController);
            entity.Add(log);
#endif
            Add(entity);
        }
Example #5
0
        /// <summary>
        /// Setup any of subscriptions
        /// </summary>
        public override void SetupSubscriptions(ClientComponent parentComponent)
        {
            base.SetupSubscriptions(parentComponent);

            PrivateState.ClientSubscribe(
                s => s.CurrentActionState,
                OnActionStateChanged,
                parentComponent);
        }
Example #6
0
        public RheinwerkGame()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";
            graphics.IsFullScreen = false;
            IsMouseVisible        = true;

            Input             = new InputComponent(this);
            Input.UpdateOrder = 0;
            Components.Add(Input);

            Screen             = new ScreenComponent(this);
            Screen.UpdateOrder = 1;
            Screen.DrawOrder   = 2;
            Components.Add(Screen);

            Local             = new LocalComponent(this);
            Local.UpdateOrder = 2;
            Components.Add(Local);

            var client = new ClientComponent(this);

            Client             = client;
            client.UpdateOrder = 3;
            Components.Add(client);

            var server = new ServerComponent(this);

            Server             = server;
            server.UpdateOrder = 4;
            Components.Add(server);

            Simulation             = new SimulationComponent(this);
            Simulation.UpdateOrder = 5;
            Components.Add(Simulation);

            Scene             = new SceneComponent(this);
            Scene.UpdateOrder = 6;
            Scene.DrawOrder   = 0;
            Components.Add(Scene);

            Hud             = new HudComponent(this);
            Hud.UpdateOrder = 7;
            Hud.DrawOrder   = 1;
            Components.Add(Hud);

            Music             = new MusicComponent(this);
            Music.UpdateOrder = 8;
            Components.Add(Music);

            Sound             = new SoundComponent(this);
            Sound.UpdateOrder = 9;
            Components.Add(Sound);

            // Einstellungen laden
            Settings = Settings.LoadSettings();
        }
Example #7
0
        private void ClientMenu_Click(object sender, RoutedEventArgs e)
        {
            MenuItem item = sender as MenuItem;

            if (item != null)
            {
                ClientComponent client = (ClientComponent)item.Header;
                MenuController.Select(client);
            }
        }
        /// <summary>
        /// Init on component enabled.
        /// </summary>
        public override void Start(ClientComponent parentComponent)
        {
            base.Start(parentComponent);

            lastSelectedItem = SelectedItem;
            if (SelectedItem != null)
            {
                itemAlerts.Add(SelectedItem, new AlertDetails());
            }
            ClientHotbarSelectedItemManager.SelectedItemChanged += SelectedItemChanged;
        }
    // Use this for initialization
    void Start()
    {
        client    = GetComponent <ClientComponent>();
        inventory = GetComponent <PlayerInventory>();

        breakStageTextures = new Texture2D[10];
        for (int i = 0; i < 10; i++)
        {
            breakStageTextures[i] = (Texture2D)Resources.Load("Images/Block_Break_Animation/destroy_stage_" + i);
        }
    }
Example #10
0
        public override void Save()
        {
            Clients.Sort(delegate(Entity entity1, Entity entity2)
            {
                ClientComponent client1 = entity1.Get <ClientComponent>();
                ClientComponent client2 = entity2.Get <ClientComponent>();
                return(client1.Name.CompareTo(client2.Name));
            });

            base.Save();
        }
Example #11
0
        public void Select(Entity entity)
        {
            if (entity == null)
            {
                return;
            }

            ClientComponent client = entity.Get <ClientComponent>();

            Select(client);
        }
Example #12
0
 void SearchForClientComp()
 {
     ClientComponent[] ccs = FindObjectsOfType <ClientComponent>();
     if (ccs.Length != 1)
     {
         Debug.LogError("Wrong number of ClientComponent: " + ccs.Length + " (should be 1).");
         return;
     }
     cc = ccs[0];
     cc.client.MessagesHandler = MessageReceived;
 }
Example #13
0
 public UpdateClient(Client client, ClientsForm parentForm)
 {
     InitializeComponent();
     textBox1.Text       = client.lastName;
     textBox2.Text       = client.firstName;
     textBox3.Text       = client.middleName;
     textBox4.Text       = client.email;
     maskedTextBox1.Text = client.telephone;
     clientComponent     = new ClientComponent();
     parent      = parentForm;
     clientIndex = client.id;
 }
Example #14
0
        /// <summary>
        /// Init on component enabled.
        /// </summary>
        public override void Start(ClientComponent parentComponent)
        {
            base.Start(parentComponent);

            ContainerHotbar.ItemRemoved      += ContainerHotbarOnItemRemoved;
            ContainerHotbar.ItemCountChanged += ContainerHotbarOnItemCountChanged;

            // Check if there an action in progress.
            if (PrivateState.CurrentActionState != null)
            {
                lastActionState = PrivateState.CurrentActionState;
            }
        }
Example #15
0
        public void Add(Entity entity)
        {
            ClientComponent client = entity.Get <ClientComponent>();

            client.ComponentChanged += Update;

            Menu.Add(client);
            Menu.Sort();

            if (Count == 1)
            {
                Select();
            }
        }
Example #16
0
    // Use this for initialization
    void Start()
    {
        INSTANCE = this;

        GameObject obj = new GameObject();

        obj.name = "Loom Object";
        obj.AddComponent(typeof(Loom));

        Block.InitializePrototypes();

        client = new CloudLandClient(this);
        client.connect(LoginScreen.addr, 21098);
    }
Example #17
0
        public void Toggle(Entity entity)
        {
            ClientComponent  client  = entity.Get <ClientComponent>();
            MachineComponent machine = entity.Get <MachineComponent>();

            client.Enabled = !client.Enabled;

            if (client.Enabled)
            {
                machine.Start();
            }
            else
            {
                machine.Stop();
            }
        }
Example #18
0
        public ActionResult Register()
        {
            ClientComponent clientComp = new ClientComponent();
            var             clients    = clientComp.GetClients();

            var model = new RegisterViewModel();

            model.Clients = clients
                            .Select(s => new SelectListItem
            {
                Value = s.ClientId.ToString(),
                Text  = s.CompanyName
            }).ToList();

            return(View(model));
        }
Example #19
0
    public async Task TestConnection()
    {
        var gameObject = new GameObject();

        component = gameObject.AddComponent <ClientComponent>();

        await Task.Run(() =>
        {
            component.room.OnJoin += () => {
                Assert.NotNull(component.room.Id);
                Assert.NotNull(component.room.SessionId);
            };

            component.room.OnStateChange += (State state, bool isFirstState) => {
                Assert.NotNull(component.room.State.entities);
            };
        });
    }
Example #20
0
 public void delete(UpdateClientRequest request)
 {
     try
     {
         var response = new UpdateClientResponse();
         var bc       = new ClientComponent();
         bc.Update(request.Client);
     }
     catch (Exception ex)
     {
         var httpError = new HttpResponseMessage()
         {
             StatusCode   = (HttpStatusCode)422,
             ReasonPhrase = ex.Message
         };
         throw new HttpResponseException(httpError);
     }
 }
Example #21
0
        public void OnEnable()
        {
            if (_profile == null)
            {
                Debug.LogError("Please drag a CubizerProfile into Inspector.");
            }

            _context                 = new CubizerContext();
            _context.profile         = _profile;
            _context.behaviour       = this;
            _context.materialFactory = _materialFactory;

            _lives           = AddComponent(new LiveManagerComponent());
            _chunkManager    = AddComponent(new ChunkManagerComponent());
            _biomeManager    = AddComponent(new BiomeManagerComponent());
            _playerComponent = AddComponent(new PlayerComponent());
            _timeComponent   = AddComponent(new TimeComponent());
            _dbComponent     = AddComponent(new DbComponent());
            _serverComponent = AddComponent(new ServerComponent());
            _clientComponent = AddComponent(new ClientComponent());

            _lives.Init(_context, _profile.lives);

            _chunkManager.Init(_context, _profile.chunk);
            _chunkManager.callbacks.OnLoadChunkBefore   += this.OnLoadChunkDataBefore;
            _chunkManager.callbacks.OnLoadChunkAfter    += this.OnLoadChunkDataAfter;
            _chunkManager.callbacks.OnDestroyChunk      += this.OnDestroyChunkData;
            _chunkManager.callbacks.OnAddBlockBefore    += this.OnAddBlockBefore;
            _chunkManager.callbacks.OnAddBlockAfter     += this.OnAddBlockAfter;
            _chunkManager.callbacks.OnRemoveBlockBefore += this.OnRemoveBlockBefore;
            _chunkManager.callbacks.OnRemoveBlockAfter  += this.OnRemoveBlockAfter;

            _biomeManager.Init(_context, _profile.biome);
            _playerComponent.Init(_context, _profile.players);
            _timeComponent.Init(_context, _profile.time);
            _dbComponent.Init(_context, _profile.database);
            _serverComponent.Init(_context, _profile.network);
            _clientComponent.Init(_context, _profile.network);

            this.EnableComponents();

            StartCoroutine("UpdateComponentsWithCoroutine");
        }
Example #22
0
        /// <summary>
        /// Init on component enabled.
        /// </summary>
        public override void Start(ClientComponent parentComponent)
        {
            base.Start(parentComponent);

            // Check if there an action in progress.
            if (PrivateState.CurrentActionState != null)
            {
                readyForInteraction = false;
                lastActionState     = PrivateState.CurrentActionState;
            }

            // Check if we opened loot container before enabling component.
            var currentInteractionObject = InteractionCheckerSystem.SharedGetCurrentInteraction(CurrentCharacter);

            if (currentInteractionObject?.ProtoWorldObject is ProtoObjectLootContainer)
            {
                readyForInteraction = false;
            }
        }
Example #23
0
 public GetClientResponse getById(int id)
 {
     try
     {
         var response = new GetClientResponse();
         var bc       = new ClientComponent();
         response.Result = bc.Find(id);
         return(response);
     }
     catch (Exception ex)
     {
         var httpError = new HttpResponseMessage()
         {
             StatusCode   = (HttpStatusCode)422,
             ReasonPhrase = ex.Message
         };
         throw new HttpResponseException(httpError);
     }
 }
Example #24
0
 public AddClientResponse add(AddClientRequest request)
 {
     try
     {
         var response = new AddClientResponse();
         var bc       = new ClientComponent();
         response.Result = bc.Add(request.Client);
         return(response);
     }
     catch (Exception ex)
     {
         var httpError = new HttpResponseMessage()
         {
             StatusCode   = (HttpStatusCode)422,
             ReasonPhrase = ex.Message
         };
         throw new HttpResponseException(httpError);
     }
 }
Example #25
0
        public override void Dispose()
        {
            if (this.IsDisposed)
            {
                return;
            }

            base.Dispose();

            //移除连接组件
            Game.Scene.RemoveComponent <SessionComponent>();
            Game.Scene.ModelScene.RemoveComponent <ETModel.SessionComponent>();

            //释放本地玩家对象
            ClientComponent clientComponent = ETModel.Game.Scene.GetComponent <ClientComponent>();

            if (clientComponent.LocalPlayer != null)
            {
                clientComponent.LocalPlayer.Dispose();
                clientComponent.LocalPlayer = null;
            }

            UIComponent uiComponent = Game.Scene.GetComponent <UIComponent>();

            //游戏关闭,不用回到登录界面
            if (uiComponent == null || uiComponent.IsDisposed)
            {
                return;
            }

            UI uiLogin = uiComponent.Create(UIType.LandlordsLogin);

            uiLogin.GetComponent <LandlordsLoginComponent>().SetPrompt("连接断开");

            if (uiComponent.Get(UIType.LandlordsLobby) != null)
            {
                uiComponent.Remove(UIType.LandlordsLobby);
            }
            else if (uiComponent.Get(UIType.LandlordsRoom) != null)
            {
                uiComponent.Remove(UIType.LandlordsRoom);
            }
        }
Example #26
0
        private void ClientEditCommand_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            DemonSaw.Entity.Entity entity = ClientController.SelectedItem;
            ClientEditWindow       wnd    = new ClientEditWindow(entity)
            {
                Owner = this
            };

            bool result = (bool)wnd.ShowDialog();

            if (result)
            {
                // Client
                ClientComponent client = entity.Get <ClientComponent>();
                client.Name     = wnd.ClientName.Text;
                client.Download = wnd.DownloadPath.Text;

                // Group
                GroupComponent group        = entity.Get <GroupComponent>();
                bool           groupChanged = (entity == MenuController.Entity) && !group.Path.Equals(wnd.GroupPath.Text);
                group.Path        = wnd.GroupPath.Text;
                GroupImage.Source = group.Image;

                // Options
                ClientOptionsComponent options = entity.Get <ClientOptionsComponent>();
                options.MaxDownloads = int.Parse(wnd.MaxDownloads.Text);
                options.MaxUploads   = int.Parse(wnd.MaxUploads.Text);

                // Machine
                MachineComponent machine = entity.Get <MachineComponent>();
                machine.Restart();

                // Controller
                MenuController.Update();

                if (groupChanged)
                {
                    SearchController.Clear();
                    BrowseController.Clear();
                }
            }
        }
Example #27
0
        public AllClientsResponse getAll()
        {
            try
            {
                var response = new AllClientsResponse();
                var bc       = new ClientComponent();
                response.Result = bc.ToList();

                return(response);
            }
            catch (Exception ex)
            {
                var httpError = new HttpResponseMessage()
                {
                    StatusCode   = (HttpStatusCode)422,
                    ReasonPhrase = ex.Message
                };
                throw new HttpResponseException(httpError);
            }
        }
Example #28
0
        public override void Add(Entity entity)
        {
            base.Add(entity);

            // Events
            ClientComponent client = entity.Get <ClientComponent>();

            client.ComponentChanged += Update;

            FolderListComponent folders = entity.Get <FolderListComponent>();

            folders.ComponentChanged += FileController.Update;

            ClientMachineComponent machine = (ClientMachineComponent)entity.Get <MachineComponent>();

            machine.ListAdded += SearchController.Add;


            MenuController.Add(entity);
        }
Example #29
0
        public bool Remove(Entity entity)
        {
            ClientComponent client = entity.Get <ClientComponent>();

            client.ComponentChanged -= Update;

            bool removed = Menu.Remove(client);

            if (removed)
            {
                if (client == SelectedItem)
                {
                    SearchController.Clear();
                    BrowseController.Clear();
                    Select();
                }
            }

            return(removed);
        }
Example #30
0
        private void ClientAddCommand_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            ClientAddWindow wnd = new ClientAddWindow();

            wnd.Owner = this;

            bool result = (bool)wnd.ShowDialog();

            if (result)
            {
                if (!NetworkUtil.IsPortValid(wnd.Port.Text))
                {
                    return;
                }

                // Client
                ClientComponent client = new ClientComponent();
                client.Name     = wnd.ClientName.Text;
                client.Download = wnd.DownloadFolder.Text;
                client.Enabled  = true;

                // Router
                ServerComponent server = new ServerComponent();
                server.Address    = wnd.Address.Text;
                server.Port       = int.Parse(wnd.Port.Text);
                server.Passphrase = wnd.Passphrase.Text;

                // Group
                GroupComponent group = new GroupComponent();
                group.Path        = wnd.GroupPath.Text;
                GroupImage.Source = group.Image;

                ClientController.Add(client, server, group);
                ClientListView.SelectedIndex = ClientController.Count - 1;
                ClientController.Select();

                // Controller
                MenuController.Update();
                BrowseController.Select();
            }
        }