-
Notifications
You must be signed in to change notification settings - Fork 642
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #142 from Geequlim/puerts
添加 puerts 支持
- Loading branch information
Showing
4 changed files
with
76 additions
and
0 deletions.
There are no files selected for viewing
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
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
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,33 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
|
||
namespace FairyGUI.Utils { | ||
|
||
public class VirualClassObject { | ||
private Dictionary<string, Action> methods = new Dictionary<string, Action>(); | ||
|
||
public static VirualClassObject Instance(Action<VirualClassObject> initializer) { | ||
var obj = new VirualClassObject(); | ||
if (initializer != null) { | ||
initializer(obj); | ||
} | ||
return obj; | ||
} | ||
|
||
public void AddMethod(string method, Action callback) { | ||
methods[method] = callback; | ||
} | ||
|
||
public bool Call(string method) { | ||
Action callback; | ||
if (methods.TryGetValue(method, out callback)) { | ||
if (callback != null) { | ||
callback(); | ||
return true; | ||
} | ||
} | ||
return false; | ||
} | ||
} | ||
|
||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.