@@ -903,39 +903,6 @@ public static Vector3 WorldToScreenPoint(Vector3 worldPos, int cameraLayer)
903903 {
904904 return FindCamera ( cameraLayer ) ? . WorldToScreenPoint ( worldPos ) ?? Vector3 . zero ;
905905 }
906-
907- public static Vector3 ScreenToWorldPoint ( Vector3 screenPos , int cameraLayer )
908- {
909- return FindCamera ( cameraLayer ) ? . ScreenToWorldPoint ( screenPos ) ?? Vector3 . zero ;
910- }
911-
912- public static PassiveButton SetUpButton ( this GameObject gameObject , bool withSound = false ,
913- SpriteRenderer buttonRenderer = null , Color ? defaultColor = null , Color ? selectedColor = null )
914- {
915- var button = gameObject . AddComponent < PassiveButton > ( ) ;
916- button . OnClick = new Button . ButtonClickedEvent ( ) ;
917- button . OnMouseOut = new UnityEvent ( ) ;
918- button . OnMouseOver = new UnityEvent ( ) ;
919-
920- if ( withSound )
921- {
922- button . OnClick . AddListener ( ( Action ) ( ( ) =>
923- SoundManager . Instance . PlaySound ( VanillaAsset . SelectClip , false , 0.8f ) ) ) ;
924- button . OnMouseOver . AddListener ( ( Action ) ( ( ) =>
925- SoundManager . Instance . PlaySound ( VanillaAsset . HoverClip , false , 0.8f ) ) ) ;
926- }
927-
928- if ( buttonRenderer != null )
929- {
930- button . OnMouseOut . AddListener ( ( Action ) ( ( ) => buttonRenderer ! . color = defaultColor ?? Color . white ) ) ;
931- button . OnMouseOver . AddListener ( ( Action ) ( ( ) => buttonRenderer ! . color = selectedColor ?? Color . green ) ) ;
932- }
933-
934- if ( buttonRenderer != null ) buttonRenderer . color = defaultColor ?? Color . white ;
935-
936- return button ;
937- }
938-
939906 public static SpriteRenderer CreateSharpBackground ( Vector2 size , Color color , Transform transform )
940907 {
941908 var renderer = CreateObject < SpriteRenderer > ( "Background" , transform , new Vector3 ( 0 , 0 , 0.25f ) ) ;
@@ -1032,4 +999,22 @@ public static bool isChinese()
1032999 return false ;
10331000 }
10341001 }
1002+ public interface Image
1003+ {
1004+ internal Sprite GetSprite ( ) ;
1005+ }
1006+ public interface ISpriteLoader : Image
1007+ {
1008+ }
1009+ public class WrapSpriteLoader : ISpriteLoader
1010+ {
1011+ Func < Sprite > supplier ;
1012+
1013+ public WrapSpriteLoader ( Func < Sprite > supplier )
1014+ {
1015+ this . supplier = supplier ;
1016+ }
1017+
1018+ public Sprite GetSprite ( ) => supplier . Invoke ( ) ;
1019+ }
10351020}
0 commit comments