コード例 #1
0
        // TODO: перенести логику подписки на события в GameManager - загрузка ресурсов
        private GameObject createButton(GameObject go, int id)
        {
            GameObject newButton = NGUITools.AddChild(go, Prefab);

            newButton.transform.parent        = go.transform;
            newButton.transform.localPosition = new Vector3(newButton.transform.position.x, newButton.transform.position.y, 0);
            ColorSelector colorSelector = newButton.GetComponent <ColorSelector>();

            colorSelector.ResetPosition();
            colorSelector.Index = id;

            colorSelector.UpdateColliderSize();

            UIEventListener.Get(newButton).onClick += OnClickEventHandler;
            return(newButton);
        }
コード例 #2
0
        private void Start()
        {
            UIPencilAtlasCustomCreator.CreateAtlas(PaletteManager.selectedPaletteName);

            int btnsCount = MaterialManager.Materials.Length;

            for (int i = 0; i < btnsCount; i++)
            {
                GameObject    selectorObject = createButton(gameObject, i);
                ColorSelector selector       = selectorObject.GetComponent <ColorSelector>();
                selector.ColorSelectorManager = _colorSelectorManager;
                ColorSelectors.Add(selector);

                selector.UISprite.sprite2D = SpriteList[i];

                selector.UpdateColliderSize();
            }
            grid.Reposition();
            grid.transform.parent.GetComponent <UIScrollView>().ResetPosition();
            _colorSelectorManager.UiGrid         = grid;
            _colorSelectorManager.ColorSelectors = ColorSelectors;
        }
コード例 #3
0
 private void ShowFirstCS()
 {
     ActiveColorSelector    = ColorSelectors[ColorSelectors.Count - 1];
     MaterialManager.Active = MaterialManager.Materials.Length - 1;
 }
コード例 #4
0
 public void HideColorSelector(ColorSelector colorSelector)
 {
     colorSelector.Hide();
 }
コード例 #5
0
 public void ShowColorSelector(ColorSelector colorSelector)
 {
     colorSelector.Show();
 }