forked from xamarin/KimonoDesigner
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed several small type conversion issues and added the ability to use script libraries across multiple ObiScripts.
- Loading branch information
1 parent
782ff0a
commit aaf1e9b
Showing
34 changed files
with
265 additions
and
65 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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
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,88 @@ | ||
using System; | ||
using SkiaSharp; | ||
|
||
namespace KimonoCore | ||
{ | ||
public class KimonoPropertyLibrary : KimonoProperty | ||
{ | ||
#region Computed Properties | ||
/// <summary> | ||
/// Gets a value indicating whether this <see cref="T:KimonoCore.KimonoProperty"/> gets value from script. | ||
/// </summary> | ||
/// <value><c>true</c> if gets value from script; otherwise, <c>false</c>.</value> | ||
public override bool GetsValueFromScript | ||
{ | ||
get | ||
{ | ||
return true; | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// Gets a value indicating whether this <see cref="T:KimonoCore.KimonoPropertyColor"/> is obi script value. | ||
/// </summary> | ||
/// <value><c>true</c> if is obi script value; otherwise, <c>false</c>.</value> | ||
public override bool IsObiScriptValue | ||
{ | ||
get | ||
{ | ||
return true; | ||
} | ||
} | ||
#endregion | ||
|
||
#region Constructors | ||
public KimonoPropertyLibrary() | ||
{ | ||
// Initialize | ||
Name = "Script Library"; | ||
ObiScript = "// Add one or more ObiScript `function` definitions to this library,\n" + | ||
"// then add `using library-name;` to the top of any other ObiScript to use these\n" + | ||
"// functions inside of that script."; | ||
} | ||
#endregion | ||
|
||
#region Public Methods | ||
/// <summary> | ||
/// Evaluate this instance by executing any attached Obi Script to get the new | ||
/// value for the `KimonoProperty`. | ||
/// </summary> | ||
/// <returns>The result of the Obi Script execution as a `ObiScriptResult`.</returns> | ||
public override ObiScriptResult Evaluate() | ||
{ | ||
// Is there a script attached? | ||
if (GetsValueFromScript) | ||
{ | ||
// Execute the script to check for errors | ||
ObiScriptEngine.Runtime.Execute(ObiScript); | ||
|
||
} | ||
|
||
// Return the result of executing the script | ||
return ObiScriptEngine.EvaluationResult; | ||
} | ||
#endregion | ||
|
||
#region Cloning | ||
/// <summary> | ||
/// Clone this instance. | ||
/// </summary> | ||
/// <returns>The clone.</returns> | ||
public override KimonoProperty Clone() | ||
{ | ||
// Make copy | ||
var newProperty = new KimonoPropertyLibrary() | ||
{ | ||
Name = this.Name, | ||
Usage = this.Usage, | ||
IsObiScriptValue = this.IsObiScriptValue, | ||
GetsValueFromScript = this.GetsValueFromScript, | ||
ObiScript = this.ObiScript | ||
}; | ||
|
||
// Return clone | ||
return newProperty; | ||
} | ||
#endregion | ||
} | ||
} |
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
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
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
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
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
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
Oops, something went wrong.