Exemple #1
0
    void Start()
    {
        FingerGestures.OnDragMove   += OnDragMove;
        FingerGestures.OnFingerDown += OnFingerDown;
        tiles = new StageType[height, width];
        gos   = new GameObject[height, width];
        var save_btn_go = gameObject.transform.Find("Controls/save_btn").gameObject;

        save_btn_button = save_btn_go.GetComponent <UnityEngine.UI.Button>();
        save_btn_button.onClick.AddListener(OnSaveBtnClick);
        TileBtns_go = gameObject.transform.Find("Controls/ScollView/TileBtns").gameObject;
        TileBtns_verticallayoutgroup = TileBtns_go.GetComponent <UnityEngine.UI.VerticalLayoutGroup>();
        Container   = new UIContainer <TileBtn>(TileBtns_verticallayoutgroup.gameObject);
        Template_go = gameObject.transform.Find("Controls/ScollView/TileBtns/Template").gameObject;
        tileGo      = gameObject.transform.Find("ScrollView/Content/tile").gameObject;
        tileGo.GetComponent <Image>();
        tileContent           = gameObject.transform.Find("ScrollView/Content").gameObject.GetComponent <RectTransform>();
        tileContent.sizeDelta = new Vector2(width * tileSize, height * tileSize);
        var brushs = Enum.GetValues(typeof(StageType));

        Container.Resize(brushs.Length);
        for (int i = 0; i < Container.ChildCount; i++)
        {
            var t = Container.GetChild(i);
            t.UpdateInfo((StageType)i);
            t.OnClickCallback = OnClick;
        }
    }