コード例 #1
0
 protected virtual void OnEnable() => EditorTools.InitTextures();
コード例 #2
0
        private void DrawSprites(int section)
        {
            #region Header

            GUILayout.BeginHorizontal();
            {
                if (!PlatformBuilder.hideSection[section])
                {
                    if (EditorTools.TexturedButton(EditorTools.eyeOpenTexture,
                                                   "Hides all the content in this section.", 20f))
                    {
                        PlatformBuilder.hideSection[section] = true;
                    }
                }
                else
                {
                    if (EditorTools.TexturedButton(EditorTools.eyeClosedTexture,
                                                   "Shows all the content in this section.", 20f))
                    {
                        PlatformBuilder.hideSection[section] = false;
                    }
                }

                var style = new GUIStyle(GUI.skin.label)
                {
                    fontStyle = FontStyle.Bold,
                    alignment = TextAnchor.MiddleCenter,
                    fontSize  = 13
                };

                EditorGUILayout.LabelField(new GUIContent("Sprites", ""), style);


                GUILayout.Space(-25);
                if (EditorTools.TexturedButton(EditorTools.settingsTexture,
                                               "Generates the platform.", 20f))
                {
                    PlatformBuilder.Generate();
                }

                if (EditorTools.TexturedButton(EditorTools.deleteTexture,
                                               "Deletes the platform, leaving only this game object.", 20f))
                {
                    PlatformBuilder.Delete();
                }
            }
            GUILayout.EndHorizontal();

            EditorTools.DrawLine();
            GUILayout.Space(5);

            if (PlatformBuilder.hideSection[section])
            {
                return;
            }

            #endregion

            EditorGUILayout.BeginVertical(_boxStyle, GUILayout.MinWidth(BoxMinWidth), GUILayout.MaxWidth(BoxMaxWidth));
            {
                PreviewTile(0, PlatformBuilder.horizontalBuild ? "Left Tile" : "Top Tile", in PlatformBuilder.leftEndTile.list, in leftEndSprites);

                PreviewTile(1, "Middle Tile", in PlatformBuilder.middleTile.list, in middleSprites);

                PreviewTile(2, PlatformBuilder.horizontalBuild ? "Right Tile" : "Bottom Tile", in PlatformBuilder.rightEndTile.list, in rightEndSprites);
            }
            EditorGUILayout.EndVertical();
        }