Esempio n. 1
0
        public void NewList(object sender, RoutedEventArgs args)
        {
            Background            = new SolidColorBrush(Color.FromRgb(0, 200, 200));
            label                 = new TextBox();
            label.FontFamily      = font;
            container             = new ListContainer();
            label.Text            = "NewToDoList";
            label.Background      = new SolidColorBrush(Color.FromRgb(0, 200, 200));
            label.BorderThickness = new Thickness(0);
            AllowDrop             = true;

            button_add = new Button();
            button_add.HorizontalAlignment = HorizontalAlignment.Stretch;
            button_add.VerticalAlignment   = VerticalAlignment.Bottom;
            button_add.BorderThickness     = new Thickness(0);
            button_add.Background          = new SolidColorBrush(accent);
            button_add.Content             = "Add";
            button_add.Click     += b_Add;
            button_add.FontFamily = font;
            GridContent.Height    = container.Height;
            GridContent.Children.Add(label);
            GridContent.Children.Add(container);
            GridContent.Children.Add(button_add);
            GridContent.UpdateLayout();
            ThemeManager_IsThemeChanged(null, null);
        }
Esempio n. 2
0
    private void Awake()
    {
        level = 0;

        gridContent = GameObject.FindWithTag("Grid").GetComponent <GridContent>();
        if (gameObject.tag == "Probe")
        {
            panel.SetActive(false);
        }

        player    = GameObject.FindWithTag("Player").GetComponent <SolveInput>();
        text      = gameObject.GetComponentInChildren <Text>();
        text.text = "";
        myImage   = gameObject.GetComponent <Image>();
        Button btn = this.GetComponent <Button>();

        btn.onClick.AddListener(OnClick);
        if (gameObject.tag == "Probe")
        {
            countDown = probeCoolingCount;
        }
        if (gameObject.tag == "Clone")
        {
            countDown = cloneCoolingCount;
        }
        if (gameObject.tag == "Interference")
        {
            countDown = ITFCoolingCount;
        }
        Unlock    = true;
        inCooling = false;
        timer     = 0f;
    }
Esempio n. 3
0
 public void Refresh()
 {
     if (null != GridContent)
     {
         GridContent.RefreshCell();
     }
 }
Esempio n. 4
0
    public State GetState()
    {
        List <GridWithContent> vision = new List <GridWithContent>();

        foreach (Vector2Int pos in hunterVisionGrids)
        {
            GridContent content = GridContent.Empty;
            foreach (Monster monster in monsterObjs)
            {
                Vector2Int monsterPos = Helper.GridVector(monster.transform.position);
                if (monsterPos.Equals(pos))
                {
                    content = GridContent.Monster;
                    break;
                }
            }
            vision.Add(new GridWithContent(pos, content));
        }

        State state = new State();

        state.Vision                   = vision;
        state.MonsterCount             = monsterObjs.Count;
        state.MapSize                  = TheGridManager.mapSize;
        state.HunterPosition           = TheHunter.targetPosition;
        state.HunterRotation           = Mathf.RoundToInt(TheHunter.targetRotation.eulerAngles.y);
        state.HunterProjectileDistance = HunterProjectileDistance;

        return(state);
    }
Esempio n. 5
0
        public UIWrapGrid(GameObject cellPrefab, int dataCount)
        {
            if (null == cellPrefab)
            {
                Console.Error.WriteLine("[UIWrapGrid Error] cellPrefab = Null!");
            }

            var content = cellPrefab.transform.parent;

            if (null == content)
            {
                Console.Error.WriteLine("[UIWrapGrid Error] cellPrefab.parent = Null!");
            }

            var viewPort = content.transform.parent;

            if (null == viewPort)
            {
                Console.Error.WriteLine("[UIWrapGrid Error] cellPrefab.parent.parent = Null!");
            }

            GridContent = viewPort.GetComponent <UIWrapGridContent>();
            if (GridContent == null)
            {
                Console.Error.WriteLine("[UIWrapGrid Error] No has UIWrapGridContent");
            }

            _CreateItemPools(cellPrefab);
            _gridSize = dataCount;
            GridContent.Init(this);
        }
        public int GetRowIndex(string rowId)
        {
            _longWait.Until(d => GridContent.Exists());
            Rows.WaitUntilAny();
            int idColumnIndex = GetColumnIndex(_idColumnName);

            return(Rows.GetIndex(rowId, IdSelector));
        }
Esempio n. 7
0
 void Awake()
 {
     if (Instance != null && Instance != this)
     {
         Destroy(this);
         throw new System.Exception("An instance of this singleton already exists.");
     }
     else
     {
         Instance = this;
     }
 }
Esempio n. 8
0
 private async Task ManageActionsVisibility()
 {
     if (GridActions.TranslationX == 0)
     {
         await Task.WhenAll(GridContent.TranslateTo(0, 0),
                            GridActions.TranslateTo(-panelTranslation, 0));
     }
     else
     {
         await Task.WhenAll(GridContent.TranslateTo(panelTranslation, 0),
                            GridActions.TranslateTo(0, 0));
     }
 }
Esempio n. 9
0
        public void Can_identify_contents(int x, int y, GridContent expected)
        {
            // Given a grid
            var input = new string[]
            {
                ".....",
                "xxxxx",
                "x.x.x",
                ".x.x."
            };

            Grid grid = new Grid(new GridInputToBytes(), input);

            // When I ask for the grid contents
            GridContent content = grid.ContentsAt(new Position(x, y));

            // Then the contents are as expected
            Assert.Equal(expected, content);
        }
Esempio n. 10
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            dataGrid.Items.Clear();
            Version.Content = "RemoteDesktopClient " + version + ", Dominik Tulak, 2019";
            GridConent      = new List <GridContent>();
            ConfigEditor.ReadConfig();
            config = ConfigEditor.GetFullConfig();

            for (int i = 0; i < config.Count; i++)
            {
                GridContent gc = new GridContent();
                gc.popis = config[i].remoteName;
                gc.port  = config[i].remotePort;
                gc.stav  = "Neaktivní";
                gc.color = "red";
                if (TestPort(config[i].remoteHost, config[i].remotePort))
                {
                    gc.port  = config[i].remotePort;
                    gc.color = "green";
                    gc.stav  = "Aktivní";
                    config[i].workingPort = config[i].remotePort;
                }
                else
                {
                    for (int j = 0; j < config[i].alternativePorts.Count; j++)
                    {
                        if (TestPort(config[i].remoteHost, config[i].alternativePorts[j]))
                        {
                            gc.port  = config[i].alternativePorts[j];
                            gc.color = "green";
                            gc.stav  = "Aktivní";
                            config[i].workingPort = config[i].alternativePorts[j];
                        }
                    }
                }
                gc.host   = config[i].remoteHost + ":" + ((config[i].workingPort == 0)?config[i].remotePort.ToString():config[i].workingPort.ToString());
                gc.button = (config[i].remoteName);
                dataGrid.Items.Add(gc);
                GridConent.Add(gc);
            }
            this.Title = "RemoteDesktop Client";
        }
Esempio n. 11
0
    private void Awake()
    {
        gridCanvas = GetComponentInChildren <Canvas>();
        hexMesh    = GetComponentInChildren <HexMesh>();
        cells      = new HexCell[height * width];

        //方政言加,为现实格子内容
        texts       = new Text[height * width];
        gridcontent = GetComponent <GridContent>();
        gridcontent.BuildContent(height * width);
        images = new Image[height * width];
        //方政言加end,为现实格子内容

        for (int z = 0, i = 0; z < height; z++)
        {
            for (int x = 0; x < width; x++)
            {
                CreateCell(x, z, i++);
            }
        }
    }
Esempio n. 12
0
    private void spawnObstacle()
    {
        bool spawned      = false;
        int  maximunTries = 10;

        while (!spawned && maximunTries > 0)
        {
            int obstacleX = Random.Range(1, gridWidth - 2);
            int obstacleY = Random.Range(1, gridHeight - 2);

            if (tileContent[obstacleX, obstacleY] == null)
            {
                GridContent obstacle = Instantiate(this.obstacle, gridToWorldCoord(obstacleX, obstacleY), Quaternion.identity, this.transform);
                obstacle.transform.Translate(new Vector3(0, 0, -1));
                tileContent[obstacleX, obstacleY] = obstacle;
                iTween.ScaleFrom(obstacle.gameObject, iTween.Hash("x", 0, "y", 0, "easetype", iTween.EaseType.easeInOutQuad, "time", 0.5f));
                spawned = true;
            }
            maximunTries--;
        }
    }
Esempio n. 13
0
        public void TestSendGridLinearMessage()
        {
            ComplexMessageContent complexMessageContent = new ComplexMessageContent("Grid线性消息概要", ComplexMessageType.Linear);

            TitleLinearComplexMessageContentItem title = new TitleLinearComplexMessageContentItem("Grid标题");
            TextLinearComplexMessageContentItem  hint  = new TextLinearComplexMessageContentItem("Grid提示");

            GridContent gridContent = new GridContent(2);

            gridContent.AddColumn(new Column("姓名", Alignment.Center, 40));
            gridContent.AddColumn(new Column("部门", Alignment.Left, 60));
            gridContent.AddData(new String[] { "张三", "云应用平台部" });
            gridContent.AddData(new String[] { "李四", "云应用体验部" });
            GridLinearComplexMessageContentItem grid = new GridLinearComplexMessageContentItem(gridContent);

            complexMessageContent.AddMessageContentItem(title).AddMessageContentItem(grid).AddMessageContentItem(hint);

            SendMessageResult result = _messageClient.SendSingleMessage(complexMessageContent, new PersonMessageReceiver("zhongt", "钟涛"));

            Assert.AreEqual(true, result.Success);
        }
Esempio n. 14
0
        public void Selects_start_position()
        {
            // Given a grid
            var input = new string[]
            {
                ".....",
                "xxxxx",
                "x.x.x",
                ".x.x."
            };

            Grid grid = new Grid(new GridInputToBytes(), input);

            // When I set the start position
            var    position = new Position(2, 1);
            CatBot bot      = new CatBot(position);

            GridContent content = grid.ContentsAt(bot.Position);

            // Then the position is set
            Assert.Equal(position, bot.Position);
        }
Esempio n. 15
0
    private void spawnPowerUp()
    {
        bool spawned      = false;
        int  maximunTries = 10;

        while (!spawned && maximunTries > 0)
        {
            int powerUpX = Random.Range(1, gridWidth - 2);
            int powerUpY = Random.Range(1, gridHeight - 2);

            if (tileContent[powerUpX, powerUpY] == null)
            {
                GridContent powerUp = Instantiate(superDrill, gridToWorldCoord(powerUpX, powerUpY), Quaternion.identity, this.transform);
                powerUp.transform.Translate(new Vector3(0, 0, -1));
                tileContent[powerUpX, powerUpY] = powerUp;

                iTween.ScaleFrom(powerUp.gameObject, iTween.Hash("x", 0, "y", 0, "easetype", iTween.EaseType.easeOutBounce, "time", 0.5f));

                spawned = true;
            }
            maximunTries--;
        }
    }
Esempio n. 16
0
        public void SetContent(UIElement content)
        {
            GridContent.FadeOut(Extensions.ContentFadeDuration);

            new Thread(() =>
            {
                Thread.Sleep(Extensions.ContentFadeDuration);

                GridContent.Dispatcher.Invoke(() =>
                {
                    GridContent.Children.Clear();

                    if (content != null)
                    {
                        GridContent.Children.Add(content);
                    }

                    GridContent.FadeIn(Extensions.ContentFadeDuration);

                    GC.Collect();
                    GC.WaitForPendingFinalizers();
                });
            }).Start();
        }
Esempio n. 17
0
 public GridWithContent(Vector2Int position, GridContent content)
 {
     this.Position = position;
     this.Content  = content;
 }
        protected void BindContentGrid()
        {
            List <App_Code.ContentView> ContentList = new List <App_Code.ContentView>();

            if (GridContent.DataSource == null)
            {
                ContentList = App_Code.ContentService.ListContent();
            }
            else
            {
                ContentList = (List <App_Code.ContentView>)GridContent.DataSource;
            }



            string[] SortExp = ViewState["SortExpr"].ToString().Split(' ');

            if (SortExp[0] == "Category")
            {
                if (SortExp[1] == "ASC")
                {
                    App_Code.ContentView.SortOnCategoryASC SOC = new App_Code.ContentView.SortOnCategoryASC();
                    ContentList.Sort(SOC);
                }
                else
                {
                    App_Code.ContentView.SortOnCategoryDSC SOC = new App_Code.ContentView.SortOnCategoryDSC();
                    ContentList.Sort(SOC);
                }
            }
            else if (SortExp[0] == "Title")
            {
                if (SortExp[1] == "ASC")
                {
                    App_Code.ContentView.SortOnLanguagesASC SOC = new App_Code.ContentView.SortOnLanguagesASC();
                    ContentList.Sort(SOC);
                }
                else
                {
                    App_Code.ContentView.SortOnTitleDSC SOC = new App_Code.ContentView.SortOnTitleDSC();
                    ContentList.Sort(SOC);
                }
            }
            else if (SortExp[0] == "Author")
            {
                if (SortExp[1] == "ASC")
                {
                    App_Code.ContentView.SortOnAuthorASC SOC = new App_Code.ContentView.SortOnAuthorASC();
                    ContentList.Sort(SOC);
                }
                else
                {
                    App_Code.ContentView.SortOnAuthorDSC SOC = new App_Code.ContentView.SortOnAuthorDSC();
                    ContentList.Sort(SOC);
                }
            }
            else if (SortExp[0] == "ModDate")
            {
                if (SortExp[1] == "ASC")
                {
                    App_Code.ContentView.SortOnDateASC SOC = new App_Code.ContentView.SortOnDateASC();
                    ContentList.Sort(SOC);
                }
                else
                {
                    App_Code.ContentView.SortOnDateDSC SOC = new App_Code.ContentView.SortOnDateDSC();
                    ContentList.Sort(SOC);
                }
            }
            else if (SortExp[0] == "Versions")
            {
                if (SortExp[1] == "ASC")
                {
                    App_Code.ContentView.SortOnVersionASC SOC = new App_Code.ContentView.SortOnVersionASC();
                    ContentList.Sort(SOC);
                }
                else
                {
                    App_Code.ContentView.SortOnVersionsDSC SOC = new App_Code.ContentView.SortOnVersionsDSC();
                    ContentList.Sort(SOC);
                }
            }
            else if (SortExp[0] == "Languages")
            {
                if (SortExp[1] == "ASC")
                {
                    App_Code.ContentView.SortOnLanguagesASC SOC = new App_Code.ContentView.SortOnLanguagesASC();
                    ContentList.Sort(SOC);
                }
                else
                {
                    App_Code.ContentView.SortOnLanguagesDSC SOC = new App_Code.ContentView.SortOnLanguagesDSC();
                    ContentList.Sort(SOC);
                }
            }


            GridContent.DataSource = ContentList;
            GridContent.DataBind();
        }
Esempio n. 19
0
    private void Awake()
    {
        locked = 0;
        grid   = GameObject.FindWithTag("Grid").GetComponent <HexGrid>();
        //于沛琦加,绑定地图探索text
        MapExplore            = GameObject.FindWithTag("MapExplore").GetComponent <Text>();
        ExplorePic            = GameObject.FindWithTag("ExplorePic").GetComponent <Image>();
        ExplorePic.fillAmount = 0.0f;
        //于沛琦加end
        //方政言加,为实现网格内容探测
        gridcontent = GameObject.FindWithTag("Grid").GetComponent <GridContent>();
        //方政言加end
        camera = GameObject.FindWithTag("MainCamera").GetComponent <CameraController>();
        if (camera == null)
        {
            Debug.Log("camera not set");
        }

        myInput = camera.GetComponent <MyInput>();
        //设定初始格,并修改颜色
        int index;

        //for (int i = 0; i < grid.height; i++)
        //{
        //    if (i == 0 || i == grid.height - 1)
        //    {
        //        for (int j = 0; j < grid.width; j++)
        //        {
        //            index = i * grid.height + j;
        //            Cell = grid.cells[index];
        //            Cell.color = grid.CellColor[4];
        //            grid.hexMesh.Triangulate(grid.cells);
        //        }
        //    }
        //    else
        //    {
        //        index = i * grid.height;
        //        Cell = grid.cells[index];
        //        Cell.color = grid.CellColor[4];
        //        grid.hexMesh.Triangulate(grid.cells);
        //        index = (i + 1) * grid.height - 1;
        //        Cell = grid.cells[index];
        //        Cell.color = grid.CellColor[4];
        //        grid.hexMesh.Triangulate(grid.cells);
        //        grid.hexMesh.Triangulate(grid.cells);
        //    }
        //}
        index             = 2 + 5 * grid.width + 5 / 2;
        CurrentCell       = grid.cells[index];
        CurrentCell.color = grid.CellColor[1];
        grid.hexMesh.Triangulate(grid.cells);
        UpdateArround(CurrentCell, CurrentCellAround, CurrentTextAround);
        PrintArround(grid.CellColor[2], CurrentCellAround);

        playerPos = grid.cells[index].transform.position;
        //方政言加,为实现网格内容探测
        CurrentText = index;
        gridcontent.start(CurrentText, CurrentTextAround);
        gridcontent.detectAround(CurrentTextAround);
        viewportalflag = false;
        viewsiflag     = false;
        //方政言加end
    }