-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
114 additions
and
0 deletions.
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
Packages/uGUI-Skinner/Editor/SkinPartsInspector/CanvasEnableInspector.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using UnityEngine; | ||
|
||
namespace Pspkurara.UI.Skinner | ||
{ | ||
|
||
[SkinPartsInspector(typeof(CanvasEnable))] | ||
internal sealed class CanvasEnableInspector : SkinPartsOnArrayInspector<Canvas> | ||
{ | ||
|
||
protected override void CleanupFieldsOtherThanObjectReference(EditorSkinPartsPropertryWithoutObjectReference property) | ||
{ | ||
SkinnerEditorUtility.CleanArray(property.floatValues, CanvasEnable.FloatLength, SkinDefaultValue.Boolean); | ||
SkinnerEditorUtility.CleanArray(property.vector4Values); | ||
SkinnerEditorUtility.CleanArray(property.stringValues); | ||
} | ||
|
||
protected override void ResetArrayOtherThanObjectReference(EditorSkinPartsPropertryWithoutObjectReference property) | ||
{ | ||
SkinnerEditorUtility.ResetArray(property.floatValues, CanvasEnable.FloatLength, SkinDefaultValue.Boolean); | ||
} | ||
|
||
protected override void DrawOptionProperty(EditorSkinPartsPropertry property) | ||
{ | ||
SkinnerEditorGUILayout.Toggle(SkinContent.Enabled, property.floatValues.GetArrayElementAtIndex(CanvasEnable.FlagIndex)); | ||
} | ||
|
||
} | ||
|
||
} |
11 changes: 11 additions & 0 deletions
11
Packages/uGUI-Skinner/Editor/SkinPartsInspector/CanvasEnableInspector.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
using System.Collections.Generic; | ||
using UnityEngine; | ||
using System.Linq; | ||
|
||
namespace Pspkurara.UI.Skinner | ||
{ | ||
|
||
[SkinParts(SkinPartsType.CanvasEnable, typeof(Logic))] | ||
public static class CanvasEnable | ||
{ | ||
|
||
public const int FlagIndex = 0; | ||
public const int FloatLength = FlagIndex + 1; | ||
|
||
/// <summary> | ||
/// 適応ロジック | ||
/// </summary> | ||
internal sealed class Logic : SkinLogicOnArray<Canvas> | ||
{ | ||
|
||
/// <summary> | ||
/// enabledフラグ | ||
/// </summary> | ||
private bool activeFlag; | ||
|
||
/// <summary> | ||
/// 値をオブジェクトに反映させる | ||
/// </summary> | ||
/// <param name="property">プロパティ</param> | ||
public override void SetValues(SkinLogicProperty property) | ||
{ | ||
//値がないなら何もしない | ||
if (property.floatValues.Count < FloatLength) return; | ||
activeFlag = property.floatValues[FlagIndex].ToBool(); | ||
base.SetValues(property); | ||
} | ||
|
||
protected override void OnApplyValue(Canvas obj) | ||
{ | ||
obj.enabled = activeFlag; | ||
} | ||
|
||
} | ||
|
||
/// <summary> | ||
/// 対象のスキンパーツを生成 | ||
/// </summary> | ||
/// <param name="outlines">設定したいGraphic</param> | ||
/// <param name="color">Graphicのenabled</param> | ||
/// <returns>生成したスキンパーツ</returns> | ||
public static SkinParts CreateSkinParts(IEnumerable<Canvas> graphics, bool enabled) | ||
{ | ||
var parts = new SkinParts(); | ||
SkinnerUtility.ResetList(parts.property.floatValues, FloatLength); | ||
parts.property.objectReferenceValues.AddRange(graphics.Cast<Object>()); | ||
parts.property.floatValues[FlagIndex] = enabled.ToFloat(); | ||
return parts; | ||
} | ||
|
||
} | ||
|
||
} |
11 changes: 11 additions & 0 deletions
11
Packages/uGUI-Skinner/Runtime/SkinParts/CanvasEnable.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters