public override void OnInspectorGUI()
        {
            base.OnInspectorGUI();
            LineManager t = target as LineManager;

            GUILayout.Space(20);
            if (GUILayout.Button("Add a new Line"))
            {
                Util.InstantiateAt <Line>(t.slot.skin.line, t.transform);
                EditorUtility.SetDirty(t);
            }
            if (GUILayout.Button("Generate Way Game Lines"))
            {
                if (EditorUtility.DisplayDialog("Warning", "This will destroy the existing lines the slot has and generates all the possible paylines. ", "Yes", "No!"))
                {
                    t.CreateLinesForWayGame();
                    EditorUtility.SetDirty(t);
                }
            }
            EditorGUILayout.LabelField("Or simply press CTRL+d on an existing line to duplicate");
        }
Esempio n. 2
0
 internal void Validate(LineManager lineManager)
 {
     this.lineManager = lineManager;
     SetPaths();
 }
Esempio n. 3
0
        public void Refresh(bool rebuild = true)
        {
            if (Application.isPlaying)
            {
                SetActiveLayout(true);
            }
            SymbolManager   symbolManager = slot.symbolManager;
            LineManager     lineManager   = slot.lineManager;
            SlotConfig      config        = slot.config;
            GridLayoutGroup reel          = slot.layoutReel;
            GridLayoutGroup row           = slot.layoutRow;

            if (rebuild)
            {
                slot.Validate();
                if (config.symbolsPerReel < config.totalRows)
                {
                    Debug.Log("[Error] Symbols per reel must be higher than total rows(including hidden rows).");
                    return;
                }
            }

            reel.cellSize = sizeSymbol;
            reel.spacing  = spacingSymbol;
            int px = (int)(spacingSymbol.x * 0.5f), py = (int)(spacingSymbol.y * 0.5f);

            reel.padding = new RectOffset(px, px, py, py);

            Vector2 spacing = sizeSymbol + spacingSymbol;
            float   width   = spacing.x * config.reelLength;
            float   height  = spacing.y * config.rows;

            row.cellSize = new Vector2(width, sizeSymbol.y + spacingSymbol.y);
            row.spacing  = Vector2.zero;

            slot.mainScreen.sizeDelta = new Vector2(width + paddingMainScreen.horizontal, height + paddingMainScreen.vertical);

            (reel.transform as RectTransform).anchoredPosition = (row.transform as RectTransform).anchoredPosition = new Vector2(paddingMainScreen.left, config.hiddenTopRows * spacing.y - paddingMainScreen.top);

            if (linkLineManagerTransformToMainScreen)
            {
                (lineManager.transform as RectTransform).sizeDelta = (slot.mainScreen.transform as RectTransform).sizeDelta;
                lineManager.transform.position = slot.mainScreen.transform.position;
            }

            if (rebuild)
            {
                SymbolMap map = symbolManager.GetSymbolMap();
                Util.DestroyChildren <Row>(row);
                for (int i = 0; i < config.totalRows; i++)
                {
                    GameObject.Instantiate(slot.skin.row).OnRefreshLayout(slot, i);
                }
                Util.DestroyChildren <Reel>(reel);
                for (int i = 0; i < config.reelLength; i++)
                {
                    GameObject.Instantiate(slot.skin.reel).OnRefreshLayout(slot, i);
                }
                slot.reels = reel.transform.GetComponentsInChildren <Reel>();
                slot.rows  = row.transform.GetComponentsInChildren <Row>();
                symbolManager.ApplySymbolMap(map);
                lineManager.OnRefreshLayout();
                slot.Validate();
            }
            else
            {
                //	DOTween.CompleteAll(true);
                foreach (Reel r in slot.reels)
                {
                    foreach (SymbolHolder h in r.holders)
                    {
                        h._rect.sizeDelta = sizeSymbol;
                    }
                    r.y = r.nextY = 0;
                    r.RefreshHolderPositions();
                }
            }

            if (Application.isPlaying)
            {
                SetActiveLayout(false);
            }
        }