Initialize local project and fix ranch growth synchronization
This commit is contained in:
@@ -0,0 +1,95 @@
|
||||
package net.pixvi.myr.view.groundobj
|
||||
{
|
||||
import flash.display.Sprite;
|
||||
import flash.events.Event;
|
||||
import net.pixvi.myr.center.Table;
|
||||
import net.pixvi.pfw.display.NetBitImg;
|
||||
import net.pixvi.pfw.display.PiSprite;
|
||||
import net.pixvi.pfw.interfaces.IDispose;
|
||||
|
||||
public class BaseGroundObject extends PiSprite implements IDispose
|
||||
{
|
||||
|
||||
public var img:NetBitImg;
|
||||
|
||||
public var container:Sprite;
|
||||
|
||||
public var data:Object;
|
||||
|
||||
public var editsrc:String = "";
|
||||
|
||||
public function BaseGroundObject()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public function init(obj:Object, editsrc:String = "") : void
|
||||
{
|
||||
this.editsrc = editsrc;
|
||||
data = obj;
|
||||
img = new NetBitImg();
|
||||
container = new Sprite();
|
||||
container.addChild(img);
|
||||
img.addEventListener("complete",imgCompleteHandler);
|
||||
if(editsrc != "")
|
||||
{
|
||||
img.load(editsrc);
|
||||
}
|
||||
else
|
||||
{
|
||||
img.load(Table.setting.groundObject[data.type].img);
|
||||
}
|
||||
this.x = obj.x;
|
||||
this.y = obj.y;
|
||||
}
|
||||
|
||||
public function imgCompleteHandler(e:Event = null) : void
|
||||
{
|
||||
if(editsrc == "")
|
||||
{
|
||||
img.x = curFloatX;
|
||||
img.y = curFloatY;
|
||||
}
|
||||
if(data.scaleX != 1)
|
||||
{
|
||||
img.scaleX = data.scaleX;
|
||||
}
|
||||
if(data.scaleY != 1)
|
||||
{
|
||||
img.scaleY = data.scaleY;
|
||||
}
|
||||
addChild(container);
|
||||
startAction();
|
||||
}
|
||||
|
||||
public function get curFloatX() : Number
|
||||
{
|
||||
return Table.setting.groundObject[data.type].floatX;
|
||||
}
|
||||
|
||||
public function get curFloatY() : Number
|
||||
{
|
||||
return Table.setting.groundObject[data.type].floatY;
|
||||
}
|
||||
|
||||
public function startAction() : void
|
||||
{
|
||||
}
|
||||
|
||||
public function pauseAction() : void
|
||||
{
|
||||
}
|
||||
|
||||
public function get loaded() : Boolean
|
||||
{
|
||||
return img.loaded;
|
||||
}
|
||||
|
||||
override public function dispose() : void
|
||||
{
|
||||
img.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
package net.pixvi.myr.view.groundobj
|
||||
{
|
||||
import com.greensock.TweenMax;
|
||||
|
||||
public class GroundObjectFlash extends BaseGroundObject
|
||||
{
|
||||
|
||||
public var t:TweenMax;
|
||||
|
||||
public var pausing:Boolean = false;
|
||||
|
||||
public function GroundObjectFlash()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
override public function startAction() : void
|
||||
{
|
||||
if(t == null)
|
||||
{
|
||||
step1(Math.random() * 1.5);
|
||||
}
|
||||
else if(pausing)
|
||||
{
|
||||
t.resume();
|
||||
}
|
||||
}
|
||||
|
||||
public function step1(delay:Number = 0) : void
|
||||
{
|
||||
t = TweenMax.to(container,1,{
|
||||
"delay":delay,
|
||||
"alpha":0.6,
|
||||
"onComplete":step2
|
||||
});
|
||||
}
|
||||
|
||||
public function step2() : void
|
||||
{
|
||||
t = TweenMax.to(container,1,{
|
||||
"alpha":1,
|
||||
"onComplete":step1
|
||||
});
|
||||
}
|
||||
|
||||
override public function pauseAction() : void
|
||||
{
|
||||
if(t != null)
|
||||
{
|
||||
t.pause();
|
||||
}
|
||||
pausing = true;
|
||||
}
|
||||
|
||||
override public function dispose() : void
|
||||
{
|
||||
super.dispose();
|
||||
if(t != null)
|
||||
{
|
||||
t.pause();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
package net.pixvi.myr.view.groundobj
|
||||
{
|
||||
import com.greensock.TweenMax;
|
||||
import com.greensock.easing.Cubic;
|
||||
|
||||
public class GroundObjectSlowShake extends BaseGroundObject
|
||||
{
|
||||
|
||||
public var t:TweenMax;
|
||||
|
||||
public var pausing:Boolean = false;
|
||||
|
||||
public function GroundObjectSlowShake()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
override public function startAction() : void
|
||||
{
|
||||
if(t == null)
|
||||
{
|
||||
step1(Math.random() * 1.5);
|
||||
}
|
||||
else if(pausing)
|
||||
{
|
||||
t.resume();
|
||||
}
|
||||
}
|
||||
|
||||
public function step1(delay:Number = 0) : void
|
||||
{
|
||||
t = TweenMax.to(container,3,{
|
||||
"transformMatrix":{"c":0.17},
|
||||
"scaleY":0.9,
|
||||
"delay":delay,
|
||||
"ease":Cubic.easeInOut,
|
||||
"onComplete":step2
|
||||
});
|
||||
}
|
||||
|
||||
public function step2() : void
|
||||
{
|
||||
t = TweenMax.to(container,3,{
|
||||
"transformMatrix":{"c":-0.17},
|
||||
"ease":Cubic.easeInOut,
|
||||
"onComplete":step1
|
||||
});
|
||||
}
|
||||
|
||||
override public function pauseAction() : void
|
||||
{
|
||||
if(t != null)
|
||||
{
|
||||
t.pause();
|
||||
}
|
||||
pausing = true;
|
||||
}
|
||||
|
||||
override public function dispose() : void
|
||||
{
|
||||
super.dispose();
|
||||
if(t != null)
|
||||
{
|
||||
t.pause();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
package net.pixvi.myr.view.groundobj
|
||||
{
|
||||
import com.greensock.plugins.TransformMatrixPlugin;
|
||||
import com.greensock.plugins.TweenPlugin;
|
||||
import net.pixvi.common.utils.Alert;
|
||||
import net.pixvi.myr.center.Table;
|
||||
|
||||
public class GroundObjectType
|
||||
{
|
||||
|
||||
public var typedic:Object = {
|
||||
"slowShake":{
|
||||
"type":"slowShake",
|
||||
"des":"缓慢摇摆"
|
||||
},
|
||||
"flash":{
|
||||
"type":"flash",
|
||||
"des":"透明度闪烁"
|
||||
}
|
||||
};
|
||||
|
||||
public function GroundObjectType()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public static function createGroundObjectByType(type:String) : BaseGroundObject
|
||||
{
|
||||
if(Table.setting.groundObject[type] == null)
|
||||
{
|
||||
Alert.showMsg("can\'t find groundObj:" + type);
|
||||
}
|
||||
var go:BaseGroundObject = createGroundObject(Table.setting.groundObject[type].actionType);
|
||||
go.mouseChildren = go.mouseEnabled = false;
|
||||
return go;
|
||||
}
|
||||
|
||||
public static function createGroundObject(actionType:String) : BaseGroundObject
|
||||
{
|
||||
switch(actionType)
|
||||
{
|
||||
case "slowShake":
|
||||
TweenPlugin.activate([TransformMatrixPlugin]);
|
||||
return new GroundObjectSlowShake();
|
||||
case "flash":
|
||||
return new GroundObjectFlash();
|
||||
default:
|
||||
return new BaseGroundObject();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user