112 lines
2.9 KiB
ActionScript
112 lines
2.9 KiB
ActionScript
package net.pixvi.myr.center
|
|
{
|
|
import flash.events.Event;
|
|
import flash.system.Capabilities;
|
|
import net.gaooo.nano.center.GAoNano;
|
|
import net.pixvi.common.center.SoundCenter;
|
|
import net.pixvi.common.utils.PiObject;
|
|
import net.pixvi.common.utils.mobi.MobiTools;
|
|
import net.pixvi.myr.element.SettingVo;
|
|
import net.pixvi.myr.element.master.MasterVo;
|
|
import net.pixvi.myrloader.center.MyrCenter;
|
|
import net.pixvi.pfw.utils.Saver;
|
|
import net.pixvi.pfw.utils.core.Singleton;
|
|
|
|
public class Game extends Singleton
|
|
{
|
|
|
|
public var master:MasterVo;
|
|
|
|
public var setting:SettingVo;
|
|
|
|
public function Game()
|
|
{
|
|
super();
|
|
if(Saver.getAuto("myrSetting") == null)
|
|
{
|
|
setting = new SettingVo();
|
|
if(MobiTools.isMobi() && Capabilities.screenResolutionY / Capabilities.screenResolutionX >= 2)
|
|
{
|
|
setting.liuhaiMode = true;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
setting = PiObject.readPiObj(Saver.getAuto("myrSetting")) as SettingVo;
|
|
if(setting == null)
|
|
{
|
|
setting = new SettingVo();
|
|
if(MobiTools.isMobi() && Capabilities.screenResolutionY / Capabilities.screenResolutionX >= 2)
|
|
{
|
|
setting.liuhaiMode = true;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
public static function getIns() : Game
|
|
{
|
|
return Singleton.getInstanceOrCreate(Game) as Game;
|
|
}
|
|
|
|
public static function get HQ() : Boolean
|
|
{
|
|
return getIns().setting.quality == 3;
|
|
}
|
|
|
|
public static function get LQ() : Boolean
|
|
{
|
|
return getIns().setting.quality == 1;
|
|
}
|
|
|
|
public static function exit(e:Event = null) : void
|
|
{
|
|
MobiTools.getIns().exit();
|
|
}
|
|
|
|
public function beforeGroundCheck() : void
|
|
{
|
|
MasterCenter.getIns().inJectGAoPara();
|
|
MonsterCenter.getIns().secondHandler(false);
|
|
MailCenter.getIns().autoCheckMailDay();
|
|
}
|
|
|
|
public function saveSetting() : void
|
|
{
|
|
Saver.saveAuto("myrSetting",setting.toObject());
|
|
}
|
|
|
|
public function initSetting() : void
|
|
{
|
|
if(!setting.openBgm)
|
|
{
|
|
SoundCenter.getIns().setBgmEnable(false);
|
|
GAoNano.getIns().volume = 0;
|
|
}
|
|
else
|
|
{
|
|
SoundCenter.getIns().bgmVolume = setting.globalVolume;
|
|
GAoNano.getIns().volume = setting.globalVolume;
|
|
}
|
|
if(!setting.openEffect)
|
|
{
|
|
SoundCenter.getIns().setEffectEnable(false);
|
|
}
|
|
else
|
|
{
|
|
SoundCenter.getIns().effectVolume = setting.globalVolume;
|
|
}
|
|
}
|
|
|
|
public function getLiuHaiAdd() : int
|
|
{
|
|
if(MyrCenter.platform == "IOS")
|
|
{
|
|
return 75;
|
|
}
|
|
return 50;
|
|
}
|
|
}
|
|
}
|
|
|