home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mobiclic 148
/
MOBICLIC148.ISO
/
mac
/
DATA
/
DSS148
/
DSS148_01
/
DSS148_01.swf
/
scripts
/
dss148
/
Memo.as
< prev
next >
Wrap
Text File
|
2012-10-16
|
4KB
|
163 lines
package dss148
{
import com.milanpresse.engine.Engine;
import flash.net.SharedObject;
public class Memo
{
public static var NEW_GAME:String = "NEW_GAME";
public static var ATTENTE:String = "ATTENTE";
private var _so:SharedObject;
private var _name:String;
private var _e:Engine;
private var _savePoint:Object;
public var modules:Array;
public function Memo(param1:Engine)
{
this.modules = [{
"no":0,
"vu":true
},{
"no":1,
"vu":false
},{
"no":2,
"vu":false
},{
"no":3,
"vu":false
},{
"no":4,
"vu":false
},{
"no":5,
"vu":false
}];
super();
this._e = param1;
this._name = this._e.config.rubriqueName;
this._so = SharedObject.getLocal(this._name,"/");
if(this._so.data._savePoint == undefined)
{
this._savePoint = {
"moduleNum":this.module.no,
"status":NEW_GAME
};
this.save();
}
else
{
this.load();
}
}
public function clear() : void
{
this._so.clear();
this.modules = [{
"no":0,
"vu":true
},{
"no":1,
"vu":false
},{
"no":2,
"vu":false
},{
"no":3,
"vu":false
},{
"no":4,
"vu":false
},{
"no":5,
"vu":false
}];
this._savePoint = {
"moduleNum":0,
"status":NEW_GAME
};
this.save();
}
public function save() : void
{
this._so.data._savePoint = this._savePoint;
this._so.data.modules = this.modules;
this._so.flush();
}
public function load() : void
{
this._savePoint = this._so.data._savePoint;
this.modules = this._so.data.modules;
}
public function get allModulesFinished() : Boolean
{
var _loc1_:int = 0;
while(_loc1_ < this.modules.length)
{
if(this.modules[_loc1_].vu == false)
{
return false;
}
_loc1_++;
}
return true;
}
public function get nbModulesFinished() : int
{
var _loc1_:int = 0;
var _loc2_:int = 0;
while(_loc2_ < this.modules.length)
{
if(this.modules[_loc2_].vu == true)
{
_loc1_++;
}
_loc2_++;
}
return _loc1_;
}
public function get module() : Object
{
return this.modules[this._e.config.moduleNum];
}
public function set savePoint(param1:Object) : void
{
param1.moduleNum = param1.moduleNum == undefined ? this.module.no : param1.moduleNum;
this._savePoint = param1;
}
public function get savePoint() : Object
{
return this._savePoint;
}
public function toString() : String
{
var _loc1_:String = "";
var _loc2_:int = 0;
while(_loc2_ < this.modules.length)
{
_loc1_ += "\r\n" + _loc2_ + " : " + this.modules[_loc2_].vu;
_loc2_++;
}
return _loc1_;
}
}
}