-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
- Loading branch information
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
using UnityEngine; | ||
using clojure.lang; | ||
|
||
public class ArcadiaBehaviour : MonoBehaviour, ISerializationCallbackReceiver | ||
{ | ||
private IFn _fn; | ||
public IFn fn | ||
{ | ||
get { return _fn; } | ||
set | ||
{ | ||
_fn = value; | ||
serializedVar = null; | ||
OnBeforeSerialize(); | ||
} | ||
} | ||
|
||
[SerializeField] | ||
public string serializedVar; | ||
|
||
// if fn is a var, store in serializedVar | ||
public void OnBeforeSerialize() | ||
{ | ||
Var v = fn as Var; | ||
if(v != null) | ||
{ | ||
serializedVar = v.Namespace.Name + "/" + v.Symbol.Name; | ||
} | ||
} | ||
|
||
// if serializedVar not null, set fn to var | ||
public void OnAfterDeserialize() | ||
{ | ||
if(serializedVar != "") | ||
{ | ||
Symbol sym = Symbol.intern(serializedVar); | ||
string libName = sym.Namespace.Replace(".", "/").Replace("-", "_"); | ||
Debug.Log("Loading " + libName); | ||
RT.load(libName); | ||
fn = Var.intern(Symbol.intern(sym.Namespace), Symbol.intern(sym.Name)); | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
using UnityEngine; | ||
using System.Collections; | ||
using clojure.lang; | ||
|
||
public class ArcadiaState : MonoBehaviour, ISerializationCallbackReceiver | ||
{ | ||
[TextArea(3,10)] | ||
public string edn; | ||
public object state; | ||
|
||
public void OnBeforeSerialize() | ||
{ | ||
edn = (string)((IFn)RT.var("clojure.core", "pr-str")).invoke(state); | ||
} | ||
|
||
public void OnAfterDeserialize() | ||
{ | ||
state = (object)((IFn)RT.var("clojure.edn", "read-string")).invoke(edn); | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
using UnityEngine; | ||
using clojure.lang; | ||
|
||
public class AwakeHook : ArcadiaBehaviour | ||
{ | ||
void Awake() | ||
{ | ||
if(fn != null) | ||
fn.invoke(gameObject); | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
using UnityEngine; | ||
using clojure.lang; | ||
|
||
public class FixedUpdateHook : ArcadiaBehaviour | ||
{ | ||
void FixedUpdate() | ||
{ | ||
if(fn != null) | ||
fn.invoke(gameObject); | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
using UnityEngine; | ||
using clojure.lang; | ||
|
||
public class LateUpdateHook : ArcadiaBehaviour | ||
{ | ||
void LateUpdate() | ||
{ | ||
if(fn != null) | ||
fn.invoke(gameObject); | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
using UnityEngine; | ||
using clojure.lang; | ||
|
||
public class OnAnimatorIKHook : ArcadiaBehaviour | ||
{ | ||
void OnAnimatorIK(System.Int32 G__18667) | ||
{ | ||
if(fn != null) | ||
fn.invoke(gameObject, G__18667); | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
using UnityEngine; | ||
using clojure.lang; | ||
|
||
public class OnAnimatorMoveHook : ArcadiaBehaviour | ||
{ | ||
void OnAnimatorMove() | ||
{ | ||
if(fn != null) | ||
fn.invoke(gameObject); | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
using UnityEngine; | ||
using clojure.lang; | ||
|
||
public class OnApplicationFocusHook : ArcadiaBehaviour | ||
{ | ||
void OnApplicationFocus(System.Boolean G__18674) | ||
{ | ||
if(fn != null) | ||
fn.invoke(gameObject, G__18674); | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
using UnityEngine; | ||
using clojure.lang; | ||
|
||
public class OnApplicationPauseHook : ArcadiaBehaviour | ||
{ | ||
void OnApplicationPause(System.Boolean G__18647) | ||
{ | ||
if(fn != null) | ||
fn.invoke(gameObject, G__18647); | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
using UnityEngine; | ||
using clojure.lang; | ||
|
||
public class OnApplicationQuitHook : ArcadiaBehaviour | ||
{ | ||
void OnApplicationQuit() | ||
{ | ||
if(fn != null) | ||
fn.invoke(gameObject); | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
using UnityEngine; | ||
using clojure.lang; | ||
|
||
public class OnAudioFilterReadHook : ArcadiaBehaviour | ||
{ | ||
void OnAudioFilterRead(System.Single[] G__18675, System.Int32 G__18676) | ||
{ | ||
if(fn != null) | ||
fn.invoke(gameObject, G__18675, G__18676); | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.