2013年9月13日 星期五

load swf as BitmapMovieClip

BitmapMCManager: getBitmapMC -> new a BitmapMovieClip with Vector.<BitmapFrameInfo> as null then ResManager loadRes -> 將swf用urlLoader將所得data以byteArray形式 load出來,byteArray完成後呼叫該resource(byteArray)的complete callback,也就是BitmapMCManager.loadComplete: 將load出來的swf進行cacheAsBitmapMC且updateBitmapMovieClip將res url對應到load出來的BitmapMovieClip。cacheAsBitmapMC(將load好的resource當成MovieClip後將此MovieClip轉成BitmapMovieClip): call BitmapCacher.cacheBitmapMovie

2013年8月26日 星期一

Background map loading

In BackGroundRender.as
also check BackGroundManager

Radar map

set the mini map sprite, it is the same sprite that is used in MapPanel
In SceneUIView.as : case SceneUI.SET_MINI_MAP:
scenePanel.setSmallMap(params["map"]); :called in SceneUI.as. setMinimap -> add mini map Sprite in ScenePanel.as.setSmallMap (search "curMap");

MiniMap.as: Sprite

Why mini map doesn't exceed to radar? see mainUISkin.fla -> SmallMap(ASLinkage name) -> layer 5 (mask layer)

panel basic logic

use UiAppDomainMemory.getAppDomain to load swf(material)

monsters' and other players' positions display

In MapInfoFightObject.setWorldPosition(x, y) : unit is pixel

setWorldPosition: the data listeners are in "MapInfoMonsterView.as" and "WorldUserView.as" to set the View object position


MapInfoFightObject.scheduleMove: retrieve next move in m_movePtList (FightObj's move list) and move to that position<br> FightObj includes monsters and other players

scheduleUserMove:由mainTimer執行更新所有FightObj的移動

WorldUserSelf.scheduleMove定義玩家本身人物移動(在mainTimer.scheduleUserMove裡update)

2013年8月23日 星期五

map panel (open by top right map button)

swf path: /res/swf/ui/mapPanel.swf
small map icon swf: base.swf
map panel

MiniMap.as: callBackMouseXXX:Function :defined in MapPanel.as (this.minimap.callBackXXX) : defined in MiniMapLogic.as ?? mouse event handling functions, function name: mouseXXX, load icons (NPC, monster...)

MiniMap.as: control what to be drawn on the mini map and the icon positions on the minimap

MiniMapView.as : handle user's action on mini map and call related function to control what to display

load mini map: in (setup in init() in ResManager) ResManager's loaderCompleteHandler -> call (GameResource.callBack) tempRes.callback(tempRes.resourse) -> call (loadRes() in ResManager) loadMapData() in MapInfoManager

WorldScene.process -> call MapInfoManager.loadMapData -> call MapInfoManager.loadMiniMapCompleteCallback "OR" call ResManager.loadRes -> call MapInfoManager.loadMiniMapCompleteCallBack -> call MapInfoManager.loadMiniMapComplete


2013年8月22日 星期四

generate NPC

NPC.as : npc data: name, task...
NPCManager.as: define NPC type (shop, storage...) , get NPC, NPC status..
NPCControl.as: npc control functions (task progress control...)
NPCControlView: Control what to display (control NPCPanel
MapInfoNPCView.as: show NPC on the map, add mouse event listeners (load /res/swf/npc/)

2013年8月19日 星期一

draw monster

Monster.as: monster data (hp, name...)
MonsterManager.as: manage Monster (data)
MonsterMovie.as: contains functions to set monster's bitmap frame
MonsterActionManager.as: determine which function in MonsterMovie should be called to set monster's bitmap frame
MapInfoMonster.as: set/get monster's map info(direction on the map, mouse event handler about the monster on the map control), control map monsters' display status (what monster's components (hp bar, name...) should be shown on screen)
MapInfoMonsterView.as: contains all DisplayObjects(functions for display objects on/off and position setting) of a monster shown on the screen, also set mouse event handler for the displayed monster

WorldScene.process: this.m_sortedLayer.monsterEnter(fightObj as MapInfoMonster) -> in WorldSortedLayer -> in WorldSortedLayer.monsterEnterView: invokeDataListener -> In WorldSortedLayerView.as: onDataChanged-> case WorldSortedLayer.DATA_CHANGE_TYPE_MONSTER_ENTER: create and add MonsterView: bandInfo(MapInfoMonster.as).createView -> new MapInfoMonsterView as DataListener, in MapInfoMonster.onDataChanged: get monster's status to determine how to display the monster

load(/res/swf/monster/)

2013年8月16日 星期五

add player BitmapMC to screen

(WorldScene.as)process(): check NetMessage(include UserData), process() is registered to NetManager in WorldScene.registerHandler() (done in initCore() in "Launcher.as" ->(when process() called) (MapInfoManager.as) loadMapData-> loadMiniMapCompleteCallback->loadMiniMapComplete->(WorldScene.as) mapLoadComplete->initScene->stage.addChildAt(m_gameLayer,0);

how the avatar generated
WorldScene.process -> if(msg is DWorldUserEnter) -> this.m_sortedLayer.userEnter(wUser) -> userEnterView(user) -> this.invokeDataListener(params);//invoke new WorldSortedLayerView.onDataChanged -> case WorldSortedLayer.DATA_CHANGE_TYPE_USER_ENTER -> userView = user.createView(null) as WorldUserView -> tempView.initAvatar() -> this._graphics = PlayerManager.instance.getAvator(race,sex,userClothes,weapons,userMount,bool) ->var playerPath:String = this.getClothesPath(professional,sex,clothes,userMount),  var player:Player = PlayerManager.instance.getPlayer(playerPath,weaponsPath,mountPath,isHigh);

swf path: /res/swf/avatar/

Avatar setting:
sex: in WorldUser
professional (race):  UserData

2013年8月15日 星期四

log in flow

Main -> onAdd( when Main.swf is added to stage)  -> preloading complete -> startClient() -> enter "Launcher.as" initToLogin (pass id, pw to Launcher) : MainUI init, stage.addChild(MainUI) -> initCore() -> stage.addChild(currentScene) -> initLogin() ->onLoginConnect: when connect succeed, send login info to server (sendLoginMessage) -> enter "Login.as": loginLoginServer(id, pw) ->enter "NetManager.as": sendMessage : login info into message queue -> back to "Launcher.as" in initCore() -> back to initToLogin: loadAllResComplete() :connect -> enter "Link.as": ConnectHandler -> outerConnectEventHandler (defined in "NetManager.as" onConnect() -> sendMessage()


2013年8月12日 星期一

To Do

Ctrl+Shift+T

Launcher
Profile
Component
ActiveView
Active
ActivePanel
ActivitiesView

2013年6月14日 星期五

map save format

c: for server
flash:  for flash: includes "canPK" "mapType" at the end of file

2013年6月11日 星期二

grid type

public static const POINT_BLOCK:int = 0;//不可通过点
public static const POINT_SHELTER:int = 2;//遮挡点
public static const POINT_TRANSMISSION:int = 3; //传送点
public static const POINT_MONSTER:int = 4; //怪物
public static const POINT_EFFECT:int = 100; //特效
public static const POINT_BORN:int = 6; //出生点
public static const POINT_BORDER:int = 7; //边界
public static const POINT_NPC:int = 8; //npc
public static const POINT_BOSS_BOX:int = 9;