72 lines
2.0 KiB
C#
72 lines
2.0 KiB
C#
|
//============= Copyright (c) Ludic GmbH, All rights reserved. ==============
|
|||
|
//
|
|||
|
// Purpose: Part of the My Behaviour Tree Controller Code
|
|||
|
//
|
|||
|
//=============================================================================
|
|||
|
|
|||
|
using System.Collections;
|
|||
|
using System.Collections.Generic;
|
|||
|
using UnityEngine;
|
|||
|
using UnityEngine.UI;
|
|||
|
using MyBT;
|
|||
|
|
|||
|
#if UNITY_EDITOR
|
|||
|
using UnityEditor;
|
|||
|
[CustomEditor(typeof(NamedRawImage))]
|
|||
|
public class NamedRawImageInspector : ComponentHandlerInspector {
|
|||
|
}
|
|||
|
#endif
|
|||
|
|
|||
|
[System.Serializable]
|
|||
|
public class NamedRawImage : ComponentHandler {
|
|||
|
public override string TypeLabel () {
|
|||
|
return "NamedImage";
|
|||
|
}
|
|||
|
|
|||
|
public override string ContentLabel() {
|
|||
|
UpdateComponent();
|
|||
|
return "";
|
|||
|
}
|
|||
|
|
|||
|
public override void UpdateComponent() {
|
|||
|
base.UpdateComponent();
|
|||
|
rawImageComponent = GetComponentInChildren<RawImage>();
|
|||
|
}
|
|||
|
|
|||
|
public RawImage rawImageComponent;
|
|||
|
|
|||
|
public override string titleText {
|
|||
|
get {
|
|||
|
return "Show/Hide, FadeIn/Out of RawImage";
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public override string[][] helpText {
|
|||
|
get {
|
|||
|
return new string[][] {
|
|||
|
new string[] {"Show", null, $"BTC.Show(\"{roomId}\", \"{gameObject.name}\")"},
|
|||
|
new string[] {"Hide", null, $"BTC.Hide(\"{roomId}\", \"{gameObject.name}\")"},
|
|||
|
new string[] {"FadeIn", null, $"BTC.FadeIn(\"{roomId}\", \"{gameObject.name}\")"},
|
|||
|
new string[] {"FadeOut", null, $"BTC.FadeOut(\"{roomId}\", \"{gameObject.name}\")"},
|
|||
|
};
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
#region both values setting
|
|||
|
public override void SetAlpha(float alpha) {
|
|||
|
if (rawImageComponent != null) {
|
|||
|
Color col = rawImageComponent.color;
|
|||
|
col.a = 1 - alpha;
|
|||
|
rawImageComponent.color = col;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public override float GetAlpha() {
|
|||
|
if (rawImageComponent != null) {
|
|||
|
return 1-rawImageComponent.color.a;
|
|||
|
}
|
|||
|
return 0;
|
|||
|
}
|
|||
|
#endregion
|
|||
|
}
|