- 001
- 002
- 003
- 004
- 005
- 006
- 007
- 008
- 009
- 010
- 011
- 012
- 013
- 014
- 015
- 016
- 017
- 018
- 019
- 020
- 021
- 022
- 023
- 024
- 025
- 026
- 027
- 028
- 029
- 030
- 031
- 032
- 033
- 034
- 035
- 036
- 037
- 038
- 039
- 040
- 041
- 042
- 043
- 044
- 045
- 046
- 047
- 048
- 049
- 050
- 051
- 052
- 053
- 054
- 055
- 056
- 057
- 058
- 059
- 060
- 061
- 062
- 063
- 064
- 065
- 066
- 067
- 068
- 069
- 070
- 071
- 072
- 073
- 074
- 075
- 076
- 077
- 078
- 079
- 080
- 081
- 082
- 083
- 084
- 085
- 086
- 087
- 088
- 089
- 090
- 091
- 092
- 093
- 094
- 095
- 096
- 097
- 098
- 099
- 100
private function checkClickCondition():Boolean {
if ((isBildable(_focus) && GameObjectMediator(_focus).step && GameObjectMediator(_focus).step.isLock && isEditObjectMode(objectEditorMode))|| isTile(_focus)|| isHelper(_focus)) {
return true;
}
return false;
}
private function isEditObjectMode(objectEditorMode:String):Boolean {
return (objectEditorMode == LevelMediator.MOVE_OBJECTS|| objectEditorMode == LevelMediator.ROTATE_OBJECTS|| objectEditorMode == LevelMediator.CREATE_OBJECTS|| objectEditorMode == LevelMediator.PLACE_OBJECT|| objectEditorMode == LevelMediator.STORE_OBJECTS|| objectEditorMode == LevelMediator.SELL_OBJECTS)
}
private function isHelper(val:ISortable):Boolean {return (val && val is HelperMediator);}
private function isTile(val:ISortable):Boolean {return (val && !(val is GameObjectMediator));}
private function isBildable(val:ISortable):Boolean {return (val && val is GameObjectMediator);}
protected function onClick(e:MouseEvent = null):void {
var focusTile:TileMediator = _focus as TileMediator;
if (_mouseClickLockedFromTutor && _focus != _tutorMagicObject) return;
if (_mouseClickLockedlockAllExceptFowFromTutor) {
if (!_focus) {
this.sendNotification(CellNotifications.CLICK, this._currentCell);
return;
}
if (!(_focus is FowObject)) return;
}
if (focusTile || this._newObjectPreview) {
if (checkClickCondition()) {
switch (this.objectEditorMode) {
case LevelMediator.MOVE_OBJECTS:
if (this._newObjectPreview) {
if (this.greenPlace) {
this.moveObject();
}
}
else if (focusTile.isMovable && !focusTile.data.worker) {
_movedObject = focusTile;
focusTile.removeHighlight();
_hittest.removeObject(_focus);
_focus = null;
focusTile.data.clearCells();
_movedObject.onStartDragging();
this.trackMode = TRACKING_DISABLED;
setNewObjectAsset(focusTile.buildable.id, AnimationsList.IDLE, _movedObject.currentAnimationStep);
if (_movedObject is GameObjectMediator && GameObjectMediator(_movedObject).flip) {
this._newObjectPreview.view.flip = GameObjectMediator(_movedObject).flip;
}
}
break;
case LevelMediator.ROTATE_OBJECTS:
if (focusTile.isRotateble && !focusTile.data.worker) {
this.rotateObject(this._focus as GameObjectMediator);
}
break;
case LevelMediator.CREATE_OBJECTS:
if (this._newObjectPreview && greenPlace) {
this.createBuyObject();
}
break;
case LevelMediator.PLACE_OBJECT:
if (this._newObjectPreview && greenPlace) {
this.placeInventoryObject();
}
break;
case LevelMediator.STORE_OBJECTS:
if (focusTile.isStorable && !focusTile.data.worker) {
sendNotification(SoundNotifications.SOUND_PLAY, Sounds.SND_ITEM_STORE);
sendNotification(GameNotifications.RUN_DIRECTIVE, {
name: DStorageItem.NAME,
args: {id: _focus.id}}
);
}
break;
case LevelMediator.SELL_OBJECTS:
if (focusTile.isSellable && !focusTile.data.worker) {
sendNotification(GameNotifications.RUN_DIRECTIVE, {
name: DSellBuildable.NAME,
args: {
id: _focus.id,
buildableId: focusTile.buildable.id,
value: 1,
confirmation: true}
});}
break;
default:
if (this._focus is HelperMediator) {
(this._focus as HelperMediator).onClick();
sendNotification(GameObjectNotifications.ON_CLICK, {id: _focus.id});}
else {
var gom:GameObjectMediator = _focus as GameObjectMediator;
if (gom && (gom.complete || gom.step != null && !focusTile.data.worker)) {
if (!gom.wait) {
Debug.log('LevelMediator.onClick: ObjectNotifications.CLICK ' + focusTile.data);
this.sendNotification(ObjectNotifications.CLICK, focusTile.data);
}
else if (Settings.ingamelog) {
this.sendNotification(UINotifications.SHOW_CONFIRMATION_WINDOW, {
title: 'speedup',
description: 'for testing purposes',
res: focusTile.buildable,
action: {
notification: UINotifications.TEST_SPEED_UP,
body: this._focus}
Сижу, меняю условия так чтобы за квестовыми объектами можно было проставлять декор...
nonamez 03.07.2013 14:23 # +4
3.14159265 03.07.2013 16:28 # +4
Lure Of Chaos 03.07.2013 17:45 # +1
wvxvw 03.07.2013 16:25 # +2
Ну и пурЭмВэЦе использован в этом коде для чего угодно, но только не для того, для чего он задумывался.
PS. FowObject - Fissure of Woe Object?
kyzi007 03.07.2013 17:10 # +1
vistefan 03.07.2013 17:19 # +1