This file contains hidden or 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
local MyStaticClass = {} | |
local data; | |
function MyStaticClass:SetData(newData) | |
data = newData | |
end | |
function MyStaticClass:PrintData() | |
print(data) |
This file contains hidden or 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
require("msa/Core") | |
local Constants = readonly { | |
MyNumber = 12.34, | |
MyString = "Some String", | |
MyObject = readonly {Data = "My Object data", Count = 123}, | |
MyPosition = readonly {x = 1, y = 2, z = 3}, | |
MyColor = readonly {r = 0.5, g = 0.5, b = 0.5, m = 1} | |
} |
This file contains hidden or 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
local MySingleton = {} | |
MySingleton.__index = MySingleton | |
setmetatable(MySingleton, {__call = function (cls, ...) return cls.GetInstance(...) end }) | |
local instance | |
function MySingleton.GetInstance() | |
if instance == nil then | |
instance = setmetatable({}, MySingleton) | |
end | |
return instance |
This file contains hidden or 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
local MyClass = {} | |
MyClass.__index = MyClass | |
setmetatable(MyClass, {__call = function (cls, ...) return cls.New(...) end }) | |
function MyClass.New(initData) | |
local self = setmetatable({}, MyClass) | |
self.data = initData | |
return self |
This file contains hidden or 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
local MyClass = {} | |
MyClass.__index = MyClass | |
setmetatable(MyClass, {__call = function (cls, ...) return cls.New(...) end }) | |
function MyClass.New(initData) | |
local self = setmetatable({}, MyClass) | |
self.data = initData | |
return self |
This file contains hidden or 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
### Animator initialization: | |
```lua | |
-- Init | |
local animator = Animator() | |
local animation = animator:InitAnimation() | |
-- plan your animation | |
animation:Move(ObjectId.TestTile1, ObjectId.InBag1, 0, HandleMoveToItemDone) | |
This file contains hidden or 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
public bool OpenConnection(string dbFalieName) | |
{ | |
if (!File.Exists(dbFalieName)) | |
{ | |
SQLiteConnection.CreateFile(dbFalieName); | |
connection = new SQLiteConnection("Data Source=" + dbFalieName + ";Version=3;"); | |
InitTables(); | |
} | |
else | |
{ |
This file contains hidden or 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
package utils.data { | |
import flash.utils.Dictionary; | |
import flash.utils.getQualifiedClassName; | |
/** | |
* Base class for creation of enumerable type-safe constants. (Similar to Enum in c++) | |
* | |
* @Example: | |
* | |
* package { |
This file contains hidden or 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
package { | |
import flash.utils.Dictionary; | |
/** | |
* Contains country codes and names. | |
*/ | |
public class Country { | |
public static var allCountries:Dictionary = new Dictionary(); | |
{ |
This file contains hidden or 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
/** | |
* Created by Raimundas Banevicius on 8/15/2016. | |
*/ | |
package utils.text { | |
import flash.text.TextField; | |
import flash.text.TextFieldAutoSize; | |
import flash.text.TextFormat; | |
public class TextHelper { |
NewerOlder