Ejemplo n.º 1
0
    public void PrimaryGridBtn()
    {
        GridBase          = GetComponent <UIGrid> ();
        MaxPerLine        = GridBase.maxPerLine;
        DefaultShowIndexs = new int[] { 0, 1, 2, 3, 4, 5 };
        ShowGridBtnObjs   = new List <GameObject> ();

        PrimaryXML();
        grids       = SeriaOrDeSeria.DeSerialzeXML(path, typeof(GridBtn[])) as GridBtn[];
        GridBtnObjs = new GameObject[grids.Length];
        for (int i = 0; i < grids.Length; i++)
        {
            GameObject ob = Instantiate(GridBtnPrefab) as GameObject;
            ob.transform.GetChild(0).GetComponent <UITexture>().mainTexture = Resources.Load <Texture>(grids[i].ImgPath);
            ob.name        = GridBtnPrefab.name + i.ToString();
            GridBtnObjs[i] = ob;
            ob.transform.SetParent(DownPanelRepository.transform);
            ob.transform.position   = Vector3.zero;
            ob.transform.localScale = Vector3.one;
        }
        GridBtnObjs[0].GetComponent <MyUIEventIndex>().Listener += Test1;
        GridBtnObjs[1].GetComponent <MyUIEventIndex>().Listener += Test2;
        GridBtnObjs[2].GetComponent <MyUIEventIndex>().Listener += Test3;
        GridBtnObjs[3].GetComponent <MyUIEventIndex>().Listener += Test4;
        GridBtnObjs[4].GetComponent <MyUIEventIndex>().Listener += Test5;
        GridBtnObjs[5].GetComponent <MyUIEventIndex>().Listener += Test6;
        GridBtnObjs[6].GetComponent <MyUIEventIndex>().Listener += Test7;
        GridBtnObjs[7].GetComponent <MyUIEventIndex>().Listener += Test8;
        GridBtnObjs[8].GetComponent <MyUIEventIndex>().Listener += Test9;
        GridBtnObjs[9].GetComponent <MyUIEventIndex>().Listener += Test10;

        AdjustShowGrids(0, true);
    }
Ejemplo n.º 2
0
 // Use this for initialization
 void Start()
 {
     GridPrefab = Resources.Load <GameObject>("UIPrefabs/Grid");
     uiGrid     = GetComponent <UIGrid>();
     taskGrid   = SeriaOrDeSeria.DeSerialzeXML(AllDataPath.Instance.TaskXMLPath, typeof(TaskGrid[])) as TaskGrid[];
     for (int i = 0; i < taskGrid.Length; i++)
     {
         GameObject obj = Instantiate <GameObject>(GridPrefab);
         obj.GetComponent <TaskGridMono>().Primary(taskGrid[i]);
         obj.transform.SetParent(transform);
         obj.transform.localPosition = Vector3.zero;
         obj.transform.localScale    = Vector3.one;
     }
     uiGrid.repositionNow = true;
 }
Ejemplo n.º 3
0
    public static void PrimaryTaskGrid()
    {
        List <TaskGrid> tgrids = new List <TaskGrid> ();

        tgrids.Add(new TaskGrid("TaskGridTex/1", "任务一", "士大夫似的犯得上大师傅", 0));
        tgrids.Add(new TaskGrid("TaskGridTex/2", "任务二", "士大夫似的犯得上大师傅", 1));
        tgrids.Add(new TaskGrid("TaskGridTex/3", "任务三", "士大夫似的犯得上大师傅", 2));
        tgrids.Add(new TaskGrid("TaskGridTex/4", "任务四", "士大夫似的犯得上大师傅", 3));
        tgrids.Add(new TaskGrid("TaskGridTex/1", "任务一", "士大夫似的犯得上大师傅", 4));
        tgrids.Add(new TaskGrid("TaskGridTex/1", "任务一", "士大夫似的犯得上大师傅", 5));
        tgrids.Add(new TaskGrid("TaskGridTex/1", "任务一", "士大夫似的犯得上大师傅", 6));
        tgrids.Add(new TaskGrid("TaskGridTex/1", "任务一", "士大夫似的犯得上大师傅", 7));
        TaskGrid[] temp = tgrids.ToArray();
        SeriaOrDeSeria.SerialzeXML <TaskGrid[]> (AllDataPath.Instance.TaskXMLPath, temp);
    }
Ejemplo n.º 4
0
    public void PrimaryXML()
    {
        string GridBtnImgPath = "GridBtnImg/";

        GridBtn[] grids = new GridBtn[10];
        grids [0] = new GridBtn(GridBtnImgPath + "1");
        grids [1] = new GridBtn(GridBtnImgPath + "2");
        grids [2] = new GridBtn(GridBtnImgPath + "3");
        grids [3] = new GridBtn(GridBtnImgPath + "4");
        grids [4] = new GridBtn(GridBtnImgPath + "5");
        grids [5] = new GridBtn(GridBtnImgPath + "6");
        grids [6] = new GridBtn(GridBtnImgPath + "7");
        grids [7] = new GridBtn(GridBtnImgPath + "8");
        grids [8] = new GridBtn(GridBtnImgPath + "9");
        grids [9] = new GridBtn(GridBtnImgPath + "10");

        SeriaOrDeSeria.SerialzeXML <GridBtn[]> (path, grids);
    }