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
using UnityEngine; | |
using System.Collections; | |
using UnityEditor; | |
[CustomEditor (typeof(SmartButton))] | |
public class SmartButtonEditor : Editor { | |
/// <summary> | |
/// The smart button itself. Here we will have stored all of his variables | |
/// </summary> |
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
using UnityEngine; | |
using System.Collections; | |
public class SmartButton : MonoBehaviour { | |
public enum Usage { | |
Default, | |
URL, | |
SceneLoader, |
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
return Movie; |
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
Movie.prototype = { | |
constructor : Movie | |
,getAttribute : function (key){ | |
return attributes[key]; | |
} | |
,setAttribute : function (key,value){ | |
attributes[key] = value; | |
} | |
}; |
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
//Private vars and functions | |
var attributes = {}; |
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
//Constructor | |
var Movie = function () { | |
}; |
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
define("movie", function () { | |
//Constructor | |
var Movie = function () { | |
}; | |
//Private vars and functions | |
var attributes = {}; | |
Movie.prototype = { | |
constructor : Movie | |
,getAttribute : function (key){ |
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
// Here we are loading a "movie" module to use in our callback function | |
require(["movie"], function(Movie) { | |
var a = new Movie(); | |
a.setAttribute('name','terminator'); | |
console.log(a.getAttribute('name')); | |
}); |
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
Project | |
Project/index.html | |
Project/scripts | |
Project/scripts/require.js | |
Project/scripts/main.js | |
Project/scripts/movie.js |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Using RequireJS</title> | |
<!-- we reference requirejs and tell it that what we want to load is specified in data-main --> | |
<script data-main="scripts/main" src="scripts/require.js"></script> | |
</head> | |
<body> | |
</body> | |
</html> |
NewerOlder