Initial Android commit
This commit is contained in:
commit
1e2b80c13d
8521 changed files with 231475 additions and 0 deletions
34
scripts/SeenTextSingleton.gd
Normal file
34
scripts/SeenTextSingleton.gd
Normal file
|
@ -0,0 +1,34 @@
|
|||
extends Node
|
||||
|
||||
|
||||
var seenPath = OS.get_user_data_dir() + "/globalSeen.txt";
|
||||
|
||||
var arraySeenTexts:Array;
|
||||
|
||||
func _ready():
|
||||
DeserializeSeen();
|
||||
|
||||
func DeserializeSeen():
|
||||
var file = File.new();
|
||||
|
||||
if not file.file_exists(seenPath):
|
||||
arraySeenTexts = [];
|
||||
SerializeSeen();
|
||||
else :
|
||||
file.open(seenPath, File.READ);
|
||||
arraySeenTexts = str2var(file.get_pascal_string());
|
||||
|
||||
file.close()
|
||||
|
||||
func SerializeSeen():
|
||||
var file = File.new();
|
||||
file.open(seenPath, File.WRITE);
|
||||
file.store_pascal_string(var2str(arraySeenTexts));
|
||||
file.close()
|
||||
|
||||
func AddSeen(text):
|
||||
if not text in arraySeenTexts and text != "":
|
||||
arraySeenTexts.push_back(text);
|
||||
|
||||
func CheckIfSeen(text:String)->bool:
|
||||
return text in arraySeenTexts;
|
Loading…
Add table
Add a link
Reference in a new issue