From 85896fbbd4ac18669a33c34c55d27c8563584365 Mon Sep 17 00:00:00 2001 From: tounefr Date: Mon, 4 May 2015 14:08:26 +0200 Subject: [PATCH] 2.28 --- Dofus.as | 1545 +++-- Dynamic.as | 20 +- README.md | 5 +- com/TubulConstants.as | 46 +- com/adobe/utils/StringUtil.as | 153 +- com/ankamagames/atouin/Atouin.as | 927 +-- com/ankamagames/atouin/AtouinConstants.as | 122 +- .../atouin/data/DataFormatError.as | 22 +- com/ankamagames/atouin/data/DefaultMap.as | 109 +- .../atouin/data/elements/Elements.as | 309 +- .../data/elements/GraphicalElementData.as | 59 +- .../data/elements/GraphicalElementFactory.as | 78 +- .../data/elements/GraphicalElementTypes.as | 37 +- .../subtypes/AnimatedGraphicalElementData.as | 70 +- .../subtypes/BlendedGraphicalElementData.as | 65 +- .../BoundingBoxGraphicalElementData.as | 22 +- .../subtypes/EntityGraphicalElementData.as | 140 +- .../subtypes/NormalGraphicalElementData.as | 124 +- .../subtypes/ParticlesGraphicalElementData.as | 63 +- com/ankamagames/atouin/data/map/Cell.as | 217 +- com/ankamagames/atouin/data/map/CellData.as | 364 +- com/ankamagames/atouin/data/map/Fixture.as | 183 +- com/ankamagames/atouin/data/map/Layer.as | 138 +- com/ankamagames/atouin/data/map/Map.as | 872 +-- .../atouin/data/map/elements/BasicElement.as | 102 +- .../data/map/elements/GraphicalElement.as | 222 +- .../atouin/data/map/elements/SoundElement.as | 140 +- .../data/map/elements/UnknownElementError.as | 22 +- .../display/AtouinDisplayBehavior.as | 114 +- .../movements/AnimatedMovementBehavior.as | 762 +-- .../movements/MountedMovementBehavior.as | 113 +- .../movements/ParableMovementBehavior.as | 272 +- .../movements/RunningMovementBehavior.as | 83 +- .../movements/SlideMovementBehavior.as | 123 +- .../movements/WalkingMovementBehavior.as | 83 +- .../atouin/enums/ElementTypesEnum.as | 25 +- com/ankamagames/atouin/enums/GroundCache.as | 43 +- com/ankamagames/atouin/enums/MapTypesEnum.as | 25 +- .../atouin/enums/PlacementStrataEnums.as | 52 +- .../atouin/managers/AnimatedElementManager.as | 225 +- .../atouin/managers/DataGroundMapManager.as | 585 +- .../atouin/managers/EntitiesDisplayManager.as | 465 +- .../atouin/managers/EntitiesManager.as | 553 +- .../atouin/managers/FrustumManager.as | 1112 ++-- .../atouin/managers/InteractiveCellManager.as | 804 +-- .../atouin/managers/MapDisplayManager.as | 1001 ++-- .../atouin/managers/SelectionManager.as | 282 +- .../messages/AdjacentMapClickMessage.as | 29 +- .../atouin/messages/AdjacentMapOutMessage.as | 59 +- .../atouin/messages/AdjacentMapOverMessage.as | 94 +- .../atouin/messages/CellClickMessage.as | 25 +- .../atouin/messages/CellInteractionMessage.as | 118 +- .../atouin/messages/CellOutMessage.as | 18 +- .../atouin/messages/CellOverMessage.as | 18 +- .../messages/EntityMovementCompleteMessage.as | 57 +- .../messages/EntityMovementStartMessage.as | 57 +- .../messages/EntityMovementStoppedMessage.as | 55 +- .../messages/MapContainerRollOutMessage.as | 22 +- .../messages/MapContainerRollOverMessage.as | 22 +- .../atouin/messages/MapLoadedMessage.as | 35 +- .../messages/MapLoadingFailedMessage.as | 29 +- com/ankamagames/atouin/messages/MapMessage.as | 73 +- .../messages/MapRenderProgressMessage.as | 38 +- .../atouin/messages/MapZoomMessage.as | 72 +- .../messages/MapsLoadingCompleteMessage.as | 59 +- .../messages/MapsLoadingStartedMessage.as | 18 +- .../atouin/renderers/CellLinkRenderer.as | 187 +- .../atouin/renderers/MapRenderer.as | 2428 ++++---- .../atouin/renderers/MovementZoneRenderer.as | 61 +- .../atouin/renderers/TrapZoneRenderer.as | 274 +- .../atouin/renderers/ZoneClipRenderer.as | 428 +- .../atouin/renderers/ZoneDARenderer.as | 319 +- .../atouin/resources/AtouinResourceType.as | 25 +- .../resources/adapters/ElementsAdapter.as | 121 +- .../atouin/resources/adapters/MapsAdapter.as | 113 +- .../atouin/types/AnimatedElementInfo.as | 59 +- com/ankamagames/atouin/types/AtouinOptions.as | 118 +- .../atouin/types/BitmapCellContainer.as | 295 +- com/ankamagames/atouin/types/CellContainer.as | 235 +- com/ankamagames/atouin/types/CellLink.as | 120 +- com/ankamagames/atouin/types/CellReference.as | 253 +- .../atouin/types/DataMapContainer.as | 719 +-- com/ankamagames/atouin/types/DebugToolTip.as | 137 +- com/ankamagames/atouin/types/Frustum.as | 215 +- com/ankamagames/atouin/types/FrustumShape.as | 42 +- com/ankamagames/atouin/types/GraphicCell.as | 143 +- .../atouin/types/ICellContainer.as | 76 +- .../atouin/types/InteractiveCell.as | 46 +- .../atouin/types/LayerContainer.as | 101 +- com/ankamagames/atouin/types/MapGfxBitmap.as | 47 +- com/ankamagames/atouin/types/Selection.as | 173 +- com/ankamagames/atouin/types/SpriteWrapper.as | 48 +- com/ankamagames/atouin/types/TrapZoneTile.as | 207 +- .../atouin/types/TweenEntityData.as | 90 +- .../atouin/types/WorldEntitySprite.as | 77 +- com/ankamagames/atouin/types/ZoneClipTile.as | 775 +-- com/ankamagames/atouin/types/ZoneTile.as | 295 +- .../atouin/types/ZoneTile__cell.as | 23 +- .../atouin/types/events/RenderMapEvent.as | 71 +- .../atouin/types/miscs/PartialDataMap.as | 33 +- .../types/sequences/AddWorldEntityStep.as | 50 +- .../types/sequences/DestroyEntityStep.as | 64 +- .../types/sequences/ParableGfxMovementStep.as | 168 +- .../atouin/utils/CellIdConverter.as | 132 +- com/ankamagames/atouin/utils/CellUtil.as | 117 +- .../atouin/utils/DataMapProvider.as | 533 +- .../atouin/utils/GroundMapLoader.as | 275 +- com/ankamagames/atouin/utils/IZoneRenderer.as | 26 +- .../atouin/utils/VisibleCellDetection.as | 314 +- .../atouin/utils/errors/AtouinError.as | 22 +- .../atouin/utils/map/getMapIdFromCoord.as | 48 +- .../atouin/utils/map/getMapUriFromId.as | 16 +- .../utils/map/getWorldPointFromMapId.as | 38 +- com/ankamagames/berilia/Berilia.as | 1522 ++--- com/ankamagames/berilia/BeriliaConstants.as | 80 +- .../berilia/FinalizableUIComponent.as | 22 +- com/ankamagames/berilia/UIComponent.as | 20 +- com/ankamagames/berilia/api/ApiBinder.as | 549 +- .../berilia/api/GenericApiFunction.as | 74 +- .../berilia/api/ModuleReference.as | 145 +- com/ankamagames/berilia/api/ReadOnlyObject.as | 485 +- com/ankamagames/berilia/api/UiApi.as | 1548 +++-- .../berilia/components/CharacterWheel.as | 1562 ++--- .../berilia/components/ChatComponent.as | 1863 +++--- .../berilia/components/ColorPicker.as | 965 +-- .../berilia/components/ComboBox.as | 1138 ++-- .../berilia/components/ComboBoxGrid.as | 115 +- .../components/ComponentInternalAccessor.as | 29 +- .../berilia/components/EntityDisplayer.as | 1443 ++--- com/ankamagames/berilia/components/Grid.as | 2920 ++++----- com/ankamagames/berilia/components/Input.as | 1292 ++-- .../berilia/components/InputComboBox.as | 518 +- com/ankamagames/berilia/components/Label.as | 2984 +++++----- .../berilia/components/LinkedLabel.as | 113 +- .../berilia/components/MapIconElement.as | 116 +- .../berilia/components/MapViewer.as | 3197 +++++----- .../berilia/components/ScrollBar.as | 1674 +++--- com/ankamagames/berilia/components/Slot.as | 2079 +++---- .../berilia/components/SpellZoneComponent.as | 333 +- .../berilia/components/SwfApplication.as | 333 +- com/ankamagames/berilia/components/TabSet.as | 1402 ++--- .../berilia/components/TextArea.as | 623 +- com/ankamagames/berilia/components/Texture.as | 1877 +++--- com/ankamagames/berilia/components/Tree.as | 181 +- .../berilia/components/VideoPlayer.as | 611 +- .../berilia/components/WebBrowser.as | 1148 ++-- .../gridRenderer/EntityGridRenderer.as | 335 +- .../gridRenderer/InlineXmlGridRenderer.as | 113 +- .../gridRenderer/LabelGridRenderer.as | 421 +- .../gridRenderer/MultiGridRenderer.as | 625 +- .../gridRenderer/SlotGridRenderer.as | 651 ++- .../gridRenderer/TreeGridRenderer.as | 708 +-- .../gridRenderer/XmlUiGridRenderer.as | 430 +- .../components/messages/BrowserDomReady.as | 26 +- .../messages/BrowserSessionTimeout.as | 26 +- .../components/messages/ChangeMessage.as | 26 +- .../components/messages/ColorChangeMessage.as | 26 +- .../components/messages/ComponentMessage.as | 138 +- .../messages/ComponentReadyMessage.as | 26 +- .../components/messages/CreateTabMessage.as | 26 +- .../components/messages/DeleteTabMessage.as | 43 +- .../components/messages/DropMessage.as | 45 +- .../components/messages/EntityReadyMessage.as | 26 +- .../messages/ItemRightClickMessage.as | 45 +- .../components/messages/ItemRollOutMessage.as | 45 +- .../messages/ItemRollOverMessage.as | 45 +- .../messages/MapElementRightClickMessage.as | 47 +- .../messages/MapElementRollOutMessage.as | 47 +- .../messages/MapElementRollOverMessage.as | 47 +- .../components/messages/MapMoveMessage.as | 30 +- .../components/messages/MapRollOverMessage.as | 58 +- .../components/messages/RenameTabMessage.as | 58 +- .../messages/SelectEmptyItemMessage.as | 43 +- .../components/messages/SelectItemMessage.as | 58 +- .../components/messages/TextClickMessage.as | 43 +- .../messages/TextureLoadFailMessage.as | 43 +- .../messages/TextureReadyMessage.as | 43 +- .../messages/VideoBufferChangeMessage.as | 43 +- .../messages/VideoConnectFailedMessage.as | 26 +- .../messages/VideoConnectSuccessMessage.as | 26 +- .../components/params/GridScriptProperties.as | 45 +- .../components/params/TooltipProperties.as | 90 +- com/ankamagames/berilia/enums/EventEnums.as | 404 +- .../berilia/enums/LocationTypeEnum.as | 26 +- .../berilia/enums/SelectMethodEnum.as | 55 +- .../berilia/enums/ShortcutsEnum.as | 29 +- com/ankamagames/berilia/enums/StatesEnum.as | 75 +- com/ankamagames/berilia/enums/StrataEnum.as | 52 +- .../berilia/enums/XmlAttributesEnum.as | 70 +- com/ankamagames/berilia/enums/XmlTagsEnum.as | 106 +- .../berilia/eventInterface/EventOnShortcut.as | 16 +- .../berilia/eventInterface/UIEvent.as | 12 +- .../berilia/events/LinkInteractionEvent.as | 39 +- .../berilia/factories/HyperlinkFactory.as | 573 +- .../berilia/factories/MenusFactory.as | 167 +- .../berilia/factories/TooltipsFactory.as | 189 +- .../berilia/frames/ShortcutsFrame.as | 510 +- .../berilia/frames/UIInteractionFrame.as | 1028 ++-- com/ankamagames/berilia/interfaces/IApi.as | 12 +- .../interfaces/IApplicationContainer.as | 12 +- .../berilia/interfaces/IClonable.as | 16 +- .../berilia/interfaces/IGridRenderer.as | 47 +- .../berilia/interfaces/IMenuMaker.as | 16 +- .../berilia/interfaces/IRadioItem.as | 28 +- .../berilia/interfaces/ITooltipMaker.as | 16 +- .../berilia/managers/BindsManager.as | 1436 ++--- .../berilia/managers/CssManager.as | 593 +- .../berilia/managers/EmbedFontManager.as | 281 +- .../berilia/managers/GenericEventsManager.as | 215 +- .../berilia/managers/HtmlManager.as | 480 +- .../berilia/managers/KernelEventsManager.as | 301 +- .../managers/LinkedCursorSpriteManager.as | 305 +- .../berilia/managers/SecureCenter.as | 299 +- .../berilia/managers/SlotDataHolderManager.as | 151 +- .../berilia/managers/TemplateManager.as | 246 +- .../berilia/managers/ThemeManager.as | 546 +- .../berilia/managers/TooltipManager.as | 732 +-- .../berilia/managers/UIEventManager.as | 124 +- .../berilia/managers/UiGroupManager.as | 238 +- .../berilia/managers/UiModuleManager.as | 2856 ++++----- .../berilia/managers/UiRenderManager.as | 504 +- .../berilia/managers/UiSoundManager.as | 251 +- .../berilia/pools/PoolableUiRenderer.as | 37 +- .../berilia/pools/PoolableXmlParsor.as | 33 +- com/ankamagames/berilia/pools/PoolsManager.as | 129 +- .../berilia/types/BeriliaOptions.as | 28 +- com/ankamagames/berilia/types/LocationEnum.as | 46 +- .../berilia/types/data/ApiAction.as | 184 +- .../types/data/BeriliaUiElementSound.as | 28 +- .../berilia/types/data/BeriliaUiSound.as | 28 +- .../berilia/types/data/ChunkData.as | 36 +- .../berilia/types/data/ContextMenuData.as | 52 +- .../berilia/types/data/ExtendedStyleSheet.as | 387 +- .../berilia/types/data/GridItem.as | 43 +- com/ankamagames/berilia/types/data/Hook.as | 125 +- .../berilia/types/data/LinkedCursorData.as | 40 +- com/ankamagames/berilia/types/data/Map.as | 122 +- com/ankamagames/berilia/types/data/MapArea.as | 309 +- .../berilia/types/data/MapElement.as | 206 +- .../berilia/types/data/OldMessage.as | 42 +- .../berilia/types/data/PreCompiledUiModule.as | 295 +- .../berilia/types/data/RadioGroup.as | 173 +- .../berilia/types/data/SlotDragAndDropData.as | 38 +- .../berilia/types/data/TextTooltipInfo.as | 59 +- com/ankamagames/berilia/types/data/Theme.as | 42 +- .../berilia/types/data/TreeData.as | 128 +- com/ankamagames/berilia/types/data/UiData.as | 204 +- com/ankamagames/berilia/types/data/UiGroup.as | 101 +- .../berilia/types/data/UiModule.as | 1049 ++-- .../berilia/types/data/UnsecureArray.as | 33 +- .../berilia/types/event/BeriliaEvent.as | 30 +- .../berilia/types/event/CssEvent.as | 49 +- .../berilia/types/event/HookEvent.as | 49 +- .../berilia/types/event/HookLogEvent.as | 78 +- .../berilia/types/event/InstanceEvent.as | 120 +- .../berilia/types/event/ParsingErrorEvent.as | 62 +- .../berilia/types/event/ParsorEvent.as | 60 +- .../berilia/types/event/PreProcessEndEvent.as | 49 +- .../types/event/TemplateLoadedEvent.as | 47 +- .../types/event/TextureLoadFailedEvent.as | 66 +- .../berilia/types/event/UiRenderAskEvent.as | 64 +- .../berilia/types/event/UiRenderEvent.as | 79 +- .../berilia/types/event/UiUnloadEvent.as | 50 +- .../berilia/types/graphic/ButtonContainer.as | 747 +-- .../types/graphic/ChatTextContainer.as | 22 +- .../berilia/types/graphic/GraphicContainer.as | 1884 +++--- .../berilia/types/graphic/GraphicElement.as | 136 +- .../berilia/types/graphic/GraphicLocation.as | 403 +- .../berilia/types/graphic/GraphicSize.as | 122 +- .../types/graphic/InternalComponentAccess.as | 43 +- .../berilia/types/graphic/MapAreaShape.as | 281 +- .../berilia/types/graphic/MapGroupElement.as | 349 +- .../berilia/types/graphic/ScrollContainer.as | 617 +- .../berilia/types/graphic/StateContainer.as | 434 +- .../types/graphic/TimeoutHTMLLoader.as | 204 +- .../berilia/types/graphic/UiRootContainer.as | 1666 +++--- .../berilia/types/listener/GenericListener.as | 221 +- .../types/messages/AllModulesLoadedMessage.as | 22 +- .../types/messages/AllUiXmlParsedMessage.as | 22 +- .../types/messages/ModuleExecErrorMessage.as | 57 +- .../types/messages/ModuleLoadedMessage.as | 42 +- .../ModuleRessourceLoadFailedMessage.as | 74 +- .../types/messages/NoThemeErrorMessage.as | 22 +- .../types/messages/ThemeLoadErrorMessage.as | 42 +- .../types/messages/ThemeLoadedMessage.as | 42 +- .../types/messages/UiXmlParsedErrorMessage.as | 57 +- .../types/messages/UiXmlParsedMessage.as | 42 +- .../berilia/types/shortcut/Bind.as | 163 +- .../types/shortcut/LocalizedKeyboard.as | 72 +- .../berilia/types/shortcut/Shortcut.as | 500 +- .../types/shortcut/ShortcutCategory.as | 102 +- .../berilia/types/template/TemplateParam.as | 35 +- .../berilia/types/template/TemplateVar.as | 45 +- .../berilia/types/template/XmlTemplate.as | 410 +- .../berilia/types/tooltip/EmptyTooltip.as | 22 +- .../berilia/types/tooltip/Tooltip.as | 268 +- .../berilia/types/tooltip/TooltipBlock.as | 289 +- .../berilia/types/tooltip/TooltipChunk.as | 64 +- .../berilia/types/tooltip/TooltipPlacer.as | 1140 ++-- .../berilia/types/tooltip/TooltipPosition.as | 149 +- .../berilia/types/tooltip/TooltipRectangle.as | 151 +- .../types/uiDefinition/BasicElement.as | 127 +- .../types/uiDefinition/ButtonElement.as | 18 +- .../types/uiDefinition/ComponentElement.as | 31 +- .../types/uiDefinition/ContainerElement.as | 28 +- .../berilia/types/uiDefinition/GridElement.as | 31 +- .../types/uiDefinition/LocationELement.as | 80 +- .../types/uiDefinition/PropertyElement.as | 25 +- .../uiDefinition/ScrollContainerElement.as | 18 +- .../berilia/types/uiDefinition/SizeElement.as | 80 +- .../uiDefinition/StateContainerElement.as | 28 +- .../types/uiDefinition/UiDefinition.as | 79 +- .../berilia/uiRender/UiRenderer.as | 1134 ++-- com/ankamagames/berilia/uiRender/XmlParsor.as | 2245 ++++--- .../berilia/uiRender/XmlPreProcessor.as | 339 +- .../berilia/utils/BeriliaHookList.as | 98 +- .../berilia/utils/ComponentList.as | 126 +- com/ankamagames/berilia/utils/EmbedIcons.as | 26 +- com/ankamagames/berilia/utils/GridItemList.as | 51 +- .../berilia/utils/ModFlashProtocol.as | 108 +- com/ankamagames/berilia/utils/ModProtocol.as | 67 +- .../berilia/utils/ModuleFileManager.as | 259 +- .../berilia/utils/ModuleInspector.as | 375 +- .../berilia/utils/ModuleScriptAnalyzer.as | 308 +- .../berilia/utils/ThemeFlashProtocol.as | 134 +- .../berilia/utils/ThemeProtocol.as | 73 +- com/ankamagames/berilia/utils/UiProperties.as | 18 +- .../berilia/utils/UriCacheFactory.as | 86 +- .../berilia/utils/errors/ApiError.as | 22 +- .../berilia/utils/errors/BeriliaError.as | 22 +- .../utils/errors/BeriliaXmlParsingError.as | 22 +- .../utils/errors/UntrustedApiCallError.as | 22 +- .../berilia/utils/web/HttpResponder.as | 704 +-- .../berilia/utils/web/HttpServer.as | 229 +- .../berilia/utils/web/HttpSocket.as | 186 +- .../berilia/utils/web/MimeTypeHelper.as | 49 +- com/ankamagames/dofus/BuildInfos.as | 40 +- com/ankamagames/dofus/Constants.as | 78 +- .../dofus/Constants_SIGNATURE_KEY_DATA.as | 23 +- .../BasicConsoleInstructionRegistar.as | 61 +- .../ChatConsoleInstructionRegistrar.as | 103 +- .../DebugConsoleInstructionRegistar.as | 145 +- .../console/chat/EmoteInstructionHandler.as | 115 +- .../console/chat/FightInstructionHandler.as | 235 +- .../console/chat/InfoInstructionHandler.as | 214 +- .../chat/MessagingInstructionHandler.as | 108 +- .../console/chat/OptionsInstructionHandler.as | 102 +- .../console/chat/SocialInstructionHandler.as | 236 +- .../console/chat/StatusInstructionHandler.as | 202 +- .../common/LatencyInstructionHandler.as | 124 +- .../debug/ActionsInstructionHandler.as | 537 +- .../debug/BenchmarkInstructionHandler.as | 534 +- .../debug/ClearSceneInstructionHandler.as | 238 +- .../ClearTextureCacheInstructionHandler.as | 88 +- .../debug/ConnectionInstructionHandler.as | 104 +- .../console/debug/CryptoInstructionHandler.as | 104 +- .../debug/DisplayMapInstructionHandler.as | 330 +- .../console/debug/DtdInstructionHandler.as | 513 +- .../debug/EnterFrameInstructionHandler.as | 120 +- .../console/debug/FightInstructionHandler.as | 170 +- .../console/debug/FontInstructionHandler.as | 121 +- .../console/debug/FrameInstructionHandler.as | 179 +- .../debug/FullScreenInstructionHandler.as | 138 +- .../console/debug/IAInstructionHandler.as | 376 +- .../debug/InventoryInstructionHandler.as | 224 +- .../debug/LivingObjectInstructionHandler.as | 102 +- .../console/debug/LuaInstructionHandler.as | 134 +- .../console/debug/MiscInstructionHandler.as | 796 ++- .../console/debug/PanicInstructionHandler.as | 92 +- .../console/debug/ResetInstructionHandler.as | 80 +- .../console/debug/SoundInstructionHandler.as | 455 +- .../console/debug/SystemInstructionHandler.as | 78 +- .../console/debug/TiphonInstructionHandler.as | 230 +- .../debug/UiHandlerInstructionHandler.as | 604 +- .../debug/UpdaterInstructionHandler.as | 262 +- .../console/debug/UtilInstructionHandler.as | 1032 ++-- .../debug/VersionInstructionHandler.as | 120 +- .../debug/frames/ReccordNetworkPacketFrame.as | 162 +- .../console/debug/frames/UpdaterDebugFrame.as | 267 +- .../dofus/console/moduleLUA/ConsoleLUA.as | 1278 ++-- .../dofus/console/moduleLUA/LuaMoveEnum.as | 34 +- .../dofus/console/moduleLogger/Console.as | 2100 +++---- .../dofus/console/moduleLogger/ConsoleIcon.as | 427 +- .../moduleLogger/ConsoleIcon_I_AUTO_RESET.as | 23 +- .../moduleLogger/ConsoleIcon_I_BOOK.as | 23 +- .../ConsoleIcon_I_CAMERA_AUTOFOLLOW.as | 23 +- .../ConsoleIcon_I_CAMERA_ZOOM_IN.as | 23 +- .../ConsoleIcon_I_CAMERA_ZOOM_OUT.as | 23 +- .../moduleLogger/ConsoleIcon_I_CANCEL.as | 23 +- .../moduleLogger/ConsoleIcon_I_DISK.as | 23 +- .../moduleLogger/ConsoleIcon_I_LIST.as | 23 +- .../ConsoleIcon_I_MOVE_DEFAULT.as | 23 +- .../moduleLogger/ConsoleIcon_I_MOVE_RUN.as | 23 +- .../moduleLogger/ConsoleIcon_I_MOVE_SLIDE.as | 23 +- .../ConsoleIcon_I_MOVE_TELEPORT.as | 23 +- .../moduleLogger/ConsoleIcon_I_MOVE_WALK.as | 23 +- .../moduleLogger/ConsoleIcon_I_OPEN.as | 23 +- .../moduleLogger/ConsoleIcon_I_PAUSE.as | 23 +- .../moduleLogger/ConsoleIcon_I_PLAY.as | 23 +- .../moduleLogger/ConsoleIcon_I_RECORD.as | 23 +- .../moduleLogger/ConsoleIcon_I_RESET_WORLD.as | 23 +- .../moduleLogger/ConsoleIcon_I_SAVE.as | 23 +- .../moduleLogger/ConsoleIcon_I_SCREEN.as | 23 +- .../moduleLogger/ConsoleIcon_I_SCRIPT.as | 23 +- .../moduleLogger/ConsoleIcon_I_STOP.as | 23 +- .../moduleLogger/ConsoleIcon_I_TERMINAL.as | 23 +- .../moduleLogger/ConsoleIcon_I_WAIT.as | 23 +- .../moduleLogger/ConsoleIcon_I_WAITAUTO.as | 23 +- .../dofus/console/moduleLogger/FilterUI.as | 463 +- .../moduleLogger/ModuleDebugManager.as | 348 +- .../moduleLogger/TextFieldOldScrollBarH.as | 232 +- .../moduleLogger/TextFieldScrollBar.as | 489 +- .../dofus/console/moduleLogger/TypeMessage.as | 499 +- .../dofus/datacenter/abuse/AbuseReasons.as | 92 +- .../datacenter/alignments/AlignmentBalance.as | 119 +- .../datacenter/alignments/AlignmentEffect.as | 92 +- .../datacenter/alignments/AlignmentGift.as | 95 +- .../datacenter/alignments/AlignmentOrder.as | 92 +- .../datacenter/alignments/AlignmentRank.as | 126 +- .../alignments/AlignmentRankJntGift.as | 72 +- .../datacenter/alignments/AlignmentSide.as | 92 +- .../datacenter/alignments/AlignmentTitle.as | 92 +- .../datacenter/almanax/AlmanaxCalendar.as | 116 +- .../datacenter/ambientSounds/AmbientSound.as | 73 +- .../dofus/datacenter/appearance/Appearance.as | 49 +- .../appearance/CreatureBoneOverride.as | 58 +- .../datacenter/appearance/CreatureBoneType.as | 146 +- .../dofus/datacenter/appearance/Ornament.as | 95 +- .../datacenter/appearance/SkinMapping.as | 65 +- .../datacenter/appearance/SkinPosition.as | 65 +- .../dofus/datacenter/appearance/Title.as | 144 +- .../datacenter/appearance/TitleCategory.as | 80 +- .../dofus/datacenter/breeds/Breed.as | 501 +- .../dofus/datacenter/breeds/BreedRole.as | 119 +- .../datacenter/breeds/BreedRoleByBreed.as | 75 +- .../dofus/datacenter/breeds/Head.as | 108 +- .../dofus/datacenter/challenges/Challenge.as | 113 +- .../characteristics/Characteristic.as | 59 + .../characteristics/CharacteristicCategory.as | 51 + .../datacenter/communication/CensoredWord.as | 74 +- .../datacenter/communication/ChatChannel.as | 104 +- .../datacenter/communication/Emoticon.as | 239 +- .../datacenter/communication/InfoMessage.as | 96 +- .../dofus/datacenter/communication/Smiley.as | 75 +- .../dofus/datacenter/documents/Comic.as | 57 +- .../dofus/datacenter/documents/Document.as | 188 +- .../dofus/datacenter/effects/Effect.as | 139 +- .../datacenter/effects/EffectInstance.as | 1313 +++-- .../instances/EffectInstanceCreature.as | 85 +- .../effects/instances/EffectInstanceDate.as | 185 +- .../effects/instances/EffectInstanceDice.as | 184 +- .../instances/EffectInstanceDuration.as | 131 +- .../instances/EffectInstanceInteger.as | 123 +- .../effects/instances/EffectInstanceLadder.as | 107 +- .../effects/instances/EffectInstanceMinMax.as | 110 +- .../effects/instances/EffectInstanceMount.as | 131 +- .../effects/instances/EffectInstanceString.as | 85 +- .../ExternalNotification.as | 137 +- .../datacenter/guild/EmblemBackground.as | 65 +- .../dofus/datacenter/guild/EmblemSymbol.as | 77 +- .../datacenter/guild/EmblemSymbolCategory.as | 89 +- .../dofus/datacenter/guild/RankName.as | 92 +- .../dofus/datacenter/houses/House.as | 109 +- .../datacenter/interactives/Interactive.as | 86 +- .../datacenter/interactives/SkillName.as | 70 +- .../datacenter/interactives/StealthBones.as | 43 +- .../dofus/datacenter/items/Incarnation.as | 70 +- .../datacenter/items/IncarnationLevel.as | 75 +- .../dofus/datacenter/items/Item.as | 665 ++- .../dofus/datacenter/items/ItemSet.as | 92 +- .../dofus/datacenter/items/ItemType.as | 218 +- .../dofus/datacenter/items/PresetIcon.as | 56 +- .../dofus/datacenter/items/VeteranReward.as | 76 +- .../dofus/datacenter/items/Weapon.as | 143 +- .../criterion/AccountRightsItemCriterion.as | 79 +- .../criterion/AchievementItemCriterion.as | 122 +- .../items/criterion/AlignmentItemCriterion.as | 79 +- .../criterion/AlignmentLevelItemCriterion.as | 67 +- .../criterion/AllianceAvAItemCriterion.as | 123 +- .../items/criterion/AllianceItemCriterion.as | 97 +- .../criterion/AllianceRightsItemCriterion.as | 180 +- .../items/criterion/AreaItemCriterion.as | 124 +- .../items/criterion/BonesItemCriterion.as | 89 +- .../items/criterion/BonusSetItemCriterion.as | 142 +- .../items/criterion/BreedItemCriterion.as | 86 +- .../items/criterion/CommunityItemCriterion.as | 102 +- .../items/criterion/DayItemCriterion.as | 71 +- .../items/criterion/EmoteItemCriterion.as | 119 +- .../criterion/FriendlistItemCriterion.as | 77 +- .../items/criterion/GiftItemCriterion.as | 160 +- .../items/criterion/GroupItemCriterion.as | 781 ++- .../items/criterion/GuildItemCriterion.as | 99 +- .../criterion/GuildLevelItemCriterion.as | 81 +- .../criterion/GuildRightsItemCriterion.as | 342 +- .../items/criterion/IItemCriterion.as | 30 +- .../items/criterion/ItemCriterion.as | 404 +- .../items/criterion/ItemCriterionFactory.as | 399 +- .../items/criterion/ItemCriterionOperator.as | 122 +- .../items/criterion/JobItemCriterion.as | 200 +- .../items/criterion/KamaItemCriterion.as | 75 +- .../items/criterion/LevelItemCriterion.as | 67 +- .../criterion/MapCharactersItemCriterion.as | 134 +- .../items/criterion/MariedItemCriterion.as | 109 +- .../items/criterion/MaxRankCriterion.as | 81 +- .../items/criterion/MonthItemCriterion.as | 73 +- .../items/criterion/NameItemCriterion.as | 199 +- .../items/criterion/ObjectItemCriterion.as | 119 +- .../items/criterion/PVPRankItemCriterion.as | 61 +- .../criterion/PremiumAccountItemCriterion.as | 71 +- .../items/criterion/QuestItemCriterion.as | 175 +- .../items/criterion/RankCriterion.as | 81 +- .../items/criterion/RideItemCriterion.as | 93 +- .../items/criterion/ServerItemCriterion.as | 69 +- .../items/criterion/SexItemCriterion.as | 71 +- .../items/criterion/SkillItemCriterion.as | 59 +- .../items/criterion/SoulStoneItemCriterion.as | 133 +- .../criterion/SpecializationItemCriterion.as | 61 +- .../items/criterion/SpellItemCriterion.as | 159 +- .../criterion/StaticCriterionItemCriterion.as | 69 +- .../items/criterion/SubareaItemCriterion.as | 126 +- .../items/criterion/SubscribeItemCriterion.as | 81 +- .../SubscriptionDurationItemCriterion.as | 69 +- .../items/criterion/UnusableItemCriterion.as | 73 +- .../items/criterion/WeightItemCriterion.as | 67 +- com/ankamagames/dofus/datacenter/jobs/Job.as | 155 +- .../dofus/datacenter/jobs/Recipe.as | 333 +- .../dofus/datacenter/jobs/Skill.as | 158 +- .../livingObjects/LivingObjectSkinJntMood.as | 79 +- .../dofus/datacenter/livingObjects/Pet.as | 80 +- .../livingObjects/SpeakingItemText.as | 101 +- .../livingObjects/SpeakingItemsTrigger.as | 69 +- .../datacenter/misc/ActionDescription.as | 116 +- .../dofus/datacenter/misc/CensoredContent.as | 135 +- .../dofus/datacenter/misc/Month.as | 89 +- .../dofus/datacenter/misc/OptionalFeature.as | 86 +- com/ankamagames/dofus/datacenter/misc/Pack.as | 85 +- com/ankamagames/dofus/datacenter/misc/Tips.as | 80 +- .../dofus/datacenter/misc/TypeAction.as | 59 +- com/ankamagames/dofus/datacenter/misc/Url.as | 176 +- .../datacenter/monsters/AnimFunMonsterData.as | 22 +- .../dofus/datacenter/monsters/Companion.as | 126 +- .../monsters/CompanionCharacteristic.as | 102 +- .../datacenter/monsters/CompanionSpell.as | 62 +- .../dofus/datacenter/monsters/Monster.as | 185 +- .../dofus/datacenter/monsters/MonsterDrop.as | 78 +- .../dofus/datacenter/monsters/MonsterGrade.as | 100 +- .../datacenter/monsters/MonsterMiniBoss.as | 56 +- .../dofus/datacenter/monsters/MonsterRace.as | 87 +- .../datacenter/monsters/MonsterSuperRace.as | 80 +- .../dofus/datacenter/mounts/Mount.as | 83 +- .../dofus/datacenter/mounts/MountBehavior.as | 104 +- .../dofus/datacenter/mounts/MountBone.as | 82 +- .../dofus/datacenter/mounts/RideFood.as | 46 +- .../datacenter/notifications/Notification.as | 122 +- .../dofus/datacenter/npcs/AnimFunNpcData.as | 22 +- com/ankamagames/dofus/datacenter/npcs/Npc.as | 114 +- .../dofus/datacenter/npcs/NpcAction.as | 92 +- .../dofus/datacenter/npcs/NpcMessage.as | 79 +- .../datacenter/npcs/TaxCollectorFirstname.as | 79 +- .../dofus/datacenter/npcs/TaxCollectorName.as | 89 +- .../dofus/datacenter/quest/Achievement.as | 187 +- .../datacenter/quest/AchievementCategory.as | 134 +- .../datacenter/quest/AchievementObjective.as | 95 +- .../datacenter/quest/AchievementReward.as | 81 +- .../dofus/datacenter/quest/Quest.as | 264 +- .../dofus/datacenter/quest/QuestCategory.as | 125 +- .../dofus/datacenter/quest/QuestObjective.as | 180 +- .../datacenter/quest/QuestObjectiveType.as | 89 +- .../dofus/datacenter/quest/QuestStep.as | 339 +- .../datacenter/quest/QuestStepRewards.as | 75 +- .../QuestObjectiveBringItemToNpc.as | 149 +- .../QuestObjectiveBringSoulToNpc.as | 149 +- .../objectives/QuestObjectiveDiscoverMap.as | 90 +- .../QuestObjectiveDiscoverSubArea.as | 90 +- .../QuestObjectiveDuelSpecificPlayer.as | 90 +- .../objectives/QuestObjectiveFightMonster.as | 108 +- .../QuestObjectiveFightMonstersOnMap.as | 149 +- .../objectives/QuestObjectiveFreeForm.as | 77 +- .../quest/objectives/QuestObjectiveGoToNpc.as | 90 +- .../QuestObjectiveMultiFightMonster.as | 108 +- .../treasureHunt/LegendaryTreasureHunt.as | 155 +- .../quest/treasureHunt/PointOfInterest.as | 104 +- .../treasureHunt/PointOfInterestCategory.as | 80 +- .../dofus/datacenter/servers/Server.as | 195 +- .../datacenter/servers/ServerCommunity.as | 96 +- .../datacenter/servers/ServerGameType.as | 89 +- .../datacenter/servers/ServerPopulation.as | 92 +- .../dofus/datacenter/sounds/SoundAnimation.as | 86 +- .../dofus/datacenter/sounds/SoundBones.as | 236 +- .../dofus/datacenter/sounds/SoundUi.as | 68 +- .../dofus/datacenter/sounds/SoundUiElement.as | 55 +- .../dofus/datacenter/sounds/SoundUiHook.as | 56 +- .../dofus/datacenter/spells/Spell.as | 318 +- .../dofus/datacenter/spells/SpellBomb.as | 58 +- .../dofus/datacenter/spells/SpellLevel.as | 402 +- .../dofus/datacenter/spells/SpellPair.as | 107 +- .../dofus/datacenter/spells/SpellState.as | 91 +- .../dofus/datacenter/spells/SpellType.as | 94 +- .../dofus/datacenter/world/Area.as | 210 +- .../dofus/datacenter/world/Dungeon.as | 108 +- .../dofus/datacenter/world/Hint.as | 118 +- .../dofus/datacenter/world/HintCategory.as | 80 +- .../dofus/datacenter/world/MapCoordinates.as | 161 +- .../dofus/datacenter/world/MapPosition.as | 360 +- .../dofus/datacenter/world/MapReference.as | 61 +- .../dofus/datacenter/world/MapScrollAction.as | 77 +- .../dofus/datacenter/world/Phoenix.as | 43 +- .../dofus/datacenter/world/SubArea.as | 323 +- .../dofus/datacenter/world/SuperArea.as | 136 +- .../dofus/datacenter/world/Waypoint.as | 49 +- .../dofus/datacenter/world/WorldMap.as | 126 +- .../ExternalNotificationManager.as | 2225 +++---- .../ExternalNotificationRequest.as | 232 +- .../ExternalNotificationWindow.as | 234 +- .../enums/ExternalNotificationModeEnum.as | 34 +- .../enums/ExternalNotificationPositionEnum.as | 31 +- .../enums/ExternalNotificationTypeEnum.as | 136 +- .../factories/RolePlayEntitiesFactory.as | 373 +- .../almanax/AlmanaxEvent.as | 47 +- .../almanax/AlmanaxMonth.as | 38 +- .../almanax/AlmanaxZodiac.as | 35 +- .../appearance/OrnamentWrapper.as | 377 +- .../appearance/TitleWrapper.as | 370 +- .../communication/BasicChatSentence.as | 117 +- .../communication/ChatBubble.as | 42 +- .../communication/ChatInformationSentence.as | 72 +- .../ChatSentenceWithRecipient.as | 61 +- .../communication/ChatSentenceWithSource.as | 91 +- .../communication/CraftSmileyItem.as | 41 +- .../communication/DelayedActionItem.as | 46 +- .../communication/EmoteWrapper.as | 455 +- .../communication/SmileyWrapper.as | 324 +- .../communication/ThinkBubble.as | 42 +- .../connection/BasicCharacterWrapper.as | 126 +- .../connection/CreationCharacterWrapper.as | 97 +- .../connection/SubscriberGift.as | 162 +- .../conquest/AllianceOnTheHillWrapper.as | 176 +- .../conquest/PrismFightersWrapper.as | 58 +- .../conquest/PrismSubAreaWrapper.as | 539 +- .../fight/ChallengeWrapper.as | 299 +- .../fight/FightLootWrapper.as | 55 +- .../fight/FightResultEntryWrapper.as | 446 +- .../fight/FighterInformations.as | 558 +- .../guild/AllianceWrapper.as | 674 +-- .../internalDatacenter/guild/EmblemWrapper.as | 424 +- .../guild/GuildFactSheetWrapper.as | 326 +- .../guild/GuildHouseWrapper.as | 294 +- .../internalDatacenter/guild/GuildWrapper.as | 809 +-- .../guild/PaddockWrapper.as | 109 +- .../guild/SocialEntityInFightWrapper.as | 203 +- .../guild/SocialFightersWrapper.as | 92 +- .../guild/TaxCollectorWrapper.as | 275 +- .../internalDatacenter/house/HouseWrapper.as | 131 +- .../internalDatacenter/items/ItemWrapper.as | 1579 ++--- .../items/LivingObjectSkinWrapper.as | 324 +- .../internalDatacenter/items/MountWrapper.as | 334 +- .../internalDatacenter/items/PresetWrapper.as | 437 +- .../items/QuantifiedItemWrapper.as | 73 +- .../items/ShortcutWrapper.as | 1236 ++-- .../items/SimpleTextureWrapper.as | 172 +- .../internalDatacenter/items/WeaponWrapper.as | 84 +- .../jobs/CraftsmanWrapper.as | 140 +- .../internalDatacenter/jobs/JobWrapper.as | 311 +- .../dofus/internalDatacenter/jobs/KnownJob.as | 36 +- .../jobs/RecipeWithSkill.as | 61 +- .../internalDatacenter/mount/MountData.as | 374 +- .../internalDatacenter/people/EnemyWrapper.as | 97 +- .../people/FriendWrapper.as | 151 +- .../people/IgnoredWrapper.as | 72 +- .../people/PartyCompanionWrapper.as | 79 +- .../people/PartyMemberWrapper.as | 160 +- .../people/SpouseWrapper.as | 126 +- .../quest/TreasureHuntStepWrapper.as | 508 +- .../quest/TreasureHuntWrapper.as | 245 +- .../sales/OfflineSaleWrapper.as | 70 +- .../spells/EffectsListWrapper.as | 242 +- .../spells/EffectsWrapper.as | 43 +- .../internalDatacenter/spells/SpellWrapper.as | 1638 +++--- .../taxi/TeleportDestinationWrapper.as | 241 +- .../userInterface/ButtonWrapper.as | 305 +- .../world/WorldPointWrapper.as | 229 +- com/ankamagames/dofus/kernel/Kernel.as | 858 +-- com/ankamagames/dofus/kernel/PanicMessages.as | 104 +- .../dofus/kernel/net/ConnectionType.as | 31 +- .../dofus/kernel/net/ConnectionsHandler.as | 486 +- .../dofus/kernel/net/DisconnectionReason.as | 53 +- .../kernel/net/DisconnectionReasonEnum.as | 38 +- .../dofus/kernel/sound/SoundManager.as | 378 +- .../kernel/sound/TubulSoundConfiguration.as | 190 +- .../kernel/sound/enum/LookTypeSoundEnum.as | 37 +- .../dofus/kernel/sound/enum/SoundTypeEnum.as | 215 +- .../dofus/kernel/sound/enum/UISoundEnum.as | 313 +- .../sound/manager/AmbientSoundsManager.as | 562 +- .../sound/manager/ClassicSoundManager.as | 1740 +++--- .../kernel/sound/manager/FightMusicManager.as | 407 +- .../kernel/sound/manager/ISoundManager.as | 110 +- .../sound/manager/LocalizedSoundsManager.as | 248 +- .../sound/manager/RegConnectionManager.as | 495 +- .../kernel/sound/manager/RegSoundManager.as | 1382 ++--- .../kernel/sound/parser/XMLSoundParser.as | 162 +- .../kernel/sound/type/LocalizedMapSound.as | 61 +- .../dofus/kernel/sound/type/RollOffPreset.as | 68 +- .../dofus/kernel/sound/type/SoundDofus.as | 737 +-- .../dofus/kernel/sound/utils/SoundUtil.as | 148 +- .../kernel/updater/UpdaterConnexionHandler.as | 191 +- .../updaterv2/IUpdaterMessageHandler.as | 26 +- .../dofus/kernel/updaterv2/UpdaterApi.as | 98 +- .../updaterv2/UpdaterConnexionHelper.as | 520 +- .../messages/IUpdaterInputMessage.as | 20 +- .../messages/IUpdaterOutputMessage.as | 20 +- .../messages/UpdaterMessageFactory.as | 95 +- .../messages/UpdaterMessageIDEnum.as | 52 +- .../messages/impl/ActivateComponentMessage.as | 106 +- .../messages/impl/ComponentListMessage.as | 73 +- .../updaterv2/messages/impl/ErrorMessage.as | 72 +- .../messages/impl/FinishedMessage.as | 130 +- .../messages/impl/GetComponentsListMessage.as | 52 +- .../messages/impl/GetSystemConfiguration.as | 52 +- .../messages/impl/ProgressMessage.as | 147 +- .../updaterv2/messages/impl/StepMessage.as | 67 +- .../impl/SystemConfigurationMessage.as | 47 +- .../actions/AddBehaviorToStackAction.as | 44 +- .../common/actions/AgreementAgreedAction.as | 41 +- .../common/actions/AuthorizedCommandAction.as | 41 +- .../actions/BrowserDomainReadyAction.as | 23 + .../common/actions/ChangeCharacterAction.as | 41 +- .../common/actions/ChangeServerAction.as | 33 +- .../actions/ChangeWorldInteractionAction.as | 46 +- .../actions/DirectSelectionCharacterAction.as | 46 +- .../logic/common/actions/EmptyStackAction.as | 33 +- .../logic/common/actions/OpenPopupAction.as | 41 +- .../logic/common/actions/QuitGameAction.as | 33 +- .../actions/RemoveBehaviorToStackAction.as | 41 +- .../logic/common/actions/ResetGameAction.as | 41 +- .../logic/common/frames/AuthorizedFrame.as | 613 +- .../common/frames/ChangeCharacterFrame.as | 315 +- .../logic/common/frames/CleanupCrewFrame.as | 321 +- .../logic/common/frames/DebugBotFrame.as | 789 +-- .../frames/DisconnectionHandlerFrame.as | 311 +- .../logic/common/frames/FightBotFrame.as | 840 +-- .../dofus/logic/common/frames/LatencyFrame.as | 152 +- .../logic/common/frames/LoadingModuleFrame.as | 470 +- .../dofus/logic/common/frames/MiscFrame.as | 618 +- .../dofus/logic/common/frames/QueueFrame.as | 112 +- .../logic/common/frames/ServerControlFrame.as | 279 +- .../ServerControlFrame_PUBLIC_KEY_V1.as | 13 + .../ServerControlFrame_PUBLIC_KEY_V2.as | 13 + .../logic/common/managers/AccountManager.as | 198 +- .../logic/common/managers/DofusFpsManager.as | 354 +- .../common/managers/HyperlinkAdminManager.as | 37 +- .../managers/HyperlinkDisplayArrowManager.as | 603 +- ...HyperlinkDisplayArrowManager_ARROW_CLIP.as | 23 +- .../common/managers/HyperlinkItemManager.as | 165 +- .../common/managers/HyperlinkMapPosition.as | 71 +- .../HyperlinkShowAccountMenuManager.as | 43 +- .../HyperlinkShowAchievementManager.as | 133 +- .../managers/HyperlinkShowAllianceManager.as | 91 +- .../managers/HyperlinkShowCellManager.as | 53 +- .../managers/HyperlinkShowEntityManager.as | 89 +- .../managers/HyperlinkShowGuildManager.as | 87 +- .../HyperlinkShowMonsterChatManager.as | 133 +- .../HyperlinkShowMonsterFightManager.as | 83 +- .../managers/HyperlinkShowMonsterManager.as | 133 +- .../managers/HyperlinkShowNpcManager.as | 85 +- .../managers/HyperlinkShowOfflineSales.as | 41 +- .../managers/HyperlinkShowOrnamentManager.as | 115 +- .../HyperlinkShowPlayerMenuManager.as | 187 +- .../managers/HyperlinkShowQuestManager.as | 114 +- .../managers/HyperlinkShowRecipeManager.as | 95 +- .../common/managers/HyperlinkShowSubArea.as | 59 +- .../managers/HyperlinkShowTitleManager.as | 115 +- .../common/managers/HyperlinkSocialManager.as | 61 +- .../common/managers/HyperlinkSpellManager.as | 180 +- .../managers/HyperlinkSubstitutionManager.as | 85 +- .../managers/HyperlinkSwapPositionRequest.as | 25 + .../HyperlinkTaxCollectorCollected.as | 24 + .../managers/HyperlinkTaxCollectorPosition.as | 74 +- .../common/managers/HyperlinkURLManager.as | 85 +- .../common/managers/NotificationManager.as | 455 +- .../logic/common/managers/PlayerManager.as | 228 +- .../dofus/logic/common/utils/Lagometer.as | 154 +- .../dofus/logic/common/utils/LagometerAck.as | 185 +- .../actions/AcquaintanceSearchAction.as | 41 +- .../connection/actions/LoginAsGuestAction.as | 37 +- .../actions/LoginValidationAction.as | 58 +- .../actions/LoginValidationAsGuestAction.as | 39 +- .../LoginValidationWithTicketAction.as | 45 +- .../actions/NicknameChoiceRequestAction.as | 41 +- .../actions/ServerSelectionAction.as | 41 +- .../frames/AuthentificationFrame.as | 1417 +++-- .../connection/frames/GameStartingFrame.as | 274 +- .../logic/connection/frames/HandshakeFrame.as | 207 +- .../connection/frames/InitializationFrame.as | 1717 +++--- .../connection/frames/ServerSelectionFrame.as | 687 +-- .../managers/AuthentificationManager.as | 505 +- .../AuthentificationManager__verifyKey.as | 23 +- .../connection/managers/GuestModeManager.as | 511 +- .../managers/SpecialBetaAuthentification.as | 117 +- .../managers/StoreUserDataManager.as | 646 +- .../DelayedSystemMessageDisplayMessage.as | 42 +- .../messages/GameStartingMessage.as | 22 +- .../UpdaterConnectionStatusMessage.as | 42 +- .../actions/CharacterCreationAction.as | 61 +- .../actions/CharacterDeletionAction.as | 46 +- .../actions/CharacterDeselectionAction.as | 35 +- .../CharacterNameSuggestionRequestAction.as | 33 +- .../CharacterRemodelSelectionAction.as | 67 +- .../actions/CharacterReplayRequestAction.as | 41 +- .../actions/CharacterSelectionAction.as | 46 +- .../approach/actions/DownloadPartAction.as | 41 +- .../approach/actions/GetPartInfoAction.as | 41 +- .../approach/actions/GetPartsListAction.as | 35 +- .../actions/GiftAssignAllRequestAction.as | 41 +- .../actions/GiftAssignCancelAction.as | 35 +- .../actions/GiftAssignRequestAction.as | 46 +- .../actions/NewsLoginRequestAction.as | 35 +- .../SubscribersGiftListRequestAction.as | 35 +- .../frames/GameServerApproachFrame.as | 1967 +++---- .../approach/frames/UpdaterDialogFrame.as | 208 +- .../game/approach/managers/PartManager.as | 550 +- .../game/approach/managers/PartManagerV2.as | 303 +- .../game/approach/utils/DownloadMonitoring.as | 316 +- .../actions/AccessoryPreviewRequestAction.as | 42 +- .../common/actions/BasicWhoIsRequestAction.as | 46 +- .../game/common/actions/CloseBookAction.as | 40 +- .../common/actions/CloseInventoryAction.as | 35 +- .../actions/ContactLookRequestByIdAction.as | 67 +- .../common/actions/GameContextQuitAction.as | 33 +- .../game/common/actions/HouseBuyAction.as | 41 +- .../actions/HouseGuildRightsChangeAction.as | 41 +- .../actions/HouseGuildRightsViewAction.as | 35 +- .../common/actions/HouseGuildShareAction.as | 46 +- .../game/common/actions/HouseKickAction.as | 41 +- .../actions/HouseKickIndoorMerchantAction.as | 41 +- .../actions/HouseLockFromInsideAction.as | 41 +- .../game/common/actions/HouseSellAction.as | 41 +- .../actions/HouseSellFromInsideAction.as | 41 +- .../actions/IncreaseSpellLevelAction.as | 46 +- .../InteractiveElementActivationAction.as | 55 +- .../game/common/actions/LeaveDialogAction.as | 35 +- .../actions/LockableChangeCodeAction.as | 41 +- .../common/actions/LockableUseCodeAction.as | 41 +- .../common/actions/NotificationResetAction.as | 35 +- .../actions/NotificationUpdateFlagAction.as | 41 +- .../actions/NumericWhoIsRequestAction.as | 41 +- .../game/common/actions/OpenArenaAction.as | 35 +- .../game/common/actions/OpenBookAction.as | 49 +- .../common/actions/OpenCurrentFightAction.as | 40 +- .../common/actions/OpenInventoryAction.as | 41 +- .../game/common/actions/OpenMainMenuAction.as | 33 +- .../game/common/actions/OpenMapAction.as | 51 +- .../game/common/actions/OpenMountAction.as | 33 +- .../actions/OpenServerSelectionAction.as | 40 +- .../game/common/actions/OpenSmileysAction.as | 46 +- .../game/common/actions/OpenSocialAction.as | 41 +- .../game/common/actions/OpenStatsAction.as | 35 +- .../common/actions/OpenTeamSearchAction.as | 35 +- .../common/actions/PivotCharacterAction.as | 35 +- .../game/common/actions/PlaySoundAction.as | 41 +- .../game/common/actions/StartZoomAction.as | 46 +- .../alignment/SetEnablePVPRequestAction.as | 41 +- .../AllianceChangeGuildRightsAction.as | 46 +- .../alliance/AllianceCreationValidAction.as | 66 +- .../alliance/AllianceFactsRequestAction.as | 41 +- .../AllianceInsiderInfoRequestAction.as | 35 +- .../alliance/AllianceInvitationAction.as | 41 +- .../AllianceInvitationAnswerAction.as | 41 +- .../alliance/AllianceKickRequestAction.as | 41 +- .../alliance/AllianceListRequestAction.as | 35 +- .../AllianceModificationEmblemValidAction.as | 56 +- ...lianceModificationNameAndTagValidAction.as | 46 +- .../AllianceModificationValidAction.as | 66 +- .../alliance/SetEnableAVARequestAction.as | 41 +- .../actions/bid/BidHouseStringSearchAction.as | 41 +- .../actions/bid/BidSwitchToBuyerModeAction.as | 35 +- .../bid/BidSwitchToSellerModeAction.as | 35 +- .../actions/bid/ExchangeBidHouseBuyAction.as | 51 +- .../actions/bid/ExchangeBidHouseListAction.as | 41 +- .../bid/ExchangeBidHousePriceAction.as | 41 +- .../bid/ExchangeBidHouseSearchAction.as | 46 +- .../actions/bid/ExchangeBidHouseTypeAction.as | 41 +- .../common/actions/bid/LeaveBidHouseAction.as | 35 +- .../actions/chat/ChannelEnablingAction.as | 46 +- .../common/actions/chat/ChatCommandAction.as | 41 +- .../common/actions/chat/ChatLoadedAction.as | 35 +- .../actions/chat/ChatRefreshChannelAction.as | 35 +- .../actions/chat/ChatRefreshChatAction.as | 41 +- .../actions/chat/ChatSmileyRequestAction.as | 41 +- .../actions/chat/ChatTextOutputAction.as | 56 +- .../common/actions/chat/ClearChatAction.as | 41 +- .../common/actions/chat/FightOutputAction.as | 46 +- .../chat/LivingObjectMessageRequestAction.as | 46 +- .../actions/chat/MoodSmileyRequestAction.as | 41 +- .../common/actions/chat/SaveMessageAction.as | 51 +- .../common/actions/chat/TabsUpdateAction.as | 46 +- .../ExchangeItemGoldAddAsPaymentAction.as | 46 +- .../ExchangeItemObjectAddAsPaymentAction.as | 56 +- ...raftSetCrafterCanUseHisRessourcesAction.as | 41 +- .../ExchangeObjectUseInWorkshopAction.as | 46 +- .../ExchangePlayerMultiCraftRequestAction.as | 51 +- .../actions/craft/ExchangeReplayAction.as | 41 +- .../actions/craft/ExchangeReplayStopAction.as | 35 +- .../craft/ExchangeSetCraftRecipeAction.as | 41 +- .../JobAllowMultiCraftRequestSetAction.as | 41 +- .../actions/exchange/ExchangeAcceptAction.as | 35 +- .../ExchangeObjectModifyPricedAction.as | 51 +- .../exchange/ExchangeObjectMoveAction.as | 46 +- .../exchange/ExchangeObjectMoveKamaAction.as | 41 +- ...ExchangeObjectTransfertAllFromInvAction.as | 33 +- .../ExchangeObjectTransfertAllToInvAction.as | 33 +- ...ngeObjectTransfertExistingFromInvAction.as | 33 +- ...hangeObjectTransfertExistingToInvAction.as | 33 +- ...xchangeObjectTransfertListFromInvAction.as | 42 +- .../ExchangeObjectTransfertListToInvAction.as | 42 +- ...ectTransfertListWithQuantityToInvAction.as | 47 +- .../exchange/ExchangePlayerRequestAction.as | 46 +- .../actions/exchange/ExchangeReadyAction.as | 41 +- .../actions/exchange/ExchangeRefuseAction.as | 35 +- .../ExchangeRequestOnTaxCollectorAction.as | 41 +- .../externalGame/GetComicRequestAction.as | 51 +- .../GetComicsLibraryRequestAction.as | 41 +- .../KrosmasterInventoryRequestAction.as | 35 +- .../KrosmasterPlayingStatusAction.as | 41 +- .../KrosmasterTokenRequestAction.as | 35 +- .../KrosmasterTransferRequestAction.as | 41 +- .../externalGame/OpenWebServiceAction.as | 46 +- .../ShopArticlesListRequestAction.as | 46 +- .../ShopAuthentificationRequestAction.as | 35 +- .../externalGame/ShopBuyRequestAction.as | 46 +- .../ShopFrontPageRequestAction.as | 35 +- .../externalGame/ShopSearchRequestAction.as | 46 +- .../GuildChangeMemberParametersAction.as | 56 +- .../guild/GuildCharacsUpgradeRequestAction.as | 41 +- .../actions/guild/GuildCreationValidAction.as | 61 +- .../actions/guild/GuildFactsRequestAction.as | 41 +- .../guild/GuildFarmTeleportRequestAction.as | 41 +- .../guild/GuildFightJoinRequestAction.as | 41 +- .../guild/GuildFightLeaveRequestAction.as | 51 +- .../guild/GuildFightTakePlaceRequestAction.as | 46 +- .../guild/GuildGetInformationsAction.as | 41 +- .../guild/GuildHouseTeleportRequestAction.as | 41 +- .../actions/guild/GuildInvitationAction.as | 41 +- .../guild/GuildInvitationAnswerAction.as | 41 +- .../guild/GuildInvitationByNameAction.as | 41 +- .../actions/guild/GuildKickRequestAction.as | 41 +- .../actions/guild/GuildListRequestAction.as | 35 +- .../GuildModificationEmblemValidAction.as | 56 +- .../guild/GuildModificationNameValidAction.as | 41 +- .../guild/GuildModificationValidAction.as | 61 +- .../guild/GuildSpellUpgradeRequestAction.as | 41 +- .../actions/humanVendor/ExchangeBuyAction.as | 46 +- .../ExchangeOnHumanVendorRequestAction.as | 46 +- .../ExchangeRequestOnShopStockAction.as | 35 +- .../actions/humanVendor/ExchangeSellAction.as | 46 +- .../ExchangeShopStockMouvmentAddAction.as | 51 +- .../ExchangeShopStockMouvmentRemoveAction.as | 46 +- .../ExchangeShowVendorTaxAction.as | 35 +- .../ExchangeStartAsVendorRequestAction.as | 35 +- .../humanVendor/LeaveShopStockAction.as | 35 +- .../JobCrafterContactLookRequestAction.as | 41 +- ...JobCrafterDirectoryDefineSettingsAction.as | 96 +- .../JobCrafterDirectoryEntryRequestAction.as | 41 +- .../JobCrafterDirectoryListRequestAction.as | 41 +- .../LivingObjectChangeSkinRequestAction.as | 51 +- .../LivingObjectDissociateAction.as | 46 +- .../livingObject/LivingObjectFeedAction.as | 51 +- .../MimicryObjectEraseRequestAction.as | 46 +- ...icryObjectFeedAndAssociateRequestAction.as | 71 +- .../WrapperObjectDissociateRequestAction.as | 46 +- .../mount/ExchangeHandleMountStableAction.as | 46 +- .../ExchangeRequestOnMountStockAction.as | 33 +- .../actions/mount/LeaveExchangeMountAction.as | 33 +- .../actions/mount/MountFeedRequestAction.as | 56 +- .../actions/mount/MountInfoRequestAction.as | 82 +- .../MountInformationInPaddockRequestAction.as | 41 +- .../mount/MountReleaseRequestAction.as | 33 +- .../actions/mount/MountRenameRequestAction.as | 46 +- .../mount/MountSetXpRatioRequestAction.as | 41 +- .../mount/MountSterilizeRequestAction.as | 33 +- .../mount/MountToggleRidingRequestAction.as | 33 +- .../actions/mount/PaddockBuyRequestAction.as | 41 +- .../mount/PaddockMoveItemRequestAction.as | 41 +- .../mount/PaddockRemoveItemRequestAction.as | 41 +- .../actions/mount/PaddockSellRequestAction.as | 41 +- .../actions/party/ArenaFightAnswerAction.as | 46 +- .../actions/party/ArenaRegisterAction.as | 41 +- .../actions/party/ArenaUnregisterAction.as | 35 +- ...ngeonPartyFinderAvailableDungeonsAction.as | 35 +- .../party/DungeonPartyFinderListenAction.as | 41 +- .../party/DungeonPartyFinderRegisterAction.as | 41 +- .../party/PartyAbdicateThroneAction.as | 46 +- .../party/PartyAcceptInvitationAction.as | 41 +- .../party/PartyAllFollowMemberAction.as | 46 +- .../PartyAllStopFollowingMemberAction.as | 46 +- .../party/PartyCancelInvitationAction.as | 46 +- .../actions/party/PartyFollowMemberAction.as | 46 +- .../actions/party/PartyInvitationAction.as | 51 +- .../PartyInvitationDetailsRequestAction.as | 41 +- .../actions/party/PartyKickRequestAction.as | 46 +- .../actions/party/PartyLeaveRequestAction.as | 41 +- .../party/PartyNameSetRequestAction.as | 46 +- .../party/PartyPledgeLoyaltyRequestAction.as | 46 +- .../party/PartyRefuseInvitationAction.as | 41 +- .../actions/party/PartyShowMenuAction.as | 46 +- .../party/PartyStopFollowingMemberAction.as | 46 +- .../party/TeleportBuddiesAnswerAction.as | 41 +- .../party/TeleportToBuddyAnswerAction.as | 51 +- .../actions/prism/PrismAttackRequestAction.as | 35 +- .../prism/PrismFightJoinLeaveRequestAction.as | 46 +- .../prism/PrismFightSwapRequestAction.as | 46 +- .../prism/PrismInfoJoinLeaveRequestAction.as | 41 +- .../prism/PrismModuleExchangeRequestAction.as | 35 +- .../prism/PrismSetSabotagedRequestAction.as | 41 +- .../prism/PrismSettingsRequestAction.as | 46 +- .../actions/prism/PrismUseRequestAction.as | 35 +- .../actions/prism/PrismsListRegisterAction.as | 46 +- .../AchievementDetailedListRequestAction.as | 41 +- .../quest/AchievementDetailsRequestAction.as | 41 +- .../quest/AchievementRewardRequestAction.as | 41 +- .../quest/GuidedModeQuitRequestAction.as | 33 +- .../quest/GuidedModeReturnRequestAction.as | 33 +- .../actions/quest/QuestInfosRequestAction.as | 41 +- .../actions/quest/QuestListRequestAction.as | 33 +- .../quest/QuestObjectiveValidationAction.as | 46 +- .../actions/quest/QuestStartRequestAction.as | 41 +- .../treasureHunt/PortalUseRequestAction.as | 41 +- .../TreasureHuntDigRequestAction.as | 41 +- .../TreasureHuntFlagRemoveRequestAction.as | 46 +- .../TreasureHuntFlagRequestAction.as | 46 +- .../TreasureHuntGiveUpRequestAction.as | 41 +- .../TreasureHuntLegendaryRequestAction.as | 41 +- .../treasureHunt/TreasureHuntRequestAction.as | 46 +- .../GameRolePlayFreeSoulRequestAction.as | 33 +- .../roleplay/JoinFightRequestAction.as | 46 +- .../roleplay/SwitchCreatureModeAction.as | 41 +- .../common/actions/social/AddEnemyAction.as | 41 +- .../common/actions/social/AddFriendAction.as | 41 +- .../common/actions/social/AddIgnoredAction.as | 41 +- .../actions/social/CharacterReportAction.as | 46 +- .../common/actions/social/ChatReportAction.as | 71 +- .../social/EnemiesListRequestAction.as | 35 +- ...GuildSetWarnOnAchievementCompleteAction.as | 41 +- ...endOrGuildMemberLevelUpWarningSetAction.as | 41 +- .../social/FriendSpouseFollowAction.as | 41 +- .../actions/social/FriendWarningSetAction.as | 41 +- .../social/FriendsListRequestAction.as | 35 +- .../common/actions/social/JoinFriendAction.as | 41 +- .../common/actions/social/JoinSpouseAction.as | 35 +- .../actions/social/MemberWarningSetAction.as | 41 +- .../social/PlayerStatusUpdateRequestAction.as | 46 +- .../actions/social/RemoveEnemyAction.as | 41 +- .../actions/social/RemoveFriendAction.as | 41 +- .../actions/social/RemoveIgnoredAction.as | 41 +- .../actions/social/SpouseRequestAction.as | 35 +- .../social/WarnOnHardcoreDeathAction.as | 41 +- .../GameFightSpectatePlayerRequestAction.as | 41 +- .../spectator/JoinAsSpectatorRequestAction.as | 41 +- .../MapRunningFightDetailsRequestAction.as | 41 +- .../StopToListenRunningFightAction.as | 33 +- ...eRolePlayTaxCollectorFightRequestAction.as | 41 +- .../tinsel/OrnamentSelectRequestAction.as | 41 +- .../tinsel/TitleSelectRequestAction.as | 41 +- .../TitlesAndOrnamentsListRequestAction.as | 35 +- .../common/frames/AbstractEntitiesFrame.as | 1116 ++-- .../game/common/frames/AlignmentFrame.as | 144 +- .../game/common/frames/AllianceDialogFrame.as | 266 +- .../logic/game/common/frames/AllianceFrame.as | 1769 +++--- .../game/common/frames/AveragePricesFrame.as | 280 +- .../common/frames/BidHouseManagementFrame.as | 1385 ++--- .../game/common/frames/CameraControlFrame.as | 409 +- .../logic/game/common/frames/ChatFrame.as | 3422 +++++------ .../frames/CommonExchangeManagementFrame.as | 532 +- .../logic/game/common/frames/CommonUiFrame.as | 791 ++- .../game/common/frames/ContextChangeFrame.as | 150 +- .../logic/game/common/frames/CraftFrame.as | 2098 +++---- .../logic/game/common/frames/DebugFrame.as | 283 +- .../logic/game/common/frames/EmoticonFrame.as | 825 +-- .../common/frames/ExchangeManagementFrame.as | 939 +-- .../game/common/frames/ExternalGameFrame.as | 542 +- .../game/common/frames/GuildDialogFrame.as | 266 +- .../game/common/frames/HouseDialogFrame.as | 138 +- .../logic/game/common/frames/HouseFrame.as | 480 +- .../frames/HumanVendorManagementFrame.as | 540 +- .../common/frames/InventoryManagementFrame.as | 2020 +++---- .../JobCrafterDirectoryListDialogFrame.as | 312 +- .../logic/game/common/frames/JobsFrame.as | 497 +- .../game/common/frames/LivingObjectFrame.as | 598 +- .../game/common/frames/MountDialogFrame.as | 159 +- .../logic/game/common/frames/MountFrame.as | 1085 ++-- .../common/frames/PartyManagementFrame.as | 4344 +++++++------- .../frames/PlayedCharacterUpdatesFrame.as | 1480 ++--- .../game/common/frames/ProtectPishingFrame.as | 428 +- .../logic/game/common/frames/QuestFrame.as | 1494 +++-- .../game/common/frames/ServerTransferFrame.as | 233 +- .../game/common/frames/SocialDataFrame.as | 686 +-- .../logic/game/common/frames/SocialFrame.as | 3533 +++++------ .../common/frames/SpectatorManagementFrame.as | 335 +- .../common/frames/SpellForgetDialogFrame.as | 138 +- .../frames/SpellInventoryManagementFrame.as | 385 +- .../common/frames/StackManagementFrame.as | 1193 ++-- .../common/frames/SynchronisationFrame.as | 215 +- .../frames/TeleportBuddiesDialogFrame.as | 138 +- .../logic/game/common/frames/TinselFrame.as | 388 +- .../logic/game/common/frames/WorldFrame.as | 161 +- .../game/common/managers/AFKFightManager.as | 263 +- .../game/common/managers/AlmanaxManager.as | 401 +- .../managers/ChatAutocompleteNameManager.as | 263 +- .../game/common/managers/ComicsManager.as | 155 +- .../game/common/managers/DofusShopManager.as | 921 +-- .../common/managers/EntitiesLooksManager.as | 657 ++- .../logic/game/common/managers/FlagManager.as | 84 +- .../game/common/managers/InactivityManager.as | 275 +- .../game/common/managers/InventoryManager.as | 266 +- .../common/managers/MapMovementAdapter.as | 188 +- .../common/managers/PlayedCharacterManager.as | 711 +-- .../common/managers/SpeakingItemManager.as | 471 +- .../common/managers/StorageOptionManager.as | 959 +-- .../common/managers/TaxCollectorsManager.as | 792 +-- .../logic/game/common/managers/TimeManager.as | 508 +- .../common/messages/FightEndingMessage.as | 33 +- .../logic/game/common/misc/DofusEntities.as | 132 +- .../dofus/logic/game/common/misc/HookLock.as | 243 +- .../game/common/misc/IEntityLocalizer.as | 23 +- .../dofus/logic/game/common/misc/IHookLock.as | 23 +- .../logic/game/common/misc/IInventoryView.as | 45 +- .../game/common/misc/ISpellCastProvider.as | 26 +- .../logic/game/common/misc/IStorageView.as | 20 +- .../dofus/logic/game/common/misc/Inventory.as | 827 +-- .../game/common/misc/KoliseumMessageRouter.as | 37 +- .../logic/game/common/misc/PlayerInventory.as | 41 +- .../game/common/misc/SpellModificator.as | 71 +- .../misc/inventoryView/BankConsumablesView.as | 93 +- .../misc/inventoryView/BankEquipementView.as | 93 +- .../misc/inventoryView/BankFilteredView.as | 93 +- .../misc/inventoryView/BankQuestView.as | 93 +- .../misc/inventoryView/BankRessourcesView.as | 93 +- .../common/misc/inventoryView/BankView.as | 81 +- .../misc/inventoryView/CertificateView.as | 181 +- .../misc/inventoryView/EquipmentView.as | 219 +- .../common/misc/inventoryView/ListView.as | 186 +- .../common/misc/inventoryView/RealView.as | 117 +- .../misc/inventoryView/RoleplayBuffView.as | 184 +- .../StorageBidHouseFilterView.as | 116 +- .../inventoryView/StorageConsumablesView.as | 73 +- .../inventoryView/StorageCraftFilterView.as | 146 +- .../inventoryView/StorageEquipmentView.as | 73 +- .../misc/inventoryView/StorageFilteredView.as | 73 +- .../misc/inventoryView/StorageGenericView.as | 769 ++- .../inventoryView/StorageQuestCategory.as | 73 +- .../inventoryView/StorageResourcesView.as | 73 +- .../StorageSmithMagicFilterView.as | 122 +- .../common/misc/inventoryView/StorageView.as | 81 +- .../misc/stackedMessages/AbstractBehavior.as | 255 +- .../misc/stackedMessages/ChangeMapBehavior.as | 170 +- .../InteractiveElementBehavior.as | 626 +- .../misc/stackedMessages/MoveBehavior.as | 329 +- .../game/common/steps/CameraFollowStep.as | 73 +- .../logic/game/common/steps/CameraMoveStep.as | 156 +- .../logic/game/common/steps/CameraZoomStep.as | 136 +- .../game/common/steps/DisplayEntityStep.as | 81 +- .../logic/game/common/steps/LookAtStep.as | 53 +- .../dofus/logic/game/common/steps/MoveStep.as | 146 +- .../logic/game/common/steps/PlayEmoteStep.as | 108 +- .../logic/game/common/steps/PlaySmileyStep.as | 125 +- .../game/common/steps/RemoveEntityStep.as | 76 +- .../logic/game/common/steps/TeleportStep.as | 53 +- .../logic/game/common/steps/TextBubbleStep.as | 124 +- .../dofus/logic/game/common/steps/WaitStep.as | 117 +- .../game/common/types/DofusShopArticle.as | 425 +- .../game/common/types/DofusShopCategory.as | 138 +- .../game/common/types/DofusShopHighlight.as | 207 +- .../game/common/types/DofusShopObject.as | 107 +- .../types/PartyFightInformationsData.as | 184 +- .../game/common/types/SubEntityHandler.as | 71 +- .../logic/game/common/types/SynchroTimer.as | 137 +- .../actions/BannerEmptySlotClickAction.as | 35 +- .../ChallengeTargetsListRequestAction.as | 41 +- .../game/fight/actions/DisableAfkAction.as | 35 +- .../fight/actions/GameContextKickAction.as | 41 +- ...GameFightPlacementPositionRequestAction.as | 41 +- ...FightPlacementSwapPositionsAcceptAction.as | 22 + ...FightPlacementSwapPositionsCancelAction.as | 22 + ...ightPlacementSwapPositionsRequestAction.as | 25 + .../fight/actions/GameFightReadyAction.as | 41 +- .../fight/actions/GameFightSpellCastAction.as | 41 +- .../actions/GameFightTurnFinishAction.as | 33 +- .../game/fight/actions/RemoveEntityAction.as | 41 +- .../game/fight/actions/ShowAllNamesAction.as | 35 +- .../fight/actions/ShowMountsInFightAction.as | 52 +- .../fight/actions/ShowTacticModeAction.as | 35 +- .../actions/TimelineEntityClickAction.as | 41 +- .../fight/actions/TimelineEntityOutAction.as | 41 +- .../fight/actions/TimelineEntityOverAction.as | 49 +- .../actions/ToggleDematerializationAction.as | 35 +- .../fight/actions/ToggleHelpWantedAction.as | 35 +- .../fight/actions/ToggleLockFightAction.as | 35 +- .../fight/actions/ToggleLockPartyAction.as | 35 +- .../fight/actions/TogglePointCellAction.as | 35 +- .../actions/ToggleWitnessForbiddenAction.as | 35 +- .../game/fight/fightEvents/FightEvent.as | 57 +- .../fight/fightEvents/FightEventsHelper.as | 1329 +++-- .../game/fight/frames/FightBattleFrame.as | 2033 +++---- .../game/fight/frames/FightContextFrame.as | 3597 +++++------- .../game/fight/frames/FightEntitiesFrame.as | 2204 +++---- .../game/fight/frames/FightPointCellFrame.as | 316 +- .../fight/frames/FightPreparationFrame.as | 926 +-- .../game/fight/frames/FightSequenceFrame.as | 3746 ++++++------ .../frames/FightSequenceSwitcherFrame.as | 89 +- .../game/fight/frames/FightSpellCastFrame.as | 2475 ++++---- .../FightSpellCastFrame_FORBIDDEN_CURSOR.as | 23 +- .../logic/game/fight/frames/FightTurnFrame.as | 1231 ++-- .../logic/game/fight/managers/BuffManager.as | 1241 ++-- .../managers/CurrentPlayedFighterManager.as | 1006 ++-- .../fight/managers/FightersStateManager.as | 157 +- .../game/fight/managers/LinkedCellsManager.as | 646 +- .../game/fight/managers/MarkedCellsManager.as | 699 +-- .../game/fight/managers/SpellZoneManager.as | 379 +- .../game/fight/managers/TacticModeManager.as | 1948 +++--- .../messages/GameActionFightLeaveMessage.as | 37 +- .../messages/TextActionInformationMessage.as | 57 +- .../game/fight/miscs/ActionIdConverter.as | 1495 +++-- .../fight/miscs/CarrierAnimationModifier.as | 104 +- .../fight/miscs/CarrierSubEntityBehaviour.as | 85 +- .../CustomAnimStatiqueAnimationModifier.as | 192 +- .../logic/game/fight/miscs/DamageUtil.as | 3098 +++++----- .../game/fight/miscs/FightEntitiesHolder.as | 151 +- .../fight/miscs/FightReachableCellsMaker.as | 575 +- .../dofus/logic/game/fight/miscs/PushUtil.as | 1120 ++-- .../logic/game/fight/miscs/TackleUtil.as | 441 +- .../steps/FightActionPointsLossDodgeStep.as | 53 +- .../steps/FightActionPointsVariationStep.as | 182 +- .../game/fight/steps/FightAddSubEntityStep.as | 150 +- .../fight/steps/FightCarryCharacterStep.as | 408 +- .../game/fight/steps/FightChangeLookStep.as | 83 +- .../fight/steps/FightChangeVisibilityStep.as | 260 +- .../game/fight/steps/FightCloseCombatStep.as | 100 +- .../logic/game/fight/steps/FightDeathStep.as | 347 +- .../fight/steps/FightDestroyEntityStep.as | 43 +- .../fight/steps/FightDispellEffectStep.as | 118 +- .../game/fight/steps/FightDispellSpellStep.as | 67 +- .../game/fight/steps/FightDispellStep.as | 62 +- .../game/fight/steps/FightDisplayBuffStep.as | 139 +- .../fight/steps/FightEnteringStateStep.as | 76 +- .../fight/steps/FightEntityMovementStep.as | 182 +- .../game/fight/steps/FightEntitySlideStep.as | 212 +- .../fight/steps/FightExchangePositionsStep.as | 196 +- .../fight/steps/FightInvisibleObstacleStep.as | 63 +- .../FightInvisibleTemporarilyDetectedStep.as | 142 +- .../logic/game/fight/steps/FightKillStep.as | 63 +- .../game/fight/steps/FightLeavingStateStep.as | 71 +- .../fight/steps/FightLifeVariationStep.as | 206 +- .../game/fight/steps/FightLossAnimStep.as | 75 +- .../game/fight/steps/FightMarkActivateStep.as | 93 +- .../game/fight/steps/FightMarkCellsStep.as | 186 +- .../fight/steps/FightMarkTriggeredStep.as | 168 +- .../steps/FightModifyEffectsDurationStep.as | 105 +- .../steps/FightMovementPointsLossDodgeStep.as | 53 +- .../steps/FightMovementPointsVariationStep.as | 162 +- .../fight/steps/FightReducedDamagesStep.as | 63 +- .../fight/steps/FightReflectedDamagesStep.as | 58 +- .../fight/steps/FightReflectedSpellStep.as | 58 +- .../steps/FightRemoveCarriedEntityStep.as | 67 +- .../fight/steps/FightRemoveSubEntityStep.as | 86 +- .../steps/FightShieldPointsVariationStep.as | 198 +- .../game/fight/steps/FightSpellCastStep.as | 167 +- .../steps/FightSpellCooldownVariationStep.as | 127 +- .../fight/steps/FightSpellImmunityStep.as | 58 +- .../fight/steps/FightStealingKamasStep.as | 68 +- .../logic/game/fight/steps/FightSummonStep.as | 131 +- .../game/fight/steps/FightTackledStep.as | 105 +- .../game/fight/steps/FightTeleportStep.as | 135 +- .../fight/steps/FightTemporaryBoostStep.as | 79 +- .../fight/steps/FightThrowCharacterStep.as | 623 +- .../game/fight/steps/FightTurnListStep.as | 101 +- .../game/fight/steps/FightUnmarkCellsStep.as | 110 +- .../logic/game/fight/steps/FightVanishStep.as | 260 +- .../game/fight/steps/FightVisibilityStep.as | 71 +- .../logic/game/fight/steps/IFightStep.as | 26 +- .../abstract/AbstractDodgePointLossStep.as | 36 +- .../abstract/AbstractStatContextualStep.as | 144 +- .../dofus/logic/game/fight/types/BasicBuff.as | 886 +-- .../logic/game/fight/types/CastingSpell.as | 82 +- .../logic/game/fight/types/EffectDamage.as | 250 +- .../game/fight/types/EffectModification.as | 44 +- .../logic/game/fight/types/FightEventEnum.as | 181 +- .../fight/types/FightTeleportationPreview.as | 1071 ++-- .../logic/game/fight/types/MarkInstance.as | 54 +- .../logic/game/fight/types/PushedEntity.as | 172 +- .../dofus/logic/game/fight/types/SpellBuff.as | 463 +- .../fight/types/SpellCastInFightManager.as | 314 +- .../logic/game/fight/types/SpellDamage.as | 1048 ++-- .../logic/game/fight/types/SpellDamageInfo.as | 2011 ++++--- .../logic/game/fight/types/SplashDamage.as | 197 +- .../dofus/logic/game/fight/types/StatBuff.as | 784 ++- .../dofus/logic/game/fight/types/StateBuff.as | 192 +- .../game/fight/types/SwapPositionRequest.as | 163 + .../logic/game/fight/types/TriggeredBuff.as | 185 +- .../logic/game/fight/types/TriggeredSpell.as | 222 +- .../types/castSpellManager/SpellManager.as | 390 +- .../roleplay/actions/DeleteObjectAction.as | 46 +- .../actions/DisplayContextualMenuAction.as | 41 +- .../actions/EmotePlayRequestAction.as | 41 +- .../actions/LeaveDialogRequestAction.as | 33 +- .../roleplay/actions/NpcDialogReplyAction.as | 41 +- .../actions/NpcGenericActionRequestAction.as | 46 +- .../game/roleplay/actions/ObjectDropAction.as | 51 +- .../actions/ObjectSetPositionAction.as | 51 +- .../game/roleplay/actions/ObjectUseAction.as | 51 +- .../roleplay/actions/ObjectUseOnCellAction.as | 46 +- .../PlayerFightFriendlyAnswerAction.as | 41 +- .../actions/PlayerFightRequestAction.as | 61 +- .../actions/PresetSetPositionAction.as | 46 +- .../actions/ShortcutBarAddRequestAction.as | 51 +- .../actions/ShortcutBarRemoveRequestAction.as | 46 +- .../actions/ShortcutBarSwapRequestAction.as | 51 +- .../actions/ShowMonstersInfoAction.as | 41 +- .../actions/SpellSetPositionAction.as | 46 +- .../actions/StatsUpgradeRequestAction.as | 51 +- .../roleplay/actions/TeleportRequestAction.as | 51 +- .../actions/ValidateSpellForgetAction.as | 41 +- .../actions/estate/HouseToSellFilterAction.as | 61 +- .../estate/HouseToSellListRequestAction.as | 41 +- .../estate/PaddockToSellFilterAction.as | 56 +- .../estate/PaddockToSellListRequestAction.as | 41 +- .../preset/InventoryPresetDeleteAction.as | 41 +- .../InventoryPresetItemUpdateRequestAction.as | 51 +- .../preset/InventoryPresetSaveAction.as | 51 +- .../preset/InventoryPresetSaveCustomAction.as | 66 +- .../preset/InventoryPresetUseAction.as | 41 +- .../roleplay/frames/DelayedActionFrame.as | 261 +- .../game/roleplay/frames/DocumentFrame.as | 128 +- .../logic/game/roleplay/frames/EstateFrame.as | 254 +- .../game/roleplay/frames/InfoEntitiesFrame.as | 1645 +++--- .../game/roleplay/frames/MonstersInfoFrame.as | 716 +-- .../game/roleplay/frames/NpcDialogFrame.as | 174 +- .../game/roleplay/frames/PaddockFrame.as | 180 +- .../roleplay/frames/RoleplayContextFrame.as | 3278 +++++------ .../roleplay/frames/RoleplayEntitiesFrame.as | 5197 +++++++++-------- .../frames/RoleplayInteractivesFrame.as | 2259 +++---- ...yInteractivesFrame_INTERACTIVE_CURSOR_0.as | 23 +- ...yInteractivesFrame_INTERACTIVE_CURSOR_1.as | 23 +- ...InteractivesFrame_INTERACTIVE_CURSOR_10.as | 23 +- ...yInteractivesFrame_INTERACTIVE_CURSOR_2.as | 23 +- ...yInteractivesFrame_INTERACTIVE_CURSOR_3.as | 23 +- ...yInteractivesFrame_INTERACTIVE_CURSOR_4.as | 23 +- ...yInteractivesFrame_INTERACTIVE_CURSOR_5.as | 23 +- ...yInteractivesFrame_INTERACTIVE_CURSOR_6.as | 23 +- ...yInteractivesFrame_INTERACTIVE_CURSOR_7.as | 23 +- ...yInteractivesFrame_INTERACTIVE_CURSOR_8.as | 23 +- ...yInteractivesFrame_INTERACTIVE_CURSOR_9.as | 23 +- ...ctivesFrame_INTERACTIVE_CURSOR_DISABLED.as | 23 +- .../roleplay/frames/RoleplayMovementFrame.as | 769 +-- .../roleplay/frames/RoleplayPointCellFrame.as | 440 +- .../roleplay/frames/RoleplayWorldFrame.as | 2226 +++---- .../logic/game/roleplay/frames/ZaapFrame.as | 292 +- .../game/roleplay/managers/AnimFunManager.as | 1418 ++--- .../game/roleplay/managers/RoleplayManager.as | 321 +- .../CharacterMovementStoppedMessage.as | 22 +- .../roleplay/messages/DelayedActionMessage.as | 72 +- .../GameRolePlaySetAnimationMessage.as | 119 +- .../InteractiveElementActivationMessage.as | 76 +- .../InteractiveElementMouseOutMessage.as | 44 +- .../InteractiveElementMouseOverMessage.as | 59 +- .../logic/game/roleplay/types/AnimFun.as | 105 +- .../types/CharacterTooltipInformation.as | 190 +- .../logic/game/roleplay/types/EntityIcon.as | 178 +- .../dofus/logic/game/roleplay/types/Estate.as | 181 +- .../dofus/logic/game/roleplay/types/Fight.as | 94 +- .../logic/game/roleplay/types/FightTeam.as | 166 +- .../GameContextPaddockItemInformations.as | 88 +- .../logic/game/roleplay/types/GroundObject.as | 43 +- .../types/MutantTooltipInformation.as | 79 +- .../types/PortalTooltipInformation.as | 27 +- .../roleplay/types/PrismTooltipInformation.as | 31 +- .../types/RoleplaySpellCastProvider.as | 63 +- .../RoleplayTeamFightersTooltipInformation.as | 269 +- .../types/TaxCollectorTooltipInformation.as | 53 +- .../dofus/logic/shield/SecureModeManager.as | 1087 ++-- .../dofus/logic/shield/ShieldCertifcate.as | 700 +-- .../dofus/logic/shield/ShieldSecureLevel.as | 28 +- .../dofus/misc/BenchmarkMovementBehavior.as | 244 +- com/ankamagames/dofus/misc/BuildTypeParser.as | 105 +- .../dofus/misc/EntityLookAdapter.as | 263 +- .../dofus/misc/ObjectEffectAdapter.as | 257 +- .../dofus/misc/interClient/AppIdModifier.as | 382 +- .../misc/interClient/InterClientKeyManager.as | 263 + .../misc/interClient/InterClientManager.as | 347 +- .../misc/interClient/InterClientMaster.as | 316 +- .../misc/interClient/InterClientSlave.as | 257 +- .../dofus/misc/lists/AlignmentHookList.as | 35 +- .../dofus/misc/lists/ApiActionList.as | 950 +-- .../dofus/misc/lists/ApiChatActionList.as | 73 +- .../dofus/misc/lists/ApiCraftActionList.as | 48 +- .../dofus/misc/lists/ApiExchangeActionList.as | 228 +- com/ankamagames/dofus/misc/lists/ApiList.as | 76 +- .../misc/lists/ApiLivingObjectActionList.as | 53 +- .../dofus/misc/lists/ApiMountActionList.as | 98 +- .../dofus/misc/lists/ApiRolePlayActionList.as | 113 +- .../dofus/misc/lists/ApiSocialActionList.as | 283 +- .../dofus/misc/lists/ChatHookList.as | 113 +- .../dofus/misc/lists/CraftHookList.as | 93 +- .../dofus/misc/lists/CustomUiHookList.as | 77 +- com/ankamagames/dofus/misc/lists/EnumList.as | 19 +- .../dofus/misc/lists/ExchangeHookList.as | 182 +- .../dofus/misc/lists/ExternalGameHookList.as | 65 +- .../dofus/misc/lists/FightHookList.as | 87 +- .../dofus/misc/lists/GameDataList.as | 647 +- com/ankamagames/dofus/misc/lists/HookList.as | 651 ++- .../dofus/misc/lists/InventoryHookList.as | 98 +- .../dofus/misc/lists/LivingObjectHookList.as | 41 +- .../dofus/misc/lists/MountHookList.as | 62 +- .../dofus/misc/lists/PrismHookList.as | 53 +- .../dofus/misc/lists/QuestHookList.as | 92 +- .../dofus/misc/lists/RoleplayHookList.as | 101 +- .../dofus/misc/lists/SocialHookList.as | 235 +- .../dofus/misc/lists/TriggerHookList.as | 77 +- .../dofus/misc/options/ChatOptions.as | 146 +- .../dofus/misc/stats/IStatsClass.as | 23 +- .../dofus/misc/stats/StatisticsFrame.as | 88 +- .../dofus/misc/stats/StatisticsManager.as | 482 +- .../dofus/misc/stats/StatsAction.as | 280 +- .../stats/frames/LoadingModuleFrameStats.as | 68 +- .../dofus/misc/stats/ui/BannerStats.as | 156 +- .../misc/stats/ui/CharacterCreationStats.as | 207 +- .../dofus/misc/stats/ui/CinematicStats.as | 124 +- .../dofus/misc/stats/ui/IUiStats.as | 22 +- .../stats/ui/NicknameRegistrationStats.as | 100 +- .../misc/stats/ui/ServerListSelectionStats.as | 114 +- .../stats/ui/ServerSimpleSelectionStats.as | 124 +- .../dofus/misc/stats/ui/TutorialStats.as | 781 ++- .../dofus/misc/utils/AnimationCleaner.as | 59 +- com/ankamagames/dofus/misc/utils/Camera.as | 361 +- .../dofus/misc/utils/CustomLoadingScreen.as | 366 +- .../misc/utils/CustomLoadingScreenManager.as | 321 +- .../dofus/misc/utils/DateFormat.as | 198 +- .../dofus/misc/utils/DebugTarget.as | 99 +- .../dofus/misc/utils/DofusApiAction.as | 125 +- .../dofus/misc/utils/EmbedAssets.as | 172 +- .../misc/utils/EmbedAssets_CHECKPOINT_CLIP.as | 23 +- .../EmbedAssets_CHECKPOINT_CLIP_BOTTOM.as | 23 +- ...EmbedAssets_CHECKPOINT_CLIP_BOTTOM_WALK.as | 23 +- .../utils/EmbedAssets_CHECKPOINT_CLIP_LEFT.as | 23 +- .../EmbedAssets_CHECKPOINT_CLIP_LEFT_WALK.as | 23 +- .../EmbedAssets_CHECKPOINT_CLIP_RIGHT.as | 23 +- .../EmbedAssets_CHECKPOINT_CLIP_RIGHT_WALK.as | 23 +- .../utils/EmbedAssets_CHECKPOINT_CLIP_TOP.as | 23 +- .../EmbedAssets_CHECKPOINT_CLIP_TOP_WALK.as | 23 +- .../utils/EmbedAssets_CHECKPOINT_CLIP_WALK.as | 23 +- .../EmbedAssets_DefaultBeriliaSlotIcon.as | 23 +- .../misc/utils/EmbedAssets_FLAG_CURSOR.as | 23 +- .../misc/utils/EmbedAssets_QUEST_CLIP.as | 23 +- .../utils/EmbedAssets_QUEST_OBJECTIVE_CLIP.as | 23 +- .../EmbedAssets_QUEST_REPEATABLE_CLIP.as | 23 +- ...dAssets_QUEST_REPEATABLE_OBJECTIVE_CLIP.as | 23 +- .../misc/utils/EmbedAssets_SWORDS_CLIP.as | 23 +- .../utils/EmbedAssets_TEAM_CIRCLE_CLIP.as | 23 +- .../dofus/misc/utils/GameDataQuery.as | 657 +-- com/ankamagames/dofus/misc/utils/Inspector.as | 1416 ++--- .../dofus/misc/utils/LoadingScreen.as | 1138 ++-- .../misc/utils/LoadingScreen__background.as | 23 +- .../misc/utils/LoadingScreen__bandeau_bas.as | 23 +- .../misc/utils/LoadingScreen__bandeau_haut.as | 23 +- .../misc/utils/LoadingScreen__btnContinue.as | 23 +- .../dofus/misc/utils/LoadingScreen__btnLog.as | 23 +- .../utils/LoadingScreen__defaultBackground.as | 23 +- .../utils/LoadingScreen__defaultForeground.as | 23 +- .../utils/LoadingScreen__dofusProgress.as | 23 +- .../misc/utils/LoadingScreen__foreground.as | 23 +- .../dofus/misc/utils/LoadingScreen__logoFr.as | 23 +- .../dofus/misc/utils/LoadingScreen__logoJp.as | 23 +- .../dofus/misc/utils/LoadingScreen__logoRu.as | 23 +- .../utils/LoadingScreen__tipsBackground.as | 23 +- .../utils/LoadingScreen__txProgressBar.as | 23 +- .../LoadingScreen__txProgressBarBackground.as | 23 +- .../dofus/misc/utils/LookCleaner.as | 71 +- .../dofus/misc/utils/ParamsDecoder.as | 911 ++- .../dofus/misc/utils/RpcServiceCenter.as | 243 +- .../dofus/misc/utils/RpcServiceManager.as | 670 ++- .../misc/utils/SkinPartTransformProvider.as | 65 +- .../misc/utils/StatisticReportingManager.as | 212 +- .../utils/errormanager/DataExceptionModel.as | 106 +- .../utils/errormanager/DofusErrorHandler.as | 1270 ++-- .../misc/utils/errormanager/ErrorReport.as | 296 +- .../errormanager/ErrorReport__htmlTemplate.as | 23 +- .../errormanager/WebServiceDataHandler.as | 640 +- .../utils/frames/LuaScriptRecorderFrame.as | 849 ++- .../utils/mapeditor/MapEditorConnector.as | 305 +- .../utils/mapeditor/MapEditorDataEvent.as | 36 +- .../misc/utils/mapeditor/MapEditorManager.as | 458 +- .../misc/utils/mapeditor/MapEditorMessage.as | 82 +- .../modules/utils/ItemTooltipSettings.as | 157 +- .../dofus/modules/utils/ModuleFilestream.as | 797 +-- .../modules/utils/ModuleInstallerFrame.as | 855 ++- .../modules/utils/SpellTooltipSettings.as | 131 +- .../InstalledModuleInfoRequestAction.as | 41 +- .../InstalledModuleListRequestAction.as | 35 +- .../actions/ModuleDeleteRequestAction.as | 41 +- .../actions/ModuleInstallCancelAction.as | 35 +- .../actions/ModuleInstallConfirmAction.as | 41 +- .../actions/ModuleInstallRequestAction.as | 41 +- .../utils/actions/ModuleListRequestAction.as | 41 +- .../dofus/network/MessageReceiver.as | 3263 +++++------ com/ankamagames/dofus/network/Metadata.as | 31 +- .../dofus/network/ProtocolConstantsEnum.as | 183 +- .../dofus/network/ProtocolTypeManager.as | 1001 ++-- .../enums/AccessoryPreviewErrorEnum.as | 29 +- .../network/enums/AggressableStatusEnum.as | 41 +- .../dofus/network/enums/AlignmentSideEnum.as | 37 +- .../network/enums/AllianceRightsBitEnum.as | 40 +- .../dofus/network/enums/BreedEnum.as | 103 +- .../dofus/network/enums/BuildTypeEnum.as | 41 +- .../enums/CharacterCreationResultEnum.as | 44 +- .../enums/CharacterDeletionErrorEnum.as | 32 +- .../enums/CharacterInventoryPositionEnum.as | 100 +- .../network/enums/CharacterRemodelingEnum.as | 38 +- .../CharacterSpellModificationTypeEnum.as | 61 +- .../enums/ChatActivableChannelsEnum.as | 61 +- .../network/enums/ChatChannelsMultiEnum.as | 52 +- .../dofus/network/enums/ChatErrorEnum.as | 46 +- .../network/enums/ClientInstallTypeEnum.as | 29 +- .../network/enums/ClientTechnologyEnum.as | 29 +- .../dofus/network/enums/CompassTypeEnum.as | 34 +- .../network/enums/ConsoleMessageTypeEnum.as | 29 +- .../dofus/network/enums/CraftResultEnum.as | 31 +- .../enums/CrafterDirectoryParamBitEnum.as | 31 +- .../dofus/network/enums/DebugLevelEnum.as | 38 +- .../network/enums/DelayedActionTypeEnum.as | 32 +- .../dofus/network/enums/DialogTypeEnum.as | 65 +- .../dofus/network/enums/DirectionsEnum.as | 43 +- .../dofus/network/enums/ExchangeErrorEnum.as | 55 +- .../enums/ExchangeReplayStopReasonEnum.as | 31 +- .../dofus/network/enums/ExchangeTypeEnum.as | 81 +- .../network/enums/FightDispellableEnum.as | 31 +- .../dofus/network/enums/FightOptionsEnum.as | 31 +- .../dofus/network/enums/FightOutcomeEnum.as | 34 +- .../enums/FightSpellCastCriticalEnum.as | 28 +- .../dofus/network/enums/FightTypeEnum.as | 49 +- .../network/enums/FighterRefusedReasonEnum.as | 94 +- .../GameActionFightInvisibilityStateEnum.as | 28 +- .../enums/GameActionMarkCellsTypeEnum.as | 28 +- .../network/enums/GameActionMarkTypeEnum.as | 31 +- .../dofus/network/enums/GameContextEnum.as | 25 +- .../dofus/network/enums/GameHierarchyEnum.as | 38 +- .../network/enums/GuestLimitationEnum.as | 43 +- .../enums/GuildInformationsTypeEnum.as | 44 +- .../dofus/network/enums/GuildRightsBitEnum.as | 73 +- .../enums/HardcoreOrEpicDeathStateEnum.as | 29 +- .../enums/IdentificationFailureReasonEnum.as | 62 +- .../dofus/network/enums/ListAddFailureEnum.as | 34 +- .../network/enums/MapObstacleStateEnum.as | 26 +- .../network/enums/MountEquipedErrorEnum.as | 28 +- .../dofus/network/enums/NicknameErrorEnum.as | 35 +- .../enums/NicknameGeneratingFailureEnum.as | 26 +- .../dofus/network/enums/ObjectErrorEnum.as | 55 +- .../dofus/network/enums/PartStateEnum.as | 29 +- .../dofus/network/enums/PartyJoinErrorEnum.as | 55 +- .../dofus/network/enums/PartyNameErrorEnum.as | 34 +- .../dofus/network/enums/PartyTypeEnum.as | 31 +- .../dofus/network/enums/PaymentTypeEnum.as | 25 +- .../dofus/network/enums/PlayableBreedEnum.as | 70 +- .../network/enums/PlayerLifeStatusEnum.as | 28 +- .../dofus/network/enums/PlayerStateEnum.as | 31 +- .../dofus/network/enums/PlayerStatusEnum.as | 40 +- .../network/enums/PresetDeleteResultEnum.as | 28 +- .../network/enums/PresetSaveResultEnum.as | 28 +- .../enums/PresetSaveUpdateErrorEnum.as | 31 +- .../network/enums/PresetUseResultEnum.as | 34 +- .../dofus/network/enums/PrismListenEnum.as | 28 +- .../PrismSetSabotagedRefusedReasonEnum.as | 40 +- .../dofus/network/enums/PrismStateEnum.as | 44 +- .../dofus/network/enums/PvpArenaStepEnum.as | 32 +- .../dofus/network/enums/PvpArenaTypeEnum.as | 26 +- .../dofus/network/enums/SequenceTypeEnum.as | 47 +- .../enums/ServerConnectionErrorEnum.as | 41 +- .../dofus/network/enums/ServerStatusEnum.as | 44 +- .../dofus/network/enums/ShortcutBarEnum.as | 25 +- .../enums/SocialContactCategoryEnum.as | 43 +- .../enums/SocialGroupCreationResultEnum.as | 59 +- .../enums/SocialGroupInvitationStateEnum.as | 31 +- .../dofus/network/enums/StatisticTypeEnum.as | 143 +- .../network/enums/StatsUpgradeResultEnum.as | 37 +- .../SubEntityBindingPointCategoryEnum.as | 43 +- .../network/enums/SubscriptionRequiredEnum.as | 37 +- .../enums/TaxCollectorErrorReasonEnum.as | 46 +- .../network/enums/TaxCollectorStateEnum.as | 29 +- .../dofus/network/enums/TeamEnum.as | 28 +- .../dofus/network/enums/TeamTypeEnum.as | 37 +- .../dofus/network/enums/TeleporterTypeEnum.as | 28 +- .../network/enums/TextInformationTypeEnum.as | 44 +- .../enums/TreasureHuntDigRequestEnum.as | 41 +- .../enums/TreasureHuntFlagRequestEnum.as | 41 +- .../enums/TreasureHuntFlagStateEnum.as | 29 +- .../network/enums/TreasureHuntRequestEnum.as | 35 +- .../network/enums/TreasureHuntTypeEnum.as | 29 +- .../network/enums/UpdatableMountBoostEnum.as | 37 +- .../authorized/AdminCommandMessage.as | 155 +- .../authorized/AdminQuietCommandMessage.as | 150 +- .../authorized/ConsoleCommandsListMessage.as | 273 +- .../messages/authorized/ConsoleMessage.as | 178 +- .../common/NetworkDataContainerMessage.as | 186 +- .../messages/common/basic/BasicPingMessage.as | 155 +- .../messages/common/basic/BasicPongMessage.as | 155 +- .../messages/common/basic/BasicStatMessage.as | 167 +- .../CredentialsAcknowledgementMessage.as | 132 +- .../connection/HelloConnectMessage.as | 203 +- .../IdentificationAccountForceMessage.as | 164 +- .../IdentificationFailedBannedMessage.as | 185 +- ...dentificationFailedForBadVersionMessage.as | 171 +- .../connection/IdentificationFailedMessage.as | 167 +- .../connection/IdentificationMessage.as | 337 +- .../IdentificationSuccessMessage.as | 367 +- ...ntificationSuccessWithLoginTokenMessage.as | 161 +- .../SelectedServerDataExtendedMessage.as | 217 +- .../connection/SelectedServerDataMessage.as | 256 +- .../SelectedServerRefusedMessage.as | 219 +- .../connection/ServerSelectionMessage.as | 179 +- .../connection/ServerStatusUpdateMessage.as | 165 +- .../messages/connection/ServersListMessage.as | 195 +- .../register/NicknameAcceptedMessage.as | 132 +- .../register/NicknameChoiceRequestMessage.as | 155 +- .../register/NicknameRefusedMessage.as | 167 +- .../register/NicknameRegistrationMessage.as | 132 +- .../search/AcquaintanceSearchErrorMessage.as | 167 +- .../search/AcquaintanceSearchMessage.as | 155 +- .../search/AcquaintanceServerListMessage.as | 211 +- .../debug/DebugClearHighlightCellsMessage.as | 132 +- .../debug/DebugHighlightCellsMessage.as | 222 +- .../messages/debug/DebugInClientMessage.as | 178 +- .../AchievementDetailedListMessage.as | 238 +- .../AchievementDetailedListRequestMessage.as | 179 +- .../achievement/AchievementDetailsMessage.as | 165 +- .../AchievementDetailsRequestMessage.as | 179 +- .../AchievementFinishedInformationMessage.as | 196 +- .../achievement/AchievementFinishedMessage.as | 204 +- .../achievement/AchievementListMessage.as | 252 +- .../AchievementRewardErrorMessage.as | 155 +- .../AchievementRewardRequestMessage.as | 155 +- .../AchievementRewardSuccessMessage.as | 155 +- ...uildSetWarnOnAchievementCompleteMessage.as | 155 +- ...ldWarnOnAchievementCompleteStateMessage.as | 155 +- .../game/actions/AbstractGameActionMessage.as | 190 +- .../AbstractGameActionWithAckMessage.as | 161 +- .../GameActionAcknowledgementMessage.as | 166 +- .../game/actions/GameActionNoopMessage.as | 132 +- ...ctGameActionFightTargetedAbilityMessage.as | 227 +- ...GameActionFightActivateGlyphTrapMessage.as | 174 +- .../GameActionFightCarryCharacterMessage.as | 198 +- ...meActionFightCastOnTargetRequestMessage.as | 190 +- .../GameActionFightCastRequestMessage.as | 212 +- .../fight/GameActionFightChangeLookMessage.as | 184 +- .../GameActionFightCloseCombatMessage.as | 185 +- .../fight/GameActionFightDeathMessage.as | 163 +- .../GameActionFightDispellEffectMessage.as | 185 +- .../fight/GameActionFightDispellMessage.as | 163 +- .../GameActionFightDispellSpellMessage.as | 185 +- ...GameActionFightDispellableEffectMessage.as | 179 +- .../GameActionFightDodgePointLossMessage.as | 198 +- .../GameActionFightDropCharacterMessage.as | 198 +- ...GameActionFightExchangePositionsMessage.as | 223 +- .../GameActionFightInvisibilityMessage.as | 186 +- ...GameActionFightInvisibleDetectedMessage.as | 198 +- ...GameActionFightInvisibleObstacleMessage.as | 187 +- .../fight/GameActionFightKillMessage.as | 163 +- ...tionFightLifeAndShieldPointsLostMessage.as | 185 +- .../GameActionFightLifePointsGainMessage.as | 198 +- .../GameActionFightLifePointsLostMessage.as | 223 +- .../fight/GameActionFightMarkCellsMessage.as | 173 +- ...ActionFightModifyEffectsDurationMessage.as | 174 +- .../GameActionFightNoSpellCastMessage.as | 179 +- .../GameActionFightPointsVariationMessage.as | 174 +- .../GameActionFightReduceDamagesMessage.as | 198 +- .../GameActionFightReflectDamagesMessage.as | 163 +- .../GameActionFightReflectSpellMessage.as | 163 +- .../fight/GameActionFightSlideMessage.as | 223 +- .../fight/GameActionFightSpellCastMessage.as | 257 +- ...ctionFightSpellCooldownVariationMessage.as | 209 +- .../GameActionFightSpellImmunityMessage.as | 198 +- .../fight/GameActionFightStealKamaMessage.as | 198 +- .../fight/GameActionFightSummonMessage.as | 179 +- .../fight/GameActionFightTackledMessage.as | 199 +- ...GameActionFightTeleportOnSameMapMessage.as | 198 +- .../GameActionFightThrowCharacterMessage.as | 198 +- .../GameActionFightTriggerEffectMessage.as | 150 +- .../GameActionFightTriggerGlyphTrapMessage.as | 209 +- .../GameActionFightUnmarkCellsMessage.as | 163 +- .../fight/GameActionFightVanishMessage.as | 163 +- .../actions/sequence/SequenceEndMessage.as | 201 +- .../actions/sequence/SequenceStartMessage.as | 166 +- .../AllianceChangeGuildRightsMessage.as | 204 +- .../alliance/AllianceCreationResultMessage.as | 167 +- .../AllianceCreationStartedMessage.as | 132 +- .../alliance/AllianceCreationValidMessage.as | 187 +- .../alliance/AllianceFactsErrorMessage.as | 179 +- .../game/alliance/AllianceFactsMessage.as | 319 +- .../alliance/AllianceFactsRequestMessage.as | 179 +- .../alliance/AllianceGuildLeavingMessage.as | 190 +- .../alliance/AllianceInsiderInfoMessage.as | 263 +- .../AllianceInsiderInfoRequestMessage.as | 132 +- .../AllianceInvitationAnswerMessage.as | 155 +- .../alliance/AllianceInvitationMessage.as | 179 +- .../AllianceInvitationStateRecrutedMessage.as | 167 +- .../AllianceInvitationStateRecruterMessage.as | 178 +- .../game/alliance/AllianceInvitedMessage.as | 209 +- .../game/alliance/AllianceJoinedMessage.as | 174 +- .../alliance/AllianceKickRequestMessage.as | 179 +- .../game/alliance/AllianceLeftMessage.as | 132 +- .../game/alliance/AllianceListMessage.as | 195 +- .../alliance/AllianceMembershipMessage.as | 152 +- .../AllianceModificationEmblemValidMessage.as | 165 +- ...ianceModificationNameAndTagValidMessage.as | 166 +- .../AllianceModificationStartedMessage.as | 185 +- .../AllianceModificationValidMessage.as | 187 +- .../alliance/AlliancePartialListMessage.as | 153 +- .../AllianceVersatileInfoListMessage.as | 195 +- .../game/alliance/KohUpdateMessage.as | 506 +- .../almanach/AlmanachCalendarDateMessage.as | 155 +- .../approach/AccountCapabilitiesMessage.as | 259 +- .../approach/AccountLoggingKickedMessage.as | 237 +- .../game/approach/AlreadyConnectedMessage.as | 132 +- .../AuthenticationTicketAcceptedMessage.as | 132 +- .../approach/AuthenticationTicketMessage.as | 166 +- .../AuthenticationTicketRefusedMessage.as | 132 +- .../game/approach/HelloGameMessage.as | 132 +- .../approach/ReloginTokenRequestMessage.as | 67 + .../approach/ReloginTokenStatusMessage.as | 166 +- .../approach/ServerOptionalFeaturesMessage.as | 211 +- .../approach/ServerSessionConstantsMessage.as | 203 +- .../game/approach/ServerSettingsMessage.as | 215 +- .../atlas/AtlasPointInformationsMessage.as | 165 +- .../game/atlas/compass/CompassResetMessage.as | 167 +- .../atlas/compass/CompassUpdateMessage.as | 194 +- .../CompassUpdatePartyMemberMessage.as | 187 +- .../compass/CompassUpdatePvpSeekMessage.as | 198 +- .../messages/game/basic/BasicAckMessage.as | 204 +- .../messages/game/basic/BasicDateMessage.as | 237 +- .../game/basic/BasicLatencyStatsMessage.as | 245 +- .../basic/BasicLatencyStatsRequestMessage.as | 132 +- .../game/basic/BasicNoOperationMessage.as | 132 +- .../messages/game/basic/BasicTimeMessage.as | 190 +- .../game/basic/BasicWhoAmIRequestMessage.as | 155 +- .../messages/game/basic/BasicWhoIsMessage.as | 359 +- .../game/basic/BasicWhoIsNoMatchMessage.as | 155 +- .../game/basic/BasicWhoIsRequestMessage.as | 166 +- .../basic/CurrentServerStatusUpdateMessage.as | 167 +- .../game/basic/NumericWhoIsMessage.as | 204 +- .../game/basic/NumericWhoIsRequestMessage.as | 179 +- .../game/basic/SequenceNumberMessage.as | 179 +- .../basic/SequenceNumberRequestMessage.as | 132 +- .../game/basic/TextInformationMessage.as | 242 +- .../choice/BasicCharactersListMessage.as | 203 +- .../choice/CharacterFirstSelectionMessage.as | 161 +- ...haracterReplayWithRemodelRequestMessage.as | 173 +- .../choice/CharacterSelectedErrorMessage.as | 132 +- .../choice/CharacterSelectedForceMessage.as | 179 +- .../CharacterSelectedForceReadyMessage.as | 132 +- .../choice/CharacterSelectedSuccessMessage.as | 174 +- .../choice/CharacterSelectionMessage.as | 179 +- .../CharacterSelectionWithRemodelMessage.as | 171 +- .../choice/CharactersListErrorMessage.as | 132 +- .../character/choice/CharactersListMessage.as | 164 +- .../choice/CharactersListRequestMessage.as | 132 +- .../CharactersListWithModificationsMessage.as | 330 +- .../CharactersListWithRemodelingMessage.as | 203 +- .../CharacterCreationRequestMessage.as | 258 +- .../CharacterCreationResultMessage.as | 167 +- .../CharacterNameSuggestionFailureMessage.as | 167 +- .../CharacterNameSuggestionRequestMessage.as | 132 +- .../CharacterNameSuggestionSuccessMessage.as | 155 +- .../deletion/CharacterDeletionErrorMessage.as | 167 +- .../CharacterDeletionRequestMessage.as | 190 +- .../replay/CharacterReplayRequestMessage.as | 179 +- .../stats/CharacterExperienceGainMessage.as | 270 +- .../CharacterLevelUpInformationMessage.as | 196 +- .../stats/CharacterLevelUpMessage.as | 179 +- .../stats/CharacterStatsListMessage.as | 165 +- .../stats/FighterStatsListMessage.as | 165 +- .../stats/LifePointsRegenBeginMessage.as | 179 +- .../stats/LifePointsRegenEndMessage.as | 185 +- .../stats/UpdateLifePointsMessage.as | 204 +- .../status/PlayerStatusUpdateErrorMessage.as | 132 +- .../status/PlayerStatusUpdateMessage.as | 231 +- .../PlayerStatusUpdateRequestMessage.as | 171 +- .../game/chat/ChatAbstractClientMessage.as | 156 +- .../game/chat/ChatAbstractServerMessage.as | 220 +- .../game/chat/ChatAdminServerMessage.as | 150 +- .../game/chat/ChatClientMultiMessage.as | 181 +- .../chat/ChatClientMultiWithObjectMessage.as | 209 +- .../game/chat/ChatClientPrivateMessage.as | 170 +- .../ChatClientPrivateWithObjectMessage.as | 209 +- .../messages/game/chat/ChatErrorMessage.as | 167 +- .../game/chat/ChatServerCopyMessage.as | 197 +- .../chat/ChatServerCopyWithObjectMessage.as | 201 +- .../messages/game/chat/ChatServerMessage.as | 208 +- .../game/chat/ChatServerWithObjectMessage.as | 201 +- .../channel/ChannelEnablingChangeMessage.as | 178 +- .../chat/channel/ChannelEnablingMessage.as | 178 +- .../chat/channel/EnabledChannelsMessage.as | 248 +- .../chat/report/ChatMessageReportMessage.as | 259 +- .../game/chat/smiley/ChatSmileyMessage.as | 215 +- .../chat/smiley/ChatSmileyRequestMessage.as | 179 +- .../chat/smiley/LocalizedChatSmileyMessage.as | 185 +- .../chat/smiley/MoodSmileyRequestMessage.as | 155 +- .../chat/smiley/MoodSmileyResultMessage.as | 178 +- .../chat/smiley/MoodSmileyUpdateMessage.as | 215 +- .../context/GameCautiousMapMovementMessage.as | 151 +- .../GameCautiousMapMovementRequestMessage.as | 159 +- .../context/GameContextCreateErrorMessage.as | 132 +- .../game/context/GameContextCreateMessage.as | 167 +- .../GameContextCreateRequestMessage.as | 132 +- .../game/context/GameContextDestroyMessage.as | 132 +- .../game/context/GameContextKickMessage.as | 155 +- .../context/GameContextMoveElementMessage.as | 165 +- .../GameContextMoveMultipleElementsMessage.as | 195 +- .../game/context/GameContextQuitMessage.as | 132 +- .../game/context/GameContextReadyMessage.as | 179 +- .../GameContextRefreshEntityLookMessage.as | 176 +- .../GameContextRemoveElementMessage.as | 155 +- ...ameContextRemoveElementWithEventMessage.as | 185 +- ...ameContextRemoveMultipleElementsMessage.as | 191 +- ...RemoveMultipleElementsWithEventsMessage.as | 217 +- .../context/GameEntitiesDispositionMessage.as | 195 +- .../GameEntityDispositionErrorMessage.as | 132 +- .../context/GameEntityDispositionMessage.as | 165 +- .../GameMapChangeOrientationMessage.as | 165 +- .../GameMapChangeOrientationRequestMessage.as | 167 +- .../GameMapChangeOrientationsMessage.as | 195 +- .../context/GameMapMovementCancelMessage.as | 179 +- .../context/GameMapMovementConfirmMessage.as | 132 +- .../game/context/GameMapMovementMessage.as | 222 +- .../context/GameMapMovementRequestMessage.as | 250 +- .../game/context/GameMapNoMovementMessage.as | 132 +- .../messages/game/context/ShowCellMessage.as | 190 +- .../game/context/ShowCellRequestMessage.as | 179 +- .../game/context/ShowCellSpectatorMessage.as | 161 +- .../DisplayNumericalValuePaddockMessage.as | 99 + .../context/dungeon/DungeonKeyRingMessage.as | 272 +- .../dungeon/DungeonKeyRingUpdateMessage.as | 190 +- .../game/context/fight/GameFightEndMessage.as | 297 +- .../fight/GameFightHumanReadyStateMessage.as | 190 +- .../context/fight/GameFightJoinMessage.as | 238 +- .../fight/GameFightJoinRequestMessage.as | 166 +- .../context/fight/GameFightLeaveMessage.as | 155 +- .../context/fight/GameFightNewRoundMessage.as | 179 +- .../context/fight/GameFightNewWaveMessage.as | 208 +- .../GameFightOptionStateUpdateMessage.as | 230 +- .../fight/GameFightOptionToggleMessage.as | 167 +- ...ameFightPlacementPositionRequestMessage.as | 179 +- ...eFightPlacementPossiblePositionsMessage.as | 293 +- ...ightPlacementSwapPositionsAcceptMessage.as | 95 + ...ightPlacementSwapPositionsCancelMessage.as | 95 + ...tPlacementSwapPositionsCancelledMessage.as | 204 +- ...FightPlacementSwapPositionsErrorMessage.as | 132 +- .../GameFightPlacementSwapPositionsMessage.as | 187 +- ...FightPlacementSwapPositionsOfferMessage.as | 303 +- ...ghtPlacementSwapPositionsRequestMessage.as | 82 + .../context/fight/GameFightReadyMessage.as | 155 +- .../fight/GameFightRemoveTeamMemberMessage.as | 208 +- .../context/fight/GameFightResumeMessage.as | 265 +- .../fight/GameFightResumeWithSlavesMessage.as | 207 +- .../context/fight/GameFightSpectateMessage.as | 300 +- .../GameFightSpectatePlayerRequestMessage.as | 155 +- .../fight/GameFightSpectatorJoinMessage.as | 201 +- .../context/fight/GameFightStartMessage.as | 132 +- .../context/fight/GameFightStartingMessage.as | 189 +- .../fight/GameFightSynchronizeMessage.as | 203 +- .../context/fight/GameFightTurnEndMessage.as | 155 +- .../fight/GameFightTurnFinishMessage.as | 132 +- .../context/fight/GameFightTurnListMessage.as | 232 +- .../fight/GameFightTurnReadyMessage.as | 155 +- .../fight/GameFightTurnReadyRequestMessage.as | 155 +- .../fight/GameFightTurnResumeMessage.as | 185 +- .../fight/GameFightTurnStartMessage.as | 190 +- .../fight/GameFightTurnStartPlayingMessage.as | 132 +- .../fight/GameFightUpdateTeamMessage.as | 198 +- .../fight/SlaveSwitchContextMessage.as | 285 +- .../fight/challenge/ChallengeInfoMessage.as | 248 +- .../fight/challenge/ChallengeResultMessage.as | 190 +- .../challenge/ChallengeTargetUpdateMessage.as | 190 +- .../challenge/ChallengeTargetsListMessage.as | 248 +- .../ChallengeTargetsListRequestMessage.as | 179 +- .../GameFightRefreshFighterMessage.as | 171 +- .../character/GameFightShowFighterMessage.as | 171 +- ...FightShowFighterRandomStaticPoseMessage.as | 152 +- .../mount/GameDataPaddockObjectAddMessage.as | 165 +- .../GameDataPaddockObjectListAddMessage.as | 195 +- .../GameDataPaddockObjectRemoveMessage.as | 179 +- .../context/mount/MountDataErrorMessage.as | 167 +- .../game/context/mount/MountDataMessage.as | 165 +- .../mount/MountEmoteIconUsedOkMessage.as | 190 +- .../context/mount/MountEquipedErrorMessage.as | 167 +- .../context/mount/MountFeedRequestMessage.as | 248 +- ...MountInformationInPaddockRequestMessage.as | 155 +- .../mount/MountInformationRequestMessage.as | 204 +- .../mount/MountReleaseRequestMessage.as | 132 +- .../context/mount/MountReleasedMessage.as | 163 +- .../mount/MountRenameRequestMessage.as | 174 +- .../game/context/mount/MountRenamedMessage.as | 174 +- .../game/context/mount/MountRidingMessage.as | 155 +- .../game/context/mount/MountSetMessage.as | 165 +- .../mount/MountSetXpRatioRequestMessage.as | 179 +- .../mount/MountSterilizeRequestMessage.as | 132 +- .../context/mount/MountSterilizedMessage.as | 163 +- .../mount/MountToggleRidingRequestMessage.as | 132 +- .../game/context/mount/MountUnSetMessage.as | 132 +- .../game/context/mount/MountXpRatioMessage.as | 179 +- .../context/mount/PaddockBuyRequestMessage.as | 179 +- .../context/mount/PaddockBuyResultMessage.as | 201 +- .../mount/PaddockMoveItemRequestMessage.as | 204 +- .../mount/PaddockRemoveItemRequestMessage.as | 179 +- .../mount/PaddockSellRequestMessage.as | 179 +- .../NotificationByServerMessage.as | 233 +- .../notification/NotificationListMessage.as | 191 +- .../notification/NotificationResetMessage.as | 132 +- .../NotificationUpdateFlagMessage.as | 179 +- .../game/context/roleplay/ChangeMapMessage.as | 179 +- .../context/roleplay/CurrentMapMessage.as | 190 +- .../roleplay/ErrorMapNotFoundMessage.as | 179 +- .../roleplay/GameRolePlayShowActorMessage.as | 171 +- .../GameRolePlayShowActorWithEventMessage.as | 187 +- ...lementaryInformationsDataInHouseMessage.as | 184 +- ...MapComplementaryInformationsDataMessage.as | 500 +- ...plementaryInformationsWithCoordsMessage.as | 223 +- .../context/roleplay/MapFightCountMessage.as | 179 +- .../roleplay/MapInformationsRequestMessage.as | 179 +- .../roleplay/MapObstacleUpdateMessage.as | 195 +- .../MapRunningFightDetailsExtendedMessage.as | 203 +- .../roleplay/MapRunningFightDetailsMessage.as | 279 +- .../MapRunningFightDetailsRequestMessage.as | 179 +- .../roleplay/MapRunningFightListMessage.as | 195 +- .../MapRunningFightListRequestMessage.as | 132 +- .../StopToListenRunningFightRequestMessage.as | 132 +- .../roleplay/TeleportOnSameMapMessage.as | 190 +- .../GameRolePlayFreeSoulRequestMessage.as | 132 +- .../death/GameRolePlayGameOverMessage.as | 132 +- .../GameRolePlayPlayerLifeStatusMessage.as | 167 +- .../roleplay/death/WarnOnPermaDeathMessage.as | 155 +- ...ameRolePlayDelayedActionFinishedMessage.as | 178 +- .../delay/GameRolePlayDelayedActionMessage.as | 208 +- .../GameRolePlayDelayedObjectUseMessage.as | 185 +- .../document/ComicReadingBeginMessage.as | 179 +- .../document/DocumentReadingBeginMessage.as | 179 +- .../context/roleplay/emote/EmoteAddMessage.as | 179 +- .../roleplay/emote/EmoteListMessage.as | 211 +- .../emote/EmotePlayAbstractMessage.as | 204 +- .../roleplay/emote/EmotePlayErrorMessage.as | 179 +- .../roleplay/emote/EmotePlayMassiveMessage.as | 197 +- .../roleplay/emote/EmotePlayMessage.as | 196 +- .../roleplay/emote/EmotePlayRequestMessage.as | 179 +- .../roleplay/emote/EmoteRemoveMessage.as | 179 +- .../fight/GameRolePlayAggressionMessage.as | 204 +- ...GameRolePlayAttackMonsterRequestMessage.as | 155 +- ...GameRolePlayFightRequestCanceledMessage.as | 201 +- ...olePlayPlayerFightFriendlyAnswerMessage.as | 166 +- ...ePlayPlayerFightFriendlyAnsweredMessage.as | 226 +- ...PlayPlayerFightFriendlyRequestedMessage.as | 237 +- .../GameRolePlayPlayerFightRequestMessage.as | 223 +- .../GameRolePlayRemoveChallengeMessage.as | 155 +- .../fight/GameRolePlayShowChallengeMessage.as | 165 +- .../GameRolePlayArenaFightAnswerMessage.as | 166 +- ...ameRolePlayArenaFightPropositionMessage.as | 255 +- .../GameRolePlayArenaFighterStatusMessage.as | 185 +- .../arena/GameRolePlayArenaRegisterMessage.as | 167 +- ...eRolePlayArenaRegistrationStatusMessage.as | 196 +- .../GameRolePlayArenaUnregisterMessage.as | 132 +- ...meRolePlayArenaUpdatePlayerInfosMessage.as | 303 +- .../roleplay/houses/AccountHouseMessage.as | 195 +- .../roleplay/houses/HouseBuyRequestMessage.as | 179 +- .../roleplay/houses/HouseBuyResultMessage.as | 215 +- .../HouseKickIndoorMerchantRequestMessage.as | 179 +- .../houses/HouseKickRequestMessage.as | 179 +- .../HouseLockFromInsideRequestMessage.as | 152 +- .../roleplay/houses/HousePropertiesMessage.as | 171 +- .../HouseSellFromInsideRequestMessage.as | 150 +- .../houses/HouseSellRequestMessage.as | 179 +- .../roleplay/houses/HouseSoldMessage.as | 215 +- .../houses/HouseToSellFilterMessage.as | 281 +- .../roleplay/houses/HouseToSellListMessage.as | 255 +- .../houses/HouseToSellListRequestMessage.as | 179 +- .../houses/guild/HouseGuildNoneMessage.as | 179 +- .../houses/guild/HouseGuildRightsMessage.as | 223 +- .../guild/HouseGuildRightsViewMessage.as | 132 +- .../guild/HouseGuildShareRequestMessage.as | 190 +- .../job/JobAllowMultiCraftRequestMessage.as | 155 +- .../JobAllowMultiCraftRequestSetMessage.as | 155 +- .../job/JobCrafterDirectoryAddMessage.as | 165 +- ...obCrafterDirectoryDefineSettingsMessage.as | 165 +- .../job/JobCrafterDirectoryEntryMessage.as | 227 +- .../JobCrafterDirectoryEntryRequestMessage.as | 179 +- .../job/JobCrafterDirectoryListMessage.as | 195 +- .../JobCrafterDirectoryListRequestMessage.as | 179 +- .../job/JobCrafterDirectoryRemoveMessage.as | 204 +- .../job/JobCrafterDirectorySettingsMessage.as | 195 +- .../roleplay/job/JobDescriptionMessage.as | 195 +- .../job/JobExperienceMultiUpdateMessage.as | 195 +- .../job/JobExperienceUpdateMessage.as | 165 +- .../context/roleplay/job/JobLevelUpMessage.as | 198 +- .../roleplay/job/JobListedUpdateMessage.as | 190 +- .../JobMultiCraftAvailableSkillsMessage.as | 252 +- .../roleplay/job/JobUnlearntMessage.as | 179 +- .../lockable/LockableChangeCodeMessage.as | 155 +- .../lockable/LockableCodeResultMessage.as | 167 +- .../lockable/LockableShowCodeDialogMessage.as | 190 +- .../LockableStateUpdateAbstractMessage.as | 155 +- .../LockableStateUpdateHouseDoorMessage.as | 177 +- .../LockableStateUpdateStorageMessage.as | 196 +- .../lockable/LockableUseCodeMessage.as | 155 +- .../npc/AlliancePrismDialogQuestionMessage.as | 132 +- ...xCollectorDialogQuestionExtendedMessage.as | 173 +- .../context/roleplay/npc/EntityTalkMessage.as | 233 +- .../npc/MapNpcsQuestStatusUpdateMessage.as | 288 +- .../roleplay/npc/NpcDialogCreationMessage.as | 166 +- .../roleplay/npc/NpcDialogQuestionMessage.as | 283 +- .../roleplay/npc/NpcDialogReplyMessage.as | 179 +- .../npc/NpcGenericActionFailureMessage.as | 132 +- .../npc/NpcGenericActionRequestMessage.as | 209 +- .../TaxCollectorDialogQuestionBasicMessage.as | 165 +- ...xCollectorDialogQuestionExtendedMessage.as | 429 +- .../objects/ObjectGroundAddedMessage.as | 204 +- .../objects/ObjectGroundListAddedMessage.as | 272 +- .../objects/ObjectGroundRemovedMessage.as | 179 +- .../ObjectGroundRemovedMultipleMessage.as | 211 +- .../GameDataPlayFarmObjectAnimationMessage.as | 211 +- .../paddock/PaddockPropertiesMessage.as | 171 +- .../paddock/PaddockSellBuyDialogMessage.as | 215 +- .../paddock/PaddockToSellFilterMessage.as | 212 +- .../paddock/PaddockToSellListMessage.as | 255 +- .../PaddockToSellListRequestMessage.as | 179 +- .../party/AbstractPartyEventMessage.as | 150 +- .../roleplay/party/AbstractPartyMessage.as | 179 +- ...geonPartyFinderAvailableDungeonsMessage.as | 211 +- ...tyFinderAvailableDungeonsRequestMessage.as | 132 +- .../DungeonPartyFinderListenErrorMessage.as | 179 +- .../DungeonPartyFinderListenRequestMessage.as | 179 +- .../DungeonPartyFinderRegisterErrorMessage.as | 132 +- ...ungeonPartyFinderRegisterRequestMessage.as | 211 +- ...ungeonPartyFinderRegisterSuccessMessage.as | 211 +- .../DungeonPartyFinderRoomContentMessage.as | 226 +- ...geonPartyFinderRoomContentUpdateMessage.as | 287 +- .../party/PartyAbdicateThroneMessage.as | 185 +- .../party/PartyAcceptInvitationMessage.as | 150 +- .../party/PartyCancelInvitationMessage.as | 185 +- ...artyCancelInvitationNotificationMessage.as | 210 +- .../party/PartyCannotJoinErrorMessage.as | 173 +- .../roleplay/party/PartyDeletedMessage.as | 150 +- .../party/PartyFollowMemberRequestMessage.as | 185 +- .../party/PartyFollowStatusUpdateMessage.as | 196 +- .../PartyFollowThisMemberRequestMessage.as | 161 +- .../PartyInvitationArenaRequestMessage.as | 150 +- ...PartyInvitationCancelledForGuestMessage.as | 185 +- .../party/PartyInvitationDetailsMessage.as | 350 +- .../PartyInvitationDetailsRequestMessage.as | 150 +- .../PartyInvitationDungeonDetailsMessage.as | 232 +- .../party/PartyInvitationDungeonMessage.as | 185 +- .../PartyInvitationDungeonRequestMessage.as | 185 +- .../roleplay/party/PartyInvitationMessage.as | 287 +- .../party/PartyInvitationRequestMessage.as | 155 +- .../roleplay/party/PartyJoinMessage.as | 357 +- .../roleplay/party/PartyKickRequestMessage.as | 185 +- .../roleplay/party/PartyKickedByMessage.as | 185 +- .../party/PartyLeaderUpdateMessage.as | 185 +- .../roleplay/party/PartyLeaveMessage.as | 150 +- .../party/PartyLeaveRequestMessage.as | 150 +- .../party/PartyLocateMembersMessage.as | 201 +- .../party/PartyLoyaltyStatusMessage.as | 161 +- .../party/PartyMemberEjectedMessage.as | 185 +- .../party/PartyMemberInFightMessage.as | 284 +- .../party/PartyMemberRemoveMessage.as | 185 +- .../party/PartyModifiableStatusMessage.as | 161 +- .../party/PartyNameSetErrorMessage.as | 173 +- .../party/PartyNameSetRequestMessage.as | 161 +- .../roleplay/party/PartyNameUpdateMessage.as | 161 +- .../roleplay/party/PartyNewGuestMessage.as | 170 +- .../roleplay/party/PartyNewMemberMessage.as | 152 +- .../party/PartyPledgeLoyaltyRequestMessage.as | 161 +- .../party/PartyRefuseInvitationMessage.as | 150 +- ...artyRefuseInvitationNotificationMessage.as | 185 +- .../roleplay/party/PartyRestrictedMessage.as | 161 +- .../party/PartyStopFollowRequestMessage.as | 150 +- .../roleplay/party/PartyUpdateLightMessage.as | 309 +- .../roleplay/party/PartyUpdateMessage.as | 177 +- .../PartyCompanionUpdateLightMessage.as | 187 +- .../purchasable/PurchasableDialogMessage.as | 215 +- .../quest/GuidedModeQuitRequestMessage.as | 132 +- .../quest/GuidedModeReturnRequestMessage.as | 132 +- .../roleplay/quest/QuestListMessage.as | 321 +- .../roleplay/quest/QuestListRequestMessage.as | 132 +- .../quest/QuestObjectiveValidatedMessage.as | 204 +- .../quest/QuestObjectiveValidationMessage.as | 204 +- .../quest/QuestStartRequestMessage.as | 179 +- .../roleplay/quest/QuestStartedMessage.as | 179 +- .../roleplay/quest/QuestStepInfoMessage.as | 171 +- .../quest/QuestStepInfoRequestMessage.as | 179 +- .../roleplay/quest/QuestStepStartedMessage.as | 204 +- .../quest/QuestStepValidatedMessage.as | 204 +- .../roleplay/quest/QuestValidatedMessage.as | 179 +- .../roleplay/spell/SpellForgetUIMessage.as | 155 +- .../roleplay/spell/SpellForgottenMessage.as | 242 +- .../roleplay/spell/SpellItemBoostMessage.as | 215 +- .../spell/SpellUpgradeFailureMessage.as | 132 +- .../spell/SpellUpgradeRequestMessage.as | 204 +- .../spell/SpellUpgradeSuccessMessage.as | 190 +- .../spell/ValidateSpellForgetMessage.as | 179 +- .../stats/StatsUpgradeRequestMessage.as | 208 +- .../stats/StatsUpgradeResultMessage.as | 190 +- .../treasureHunt/PortalUseRequestMessage.as | 179 +- ...ureHuntAvailableRetryCountUpdateMessage.as | 178 +- ...easureHuntDigRequestAnswerFailedMessage.as | 185 +- .../TreasureHuntDigRequestAnswerMessage.as | 185 +- .../TreasureHuntDigRequestMessage.as | 167 +- .../TreasureHuntFinishedMessage.as | 167 +- .../TreasureHuntFlagRemoveRequestMessage.as | 197 +- .../TreasureHuntFlagRequestAnswerMessage.as | 219 +- .../TreasureHuntFlagRequestMessage.as | 197 +- .../TreasureHuntGiveUpRequestMessage.as | 167 +- .../TreasureHuntLegendaryRequestMessage.as | 179 +- .../treasureHunt/TreasureHuntMessage.as | 383 +- .../TreasureHuntRequestAnswerMessage.as | 185 +- .../TreasureHuntRequestMessage.as | 197 +- .../TreasureHuntShowLegendaryUIMessage.as | 211 +- .../visual/GameRolePlaySpellAnimMessage.as | 248 +- .../game/dialog/LeaveDialogMessage.as | 167 +- .../game/dialog/LeaveDialogRequestMessage.as | 132 +- .../game/dialog/PauseDialogMessage.as | 167 +- .../game/friend/FriendAddFailureMessage.as | 167 +- .../game/friend/FriendAddRequestMessage.as | 155 +- .../game/friend/FriendAddedMessage.as | 171 +- .../game/friend/FriendDeleteRequestMessage.as | 179 +- .../game/friend/FriendDeleteResultMessage.as | 166 +- .../game/friend/FriendJoinRequestMessage.as | 155 +- .../FriendSetWarnOnConnectionMessage.as | 155 +- .../friend/FriendSetWarnOnLevelGainMessage.as | 155 +- ...ndSpouseFollowWithCompassRequestMessage.as | 155 +- .../friend/FriendSpouseJoinRequestMessage.as | 132 +- .../game/friend/FriendUpdateMessage.as | 171 +- .../FriendWarnOnConnectionStateMessage.as | 155 +- .../FriendWarnOnLevelGainStateMessage.as | 155 +- .../game/friend/FriendsGetListMessage.as | 132 +- .../game/friend/FriendsListMessage.as | 203 +- .../GuildMemberSetWarnOnConnectionMessage.as | 155 +- ...GuildMemberWarnOnConnectionStateMessage.as | 155 +- .../game/friend/IgnoredAddFailureMessage.as | 167 +- .../game/friend/IgnoredAddRequestMessage.as | 166 +- .../game/friend/IgnoredAddedMessage.as | 180 +- .../friend/IgnoredDeleteRequestMessage.as | 190 +- .../game/friend/IgnoredDeleteResultMessage.as | 185 +- .../game/friend/IgnoredGetListMessage.as | 132 +- .../game/friend/IgnoredListMessage.as | 203 +- .../friend/SpouseGetInformationsMessage.as | 132 +- .../game/friend/SpouseInformationsMessage.as | 171 +- .../game/friend/SpouseStatusMessage.as | 155 +- .../friend/WarnOnPermaDeathStateMessage.as | 155 +- .../game/guest/GuestLimitationMessage.as | 167 +- .../messages/game/guest/GuestModeMessage.as | 155 +- .../guild/ChallengeFightJoinRefusedMessage.as | 190 +- .../GuildChangeMemberParametersMessage.as | 270 +- .../GuildCharacsUpgradeRequestMessage.as | 167 +- .../game/guild/GuildCreationResultMessage.as | 167 +- .../game/guild/GuildCreationStartedMessage.as | 132 +- .../game/guild/GuildCreationValidMessage.as | 176 +- .../game/guild/GuildFactsErrorMessage.as | 179 +- .../messages/game/guild/GuildFactsMessage.as | 287 +- .../game/guild/GuildFactsRequestMessage.as | 179 +- .../game/guild/GuildGetInformationsMessage.as | 167 +- .../game/guild/GuildHouseRemoveMessage.as | 179 +- .../guild/GuildHouseTeleportRequestMessage.as | 179 +- .../GuildHouseUpdateInformationMessage.as | 165 +- .../guild/GuildHousesInformationMessage.as | 195 +- .../game/guild/GuildInAllianceFactsMessage.as | 176 +- .../guild/GuildInformationsGeneralMessage.as | 399 +- .../GuildInformationsMemberUpdateMessage.as | 165 +- .../guild/GuildInformationsMembersMessage.as | 195 +- .../guild/GuildInformationsPaddocksMessage.as | 226 +- .../game/guild/GuildInfosUpgradeMessage.as | 538 +- .../guild/GuildInvitationAnswerMessage.as | 155 +- .../guild/GuildInvitationByNameMessage.as | 155 +- .../game/guild/GuildInvitationMessage.as | 179 +- .../GuildInvitationStateRecrutedMessage.as | 167 +- .../GuildInvitationStateRecruterMessage.as | 178 +- .../game/guild/GuildInvitedMessage.as | 209 +- .../messages/game/guild/GuildJoinedMessage.as | 209 +- .../game/guild/GuildKickRequestMessage.as | 179 +- .../messages/game/guild/GuildLeftMessage.as | 132 +- .../game/guild/GuildLevelUpMessage.as | 179 +- .../messages/game/guild/GuildListMessage.as | 195 +- .../game/guild/GuildMemberLeavingMessage.as | 166 +- .../guild/GuildMemberOnlineStatusMessage.as | 190 +- .../game/guild/GuildMembershipMessage.as | 152 +- .../GuildModificationEmblemValidMessage.as | 165 +- .../GuildModificationNameValidMessage.as | 155 +- .../guild/GuildModificationStartedMessage.as | 174 +- .../guild/GuildModificationValidMessage.as | 176 +- .../game/guild/GuildPaddockBoughtMessage.as | 165 +- .../game/guild/GuildPaddockRemovedMessage.as | 155 +- .../GuildPaddockTeleportRequestMessage.as | 155 +- .../guild/GuildSpellUpgradeRequestMessage.as | 179 +- .../guild/GuildVersatileInfoListMessage.as | 203 +- .../tax/AbstractTaxCollectorListMessage.as | 100 + ...RolePlayTaxCollectorFightRequestMessage.as | 155 +- .../guild/tax/GuildFightJoinRequestMessage.as | 155 +- .../tax/GuildFightLeaveRequestMessage.as | 204 +- .../GuildFightPlayersEnemiesListMessage.as | 226 +- .../GuildFightPlayersEnemyRemoveMessage.as | 204 +- .../GuildFightPlayersHelpersJoinMessage.as | 198 +- .../GuildFightPlayersHelpersLeaveMessage.as | 204 +- .../tax/GuildFightTakePlaceRequestMessage.as | 161 +- .../guild/tax/TaxCollectorAttackedMessage.as | 335 +- .../tax/TaxCollectorAttackedResultMessage.as | 191 +- .../guild/tax/TaxCollectorErrorMessage.as | 155 +- .../game/guild/tax/TaxCollectorListMessage.as | 256 +- .../tax/TaxCollectorMovementAddMessage.as | 171 +- .../guild/tax/TaxCollectorMovementMessage.as | 220 +- .../tax/TaxCollectorMovementRemoveMessage.as | 155 +- .../tax/TaxCollectorStateUpdateMessage.as | 166 +- .../guild/tax/TopTaxCollectorListMessage.as | 83 + .../CharacterCapabilitiesMessage.as | 179 +- .../CharacterLoadingCompleteMessage.as | 132 +- .../OnConnectionEventMessage.as | 167 +- .../ServerExperienceModificatorMessage.as | 179 +- .../SetCharacterRestrictionsMessage.as | 165 +- .../InteractiveElementUpdatedMessage.as | 165 +- .../InteractiveMapUpdateMessage.as | 203 +- .../interactive/InteractiveUseEndedMessage.as | 204 +- .../interactive/InteractiveUseErrorMessage.as | 204 +- .../InteractiveUseRequestMessage.as | 212 +- .../interactive/InteractiveUsedMessage.as | 270 +- .../StatedElementUpdatedMessage.as | 165 +- .../interactive/StatedMapUpdateMessage.as | 195 +- .../meeting/TeleportBuddiesAnswerMessage.as | 155 +- .../meeting/TeleportBuddiesMessage.as | 179 +- .../TeleportBuddiesRequestedMessage.as | 275 +- .../meeting/TeleportToBuddyAnswerMessage.as | 215 +- .../meeting/TeleportToBuddyCloseMessage.as | 204 +- .../meeting/TeleportToBuddyOfferMessage.as | 237 +- .../zaap/TeleportDestinationsListMessage.as | 403 +- .../zaap/TeleportRequestMessage.as | 197 +- .../game/interactive/zaap/ZaapListMessage.as | 186 +- .../game/inventory/KamasUpdateMessage.as | 155 +- .../ObjectAveragePricesErrorMessage.as | 132 +- .../ObjectAveragePricesGetMessage.as | 132 +- .../inventory/ObjectAveragePricesMessage.as | 272 +- .../exchanges/DecraftResultMessage.as | 96 + .../exchanges/ExchangeAcceptMessage.as | 132 +- .../exchanges/ExchangeBidHouseBuyMessage.as | 237 +- .../ExchangeBidHouseBuyResultMessage.as | 190 +- ...ExchangeBidHouseGenericItemAddedMessage.as | 179 +- ...changeBidHouseGenericItemRemovedMessage.as | 179 +- .../ExchangeBidHouseInListAddedMessage.as | 282 +- .../ExchangeBidHouseInListRemovedMessage.as | 155 +- .../ExchangeBidHouseInListUpdatedMessage.as | 153 +- .../ExchangeBidHouseItemAddOkMessage.as | 165 +- .../ExchangeBidHouseItemRemoveOkMessage.as | 155 +- .../exchanges/ExchangeBidHouseListMessage.as | 179 +- .../exchanges/ExchangeBidHousePriceMessage.as | 179 +- .../ExchangeBidHouseSearchMessage.as | 204 +- .../exchanges/ExchangeBidHouseTypeMessage.as | 179 +- .../ExchangeBidPriceForSellerMessage.as | 228 +- .../exchanges/ExchangeBidPriceMessage.as | 190 +- .../exchanges/ExchangeBidSearchOkMessage.as | 132 +- .../inventory/exchanges/ExchangeBuyMessage.as | 204 +- .../exchanges/ExchangeBuyOkMessage.as | 132 +- .../ExchangeClearPaymentForCraftMessage.as | 167 +- .../ExchangeCraftInformationObjectMessage.as | 185 +- ...geCraftResultMagicWithObjectDescMessage.as | 163 +- .../exchanges/ExchangeCraftResultMessage.as | 167 +- ...xchangeCraftResultWithObjectDescMessage.as | 171 +- .../ExchangeCraftResultWithObjectIdMessage.as | 185 +- .../ExchangeCraftSlotCountIncreasedMessage.as | 179 +- .../exchanges/ExchangeErrorMessage.as | 155 +- .../ExchangeGoldPaymentForCraftMessage.as | 190 +- .../ExchangeGuildTaxCollectorGetMessage.as | 354 +- .../ExchangeHandleMountsStableMessage.as | 116 + .../exchanges/ExchangeIsReadyMessage.as | 190 +- .../ExchangeItemAutoCraftRemainingMessage.as | 179 +- .../ExchangeItemAutoCraftStopedMessage.as | 155 +- .../ExchangeItemGoldAddAsPaymentMessage.as | 197 +- .../ExchangeItemObjectAddAsPaymentMessage.as | 237 +- .../ExchangeItemPaymentForCraftMessage.as | 176 +- .../exchanges/ExchangeLeaveMessage.as | 163 +- .../ExchangeModifiedPaymentForCraftMessage.as | 176 +- .../ExchangeMountFreeFromPaddockMessage.as | 226 +- .../ExchangeMountStableErrorMessage.as | 132 +- ...xchangeMountSterilizeFromPaddockMessage.as | 226 +- .../ExchangeMountsPaddockAddMessage.as | 96 + .../ExchangeMountsPaddockRemoveMessage.as | 94 + .../ExchangeMountsStableAddMessage.as | 96 + .../ExchangeMountsStableBornAddMessage.as | 77 + .../ExchangeMountsStableRemoveMessage.as | 94 + .../ExchangeMountsTakenFromPaddockMessage.as | 127 + .../exchanges/ExchangeObjectAddedMessage.as | 171 +- .../exchanges/ExchangeObjectMessage.as | 155 +- .../ExchangeObjectModifyPricedMessage.as | 150 +- .../ExchangeObjectMoveKamaMessage.as | 155 +- .../exchanges/ExchangeObjectMoveMessage.as | 190 +- .../ExchangeObjectMovePricedMessage.as | 185 +- ...xchangeObjectTransfertAllFromInvMessage.as | 132 +- .../ExchangeObjectTransfertAllToInvMessage.as | 132 +- ...geObjectTransfertExistingFromInvMessage.as | 132 +- ...angeObjectTransfertExistingToInvMessage.as | 132 +- ...changeObjectTransfertListFromInvMessage.as | 211 +- ...ExchangeObjectTransfertListToInvMessage.as | 211 +- ...ctTransfertListWithQuantityToInvMessage.as | 272 +- .../ExchangeObjectUseInWorkshopMessage.as | 190 +- .../exchanges/ExchangeObjectsAddedMessage.as | 201 +- .../exchanges/ExchangeOkMultiCraftMessage.as | 215 +- .../ExchangeOnHumanVendorRequestMessage.as | 204 +- .../ExchangePlayerMultiCraftRequestMessage.as | 218 +- .../exchanges/ExchangePlayerRequestMessage.as | 193 +- .../exchanges/ExchangeReadyMessage.as | 190 +- .../ExchangeRemovedPaymentForCraftMessage.as | 190 +- .../ExchangeReplayCountModifiedMessage.as | 155 +- .../exchanges/ExchangeReplayMessage.as | 155 +- .../exchanges/ExchangeReplayStopMessage.as | 132 +- .../ExchangeReplyTaxVendorMessage.as | 204 +- .../exchanges/ExchangeRequestMessage.as | 155 +- .../ExchangeRequestOnMountStockMessage.as | 132 +- .../ExchangeRequestOnShopStockMessage.as | 132 +- .../ExchangeRequestOnTaxCollectorMessage.as | 155 +- .../exchanges/ExchangeRequestedMessage.as | 155 +- .../ExchangeRequestedTradeMessage.as | 210 +- .../exchanges/ExchangeSellMessage.as | 204 +- .../exchanges/ExchangeSellOkMessage.as | 132 +- .../ExchangeSetCraftRecipeMessage.as | 179 +- ...ExchangeShopStockMovementRemovedMessage.as | 179 +- ...ExchangeShopStockMovementUpdatedMessage.as | 165 +- ...ngeShopStockMultiMovementRemovedMessage.as | 211 +- ...ngeShopStockMultiMovementUpdatedMessage.as | 195 +- .../ExchangeShopStockStartedMessage.as | 195 +- .../exchanges/ExchangeShowVendorTaxMessage.as | 132 +- .../exchanges/ExchangeStartAsVendorMessage.as | 132 +- .../exchanges/ExchangeStartOkCraftMessage.as | 132 +- ...hangeStartOkCraftWithInformationMessage.as | 206 +- .../ExchangeStartOkHumanVendorMessage.as | 226 +- .../ExchangeStartOkJobIndexMessage.as | 211 +- .../exchanges/ExchangeStartOkMountMessage.as | 201 +- ...changeStartOkMountWithOutPaddockMessage.as | 195 +- ...ExchangeStartOkMulticraftCrafterMessage.as | 204 +- ...xchangeStartOkMulticraftCustomerMessage.as | 237 +- .../ExchangeStartOkNpcShopMessage.as | 237 +- .../ExchangeStartOkNpcTradeMessage.as | 155 +- .../ExchangeStartOkRunesTradeMessage.as | 67 + .../ExchangeStartedBidBuyerMessage.as | 165 +- .../ExchangeStartedBidSellerMessage.as | 210 +- .../exchanges/ExchangeStartedMessage.as | 155 +- .../ExchangeStartedMountStockMessage.as | 195 +- .../ExchangeStartedWithPodsMessage.as | 298 +- .../ExchangeStartedWithStorageMessage.as | 185 +- ...TypesExchangerDescriptionForUserMessage.as | 211 +- ...ItemsExchangerDescriptionForUserMessage.as | 195 +- .../exchanges/ExchangeWaitingResultMessage.as | 155 +- .../exchanges/ExchangeWeightMessage.as | 204 +- .../exchanges/ItemNoMoreAvailableMessage.as | 132 +- .../exchanges/UpdateMountBoostMessage.as | 222 +- .../items/ExchangeKamaModifiedMessage.as | 187 +- ...iCraftCrafterCanUseHisRessourcesMessage.as | 155 +- ...aftSetCrafterCanUseHisRessourcesMessage.as | 155 +- .../ExchangeObjectModifiedInBagMessage.as | 173 +- .../items/ExchangeObjectModifiedMessage.as | 173 +- .../items/ExchangeObjectPutInBagMessage.as | 173 +- .../ExchangeObjectRemovedFromBagMessage.as | 187 +- .../items/ExchangeObjectRemovedMessage.as | 187 +- .../items/ExchangeObjectsModifiedMessage.as | 203 +- .../items/ExchangeObjectsRemovedMessage.as | 219 +- .../game/inventory/items/GoldAddedMessage.as | 165 +- .../items/InventoryContentAndPresetMessage.as | 203 +- .../items/InventoryContentMessage.as | 230 +- .../inventory/items/InventoryWeightMessage.as | 204 +- .../LivingObjectChangeSkinRequestMessage.as | 237 +- .../items/LivingObjectDissociateMessage.as | 204 +- .../items/LivingObjectMessageMessage.as | 248 +- .../LivingObjectMessageRequestMessage.as | 247 +- .../items/MimicryObjectAssociatedMessage.as | 150 +- .../items/MimicryObjectEraseRequestMessage.as | 204 +- .../items/MimicryObjectErrorMessage.as | 161 +- ...cryObjectFeedAndAssociateRequestMessage.as | 221 +- .../items/MimicryObjectPreviewMessage.as | 165 +- .../inventory/items/ObjectAddedMessage.as | 165 +- .../inventory/items/ObjectDeleteMessage.as | 204 +- .../inventory/items/ObjectDeletedMessage.as | 179 +- .../game/inventory/items/ObjectDropMessage.as | 204 +- .../inventory/items/ObjectErrorMessage.as | 155 +- .../game/inventory/items/ObjectFeedMessage.as | 237 +- .../items/ObjectFoundWhileRecoltingMessage.as | 237 +- .../inventory/items/ObjectJobAddedMessage.as | 179 +- .../inventory/items/ObjectModifiedMessage.as | 165 +- .../inventory/items/ObjectMovementMessage.as | 197 +- .../inventory/items/ObjectQuantityMessage.as | 204 +- .../items/ObjectSetPositionMessage.as | 226 +- .../game/inventory/items/ObjectUseMessage.as | 179 +- .../items/ObjectUseMultipleMessage.as | 185 +- .../inventory/items/ObjectUseOnCellMessage.as | 185 +- .../items/ObjectUseOnCharacterMessage.as | 185 +- .../inventory/items/ObjectsAddedMessage.as | 195 +- .../inventory/items/ObjectsDeletedMessage.as | 211 +- .../inventory/items/ObjectsQuantityMessage.as | 195 +- .../inventory/items/ObtainedItemMessage.as | 204 +- .../items/ObtainedItemWithBonusMessage.as | 185 +- .../game/inventory/items/SetUpdateMessage.as | 295 +- .../SymbioticObjectAssociateRequestMessage.as | 270 +- .../items/SymbioticObjectAssociatedMessage.as | 179 +- .../items/SymbioticObjectErrorMessage.as | 161 +- .../items/WrapperObjectAssociatedMessage.as | 150 +- .../WrapperObjectDissociateRequestMessage.as | 204 +- .../items/WrapperObjectErrorMessage.as | 150 +- .../preset/InventoryPresetDeleteMessage.as | 179 +- .../InventoryPresetDeleteResultMessage.as | 197 +- .../InventoryPresetItemUpdateErrorMessage.as | 167 +- .../InventoryPresetItemUpdateMessage.as | 198 +- ...InventoryPresetItemUpdateRequestMessage.as | 226 +- .../InventoryPresetSaveCustomMessage.as | 328 +- .../preset/InventoryPresetSaveMessage.as | 215 +- .../InventoryPresetSaveResultMessage.as | 197 +- .../preset/InventoryPresetUpdateMessage.as | 165 +- .../preset/InventoryPresetUseMessage.as | 179 +- .../preset/InventoryPresetUseResultMessage.as | 254 +- .../game/inventory/spells/SpellListMessage.as | 206 +- .../storage/StorageInventoryContentMessage.as | 155 +- .../storage/StorageKamasUpdateMessage.as | 155 +- .../storage/StorageObjectRemoveMessage.as | 179 +- .../storage/StorageObjectUpdateMessage.as | 165 +- .../storage/StorageObjectsRemoveMessage.as | 211 +- .../storage/StorageObjectsUpdateMessage.as | 195 +- .../game/look/AccessoryPreviewErrorMessage.as | 167 +- .../game/look/AccessoryPreviewMessage.as | 165 +- .../look/AccessoryPreviewRequestMessage.as | 211 +- .../game/moderation/PopupWarningMessage.as | 201 +- .../AreaFightModificatorUpdateMessage.as | 155 +- .../game/prism/PrismAttackRequestMessage.as | 132 +- .../game/prism/PrismFightAddedMessage.as | 165 +- .../prism/PrismFightAttackerAddMessage.as | 231 +- .../prism/PrismFightAttackerRemoveMessage.as | 237 +- .../prism/PrismFightDefenderAddMessage.as | 231 +- .../prism/PrismFightDefenderLeaveMessage.as | 237 +- .../PrismFightJoinLeaveRequestMessage.as | 190 +- .../game/prism/PrismFightRemovedMessage.as | 179 +- .../prism/PrismFightStateUpdateMessage.as | 179 +- .../prism/PrismFightSwapRequestMessage.as | 204 +- .../game/prism/PrismInfoCloseMessage.as | 132 +- .../game/prism/PrismInfoInValidMessage.as | 167 +- .../prism/PrismInfoJoinLeaveRequestMessage.as | 155 +- .../PrismModuleExchangeRequestMessage.as | 132 +- .../prism/PrismSetSabotagedRefusedMessage.as | 190 +- .../prism/PrismSetSabotagedRequestMessage.as | 179 +- .../game/prism/PrismSettingsErrorMessage.as | 132 +- .../game/prism/PrismSettingsRequestMessage.as | 204 +- .../game/prism/PrismUseRequestMessage.as | 132 +- .../game/prism/PrismsInfoValidMessage.as | 195 +- .../messages/game/prism/PrismsListMessage.as | 203 +- .../game/prism/PrismsListRegisterMessage.as | 167 +- .../game/prism/PrismsListUpdateMessage.as | 153 +- .../game/pvp/AlignmentRankUpdateMessage.as | 190 +- .../game/pvp/SetEnableAVARequestMessage.as | 155 +- .../game/pvp/SetEnablePVPRequestMessage.as | 155 +- ...UpdateMapPlayersAgressableStatusMessage.as | 260 +- .../pvp/UpdateSelfAgressableStatusMessage.as | 197 +- .../game/report/CharacterReportMessage.as | 204 +- .../messages/game/script/CinematicMessage.as | 179 +- .../messages/game/script/URLOpenMessage.as | 179 +- .../shortcut/ShortcutBarAddErrorMessage.as | 167 +- .../shortcut/ShortcutBarAddRequestMessage.as | 194 +- .../shortcut/ShortcutBarContentMessage.as | 224 +- .../shortcut/ShortcutBarRefreshMessage.as | 194 +- .../shortcut/ShortcutBarRemoveErrorMessage.as | 167 +- .../ShortcutBarRemoveRequestMessage.as | 197 +- .../shortcut/ShortcutBarRemovedMessage.as | 197 +- .../shortcut/ShortcutBarSwapErrorMessage.as | 167 +- .../shortcut/ShortcutBarSwapRequestMessage.as | 226 +- .../game/social/ContactLookErrorMessage.as | 179 +- .../game/social/ContactLookMessage.as | 236 +- .../social/ContactLookRequestByIdMessage.as | 185 +- .../game/social/ContactLookRequestMessage.as | 197 +- .../game/startup/StartupActionAddMessage.as | 165 +- .../startup/StartupActionFinishedMessage.as | 209 +- .../StartupActionsAllAttributionMessage.as | 179 +- .../startup/StartupActionsExecuteMessage.as | 132 +- .../game/startup/StartupActionsListMessage.as | 195 +- .../StartupActionsObjetAttributionMessage.as | 204 +- .../SubscriptionLimitationMessage.as | 167 +- .../subscriber/SubscriptionZoneMessage.as | 155 +- .../game/tinsel/OrnamentGainedMessage.as | 179 +- .../game/tinsel/OrnamentSelectErrorMessage.as | 167 +- .../tinsel/OrnamentSelectRequestMessage.as | 179 +- .../game/tinsel/OrnamentSelectedMessage.as | 179 +- .../game/tinsel/TitleGainedMessage.as | 179 +- .../messages/game/tinsel/TitleLostMessage.as | 179 +- .../game/tinsel/TitleSelectErrorMessage.as | 167 +- .../game/tinsel/TitleSelectRequestMessage.as | 179 +- .../game/tinsel/TitleSelectedMessage.as | 179 +- .../tinsel/TitlesAndOrnamentsListMessage.as | 332 +- .../TitlesAndOrnamentsListRequestMessage.as | 132 +- .../game/ui/ClientUIOpenedByObjectMessage.as | 185 +- .../messages/game/ui/ClientUIOpenedMessage.as | 167 +- .../messages/handshake/ProtocolRequired.as | 204 +- .../queues/LoginQueueStatusMessage.as | 204 +- .../messages/queues/QueueStatusMessage.as | 204 +- .../messages/secure/TrustStatusMessage.as | 155 +- .../messages/security/CheckFileMessage.as | 189 +- .../security/CheckFileRequestMessage.as | 178 +- .../security/CheckIntegrityMessage.as | 191 +- .../messages/security/ClientKeyMessage.as | 155 +- .../messages/security/RawDataMessage.as | 175 +- .../basic/SystemMessageDisplayMessage.as | 233 +- .../parts/DownloadCurrentSpeedMessage.as | 179 +- .../updater/parts/DownloadErrorMessage.as | 189 +- .../DownloadGetCurrentSpeedRequestMessage.as | 132 +- .../updater/parts/DownloadPartMessage.as | 155 +- .../parts/DownloadSetSpeedRequestMessage.as | 179 +- .../updater/parts/GetPartInfoMessage.as | 155 +- .../updater/parts/GetPartsListMessage.as | 132 +- .../messages/updater/parts/PartInfoMessage.as | 174 +- .../updater/parts/PartsListMessage.as | 195 +- .../messages/web/ankabox/MailStatusMessage.as | 204 +- .../messages/web/ankabox/NewMailMessage.as | 217 +- .../KrosmasterAuthTokenErrorMessage.as | 167 +- .../krosmaster/KrosmasterAuthTokenMessage.as | 155 +- .../KrosmasterAuthTokenRequestMessage.as | 132 +- .../KrosmasterInventoryErrorMessage.as | 167 +- .../krosmaster/KrosmasterInventoryMessage.as | 195 +- .../KrosmasterInventoryRequestMessage.as | 132 +- .../KrosmasterPlayingStatusMessage.as | 155 +- .../krosmaster/KrosmasterTransferMessage.as | 178 +- .../KrosmasterTransferRequestMessage.as | 155 +- .../types/common/basic/StatisticData.as | 71 + .../common/basic/StatisticDataBoolean.as | 59 + .../types/common/basic/StatisticDataByte.as | 59 + .../types/common/basic/StatisticDataInt.as | 59 + .../types/common/basic/StatisticDataShort.as | 59 + .../types/common/basic/StatisticDataString.as | 59 + .../connection/GameServerInformations.as | 245 +- .../types/game/achievement/Achievement.as | 216 +- .../game/achievement/AchievementObjective.as | 157 +- .../game/achievement/AchievementRewardable.as | 157 +- .../AchievementStartedObjective.as | 140 +- ...htDispellableEffectExtendedInformations.as | 170 +- .../fight/AbstractFightDispellableEffect.as | 267 +- .../fight/FightTemporaryBoostEffect.as | 116 +- .../fight/FightTemporaryBoostStateEffect.as | 116 +- .../FightTemporaryBoostWeaponDamagesEffect.as | 116 +- .../fight/FightTemporarySpellBoostEffect.as | 140 +- .../FightTemporarySpellImmunityEffect.as | 116 +- .../actions/fight/FightTriggeredEffect.as | 149 +- .../game/actions/fight/GameActionMark.as | 305 +- .../actions/fight/GameActionMarkedCell.as | 165 +- .../game/approach/ServerSessionConstant.as | 132 +- .../approach/ServerSessionConstantInteger.as | 116 +- .../approach/ServerSessionConstantLong.as | 140 +- .../approach/ServerSessionConstantString.as | 116 +- .../character/AbstractCharacterInformation.as | 131 +- .../CharacterMinimalAllianceInformations.as | 129 +- .../CharacterMinimalGuildInformations.as | 127 +- .../character/CharacterMinimalInformations.as | 150 +- ...cterMinimalPlusLookAndGradeInformations.as | 141 +- .../CharacterMinimalPlusLookInformations.as | 125 +- .../alignment/ActorAlignmentInformations.as | 200 +- .../ActorExtendedAlignmentInformations.as | 219 +- .../CharacterBaseCharacteristic.as | 151 +- .../CharacterCharacteristicsInformations.as | 1359 +++-- .../CharacterSpellModification.as | 168 +- ...AbstractCharacterToRefurbishInformation.as | 189 +- .../choice/CharacterBaseInformations.as | 130 +- .../CharacterHardcoreOrEpicInformations.as | 189 +- .../choice/CharacterRemodelingInformation.as | 218 +- .../choice/CharacterToRecolorInformation.as | 105 +- .../choice/CharacterToRelookInformation.as | 105 +- .../choice/CharacterToRemodelInformations.as | 166 +- .../character/choice/RemodelingInformation.as | 208 +- .../ActorRestrictionsInformations.as | 347 +- .../game/character/status/PlayerStatus.as | 119 +- .../character/status/PlayerStatusExtended.as | 115 +- .../types/game/context/ActorOrientation.as | 131 +- .../context/EntityDispositionInformations.as | 149 +- .../context/EntityMovementInformations.as | 155 +- .../FightEntityDispositionInformations.as | 115 +- .../context/GameContextActorInformations.as | 147 +- .../GameRolePlayTaxCollectorInformations.as | 177 +- ...IdentifiedEntityDispositionInformations.as | 115 +- .../types/game/context/MapCoordinates.as | 156 +- .../types/game/context/MapCoordinatesAndId.as | 115 +- .../game/context/MapCoordinatesExtended.as | 139 +- .../TaxCollectorStaticExtendedInformations.as | 127 +- .../context/TaxCollectorStaticInformations.as | 177 +- .../fight/AbstractFightTeamInformations.as | 193 +- .../fight/FightAllianceTeamInformations.as | 128 +- .../context/fight/FightCommonInformations.as | 285 +- .../fight/FightExternalInformations.as | 243 +- .../types/game/context/fight/FightLoot.as | 194 +- .../context/fight/FightOptionsInformations.as | 148 +- .../fight/FightResultAdditionalData.as | 91 +- .../fight/FightResultExperienceData.as | 388 +- .../fight/FightResultFighterListEntry.as | 126 +- .../context/fight/FightResultListEntry.as | 168 +- .../fight/FightResultMutantListEntry.as | 139 +- .../fight/FightResultPlayerListEntry.as | 192 +- .../game/context/fight/FightResultPvpData.as | 237 +- .../fight/FightResultTaxCollectorListEntry.as | 167 +- .../context/fight/FightTeamInformations.as | 161 +- .../fight/FightTeamLightInformations.as | 227 +- .../FightTeamMemberCharacterInformations.as | 150 +- .../FightTeamMemberCompanionInformations.as | 175 +- .../fight/FightTeamMemberInformations.as | 107 +- .../FightTeamMemberMonsterInformations.as | 150 +- ...FightTeamMemberTaxCollectorInformations.as | 263 +- ...MemberWithAllianceCharacterInformations.as | 125 +- .../context/fight/GameFightAIInformations.as | 108 +- .../fight/GameFightCharacterInformations.as | 185 +- .../fight/GameFightCompanionInformations.as | 180 +- ...eFightFighterCompanionLightInformations.as | 150 +- .../fight/GameFightFighterInformations.as | 262 +- .../GameFightFighterLightInformations.as | 208 +- ...ameFightFighterMonsterLightInformations.as | 139 +- .../GameFightFighterNamedInformations.as | 141 +- .../GameFightFighterNamedLightInformations.as | 115 +- ...ghtFighterTaxCollectorLightInformations.as | 164 +- .../context/fight/GameFightMinimalStats.as | 563 +- .../fight/GameFightMinimalStatsPreparation.as | 139 +- .../fight/GameFightMonsterInformations.as | 169 +- ...meFightMonsterWithAlignmentInformations.as | 130 +- .../fight/GameFightMutantInformations.as | 146 +- .../context/fight/GameFightResumeSlaveInfo.as | 217 +- .../context/fight/GameFightSpellCooldown.as | 143 +- .../GameFightTaxCollectorInformations.as | 202 +- .../context/roleplay/AllianceInformations.as | 125 +- ...rnativeMonstersInGroupLightInformations.as | 156 +- .../roleplay/AtlasPointsInformations.as | 168 +- .../roleplay/BasicAllianceInformations.as | 148 +- .../roleplay/BasicGuildInformations.as | 148 +- .../BasicNamedAllianceInformations.as | 115 +- .../roleplay/GameRolePlayActorInformations.as | 109 +- .../GameRolePlayCharacterInformations.as | 129 +- .../GameRolePlayGroupMonsterInformations.as | 243 +- ...ameRolePlayGroupMonsterWaveInformations.as | 196 +- .../GameRolePlayHumanoidInformations.as | 166 +- .../GameRolePlayMerchantInformations.as | 196 +- .../roleplay/GameRolePlayMountInformations.as | 154 +- .../GameRolePlayMutantInformations.as | 154 +- .../GameRolePlayNamedActorInformations.as | 119 +- .../roleplay/GameRolePlayNpcInformations.as | 179 +- .../GameRolePlayNpcWithQuestInformations.as | 129 +- .../GameRolePlayPortalInformations.as | 135 +- .../roleplay/GameRolePlayPrismInformations.as | 135 +- .../GameRolePlayTreasureHintInformations.as | 143 +- .../GroupMonsterStaticInformations.as | 158 +- ...nsterStaticInformationsWithAlternatives.as | 153 +- .../roleplay/GuildInAllianceInformations.as | 177 +- .../context/roleplay/GuildInformations.as | 125 +- .../context/roleplay/HumanInformations.as | 179 +- .../game/context/roleplay/HumanOption.as | 92 +- .../context/roleplay/HumanOptionAlliance.as | 141 +- .../game/context/roleplay/HumanOptionEmote.as | 161 +- .../context/roleplay/HumanOptionFollowers.as | 152 +- .../game/context/roleplay/HumanOptionGuild.as | 120 +- .../context/roleplay/HumanOptionObjectUse.as | 183 +- .../context/roleplay/HumanOptionOrnament.as | 136 +- .../game/context/roleplay/HumanOptionTitle.as | 147 +- .../roleplay/MonsterInGroupInformations.as | 125 +- .../MonsterInGroupLightInformations.as | 142 +- .../context/roleplay/ObjectItemInRolePlay.as | 157 +- .../roleplay/job/DecraftedItemStackInfo.as | 157 + .../job/JobCrafterDirectoryEntryJobInfo.as | 222 +- .../job/JobCrafterDirectoryEntryPlayerInfo.as | 328 +- .../job/JobCrafterDirectoryListEntry.as | 128 +- .../job/JobCrafterDirectorySettings.as | 189 +- .../context/roleplay/job/JobDescription.as | 186 +- .../context/roleplay/job/JobExperience.as | 255 +- .../party/DungeonPartyFinderPlayer.as | 202 +- .../context/roleplay/party/NamedPartyTeam.as | 130 +- .../party/NamedPartyTeamWithOutcome.as | 136 +- .../roleplay/party/PartyGuestInformations.as | 276 +- .../PartyInvitationMemberInformations.as | 263 +- .../party/PartyMemberArenaInformations.as | 146 +- .../roleplay/party/PartyMemberGeoPosition.as | 234 +- .../roleplay/party/PartyMemberInformations.as | 460 +- .../PartyCompanionBaseInformations.as | 177 +- .../PartyCompanionMemberInformations.as | 265 +- .../quest/GameRolePlayNpcQuestFlag.as | 224 +- .../quest/QuestActiveDetailedInformations.as | 192 +- .../roleplay/quest/QuestActiveInformations.as | 131 +- .../quest/QuestObjectiveInformations.as | 185 +- ...uestObjectiveInformationsWithCompletion.as | 165 +- .../treasureHunt/PortalInformation.as | 142 +- .../roleplay/treasureHunt/TreasureHuntFlag.as | 130 +- .../roleplay/treasureHunt/TreasureHuntStep.as | 91 +- .../treasureHunt/TreasureHuntStepDig.as | 91 +- .../treasureHunt/TreasureHuntStepFight.as | 91 +- .../TreasureHuntStepFollowDirection.as | 153 +- .../TreasureHuntStepFollowDirectionToHint.as | 153 +- .../TreasureHuntStepFollowDirectionToPOI.as | 153 +- .../game/data/items/BidExchangerObjectInfo.as | 247 +- .../network/types/game/data/items/GoldItem.as | 135 +- .../network/types/game/data/items/Item.as | 91 +- .../types/game/data/items/ObjectItem.as | 272 +- .../data/items/ObjectItemGenericQuantity.as | 93 + .../ObjectItemInformationWithQuantity.as | 143 +- .../items/ObjectItemMinimalInformation.as | 190 +- .../data/items/ObjectItemNotInContainer.as | 248 +- .../game/data/items/ObjectItemQuantity.as | 160 +- .../types/game/data/items/ObjectItemToSell.as | 281 +- .../game/data/items/ObjectItemToSellInBid.as | 142 +- .../ObjectItemToSellInHumanVendorShop.as | 314 +- .../data/items/ObjectItemToSellInNpcShop.as | 153 +- .../game/data/items/SellerBuyerDescriptor.as | 346 +- .../types/game/data/items/SpellItem.as | 172 +- .../game/data/items/effects/ObjectEffect.as | 132 +- .../items/effects/ObjectEffectCreature.as | 140 +- .../data/items/effects/ObjectEffectDate.as | 264 +- .../data/items/effects/ObjectEffectDice.as | 198 +- .../items/effects/ObjectEffectDuration.as | 198 +- .../data/items/effects/ObjectEffectInteger.as | 140 +- .../data/items/effects/ObjectEffectLadder.as | 140 +- .../data/items/effects/ObjectEffectMinMax.as | 165 +- .../data/items/effects/ObjectEffectMount.as | 198 +- .../data/items/effects/ObjectEffectString.as | 116 +- .../ProtectedEntityWaitingForHelpInfo.as | 153 +- .../friend/AbstractContactInformations.as | 142 +- .../types/game/friend/FriendInformations.as | 168 +- .../game/friend/FriendOnlineInformations.as | 274 +- .../game/friend/FriendSpouseInformations.as | 267 +- .../friend/FriendSpouseOnlineInformations.as | 198 +- .../types/game/friend/IgnoredInformations.as | 103 +- .../game/friend/IgnoredOnlineInformations.as | 181 +- .../network/types/game/guild/GuildEmblem.as | 178 +- .../network/types/game/guild/GuildMember.as | 402 +- .../tax/AdditionalTaxCollectorInformations.as | 142 +- .../tax/TaxCollectorBasicInformations.as | 267 +- .../TaxCollectorComplementaryInformations.as | 91 +- .../tax/TaxCollectorFightersInformation.as | 215 +- .../tax/TaxCollectorGuildInformations.as | 121 +- .../guild/tax/TaxCollectorInformations.as | 373 +- .../guild/tax/TaxCollectorLootInformations.as | 226 +- .../TaxCollectorWaitingForHelpInformations.as | 121 +- .../game/house/AccountHouseInformations.as | 266 +- .../types/game/house/HouseInformations.as | 264 +- .../game/house/HouseInformationsExtended.as | 126 +- .../game/house/HouseInformationsForGuild.as | 357 +- .../game/house/HouseInformationsForSell.as | 357 +- .../game/house/HouseInformationsInside.as | 288 +- .../game/interactive/InteractiveElement.as | 241 +- .../InteractiveElementNamedSkill.as | 140 +- .../interactive/InteractiveElementSkill.as | 157 +- .../InteractiveElementWithAgeBonus.as | 141 +- .../types/game/interactive/MapObstacle.as | 150 +- .../types/game/interactive/StatedElement.as | 190 +- .../skill/SkillActionDescription.as | 131 +- .../skill/SkillActionDescriptionCollect.as | 165 +- .../skill/SkillActionDescriptionCraft.as | 165 +- .../skill/SkillActionDescriptionTimed.as | 140 +- .../types/game/inventory/preset/Preset.as | 216 +- .../types/game/inventory/preset/PresetItem.as | 178 +- .../network/types/game/look/EntityLook.as | 311 +- .../types/game/look/IndexedEntityLook.as | 149 +- .../network/types/game/look/SubEntity.as | 168 +- .../types/game/mount/ItemDurability.as | 119 +- .../types/game/mount/MountClientData.as | 1046 ++-- .../types/game/mount/UpdateMountBoost.as | 119 +- .../types/game/mount/UpdateMountIntBoost.as | 115 +- .../paddock/MountInformationsForPaddock.as | 153 +- .../paddock/PaddockAbandonnedInformations.as | 115 +- .../paddock/PaddockBuyableInformations.as | 150 +- .../paddock/PaddockContentInformations.as | 279 +- .../types/game/paddock/PaddockInformations.as | 156 +- .../paddock/PaddockInformationsForSell.as | 255 +- .../network/types/game/paddock/PaddockItem.as | 128 +- .../paddock/PaddockPrivateInformations.as | 125 +- .../prism/AllianceInsiderPrismInformation.as | 279 +- .../game/prism/AlliancePrismInformation.as | 125 +- .../game/prism/PrismFightersInformation.as | 244 +- .../prism/PrismGeolocalizedInformation.as | 201 +- .../types/game/prism/PrismInformation.as | 244 +- .../types/game/prism/PrismSubareaEmptyInfo.as | 156 +- .../network/types/game/shortcut/Shortcut.as | 131 +- .../types/game/shortcut/ShortcutEmote.as | 139 +- .../types/game/shortcut/ShortcutObject.as | 103 +- .../types/game/shortcut/ShortcutObjectItem.as | 126 +- .../game/shortcut/ShortcutObjectPreset.as | 139 +- .../types/game/shortcut/ShortcutSmiley.as | 139 +- .../types/game/shortcut/ShortcutSpell.as | 139 +- .../game/social/AbstractSocialGroupInfos.as | 91 +- .../social/AllianceFactSheetInformations.as | 144 +- .../social/AllianceVersatileInformations.as | 223 +- .../AlliancedGuildFactSheetInformations.as | 130 +- .../game/social/GuildFactSheetInformations.as | 202 +- .../GuildInAllianceVersatileInformations.as | 140 +- .../GuildInsiderFactSheetInformations.as | 222 +- .../game/social/GuildVersatileInformations.as | 223 +- .../game/startup/StartupActionAddObject.as | 223 +- .../network/types/secure/TrustCertificate.as | 143 +- .../network/types/updater/ContentPart.as | 131 +- .../dofus/network/types/version/Version.as | 277 +- .../network/types/version/VersionExtended.as | 145 +- .../types/web/krosmaster/KrosmasterFigure.as | 178 +- .../dofus/pools/PoolableSoundCommand.as | 41 + com/ankamagames/dofus/pools/PoolsManager.as | 44 + com/ankamagames/dofus/scripts/FxRunner.as | 115 +- com/ankamagames/dofus/scripts/ScriptEntity.as | 657 +-- com/ankamagames/dofus/scripts/ScriptsUtil.as | 75 +- .../dofus/scripts/SpellFxRunner.as | 96 +- .../dofus/scripts/SpellScriptManager.as | 181 +- .../dofus/scripts/api/CameraApi.as | 130 +- .../dofus/scripts/api/EntityApi.as | 341 +- com/ankamagames/dofus/scripts/api/FxApi.as | 281 +- .../dofus/scripts/api/ScriptSequenceApi.as | 128 +- .../dofus/scripts/api/SequenceApi.as | 316 +- .../dofus/scripts/api/SpellFxApi.as | 372 +- .../dofus/scripts/spells/SpellScript1.as | 97 +- .../dofus/scripts/spells/SpellScript2.as | 219 +- .../dofus/scripts/spells/SpellScript3.as | 163 +- .../dofus/scripts/spells/SpellScript5.as | 117 +- .../dofus/scripts/spells/SpellScript6.as | 316 +- .../dofus/scripts/spells/SpellScript7.as | 74 +- .../dofus/scripts/spells/SpellScript8.as | 89 +- .../dofus/scripts/spells/SpellScriptBase.as | 474 +- com/ankamagames/dofus/types/DofusOptions.as | 140 +- .../CharacteristicContextual.as | 70 +- .../CharacteristicContextualManager.as | 638 +- .../StyledTextContextual.as | 241 +- .../StyledTextContextual_STYLE_0_NUMBER_0.as | 23 +- .../StyledTextContextual_STYLE_0_NUMBER_1.as | 23 +- .../StyledTextContextual_STYLE_0_NUMBER_2.as | 23 +- .../StyledTextContextual_STYLE_0_NUMBER_3.as | 23 +- .../StyledTextContextual_STYLE_0_NUMBER_4.as | 23 +- .../StyledTextContextual_STYLE_0_NUMBER_5.as | 23 +- .../StyledTextContextual_STYLE_0_NUMBER_6.as | 23 +- .../StyledTextContextual_STYLE_0_NUMBER_7.as | 23 +- .../StyledTextContextual_STYLE_0_NUMBER_8.as | 23 +- .../StyledTextContextual_STYLE_0_NUMBER_9.as | 23 +- ...yledTextContextual_STYLE_0_NUMBER_MOINS.as | 23 +- ...tyledTextContextual_STYLE_0_NUMBER_PLUS.as | 23 +- .../StyledTextContextual_STYLE_1_NUMBER_0.as | 23 +- .../StyledTextContextual_STYLE_1_NUMBER_1.as | 23 +- .../StyledTextContextual_STYLE_1_NUMBER_2.as | 23 +- .../StyledTextContextual_STYLE_1_NUMBER_3.as | 23 +- .../StyledTextContextual_STYLE_1_NUMBER_4.as | 23 +- .../StyledTextContextual_STYLE_1_NUMBER_5.as | 23 +- .../StyledTextContextual_STYLE_1_NUMBER_6.as | 23 +- .../StyledTextContextual_STYLE_1_NUMBER_7.as | 23 +- .../StyledTextContextual_STYLE_1_NUMBER_8.as | 23 +- .../StyledTextContextual_STYLE_1_NUMBER_9.as | 23 +- ...yledTextContextual_STYLE_1_NUMBER_MOINS.as | 23 +- ...tyledTextContextual_STYLE_1_NUMBER_PLUS.as | 23 +- .../StyledTextContextual_STYLE_2_NUMBER_0.as | 23 +- .../StyledTextContextual_STYLE_2_NUMBER_1.as | 23 +- .../StyledTextContextual_STYLE_2_NUMBER_2.as | 23 +- .../StyledTextContextual_STYLE_2_NUMBER_3.as | 23 +- .../StyledTextContextual_STYLE_2_NUMBER_4.as | 23 +- .../StyledTextContextual_STYLE_2_NUMBER_5.as | 23 +- .../StyledTextContextual_STYLE_2_NUMBER_6.as | 23 +- .../StyledTextContextual_STYLE_2_NUMBER_7.as | 23 +- .../StyledTextContextual_STYLE_2_NUMBER_8.as | 23 +- .../StyledTextContextual_STYLE_2_NUMBER_9.as | 23 +- ...yledTextContextual_STYLE_2_NUMBER_MOINS.as | 23 +- ...tyledTextContextual_STYLE_2_NUMBER_PLUS.as | 23 +- .../StyledTextContextual_STYLE_3_NUMBER_0.as | 23 +- .../StyledTextContextual_STYLE_3_NUMBER_1.as | 23 +- .../StyledTextContextual_STYLE_3_NUMBER_2.as | 23 +- .../StyledTextContextual_STYLE_3_NUMBER_3.as | 23 +- .../StyledTextContextual_STYLE_3_NUMBER_4.as | 23 +- .../StyledTextContextual_STYLE_3_NUMBER_5.as | 23 +- .../StyledTextContextual_STYLE_3_NUMBER_6.as | 23 +- .../StyledTextContextual_STYLE_3_NUMBER_7.as | 23 +- .../StyledTextContextual_STYLE_3_NUMBER_8.as | 23 +- .../StyledTextContextual_STYLE_3_NUMBER_9.as | 23 +- ...yledTextContextual_STYLE_3_NUMBER_MOINS.as | 23 +- ...tyledTextContextual_STYLE_3_NUMBER_PLUS.as | 23 +- .../TextContextual.as | 119 +- .../dofus/types/data/AnimFunData.as | 25 +- com/ankamagames/dofus/types/data/Follower.as | 56 +- .../dofus/types/data/FpsLogWrapper.as | 22 +- .../dofus/types/data/GenericSlotData.as | 225 +- .../dofus/types/data/ItemTooltipInfo.as | 36 +- .../dofus/types/data/PlayerSetInfo.as | 78 +- .../dofus/types/data/ServerCommand.as | 190 +- .../dofus/types/data/SpellTooltipInfo.as | 36 +- .../entities/AnimStatiqueSubEntityBehavior.as | 125 +- .../dofus/types/entities/AnimatedCharacter.as | 1827 +++--- .../dofus/types/entities/BasicParticle.as | 131 +- .../types/entities/BenchmarkCharacter.as | 69 +- .../dofus/types/entities/BreedSkinModifier.as | 67 +- .../dofus/types/entities/CheckPointEntity.as | 169 +- .../dofus/types/entities/ExplosionEntity.as | 419 +- com/ankamagames/dofus/types/entities/Glyph.as | 175 +- .../dofus/types/entities/IParticule.as | 32 +- .../types/entities/ParticuleEmitterEntity.as | 215 +- .../dofus/types/entities/Projectile.as | 326 +- .../dofus/types/entities/RiderBehavior.as | 267 +- .../types/entities/RoleplayObjectEntity.as | 211 +- .../dofus/types/entities/TailEntity.as | 206 +- .../dofus/types/entities/TwirlParticle.as | 137 +- .../dofus/types/enums/AnimationEnum.as | 82 +- .../dofus/types/enums/DofusShopEnum.as | 64 +- .../dofus/types/enums/EntityIconEnum.as | 25 +- .../dofus/types/enums/LanguageEnum.as | 46 +- .../dofus/types/enums/NotificationTypeEnum.as | 40 +- .../dofus/types/enums/PortalAnimationEnum.as | 37 +- .../dofus/types/enums/StackActionEnum.as | 28 +- .../types/enums/TreasureHuntStepTypeEnum.as | 37 +- .../dofus/types/events/RpcEvent.as | 65 +- .../dofus/types/sequences/AddGfxEntityStep.as | 271 +- .../dofus/types/sequences/AddGfxInLineStep.as | 389 +- .../dofus/types/sequences/AddGlyphGfxStep.as | 106 +- com/ankamagames/dofus/uiApi/AlignmentApi.as | 452 +- .../dofus/uiApi/AveragePricesApi.as | 148 +- com/ankamagames/dofus/uiApi/BindsApi.as | 316 +- com/ankamagames/dofus/uiApi/CaptureApi.as | 206 +- com/ankamagames/dofus/uiApi/ChatApi.as | 624 +- com/ankamagames/dofus/uiApi/ColorApi.as | 87 +- com/ankamagames/dofus/uiApi/ConfigApi.as | 448 +- com/ankamagames/dofus/uiApi/ConnectionApi.as | 246 +- com/ankamagames/dofus/uiApi/ContextMenuApi.as | 84 +- com/ankamagames/dofus/uiApi/DataApi.as | 2352 ++++---- com/ankamagames/dofus/uiApi/DocumentApi.as | 91 +- com/ankamagames/dofus/uiApi/ExchangeApi.as | 127 +- .../dofus/uiApi/ExternalNotificationApi.as | 211 +- com/ankamagames/dofus/uiApi/FightApi.as | 640 +- com/ankamagames/dofus/uiApi/FileApi.as | 458 +- com/ankamagames/dofus/uiApi/HighlightApi.as | 203 +- com/ankamagames/dofus/uiApi/InventoryApi.as | 581 +- com/ankamagames/dofus/uiApi/JobsApi.as | 1676 +++--- com/ankamagames/dofus/uiApi/MapApi.as | 704 ++- com/ankamagames/dofus/uiApi/MountApi.as | 159 +- .../dofus/uiApi/NotificationApi.as | 150 +- com/ankamagames/dofus/uiApi/PartyApi.as | 332 +- .../dofus/uiApi/PlayedCharacterApi.as | 1083 ++-- com/ankamagames/dofus/uiApi/QuestApi.as | 461 +- com/ankamagames/dofus/uiApi/RoleplayApi.as | 364 +- com/ankamagames/dofus/uiApi/SecurityApi.as | 82 +- com/ankamagames/dofus/uiApi/SocialApi.as | 865 ++- com/ankamagames/dofus/uiApi/SoundApi.as | 820 ++- com/ankamagames/dofus/uiApi/StorageApi.as | 913 ++- com/ankamagames/dofus/uiApi/SystemApi.as | 2807 ++++----- com/ankamagames/dofus/uiApi/TestApi.as | 122 +- com/ankamagames/dofus/uiApi/TimeApi.as | 222 +- com/ankamagames/dofus/uiApi/TooltipApi.as | 687 ++- com/ankamagames/dofus/uiApi/UtilApi.as | 639 +- .../enum/CompassTypeEnum.as | 31 +- .../enum/WebLocationEnum.as | 36 +- .../jerakine/BalanceManager/BalanceManager.as | 379 +- .../BalanceManager/events/BalanceEvent.as | 40 +- .../BalanceManager/type/BalancedObject.as | 89 +- com/ankamagames/jerakine/JerakineConstants.as | 164 +- com/ankamagames/jerakine/cache/Cache.as | 582 +- com/ankamagames/jerakine/cache/ICachable.as | 29 +- .../jerakine/console/ConsoleHandler.as | 564 +- .../console/ConsoleInstructionHandler.as | 22 +- .../console/ConsoleInstructionMessage.as | 122 +- .../console/ConsoleInstructionRegistar.as | 16 +- .../jerakine/console/ConsoleOutputMessage.as | 72 +- .../jerakine/console/ConsolesManager.as | 100 +- .../UnhandledConsoleInstructionError.as | 22 +- .../jerakine/data/AbstractDataManager.as | 201 +- .../jerakine/data/CensoredContentManager.as | 115 +- .../jerakine/data/DataUpdateManager.as | 279 +- com/ankamagames/jerakine/data/GameData.as | 180 +- .../jerakine/data/GameDataClassDefinition.as | 95 +- .../jerakine/data/GameDataField.as | 260 +- .../jerakine/data/GameDataFileAccessor.as | 523 +- .../jerakine/data/GameDataProcess.as | 660 +-- .../jerakine/data/GameDataUpdater.as | 125 +- com/ankamagames/jerakine/data/I18n.as | 119 +- .../jerakine/data/I18nFileAccessor.as | 559 +- com/ankamagames/jerakine/data/I18nUpdater.as | 221 +- .../jerakine/data/ICensoredDataItem.as | 25 +- .../jerakine/data/IDataContainer.as | 31 +- com/ankamagames/jerakine/data/IPostInit.as | 16 +- com/ankamagames/jerakine/data/XmlConfig.as | 136 +- .../entities/behaviours/IDisplayBehavior.as | 28 +- .../entities/behaviours/IMovementBehavior.as | 38 +- .../jerakine/entities/interfaces/IAnimated.as | 28 +- .../entities/interfaces/IDisplayable.as | 37 +- .../jerakine/entities/interfaces/IEntity.as | 29 +- .../entities/interfaces/IInteractive.as | 28 +- .../jerakine/entities/interfaces/IMovable.as | 39 +- .../interfaces/ISubEntityContainer.as | 25 +- .../entities/messages/EntityClickMessage.as | 26 +- .../messages/EntityInteractionMessage.as | 44 +- .../messages/EntityMouseOutMessage.as | 53 +- .../messages/EntityMouseOverMessage.as | 32 +- .../jerakine/enum/AddGfxModeEnum.as | 29 +- .../enum/ColorGenerationMethodsEnum.as | 38 +- .../jerakine/enum/GameDataTypeEnum.as | 40 +- .../jerakine/enum/OperatingSystem.as | 28 +- com/ankamagames/jerakine/enum/OptionEnum.as | 31 +- .../jerakine/enum/WebBrowserEnum.as | 43 +- com/ankamagames/jerakine/eval/Evaluator.as | 867 ++- .../jerakine/handlers/FocusHandler.as | 155 +- .../jerakine/handlers/HumanInputHandler.as | 781 ++- .../jerakine/handlers/messages/Action.as | 16 +- .../handlers/messages/FocusChangeMessage.as | 43 +- .../handlers/messages/HumanInputMessage.as | 180 +- .../handlers/messages/InvalidCancelError.as | 22 +- .../keyboard/KeyboardKeyDownMessage.as | 43 +- .../messages/keyboard/KeyboardKeyUpMessage.as | 43 +- .../messages/keyboard/KeyboardMessage.as | 56 +- .../messages/mouse/MouseClickMessage.as | 43 +- .../messages/mouse/MouseDoubleClickMessage.as | 43 +- .../messages/mouse/MouseDownMessage.as | 43 +- .../handlers/messages/mouse/MouseMessage.as | 56 +- .../messages/mouse/MouseMiddleClickMessage.as | 43 +- .../messages/mouse/MouseOutMessage.as | 45 +- .../messages/mouse/MouseOverMessage.as | 43 +- .../mouse/MouseReleaseOutsideMessage.as | 43 +- .../messages/mouse/MouseRightClickMessage.as | 43 +- .../mouse/MouseRightClickOutsideMessage.as | 43 +- .../handlers/messages/mouse/MouseUpMessage.as | 43 +- .../messages/mouse/MouseWheelMessage.as | 43 +- .../interfaces/ICustomSecureObject.as | 12 +- .../interfaces/ICustomUnicNameGetter.as | 16 +- .../jerakine/interfaces/IDataCenter.as | 12 +- .../jerakine/interfaces/IDestroyable.as | 16 +- .../interfaces/IDragAndDropHandler.as | 31 +- .../jerakine/interfaces/IFLAEventHandler.as | 23 +- .../jerakine/interfaces/IInterfaceListener.as | 16 +- .../jerakine/interfaces/IModuleUtil.as | 12 +- .../jerakine/interfaces/INoBoxing.as | 12 +- .../jerakine/interfaces/IObstacle.as | 22 +- .../jerakine/interfaces/IRectangle.as | 47 +- .../jerakine/interfaces/IScriptsPlayer.as | 22 +- .../jerakine/interfaces/ISecurizable.as | 16 +- .../jerakine/interfaces/ISlotData.as | 50 +- .../jerakine/interfaces/ISlotDataHolder.as | 22 +- .../interfaces/ISoundPositionListener.as | 20 +- .../jerakine/interfaces/ITransparency.as | 16 +- com/ankamagames/jerakine/interfaces/Secure.as | 16 +- com/ankamagames/jerakine/json/JSON.as | 39 +- com/ankamagames/jerakine/json/JSONDecoder.as | 319 +- com/ankamagames/jerakine/json/JSONEncoder.as | 370 +- .../jerakine/json/JSONParseError.as | 56 +- com/ankamagames/jerakine/json/JSONToken.as | 73 +- .../jerakine/json/JSONTokenType.as | 58 +- .../jerakine/json/JSONTokenizer.as | 872 +-- .../jerakine/logger/InvalidFilterError.as | 22 +- com/ankamagames/jerakine/logger/Log.as | 428 +- com/ankamagames/jerakine/logger/LogEvent.as | 72 +- com/ankamagames/jerakine/logger/LogLevel.as | 82 +- com/ankamagames/jerakine/logger/LogLogger.as | 230 +- .../jerakine/logger/LogTargetFilter.as | 32 +- com/ankamagames/jerakine/logger/Logger.as | 43 +- .../jerakine/logger/ModuleLogger.as | 61 +- .../jerakine/logger/TextLogEvent.as | 37 +- .../jerakine/logger/targets/AbstractTarget.as | 228 +- .../logger/targets/CentralizeTarget.as | 131 +- .../targets/ConfigurableLoggingTarget.as | 16 +- .../jerakine/logger/targets/ConsoleTarget.as | 137 +- .../jerakine/logger/targets/FileTarget.as | 185 +- .../logger/targets/LimitedBufferTarget.as | 105 +- .../logger/targets/LoggerHistoryElement.as | 53 +- .../jerakine/logger/targets/LoggingTarget.as | 34 +- .../jerakine/logger/targets/SOSTarget.as | 256 +- .../logger/targets/TargetsPreparator.as | 34 +- .../logger/targets/TemporaryBufferTarget.as | 62 +- com/ankamagames/jerakine/lua/LuaPackage.as | 12 +- com/ankamagames/jerakine/lua/LuaPlayer.as | 332 +- .../jerakine/lua/LuaPlayerEvent.as | 40 +- .../jerakine/managers/ErrorManager.as | 207 +- .../jerakine/managers/FiltersManager.as | 149 +- .../jerakine/managers/FontManager.as | 333 +- .../jerakine/managers/LangManager.as | 1136 ++-- .../jerakine/managers/OptionManager.as | 340 +- .../jerakine/managers/PerformanceManager.as | 169 +- .../jerakine/managers/StoreDataManager.as | 765 +-- .../jerakine/map/IDataMapProvider.as | 46 +- com/ankamagames/jerakine/map/LosDetector.as | 221 +- .../jerakine/messages/CancelableMessage.as | 16 +- .../jerakine/messages/ConnectedMessage.as | 18 +- .../messages/ConnectionResumedMessage.as | 18 +- .../jerakine/messages/DiscardableMessage.as | 12 +- com/ankamagames/jerakine/messages/Frame.as | 23 +- .../jerakine/messages/IDontLogThisMessage.as | 12 +- .../jerakine/messages/ILogableMessage.as | 12 +- .../jerakine/messages/IMessageDispatcher.as | 16 +- .../jerakine/messages/IdentifiedMessage.as | 16 +- .../messages/LangAllFilesLoadedMessage.as | 53 +- .../messages/LangFileLoadedMessage.as | 68 +- com/ankamagames/jerakine/messages/Message.as | 12 +- .../jerakine/messages/MessageDispatcher.as | 29 +- .../jerakine/messages/MessageHandler.as | 16 +- .../jerakine/messages/QueueableMessage.as | 12 +- .../jerakine/messages/RegisteringFrame.as | 140 +- com/ankamagames/jerakine/messages/Worker.as | 757 +-- .../messages/events/FramePulledEvent.as | 49 +- .../messages/events/FramePushedEvent.as | 49 +- .../jerakine/network/CustomDataWrapper.as | 926 ++- .../jerakine/network/HttpServerConnection.as | 401 +- .../jerakine/network/IConnectionProxy.as | 25 +- .../jerakine/network/ICustomDataInput.as | 35 +- .../jerakine/network/ICustomDataOutput.as | 26 +- .../jerakine/network/ILagometer.as | 22 +- .../jerakine/network/IMessageRouter.as | 16 +- .../network/INetworkDataContainerMessage.as | 23 +- .../jerakine/network/INetworkMessage.as | 28 +- .../jerakine/network/INetworkType.as | 12 +- .../jerakine/network/IServerConnection.as | 65 +- .../jerakine/network/MultiConnection.as | 580 +- .../jerakine/network/NetworkError.as | 22 +- .../jerakine/network/NetworkLogEvent.as | 70 +- .../jerakine/network/NetworkMessage.as | 236 +- .../jerakine/network/NetworkSentEvent.as | 47 +- .../network/ProxyedServerConnection.as | 81 +- .../jerakine/network/RawDataParser.as | 16 +- .../jerakine/network/ServerConnection.as | 1377 ++--- .../network/SnifferServerConnection.as | 130 +- .../messages/ExpectedSocketClosureMessage.as | 33 +- .../messages/ServerConnectionClosedMessage.as | 44 +- .../messages/ServerConnectionFailedMessage.as | 59 +- .../UnexpectedSocketClosureMessage.as | 22 +- .../WrongSocketClosureReasonMessage.as | 57 +- .../network/utils/BooleanByteWrapper.as | 249 +- .../jerakine/network/utils/types/Binary64.as | 112 +- .../jerakine/network/utils/types/Int64.as | 277 +- .../jerakine/network/utils/types/UInt64.as | 224 +- com/ankamagames/jerakine/newCache/ICache.as | 31 +- .../newCache/ICacheGarbageCollector.as | 22 +- .../newCache/garbage/LruGarbageCollector.as | 201 +- .../jerakine/newCache/impl/Cache.as | 150 +- .../newCache/impl/DisplayObjectCache.as | 306 +- .../jerakine/newCache/impl/InfiniteCache.as | 111 +- .../jerakine/pathfinding/CellInfo.as | 45 +- .../jerakine/pathfinding/Pathfinding.as | 1085 ++-- com/ankamagames/jerakine/pools/GenericPool.as | 67 +- com/ankamagames/jerakine/pools/Pool.as | 162 +- com/ankamagames/jerakine/pools/Poolable.as | 16 +- .../jerakine/pools/PoolableLoader.as | 43 +- .../jerakine/pools/PoolablePoint.as | 49 +- .../jerakine/pools/PoolableRectangle.as | 71 +- .../jerakine/pools/PoolableSound.as | 41 +- .../jerakine/pools/PoolableURLLoader.as | 63 +- .../jerakine/pools/PoolsManager.as | 178 +- .../jerakine/protocolAudio/ProtocolEnum.as | 131 +- .../jerakine/replay/KeyboardInput.as | 32 +- .../jerakine/replay/KeyboardShortcut.as | 27 +- .../jerakine/replay/LogClassField.as | 37 +- com/ankamagames/jerakine/replay/LogFrame.as | 877 +-- .../jerakine/replay/LogTypeEnum.as | 68 +- .../jerakine/replay/MouseInteraction.as | 53 +- .../jerakine/resources/CacheableResource.as | 32 +- .../jerakine/resources/IResourceObserver.as | 26 +- .../jerakine/resources/ResourceError.as | 22 +- .../jerakine/resources/ResourceErrorCode.as | 73 +- .../resources/ResourceObserverWrapper.as | 90 +- .../jerakine/resources/ResourceType.as | 109 +- .../adapters/AbstractLoaderAdapter.as | 308 +- .../adapters/AbstractUrlLoaderAdapter.as | 397 +- .../resources/adapters/AdapterFactory.as | 193 +- .../jerakine/resources/adapters/IAdapter.as | 32 +- .../resources/adapters/SimpleLoaderAdapter.as | 277 +- .../impl/AdvancedSignedFileAdapter.as | 39 +- .../adapters/impl/AdvancedSwfAdapter.as | 67 +- .../resources/adapters/impl/BinaryAdapter.as | 59 +- .../resources/adapters/impl/BitmapAdapter.as | 89 +- .../resources/adapters/impl/DxAdapter.as | 260 +- .../resources/adapters/impl/MP3Adapter.as | 261 +- .../adapters/impl/SignedFileAdapter.as | 289 +- .../resources/adapters/impl/SwfAdapter.as | 49 +- .../resources/adapters/impl/SwlAdapter.as | 275 +- .../resources/adapters/impl/TxtAdapter.as | 57 +- .../resources/adapters/impl/XmlAdapter.as | 73 +- .../resources/adapters/impl/ZipAdapter.as | 63 +- .../resources/events/ResourceErrorEvent.as | 61 +- .../resources/events/ResourceEvent.as | 37 +- .../resources/events/ResourceLoadedEvent.as | 61 +- .../events/ResourceLoaderProgressEvent.as | 64 +- .../resources/events/ResourceProgressEvent.as | 61 +- .../loaders/AbstractRessourceLoader.as | 350 +- .../resources/loaders/IResourceLoader.as | 30 +- .../loaders/ResourceLoaderFactory.as | 56 +- .../resources/loaders/ResourceLoaderType.as | 28 +- .../loaders/impl/ParallelRessourceLoader.as | 303 +- .../loaders/impl/SingleRessourceLoader.as | 140 +- .../protocols/AbstractFileProtocol.as | 188 +- .../resources/protocols/AbstractProtocol.as | 133 +- .../jerakine/resources/protocols/IProtocol.as | 29 +- .../resources/protocols/ProtocolFactory.as | 151 +- .../protocols/impl/FileFlashProtocol.as | 456 +- .../resources/protocols/impl/FileProtocol.as | 296 +- .../protocols/impl/HttpCacheProtocol.as | 968 +-- .../resources/protocols/impl/HttpProtocol.as | 67 +- .../resources/protocols/impl/PakProtocol.as | 236 +- .../resources/protocols/impl/PakProtocol2.as | 347 +- .../protocols/impl/UpdaterProtocol.as | 51 +- .../resources/protocols/impl/ZipProtocol.as | 291 +- .../jerakine/scrambling/Scramblable.as | 23 +- .../jerakine/scrambling/ScramblableElement.as | 39 +- .../jerakine/script/BinaryScript.as | 49 +- .../jerakine/script/ScriptErrorEnum.as | 26 +- com/ankamagames/jerakine/script/ScriptExec.as | 325 +- .../jerakine/script/ScriptsManager.as | 146 +- .../jerakine/script/api/EffectsApi.as | 109 +- .../jerakine/script/api/LoggingApi.as | 43 +- .../jerakine/script/api/MathApi.as | 183 +- .../jerakine/script/api/RootApi.as | 129 +- .../jerakine/script/api/StringApi.as | 89 +- .../jerakine/script/api/TimeApi.as | 95 +- .../jerakine/script/api/VectorApi.as | 18 +- .../jerakine/script/runners/IRunner.as | 16 +- .../jerakine/sequencer/AbstractSequencable.as | 328 +- .../jerakine/sequencer/CallbackStep.as | 44 +- .../jerakine/sequencer/DebugStep.as | 77 +- .../sequencer/IPausableSequencable.as | 19 +- .../jerakine/sequencer/ISequencable.as | 46 +- .../sequencer/ISequencableListener.as | 16 +- .../jerakine/sequencer/ISequencer.as | 44 +- .../sequencer/ISubSequenceSequencable.as | 16 +- .../sequencer/ParallelStartSequenceStep.as | 137 +- .../jerakine/sequencer/SerialSequencer.as | 490 +- .../jerakine/sequencer/StartSequenceStep.as | 46 +- .../jerakine/sound/AbstractFlashSound.as | 136 +- .../jerakine/sound/FlashSoundSender.as | 139 +- .../jerakine/task/LangXmlParsingTask.as | 203 +- .../jerakine/tasking/SplittedTask.as | 81 +- .../jerakine/tasking/TaskingManager.as | 163 +- com/ankamagames/jerakine/types/ASwf.as | 89 +- com/ankamagames/jerakine/types/Callback.as | 58 +- com/ankamagames/jerakine/types/Color.as | 254 +- .../jerakine/types/ColorMultiplicator.as | 148 +- .../jerakine/types/CustomSharedObject.as | 354 +- .../jerakine/types/DataStoreType.as | 190 +- .../jerakine/types/DefaultableColor.as | 59 +- .../jerakine/types/DynamicSecureObject.as | 35 +- com/ankamagames/jerakine/types/LangFile.as | 42 +- .../jerakine/types/LangMetaData.as | 156 +- com/ankamagames/jerakine/types/Point3D.as | 37 +- .../jerakine/types/SoundEventParamWrapper.as | 62 +- com/ankamagames/jerakine/types/Swl.as | 82 +- com/ankamagames/jerakine/types/Uri.as | 617 +- com/ankamagames/jerakine/types/Version.as | 266 +- .../jerakine/types/enums/DataStoreEnum.as | 34 +- .../jerakine/types/enums/DirectionsEnum.as | 43 +- .../jerakine/types/enums/InteractionsEnum.as | 104 +- .../jerakine/types/enums/Priority.as | 133 +- .../types/events/ErrorReportedEvent.as | 97 +- .../jerakine/types/events/FileEvent.as | 62 +- .../jerakine/types/events/LangFileEvent.as | 75 +- .../types/events/PropertyChangeEvent.as | 92 +- .../types/events/RegisterClassLogEvent.as | 55 +- .../jerakine/types/events/SequencerEvent.as | 75 +- .../jerakine/types/positions/MapPoint.as | 742 +-- .../jerakine/types/positions/MovementPath.as | 434 +- .../jerakine/types/positions/PathElement.as | 107 +- .../jerakine/types/positions/WorldPoint.as | 256 +- com/ankamagames/jerakine/types/zones/Cone.as | 348 +- com/ankamagames/jerakine/types/zones/Cross.as | 368 +- .../jerakine/types/zones/Custom.as | 115 +- .../jerakine/types/zones/HalfLozenge.as | 227 +- com/ankamagames/jerakine/types/zones/IZone.as | 39 +- com/ankamagames/jerakine/types/zones/Line.as | 279 +- .../jerakine/types/zones/Lozenge.as | 220 +- .../jerakine/types/zones/Square.as | 37 +- .../jerakine/types/zones/ZRectangle.as | 232 +- .../utils/benchmark/monitoring/FpsManager.as | 456 +- .../benchmark/monitoring/FpsManagerConst.as | 61 +- .../benchmark/monitoring/FpsManagerEvent.as | 30 +- .../benchmark/monitoring/FpsManagerUtils.as | 216 +- .../utils/benchmark/monitoring/List.as | 32 +- .../benchmark/monitoring/MonitoredObject.as | 104 +- .../benchmark/monitoring/ui/ExtensionPanel.as | 179 +- .../utils/benchmark/monitoring/ui/Graph.as | 300 +- .../benchmark/monitoring/ui/GraphDisplayer.as | 487 +- .../monitoring/ui/LeakDetectionPanel.as | 299 +- .../benchmark/monitoring/ui/MemoryPanel.as | 445 +- .../monitoring/ui/RedrawRegionButton.as | 45 +- .../benchmark/monitoring/ui/StateButton.as | 115 +- .../jerakine/utils/crypto/AdvancedMd5.as | 778 +-- .../jerakine/utils/crypto/Base64.as | 71 +- .../jerakine/utils/crypto/CRC32.as | 118 +- com/ankamagames/jerakine/utils/crypto/RSA.as | 43 +- .../jerakine/utils/crypto/Signature.as | 596 +- .../jerakine/utils/crypto/SignatureKey.as | 86 +- .../utils/display/AngleToOrientation.as | 64 +- .../jerakine/utils/display/ColorUtils.as | 153 +- .../jerakine/utils/display/Dofus1Line.as | 533 +- .../jerakine/utils/display/Dofus2Line.as | 38 +- .../utils/display/EnterFrameDispatcher.as | 256 +- .../jerakine/utils/display/FpsControler.as | 351 +- .../jerakine/utils/display/FrameIdManager.as | 70 +- .../utils/display/FramerateCounter.as | 198 +- .../utils/display/IFramerateListener.as | 16 +- .../jerakine/utils/display/KeyPoll.as | 159 +- .../jerakine/utils/display/MovieClipUtils.as | 221 +- .../jerakine/utils/display/Rectangle2.as | 159 +- .../utils/display/StageShareManager.as | 510 +- .../display/spellZone/ICellZoneProvider.as | 27 +- .../utils/display/spellZone/IZoneShape.as | 25 +- .../utils/display/spellZone/SpellShapeEnum.as | 92 +- .../utils/display/spellZone/SpellZoneCell.as | 226 +- .../display/spellZone/SpellZoneCellManager.as | 807 +-- .../display/spellZone/SpellZoneConstant.as | 22 +- .../utils/display/spellZone/SpellZoneEvent.as | 37 +- .../utils/display/spellZone/ZoneEffect.as | 73 +- .../utils/errors/AbstractMethodCallError.as | 22 +- .../CustomSharedObjectFileFormatError.as | 22 +- .../jerakine/utils/errors/FileTypeError.as | 22 +- .../jerakine/utils/errors/JerakineError.as | 22 +- .../jerakine/utils/errors/SignatureError.as | 29 +- .../jerakine/utils/errors/SingletonError.as | 22 +- .../jerakine/utils/files/FileUtils.as | 127 +- .../jerakine/utils/files/ZipLoader.as | 336 +- .../jerakine/utils/memory/Memory.as | 90 +- .../jerakine/utils/memory/SoftReference.as | 84 +- .../utils/memory/WeakProxyReference.as | 134 +- .../jerakine/utils/memory/WeakReference.as | 64 +- .../misc/ApplicationDomainShareManager.as | 47 +- .../jerakine/utils/misc/CallWithParameters.as | 301 +- .../jerakine/utils/misc/CheckCompatibility.as | 208 +- com/ankamagames/jerakine/utils/misc/Chrono.as | 104 +- .../jerakine/utils/misc/CopyObject.as | 71 +- .../jerakine/utils/misc/DescribeTypeCache.as | 357 +- .../jerakine/utils/misc/FightProfiler.as | 75 +- .../jerakine/utils/misc/Levenshtein.as | 151 +- .../jerakine/utils/misc/LogUploadManager.as | 309 +- .../jerakine/utils/misc/Prioritizable.as | 16 +- .../jerakine/utils/misc/PriorityComparer.as | 45 +- .../jerakine/utils/misc/StringUtils.as | 864 ++- .../utils/parser/FLAEventLabelParser.as | 278 +- .../jerakine/utils/pattern/PatternDecoder.as | 480 +- com/ankamagames/jerakine/utils/prng/PRNG.as | 28 +- .../jerakine/utils/prng/ParkMillerCarta.as | 96 +- .../jerakine/utils/system/AirScanner.as | 155 +- .../utils/system/CommandLineArguments.as | 128 +- .../jerakine/utils/system/SystemManager.as | 320 +- .../jerakine/utils/system/SystemPopupUI.as | 537 +- com/ankamagames/performance/Benchmark.as | 274 +- .../performance/DisplayObjectDummy.as | 78 +- com/ankamagames/performance/IBenchmarkTest.as | 22 +- .../performance/tests/TestBandwidth.as | 295 +- .../tests/TestDisplayPerformance.as | 342 +- .../performance/tests/TestReadDisk.as | 127 +- .../performance/tests/TestWriteDisk.as | 153 +- .../sweevo/runners/EmitterRunner.as | 108 +- com/ankamagames/tiphon/TiphonConstants.as | 25 +- .../tiphon/display/RasterizedAnimation.as | 335 +- .../tiphon/display/RasterizedFrame.as | 123 +- .../tiphon/display/RasterizedFrameList.as | 46 +- .../tiphon/display/RasterizedSyncAnimation.as | 129 +- .../tiphon/display/TiphonAnimation.as | 28 +- .../tiphon/display/TiphonSprite.as | 3663 ++++++------ .../tiphon/engine/BoneIndexManager.as | 400 +- .../tiphon/engine/LibrariesManager.as | 640 +- .../engine/SubstituteAnimationManager.as | 79 +- com/ankamagames/tiphon/engine/Tiphon.as | 288 +- .../tiphon/engine/TiphonCacheManager.as | 346 +- .../tiphon/engine/TiphonDebugManager.as | 158 +- .../tiphon/engine/TiphonEventsManager.as | 608 +- .../tiphon/engine/TiphonFpsManager.as | 262 +- .../tiphon/engine/TiphonLibraries.as | 25 +- .../tiphon/engine/TiphonMultiBonesManager.as | 172 +- com/ankamagames/tiphon/error/TiphonError.as | 22 +- .../tiphon/events/AnimationEvent.as | 60 +- com/ankamagames/tiphon/events/SwlEvent.as | 57 +- com/ankamagames/tiphon/events/TiphonEvent.as | 220 +- .../tiphon/sequence/PlayAnimationStep.as | 405 +- .../tiphon/sequence/SetAnimationStep.as | 81 +- .../tiphon/sequence/SetDirectionStep.as | 75 +- .../tiphon/sequence/WaitAnimationEventStep.as | 128 +- .../tiphon/types/AdvancedColoredSprite.as | 49 +- com/ankamagames/tiphon/types/AnimLibrary.as | 57 +- .../tiphon/types/AnimationModifierPriority.as | 28 +- com/ankamagames/tiphon/types/BehaviorData.as | 121 +- com/ankamagames/tiphon/types/CarriedSprite.as | 45 +- com/ankamagames/tiphon/types/ColoredSprite.as | 84 +- .../tiphon/types/DisplayInfoSprite.as | 37 +- com/ankamagames/tiphon/types/DynamicSprite.as | 96 +- .../tiphon/types/EquipmentSprite.as | 121 +- com/ankamagames/tiphon/types/EventListener.as | 36 +- .../tiphon/types/GraphicLibrary.as | 220 +- .../tiphon/types/IAnimationModifier.as | 23 +- .../tiphon/types/IAnimationSpriteHandler.as | 50 +- com/ankamagames/tiphon/types/ISkinModifier.as | 20 +- .../types/ISkinPartTransformProvider.as | 16 +- .../tiphon/types/ISubEntityBehavior.as | 23 +- .../tiphon/types/ISubEntityHandler.as | 22 +- com/ankamagames/tiphon/types/ITiphonEvent.as | 25 +- .../tiphon/types/ScriptedAnimation.as | 256 +- com/ankamagames/tiphon/types/Skin.as | 575 +- .../tiphon/types/SubEntityTempInfo.as | 41 +- .../tiphon/types/TiphonEventInfo.as | 197 +- com/ankamagames/tiphon/types/TiphonOptions.as | 34 +- com/ankamagames/tiphon/types/TiphonUtility.as | 175 +- com/ankamagames/tiphon/types/TransformData.as | 40 +- .../tiphon/types/cache/AnimCache.as | 159 +- .../tiphon/types/cache/SpriteCacheInfo.as | 38 +- .../tiphon/types/look/EntityLookObserver.as | 28 +- .../tiphon/types/look/EntityLookParser.as | 526 +- .../tiphon/types/look/TiphonEntityLook.as | 1819 +++--- com/ankamagames/tubul/BusConstants.as | 25 +- com/ankamagames/tubul/Tubul.as | 913 +-- com/ankamagames/tubul/XMLSounds.as | 37 +- com/ankamagames/tubul/enum/EnumSoundType.as | 25 +- com/ankamagames/tubul/enum/EnumTypeBus.as | 25 +- .../tubul/enum/EventListenerPriority.as | 34 +- com/ankamagames/tubul/events/AudioBusEvent.as | 54 +- .../tubul/events/AudioBusVolumeEvent.as | 49 +- com/ankamagames/tubul/events/FadeEvent.as | 51 +- .../events/LoadingSound/LoadingSoundEvent.as | 55 +- com/ankamagames/tubul/events/LoopEvent.as | 57 +- com/ankamagames/tubul/events/MP3SoundEvent.as | 51 +- com/ankamagames/tubul/events/PlaylistEvent.as | 54 +- .../tubul/events/SoundCompleteEvent.as | 51 +- .../tubul/events/SoundSilenceEvent.as | 46 +- .../tubul/events/SoundWrapperEvent.as | 43 +- com/ankamagames/tubul/events/TubulEvent.as | 49 +- .../tubul/factory/AudioBusFactory.as | 54 +- com/ankamagames/tubul/factory/SoundFactory.as | 126 +- com/ankamagames/tubul/interfaces/IAudioBus.as | 54 +- com/ankamagames/tubul/interfaces/IEffect.as | 22 +- .../tubul/interfaces/IEventDispatcher.as | 20 +- .../tubul/interfaces/ILocalizedSound.as | 47 +- .../interfaces/ILocalizedSoundListener.as | 29 +- com/ankamagames/tubul/interfaces/ISound.as | 91 +- .../tubul/interfaces/ISoundController.as | 45 +- .../tubul/interfaces/IUnlocalizedSound.as | 12 +- .../tubul/resources/TubulResourceType.as | 25 +- .../tubul/resources/adapters/MP3Adapter.as | 202 +- .../tubul/types/LoadedSoundInformations.as | 25 +- com/ankamagames/tubul/types/MP3Information.as | 40 +- com/ankamagames/tubul/types/PlayList.as | 687 +-- com/ankamagames/tubul/types/RollOffPreset.as | 68 +- com/ankamagames/tubul/types/SoundMerger.as | 646 +- com/ankamagames/tubul/types/SoundSilence.as | 194 +- com/ankamagames/tubul/types/SoundWrapper.as | 528 +- com/ankamagames/tubul/types/TubulOptions.as | 48 +- .../tubul/types/VolumeFadeEffect.as | 280 +- com/ankamagames/tubul/types/bus/AudioBus.as | 937 +-- .../tubul/types/bus/LocalizedBus.as | 53 +- .../tubul/types/bus/UnlocalizedBus.as | 22 +- .../tubul/types/effects/LowPassFilter.as | 249 +- .../tubul/types/sounds/LocalizedSound.as | 336 +- .../tubul/types/sounds/MP3SoundDofus.as | 1250 ++-- .../tubul/types/sounds/UnlocalizedSound.as | 28 +- .../tubul/utils/error/TubulError.as | 22 +- com/hurlant/crypto/Crypto.as | 460 +- com/hurlant/crypto/hash/HMAC.as | 153 +- com/hurlant/crypto/hash/IHMAC.as | 29 +- com/hurlant/crypto/hash/IHash.as | 32 +- com/hurlant/crypto/hash/MAC.as | 206 +- com/hurlant/crypto/hash/MD2.as | 187 +- com/hurlant/crypto/hash/MD5.as | 411 +- com/hurlant/crypto/hash/SHA1.as | 203 +- com/hurlant/crypto/hash/SHA224.as | 44 +- com/hurlant/crypto/hash/SHA256.as | 211 +- com/hurlant/crypto/hash/SHABase.as | 143 +- com/hurlant/crypto/prng/ARC4.as | 221 +- com/hurlant/crypto/prng/IPRNG.as | 32 +- com/hurlant/crypto/prng/Random.as | 255 +- com/hurlant/crypto/rsa/RSAKey.as | 669 +-- com/hurlant/crypto/symmetric/AESKey.as | 642 +- com/hurlant/crypto/symmetric/BlowFishKey.as | 435 +- com/hurlant/crypto/symmetric/CBCMode.as | 123 +- com/hurlant/crypto/symmetric/CFB8Mode.as | 129 +- com/hurlant/crypto/symmetric/CFBMode.as | 131 +- com/hurlant/crypto/symmetric/CTRMode.as | 130 +- com/hurlant/crypto/symmetric/DESKey.as | 517 +- com/hurlant/crypto/symmetric/ECBMode.as | 179 +- com/hurlant/crypto/symmetric/ICipher.as | 32 +- com/hurlant/crypto/symmetric/IMode.as | 12 +- com/hurlant/crypto/symmetric/IPad.as | 26 +- com/hurlant/crypto/symmetric/IStreamCipher.as | 12 +- com/hurlant/crypto/symmetric/ISymmetricKey.as | 32 +- com/hurlant/crypto/symmetric/IVMode.as | 222 +- com/hurlant/crypto/symmetric/NullPad.as | 47 +- com/hurlant/crypto/symmetric/OFBMode.as | 109 +- com/hurlant/crypto/symmetric/PKCS5.as | 114 +- com/hurlant/crypto/symmetric/SimpleIVMode.as | 119 +- com/hurlant/crypto/symmetric/TripleDESKey.as | 188 +- com/hurlant/crypto/symmetric/XTeaKey.as | 198 +- com/hurlant/crypto/tls/TLSError.as | 89 +- com/hurlant/math/BarrettReduction.as | 162 +- com/hurlant/math/BigInteger.as | 3525 ++++++----- com/hurlant/math/ClassicReduction.as | 95 +- com/hurlant/math/IReduction.as | 30 +- com/hurlant/math/MontgomeryReduction.as | 185 +- com/hurlant/math/NullReduction.as | 71 +- com/hurlant/math/bi_internal.as | 7 +- com/hurlant/util/Base64.as | 275 +- com/hurlant/util/Hex.as | 119 +- com/hurlant/util/Memory.as | 59 +- com/hurlant/util/der/ByteString.as | 79 +- com/hurlant/util/der/DER.as | 441 +- com/hurlant/util/der/IAsn1Type.as | 26 +- com/hurlant/util/der/Integer.as | 80 +- com/hurlant/util/der/OID.as | 76 +- com/hurlant/util/der/ObjectIdentifier.as | 280 +- com/hurlant/util/der/PEM.as | 180 +- com/hurlant/util/der/PrintableString.as | 100 +- com/hurlant/util/der/Sequence.as | 217 +- com/hurlant/util/der/Set.as | 43 +- com/hurlant/util/der/UTCTime.as | 116 +- com/somerandomdude/colortoolkit/Color.as | 865 +-- com/somerandomdude/colortoolkit/ColorUtil.as | 321 +- com/somerandomdude/colortoolkit/CoreColor.as | 153 +- .../colortoolkit/schemes/Analogous.as | 146 +- .../colortoolkit/schemes/ColorList.as | 269 +- .../colortoolkit/schemes/ColorScheme.as | 60 +- .../colortoolkit/schemes/ColorWheelScheme.as | 116 +- .../colortoolkit/schemes/Complementary.as | 111 +- .../colortoolkit/schemes/Compound.as | 89 +- .../colortoolkit/schemes/FlippedCompound.as | 91 +- .../colortoolkit/schemes/IColorScheme.as | 12 +- .../colortoolkit/schemes/Monochrome.as | 75 +- .../schemes/SplitComplementary.as | 53 +- .../colortoolkit/schemes/Tetrad.as | 144 +- .../colortoolkit/schemes/Triad.as | 83 +- .../colortoolkit/spaces/CMYK.as | 283 +- .../colortoolkit/spaces/Gray.as | 119 +- com/somerandomdude/colortoolkit/spaces/HSB.as | 387 +- com/somerandomdude/colortoolkit/spaces/HSL.as | 339 +- .../colortoolkit/spaces/IColorSpace.as | 37 +- com/somerandomdude/colortoolkit/spaces/Lab.as | 294 +- com/somerandomdude/colortoolkit/spaces/RGB.as | 182 +- com/somerandomdude/colortoolkit/spaces/XYZ.as | 294 +- com/somerandomdude/colortoolkit/spaces/YUV.as | 216 +- d2hooks/UpdateError.as | 18 +- d2network/AbstractContactInformations.as | 39 +- d2network/IgnoredInformations.as | 18 +- d2network/IgnoredOnlineInformations.as | 59 +- 3512 files changed, 363881 insertions(+), 346528 deletions(-) create mode 100644 com/ankamagames/dofus/datacenter/characteristics/Characteristic.as create mode 100644 com/ankamagames/dofus/datacenter/characteristics/CharacteristicCategory.as create mode 100644 com/ankamagames/dofus/logic/common/actions/BrowserDomainReadyAction.as create mode 100644 com/ankamagames/dofus/logic/common/frames/ServerControlFrame_PUBLIC_KEY_V1.as create mode 100644 com/ankamagames/dofus/logic/common/frames/ServerControlFrame_PUBLIC_KEY_V2.as create mode 100644 com/ankamagames/dofus/logic/common/managers/HyperlinkSwapPositionRequest.as create mode 100644 com/ankamagames/dofus/logic/common/managers/HyperlinkTaxCollectorCollected.as create mode 100644 com/ankamagames/dofus/logic/game/fight/actions/GameFightPlacementSwapPositionsAcceptAction.as create mode 100644 com/ankamagames/dofus/logic/game/fight/actions/GameFightPlacementSwapPositionsCancelAction.as create mode 100644 com/ankamagames/dofus/logic/game/fight/actions/GameFightPlacementSwapPositionsRequestAction.as create mode 100644 com/ankamagames/dofus/logic/game/fight/types/SwapPositionRequest.as create mode 100644 com/ankamagames/dofus/misc/interClient/InterClientKeyManager.as create mode 100644 com/ankamagames/dofus/network/messages/game/approach/ReloginTokenRequestMessage.as create mode 100644 com/ankamagames/dofus/network/messages/game/context/display/DisplayNumericalValuePaddockMessage.as create mode 100644 com/ankamagames/dofus/network/messages/game/context/fight/GameFightPlacementSwapPositionsAcceptMessage.as create mode 100644 com/ankamagames/dofus/network/messages/game/context/fight/GameFightPlacementSwapPositionsCancelMessage.as create mode 100644 com/ankamagames/dofus/network/messages/game/context/fight/GameFightPlacementSwapPositionsRequestMessage.as create mode 100644 com/ankamagames/dofus/network/messages/game/guild/tax/AbstractTaxCollectorListMessage.as create mode 100644 com/ankamagames/dofus/network/messages/game/guild/tax/TopTaxCollectorListMessage.as create mode 100644 com/ankamagames/dofus/network/messages/game/inventory/exchanges/DecraftResultMessage.as create mode 100644 com/ankamagames/dofus/network/messages/game/inventory/exchanges/ExchangeHandleMountsStableMessage.as create mode 100644 com/ankamagames/dofus/network/messages/game/inventory/exchanges/ExchangeMountsPaddockAddMessage.as create mode 100644 com/ankamagames/dofus/network/messages/game/inventory/exchanges/ExchangeMountsPaddockRemoveMessage.as create mode 100644 com/ankamagames/dofus/network/messages/game/inventory/exchanges/ExchangeMountsStableAddMessage.as create mode 100644 com/ankamagames/dofus/network/messages/game/inventory/exchanges/ExchangeMountsStableBornAddMessage.as create mode 100644 com/ankamagames/dofus/network/messages/game/inventory/exchanges/ExchangeMountsStableRemoveMessage.as create mode 100644 com/ankamagames/dofus/network/messages/game/inventory/exchanges/ExchangeMountsTakenFromPaddockMessage.as create mode 100644 com/ankamagames/dofus/network/messages/game/inventory/exchanges/ExchangeStartOkRunesTradeMessage.as create mode 100644 com/ankamagames/dofus/network/types/common/basic/StatisticData.as create mode 100644 com/ankamagames/dofus/network/types/common/basic/StatisticDataBoolean.as create mode 100644 com/ankamagames/dofus/network/types/common/basic/StatisticDataByte.as create mode 100644 com/ankamagames/dofus/network/types/common/basic/StatisticDataInt.as create mode 100644 com/ankamagames/dofus/network/types/common/basic/StatisticDataShort.as create mode 100644 com/ankamagames/dofus/network/types/common/basic/StatisticDataString.as create mode 100644 com/ankamagames/dofus/network/types/game/context/roleplay/job/DecraftedItemStackInfo.as create mode 100644 com/ankamagames/dofus/network/types/game/data/items/ObjectItemGenericQuantity.as create mode 100644 com/ankamagames/dofus/pools/PoolableSoundCommand.as create mode 100644 com/ankamagames/dofus/pools/PoolsManager.as diff --git a/Dofus.as b/Dofus.as index 1b8d0280f..714f81ab0 100644 --- a/Dofus.as +++ b/Dofus.as @@ -1,794 +1,791 @@ -package +package { - import flash.display.Sprite; - import com.ankamagames.jerakine.utils.display.IFramerateListener; - import com.ankamagames.berilia.interfaces.IApplicationContainer; - import com.ankamagames.jerakine.logger.Logger; - import com.ankamagames.jerakine.logger.Log; - import flash.utils.getQualifiedClassName; - import flash.text.TextField; - import com.ankamagames.dofus.types.DofusOptions; - import com.ankamagames.berilia.components.MapViewer; - import com.ankamagames.dofus.misc.utils.EmbedAssets; - import flash.display.Stage; - import com.ankamagames.jerakine.utils.system.AirScanner; - import flash.system.Security; - import com.ankamagames.dofus.misc.utils.errormanager.DofusErrorHandler; - import com.ankamagames.jerakine.managers.ErrorManager; - import com.ankamagames.dofus.misc.interClient.AppIdModifier; - import flash.desktop.NativeApplication; - import flash.events.Event; - import flash.events.InvokeEvent; - import flash.events.NativeWindowBoundsEvent; - import flash.events.FullScreenEvent; - import flash.filesystem.FileStream; - import flash.filesystem.File; - import flash.filesystem.FileMode; - import flash.utils.ByteArray; - import flash.xml.XMLDocument; - import flash.xml.XMLNode; - import com.ankamagames.dofus.network.types.updater.ContentPart; - import com.ankamagames.jerakine.utils.system.CommandLineArguments; - import com.ankamagames.dofus.logic.game.approach.managers.PartManager; - import com.ankamagames.dofus.network.enums.PartStateEnum; - import com.ankamagames.dofus.BuildInfos; - import com.ankamagames.jerakine.types.Version; - import com.ankamagames.dofus.network.enums.BuildTypeEnum; - import com.ankamagames.jerakine.types.Uri; - import flash.system.ApplicationDomain; - import com.ankamagames.jerakine.types.CustomSharedObject; - import flash.display.NativeWindowDisplayState; - import com.ankamagames.jerakine.managers.OptionManager; - import com.ankamagames.jerakine.utils.display.StageShareManager; - import flash.display.NativeWindow; - import com.ankamagames.jerakine.utils.system.SystemManager; - import flash.display.StageDisplayState; - import com.ankamagames.jerakine.enum.OperatingSystem; - import flash.display.Screen; - import flash.display.DisplayObjectContainer; - import com.ankamagames.jerakine.types.events.PropertyChangeEvent; - import com.ankamagames.jerakine.resources.adapters.impl.SignedFileAdapter; - import com.ankamagames.jerakine.utils.crypto.SignatureKey; - import com.ankamagames.dofus.Constants; - import com.ankamagames.tiphon.engine.TiphonEventsManager; - import com.ankamagames.tiphon.engine.Tiphon; - import com.ankamagames.tiphon.events.TiphonEvent; - import com.ankamagames.dofus.kernel.sound.SoundManager; - import com.ankamagames.dofus.kernel.sound.manager.RegSoundManager; - import com.ankamagames.atouin.Atouin; - import flash.display.DisplayObject; - import com.ankamagames.dofus.misc.utils.errormanager.WebServiceDataHandler; - import com.ankamagames.dofus.kernel.sound.manager.RegConnectionManager; - import com.ankamagames.jerakine.protocolAudio.ProtocolEnum; - import com.ankamagames.dofus.misc.interClient.InterClientManager; - import com.ankamagames.jerakine.managers.StoreDataManager; - import com.ankamagames.jerakine.utils.files.FileUtils; - import flash.external.ExternalInterface; - import com.ankamagames.dofus.kernel.Kernel; - import com.ankamagames.jerakine.messages.Worker; - import com.ankamagames.jerakine.managers.LangManager; - import com.ankamagames.jerakine.managers.FontManager; - import com.ankamagames.berilia.Berilia; - import flash.system.LoaderContext; - import com.ankamagames.berilia.managers.UiModuleManager; - import com.ankamagames.berilia.components.EntityDisplayer; - import com.ankamagames.dofus.logic.game.fight.miscs.CustomAnimStatiqueAnimationModifier; - import com.ankamagames.dofus.types.entities.BreedSkinModifier; - import com.ankamagames.dofus.network.enums.SubEntityBindingPointCategoryEnum; - import com.ankamagames.dofus.types.entities.AnimStatiqueSubEntityBehavior; - import com.ankamagames.dofus.types.entities.RiderBehavior; - import com.ankamagames.berilia.components.CharacterWheel; - import com.ankamagames.dofus.misc.EntityLookAdapter; - import com.ankamagames.jerakine.utils.display.FramerateCounter; - import com.ankamagames.dofus.misc.BuildTypeParser; - import flash.text.TextFormat; - import flash.text.TextFormatAlign; - import flash.filters.DropShadowFilter; - import com.ankamagames.dofus.console.moduleLogger.Console; - import com.ankamagames.dofus.console.moduleLUA.ConsoleLUA; - import com.ankamagames.berilia.utils.web.HttpServer; - import flash.display.StageQuality; - import com.ankamagames.tiphon.display.RasterizedAnimation; - import com.ankamagames.jerakine.utils.memory.Memory; - - [SWF(backgroundColor="#111111", frameRate="50", width="1280", height="1024")] - public class Dofus extends Sprite implements IFramerateListener, IApplicationContainer - { - - protected static const _log:Logger = Log.getLogger(getQualifiedClassName(Dofus)); - private static var _self:Dofus; - - private var _uiContainer:Sprite; - private var _worldContainer:Sprite; - private var _fpsDisplay:TextField; - private var _buildType:String; - private var _instanceId:uint; - private var _doOptions:DofusOptions; - private var _blockLoading:Boolean; - private var _initialized:Boolean = false; - private var _forcedLang:String; - private var _stageWidth:int; - private var _stageHeight:int; - private var _displayState:String; - private var _returnCode:int; - public var REG_LOCAL_CONNECTION_ID:uint = 0; - public var strProgress:Number = 0; - public var strComplete:Boolean = false; - - public function Dofus() - { - super(); - var i:uint; - while (i < numChildren) - { - getChildAt(i).visible = false; - i++; - }; - MapViewer.FLAG_CURSOR = EmbedAssets.getClass("FLAG_CURSOR"); - var stage:Stage = this.stage; - if (!(stage)) - { - stage = loaderInfo.loader.stage; - AirScanner.init((getQualifiedClassName(loaderInfo.loader.parent) == "DofusLoader")); + import flash.display.Sprite; + import com.ankamagames.jerakine.utils.display.IFramerateListener; + import com.ankamagames.berilia.interfaces.IApplicationContainer; + import com.ankamagames.jerakine.logger.Logger; + import com.ankamagames.jerakine.logger.Log; + import flash.utils.getQualifiedClassName; + import flash.text.TextField; + import com.ankamagames.dofus.types.DofusOptions; + import flash.utils.ByteArray; + import flash.filesystem.FileStream; + import flash.filesystem.File; + import flash.filesystem.FileMode; + import flash.events.InvokeEvent; + import flash.xml.XMLDocument; + import flash.xml.XMLNode; + import com.ankamagames.dofus.network.types.updater.ContentPart; + import com.ankamagames.jerakine.utils.system.CommandLineArguments; + import com.ankamagames.dofus.misc.utils.errormanager.DofusErrorHandler; + import com.ankamagames.dofus.logic.game.approach.managers.PartManager; + import com.ankamagames.dofus.network.enums.PartStateEnum; + import com.ankamagames.dofus.BuildInfos; + import com.ankamagames.jerakine.types.Version; + import com.ankamagames.dofus.network.enums.BuildTypeEnum; + import com.ankamagames.jerakine.types.Uri; + import flash.system.ApplicationDomain; + import com.ankamagames.jerakine.types.CustomSharedObject; + import flash.events.NativeWindowBoundsEvent; + import flash.display.NativeWindowDisplayState; + import flash.events.FullScreenEvent; + import com.ankamagames.jerakine.managers.OptionManager; + import com.ankamagames.jerakine.utils.display.StageShareManager; + import flash.display.NativeWindow; + import com.ankamagames.jerakine.utils.system.SystemManager; + import com.ankamagames.jerakine.enum.OperatingSystem; + import flash.display.StageDisplayState; + import flash.display.Screen; + import flash.display.DisplayObjectContainer; + import com.ankamagames.jerakine.types.events.PropertyChangeEvent; + import flash.display.DisplayObject; + import com.ankamagames.jerakine.resources.adapters.impl.SignedFileAdapter; + import com.ankamagames.jerakine.utils.crypto.SignatureKey; + import com.ankamagames.dofus.Constants; + import com.ankamagames.jerakine.utils.system.AirScanner; + import flash.events.Event; + import com.ankamagames.tiphon.engine.TiphonEventsManager; + import com.ankamagames.tiphon.engine.Tiphon; + import com.ankamagames.tiphon.events.TiphonEvent; + import com.ankamagames.dofus.kernel.sound.SoundManager; + import com.ankamagames.dofus.kernel.sound.manager.RegSoundManager; + import com.ankamagames.atouin.Atouin; + import com.ankamagames.dofus.misc.utils.errormanager.WebServiceDataHandler; + import flash.desktop.NativeApplication; + import com.ankamagames.dofus.kernel.sound.manager.RegConnectionManager; + import com.ankamagames.jerakine.protocolAudio.ProtocolEnum; + import com.ankamagames.dofus.misc.interClient.InterClientManager; + import com.ankamagames.jerakine.managers.StoreDataManager; + import com.ankamagames.jerakine.utils.files.FileUtils; + import com.ankamagames.dofus.misc.interClient.AppIdModifier; + import flash.external.ExternalInterface; + import com.ankamagames.dofus.kernel.Kernel; + import com.ankamagames.jerakine.messages.Worker; + import flash.display.Stage; + import com.ankamagames.jerakine.managers.LangManager; + import com.ankamagames.jerakine.managers.FontManager; + import com.ankamagames.berilia.Berilia; + import com.ankamagames.dofus.misc.utils.EmbedAssets; + import flash.system.LoaderContext; + import com.ankamagames.berilia.managers.UiModuleManager; + import com.ankamagames.berilia.components.EntityDisplayer; + import com.ankamagames.dofus.logic.game.fight.miscs.CustomAnimStatiqueAnimationModifier; + import com.ankamagames.dofus.types.entities.BreedSkinModifier; + import com.ankamagames.dofus.network.enums.SubEntityBindingPointCategoryEnum; + import com.ankamagames.dofus.types.entities.AnimStatiqueSubEntityBehavior; + import com.ankamagames.dofus.types.entities.RiderBehavior; + import com.ankamagames.berilia.components.CharacterWheel; + import com.ankamagames.dofus.misc.EntityLookAdapter; + import com.ankamagames.jerakine.utils.display.FramerateCounter; + import com.ankamagames.dofus.misc.BuildTypeParser; + import flash.text.TextFormat; + import flash.text.TextFormatAlign; + import flash.filters.DropShadowFilter; + import com.ankamagames.dofus.console.moduleLogger.Console; + import com.ankamagames.dofus.console.moduleLUA.ConsoleLUA; + import com.ankamagames.berilia.utils.web.HttpServer; + import flash.display.StageQuality; + import com.ankamagames.tiphon.display.RasterizedAnimation; + import com.ankamagames.jerakine.utils.memory.Memory; + import com.ankamagames.berilia.components.MapViewer; + import flash.system.Security; + import com.ankamagames.jerakine.managers.ErrorManager; + + public class Dofus extends Sprite implements IFramerateListener, IApplicationContainer + { + + public function Dofus() + { + super(); + var i:uint = 0; + while(i < numChildren) + { + getChildAt(i).visible = false; + i++; + } + MapViewer.FLAG_CURSOR = EmbedAssets.getClass("FLAG_CURSOR"); + var stage:Stage = this.stage; + if(!stage) + { + stage = loaderInfo.loader.stage; + AirScanner.init(getQualifiedClassName(loaderInfo.loader.parent) == "DofusLoader"); + } + else + { + AirScanner.init(false); + } + _self = this; + var hasAir:Boolean = AirScanner.hasAir(); + if(!hasAir) + { + stage.showDefaultContextMenu = false; + Security.allowDomain("*"); + new DofusErrorHandler(); + } + if(hasAir) + { + this._blockLoading = !(name == "root1"); + } + ErrorManager.registerLoaderInfo(loaderInfo); + mouseEnabled = false; + tabChildren = false; + if(hasAir) + { + try + { + new AppIdModifier(); } - else - { - AirScanner.init(false); - }; - _self = this; - var hasAir:Boolean = AirScanner.hasAir(); - if (!(hasAir)) - { - stage.showDefaultContextMenu = false; - Security.allowDomain("*"); - new DofusErrorHandler(); - }; - if (hasAir) - { - this._blockLoading = !((name == "root1")); - }; - ErrorManager.registerLoaderInfo(loaderInfo); - mouseEnabled = false; - tabChildren = false; - if (hasAir) - { - try - { - new AppIdModifier(); - } - catch(e:Error) - { - trace(("Erreur sur la gestion du multicompte :\n" + e.getStackTrace())); - }; - }; - if (hasAir) + catch(e:Error) { - NativeApplication.nativeApplication.addEventListener(Event.EXITING, this.onExiting); - NativeApplication.nativeApplication.addEventListener(InvokeEvent.INVOKE, this.onCall); - stage.nativeWindow.addEventListener(NativeWindowBoundsEvent.RESIZE, this.onResize); } - else - { - if (AirScanner.isStreamingVersion()) - { - stage.addEventListener(FullScreenEvent.FULL_SCREEN, this.onFullScreen); - }; - }; - } - - public static function getInstance():Dofus - { - return (_self); - } - - - public function getRawSignatureData():ByteArray - { - var fs:FileStream = new FileStream(); - var f:File = File.applicationDirectory.resolvePath("DofusInvoker.d2sf"); - fs.open(f, FileMode.READ); - var rawData:ByteArray = new ByteArray(); - fs.readBytes(rawData); - fs.close(); - return (rawData); - } - - private function onCall(e:InvokeEvent):void - { - var file:File; - var stream:FileStream; - var content:String; - var xml:XMLDocument; - var gameNode:XMLNode; - var upperVersion:String; - var configNode:XMLNode; - var versionSplitted:Array; - var version:String; - var part:ContentPart; - if (!(this._initialized)) - { - CommandLineArguments.getInstance().setArguments(e.arguments); - new DofusErrorHandler(); - this.initWindow(); - try - { - file = new File(((File.applicationDirectory.nativePath + File.separator) + "uplauncherComponents.xml")); - if (file.exists) - { - PartManager.getInstance().createEmptyPartList(); - stream = new FileStream(); - stream.open(file, FileMode.READ); - content = stream.readMultiByte(file.size, "utf-8"); - xml = new XMLDocument(); - xml.ignoreWhite = true; - xml.parseXML(content); - gameNode = xml.firstChild; - upperVersion = null; - for each (configNode in gameNode.childNodes) + } + if(hasAir) + { + NativeApplication.nativeApplication.addEventListener(Event.EXITING,this.onExiting); + NativeApplication.nativeApplication.addEventListener(InvokeEvent.INVOKE,this.onCall); + stage.nativeWindow.addEventListener(NativeWindowBoundsEvent.RESIZE,this.onResize); + } + else if(AirScanner.isStreamingVersion()) + { + stage.addEventListener(FullScreenEvent.FULL_SCREEN,this.onFullScreen); + } + + } + + protected static const _log:Logger = Log.getLogger(getQualifiedClassName(Dofus)); + + private static var _self:Dofus; + + public static function getInstance() : Dofus + { + return _self; + } + + private var _uiContainer:Sprite; + + private var _worldContainer:Sprite; + + private var _fpsDisplay:TextField; + + private var _buildType:String; + + private var _instanceId:uint; + + private var _doOptions:DofusOptions; + + private var _blockLoading:Boolean; + + private var _initialized:Boolean = false; + + private var _forcedLang:String; + + private var _stageWidth:int; + + private var _stageHeight:int; + + private var _displayState:String; + + private var _returnCode:int; + + public var REG_LOCAL_CONNECTION_ID:uint = 0; + + public function getRawSignatureData() : ByteArray + { + var _loc1_:FileStream = new FileStream(); + var _loc2_:File = File.applicationDirectory.resolvePath("DofusInvoker.d2sf"); + _loc1_.open(_loc2_,FileMode.READ); + var _loc3_:ByteArray = new ByteArray(); + _loc1_.readBytes(_loc3_); + _loc1_.close(); + return _loc3_; + } + + private function onCall(param1:InvokeEvent) : void + { + var file:File = null; + var stream:FileStream = null; + var content:String = null; + var xml:XMLDocument = null; + var gameNode:XMLNode = null; + var upperVersion:String = null; + var configNode:XMLNode = null; + var versionSplitted:Array = null; + var version:String = null; + var part:ContentPart = null; + var e:InvokeEvent = param1; + if(!this._initialized) + { + CommandLineArguments.getInstance().setArguments(e.arguments); + new DofusErrorHandler(); + this.initWindow(); + try + { + file = new File(File.applicationDirectory.nativePath + File.separator + "uplauncherComponents.xml"); + if(file.exists) + { + PartManager.getInstance().createEmptyPartList(); + stream = new FileStream(); + stream.open(file,FileMode.READ); + content = stream.readMultiByte(file.size,"utf-8"); + xml = new XMLDocument(); + xml.ignoreWhite = true; + xml.parseXML(content); + gameNode = xml.firstChild; + upperVersion = null; + for each(configNode in gameNode.childNodes) + { + version = configNode.attributes["version"]; + part = new ContentPart(); + part.id = configNode.attributes["name"]; + part.state = version?PartStateEnum.PART_UP_TO_DATE:PartStateEnum.PART_NOT_INSTALLED; + PartManager.getInstance().updatePart(part); + if((version) && (upperVersion == null) || version > upperVersion) + { + upperVersion = version; + } + } + versionSplitted = upperVersion.split("."); + if(versionSplitted.length >= 5) + { + BuildInfos.BUILD_VERSION = new Version(versionSplitted[0],versionSplitted[1],versionSplitted[2]); + BuildInfos.BUILD_VERSION.revision = versionSplitted[3]; + BuildInfos.BUILD_REVISION = versionSplitted[3]; + BuildInfos.BUILD_VERSION.patch = versionSplitted[4]; + BuildInfos.BUILD_PATCH = versionSplitted[4]; + } + } + else + { + file = new File(File.applicationDirectory.nativePath + File.separator + "games_base.xml"); + if(file.exists) + { + stream = new FileStream(); + stream.open(file,FileMode.READ); + content = stream.readMultiByte(file.size,"utf-8"); + xml = new XMLDocument(); + xml.ignoreWhite = true; + xml.parseXML(content); + gameNode = xml.firstChild.firstChild; + for each(configNode in gameNode.childNodes) + { + if(configNode.nodeName == "version") { - version = configNode.attributes["version"]; - part = new ContentPart(); - part.id = configNode.attributes["name"]; - part.state = ((version) ? PartStateEnum.PART_UP_TO_DATE : PartStateEnum.PART_NOT_INSTALLED); - PartManager.getInstance().updatePart(part); - if (((((version) && ((upperVersion == null)))) || ((version > upperVersion)))) - { - upperVersion = version; - }; - }; - versionSplitted = upperVersion.split("."); - if (versionSplitted.length >= 5) - { - BuildInfos.BUILD_VERSION = new Version(versionSplitted[0], versionSplitted[1], versionSplitted[2]); - BuildInfos.BUILD_VERSION.revision = versionSplitted[3]; - BuildInfos.BUILD_REVISION = versionSplitted[3]; - BuildInfos.BUILD_VERSION.patch = versionSplitted[4]; - BuildInfos.BUILD_PATCH = versionSplitted[4]; - }; - } - else - { - file = new File(((File.applicationDirectory.nativePath + File.separator) + "games_base.xml")); - if (file.exists) - { - stream = new FileStream(); - stream.open(file, FileMode.READ); - content = stream.readMultiByte(file.size, "utf-8"); - xml = new XMLDocument(); - xml.ignoreWhite = true; - xml.parseXML(content); - gameNode = xml.firstChild.firstChild; - for each (configNode in gameNode.childNodes) - { - if (configNode.nodeName == "version") - { - version = configNode.firstChild.nodeValue; - version = version.split("_")[0]; - versionSplitted = version.split("."); - if (versionSplitted.length >= 5) - { - BuildInfos.BUILD_VERSION = new Version(versionSplitted[0], versionSplitted[1], versionSplitted[2]); - BuildInfos.BUILD_VERSION.revision = versionSplitted[3]; - BuildInfos.BUILD_REVISION = versionSplitted[3]; - BuildInfos.BUILD_VERSION.patch = versionSplitted[4]; - BuildInfos.BUILD_PATCH = versionSplitted[4]; - }; - }; - }; + version = configNode.firstChild.nodeValue; + version = version.split("_")[0]; + versionSplitted = version.split("."); + if(versionSplitted.length >= 5) + { + BuildInfos.BUILD_VERSION = new Version(versionSplitted[0],versionSplitted[1],versionSplitted[2]); + BuildInfos.BUILD_VERSION.revision = versionSplitted[3]; + BuildInfos.BUILD_REVISION = versionSplitted[3]; + BuildInfos.BUILD_VERSION.patch = versionSplitted[4]; + BuildInfos.BUILD_PATCH = versionSplitted[4]; + } } - else - { - BuildInfos.BUILD_VERSION.revision = BuildInfos.BUILD_REVISION; - BuildInfos.BUILD_VERSION.patch = BuildInfos.BUILD_PATCH; - }; - }; - } - catch(e:Error) - { - trace(e.toString()); - BuildInfos.BUILD_VERSION.revision = BuildInfos.BUILD_REVISION; - BuildInfos.BUILD_VERSION.patch = BuildInfos.BUILD_PATCH; - }; - trace(((((((((("Version : " + BuildInfos.BUILD_VERSION.major) + ".") + BuildInfos.BUILD_VERSION.minor) + ".") + BuildInfos.BUILD_VERSION.release) + ".") + BuildInfos.BUILD_REVISION) + ".") + BuildInfos.BUILD_PATCH)); - if (BuildInfos.BUILD_TYPE < BuildTypeEnum.INTERNAL) - { - Uri.enableSecureURI(); - }; - if (this.stage) - { - this.init(this.stage); - }; - _log.debug(("Support des Workers : " + ApplicationDomain.currentDomain.hasDefinition("flash.system::Worker"))); - try - { - file = new File(((CustomSharedObject.getCustomSharedObjectDirectory() + File.separator) + "path.d2p")); - if (!(file.exists)) - { - stream = new FileStream(); - stream.open(file, FileMode.WRITE); - stream.writeUTF(File.applicationDirectory.nativePath); - stream.close(); - }; - } - catch(e:Error) - { - }; - this._initialized = true; - }; - } - - private function onResize(e:NativeWindowBoundsEvent):void - { - this._displayState = stage.nativeWindow.displayState; - if (this._displayState != NativeWindowDisplayState.MAXIMIZED) - { - this._stageHeight = stage.nativeWindow.height; - this._stageWidth = stage.nativeWindow.width; - }; - } - - private function onFullScreen(e:FullScreenEvent):void - { - var fullScreenOption:Boolean = OptionManager.getOptionManager("dofus").fullScreen; - if (fullScreenOption != e.fullScreen) - { - OptionManager.getOptionManager("dofus").fullScreen = e.fullScreen; - }; - StageShareManager.justExitFullScreen = !(e.fullScreen); - } - - private function initWindow():void - { - var r:Number = (stage.stageWidth / stage.stageHeight); - var mainWindow:NativeWindow = stage.nativeWindow; - var chromeWidth:Number = (mainWindow.width - stage.stageWidth); - var chromeHeight:Number = (mainWindow.height - stage.stageHeight); - StageShareManager.chrome.x = chromeWidth; - StageShareManager.chrome.y = chromeHeight; - var clientDimentionSo:CustomSharedObject = CustomSharedObject.getLocal("clientData"); - var os:String = SystemManager.getSingleton().os; - var sizeInitialised:Boolean; - if (((!((clientDimentionSo.data == null))) && ((((clientDimentionSo.data.width > 0)) && ((clientDimentionSo.data.height > 0)))))) - { - if ((((((clientDimentionSo.data.displayState == NativeWindowDisplayState.MAXIMIZED)) && ((os == OperatingSystem.WINDOWS)))) && (!((stage.displayState == StageDisplayState["FULL_SCREEN_INTERACTIVE"]))))) - { - stage.nativeWindow.maximize(); - this._displayState = NativeWindowDisplayState.MAXIMIZED; - }; - if ((((clientDimentionSo.data.width > 0)) && ((clientDimentionSo.data.height > 0)))) - { - mainWindow.width = clientDimentionSo.data.width; - if (os == OperatingSystem.LINUX) - { - mainWindow.height = (clientDimentionSo.data.height - 28); - } - else - { - mainWindow.height = clientDimentionSo.data.height; - }; - this._stageWidth = mainWindow.width; - this._stageHeight = mainWindow.height; - sizeInitialised = true; - }; - }; - if (!(sizeInitialised)) - { - if (Screen.mainScreen.visibleBounds.width > Screen.mainScreen.visibleBounds.height) - { - if (os == OperatingSystem.WINDOWS) - { - mainWindow.height = ((Screen.mainScreen.visibleBounds.height * 0.8) + chromeHeight); - mainWindow.width = ((r * (mainWindow.height - chromeHeight)) + chromeWidth); - } - else - { - mainWindow.height = (Screen.mainScreen.visibleBounds.height * 0.8); - mainWindow.width = (r * (mainWindow.height - chromeHeight)); - }; - } - else - { - if (os == OperatingSystem.WINDOWS) - { - mainWindow.width = ((Screen.mainScreen.visibleBounds.width * 0.8) + chromeWidth); - mainWindow.height = (((mainWindow.width - chromeWidth) / r) + chromeHeight); - } - else - { - mainWindow.width = (Screen.mainScreen.visibleBounds.width * 0.8); - mainWindow.height = (mainWindow.width / r); - }; - }; - this._stageHeight = stage.nativeWindow.height; - this._stageWidth = stage.nativeWindow.width; - }; - mainWindow.x = (((Screen.mainScreen.visibleBounds.width - mainWindow.width) / 2) + Screen.mainScreen.visibleBounds.x); - mainWindow.y = (((Screen.mainScreen.visibleBounds.height - mainWindow.height) / 2) + Screen.mainScreen.visibleBounds.y); - mainWindow.visible = true; - } - - public function getUiContainer():DisplayObjectContainer - { - return (this._uiContainer); - } - - public function getWorldContainer():DisplayObjectContainer - { - return (this._worldContainer); - } - - public function get options():DofusOptions - { - return (this._doOptions); - } - - public function get instanceId():uint - { - return (this._instanceId); - } - - public function get forcedLang():String - { - return (this._forcedLang); - } - - public function setDisplayOptions(opt:DofusOptions):void - { - this._doOptions = opt; - this._doOptions.addEventListener(PropertyChangeEvent.PROPERTY_CHANGED, this.onOptionChange); - this._doOptions.flashQuality = this._doOptions.flashQuality; - this._doOptions.fullScreen = this._doOptions.fullScreen; - } - - public function init(rootClip:DisplayObject, instanceId:uint=0, forcedLang:String=null, args:Array=null):void - { - if (args) - { - CommandLineArguments.getInstance().setArguments(args); - }; - this._instanceId = instanceId; - this._forcedLang = forcedLang; - var catchMouseEventCtr:Sprite = new Sprite(); - catchMouseEventCtr.name = "catchMouseEventCtr"; - catchMouseEventCtr.graphics.beginFill(0); - catchMouseEventCtr.graphics.drawRect(0, 0, StageShareManager.startWidth, StageShareManager.startHeight); - catchMouseEventCtr.graphics.endFill(); - addChild(catchMouseEventCtr); - var so:CustomSharedObject = CustomSharedObject.getLocal("appVersion"); - if (((!(so.data.lastBuildVersion)) || (((!((so.data.lastBuildVersion == BuildInfos.BUILD_REVISION))) && ((BuildInfos.BUILD_TYPE < BuildTypeEnum.INTERNAL)))))) - { - this.clearCache(true); - }; - so = CustomSharedObject.getLocal("appVersion"); - so.data.lastBuildVersion = BuildInfos.BUILD_REVISION; - so.flush(); - so.close(); - SignedFileAdapter.defaultSignatureKey = SignatureKey.fromByte((new (Constants.SIGNATURE_KEY_DATA)() as ByteArray)); - this.initKernel(this.stage, rootClip); - this.initWorld(); - this.initUi(); - if (BuildInfos.BUILD_TYPE > BuildTypeEnum.ALPHA) - { - this.initDebug(); - }; - if (AirScanner.hasAir()) - { - stage["nativeWindow"].addEventListener(Event.CLOSE, this.onClosed); - }; - TiphonEventsManager.addListener(Tiphon.getInstance(), TiphonEvent.EVT_EVENT); - SoundManager.getInstance().manager = new RegSoundManager(); - (SoundManager.getInstance().manager as RegSoundManager).forceSoundsDebugMode = true; - Atouin.getInstance().addListener(SoundManager.getInstance().manager); - } - - private function onExiting(pEvt:Event):void - { - this.saveClientSize(); - if (WebServiceDataHandler.getInstance().quit()) - { - pEvt.preventDefault(); - pEvt.stopPropagation(); - WebServiceDataHandler.getInstance().addEventListener(WebServiceDataHandler.ALL_DATA_SENT, this.quitHandler); - }; - } - - public function quit(returnCode:int=0):void - { - this._returnCode = returnCode; - if (!(WebServiceDataHandler.getInstance().quit())) - { - this.quitHandler(); + } + } + else + { + BuildInfos.BUILD_VERSION.revision = BuildInfos.BUILD_REVISION; + BuildInfos.BUILD_VERSION.patch = BuildInfos.BUILD_PATCH; + } + } } - else - { - _log.trace("We have data to send to the webservice. waiting..."); - WebServiceDataHandler.getInstance().addEventListener(WebServiceDataHandler.ALL_DATA_SENT, this.quitHandler); - WebServiceDataHandler.getInstance().sendWaitingException(); - }; - } - - private function quitHandler(pEvt:Event=null):void - { - if (pEvt != null) - { - pEvt.currentTarget.removeEventListener(WebServiceDataHandler.ALL_DATA_SENT, this.quitHandler); - _log.trace("Data sent. Good to go. Bye bye"); - }; - if (Constants.EVENT_MODE) + catch(e:Error) { - this.reboot(); + BuildInfos.BUILD_VERSION.revision = BuildInfos.BUILD_REVISION; + BuildInfos.BUILD_VERSION.patch = BuildInfos.BUILD_PATCH; } - else - { - if (AirScanner.hasAir()) - { - stage.nativeWindow.close(); - if (NativeApplication.nativeApplication.openedWindows.length == 0) - { - NativeApplication.nativeApplication.exit(this._returnCode); - }; - }; - }; - } - - public function onClose():void - { - RegConnectionManager.getInstance().send(ProtocolEnum.SAY_GOODBYE, RegConnectionManager.getInstance().socketClientID); - InterClientManager.destroy(); - } - - public function clearCache(selective:Boolean=false, reboot:Boolean=false):void - { - var soList:Array; - var file:File; - var fileName:String; - StoreDataManager.getInstance().reset(); - var soFolder:File = new File(CustomSharedObject.getCustomSharedObjectDirectory()); - if (((soFolder) && (soFolder.exists))) + if(BuildInfos.BUILD_TYPE < BuildTypeEnum.INTERNAL) { - CustomSharedObject.closeAll(); - soList = soFolder.getDirectoryListing(); - for each (file in soList) - { - fileName = FileUtils.getFileStartName(file.name); - if (fileName == "Dofus_Guest") - { - } - else - { - if (selective) - { - switch (true) - { - case (fileName.indexOf("Module_") == 0): - case (fileName == "dofus"): - case (fileName.indexOf("Dofus_") == 0): - case (fileName == "atouin"): - case (fileName == "berilia"): - case (fileName == "chat"): - case (fileName == "tiphon"): - case (fileName == "tubul"): - case (fileName.indexOf("externalNotifications_") == 0): - case (fileName == "averagePrices"): - case (fileName == "Berilia_binds"): - case (fileName == "maps"): - case (fileName == "logs"): - case (fileName == "uid"): - case (fileName == "appVersion"): - continue; - }; - }; - try - { - if (file.isDirectory) - { - file.deleteDirectory(true); - } - else - { - file.deleteFile(); - }; - } - catch(e:Error) - { - trace(("ClearCache method cannot delete " + file.nativePath)); - }; - }; - }; - }; - if (reboot) + Uri.enableSecureURI(); + } + if(this.stage) { - if (AirScanner.hasAir()) - { - AppIdModifier.getInstance().invalideCache(); - this.reboot(); - } - else - { - if (ExternalInterface.available) - { - ExternalInterface.call("eval", "window.location.reload()"); - }; - }; - }; - } - - public function reboot():void - { - this.saveClientSize(); - var w:Worker = Kernel.getWorker(); - if (w) + this.init(this.stage); + } + _log.debug("Support des Workers : " + ApplicationDomain.currentDomain.hasDefinition("flash.system::Worker")); + try + { + file = new File(CustomSharedObject.getCustomSharedObjectDirectory() + File.separator + "path.d2p"); + if(!file.exists) + { + stream = new FileStream(); + stream.open(file,FileMode.WRITE); + stream.writeUTF(File.applicationDirectory.nativePath); + stream.close(); + } + } + catch(e:Error) { - w.clear(); - }; - _log.fatal("REBOOT"); - if (AirScanner.hasAir()) + } + this._initialized = true; + } + if(!this._initialized) + { + return; + } + } + + private function onResize(param1:NativeWindowBoundsEvent) : void + { + this._displayState = stage.nativeWindow.displayState; + if(this._displayState != NativeWindowDisplayState.MAXIMIZED) + { + this._stageHeight = stage.nativeWindow.height; + this._stageWidth = stage.nativeWindow.width; + } + } + + private function onFullScreen(param1:FullScreenEvent) : void + { + var _loc2_:Boolean = OptionManager.getOptionManager("dofus").fullScreen; + if(_loc2_ != param1.fullScreen) + { + OptionManager.getOptionManager("dofus").fullScreen = param1.fullScreen; + } + StageShareManager.justExitFullScreen = !param1.fullScreen; + } + + private function initWindow() : void + { + var _loc1_:Number = stage.stageWidth / stage.stageHeight; + var _loc2_:NativeWindow = stage.nativeWindow; + var _loc3_:Number = _loc2_.width - stage.stageWidth; + var _loc4_:Number = _loc2_.height - stage.stageHeight; + StageShareManager.chrome.x = _loc3_; + StageShareManager.chrome.y = _loc4_; + var _loc5_:CustomSharedObject = CustomSharedObject.getLocal("clientData"); + var _loc6_:String = SystemManager.getSingleton().os; + var _loc7_:* = false; + if(!(_loc5_.data == null) && _loc5_.data.width > 0 && _loc5_.data.height > 0) + { + if(_loc5_.data.displayState == NativeWindowDisplayState.MAXIMIZED && _loc6_ == OperatingSystem.WINDOWS && !(stage.displayState == StageDisplayState["FULL_SCREEN_INTERACTIVE"])) + { + stage.nativeWindow.maximize(); + this._displayState = NativeWindowDisplayState.MAXIMIZED; + } + if(_loc5_.data.width > 0 && _loc5_.data.height > 0) + { + _loc2_.width = _loc5_.data.width; + if(_loc6_ == OperatingSystem.LINUX) + { + _loc2_.height = _loc5_.data.height - 28; + } + else + { + _loc2_.height = _loc5_.data.height; + } + this._stageWidth = _loc2_.width; + this._stageHeight = _loc2_.height; + _loc7_ = true; + } + } + if(!_loc7_) + { + if(Screen.mainScreen.visibleBounds.width > Screen.mainScreen.visibleBounds.height) + { + if(_loc6_ == OperatingSystem.WINDOWS) + { + _loc2_.height = Screen.mainScreen.visibleBounds.height * 0.8 + _loc4_; + _loc2_.width = _loc1_ * (_loc2_.height - _loc4_) + _loc3_; + } + else + { + _loc2_.height = Screen.mainScreen.visibleBounds.height * 0.8; + _loc2_.width = _loc1_ * (_loc2_.height - _loc4_); + } + } + else if(_loc6_ == OperatingSystem.WINDOWS) { - var _local_2 = NativeApplication.nativeApplication; - (_local_2["exit"](42)); + _loc2_.width = Screen.mainScreen.visibleBounds.width * 0.8 + _loc3_; + _loc2_.height = (_loc2_.width - _loc3_) / _loc1_ + _loc4_; } else { - throw (new Error("Reboot not implemented with flash")); - }; - } - - public function renameApp(name:String):void - { - if (AirScanner.hasAir()) - { - stage["nativeWindow"].title = name; - }; - } - - private function initKernel(stage:Stage, rootClip:DisplayObject):void - { - Kernel.getInstance().init(stage, rootClip); - LangManager.getInstance().handler = Kernel.getWorker(); - FontManager.getInstance().handler = Kernel.getWorker(); - Berilia.getInstance().handler = Kernel.getWorker(); - LangManager.getInstance().lang = "frFr"; - } - - private function initWorld():void - { - if (this._worldContainer) - { - removeChild(this._worldContainer); - }; - this._worldContainer = new Sprite(); - addChild(this._worldContainer); - this._worldContainer.mouseEnabled = false; - } - - private function initUi():void - { - if (this._uiContainer) - { - removeChild(this._uiContainer); - }; - this._uiContainer = new Sprite(); - addChild(this._uiContainer); - this._uiContainer.mouseEnabled = false; - var isDebugMode:Boolean = (BuildInfos.BUILD_TYPE == BuildTypeEnum.DEBUG); - Berilia.getInstance().verboseException = isDebugMode; - Berilia.getInstance().init(this._uiContainer, isDebugMode, BuildInfos.BUILD_REVISION, !(isDebugMode)); - if (AirScanner.isStreamingVersion()) - { - Berilia.embedIcons.SLOT_DEFAULT_ICON = EmbedAssets.getBitmap("DefaultBeriliaSlotIcon", true).bitmapData; - }; - var sharedDefUri:Uri = new Uri("SharedDefinitions.swf"); - sharedDefUri.loaderContext = new LoaderContext(false, new ApplicationDomain()); - var hasNoHttpServerFile:Boolean = File.applicationDirectory.resolvePath("noHttpServer").exists; - UiModuleManager.getInstance((((BuildInfos.BUILD_TYPE == BuildTypeEnum.RELEASE)) || (hasNoHttpServerFile))).sharedDefinitionContainer = sharedDefUri; - EntityDisplayer.setAnimationModifier(1, new CustomAnimStatiqueAnimationModifier()); - EntityDisplayer.setAnimationModifier(2, new CustomAnimStatiqueAnimationModifier()); - EntityDisplayer.setSkinModifier(1, new BreedSkinModifier()); - EntityDisplayer.setSkinModifier(2, new BreedSkinModifier()); - EntityDisplayer.setAnimationModifier(2, new CustomAnimStatiqueAnimationModifier()); - EntityDisplayer.setSubEntityDefaultBehavior(SubEntityBindingPointCategoryEnum.HOOK_POINT_CATEGORY_PET, new AnimStatiqueSubEntityBehavior()); - EntityDisplayer.setSubEntityDefaultBehavior(SubEntityBindingPointCategoryEnum.HOOK_POINT_CATEGORY_MOUNT_DRIVER, new RiderBehavior()); - CharacterWheel.setAnimationModifier(1, new CustomAnimStatiqueAnimationModifier()); - CharacterWheel.setAnimationModifier(2, new CustomAnimStatiqueAnimationModifier()); - CharacterWheel.setSkinModifier(1, new BreedSkinModifier()); - CharacterWheel.setSkinModifier(2, new BreedSkinModifier()); - CharacterWheel.setSubEntityDefaultBehavior(SubEntityBindingPointCategoryEnum.HOOK_POINT_CATEGORY_PET, new AnimStatiqueSubEntityBehavior()); - CharacterWheel.setSubEntityDefaultBehavior(SubEntityBindingPointCategoryEnum.HOOK_POINT_CATEGORY_MOUNT_DRIVER, new RiderBehavior()); - EntityDisplayer.lookAdaptater = EntityLookAdapter.tiphonizeLook; - } - - private function initDebug():void - { - FramerateCounter.refreshRate = 250; - FramerateCounter.addListener(this); - this._buildType = BuildTypeParser.getTypeName(BuildInfos.BUILD_TYPE); - this._fpsDisplay = new TextField(); - this._fpsDisplay.mouseEnabled = false; - this._fpsDisplay.selectable = false; - this._fpsDisplay.defaultTextFormat = new TextFormat("Verdana", 12, 0xFFFFFF, true, false, false, null, null, TextFormatAlign.RIGHT); - this._fpsDisplay.text = ((this._buildType + "\nr") + BuildInfos.BUILD_REVISION); - this._fpsDisplay.filters = [new DropShadowFilter(0, 0, 0, 1, 2, 2, 5, 3)]; - this._fpsDisplay.width = 300; - this._fpsDisplay.x = (0x0500 - this._fpsDisplay.width); - addChild(this._fpsDisplay); - if (Constants.EVENT_MODE) + _loc2_.width = Screen.mainScreen.visibleBounds.width * 0.8; + _loc2_.height = _loc2_.width / _loc1_; + } + + this._stageHeight = stage.nativeWindow.height; + this._stageWidth = stage.nativeWindow.width; + } + _loc2_.x = (Screen.mainScreen.visibleBounds.width - _loc2_.width) / 2 + Screen.mainScreen.visibleBounds.x; + _loc2_.y = (Screen.mainScreen.visibleBounds.height - _loc2_.height) / 2 + Screen.mainScreen.visibleBounds.y; + _loc2_.visible = true; + } + + public function getUiContainer() : DisplayObjectContainer + { + return this._uiContainer; + } + + public function getWorldContainer() : DisplayObjectContainer + { + return this._worldContainer; + } + + public function get options() : DofusOptions + { + return this._doOptions; + } + + public function get instanceId() : uint + { + return this._instanceId; + } + + public function get forcedLang() : String + { + return this._forcedLang; + } + + public function setDisplayOptions(param1:DofusOptions) : void + { + this._doOptions = param1; + this._doOptions.addEventListener(PropertyChangeEvent.PROPERTY_CHANGED,this.onOptionChange); + this._doOptions.flashQuality = this._doOptions.flashQuality; + this._doOptions.fullScreen = this._doOptions.fullScreen; + } + + public function init(param1:DisplayObject, param2:uint = 0, param3:String = null, param4:Array = null) : void + { + if(param4) + { + CommandLineArguments.getInstance().setArguments(param4); + } + this._instanceId = param2; + this._forcedLang = param3; + var _loc5_:Sprite = new Sprite(); + _loc5_.name = "catchMouseEventCtr"; + _loc5_.graphics.beginFill(0); + _loc5_.graphics.drawRect(0,0,StageShareManager.startWidth,StageShareManager.startHeight); + _loc5_.graphics.endFill(); + addChild(_loc5_); + var _loc6_:CustomSharedObject = CustomSharedObject.getLocal("appVersion"); + if(!_loc6_.data.lastBuildVersion || !(_loc6_.data.lastBuildVersion == BuildInfos.BUILD_REVISION) && BuildInfos.BUILD_TYPE < BuildTypeEnum.INTERNAL) + { + this.clearCache(true); + } + _loc6_ = CustomSharedObject.getLocal("appVersion"); + _loc6_.data.lastBuildVersion = BuildInfos.BUILD_REVISION; + _loc6_.flush(); + _loc6_.close(); + SignedFileAdapter.defaultSignatureKey = SignatureKey.fromByte(new Constants.SIGNATURE_KEY_DATA() as ByteArray); + this.initKernel(this.stage,param1); + this.initWorld(); + this.initUi(); + if(BuildInfos.BUILD_TYPE > BuildTypeEnum.ALPHA) + { + this.initDebug(); + } + if(AirScanner.hasAir()) + { + stage["nativeWindow"].addEventListener(Event.CLOSE,this.onClosed); + } + TiphonEventsManager.addListener(Tiphon.getInstance(),TiphonEvent.EVT_EVENT); + SoundManager.getInstance().manager = new RegSoundManager(); + (SoundManager.getInstance().manager as RegSoundManager).forceSoundsDebugMode = true; + Atouin.getInstance().addListener(SoundManager.getInstance().manager); + } + + private function onExiting(param1:Event) : void + { + this.saveClientSize(); + if(WebServiceDataHandler.getInstance().quit()) + { + param1.preventDefault(); + param1.stopPropagation(); + WebServiceDataHandler.getInstance().addEventListener(WebServiceDataHandler.ALL_DATA_SENT,this.quitHandler); + } + } + + public function quit(param1:int = 0) : void + { + this._returnCode = param1; + if(!WebServiceDataHandler.getInstance().quit()) + { + this.quitHandler(); + } + else + { + _log.trace("We have data to send to the webservice. waiting..."); + WebServiceDataHandler.getInstance().addEventListener(WebServiceDataHandler.ALL_DATA_SENT,this.quitHandler); + WebServiceDataHandler.getInstance().sendWaitingException(); + } + } + + private function quitHandler(param1:Event = null) : void + { + if(param1 != null) + { + param1.currentTarget.removeEventListener(WebServiceDataHandler.ALL_DATA_SENT,this.quitHandler); + _log.trace("Data sent. Good to go. Bye bye"); + } + if(Constants.EVENT_MODE) + { + this.reboot(); + } + else if(AirScanner.hasAir()) + { + stage.nativeWindow.close(); + if(NativeApplication.nativeApplication.openedWindows.length == 0) + { + NativeApplication.nativeApplication.exit(this._returnCode); + } + } + + } + + public function onClose() : void + { + RegConnectionManager.getInstance().send(ProtocolEnum.SAY_GOODBYE,RegConnectionManager.getInstance().socketClientID); + InterClientManager.destroy(); + } + + public function clearCache(param1:Boolean = false, param2:Boolean = false) : void + { + var soList:Array = null; + var file:File = null; + var fileName:String = null; + var selective:Boolean = param1; + var reboot:Boolean = param2; + StoreDataManager.getInstance().reset(); + var soFolder:File = new File(CustomSharedObject.getCustomSharedObjectDirectory()); + if((soFolder) && (soFolder.exists)) + { + CustomSharedObject.closeAll(); + soList = soFolder.getDirectoryListing(); + for each(file in soList) + { + fileName = FileUtils.getFileStartName(file.name); + if(fileName != "Dofus_Guest") + { + if(selective) + { + switch(true) + { + case fileName.indexOf("Module_") == 0: + case fileName == "dofus": + case fileName.indexOf("Dofus_") == 0: + case fileName == "atouin": + case fileName == "berilia": + case fileName == "chat": + case fileName == "tiphon": + case fileName == "tubul": + case fileName.indexOf("externalNotifications_") == 0: + case fileName == "averagePrices": + case fileName == "Berilia_binds": + case fileName == "maps": + case fileName == "logs": + case fileName == "uid": + case fileName == "appVersion": + continue; + } + } + try + { + if(file.isDirectory) + { + file.deleteDirectory(true); + } + else + { + file.deleteFile(); + } + } + catch(e:Error) + { + continue; + } + } + } + } + if(reboot) + { + if(AirScanner.hasAir()) { - this._fpsDisplay.visible = false; - }; - } - - public function toggleFPS():void - { - this._fpsDisplay.visible = !(this._fpsDisplay.visible); - } - - private function onClosed(e:Event):void - { - Console.getInstance().close(); - ConsoleLUA.getInstance().close(); - HttpServer.getInstance().close(); - } - - private function onOptionChange(e:PropertyChangeEvent):void - { - if (e.propertyName == "flashQuality") + AppIdModifier.getInstance().invalideCache(); + this.reboot(); + } + else if(ExternalInterface.available) { - if (e.propertyValue == 0) - { - StageShareManager.stage.quality = StageQuality.LOW; - } - else - { - if (e.propertyValue == 1) - { - StageShareManager.stage.quality = StageQuality.MEDIUM; - } - else - { - if (e.propertyValue == 2) - { - StageShareManager.stage.quality = StageQuality.HIGH; - }; - }; - }; - }; - if (e.propertyName == "fullScreen") + ExternalInterface.call("eval","window.location.reload()"); + } + + } + } + + public function reboot() : void + { + this.saveClientSize(); + var _loc1_:Worker = Kernel.getWorker(); + if(_loc1_) + { + _loc1_.clear(); + } + _log.fatal("REBOOT"); + if(AirScanner.hasAir()) + { + NativeApplication.nativeApplication["exit"](42); + return; + } + throw new Error("Reboot not implemented with flash"); + } + + public function renameApp(param1:String) : void + { + if(AirScanner.hasAir()) + { + stage["nativeWindow"].title = param1; + } + } + + private function initKernel(param1:Stage, param2:DisplayObject) : void + { + Kernel.getInstance().init(param1,param2); + LangManager.getInstance().handler = Kernel.getWorker(); + FontManager.getInstance().handler = Kernel.getWorker(); + Berilia.getInstance().handler = Kernel.getWorker(); + LangManager.getInstance().lang = "frFr"; + } + + private function initWorld() : void + { + if(this._worldContainer) + { + removeChild(this._worldContainer); + } + this._worldContainer = new Sprite(); + addChild(this._worldContainer); + this._worldContainer.mouseEnabled = false; + } + + private function initUi() : void + { + if(this._uiContainer) + { + removeChild(this._uiContainer); + } + this._uiContainer = new Sprite(); + addChild(this._uiContainer); + this._uiContainer.mouseEnabled = false; + var _loc1_:* = BuildInfos.BUILD_TYPE == BuildTypeEnum.DEBUG; + Berilia.getInstance().verboseException = _loc1_; + Berilia.getInstance().init(this._uiContainer,_loc1_,BuildInfos.BUILD_REVISION,!_loc1_); + if(AirScanner.isStreamingVersion()) + { + Berilia.embedIcons.SLOT_DEFAULT_ICON = EmbedAssets.getBitmap("DefaultBeriliaSlotIcon",true).bitmapData; + } + var _loc2_:Uri = new Uri("SharedDefinitions.swf"); + _loc2_.loaderContext = new LoaderContext(false,new ApplicationDomain()); + var _loc3_:Boolean = File.applicationDirectory.resolvePath("noHttpServer").exists; + UiModuleManager.getInstance(BuildInfos.BUILD_TYPE == BuildTypeEnum.RELEASE || (_loc3_)).sharedDefinitionContainer = _loc2_; + EntityDisplayer.setAnimationModifier(1,new CustomAnimStatiqueAnimationModifier()); + EntityDisplayer.setAnimationModifier(2,new CustomAnimStatiqueAnimationModifier()); + EntityDisplayer.setSkinModifier(1,new BreedSkinModifier()); + EntityDisplayer.setSkinModifier(2,new BreedSkinModifier()); + EntityDisplayer.setAnimationModifier(2,new CustomAnimStatiqueAnimationModifier()); + EntityDisplayer.setSubEntityDefaultBehavior(SubEntityBindingPointCategoryEnum.HOOK_POINT_CATEGORY_PET,new AnimStatiqueSubEntityBehavior()); + EntityDisplayer.setSubEntityDefaultBehavior(SubEntityBindingPointCategoryEnum.HOOK_POINT_CATEGORY_MOUNT_DRIVER,new RiderBehavior()); + CharacterWheel.setAnimationModifier(1,new CustomAnimStatiqueAnimationModifier()); + CharacterWheel.setAnimationModifier(2,new CustomAnimStatiqueAnimationModifier()); + CharacterWheel.setSkinModifier(1,new BreedSkinModifier()); + CharacterWheel.setSkinModifier(2,new BreedSkinModifier()); + CharacterWheel.setSubEntityDefaultBehavior(SubEntityBindingPointCategoryEnum.HOOK_POINT_CATEGORY_PET,new AnimStatiqueSubEntityBehavior()); + CharacterWheel.setSubEntityDefaultBehavior(SubEntityBindingPointCategoryEnum.HOOK_POINT_CATEGORY_MOUNT_DRIVER,new RiderBehavior()); + EntityDisplayer.lookAdaptater = EntityLookAdapter.tiphonizeLook; + } + + private function initDebug() : void + { + FramerateCounter.refreshRate = 250; + FramerateCounter.addListener(this); + this._buildType = BuildTypeParser.getTypeName(BuildInfos.BUILD_TYPE); + this._fpsDisplay = new TextField(); + this._fpsDisplay.mouseEnabled = false; + this._fpsDisplay.selectable = false; + this._fpsDisplay.defaultTextFormat = new TextFormat("Verdana",12,16777215,true,false,false,null,null,TextFormatAlign.RIGHT); + this._fpsDisplay.text = this._buildType + "\nr" + BuildInfos.BUILD_REVISION; + this._fpsDisplay.filters = [new DropShadowFilter(0,0,0,1,2,2,5,3)]; + this._fpsDisplay.width = 300; + this._fpsDisplay.x = 1280 - this._fpsDisplay.width; + addChild(this._fpsDisplay); + if(Constants.EVENT_MODE) + { + this._fpsDisplay.visible = false; + } + } + + public function toggleFPS() : void + { + this._fpsDisplay.visible = !this._fpsDisplay.visible; + } + + private function onClosed(param1:Event) : void + { + Console.getInstance().close(); + ConsoleLUA.getInstance().close(); + HttpServer.getInstance().close(); + } + + private function onOptionChange(param1:PropertyChangeEvent) : void + { + if(param1.propertyName == "flashQuality") + { + if(param1.propertyValue == 0) + { + StageShareManager.stage.quality = StageQuality.LOW; + } + else if(param1.propertyValue == 1) { - StageShareManager.setFullScreen(e.propertyValue, false); - }; - } - - public function onFps(fps:uint):void - { - var framesInfo:Object; - if (this._fpsDisplay.visible) + StageShareManager.stage.quality = StageQuality.MEDIUM; + } + else if(param1.propertyValue == 2) { - framesInfo = RasterizedAnimation.countFrames(); - this._fpsDisplay.htmlText = ((((((((((("" + fps) + " fps - ") + this._buildType) + "\n") + Memory.humanReadableUsage()) + " - r") + BuildInfos.BUILD_REVISION) + "\n Anim/Img en cache - ") + framesInfo.animations) + "/") + framesInfo.frames); - }; - } - - private function saveClientSize():void - { - var clientDimentionSo:CustomSharedObject = CustomSharedObject.getLocal("clientData"); - clientDimentionSo.data.height = this._stageHeight; - clientDimentionSo.data.width = this._stageWidth; - clientDimentionSo.data.displayState = this._displayState; - clientDimentionSo.flush(); - clientDimentionSo.close(); - } - - public function strLoaderComplete():void - { - this.strComplete = true; - } - - public function getLoadingProgress():Number - { - return (this.strProgress); - } - - - } -}//package - + StageShareManager.stage.quality = StageQuality.HIGH; + } + + + } + if(param1.propertyName == "fullScreen") + { + StageShareManager.setFullScreen(param1.propertyValue,false); + } + } + + public function onFps(param1:uint) : void + { + var _loc2_:Object = null; + if(this._fpsDisplay.visible) + { + _loc2_ = RasterizedAnimation.countFrames(); + this._fpsDisplay.htmlText = "" + param1 + " fps - " + this._buildType + "\n" + Memory.humanReadableUsage() + " - r" + BuildInfos.BUILD_REVISION + "\n Anim/Img en cache - " + _loc2_.animations + "/" + _loc2_.frames; + } + } + + private function saveClientSize() : void + { + var _loc1_:CustomSharedObject = CustomSharedObject.getLocal("clientData"); + _loc1_.data.height = this._stageHeight; + _loc1_.data.width = this._stageWidth; + _loc1_.data.displayState = this._displayState; + _loc1_.flush(); + _loc1_.close(); + } + + public var strProgress:Number = 0; + + public var strComplete:Boolean = false; + + public function strLoaderComplete() : void + { + this.strComplete = true; + } + + public function getLoadingProgress() : Number + { + return this.strProgress; + } + } +} diff --git a/Dynamic.as b/Dynamic.as index c306de112..8972b3b19 100644 --- a/Dynamic.as +++ b/Dynamic.as @@ -1,12 +1,10 @@ -package +package { - public class Dynamic - { - - public function Dynamic():void - { - } - - } -}//package - + public class Dynamic extends Object + { + + public function Dynamic() + { + } + } +} diff --git a/README.md b/README.md index b8abe3e6a..2207aeb58 100644 --- a/README.md +++ b/README.md @@ -5,10 +5,11 @@ Decompilation of Dofus Beta client version : - 2.22 - 2.23 -- 2.26 _(current)_ +- 2.26 +- 2.28 _(current)_ Ui Modules version : -- 2.26 _(current)_ +- 2.26 To see previous versions, please check old commits and [master](https://github.com/Emudofus/Dofus/tree/master) branch. diff --git a/com/TubulConstants.as b/com/TubulConstants.as index 5b4e47ed9..b904ba8f4 100644 --- a/com/TubulConstants.as +++ b/com/TubulConstants.as @@ -1,19 +1,29 @@ -package com +package com { - public class TubulConstants - { - - public static const PREFIXE_LOADER:String = "RES_"; - public static const SOUND_CHANNEL_POOL_INITIAL_SIZE:int = 5; - public static const SOUND_CHANNEL_POOL_GROW_SIZE:int = 10; - public static const SOUND_CHANNEL_POOL_WARN_LIMIT:int = 50; - public static const MAXIMUM_BOUNDS_CACHE:int = 10; - public static const MAXIMUM_SOUNDS_PLAYING_SAME_TIME:int = 30; - public static const BUFFER_SIZE:uint = 0x2000; - public static const BUFFER_SIZE_MUSIC:uint = 0x2000; - public static const BOUNDS_BYTEARRAY_CACHE:uint = 20; - - - } -}//package com - + public class TubulConstants extends Object + { + + public function TubulConstants() + { + super(); + } + + public static const PREFIXE_LOADER:String = "RES_"; + + public static const SOUND_CHANNEL_POOL_INITIAL_SIZE:int = 5; + + public static const SOUND_CHANNEL_POOL_GROW_SIZE:int = 10; + + public static const SOUND_CHANNEL_POOL_WARN_LIMIT:int = 50; + + public static const MAXIMUM_BOUNDS_CACHE:int = 10; + + public static const MAXIMUM_SOUNDS_PLAYING_SAME_TIME:int = 30; + + public static const BUFFER_SIZE:uint = 8192; + + public static const BUFFER_SIZE_MUSIC:uint = 8192; + + public static const BOUNDS_BYTEARRAY_CACHE:uint = 20; + } +} diff --git a/com/adobe/utils/StringUtil.as b/com/adobe/utils/StringUtil.as index 923705d32..c337fb318 100644 --- a/com/adobe/utils/StringUtil.as +++ b/com/adobe/utils/StringUtil.as @@ -1,79 +1,80 @@ -package com.adobe.utils +package com.adobe.utils { - public class StringUtil - { - - - public static function beginsWith(input:String, prefix:String):Boolean - { - return ((prefix == input.substring(0, prefix.length))); - } - - public static function trim(input:String):String - { - return (StringUtil.ltrim(StringUtil.rtrim(input))); - } - - public static function stringsAreEqual(s1:String, s2:String, caseSensitive:Boolean):Boolean - { - if (caseSensitive) + public class StringUtil extends Object + { + + public function StringUtil() + { + super(); + } + + public static function beginsWith(param1:String, param2:String) : Boolean + { + return param2 == param1.substring(0,param2.length); + } + + public static function trim(param1:String) : String + { + return StringUtil.ltrim(StringUtil.rtrim(param1)); + } + + public static function stringsAreEqual(param1:String, param2:String, param3:Boolean) : Boolean + { + if(param3) + { + return param1 == param2; + } + return param1.toUpperCase() == param2.toUpperCase(); + } + + public static function replace(param1:String, param2:String, param3:String) : String + { + return param1.split(param2).join(param3); + } + + public static function rtrim(param1:String) : String + { + var _loc2_:Number = param1.length; + var _loc3_:Number = _loc2_; + while(_loc3_ > 0) + { + if(param1.charCodeAt(_loc3_ - 1) > 32) { - return ((s1 == s2)); - }; - return ((s1.toUpperCase() == s2.toUpperCase())); - } - - public static function replace(input:String, replace:String, replaceWith:String):String - { - return (input.split(replace).join(replaceWith)); - } - - public static function rtrim(input:String):String - { - var size:Number = input.length; - var i:Number = size; - while (i > 0) + return param1.substring(0,_loc3_); + } + _loc3_--; + } + return ""; + } + + public static function endsWith(param1:String, param2:String) : Boolean + { + return param2 == param1.substring(param1.length - param2.length); + } + + public static function stringHasValue(param1:String) : Boolean + { + return !(param1 == null) && param1.length > 0; + } + + public static function remove(param1:String, param2:String) : String + { + return StringUtil.replace(param1,param2,""); + } + + public static function ltrim(param1:String) : String + { + var _loc2_:Number = param1.length; + var _loc3_:Number = 0; + while(_loc3_ < _loc2_) + { + if(param1.charCodeAt(_loc3_) > 32) { - if (input.charCodeAt((i - 1)) > 32) - { - return (input.substring(0, i)); - }; - i--; - }; - return (""); - } - - public static function endsWith(input:String, suffix:String):Boolean - { - return ((suffix == input.substring((input.length - suffix.length)))); - } - - public static function stringHasValue(s:String):Boolean - { - return (((!((s == null))) && ((s.length > 0)))); - } - - public static function remove(input:String, remove:String):String - { - return (StringUtil.replace(input, remove, "")); - } - - public static function ltrim(input:String):String - { - var size:Number = input.length; - var i:Number = 0; - while (i < size) - { - if (input.charCodeAt(i) > 32) - { - return (input.substring(i)); - }; - i++; - }; - return (""); - } - - - } -}//package com.adobe.utils - + return param1.substring(_loc3_); + } + _loc3_++; + } + return ""; + } + } +} diff --git a/com/ankamagames/atouin/Atouin.as b/com/ankamagames/atouin/Atouin.as index e4479cbd7..ba723d56f 100644 --- a/com/ankamagames/atouin/Atouin.as +++ b/com/ankamagames/atouin/Atouin.as @@ -1,477 +1,486 @@ -package com.ankamagames.atouin +package com.ankamagames.atouin { - import com.ankamagames.jerakine.logger.Logger; - import com.ankamagames.jerakine.logger.Log; - import flash.utils.getQualifiedClassName; - import flash.display.DisplayObjectContainer; - import flash.display.Sprite; - import com.ankamagames.jerakine.messages.MessageHandler; - import com.ankamagames.atouin.types.AtouinOptions; - import com.ankamagames.atouin.utils.errors.AtouinError; - import com.ankamagames.jerakine.resources.adapters.AdapterFactory; - import com.ankamagames.atouin.resources.adapters.ElementsAdapter; - import com.ankamagames.atouin.resources.adapters.MapsAdapter; - import com.ankamagames.atouin.managers.InteractiveCellManager; - import flash.events.MouseEvent; - import com.ankamagames.atouin.managers.FrustumManager; - import com.ankamagames.jerakine.utils.display.StageShareManager; - import com.ankamagames.atouin.messages.MapContainerRollOverMessage; - import flash.events.Event; - import com.ankamagames.atouin.messages.MapContainerRollOutMessage; - import com.ankamagames.jerakine.utils.display.EnterFrameDispatcher; - import com.ankamagames.atouin.types.Frustum; - import com.ankamagames.atouin.managers.MapDisplayManager; - import com.ankamagames.jerakine.types.positions.WorldPoint; - import flash.utils.ByteArray; - import com.ankamagames.atouin.managers.EntitiesManager; - import com.ankamagames.jerakine.entities.interfaces.IEntity; - import flash.display.InteractiveObject; - import com.ankamagames.jerakine.types.positions.MapPoint; - import com.ankamagames.jerakine.interfaces.ISoundPositionListener; - import com.ankamagames.atouin.messages.MapZoomMessage; - import com.ankamagames.jerakine.resources.loaders.IResourceLoader; - import com.ankamagames.atouin.data.elements.Elements; - import com.ankamagames.jerakine.resources.loaders.ResourceLoaderFactory; - import com.ankamagames.jerakine.resources.loaders.ResourceLoaderType; - import com.ankamagames.jerakine.resources.events.ResourceErrorEvent; - import com.ankamagames.jerakine.types.Uri; - import com.ankamagames.jerakine.pathfinding.Pathfinding; - - public class Atouin - { - - protected static const _log:Logger = Log.getLogger(getQualifiedClassName(Atouin)); - private static var _self:Atouin; - - private var _worldContainer:DisplayObjectContainer; - private var _overlayContainer:Sprite; - private var _spMapContainer:Sprite; - private var _spGfxContainer:Sprite; - private var _spChgMapContainer:Sprite; - private var _worldMask:Sprite; - private var _currentZoom:Number = 1; - private var _zoomPosX:int; - private var _zoomPosY:int; - private var _movementListeners:Array; - private var _handler:MessageHandler; - private var _aSprites:Array; - private var _aoOptions:AtouinOptions; - private var _cursorUpdateSprite:Sprite; - - public function Atouin() - { - if (_self) - { - throw (new AtouinError("Atouin is a singleton class. Please acces it through getInstance()")); - }; - AdapterFactory.addAdapter("ele", ElementsAdapter); - AdapterFactory.addAdapter("dlm", MapsAdapter); + import com.ankamagames.jerakine.logger.Logger; + import com.ankamagames.jerakine.logger.Log; + import flash.utils.getQualifiedClassName; + import flash.display.DisplayObjectContainer; + import flash.display.Sprite; + import com.ankamagames.jerakine.messages.MessageHandler; + import com.ankamagames.atouin.types.AtouinOptions; + import com.ankamagames.atouin.managers.InteractiveCellManager; + import flash.events.MouseEvent; + import com.ankamagames.atouin.managers.FrustumManager; + import com.ankamagames.jerakine.utils.display.StageShareManager; + import flash.events.Event; + import com.ankamagames.atouin.messages.MapContainerRollOverMessage; + import com.ankamagames.atouin.messages.MapContainerRollOutMessage; + import com.ankamagames.jerakine.utils.display.EnterFrameDispatcher; + import com.ankamagames.atouin.types.Frustum; + import com.ankamagames.jerakine.types.positions.WorldPoint; + import com.ankamagames.atouin.managers.MapDisplayManager; + import flash.utils.ByteArray; + import com.ankamagames.jerakine.entities.interfaces.IEntity; + import com.ankamagames.atouin.managers.EntitiesManager; + import flash.display.InteractiveObject; + import com.ankamagames.jerakine.types.positions.MapPoint; + import com.ankamagames.jerakine.interfaces.ISoundPositionListener; + import com.ankamagames.atouin.messages.MapZoomMessage; + import com.ankamagames.jerakine.resources.loaders.IResourceLoader; + import com.ankamagames.atouin.data.elements.Elements; + import com.ankamagames.jerakine.resources.loaders.ResourceLoaderFactory; + import com.ankamagames.jerakine.resources.loaders.ResourceLoaderType; + import com.ankamagames.jerakine.resources.events.ResourceErrorEvent; + import com.ankamagames.jerakine.types.Uri; + import com.ankamagames.jerakine.pathfinding.Pathfinding; + import com.ankamagames.atouin.utils.errors.AtouinError; + import com.ankamagames.jerakine.resources.adapters.AdapterFactory; + import com.ankamagames.atouin.resources.adapters.ElementsAdapter; + import com.ankamagames.atouin.resources.adapters.MapsAdapter; + + public class Atouin extends Object + { + + public function Atouin() + { + super(); + if(_self) + { + throw new AtouinError("Atouin is a singleton class. Please acces it through getInstance()"); + } + else + { + AdapterFactory.addAdapter("ele",ElementsAdapter); + AdapterFactory.addAdapter("dlm",MapsAdapter); this._cursorUpdateSprite = new Sprite(); - this._cursorUpdateSprite.graphics.beginFill(0xFF00, 0); - this._cursorUpdateSprite.graphics.drawRect(0, 0, 6, 6); + this._cursorUpdateSprite.graphics.beginFill(65280,0); + this._cursorUpdateSprite.graphics.drawRect(0,0,6,6); this._cursorUpdateSprite.graphics.endFill(); this._cursorUpdateSprite.useHandCursor = true; - } - - public static function getInstance():Atouin - { - if (!(_self)) - { - _self = new (Atouin)(); - }; - return (_self); - } - - - public function get movementListeners():Array - { - return (this._movementListeners); - } - - public function get worldContainer():DisplayObjectContainer - { - return (this._spMapContainer); - } - - public function get selectionContainer():DisplayObjectContainer - { - var ctr:DisplayObjectContainer; - var i:int; - if (this._spMapContainer == null) - { - return (null); - }; - var len:Number = this._spMapContainer.numChildren; - if (len > 1) - { - i = 1; - while (((!(ctr)) && ((i < len)))) - { - ctr = (this._spMapContainer.getChildAt(i) as DisplayObjectContainer); - i++; - }; - }; - return (ctr); - } - - public function get chgMapContainer():DisplayObjectContainer - { - return (this._spChgMapContainer); - } - - public function get gfxContainer():DisplayObjectContainer - { - return (this._spGfxContainer); - } - - public function get overlayContainer():DisplayObjectContainer - { - return (this._overlayContainer); - } - - public function get handler():MessageHandler - { - return (this._handler); - } - - public function set handler(value:MessageHandler):void - { - this._handler = value; - } - - public function get options():AtouinOptions - { - return (this._aoOptions); - } - - public function get currentZoom():Number - { - return (this._currentZoom); - } - - public function set currentZoom(value:Number):void - { - this._currentZoom = value; - } - - public function get cellOverEnabled():Boolean - { - return (InteractiveCellManager.getInstance().cellOverEnabled); - } - - public function set cellOverEnabled(value:Boolean):void - { - InteractiveCellManager.getInstance().cellOverEnabled = value; - } - - public function get rootContainer():DisplayObjectContainer - { - return (this._worldContainer); - } - - public function get worldIsVisible():Boolean - { - return (this._worldContainer.contains(this._spMapContainer)); - } - - public function setDisplayOptions(ao:AtouinOptions):void - { - this._aoOptions = ao; - this._worldContainer = ao.container; - this._handler = ao.handler; - var i:uint; - while (i < this._worldContainer.numChildren) - { - this._worldContainer.removeChildAt(i); - i++; - }; - this._overlayContainer = new Sprite(); - this._spMapContainer = new Sprite(); - this._spChgMapContainer = new Sprite(); - this._spGfxContainer = new Sprite(); - this._worldContainer.mouseEnabled = false; - this._spMapContainer.addEventListener(MouseEvent.ROLL_OUT, this.onRollOutMapContainer); - this._spMapContainer.addEventListener(MouseEvent.ROLL_OVER, this.onRollOverMapContainer); - this._spMapContainer.tabChildren = false; - this._spMapContainer.mouseEnabled = false; - this._spChgMapContainer.tabChildren = false; - this._spChgMapContainer.mouseEnabled = false; - this._spGfxContainer.tabChildren = false; - this._spGfxContainer.mouseEnabled = false; - this._spGfxContainer.mouseChildren = false; - this._overlayContainer.tabChildren = false; - this._overlayContainer.mouseEnabled = false; - this._worldContainer.addChild(this._spMapContainer); - this._worldContainer.addChild(this._spChgMapContainer); - this._worldContainer.addChild(this._spGfxContainer); - this._worldContainer.addChild(this._overlayContainer); - FrustumManager.getInstance().init(this._spChgMapContainer); - this._worldMask = new Sprite(); - this._worldMask.graphics.beginFill(0); - var w:int = StageShareManager.startWidth; - var h:int = StageShareManager.startHeight; - this._worldMask.graphics.drawRect(-2000, -2000, (4000 + w), (4000 + h)); - this._worldMask.graphics.drawRect(0, 0, w, h); - this._worldMask.graphics.endFill(); - DisplayObjectContainer(this._worldContainer.parent).addChild(this._worldMask); - this.setFrustrum(ao.frustum); - this.init(); - } - - public function onRollOverMapContainer(event:Event):void - { - var msg:MapContainerRollOverMessage = new MapContainerRollOverMessage(); - Atouin.getInstance().handler.process(msg); - } - - private function onRollOutMapContainer(event:Event):void - { - var msg:MapContainerRollOutMessage = new MapContainerRollOutMessage(); - Atouin.getInstance().handler.process(msg); - } - - public function updateCursor():void - { - this._cursorUpdateSprite.x = (StageShareManager.stage.mouseX - 3); - this._cursorUpdateSprite.y = (StageShareManager.stage.mouseY - 3); - StageShareManager.stage.addChild(this._cursorUpdateSprite); - EnterFrameDispatcher.addEventListener(this.removeUpdateCursorSprite, "UpdateCursorSprite", 50); - } - - public function showWorld(b:Boolean):void - { - this._spMapContainer.visible = b; - this._spChgMapContainer.visible = b; - this._spGfxContainer.visible = b; - this._overlayContainer.visible = b; - } - - public function setFrustrum(f:Frustum):void - { - if (!(this._aoOptions)) + return; + } + } + + protected static const _log:Logger = Log.getLogger(getQualifiedClassName(Atouin)); + + private static var _self:Atouin; + + public static function getInstance() : Atouin + { + if(!_self) + { + _self = new Atouin(); + } + return _self; + } + + private var _worldContainer:DisplayObjectContainer; + + private var _overlayContainer:Sprite; + + private var _spMapContainer:Sprite; + + private var _spGfxContainer:Sprite; + + private var _spChgMapContainer:Sprite; + + private var _worldMask:Sprite; + + private var _currentZoom:Number = 1; + + private var _zoomPosX:int; + + private var _zoomPosY:int; + + private var _movementListeners:Array; + + private var _handler:MessageHandler; + + private var _aSprites:Array; + + private var _aoOptions:AtouinOptions; + + private var _cursorUpdateSprite:Sprite; + + public function get movementListeners() : Array + { + return this._movementListeners; + } + + public function get worldContainer() : DisplayObjectContainer + { + return this._spMapContainer; + } + + public function get selectionContainer() : DisplayObjectContainer + { + var _loc2_:DisplayObjectContainer = null; + var _loc3_:* = 0; + if(this._spMapContainer == null) + { + return null; + } + var _loc1_:Number = this._spMapContainer.numChildren; + if(_loc1_ > 1) + { + _loc3_ = 1; + while(!_loc2_ && _loc3_ < _loc1_) { - _log.error("Please call setDisplayOptions once before calling setFrustrum"); - return; - }; - this._aoOptions.frustum = f; - this.worldContainer.scaleX = this._aoOptions.frustum.scale; - this.worldContainer.scaleY = this._aoOptions.frustum.scale; - this.worldContainer.x = this._aoOptions.frustum.x; - this.worldContainer.y = this._aoOptions.frustum.y; - this.gfxContainer.scaleX = this._aoOptions.frustum.scale; - this.gfxContainer.scaleY = this._aoOptions.frustum.scale; - this.gfxContainer.x = this._aoOptions.frustum.x; - this.gfxContainer.y = this._aoOptions.frustum.y; - this.overlayContainer.x = this._aoOptions.frustum.x; - this.overlayContainer.y = this._aoOptions.frustum.y; - this.overlayContainer.scaleX = this._aoOptions.frustum.scale; - this.overlayContainer.scaleY = this._aoOptions.frustum.scale; - FrustumManager.getInstance().frustum = f; - } - - public function initPreDisplay(wp:WorldPoint):void - { - if (((((((wp) && (MapDisplayManager.getInstance()))) && (MapDisplayManager.getInstance().currentMapPoint))) && ((MapDisplayManager.getInstance().currentMapPoint.mapId == wp.mapId)))) - { - return; - }; - MapDisplayManager.getInstance().capture(); - } - - public function display(wpMap:WorldPoint, decryptionKey:ByteArray=null):uint - { - return (MapDisplayManager.getInstance().display(wpMap, false, decryptionKey)); - } - - public function getEntity(id:int):IEntity - { - return (EntitiesManager.getInstance().getEntity(id)); - } - - public function getEntityOnCell(cellId:uint, oClass:*=null):IEntity - { - return (EntitiesManager.getInstance().getEntityOnCell(cellId, oClass)); - } - - public function clearEntities():void - { - EntitiesManager.getInstance().clearEntities(); - } - - public function reset():void - { - InteractiveCellManager.getInstance().clean(); - MapDisplayManager.getInstance().reset(); - EntitiesManager.getInstance().clearEntities(); - this.cancelZoom(); - if (this._spMapContainer.parent) + _loc2_ = this._spMapContainer.getChildAt(_loc3_) as DisplayObjectContainer; + _loc3_++; + } + } + return _loc2_; + } + + public function get chgMapContainer() : DisplayObjectContainer + { + return this._spChgMapContainer; + } + + public function get gfxContainer() : DisplayObjectContainer + { + return this._spGfxContainer; + } + + public function get overlayContainer() : DisplayObjectContainer + { + return this._overlayContainer; + } + + public function get handler() : MessageHandler + { + return this._handler; + } + + public function set handler(param1:MessageHandler) : void + { + this._handler = param1; + } + + public function get options() : AtouinOptions + { + return this._aoOptions; + } + + public function get currentZoom() : Number + { + return this._currentZoom; + } + + public function set currentZoom(param1:Number) : void + { + this._currentZoom = param1; + } + + public function get cellOverEnabled() : Boolean + { + return InteractiveCellManager.getInstance().cellOverEnabled; + } + + public function set cellOverEnabled(param1:Boolean) : void + { + InteractiveCellManager.getInstance().cellOverEnabled = param1; + } + + public function get rootContainer() : DisplayObjectContainer + { + return this._worldContainer; + } + + public function get worldIsVisible() : Boolean + { + return this._worldContainer.contains(this._spMapContainer); + } + + public function setDisplayOptions(param1:AtouinOptions) : void + { + this._aoOptions = param1; + this._worldContainer = param1.container; + this._handler = param1.handler; + var _loc2_:uint = 0; + while(_loc2_ < this._worldContainer.numChildren) + { + this._worldContainer.removeChildAt(_loc2_); + _loc2_++; + } + this._overlayContainer = new Sprite(); + this._spMapContainer = new Sprite(); + this._spChgMapContainer = new Sprite(); + this._spGfxContainer = new Sprite(); + this._worldContainer.mouseEnabled = false; + this._spMapContainer.addEventListener(MouseEvent.ROLL_OUT,this.onRollOutMapContainer); + this._spMapContainer.addEventListener(MouseEvent.ROLL_OVER,this.onRollOverMapContainer); + this._spMapContainer.tabChildren = false; + this._spMapContainer.mouseEnabled = false; + this._spChgMapContainer.tabChildren = false; + this._spChgMapContainer.mouseEnabled = false; + this._spGfxContainer.tabChildren = false; + this._spGfxContainer.mouseEnabled = false; + this._spGfxContainer.mouseChildren = false; + this._overlayContainer.tabChildren = false; + this._overlayContainer.mouseEnabled = false; + this._worldContainer.addChild(this._spMapContainer); + this._worldContainer.addChild(this._spChgMapContainer); + this._worldContainer.addChild(this._spGfxContainer); + this._worldContainer.addChild(this._overlayContainer); + FrustumManager.getInstance().init(this._spChgMapContainer); + this._worldMask = new Sprite(); + this._worldMask.graphics.beginFill(0); + var _loc3_:int = StageShareManager.startWidth; + var _loc4_:int = StageShareManager.startHeight; + this._worldMask.graphics.drawRect(-2000,-2000,4000 + _loc3_,4000 + _loc4_); + this._worldMask.graphics.drawRect(0,0,_loc3_,_loc4_); + this._worldMask.graphics.endFill(); + DisplayObjectContainer(this._worldContainer.parent).addChild(this._worldMask); + this.setFrustrum(param1.frustum); + this.init(); + } + + public function onRollOverMapContainer(param1:Event) : void + { + var _loc2_:MapContainerRollOverMessage = new MapContainerRollOverMessage(); + Atouin.getInstance().handler.process(_loc2_); + } + + private function onRollOutMapContainer(param1:Event) : void + { + var _loc2_:MapContainerRollOutMessage = new MapContainerRollOutMessage(); + Atouin.getInstance().handler.process(_loc2_); + } + + public function updateCursor() : void + { + this._cursorUpdateSprite.x = StageShareManager.stage.mouseX - 3; + this._cursorUpdateSprite.y = StageShareManager.stage.mouseY - 3; + StageShareManager.stage.addChild(this._cursorUpdateSprite); + EnterFrameDispatcher.addEventListener(this.removeUpdateCursorSprite,"UpdateCursorSprite",50); + } + + public function showWorld(param1:Boolean) : void + { + this._spMapContainer.visible = param1; + this._spChgMapContainer.visible = param1; + this._spGfxContainer.visible = param1; + this._overlayContainer.visible = param1; + } + + public function setFrustrum(param1:Frustum) : void + { + if(!this._aoOptions) + { + _log.error("Please call setDisplayOptions once before calling setFrustrum"); + return; + } + this._aoOptions.frustum = param1; + this.worldContainer.scaleX = this._aoOptions.frustum.scale; + this.worldContainer.scaleY = this._aoOptions.frustum.scale; + this.worldContainer.x = this._aoOptions.frustum.x; + this.worldContainer.y = this._aoOptions.frustum.y; + this.gfxContainer.scaleX = this._aoOptions.frustum.scale; + this.gfxContainer.scaleY = this._aoOptions.frustum.scale; + this.gfxContainer.x = this._aoOptions.frustum.x; + this.gfxContainer.y = this._aoOptions.frustum.y; + this.overlayContainer.x = this._aoOptions.frustum.x; + this.overlayContainer.y = this._aoOptions.frustum.y; + this.overlayContainer.scaleX = this._aoOptions.frustum.scale; + this.overlayContainer.scaleY = this._aoOptions.frustum.scale; + FrustumManager.getInstance().frustum = param1; + } + + public function initPreDisplay(param1:WorldPoint) : void + { + if((param1 && MapDisplayManager.getInstance()) && (MapDisplayManager.getInstance().currentMapPoint) && MapDisplayManager.getInstance().currentMapPoint.mapId == param1.mapId) + { + return; + } + MapDisplayManager.getInstance().capture(); + } + + public function display(param1:WorldPoint, param2:ByteArray = null) : uint + { + return MapDisplayManager.getInstance().display(param1,false,param2); + } + + public function getEntity(param1:int) : IEntity + { + return EntitiesManager.getInstance().getEntity(param1); + } + + public function getEntityOnCell(param1:uint, param2:* = null) : IEntity + { + return EntitiesManager.getInstance().getEntityOnCell(param1,param2); + } + + public function clearEntities() : void + { + EntitiesManager.getInstance().clearEntities(); + } + + public function reset() : void + { + InteractiveCellManager.getInstance().clean(); + MapDisplayManager.getInstance().reset(); + EntitiesManager.getInstance().clearEntities(); + this.cancelZoom(); + if(this._spMapContainer.parent) + { + this._worldContainer.removeChild(this._spMapContainer); + } + if(this._spChgMapContainer.parent) + { + this._worldContainer.removeChild(this._spChgMapContainer); + } + if(this._spGfxContainer.parent) + { + this._worldContainer.removeChild(this._spGfxContainer); + } + if(this._overlayContainer.parent) + { + this._worldContainer.removeChild(this._overlayContainer); + } + } + + public function displayGrid(param1:Boolean, param2:Boolean = false) : void + { + InteractiveCellManager.getInstance().show((param1) || (this.options.alwaysShowGrid),param2); + } + + public function getIdentifiedElement(param1:uint) : InteractiveObject + { + return MapDisplayManager.getInstance().getIdentifiedElement(param1); + } + + public function getIdentifiedElementPosition(param1:uint) : MapPoint + { + return MapDisplayManager.getInstance().getIdentifiedElementPosition(param1); + } + + public function addListener(param1:ISoundPositionListener) : void + { + if(this._movementListeners == null) + { + this._movementListeners = new Array(); + } + this._movementListeners.push(param1); + } + + public function removeListener(param1:ISoundPositionListener) : void + { + var _loc2_:int = Atouin.getInstance()._movementListeners.indexOf(param1); + if(_loc2_) + { + Atouin.getInstance()._movementListeners.splice(_loc2_,1); + } + } + + public function zoom(param1:Number, param2:int = 0, param3:int = 0) : void + { + var _loc5_:* = NaN; + if(param1 == 1) + { + this._worldContainer.scaleX = 1; + this._worldContainer.scaleY = 1; + this._worldContainer.x = 0; + this._worldContainer.y = 0; + this._currentZoom = 1; + MapDisplayManager.getInstance().cacheAsBitmapEnabled(true); + } + else + { + if(param1 < 1) { - this._worldContainer.removeChild(this._spMapContainer); - }; - if (this._spChgMapContainer.parent) + var param1:Number = 1; + } + else if(param1 > AtouinConstants.MAX_ZOOM) { - this._worldContainer.removeChild(this._spChgMapContainer); - }; - if (this._spGfxContainer.parent) + param1 = AtouinConstants.MAX_ZOOM; + } + + _loc5_ = this._currentZoom; + this._currentZoom = param1; + if(_loc5_ == this._currentZoom) { - this._worldContainer.removeChild(this._spGfxContainer); - }; - if (this._overlayContainer.parent) + return; + } + if(this._currentZoom != 1) { - this._worldContainer.removeChild(this._overlayContainer); - }; - } - - public function displayGrid(b:Boolean, pIsInFight:Boolean=false):void - { - InteractiveCellManager.getInstance().show(((b) || (this.options.alwaysShowGrid)), pIsInFight); - } - - public function getIdentifiedElement(id:uint):InteractiveObject - { - return (MapDisplayManager.getInstance().getIdentifiedElement(id)); - } - - public function getIdentifiedElementPosition(id:uint):MapPoint - { - return (MapDisplayManager.getInstance().getIdentifiedElementPosition(id)); - } - - public function addListener(pListener:ISoundPositionListener):void - { - if (this._movementListeners == null) + MapDisplayManager.getInstance().cacheAsBitmapEnabled(false); + } + if(param2) { - this._movementListeners = new Array(); - }; - this._movementListeners.push(pListener); - } - - public function removeListener(pListener:ISoundPositionListener):void - { - var index:int = Atouin.getInstance()._movementListeners.indexOf(pListener); - if (index) + this._zoomPosX = param2; + } + else { - Atouin.getInstance()._movementListeners.splice(index, 1); - }; - } - - public function zoom(value:Number, posX:int=0, posY:int=0):void - { - var _local_5:Number; - if (value == 1) + var param2:int = this._zoomPosX; + } + if(param3) { - this._worldContainer.scaleX = 1; - this._worldContainer.scaleY = 1; - this._worldContainer.x = 0; - this._worldContainer.y = 0; - this._currentZoom = 1; - MapDisplayManager.getInstance().cacheAsBitmapEnabled(true); + this._zoomPosY = param3; } else { - if (value < 1) - { - value = 1; - } - else - { - if (value > AtouinConstants.MAX_ZOOM) - { - value = AtouinConstants.MAX_ZOOM; - }; - }; - _local_5 = this._currentZoom; - this._currentZoom = value; - if (_local_5 == this._currentZoom) - { - return; - }; - if (this._currentZoom != 1) - { - MapDisplayManager.getInstance().cacheAsBitmapEnabled(false); - }; - if (posX) - { - this._zoomPosX = posX; - } - else - { - posX = this._zoomPosX; - }; - if (posY) - { - this._zoomPosY = posY; - } - else - { - posY = this._zoomPosY; - }; - this._worldContainer.x = (this._worldContainer.x - ((posX * this._currentZoom) - (posX * this._worldContainer.scaleX))); - this._worldContainer.y = (this._worldContainer.y - ((posY * this._currentZoom) - (posY * this._worldContainer.scaleY))); - this._worldContainer.scaleX = this._currentZoom; - this._worldContainer.scaleY = this._currentZoom; - if (this._worldContainer.x > 0) - { - this._worldContainer.x = 0; - } - else - { - if (this._worldContainer.x < (1276 - (1276 * this._currentZoom))) - { - this._worldContainer.x = (1276 - (1276 * this._currentZoom)); - }; - }; - if (this._worldContainer.y > 0) - { - this._worldContainer.y = 0; - } - else - { - if (this._worldContainer.y < (876 - (876 * this._currentZoom))) - { - this._worldContainer.y = (876 - (876 * this._currentZoom)); - }; - }; - }; - var mzm:MapZoomMessage = new MapZoomMessage(value, posX, posY); - Atouin.getInstance().handler.process(mzm); - } - - public function cancelZoom():void - { - if (this._currentZoom != 1) + var param3:int = this._zoomPosY; + } + this._worldContainer.x = this._worldContainer.x - (param2 * this._currentZoom - param2 * this._worldContainer.scaleX); + this._worldContainer.y = this._worldContainer.y - (param3 * this._currentZoom - param3 * this._worldContainer.scaleY); + this._worldContainer.scaleX = this._currentZoom; + this._worldContainer.scaleY = this._currentZoom; + if(this._worldContainer.x > 0) + { + this._worldContainer.x = 0; + } + else if(this._worldContainer.x < 1276 - 1276 * this._currentZoom) { - this.zoom(1); - }; - } - - private function removeUpdateCursorSprite(e:Event):void - { - EnterFrameDispatcher.removeEventListener(this.removeUpdateCursorSprite); - if (this._cursorUpdateSprite.parent) + this._worldContainer.x = 1276 - 1276 * this._currentZoom; + } + + if(this._worldContainer.y > 0) { - this._cursorUpdateSprite.parent.removeChild(this._cursorUpdateSprite); - }; - } - - private function init():void - { - var elementsLoader:IResourceLoader; - this._aSprites = new Array(); - if (!(Elements.getInstance().parsed)) + this._worldContainer.y = 0; + } + else if(this._worldContainer.y < 876 - 876 * this._currentZoom) { - elementsLoader = ResourceLoaderFactory.getLoader(ResourceLoaderType.SINGLE_LOADER); - elementsLoader.addEventListener(ResourceErrorEvent.ERROR, this.onElementsError); - elementsLoader.load(new Uri(Atouin.getInstance().options.elementsIndexPath)); - }; - Pathfinding.init(AtouinConstants.PATHFINDER_MIN_X, AtouinConstants.PATHFINDER_MAX_X, AtouinConstants.PATHFINDER_MIN_Y, AtouinConstants.PATHFINDER_MAX_Y); - } - - private function onElementsError(ree:ResourceErrorEvent):void - { - } - - - } -}//package com.ankamagames.atouin - + this._worldContainer.y = 876 - 876 * this._currentZoom; + } + + } + var _loc4_:MapZoomMessage = new MapZoomMessage(param1,param2,param3); + Atouin.getInstance().handler.process(_loc4_); + } + + public function cancelZoom() : void + { + if(this._currentZoom != 1) + { + this.zoom(1); + } + } + + private function removeUpdateCursorSprite(param1:Event) : void + { + EnterFrameDispatcher.removeEventListener(this.removeUpdateCursorSprite); + if(this._cursorUpdateSprite.parent) + { + this._cursorUpdateSprite.parent.removeChild(this._cursorUpdateSprite); + } + } + + private function init() : void + { + var _loc1_:IResourceLoader = null; + this._aSprites = new Array(); + if(!Elements.getInstance().parsed) + { + _loc1_ = ResourceLoaderFactory.getLoader(ResourceLoaderType.SINGLE_LOADER); + _loc1_.addEventListener(ResourceErrorEvent.ERROR,this.onElementsError); + _loc1_.load(new Uri(Atouin.getInstance().options.elementsIndexPath)); + } + Pathfinding.init(AtouinConstants.PATHFINDER_MIN_X,AtouinConstants.PATHFINDER_MAX_X,AtouinConstants.PATHFINDER_MIN_Y,AtouinConstants.PATHFINDER_MAX_Y); + } + + private function onElementsError(param1:ResourceErrorEvent) : void + { + } + } +} diff --git a/com/ankamagames/atouin/AtouinConstants.as b/com/ankamagames/atouin/AtouinConstants.as index d21fb41e6..35595319d 100644 --- a/com/ankamagames/atouin/AtouinConstants.as +++ b/com/ankamagames/atouin/AtouinConstants.as @@ -1,45 +1,79 @@ -package com.ankamagames.atouin +package com.ankamagames.atouin { - import flash.geom.Point; - - public class AtouinConstants - { - - public static const DEBUG_FILES_PARSING:Boolean = false; - public static const DEBUG_FILES_PARSING_ELEMENTS:Boolean = false; - public static const MAP_WIDTH:uint = 14; - public static const MAP_HEIGHT:uint = 20; - public static const MAP_CELLS_COUNT:uint = 560; - public static const CELL_WIDTH:uint = 86; - public static const CELL_HALF_WIDTH:uint = 43; - public static const CELL_HEIGHT:uint = 43; - public static const CELL_HALF_HEIGHT:Number = 21.5; - public static const ALTITUDE_PIXEL_UNIT:uint = 10; - public static const LOADERS_POOL_INITIAL_SIZE:int = 30; - public static const LOADERS_POOL_GROW_SIZE:int = 5; - public static const LOADERS_POOL_WARN_LIMIT:int = 100; - public static const OVERLAY_MODE_ALPHA:Number = 0.7; - public static const MAX_ZOOM:int = 4; - public static const MAX_GROUND_CACHE_MEMORY:int = 5; - public static const GROUND_MAP_VERSION:int = 1; - public static const MIN_DISK_SPACE_AVAILABLE:Number = (Math.pow(2, 20) * 0x0200); - public static const PSEUDO_INFINITE:int = 63; - public static const PATHFINDER_MIN_X:int = 0; - public static const PATHFINDER_MAX_X:int = (33 + 1);//34 - public static const PATHFINDER_MIN_Y:int = -19; - public static const PATHFINDER_MAX_Y:int = (13 + 1);//14 - public static const VIEW_DETECT_CELL_WIDTH:int = (2 * CELL_WIDTH);//172 - public static const MIN_MAP_X:int = -255; - public static const MAX_MAP_X:int = 0xFF; - public static const MIN_MAP_Y:int = -255; - public static const MAX_MAP_Y:int = 0xFF; - public static const RESOLUTION_HIGH_QUALITY:Point = new Point(1276, 876); - public static const RESOLUTION_MEDIUM_QUALITY:Point = new Point(957, 657); - public static const RESOLUTION_LOW_QUALITY:Point = new Point(638, 438); - public static const MOVEMENT_WALK:uint = 1; - public static const MOVEMENT_NORMAL:uint = 2; - - - } -}//package com.ankamagames.atouin - + import flash.geom.Point; + + public class AtouinConstants extends Object + { + + public function AtouinConstants() + { + super(); + } + + public static const DEBUG_FILES_PARSING:Boolean = false; + + public static const DEBUG_FILES_PARSING_ELEMENTS:Boolean = false; + + public static const MAP_WIDTH:uint = 14; + + public static const MAP_HEIGHT:uint = 20; + + public static const MAP_CELLS_COUNT:uint = 560; + + public static const CELL_WIDTH:uint = 86; + + public static const CELL_HALF_WIDTH:uint = 43; + + public static const CELL_HEIGHT:uint = 43; + + public static const CELL_HALF_HEIGHT:Number = 21.5; + + public static const ALTITUDE_PIXEL_UNIT:uint = 10; + + public static const LOADERS_POOL_INITIAL_SIZE:int = 30; + + public static const LOADERS_POOL_GROW_SIZE:int = 5; + + public static const LOADERS_POOL_WARN_LIMIT:int = 100; + + public static const OVERLAY_MODE_ALPHA:Number = 0.7; + + public static const MAX_ZOOM:int = 4; + + public static const MAX_GROUND_CACHE_MEMORY:int = 5; + + public static const GROUND_MAP_VERSION:int = 1; + + public static const MIN_DISK_SPACE_AVAILABLE:Number = Math.pow(2,20) * 512; + + public static const PSEUDO_INFINITE:int = 63; + + public static const PATHFINDER_MIN_X:int = 0; + + public static const PATHFINDER_MAX_X:int = 33 + 1; + + public static const PATHFINDER_MIN_Y:int = -19; + + public static const PATHFINDER_MAX_Y:int = 13 + 1; + + public static const VIEW_DETECT_CELL_WIDTH:int = 2 * CELL_WIDTH; + + public static const MIN_MAP_X:int = -255; + + public static const MAX_MAP_X:int = 255; + + public static const MIN_MAP_Y:int = -255; + + public static const MAX_MAP_Y:int = 255; + + public static const RESOLUTION_HIGH_QUALITY:Point = new Point(1276,876); + + public static const RESOLUTION_MEDIUM_QUALITY:Point = new Point(957,657); + + public static const RESOLUTION_LOW_QUALITY:Point = new Point(638,438); + + public static const MOVEMENT_WALK:uint = 1; + + public static const MOVEMENT_NORMAL:uint = 2; + } +} diff --git a/com/ankamagames/atouin/data/DataFormatError.as b/com/ankamagames/atouin/data/DataFormatError.as index e0150bf3a..b7f303421 100644 --- a/com/ankamagames/atouin/data/DataFormatError.as +++ b/com/ankamagames/atouin/data/DataFormatError.as @@ -1,13 +1,11 @@ -package com.ankamagames.atouin.data +package com.ankamagames.atouin.data { - public class DataFormatError extends Error - { - - public function DataFormatError(message:String="", id:uint=0) - { - super(message, id); - } - - } -}//package com.ankamagames.atouin.data - + public class DataFormatError extends Error + { + + public function DataFormatError(param1:String = "", param2:uint = 0) + { + super(param1,param2); + } + } +} diff --git a/com/ankamagames/atouin/data/DefaultMap.as b/com/ankamagames/atouin/data/DefaultMap.as index 89020984b..d14855033 100644 --- a/com/ankamagames/atouin/data/DefaultMap.as +++ b/com/ankamagames/atouin/data/DefaultMap.as @@ -1,57 +1,54 @@ -package com.ankamagames.atouin.data +package com.ankamagames.atouin.data { - import com.ankamagames.atouin.data.map.Map; - import com.ankamagames.atouin.data.map.CellData; - import com.ankamagames.atouin.data.map.Layer; - import com.ankamagames.atouin.AtouinConstants; - import flash.utils.IDataInput; - import flash.utils.ByteArray; - import com.ankamagames.atouin.data.map.Cell; - - public class DefaultMap extends Map - { - - public function DefaultMap(id:uint=0) - { - var l:int; - var cd:CellData; - super(); - this.id = id; - mapVersion = 7; - backgroundFixtures = new Array(); - foregroundFixtures = new Array(); - layers = new Array(); - layers.push(this.createLayer(Layer.LAYER_GROUND)); - layers.push(this.createLayer(Layer.LAYER_DECOR)); - cells = new Array(); - cellsCount = AtouinConstants.MAP_CELLS_COUNT; - l = 0; - while (l < cellsCount) - { - cd = new CellData(this, l); - cells.push(cd); - l++; - }; - } - - override public function fromRaw(raw:IDataInput, decryptionKey:ByteArray=null):void - { - } - - private function createLayer(id:uint):Layer - { - var bgLayer:Layer; - bgLayer = new Layer(this); - bgLayer.cells = new Array(); - bgLayer.layerId = id; - bgLayer.cellsCount = 1; - var firstCell:Cell = new Cell(bgLayer); - firstCell.elements = new Array(); - bgLayer.cells.push(firstCell); - return (bgLayer); - } - - - } -}//package com.ankamagames.atouin.data - + import com.ankamagames.atouin.data.map.Map; + import flash.utils.IDataInput; + import flash.utils.ByteArray; + import com.ankamagames.atouin.data.map.Layer; + import com.ankamagames.atouin.data.map.Cell; + import com.ankamagames.atouin.data.map.CellData; + import com.ankamagames.atouin.AtouinConstants; + + public class DefaultMap extends Map + { + + public function DefaultMap(param1:uint = 0) + { + var _loc2_:* = 0; + var _loc3_:CellData = null; + super(); + this.id = param1; + mapVersion = 7; + backgroundFixtures = new Array(); + foregroundFixtures = new Array(); + layers = new Array(); + layers.push(this.createLayer(Layer.LAYER_GROUND)); + layers.push(this.createLayer(Layer.LAYER_DECOR)); + cells = new Array(); + cellsCount = AtouinConstants.MAP_CELLS_COUNT; + _loc2_ = 0; + while(_loc2_ < cellsCount) + { + _loc3_ = new CellData(this,_loc2_); + cells.push(_loc3_); + _loc2_++; + } + } + + override public function fromRaw(param1:IDataInput, param2:ByteArray = null) : void + { + } + + private function createLayer(param1:uint) : Layer + { + var _loc2_:Layer = null; + _loc2_ = new Layer(this); + _loc2_.cells = new Array(); + _loc2_.layerId = param1; + _loc2_.cellsCount = 1; + var _loc3_:Cell = new Cell(_loc2_); + _loc3_.elements = new Array(); + _loc2_.cells.push(_loc3_); + return _loc2_; + } + } +} diff --git a/com/ankamagames/atouin/data/elements/Elements.as b/com/ankamagames/atouin/data/elements/Elements.as index 078ece3b5..06291a780 100644 --- a/com/ankamagames/atouin/data/elements/Elements.as +++ b/com/ankamagames/atouin/data/elements/Elements.as @@ -1,152 +1,165 @@ -package com.ankamagames.atouin.data.elements +package com.ankamagames.atouin.data.elements { - import com.ankamagames.jerakine.logger.Logger; - import com.ankamagames.jerakine.logger.Log; - import flash.utils.getQualifiedClassName; - import flash.utils.Dictionary; - import flash.utils.IDataInput; - import com.ankamagames.jerakine.utils.errors.SingletonError; - import com.ankamagames.atouin.data.DataFormatError; - import com.ankamagames.atouin.AtouinConstants; - - public class Elements - { - - private static var _self:Elements; - protected static const _log:Logger = Log.getLogger(getQualifiedClassName(Elements)); - - public var fileVersion:uint; - public var elementsCount:uint; - private var _parsed:Boolean; - private var _failed:Boolean; - private var _elementsMap:Dictionary; - private var _jpgMap:Dictionary; - private var _elementsIndex:Dictionary; - private var _rawData:IDataInput; - - public function Elements():void - { - if (_self) + import com.ankamagames.jerakine.logger.Logger; + import com.ankamagames.jerakine.logger.Log; + import flash.utils.getQualifiedClassName; + import flash.utils.Dictionary; + import flash.utils.IDataInput; + import com.ankamagames.atouin.data.DataFormatError; + import com.ankamagames.atouin.AtouinConstants; + import com.ankamagames.jerakine.utils.errors.SingletonError; + + public class Elements extends Object + { + + public function Elements() + { + super(); + if(_self) + { + throw new SingletonError(); + } + else + { + return; + } + } + + private static var _self:Elements; + + public static function getInstance() : Elements + { + if(!_self) + { + _self = new Elements(); + } + return _self; + } + + protected static const _log:Logger = Log.getLogger(getQualifiedClassName(Elements)); + + public var fileVersion:uint; + + public var elementsCount:uint; + + private var _parsed:Boolean; + + private var _failed:Boolean; + + private var _elementsMap:Dictionary; + + private var _jpgMap:Dictionary; + + private var _elementsIndex:Dictionary; + + private var _rawData:IDataInput; + + public function get parsed() : Boolean + { + return this._parsed; + } + + public function get failed() : Boolean + { + return this._failed; + } + + public function getElementData(param1:int) : GraphicalElementData + { + return this._elementsMap[param1]?GraphicalElementData(this._elementsMap[param1]):this.readElement(param1); + } + + public function isJpg(param1:uint) : Boolean + { + return this._jpgMap[param1] == true; + } + + public function fromRaw(param1:IDataInput) : void + { + var header:int = 0; + var skypLen:uint = 0; + var i:int = 0; + var edId:int = 0; + var gfxCount:int = 0; + var gfxId:int = 0; + var raw:IDataInput = param1; + try + { + header = raw.readByte(); + if(header != 69) { - throw (new SingletonError()); - }; - } - - public static function getInstance():Elements - { - if (!(_self)) - { - _self = new (Elements)(); - }; - return (_self); - } - - - public function get parsed():Boolean - { - return (this._parsed); - } - - public function get failed():Boolean - { - return (this._failed); - } - - public function getElementData(elementId:int):GraphicalElementData - { - return (((this._elementsMap[elementId]) ? GraphicalElementData(this._elementsMap[elementId]) : this.readElement(elementId))); - } - - public function isJpg(gfxId:uint):Boolean - { - return ((this._jpgMap[gfxId] == true)); - } - - public function fromRaw(raw:IDataInput):void - { - var header:int; - var skypLen:uint; - var i:int; - var edId:int; - var gfxCount:int; - var gfxId:int; - try - { - header = raw.readByte(); - if (header != 69) - { - throw (new DataFormatError("Unknown file format")); - }; - this._rawData = raw; - this.fileVersion = raw.readByte(); - if (AtouinConstants.DEBUG_FILES_PARSING_ELEMENTS) - { - _log.debug(("File version : " + this.fileVersion)); - }; - this.elementsCount = raw.readUnsignedInt(); - if (AtouinConstants.DEBUG_FILES_PARSING_ELEMENTS) - { - _log.debug(("Elements count : " + this.elementsCount)); - }; - this._elementsMap = new Dictionary(); - this._elementsIndex = new Dictionary(); - skypLen = 0; - i = 0; - while (i < this.elementsCount) - { - if (this.fileVersion >= 9) - { - skypLen = raw.readUnsignedShort(); - }; - edId = raw.readInt(); - if (this.fileVersion <= 8) - { - this._elementsIndex[edId] = raw["position"]; - this.readElement(edId); - } - else - { - this._elementsIndex[edId] = raw["position"]; - raw["position"] = (raw["position"] + (skypLen - 4)); - }; - i = (i + 1); - }; - if (this.fileVersion >= 8) - { - gfxCount = raw.readInt(); - this._jpgMap = new Dictionary(); - i = 0; - while (i < gfxCount) - { - gfxId = raw.readInt(); - this._jpgMap[gfxId] = true; - i = (i + 1); - }; - }; - this._parsed = true; + throw new DataFormatError("Unknown file format"); } - catch(e) + else { - _failed = true; - throw (e); - }; - } - - private function readElement(edId:uint):GraphicalElementData - { - this._rawData["position"] = this._elementsIndex[edId]; - var edType:int = this._rawData.readByte(); - var ed:GraphicalElementData = GraphicalElementFactory.getGraphicalElementData(edId, edType); - if (!(ed)) - { - return (null); - }; - ed.fromRaw(this._rawData, this.fileVersion); - this._elementsMap[edId] = ed; - return (ed); - } - - - } -}//package com.ankamagames.atouin.data.elements - + this._rawData = raw; + this.fileVersion = raw.readByte(); + if(AtouinConstants.DEBUG_FILES_PARSING_ELEMENTS) + { + _log.debug("File version : " + this.fileVersion); + } + this.elementsCount = raw.readUnsignedInt(); + if(AtouinConstants.DEBUG_FILES_PARSING_ELEMENTS) + { + _log.debug("Elements count : " + this.elementsCount); + } + this._elementsMap = new Dictionary(); + this._elementsIndex = new Dictionary(); + skypLen = 0; + i = 0; + while(i < this.elementsCount) + { + if(this.fileVersion >= 9) + { + skypLen = raw.readUnsignedShort(); + } + edId = raw.readInt(); + if(this.fileVersion <= 8) + { + this._elementsIndex[edId] = raw["position"]; + this.readElement(edId); + } + else + { + this._elementsIndex[edId] = raw["position"]; + raw["position"] = raw["position"] + (skypLen - 4); + } + i++; + } + if(this.fileVersion >= 8) + { + gfxCount = raw.readInt(); + this._jpgMap = new Dictionary(); + i = 0; + while(i < gfxCount) + { + gfxId = raw.readInt(); + this._jpgMap[gfxId] = true; + i++; + } + } + this._parsed = true; + } + } + catch(e:*) + { + _failed = true; + throw e; + } + } + + private function readElement(param1:uint) : GraphicalElementData + { + this._rawData["position"] = this._elementsIndex[param1]; + var _loc2_:int = this._rawData.readByte(); + var _loc3_:GraphicalElementData = GraphicalElementFactory.getGraphicalElementData(param1,_loc2_); + if(!_loc3_) + { + return null; + } + _loc3_.fromRaw(this._rawData,this.fileVersion); + this._elementsMap[param1] = _loc3_; + return _loc3_; + } + } +} diff --git a/com/ankamagames/atouin/data/elements/GraphicalElementData.as b/com/ankamagames/atouin/data/elements/GraphicalElementData.as index f312ec37e..120372d5a 100644 --- a/com/ankamagames/atouin/data/elements/GraphicalElementData.as +++ b/com/ankamagames/atouin/data/elements/GraphicalElementData.as @@ -1,31 +1,30 @@ -package com.ankamagames.atouin.data.elements +package com.ankamagames.atouin.data.elements { - import com.ankamagames.jerakine.logger.Logger; - import com.ankamagames.jerakine.logger.Log; - import flash.utils.getQualifiedClassName; - import com.ankamagames.jerakine.utils.errors.AbstractMethodCallError; - import flash.utils.IDataInput; - - public class GraphicalElementData - { - - protected static const _log:Logger = Log.getLogger(getQualifiedClassName(GraphicalElementData)); - - public var id:int; - public var type:int; - - public function GraphicalElementData(elementId:int, elementType:int) - { - this.id = elementId; - this.type = elementType; - } - - public function fromRaw(raw:IDataInput, version:int):void - { - throw (new AbstractMethodCallError()); - } - - - } -}//package com.ankamagames.atouin.data.elements - + import com.ankamagames.jerakine.logger.Logger; + import com.ankamagames.jerakine.logger.Log; + import flash.utils.getQualifiedClassName; + import flash.utils.IDataInput; + import com.ankamagames.jerakine.utils.errors.AbstractMethodCallError; + + public class GraphicalElementData extends Object + { + + public function GraphicalElementData(param1:int, param2:int) + { + super(); + this.id = param1; + this.type = param2; + } + + protected static const _log:Logger = Log.getLogger(getQualifiedClassName(GraphicalElementData)); + + public var id:int; + + public var type:int; + + public function fromRaw(param1:IDataInput, param2:int) : void + { + throw new AbstractMethodCallError(); + } + } +} diff --git a/com/ankamagames/atouin/data/elements/GraphicalElementFactory.as b/com/ankamagames/atouin/data/elements/GraphicalElementFactory.as index 50ab53f4e..03d4519e2 100644 --- a/com/ankamagames/atouin/data/elements/GraphicalElementFactory.as +++ b/com/ankamagames/atouin/data/elements/GraphicalElementFactory.as @@ -1,39 +1,41 @@ -package com.ankamagames.atouin.data.elements +package com.ankamagames.atouin.data.elements { - import com.ankamagames.atouin.data.elements.subtypes.NormalGraphicalElementData; - import com.ankamagames.atouin.data.elements.subtypes.BoundingBoxGraphicalElementData; - import com.ankamagames.atouin.data.elements.subtypes.AnimatedGraphicalElementData; - import com.ankamagames.atouin.data.elements.subtypes.EntityGraphicalElementData; - import com.ankamagames.atouin.data.elements.subtypes.ParticlesGraphicalElementData; - import com.ankamagames.atouin.data.elements.subtypes.BlendedGraphicalElementData; - import com.ankamagames.jerakine.managers.ErrorManager; - - public class GraphicalElementFactory - { - - - public static function getGraphicalElementData(elementId:int, elementType:int):GraphicalElementData - { - switch (elementType) - { - case GraphicalElementTypes.NORMAL: - return (new NormalGraphicalElementData(elementId, elementType)); - case GraphicalElementTypes.BOUNDING_BOX: - return (new BoundingBoxGraphicalElementData(elementId, elementType)); - case GraphicalElementTypes.ANIMATED: - return (new AnimatedGraphicalElementData(elementId, elementType)); - case GraphicalElementTypes.ENTITY: - return (new EntityGraphicalElementData(elementId, elementType)); - case GraphicalElementTypes.PARTICLES: - return (new ParticlesGraphicalElementData(elementId, elementType)); - case GraphicalElementTypes.BLENDED: - return (new BlendedGraphicalElementData(elementId, elementType)); - }; - ErrorManager.addError((((("Unknown graphical element data type " + elementType) + " for element ") + elementId) + "!"), false); - return (null); - } - - - } -}//package com.ankamagames.atouin.data.elements - + import com.ankamagames.atouin.data.elements.subtypes.NormalGraphicalElementData; + import com.ankamagames.atouin.data.elements.subtypes.BoundingBoxGraphicalElementData; + import com.ankamagames.atouin.data.elements.subtypes.AnimatedGraphicalElementData; + import com.ankamagames.atouin.data.elements.subtypes.EntityGraphicalElementData; + import com.ankamagames.atouin.data.elements.subtypes.ParticlesGraphicalElementData; + import com.ankamagames.atouin.data.elements.subtypes.BlendedGraphicalElementData; + import com.ankamagames.jerakine.managers.ErrorManager; + + public class GraphicalElementFactory extends Object + { + + public function GraphicalElementFactory() + { + super(); + } + + public static function getGraphicalElementData(param1:int, param2:int) : GraphicalElementData + { + switch(param2) + { + case GraphicalElementTypes.NORMAL: + return new NormalGraphicalElementData(param1,param2); + case GraphicalElementTypes.BOUNDING_BOX: + return new BoundingBoxGraphicalElementData(param1,param2); + case GraphicalElementTypes.ANIMATED: + return new AnimatedGraphicalElementData(param1,param2); + case GraphicalElementTypes.ENTITY: + return new EntityGraphicalElementData(param1,param2); + case GraphicalElementTypes.PARTICLES: + return new ParticlesGraphicalElementData(param1,param2); + case GraphicalElementTypes.BLENDED: + return new BlendedGraphicalElementData(param1,param2); + default: + ErrorManager.addError("Unknown graphical element data type " + param2 + " for element " + param1 + "!",false); + return null; + } + } + } +} diff --git a/com/ankamagames/atouin/data/elements/GraphicalElementTypes.as b/com/ankamagames/atouin/data/elements/GraphicalElementTypes.as index 12996b703..cd80fbf97 100644 --- a/com/ankamagames/atouin/data/elements/GraphicalElementTypes.as +++ b/com/ankamagames/atouin/data/elements/GraphicalElementTypes.as @@ -1,16 +1,23 @@ -package com.ankamagames.atouin.data.elements +package com.ankamagames.atouin.data.elements { - public class GraphicalElementTypes - { - - public static const NORMAL:uint = 0; - public static const BOUNDING_BOX:uint = 1; - public static const ANIMATED:uint = 2; - public static const ENTITY:uint = 3; - public static const PARTICLES:uint = 4; - public static const BLENDED:uint = 5; - - - } -}//package com.ankamagames.atouin.data.elements - + public class GraphicalElementTypes extends Object + { + + public function GraphicalElementTypes() + { + super(); + } + + public static const NORMAL:uint = 0; + + public static const BOUNDING_BOX:uint = 1; + + public static const ANIMATED:uint = 2; + + public static const ENTITY:uint = 3; + + public static const PARTICLES:uint = 4; + + public static const BLENDED:uint = 5; + } +} diff --git a/com/ankamagames/atouin/data/elements/subtypes/AnimatedGraphicalElementData.as b/com/ankamagames/atouin/data/elements/subtypes/AnimatedGraphicalElementData.as index 97c189b0a..b72ef3cac 100644 --- a/com/ankamagames/atouin/data/elements/subtypes/AnimatedGraphicalElementData.as +++ b/com/ankamagames/atouin/data/elements/subtypes/AnimatedGraphicalElementData.as @@ -1,38 +1,36 @@ -package com.ankamagames.atouin.data.elements.subtypes +package com.ankamagames.atouin.data.elements.subtypes { - import com.ankamagames.atouin.AtouinConstants; - import flash.utils.IDataInput; - - public class AnimatedGraphicalElementData extends NormalGraphicalElementData - { - - public var minDelay:uint; - public var maxDelay:uint; - - public function AnimatedGraphicalElementData(elementId:int, elementType:int) - { - super(elementId, elementType); - } - - override public function fromRaw(raw:IDataInput, version:int):void - { - super.fromRaw(raw, version); - if (version == 4) + import flash.utils.IDataInput; + import com.ankamagames.atouin.AtouinConstants; + + public class AnimatedGraphicalElementData extends NormalGraphicalElementData + { + + public function AnimatedGraphicalElementData(param1:int, param2:int) + { + super(param1,param2); + } + + public var minDelay:uint; + + public var maxDelay:uint; + + override public function fromRaw(param1:IDataInput, param2:int) : void + { + super.fromRaw(param1,param2); + if(param2 == 4) + { + this.minDelay = param1.readInt(); + if(AtouinConstants.DEBUG_FILES_PARSING_ELEMENTS) { - this.minDelay = raw.readInt(); - if (AtouinConstants.DEBUG_FILES_PARSING_ELEMENTS) - { - _log.debug((" (AnimatedGraphicalElementData) minDelay : " + this.minDelay)); - }; - this.maxDelay = raw.readInt(); - if (AtouinConstants.DEBUG_FILES_PARSING_ELEMENTS) - { - _log.debug((" (AnimatedGraphicalElementData) maxDelay : " + this.maxDelay)); - }; - }; - } - - - } -}//package com.ankamagames.atouin.data.elements.subtypes - + _log.debug(" (AnimatedGraphicalElementData) minDelay : " + this.minDelay); + } + this.maxDelay = param1.readInt(); + if(AtouinConstants.DEBUG_FILES_PARSING_ELEMENTS) + { + _log.debug(" (AnimatedGraphicalElementData) maxDelay : " + this.maxDelay); + } + } + } + } +} diff --git a/com/ankamagames/atouin/data/elements/subtypes/BlendedGraphicalElementData.as b/com/ankamagames/atouin/data/elements/subtypes/BlendedGraphicalElementData.as index 7ca2ae504..44729058a 100644 --- a/com/ankamagames/atouin/data/elements/subtypes/BlendedGraphicalElementData.as +++ b/com/ankamagames/atouin/data/elements/subtypes/BlendedGraphicalElementData.as @@ -1,35 +1,32 @@ -package com.ankamagames.atouin.data.elements.subtypes +package com.ankamagames.atouin.data.elements.subtypes { - import com.ankamagames.jerakine.logger.Logger; - import com.ankamagames.jerakine.logger.Log; - import flash.utils.getQualifiedClassName; - import com.ankamagames.atouin.AtouinConstants; - import flash.utils.IDataInput; - - public class BlendedGraphicalElementData extends NormalGraphicalElementData - { - - protected static const _log:Logger = Log.getLogger(getQualifiedClassName(NormalGraphicalElementData)); - - public var blendMode:String; - - public function BlendedGraphicalElementData(elementId:int, elementType:int) - { - super(elementId, elementType); - } - - override public function fromRaw(raw:IDataInput, version:int):void - { - super.fromRaw(raw, version); - var blendModeLength:uint = raw.readInt(); - this.blendMode = raw.readUTFBytes(blendModeLength); - if (AtouinConstants.DEBUG_FILES_PARSING_ELEMENTS) - { - _log.debug((" (BlendedGraphicalElementData) BlendMode : " + this.blendMode)); - }; - } - - - } -}//package com.ankamagames.atouin.data.elements.subtypes - + import com.ankamagames.jerakine.logger.Logger; + import com.ankamagames.jerakine.logger.Log; + import flash.utils.getQualifiedClassName; + import flash.utils.IDataInput; + import com.ankamagames.atouin.AtouinConstants; + + public class BlendedGraphicalElementData extends NormalGraphicalElementData + { + + public function BlendedGraphicalElementData(param1:int, param2:int) + { + super(param1,param2); + } + + protected static const _log:Logger = Log.getLogger(getQualifiedClassName(NormalGraphicalElementData)); + + public var blendMode:String; + + override public function fromRaw(param1:IDataInput, param2:int) : void + { + super.fromRaw(param1,param2); + var _loc3_:uint = param1.readInt(); + this.blendMode = param1.readUTFBytes(_loc3_); + if(AtouinConstants.DEBUG_FILES_PARSING_ELEMENTS) + { + _log.debug(" (BlendedGraphicalElementData) BlendMode : " + this.blendMode); + } + } + } +} diff --git a/com/ankamagames/atouin/data/elements/subtypes/BoundingBoxGraphicalElementData.as b/com/ankamagames/atouin/data/elements/subtypes/BoundingBoxGraphicalElementData.as index 6033f7b3c..102a093f8 100644 --- a/com/ankamagames/atouin/data/elements/subtypes/BoundingBoxGraphicalElementData.as +++ b/com/ankamagames/atouin/data/elements/subtypes/BoundingBoxGraphicalElementData.as @@ -1,13 +1,11 @@ -package com.ankamagames.atouin.data.elements.subtypes +package com.ankamagames.atouin.data.elements.subtypes { - public class BoundingBoxGraphicalElementData extends NormalGraphicalElementData - { - - public function BoundingBoxGraphicalElementData(elementId:int, elementType:int) - { - super(elementId, elementType); - } - - } -}//package com.ankamagames.atouin.data.elements.subtypes - + public class BoundingBoxGraphicalElementData extends NormalGraphicalElementData + { + + public function BoundingBoxGraphicalElementData(param1:int, param2:int) + { + super(param1,param2); + } + } +} diff --git a/com/ankamagames/atouin/data/elements/subtypes/EntityGraphicalElementData.as b/com/ankamagames/atouin/data/elements/subtypes/EntityGraphicalElementData.as index 4611511af..9c599d511 100644 --- a/com/ankamagames/atouin/data/elements/subtypes/EntityGraphicalElementData.as +++ b/com/ankamagames/atouin/data/elements/subtypes/EntityGraphicalElementData.as @@ -1,74 +1,76 @@ -package com.ankamagames.atouin.data.elements.subtypes +package com.ankamagames.atouin.data.elements.subtypes { - import com.ankamagames.atouin.data.elements.GraphicalElementData; - import com.ankamagames.jerakine.logger.Logger; - import com.ankamagames.jerakine.logger.Log; - import flash.utils.getQualifiedClassName; - import com.ankamagames.atouin.AtouinConstants; - import flash.utils.IDataInput; - - public class EntityGraphicalElementData extends GraphicalElementData - { - - protected static const _log:Logger = Log.getLogger(getQualifiedClassName(EntityGraphicalElementData)); - - public var entityLook:String; - public var horizontalSymmetry:Boolean; - public var playAnimation:Boolean; - public var playAnimStatic:Boolean; - public var minDelay:uint; - public var maxDelay:uint; - - public function EntityGraphicalElementData(elementId:int, elementType:int) - { - super(elementId, elementType); - } - - override public function fromRaw(raw:IDataInput, version:int):void - { - var entityLookLength:uint = raw.readInt(); - this.entityLook = raw.readUTFBytes(entityLookLength); - if (AtouinConstants.DEBUG_FILES_PARSING_ELEMENTS) + import com.ankamagames.atouin.data.elements.GraphicalElementData; + import com.ankamagames.jerakine.logger.Logger; + import com.ankamagames.jerakine.logger.Log; + import flash.utils.getQualifiedClassName; + import flash.utils.IDataInput; + import com.ankamagames.atouin.AtouinConstants; + + public class EntityGraphicalElementData extends GraphicalElementData + { + + public function EntityGraphicalElementData(param1:int, param2:int) + { + super(param1,param2); + } + + protected static const _log:Logger = Log.getLogger(getQualifiedClassName(EntityGraphicalElementData)); + + public var entityLook:String; + + public var horizontalSymmetry:Boolean; + + public var playAnimation:Boolean; + + public var playAnimStatic:Boolean; + + public var minDelay:uint; + + public var maxDelay:uint; + + override public function fromRaw(param1:IDataInput, param2:int) : void + { + var _loc3_:uint = param1.readInt(); + this.entityLook = param1.readUTFBytes(_loc3_); + if(AtouinConstants.DEBUG_FILES_PARSING_ELEMENTS) + { + _log.debug(" (EntityGraphicalElementData) Entity look : " + this.entityLook); + } + this.horizontalSymmetry = param1.readBoolean(); + if(AtouinConstants.DEBUG_FILES_PARSING_ELEMENTS) + { + _log.debug(" (EntityGraphicalElementData) Element horizontals symmetry : " + this.horizontalSymmetry); + } + if(param2 >= 7) + { + this.playAnimation = param1.readBoolean(); + if(AtouinConstants.DEBUG_FILES_PARSING_ELEMENTS) { - _log.debug((" (EntityGraphicalElementData) Entity look : " + this.entityLook)); - }; - this.horizontalSymmetry = raw.readBoolean(); - if (AtouinConstants.DEBUG_FILES_PARSING_ELEMENTS) + _log.debug(" (EntityGraphicalElementData) playAnimation : " + this.playAnimation); + } + } + if(param2 >= 6) + { + this.playAnimStatic = param1.readBoolean(); + if(AtouinConstants.DEBUG_FILES_PARSING_ELEMENTS) { - _log.debug((" (EntityGraphicalElementData) Element horizontals symmetry : " + this.horizontalSymmetry)); - }; - if (version >= 7) + _log.debug(" (EntityGraphicalElementData) playAnimStatic : " + this.playAnimStatic); + } + } + if(param2 >= 5) + { + this.minDelay = param1.readInt(); + if(AtouinConstants.DEBUG_FILES_PARSING_ELEMENTS) { - this.playAnimation = raw.readBoolean(); - if (AtouinConstants.DEBUG_FILES_PARSING_ELEMENTS) - { - _log.debug((" (EntityGraphicalElementData) playAnimation : " + this.playAnimation)); - }; - }; - if (version >= 6) + _log.debug(" (EntityGraphicalElementData) minDelay : " + this.minDelay); + } + this.maxDelay = param1.readInt(); + if(AtouinConstants.DEBUG_FILES_PARSING_ELEMENTS) { - this.playAnimStatic = raw.readBoolean(); - if (AtouinConstants.DEBUG_FILES_PARSING_ELEMENTS) - { - _log.debug((" (EntityGraphicalElementData) playAnimStatic : " + this.playAnimStatic)); - }; - }; - if (version >= 5) - { - this.minDelay = raw.readInt(); - if (AtouinConstants.DEBUG_FILES_PARSING_ELEMENTS) - { - _log.debug((" (EntityGraphicalElementData) minDelay : " + this.minDelay)); - }; - this.maxDelay = raw.readInt(); - if (AtouinConstants.DEBUG_FILES_PARSING_ELEMENTS) - { - _log.debug((" (EntityGraphicalElementData) maxDelay : " + this.maxDelay)); - }; - }; - } - - - } -}//package com.ankamagames.atouin.data.elements.subtypes - + _log.debug(" (EntityGraphicalElementData) maxDelay : " + this.maxDelay); + } + } + } + } +} diff --git a/com/ankamagames/atouin/data/elements/subtypes/NormalGraphicalElementData.as b/com/ankamagames/atouin/data/elements/subtypes/NormalGraphicalElementData.as index 2f2ced06b..a1bb7d7a5 100644 --- a/com/ankamagames/atouin/data/elements/subtypes/NormalGraphicalElementData.as +++ b/com/ankamagames/atouin/data/elements/subtypes/NormalGraphicalElementData.as @@ -1,62 +1,64 @@ -package com.ankamagames.atouin.data.elements.subtypes +package com.ankamagames.atouin.data.elements.subtypes { - import com.ankamagames.atouin.data.elements.GraphicalElementData; - import flash.utils.Dictionary; - import com.ankamagames.jerakine.logger.Logger; - import com.ankamagames.jerakine.logger.Log; - import flash.utils.getQualifiedClassName; - import flash.geom.Point; - import com.ankamagames.atouin.AtouinConstants; - import flash.utils.IDataInput; - - public class NormalGraphicalElementData extends GraphicalElementData - { - - public static var MEMORY_LOG:Dictionary = new Dictionary(true); - protected static const _log:Logger = Log.getLogger(getQualifiedClassName(NormalGraphicalElementData)); - - public var gfxId:int; - public var height:uint; - public var horizontalSymmetry:Boolean; - public var origin:Point; - public var size:Point; - - public function NormalGraphicalElementData(elementId:int, elementType:int) - { - super(elementId, elementType); - MEMORY_LOG[this] = 1; - } - - override public function fromRaw(raw:IDataInput, version:int):void - { - this.gfxId = raw.readInt(); - if (AtouinConstants.DEBUG_FILES_PARSING_ELEMENTS) - { - _log.debug((" (ElementData) Element gfx id : " + this.gfxId)); - }; - this.height = raw.readByte(); - if (AtouinConstants.DEBUG_FILES_PARSING_ELEMENTS) - { - _log.debug((" (ElementData) Element height : " + this.height)); - }; - this.horizontalSymmetry = raw.readBoolean(); - if (AtouinConstants.DEBUG_FILES_PARSING_ELEMENTS) - { - _log.debug((" (ElementData) Element horizontals symmetry : " + this.horizontalSymmetry)); - }; - this.origin = new Point(raw.readShort(), raw.readShort()); - if (AtouinConstants.DEBUG_FILES_PARSING_ELEMENTS) - { - _log.debug(((((" (ElementData) Origin : (" + this.origin.x) + ";") + this.origin.y) + ")")); - }; - this.size = new Point(raw.readShort(), raw.readShort()); - if (AtouinConstants.DEBUG_FILES_PARSING_ELEMENTS) - { - _log.debug(((((" (ElementData) Size : (" + this.size.x) + ";") + this.size.y) + ")")); - }; - } - - - } -}//package com.ankamagames.atouin.data.elements.subtypes - + import com.ankamagames.atouin.data.elements.GraphicalElementData; + import flash.utils.Dictionary; + import com.ankamagames.jerakine.logger.Logger; + import com.ankamagames.jerakine.logger.Log; + import flash.utils.getQualifiedClassName; + import flash.geom.Point; + import flash.utils.IDataInput; + import com.ankamagames.atouin.AtouinConstants; + + public class NormalGraphicalElementData extends GraphicalElementData + { + + public function NormalGraphicalElementData(param1:int, param2:int) + { + super(param1,param2); + MEMORY_LOG[this] = 1; + } + + public static var MEMORY_LOG:Dictionary = new Dictionary(true); + + protected static const _log:Logger = Log.getLogger(getQualifiedClassName(NormalGraphicalElementData)); + + public var gfxId:int; + + public var height:uint; + + public var horizontalSymmetry:Boolean; + + public var origin:Point; + + public var size:Point; + + override public function fromRaw(param1:IDataInput, param2:int) : void + { + this.gfxId = param1.readInt(); + if(AtouinConstants.DEBUG_FILES_PARSING_ELEMENTS) + { + _log.debug(" (ElementData) Element gfx id : " + this.gfxId); + } + this.height = param1.readByte(); + if(AtouinConstants.DEBUG_FILES_PARSING_ELEMENTS) + { + _log.debug(" (ElementData) Element height : " + this.height); + } + this.horizontalSymmetry = param1.readBoolean(); + if(AtouinConstants.DEBUG_FILES_PARSING_ELEMENTS) + { + _log.debug(" (ElementData) Element horizontals symmetry : " + this.horizontalSymmetry); + } + this.origin = new Point(param1.readShort(),param1.readShort()); + if(AtouinConstants.DEBUG_FILES_PARSING_ELEMENTS) + { + _log.debug(" (ElementData) Origin : (" + this.origin.x + ";" + this.origin.y + ")"); + } + this.size = new Point(param1.readShort(),param1.readShort()); + if(AtouinConstants.DEBUG_FILES_PARSING_ELEMENTS) + { + _log.debug(" (ElementData) Size : (" + this.size.x + ";" + this.size.y + ")"); + } + } + } +} diff --git a/com/ankamagames/atouin/data/elements/subtypes/ParticlesGraphicalElementData.as b/com/ankamagames/atouin/data/elements/subtypes/ParticlesGraphicalElementData.as index 83efb5630..c0f44e6d7 100644 --- a/com/ankamagames/atouin/data/elements/subtypes/ParticlesGraphicalElementData.as +++ b/com/ankamagames/atouin/data/elements/subtypes/ParticlesGraphicalElementData.as @@ -1,34 +1,31 @@ -package com.ankamagames.atouin.data.elements.subtypes +package com.ankamagames.atouin.data.elements.subtypes { - import com.ankamagames.atouin.data.elements.GraphicalElementData; - import com.ankamagames.jerakine.logger.Logger; - import com.ankamagames.jerakine.logger.Log; - import flash.utils.getQualifiedClassName; - import com.ankamagames.atouin.AtouinConstants; - import flash.utils.IDataInput; - - public class ParticlesGraphicalElementData extends GraphicalElementData - { - - protected static const _log:Logger = Log.getLogger(getQualifiedClassName(ParticlesGraphicalElementData)); - - public var scriptId:int; - - public function ParticlesGraphicalElementData(elementId:int, elementType:int) - { - super(elementId, elementType); - } - - override public function fromRaw(raw:IDataInput, version:int):void - { - this.scriptId = raw.readShort(); - if (AtouinConstants.DEBUG_FILES_PARSING_ELEMENTS) - { - _log.debug((" (ParticlesGraphicalElementData) Script id : " + this.scriptId)); - }; - } - - - } -}//package com.ankamagames.atouin.data.elements.subtypes - + import com.ankamagames.atouin.data.elements.GraphicalElementData; + import com.ankamagames.jerakine.logger.Logger; + import com.ankamagames.jerakine.logger.Log; + import flash.utils.getQualifiedClassName; + import flash.utils.IDataInput; + import com.ankamagames.atouin.AtouinConstants; + + public class ParticlesGraphicalElementData extends GraphicalElementData + { + + public function ParticlesGraphicalElementData(param1:int, param2:int) + { + super(param1,param2); + } + + protected static const _log:Logger = Log.getLogger(getQualifiedClassName(ParticlesGraphicalElementData)); + + public var scriptId:int; + + override public function fromRaw(param1:IDataInput, param2:int) : void + { + this.scriptId = param1.readShort(); + if(AtouinConstants.DEBUG_FILES_PARSING_ELEMENTS) + { + _log.debug(" (ParticlesGraphicalElementData) Script id : " + this.scriptId); + } + } + } +} diff --git a/com/ankamagames/atouin/data/map/Cell.as b/com/ankamagames/atouin/data/map/Cell.as index 6c372acfa..40da96510 100644 --- a/com/ankamagames/atouin/data/map/Cell.as +++ b/com/ankamagames/atouin/data/map/Cell.as @@ -1,112 +1,115 @@ -package com.ankamagames.atouin.data.map +package com.ankamagames.atouin.data.map { - import com.ankamagames.jerakine.logger.Logger; - import com.ankamagames.jerakine.logger.Log; - import flash.utils.getQualifiedClassName; - import flash.geom.Point; - import com.ankamagames.atouin.AtouinConstants; - import com.ankamagames.atouin.utils.CellIdConverter; - import com.ankamagames.atouin.data.map.elements.BasicElement; - import flash.utils.IDataInput; - - public class Cell - { - - protected static const _log:Logger = Log.getLogger(getQualifiedClassName(Cell)); - private static var _cellCoords:Point; - - public var cellId:int; - public var elementsCount:int; - public var elements:Array; - private var _layer:Layer; - - public function Cell(layer:Layer) - { - this._layer = layer; - } - - public static function cellCoords(cellId:uint):Point - { - if (_cellCoords == null) + import com.ankamagames.jerakine.logger.Logger; + import flash.geom.Point; + import com.ankamagames.atouin.AtouinConstants; + import com.ankamagames.atouin.utils.CellIdConverter; + import com.ankamagames.jerakine.logger.Log; + import flash.utils.getQualifiedClassName; + import flash.utils.IDataInput; + import com.ankamagames.atouin.data.map.elements.BasicElement; + + public class Cell extends Object + { + + public function Cell(param1:Layer) + { + super(); + this._layer = param1; + } + + protected static const _log:Logger = Log.getLogger(getQualifiedClassName(Cell)); + + private static var _cellCoords:Point; + + public static function cellCoords(param1:uint) : Point + { + if(_cellCoords == null) + { + _cellCoords = new Point(); + } + _cellCoords.x = param1 % AtouinConstants.MAP_WIDTH; + _cellCoords.y = Math.floor(param1 / AtouinConstants.MAP_WIDTH); + return _cellCoords; + } + + public static function cellId(param1:Point) : uint + { + return CellIdConverter.coordToCellId(param1.x,param1.y); + } + + public static function cellIdByXY(param1:int, param2:int) : uint + { + return CellIdConverter.coordToCellId(param1,param2); + } + + public static function cellPixelCoords(param1:uint) : Point + { + var _loc2_:Point = cellCoords(param1); + _loc2_.x = _loc2_.x * AtouinConstants.CELL_WIDTH + (_loc2_.y % 2 == 1?AtouinConstants.CELL_HALF_WIDTH:0); + _loc2_.y = _loc2_.y * AtouinConstants.CELL_HALF_HEIGHT; + return _loc2_; + } + + public var cellId:int; + + public var elementsCount:int; + + public var elements:Array; + + private var _layer:Layer; + + public function get layer() : Layer + { + return this._layer; + } + + public function get coords() : Point + { + return CellIdConverter.cellIdToCoord(this.cellId); + } + + public function get pixelCoords() : Point + { + return cellPixelCoords(this.cellId); + } + + public function fromRaw(param1:IDataInput, param2:int) : void + { + var be:BasicElement = null; + var i:int = 0; + var raw:IDataInput = param1; + var mapVersion:int = param2; + try + { + this.cellId = raw.readShort(); + if(AtouinConstants.DEBUG_FILES_PARSING) { - _cellCoords = new Point(); - }; - _cellCoords.x = (cellId % AtouinConstants.MAP_WIDTH); - _cellCoords.y = Math.floor((cellId / AtouinConstants.MAP_WIDTH)); - return (_cellCoords); - } - - public static function cellId(p:Point):uint - { - return (CellIdConverter.coordToCellId(p.x, p.y)); - } - - public static function cellIdByXY(x:int, y:int):uint - { - return (CellIdConverter.coordToCellId(x, y)); - } - - public static function cellPixelCoords(cellId:uint):Point - { - var p:Point = cellCoords(cellId); - p.x = ((p.x * AtouinConstants.CELL_WIDTH) + ((((p.y % 2) == 1)) ? AtouinConstants.CELL_HALF_WIDTH : 0)); - p.y = (p.y * AtouinConstants.CELL_HALF_HEIGHT); - return (p); - } - - - public function get layer():Layer - { - return (this._layer); - } - - public function get coords():Point - { - return (CellIdConverter.cellIdToCoord(this.cellId)); - } - - public function get pixelCoords():Point - { - return (cellPixelCoords(this.cellId)); - } - - public function fromRaw(raw:IDataInput, mapVersion:int):void - { - var be:BasicElement; - var i:int; - try + _log.debug(" (Cell) Id : " + this.cellId); + } + this.elementsCount = raw.readShort(); + if(AtouinConstants.DEBUG_FILES_PARSING) { - this.cellId = raw.readShort(); - if (AtouinConstants.DEBUG_FILES_PARSING) - { - _log.debug((" (Cell) Id : " + this.cellId)); - }; - this.elementsCount = raw.readShort(); - if (AtouinConstants.DEBUG_FILES_PARSING) - { - _log.debug((" (Cell) Elements count : " + this.elementsCount)); - }; - this.elements = new Array(); - i = 0; - while (i < this.elementsCount) - { - be = BasicElement.getElementFromType(raw.readByte(), this); - if (AtouinConstants.DEBUG_FILES_PARSING) - { - _log.debug(((" (Cell) Element at index " + i) + " :")); - }; - be.fromRaw(raw, mapVersion); - this.elements.push(be); - i = (i + 1); - }; + _log.debug(" (Cell) Elements count : " + this.elementsCount); } - catch(e) + this.elements = new Array(); + i = 0; + while(i < this.elementsCount) { - throw (e); - }; - } - - - } -}//package com.ankamagames.atouin.data.map - + be = BasicElement.getElementFromType(raw.readByte(),this); + if(AtouinConstants.DEBUG_FILES_PARSING) + { + _log.debug(" (Cell) Element at index " + i + " :"); + } + be.fromRaw(raw,mapVersion); + this.elements.push(be); + i++; + } + } + catch(e:*) + { + throw e; + } + } + } +} diff --git a/com/ankamagames/atouin/data/map/CellData.as b/com/ankamagames/atouin/data/map/CellData.as index 0ea8d9b47..12b18dcb4 100644 --- a/com/ankamagames/atouin/data/map/CellData.as +++ b/com/ankamagames/atouin/data/map/CellData.as @@ -1,179 +1,193 @@ -package com.ankamagames.atouin.data.map +package com.ankamagames.atouin.data.map { - import com.ankamagames.jerakine.logger.Logger; - import com.ankamagames.jerakine.logger.Log; - import flash.utils.getQualifiedClassName; - import com.ankamagames.atouin.AtouinConstants; - import flash.utils.IDataInput; - - public class CellData - { - - protected static const _log:Logger = Log.getLogger(getQualifiedClassName(CellData)); - - public var id:uint; - public var speed:int; - public var mapChangeData:uint; - public var moveZone:uint; - private var _losmov:int = 3; - private var _floor:int; - private var _map:Map; - private var _arrow:int = 0; - private var _mov:Boolean; - private var _los:Boolean; - private var _nonWalkableDuringFight:Boolean; - private var _red:Boolean; - private var _blue:Boolean; - private var _farmCell:Boolean; - private var _visible:Boolean; - private var _nonWalkableDuringRP:Boolean; - - public function CellData(map:Map, cellId:uint) - { - this.id = cellId; - this._map = map; - } - - public function get map():Map - { - return (this._map); - } - - public function get mov():Boolean - { - return (this._mov); - } - - public function get los():Boolean - { - return (this._los); - } - - public function get nonWalkableDuringFight():Boolean - { - return (this._nonWalkableDuringFight); - } - - public function get red():Boolean - { - return (this._red); - } - - public function get blue():Boolean - { - return (this._blue); - } - - public function get farmCell():Boolean - { - return (this._farmCell); - } - - public function get visible():Boolean - { - return (this._visible); - } - - public function get nonWalkableDuringRP():Boolean - { - return (this._nonWalkableDuringRP); - } - - public function get floor():int - { - return (this._floor); - } - - public function get useTopArrow():Boolean - { - return (!(((this._arrow & 1) == 0))); - } - - public function get useBottomArrow():Boolean - { - return (!(((this._arrow & 2) == 0))); - } - - public function get useRightArrow():Boolean - { - return (!(((this._arrow & 4) == 0))); - } - - public function get useLeftArrow():Boolean - { - return (!(((this._arrow & 8) == 0))); - } - - public function fromRaw(raw:IDataInput):void - { - var tmpBits:int; - try + import com.ankamagames.jerakine.logger.Logger; + import com.ankamagames.jerakine.logger.Log; + import flash.utils.getQualifiedClassName; + import flash.utils.IDataInput; + import com.ankamagames.atouin.AtouinConstants; + + public class CellData extends Object + { + + public function CellData(param1:Map, param2:uint) + { + super(); + this.id = param2; + this._map = param1; + } + + protected static const _log:Logger = Log.getLogger(getQualifiedClassName(CellData)); + + public var id:uint; + + public var speed:int; + + public var mapChangeData:uint; + + public var moveZone:uint; + + private var _losmov:int = 3; + + private var _floor:int; + + private var _map:Map; + + private var _arrow:int = 0; + + public function get map() : Map + { + return this._map; + } + + private var _mov:Boolean; + + public function get mov() : Boolean + { + return this._mov; + } + + private var _los:Boolean; + + public function get los() : Boolean + { + return this._los; + } + + private var _nonWalkableDuringFight:Boolean; + + public function get nonWalkableDuringFight() : Boolean + { + return this._nonWalkableDuringFight; + } + + private var _red:Boolean; + + public function get red() : Boolean + { + return this._red; + } + + private var _blue:Boolean; + + public function get blue() : Boolean + { + return this._blue; + } + + private var _farmCell:Boolean; + + public function get farmCell() : Boolean + { + return this._farmCell; + } + + private var _visible:Boolean; + + public function get visible() : Boolean + { + return this._visible; + } + + private var _nonWalkableDuringRP:Boolean; + + public function get nonWalkableDuringRP() : Boolean + { + return this._nonWalkableDuringRP; + } + + public function get floor() : int + { + return this._floor; + } + + public function get useTopArrow() : Boolean + { + return !((this._arrow & 1) == 0); + } + + public function get useBottomArrow() : Boolean + { + return !((this._arrow & 2) == 0); + } + + public function get useRightArrow() : Boolean + { + return !((this._arrow & 4) == 0); + } + + public function get useLeftArrow() : Boolean + { + return !((this._arrow & 8) == 0); + } + + public function fromRaw(param1:IDataInput) : void + { + var tmpBits:int = 0; + var raw:IDataInput = param1; + try + { + this._floor = raw.readByte() * 10; + if(this._floor == -1280) { - this._floor = (raw.readByte() * 10); - if (this._floor == -1280) - { - return; - }; - this._losmov = raw.readUnsignedByte(); - if (AtouinConstants.DEBUG_FILES_PARSING) - { - _log.debug((" (CellData) LOS+MOV : " + this._losmov)); - }; - this.speed = raw.readByte(); - if (AtouinConstants.DEBUG_FILES_PARSING) - { - _log.debug((" (CellData) Speed : " + this.speed)); - }; - this.mapChangeData = raw.readUnsignedByte(); - if (AtouinConstants.DEBUG_FILES_PARSING) - { - _log.debug((" (CellData) MapChangeData : " + this.mapChangeData)); - }; - if (this._map.mapVersion > 5) - { - this.moveZone = raw.readUnsignedByte(); - if (AtouinConstants.DEBUG_FILES_PARSING) - { - _log.debug((" (CellData) moveZone : " + this.moveZone)); - }; - }; - if (this._map.mapVersion > 7) - { - tmpBits = raw.readByte(); - this._arrow = (15 & tmpBits); - if (this.useTopArrow) - { - this._map.topArrowCell.push(this.id); - }; - if (this.useBottomArrow) - { - this._map.bottomArrowCell.push(this.id); - }; - if (this.useLeftArrow) - { - this._map.leftArrowCell.push(this.id); - }; - if (this.useRightArrow) - { - this._map.rightArrowCell.push(this.id); - }; - }; + return; } - catch(e) + this._losmov = raw.readUnsignedByte(); + if(AtouinConstants.DEBUG_FILES_PARSING) { - throw (e); - }; - this._los = (((this._losmov & 2) >> 1) == 1); - this._mov = ((this._losmov & 1) == 1); - this._visible = (((this._losmov & 64) >> 6) == 1); - this._farmCell = (((this._losmov & 32) >> 5) == 1); - this._blue = (((this._losmov & 16) >> 4) == 1); - this._red = (((this._losmov & 8) >> 3) == 1); - this._nonWalkableDuringRP = (((this._losmov & 128) >> 7) == 1); - this._nonWalkableDuringFight = (((this._losmov & 4) >> 2) == 1); - } - - - } -}//package com.ankamagames.atouin.data.map - + _log.debug(" (CellData) LOS+MOV : " + this._losmov); + } + this.speed = raw.readByte(); + if(AtouinConstants.DEBUG_FILES_PARSING) + { + _log.debug(" (CellData) Speed : " + this.speed); + } + this.mapChangeData = raw.readUnsignedByte(); + if(AtouinConstants.DEBUG_FILES_PARSING) + { + _log.debug(" (CellData) MapChangeData : " + this.mapChangeData); + } + if(this._map.mapVersion > 5) + { + this.moveZone = raw.readUnsignedByte(); + if(AtouinConstants.DEBUG_FILES_PARSING) + { + _log.debug(" (CellData) moveZone : " + this.moveZone); + } + } + if(this._map.mapVersion > 7) + { + tmpBits = raw.readByte(); + this._arrow = 15 & tmpBits; + if(this.useTopArrow) + { + this._map.topArrowCell.push(this.id); + } + if(this.useBottomArrow) + { + this._map.bottomArrowCell.push(this.id); + } + if(this.useLeftArrow) + { + this._map.leftArrowCell.push(this.id); + } + if(this.useRightArrow) + { + this._map.rightArrowCell.push(this.id); + } + } + } + catch(e:*) + { + throw e; + } + this._los = (this._losmov & 2) >> 1 == 1; + this._mov = (this._losmov & 1) == 1; + this._visible = (this._losmov & 64) >> 6 == 1; + this._farmCell = (this._losmov & 32) >> 5 == 1; + this._blue = (this._losmov & 16) >> 4 == 1; + this._red = (this._losmov & 8) >> 3 == 1; + this._nonWalkableDuringRP = (this._losmov & 128) >> 7 == 1; + this._nonWalkableDuringFight = (this._losmov & 4) >> 2 == 1; + } + } +} diff --git a/com/ankamagames/atouin/data/map/Fixture.as b/com/ankamagames/atouin/data/map/Fixture.as index b68dfc995..ac40f3e04 100644 --- a/com/ankamagames/atouin/data/map/Fixture.as +++ b/com/ankamagames/atouin/data/map/Fixture.as @@ -1,91 +1,100 @@ -package com.ankamagames.atouin.data.map +package com.ankamagames.atouin.data.map { - import com.ankamagames.jerakine.logger.Logger; - import com.ankamagames.jerakine.logger.Log; - import flash.utils.getQualifiedClassName; - import flash.geom.Point; - import com.ankamagames.atouin.AtouinConstants; - import flash.utils.IDataInput; - - public class Fixture - { - - protected static const _log:Logger = Log.getLogger(getQualifiedClassName(Fixture)); - - public var fixtureId:int; - public var offset:Point; - public var hue:int; - public var redMultiplier:int; - public var greenMultiplier:int; - public var blueMultiplier:int; - public var alpha:uint; - public var xScale:int; - public var yScale:int; - public var rotation:int; - private var _map:Map; - - public function Fixture(map:Map) - { - this._map = map; - } - - public function get map():Map - { - return (this._map); - } - - public function fromRaw(raw:IDataInput):void - { - try + import com.ankamagames.jerakine.logger.Logger; + import com.ankamagames.jerakine.logger.Log; + import flash.utils.getQualifiedClassName; + import flash.geom.Point; + import flash.utils.IDataInput; + import com.ankamagames.atouin.AtouinConstants; + + public class Fixture extends Object + { + + public function Fixture(param1:Map) + { + super(); + this._map = param1; + } + + protected static const _log:Logger = Log.getLogger(getQualifiedClassName(Fixture)); + + public var fixtureId:int; + + public var offset:Point; + + public var hue:int; + + public var redMultiplier:int; + + public var greenMultiplier:int; + + public var blueMultiplier:int; + + public var alpha:uint; + + public var xScale:int; + + public var yScale:int; + + public var rotation:int; + + private var _map:Map; + + public function get map() : Map + { + return this._map; + } + + public function fromRaw(param1:IDataInput) : void + { + var raw:IDataInput = param1; + try + { + this.fixtureId = raw.readInt(); + if(AtouinConstants.DEBUG_FILES_PARSING) { - this.fixtureId = raw.readInt(); - if (AtouinConstants.DEBUG_FILES_PARSING) - { - _log.debug((" (Fixture) Id : " + this.fixtureId)); - }; - this.offset = new Point(); - this.offset.x = raw.readShort(); - this.offset.y = raw.readShort(); - if (AtouinConstants.DEBUG_FILES_PARSING) - { - _log.debug(((((" (Fixture) Offset : (" + this.offset.x) + ";") + this.offset.y) + ")")); - }; - this.rotation = raw.readShort(); - if (AtouinConstants.DEBUG_FILES_PARSING) - { - _log.debug((" (Fixture) Rotation : " + this.rotation)); - }; - this.xScale = raw.readShort(); - if (AtouinConstants.DEBUG_FILES_PARSING) - { - _log.debug((" (Fixture) Scale X : " + this.xScale)); - }; - this.yScale = raw.readShort(); - if (AtouinConstants.DEBUG_FILES_PARSING) - { - _log.debug((" (Fixture) Scale Y : " + this.yScale)); - }; - this.redMultiplier = raw.readByte(); - this.greenMultiplier = raw.readByte(); - this.blueMultiplier = raw.readByte(); - this.hue = ((this.redMultiplier | this.greenMultiplier) | this.blueMultiplier); - if (AtouinConstants.DEBUG_FILES_PARSING) - { - _log.debug((" (Fixture) Hue : 0x" + this.hue.toString(16))); - }; - this.alpha = raw.readUnsignedByte(); - if (AtouinConstants.DEBUG_FILES_PARSING) - { - _log.debug((" (Fixture) Alpha : " + this.alpha)); - }; + _log.debug(" (Fixture) Id : " + this.fixtureId); } - catch(e) + this.offset = new Point(); + this.offset.x = raw.readShort(); + this.offset.y = raw.readShort(); + if(AtouinConstants.DEBUG_FILES_PARSING) { - throw (e); - }; - } - - - } -}//package com.ankamagames.atouin.data.map - + _log.debug(" (Fixture) Offset : (" + this.offset.x + ";" + this.offset.y + ")"); + } + this.rotation = raw.readShort(); + if(AtouinConstants.DEBUG_FILES_PARSING) + { + _log.debug(" (Fixture) Rotation : " + this.rotation); + } + this.xScale = raw.readShort(); + if(AtouinConstants.DEBUG_FILES_PARSING) + { + _log.debug(" (Fixture) Scale X : " + this.xScale); + } + this.yScale = raw.readShort(); + if(AtouinConstants.DEBUG_FILES_PARSING) + { + _log.debug(" (Fixture) Scale Y : " + this.yScale); + } + this.redMultiplier = raw.readByte(); + this.greenMultiplier = raw.readByte(); + this.blueMultiplier = raw.readByte(); + this.hue = this.redMultiplier | this.greenMultiplier | this.blueMultiplier; + if(AtouinConstants.DEBUG_FILES_PARSING) + { + _log.debug(" (Fixture) Hue : 0x" + this.hue.toString(16)); + } + this.alpha = raw.readUnsignedByte(); + if(AtouinConstants.DEBUG_FILES_PARSING) + { + _log.debug(" (Fixture) Alpha : " + this.alpha); + } + } + catch(e:*) + { + throw e; + } + } + } +} diff --git a/com/ankamagames/atouin/data/map/Layer.as b/com/ankamagames/atouin/data/map/Layer.as index 8bb3e6742..ccf48b218 100644 --- a/com/ankamagames/atouin/data/map/Layer.as +++ b/com/ankamagames/atouin/data/map/Layer.as @@ -1,69 +1,77 @@ -package com.ankamagames.atouin.data.map +package com.ankamagames.atouin.data.map { - import com.ankamagames.jerakine.logger.Logger; - import com.ankamagames.jerakine.logger.Log; - import flash.utils.getQualifiedClassName; - import com.ankamagames.atouin.AtouinConstants; - import flash.utils.IDataInput; - - public class Layer - { - - public static const LAYER_GROUND:uint = 0; - public static const LAYER_ADDITIONAL_GROUND:uint = 1; - public static const LAYER_DECOR:uint = 2; - public static const LAYER_ADDITIONAL_DECOR:uint = 3; - protected static const _log:Logger = Log.getLogger(getQualifiedClassName(Layer)); - - public var layerId:int; - public var refCell:int = 0; - public var cellsCount:int; - public var cells:Array; - private var _map:Map; - - public function Layer(map:Map) - { - this._map = map; - } - - public function get map():Map - { - return (this._map); - } - - public function fromRaw(raw:IDataInput, mapVersion:int):void - { - var i:int; - var c:Cell; - try + import com.ankamagames.jerakine.logger.Logger; + import com.ankamagames.jerakine.logger.Log; + import flash.utils.getQualifiedClassName; + import flash.utils.IDataInput; + import com.ankamagames.atouin.AtouinConstants; + + public class Layer extends Object + { + + public function Layer(param1:Map) + { + super(); + this._map = param1; + } + + public static const LAYER_GROUND:uint = 0; + + public static const LAYER_ADDITIONAL_GROUND:uint = 1; + + public static const LAYER_DECOR:uint = 2; + + public static const LAYER_ADDITIONAL_DECOR:uint = 3; + + protected static const _log:Logger = Log.getLogger(getQualifiedClassName(Layer)); + + public var layerId:int; + + public var refCell:int = 0; + + public var cellsCount:int; + + public var cells:Array; + + private var _map:Map; + + public function get map() : Map + { + return this._map; + } + + public function fromRaw(param1:IDataInput, param2:int) : void + { + var i:int = 0; + var c:Cell = null; + var raw:IDataInput = param1; + var mapVersion:int = param2; + try + { + this.layerId = raw.readInt(); + this.cellsCount = raw.readShort(); + if(AtouinConstants.DEBUG_FILES_PARSING) { - this.layerId = raw.readInt(); - this.cellsCount = raw.readShort(); - if (AtouinConstants.DEBUG_FILES_PARSING) - { - _log.debug((" (Layer) Cells count : " + this.cellsCount)); - }; - this.cells = new Array(); - i = 0; - while (i < this.cellsCount) - { - c = new Cell(this); - if (AtouinConstants.DEBUG_FILES_PARSING) - { - _log.debug(((" (Layer) Cell at index " + i) + " :")); - }; - c.fromRaw(raw, mapVersion); - this.cells.push(c); - i = (i + 1); - }; + _log.debug(" (Layer) Cells count : " + this.cellsCount); } - catch(e) + this.cells = new Array(); + i = 0; + while(i < this.cellsCount) { - throw (e); - }; - } - - - } -}//package com.ankamagames.atouin.data.map - + c = new Cell(this); + if(AtouinConstants.DEBUG_FILES_PARSING) + { + _log.debug(" (Layer) Cell at index " + i + " :"); + } + c.fromRaw(raw,mapVersion); + this.cells.push(c); + i++; + } + } + catch(e:*) + { + throw e; + } + } + } +} diff --git a/com/ankamagames/atouin/data/map/Map.as b/com/ankamagames/atouin/data/map/Map.as index 83a57f33d..fdffd6613 100644 --- a/com/ankamagames/atouin/data/map/Map.as +++ b/com/ankamagames/atouin/data/map/Map.as @@ -1,428 +1,466 @@ -package com.ankamagames.atouin.data.map +package com.ankamagames.atouin.data.map { - import com.ankamagames.jerakine.logger.Logger; - import com.ankamagames.jerakine.logger.Log; - import flash.utils.getQualifiedClassName; - import flash.utils.ByteArray; - import com.ankamagames.atouin.data.DataFormatError; - import com.ankamagames.atouin.AtouinConstants; - import flash.errors.IllegalOperationError; - import flash.utils.IDataInput; - import com.ankamagames.atouin.data.map.elements.BasicElement; - import com.ankamagames.atouin.data.elements.GraphicalElementData; - import com.ankamagames.atouin.data.elements.subtypes.NormalGraphicalElementData; - import com.ankamagames.atouin.data.elements.Elements; - import com.ankamagames.atouin.enums.ElementTypesEnum; - import com.ankamagames.atouin.data.map.elements.GraphicalElement; - - public class Map - { - - protected static const _log:Logger = Log.getLogger(getQualifiedClassName(Map)); - - public var mapClass:Class; - public var mapVersion:int; - public var encrypted:Boolean; - public var encryptionVersion:uint; - public var groundCRC:int; - public var zoomScale:Number = 1; - public var zoomOffsetX:int; - public var zoomOffsetY:int; - public var groundCacheCurrentlyUsed:int = 0; - public var id:int; - public var relativeId:int; - public var mapType:int; - public var backgroundsCount:int; - public var backgroundFixtures:Array; - public var foregroundsCount:int; - public var foregroundFixtures:Array; - public var subareaId:int; - public var shadowBonusOnEntities:int; - public var backgroundColor:uint; - public var backgroundRed:int; - public var backgroundGreen:int; - public var backgroundBlue:int; - public var topNeighbourId:int; - public var bottomNeighbourId:int; - public var leftNeighbourId:int; - public var rightNeighbourId:int; - public var useLowPassFilter:Boolean; - public var useReverb:Boolean; - public var presetId:int; - public var cellsCount:int; - public var layersCount:int; - public var isUsingNewMovementSystem:Boolean = false; - public var layers:Array; - public var cells:Array; - public var topArrowCell:Array; - public var leftArrowCell:Array; - public var bottomArrowCell:Array; - public var rightArrowCell:Array; - private var _parsed:Boolean; - private var _failed:Boolean; - private var _gfxList:Array; - private var _gfxCount:Array; - - public function Map() - { - this.mapClass = Map; - this.topArrowCell = []; - this.leftArrowCell = []; - this.bottomArrowCell = []; - this.rightArrowCell = []; - super(); - } - - public function get parsed():Boolean - { - return (this._parsed); - } - - public function get failed():Boolean - { - return (this._failed); - } - - public function getGfxList(skipBackground:Boolean=false):Array - { - if (!(this._gfxList)) + import com.ankamagames.jerakine.logger.Logger; + import com.ankamagames.jerakine.logger.Log; + import flash.utils.getQualifiedClassName; + import flash.utils.IDataInput; + import flash.utils.ByteArray; + import com.ankamagames.atouin.data.DataFormatError; + import com.ankamagames.atouin.AtouinConstants; + import flash.errors.IllegalOperationError; + import com.ankamagames.atouin.data.map.elements.BasicElement; + import com.ankamagames.atouin.data.elements.GraphicalElementData; + import com.ankamagames.atouin.data.elements.subtypes.NormalGraphicalElementData; + import com.ankamagames.atouin.data.elements.Elements; + import com.ankamagames.atouin.enums.ElementTypesEnum; + import com.ankamagames.atouin.data.map.elements.GraphicalElement; + + public class Map extends Object + { + + public function Map() + { + this.mapClass = Map; + this.topArrowCell = []; + this.leftArrowCell = []; + this.bottomArrowCell = []; + this.rightArrowCell = []; + super(); + } + + protected static const _log:Logger = Log.getLogger(getQualifiedClassName(Map)); + + public var mapClass:Class; + + public var mapVersion:int; + + public var encrypted:Boolean; + + public var encryptionVersion:uint; + + public var groundCRC:int; + + public var zoomScale:Number = 1; + + public var zoomOffsetX:int; + + public var zoomOffsetY:int; + + public var groundCacheCurrentlyUsed:int = 0; + + public var id:int; + + public var relativeId:int; + + public var mapType:int; + + public var backgroundsCount:int; + + public var backgroundFixtures:Array; + + public var foregroundsCount:int; + + public var foregroundFixtures:Array; + + public var subareaId:int; + + public var shadowBonusOnEntities:int; + + public var backgroundColor:uint; + + public var backgroundRed:int; + + public var backgroundGreen:int; + + public var backgroundBlue:int; + + public var topNeighbourId:int; + + public var bottomNeighbourId:int; + + public var leftNeighbourId:int; + + public var rightNeighbourId:int; + + public var useLowPassFilter:Boolean; + + public var useReverb:Boolean; + + public var presetId:int; + + public var cellsCount:int; + + public var layersCount:int; + + public var isUsingNewMovementSystem:Boolean = false; + + public var layers:Array; + + public var cells:Array; + + public var topArrowCell:Array; + + public var leftArrowCell:Array; + + public var bottomArrowCell:Array; + + public var rightArrowCell:Array; + + private var _parsed:Boolean; + + private var _failed:Boolean; + + private var _gfxList:Array; + + private var _gfxCount:Array; + + public function get parsed() : Boolean + { + return this._parsed; + } + + public function get failed() : Boolean + { + return this._failed; + } + + public function getGfxList(param1:Boolean = false) : Array + { + if(!this._gfxList) + { + this.computeGfxList(param1); + } + return this._gfxList; + } + + public function getGfxCount(param1:uint) : uint + { + if(!this._gfxList) + { + this.computeGfxList(); + } + return this._gfxCount[param1]; + } + + public function fromRaw(param1:IDataInput, param2:ByteArray = null) : void + { + var i:int = 0; + var header:int = 0; + var bg:Fixture = null; + var la:Layer = null; + var _oldMvtSystem:uint = 0; + var cd:CellData = null; + var dataLen:uint = 0; + var encryptedData:ByteArray = null; + var fg:Fixture = null; + var raw:IDataInput = param1; + var decryptionKey:ByteArray = param2; + try + { + header = raw.readByte(); + if(header != 77) { - this.computeGfxList(skipBackground); - }; - return (this._gfxList); - } - - public function getGfxCount(gfxId:uint):uint - { - if (!(this._gfxList)) - { - this.computeGfxList(); - }; - return (this._gfxCount[gfxId]); - } - - public function fromRaw(raw:IDataInput, decryptionKey:ByteArray=null):void - { - var i:int; - var header:int; - var bg:Fixture; - var la:Layer; - var _oldMvtSystem:uint; - var cd:CellData; - var dataLen:uint; - var encryptedData:ByteArray; - var fg:Fixture; - try + throw new DataFormatError("Unknown file format"); + } + else { - header = raw.readByte(); - if (header != 77) - { - throw (new DataFormatError("Unknown file format")); - }; - this.mapVersion = raw.readByte(); - if (AtouinConstants.DEBUG_FILES_PARSING) - { - _log.debug(("Map version : " + this.mapVersion)); - }; - this.id = raw.readUnsignedInt(); - if (AtouinConstants.DEBUG_FILES_PARSING) - { - _log.debug(("Map id : " + this.id)); - }; - if (this.mapVersion >= 7) - { - this.encrypted = raw.readBoolean(); - this.encryptionVersion = raw.readByte(); - dataLen = raw.readInt(); - if (this.encrypted) - { - if (!(decryptionKey)) - { - throw (new IllegalOperationError("Map decryption key is empty")); - }; + this.mapVersion = raw.readByte(); + if(AtouinConstants.DEBUG_FILES_PARSING) + { + _log.debug("Map version : " + this.mapVersion); + } + this.id = raw.readUnsignedInt(); + if(AtouinConstants.DEBUG_FILES_PARSING) + { + _log.debug("Map id : " + this.id); + } + if(this.mapVersion >= 7) + { + this.encrypted = raw.readBoolean(); + this.encryptionVersion = raw.readByte(); + dataLen = raw.readInt(); + if(this.encrypted) + { + if(!decryptionKey) + { + throw new IllegalOperationError("Map decryption key is empty"); + } + else + { encryptedData = new ByteArray(); - raw.readBytes(encryptedData, 0, dataLen); + raw.readBytes(encryptedData,0,dataLen); i = 0; - while (i < encryptedData.length) + while(i < encryptedData.length) { - encryptedData[i] = (encryptedData[i] ^ decryptionKey[(i % decryptionKey.length)]); - i = (i + 1); - }; + encryptedData[i] = encryptedData[i] ^ decryptionKey[i % decryptionKey.length]; + i++; + } encryptedData.position = 0; raw = encryptedData; - }; - }; - this.relativeId = raw.readUnsignedInt(); - if (AtouinConstants.DEBUG_FILES_PARSING) - { - _log.debug(("Map relativeId: " + this.relativeId)); - }; - this.mapType = raw.readByte(); - if (AtouinConstants.DEBUG_FILES_PARSING) - { - _log.debug(("Map type : " + this.mapType)); - }; - this.subareaId = raw.readInt(); - if (AtouinConstants.DEBUG_FILES_PARSING) - { - _log.debug(("Subarea id : " + this.subareaId)); - }; - this.topNeighbourId = raw.readInt(); - if (AtouinConstants.DEBUG_FILES_PARSING) - { - _log.debug(("topNeighbourId : " + this.topNeighbourId)); - }; - this.bottomNeighbourId = raw.readInt(); - if (AtouinConstants.DEBUG_FILES_PARSING) - { - _log.debug(("bottomNeighbourId : " + this.bottomNeighbourId)); - }; - this.leftNeighbourId = raw.readInt(); - if (AtouinConstants.DEBUG_FILES_PARSING) - { - _log.debug(("leftNeighbourId : " + this.leftNeighbourId)); - }; - this.rightNeighbourId = raw.readInt(); - if (AtouinConstants.DEBUG_FILES_PARSING) - { - _log.debug(("rightNeighbourId : " + this.rightNeighbourId)); - }; - this.shadowBonusOnEntities = raw.readInt(); - if (AtouinConstants.DEBUG_FILES_PARSING) - { - _log.debug(("ShadowBonusOnEntities : " + this.shadowBonusOnEntities)); - }; - if (this.mapVersion >= 3) - { - this.backgroundRed = raw.readByte(); - this.backgroundGreen = raw.readByte(); - this.backgroundBlue = raw.readByte(); - this.backgroundColor = ((((this.backgroundRed & 0xFF) << 16) | ((this.backgroundGreen & 0xFF) << 8)) | (this.backgroundBlue & 0xFF)); - if (AtouinConstants.DEBUG_FILES_PARSING) - { - _log.debug(((((("BackgroundColor : " + this.backgroundRed) + ",") + this.backgroundGreen) + ",") + this.backgroundBlue)); - }; - }; - if (this.mapVersion >= 4) - { - this.zoomScale = (raw.readUnsignedShort() / 100); - this.zoomOffsetX = raw.readShort(); - this.zoomOffsetY = raw.readShort(); - if (this.zoomScale < 1) - { - this.zoomScale = 1; - this.zoomOffsetX = (this.zoomOffsetY = 0); - }; - if (AtouinConstants.DEBUG_FILES_PARSING) - { - _log.debug(((((("Zoom auto : " + this.zoomScale) + ",") + this.zoomOffsetX) + ",") + this.zoomOffsetY)); - }; - }; - this.useLowPassFilter = (raw.readByte() == 1); - if (AtouinConstants.DEBUG_FILES_PARSING) - { - _log.debug(("useLowPassFilter : " + this.useLowPassFilter)); - }; - this.useReverb = (raw.readByte() == 1); - if (AtouinConstants.DEBUG_FILES_PARSING) - { - _log.debug(("useReverb : " + this.useReverb)); - }; - if (this.useReverb) - { - this.presetId = raw.readInt(); - } - else - { - this.presetId = -1; - }; - if (AtouinConstants.DEBUG_FILES_PARSING) - { - _log.debug(("presetId : " + this.presetId)); - }; - this.backgroundsCount = raw.readByte(); - if (AtouinConstants.DEBUG_FILES_PARSING) - { - _log.debug(("Backgrounds count : " + this.backgroundsCount)); - }; - this.backgroundFixtures = new Array(); - i = 0; - while (i < this.backgroundsCount) - { - bg = new Fixture(this); - if (AtouinConstants.DEBUG_FILES_PARSING) - { - _log.debug((("Background at index " + i) + " :")); - }; - bg.fromRaw(raw); - this.backgroundFixtures.push(bg); - i = (i + 1); - }; - this.foregroundsCount = raw.readByte(); - if (AtouinConstants.DEBUG_FILES_PARSING) - { - _log.debug(("Foregrounds count : " + this.foregroundsCount)); - }; - this.foregroundFixtures = new Array(); - i = 0; - while (i < this.foregroundsCount) - { - fg = new Fixture(this); - if (AtouinConstants.DEBUG_FILES_PARSING) - { - _log.debug((("Foreground at index " + i) + " :")); - }; - fg.fromRaw(raw); - this.foregroundFixtures.push(fg); - i = (i + 1); - }; - this.cellsCount = AtouinConstants.MAP_CELLS_COUNT; - if (AtouinConstants.DEBUG_FILES_PARSING) - { - _log.debug(("Cells count : " + this.cellsCount)); - }; - raw.readInt(); - this.groundCRC = raw.readInt(); - if (AtouinConstants.DEBUG_FILES_PARSING) - { - _log.debug(("groundCRC : " + this.groundCRC)); - }; - this.layersCount = raw.readByte(); - if (AtouinConstants.DEBUG_FILES_PARSING) - { - _log.debug(("Layers count : " + this.layersCount)); - }; - this.layers = new Array(); - i = 0; - while (i < this.layersCount) - { - la = new Layer(this); - if (AtouinConstants.DEBUG_FILES_PARSING) - { - _log.debug((("Layer at index " + i) + " :")); - }; - la.fromRaw(raw, this.mapVersion); - this.layers.push(la); - i = (i + 1); - }; - this.cells = new Array(); - i = 0; - while (i < this.cellsCount) - { - cd = new CellData(this, i); - if (AtouinConstants.DEBUG_FILES_PARSING) - { - _log.debug((("Cell data at index " + i) + " :")); - }; - cd.fromRaw(raw); - if (!(_oldMvtSystem)) - { - _oldMvtSystem = cd.moveZone; - }; - if (cd.moveZone != _oldMvtSystem) - { - this.isUsingNewMovementSystem = true; - }; - this.cells.push(cd); - i = (i + 1); - }; - if (AtouinConstants.DEBUG_FILES_PARSING) - { - trace(((this.isUsingNewMovementSystem) ? "This map is using the new movement system" : "This map is using the old movement system")); - }; - this._parsed = true; + } + } + } + this.relativeId = raw.readUnsignedInt(); + if(AtouinConstants.DEBUG_FILES_PARSING) + { + _log.debug("Map relativeId: " + this.relativeId); + } + this.mapType = raw.readByte(); + if(AtouinConstants.DEBUG_FILES_PARSING) + { + _log.debug("Map type : " + this.mapType); + } + this.subareaId = raw.readInt(); + if(AtouinConstants.DEBUG_FILES_PARSING) + { + _log.debug("Subarea id : " + this.subareaId); + } + this.topNeighbourId = raw.readInt(); + if(AtouinConstants.DEBUG_FILES_PARSING) + { + _log.debug("topNeighbourId : " + this.topNeighbourId); + } + this.bottomNeighbourId = raw.readInt(); + if(AtouinConstants.DEBUG_FILES_PARSING) + { + _log.debug("bottomNeighbourId : " + this.bottomNeighbourId); + } + this.leftNeighbourId = raw.readInt(); + if(AtouinConstants.DEBUG_FILES_PARSING) + { + _log.debug("leftNeighbourId : " + this.leftNeighbourId); + } + this.rightNeighbourId = raw.readInt(); + if(AtouinConstants.DEBUG_FILES_PARSING) + { + _log.debug("rightNeighbourId : " + this.rightNeighbourId); + } + this.shadowBonusOnEntities = raw.readInt(); + if(AtouinConstants.DEBUG_FILES_PARSING) + { + _log.debug("ShadowBonusOnEntities : " + this.shadowBonusOnEntities); + } + if(this.mapVersion >= 3) + { + this.backgroundRed = raw.readByte(); + this.backgroundGreen = raw.readByte(); + this.backgroundBlue = raw.readByte(); + this.backgroundColor = (this.backgroundRed & 255) << 16 | (this.backgroundGreen & 255) << 8 | this.backgroundBlue & 255; + if(AtouinConstants.DEBUG_FILES_PARSING) + { + _log.debug("BackgroundColor : " + this.backgroundRed + "," + this.backgroundGreen + "," + this.backgroundBlue); + } + } + if(this.mapVersion >= 4) + { + this.zoomScale = raw.readUnsignedShort() / 100; + this.zoomOffsetX = raw.readShort(); + this.zoomOffsetY = raw.readShort(); + if(this.zoomScale < 1) + { + this.zoomScale = 1; + this.zoomOffsetX = this.zoomOffsetY = 0; + } + if(AtouinConstants.DEBUG_FILES_PARSING) + { + _log.debug("Zoom auto : " + this.zoomScale + "," + this.zoomOffsetX + "," + this.zoomOffsetY); + } + } + this.useLowPassFilter = raw.readByte() == 1; + if(AtouinConstants.DEBUG_FILES_PARSING) + { + _log.debug("useLowPassFilter : " + this.useLowPassFilter); + } + this.useReverb = raw.readByte() == 1; + if(AtouinConstants.DEBUG_FILES_PARSING) + { + _log.debug("useReverb : " + this.useReverb); + } + if(this.useReverb) + { + this.presetId = raw.readInt(); + } + else + { + this.presetId = -1; + } + if(AtouinConstants.DEBUG_FILES_PARSING) + { + _log.debug("presetId : " + this.presetId); + } + this.backgroundsCount = raw.readByte(); + if(AtouinConstants.DEBUG_FILES_PARSING) + { + _log.debug("Backgrounds count : " + this.backgroundsCount); + } + this.backgroundFixtures = new Array(); + i = 0; + while(i < this.backgroundsCount) + { + bg = new Fixture(this); + if(AtouinConstants.DEBUG_FILES_PARSING) + { + _log.debug("Background at index " + i + " :"); + } + bg.fromRaw(raw); + this.backgroundFixtures.push(bg); + i++; + } + this.foregroundsCount = raw.readByte(); + if(AtouinConstants.DEBUG_FILES_PARSING) + { + _log.debug("Foregrounds count : " + this.foregroundsCount); + } + this.foregroundFixtures = new Array(); + i = 0; + while(i < this.foregroundsCount) + { + fg = new Fixture(this); + if(AtouinConstants.DEBUG_FILES_PARSING) + { + _log.debug("Foreground at index " + i + " :"); + } + fg.fromRaw(raw); + this.foregroundFixtures.push(fg); + i++; + } + this.cellsCount = AtouinConstants.MAP_CELLS_COUNT; + if(AtouinConstants.DEBUG_FILES_PARSING) + { + _log.debug("Cells count : " + this.cellsCount); + } + raw.readInt(); + this.groundCRC = raw.readInt(); + if(AtouinConstants.DEBUG_FILES_PARSING) + { + _log.debug("groundCRC : " + this.groundCRC); + } + this.layersCount = raw.readByte(); + if(AtouinConstants.DEBUG_FILES_PARSING) + { + _log.debug("Layers count : " + this.layersCount); + } + this.layers = new Array(); + i = 0; + while(i < this.layersCount) + { + la = new Layer(this); + if(AtouinConstants.DEBUG_FILES_PARSING) + { + _log.debug("Layer at index " + i + " :"); + } + la.fromRaw(raw,this.mapVersion); + this.layers.push(la); + i++; + } + this.cells = new Array(); + i = 0; + while(i < this.cellsCount) + { + cd = new CellData(this,i); + if(AtouinConstants.DEBUG_FILES_PARSING) + { + _log.debug("Cell data at index " + i + " :"); + } + cd.fromRaw(raw); + if(!_oldMvtSystem) + { + _oldMvtSystem = cd.moveZone; + } + if(cd.moveZone != _oldMvtSystem) + { + this.isUsingNewMovementSystem = true; + } + this.cells.push(cd); + i++; + } + if(AtouinConstants.DEBUG_FILES_PARSING) + { + trace(this.isUsingNewMovementSystem?"This map is using the new movement system":"This map is using the old movement system"); + } + this._parsed = true; } - catch(e) - { - _failed = true; - throw (e); - }; - } - - private function computeGfxList(skipBackground:Boolean=false):void - { - var l:int; - var c:int; - var e:int; - var lsCell:Array; - var numCell:int; - var lsElement:Array; - var numElement:int; - var layer:Layer; - var cell:Cell; - var element:BasicElement; - var elementId:int; - var elementData:GraphicalElementData; - var graphicalElementData:NormalGraphicalElementData; - var s:String; - var ele:Elements = Elements.getInstance(); - var gfxList:Array = new Array(); - this._gfxCount = new Array(); - var numLayer:int = this.layers.length; - l = 0; - while (l < numLayer) + } + catch(e:*) + { + _failed = true; + throw e; + } + } + + private function computeGfxList(param1:Boolean = false) : void + { + var _loc5_:* = 0; + var _loc6_:* = 0; + var _loc7_:* = 0; + var _loc8_:Array = null; + var _loc9_:* = 0; + var _loc10_:Array = null; + var _loc11_:* = 0; + var _loc12_:Layer = null; + var _loc13_:Cell = null; + var _loc14_:BasicElement = null; + var _loc15_:* = 0; + var _loc16_:GraphicalElementData = null; + var _loc17_:NormalGraphicalElementData = null; + var _loc18_:String = null; + var _loc2_:Elements = Elements.getInstance(); + var _loc3_:Array = new Array(); + this._gfxCount = new Array(); + var _loc4_:int = this.layers.length; + _loc5_ = 0; + while(_loc5_ < _loc4_) + { + _loc12_ = this.layers[_loc5_]; + if(!((param1) && _loc5_ == 0)) { - layer = this.layers[l]; - if (((skipBackground) && ((l == 0)))) - { - } - else - { - lsCell = layer.cells; - numCell = lsCell.length; - c = 0; - while (c < numCell) - { - cell = lsCell[c]; - lsElement = cell.elements; - numElement = lsElement.length; - e = 0; - while (e < numElement) + _loc8_ = _loc12_.cells; + _loc9_ = _loc8_.length; + _loc6_ = 0; + while(_loc6_ < _loc9_) + { + _loc13_ = _loc8_[_loc6_]; + _loc10_ = _loc13_.elements; + _loc11_ = _loc10_.length; + _loc7_ = 0; + while(_loc7_ < _loc11_) + { + _loc14_ = _loc10_[_loc7_]; + if(_loc14_.elementType == ElementTypesEnum.GRAPHICAL) + { + _loc15_ = GraphicalElement(_loc14_).elementId; + _loc16_ = _loc2_.getElementData(_loc15_); + if(_loc16_ == null) { - element = lsElement[e]; - if (element.elementType == ElementTypesEnum.GRAPHICAL) - { - elementId = GraphicalElement(element).elementId; - elementData = ele.getElementData(elementId); - if (elementData == null) - { - _log.error(("Unknown graphical element ID " + elementId)); - } - else - { - if ((elementData is NormalGraphicalElementData)) - { - graphicalElementData = (elementData as NormalGraphicalElementData); - gfxList[graphicalElementData.gfxId] = graphicalElementData; - if (this._gfxCount[graphicalElementData.gfxId]) - { - var _local_19 = this._gfxCount; - var _local_20 = graphicalElementData.gfxId; - var _local_21 = (_local_19[_local_20] + 1); - _local_19[_local_20] = _local_21; - } - else - { - this._gfxCount[graphicalElementData.gfxId] = 1; - }; - }; - }; - }; - e++; - }; - c++; - }; - }; - l++; - }; - this._gfxList = new Array(); - for (s in gfxList) - { - this._gfxList.push(gfxList[s]); - }; - } - - - } -}//package com.ankamagames.atouin.data.map - + _log.error("Unknown graphical element ID " + _loc15_); + } + else if(_loc16_ is NormalGraphicalElementData) + { + _loc17_ = _loc16_ as NormalGraphicalElementData; + _loc3_[_loc17_.gfxId] = _loc17_; + if(this._gfxCount[_loc17_.gfxId]) + { + this._gfxCount[_loc17_.gfxId]++; + } + else + { + this._gfxCount[_loc17_.gfxId] = 1; + } + } + + } + _loc7_++; + } + _loc6_++; + } + } + _loc5_++; + } + this._gfxList = new Array(); + for(_loc18_ in _loc3_) + { + this._gfxList.push(_loc3_[_loc18_]); + } + } + } +} diff --git a/com/ankamagames/atouin/data/map/elements/BasicElement.as b/com/ankamagames/atouin/data/map/elements/BasicElement.as index 2b870a187..5fa9b4386 100644 --- a/com/ankamagames/atouin/data/map/elements/BasicElement.as +++ b/com/ankamagames/atouin/data/map/elements/BasicElement.as @@ -1,53 +1,51 @@ -package com.ankamagames.atouin.data.map.elements +package com.ankamagames.atouin.data.map.elements { - import com.ankamagames.jerakine.logger.Logger; - import com.ankamagames.jerakine.logger.Log; - import flash.utils.getQualifiedClassName; - import com.ankamagames.atouin.data.map.Cell; - import com.ankamagames.atouin.enums.ElementTypesEnum; - import flash.utils.IDataInput; - - public class BasicElement - { - - protected static const _log:Logger = Log.getLogger(getQualifiedClassName(BasicElement)); - - private var _cell:Cell; - - public function BasicElement(cell:Cell) - { - this._cell = cell; - } - - public static function getElementFromType(type:int, cell:Cell):BasicElement - { - switch (type) - { - case ElementTypesEnum.GRAPHICAL: - return (new GraphicalElement(cell)); - case ElementTypesEnum.SOUND: - return (new SoundElement(cell)); - }; - throw (new UnknownElementError((((("Un élément de type inconnu " + type) + " a été trouvé sur la cellule ") + cell.cellId) + "!"))); - } - - - public function get cell():Cell - { - return (this._cell); - } - - public function get elementType():int - { - return (-1); - } - - public function fromRaw(raw:IDataInput, mapVersion:int):void - { - throw (new Error("Cette méthode doit être surchargée !")); - } - - - } -}//package com.ankamagames.atouin.data.map.elements - + import com.ankamagames.jerakine.logger.Logger; + import com.ankamagames.atouin.data.map.Cell; + import com.ankamagames.atouin.enums.ElementTypesEnum; + import com.ankamagames.jerakine.logger.Log; + import flash.utils.getQualifiedClassName; + import flash.utils.IDataInput; + + public class BasicElement extends Object + { + + public function BasicElement(param1:Cell) + { + super(); + this._cell = param1; + } + + protected static const _log:Logger = Log.getLogger(getQualifiedClassName(BasicElement)); + + public static function getElementFromType(param1:int, param2:Cell) : BasicElement + { + switch(param1) + { + case ElementTypesEnum.GRAPHICAL: + return new GraphicalElement(param2); + case ElementTypesEnum.SOUND: + return new SoundElement(param2); + default: + throw new UnknownElementError("Un élément de type inconnu " + param1 + " a été trouvé sur la cellule " + param2.cellId + "!"); + } + } + + private var _cell:Cell; + + public function get cell() : Cell + { + return this._cell; + } + + public function get elementType() : int + { + return -1; + } + + public function fromRaw(param1:IDataInput, param2:int) : void + { + throw new Error("Cette méthode doit être surchargée !"); + } + } +} diff --git a/com/ankamagames/atouin/data/map/elements/GraphicalElement.as b/com/ankamagames/atouin/data/map/elements/GraphicalElement.as index 56b92913d..daa161e48 100644 --- a/com/ankamagames/atouin/data/map/elements/GraphicalElement.as +++ b/com/ankamagames/atouin/data/map/elements/GraphicalElement.as @@ -1,112 +1,118 @@ -package com.ankamagames.atouin.data.map.elements +package com.ankamagames.atouin.data.map.elements { - import com.ankamagames.jerakine.types.ColorMultiplicator; - import flash.geom.Point; - import com.ankamagames.atouin.data.map.Cell; - import com.ankamagames.atouin.enums.ElementTypesEnum; - import com.ankamagames.atouin.AtouinConstants; - import flash.utils.IDataInput; - - public class GraphicalElement extends BasicElement - { - - public var elementId:int; - public var hue:ColorMultiplicator; - public var shadow:ColorMultiplicator; - public var finalTeint:ColorMultiplicator; - public var offset:Point; - public var pixelOffset:Point; - public var altitude:int; - public var identifier:uint; - - public function GraphicalElement(cell:Cell) - { - super(cell); - } - - override public function get elementType():int - { - return (ElementTypesEnum.GRAPHICAL); - } - - public function get colorMultiplicator():ColorMultiplicator - { - return (this.finalTeint); - } - - private function calculateFinalTeint():void - { - var r:Number = (this.hue.red + this.shadow.red); - var g:Number = (this.hue.green + this.shadow.green); - var b:Number = (this.hue.blue + this.shadow.blue); - r = ColorMultiplicator.clamp(((r + 128) * 2), 0, 0x0200); - g = ColorMultiplicator.clamp(((g + 128) * 2), 0, 0x0200); - b = ColorMultiplicator.clamp(((b + 128) * 2), 0, 0x0200); - this.finalTeint = new ColorMultiplicator(r, g, b, true); - } - - override public function fromRaw(raw:IDataInput, mapVersion:int):void - { - try + import com.ankamagames.jerakine.types.ColorMultiplicator; + import flash.geom.Point; + import com.ankamagames.atouin.enums.ElementTypesEnum; + import flash.utils.IDataInput; + import com.ankamagames.atouin.AtouinConstants; + import com.ankamagames.atouin.data.map.Cell; + + public class GraphicalElement extends BasicElement + { + + public function GraphicalElement(param1:Cell) + { + super(param1); + } + + public var elementId:int; + + public var hue:ColorMultiplicator; + + public var shadow:ColorMultiplicator; + + public var finalTeint:ColorMultiplicator; + + public var offset:Point; + + public var pixelOffset:Point; + + public var altitude:int; + + public var identifier:uint; + + override public function get elementType() : int + { + return ElementTypesEnum.GRAPHICAL; + } + + public function get colorMultiplicator() : ColorMultiplicator + { + return this.finalTeint; + } + + private function calculateFinalTeint() : void + { + var _loc1_:Number = this.hue.red + this.shadow.red; + var _loc2_:Number = this.hue.green + this.shadow.green; + var _loc3_:Number = this.hue.blue + this.shadow.blue; + _loc1_ = ColorMultiplicator.clamp((_loc1_ + 128) * 2,0,512); + _loc2_ = ColorMultiplicator.clamp((_loc2_ + 128) * 2,0,512); + _loc3_ = ColorMultiplicator.clamp((_loc3_ + 128) * 2,0,512); + this.finalTeint = new ColorMultiplicator(_loc1_,_loc2_,_loc3_,true); + } + + override public function fromRaw(param1:IDataInput, param2:int) : void + { + var raw:IDataInput = param1; + var mapVersion:int = param2; + try + { + this.elementId = raw.readUnsignedInt(); + if(AtouinConstants.DEBUG_FILES_PARSING_ELEMENTS) { - this.elementId = raw.readUnsignedInt(); - if (AtouinConstants.DEBUG_FILES_PARSING_ELEMENTS) - { - _log.debug((" (GraphicalElement) Element id : " + this.elementId)); - }; - this.hue = new ColorMultiplicator(raw.readByte(), raw.readByte(), raw.readByte()); - if (AtouinConstants.DEBUG_FILES_PARSING_ELEMENTS) - { - _log.debug((" (GraphicalElement) Hue : " + this.hue)); - }; - this.shadow = new ColorMultiplicator(raw.readByte(), raw.readByte(), raw.readByte()); - if (AtouinConstants.DEBUG_FILES_PARSING_ELEMENTS) - { - _log.debug((" (GraphicalElement) Shadow : " + this.shadow)); - }; - this.offset = new Point(); - this.pixelOffset = new Point(); - if (mapVersion <= 4) - { - this.offset.x = raw.readByte(); - this.offset.y = raw.readByte(); - this.pixelOffset.x = (this.offset.x * AtouinConstants.CELL_HALF_WIDTH); - this.pixelOffset.y = (this.offset.y * AtouinConstants.CELL_HALF_HEIGHT); - } - else - { - this.pixelOffset.x = raw.readShort(); - this.pixelOffset.y = raw.readShort(); - this.offset.x = (this.pixelOffset.x / AtouinConstants.CELL_HALF_WIDTH); - this.offset.y = (this.pixelOffset.y / AtouinConstants.CELL_HALF_HEIGHT); - }; - if (AtouinConstants.DEBUG_FILES_PARSING_ELEMENTS) - { - _log.debug(((((" (GraphicalElement) Offset : (" + this.offset.x) + ";") + this.offset.y) + ")")); - }; - if (AtouinConstants.DEBUG_FILES_PARSING_ELEMENTS) - { - _log.debug(((((" (GraphicalElement) Pixel Offset : (" + this.pixelOffset.x) + ";") + this.pixelOffset.y) + ")")); - }; - this.altitude = raw.readByte(); - if (AtouinConstants.DEBUG_FILES_PARSING_ELEMENTS) - { - _log.debug((" (GraphicalElement) Altitude : " + this.altitude)); - }; - this.identifier = raw.readUnsignedInt(); - if (AtouinConstants.DEBUG_FILES_PARSING_ELEMENTS) - { - _log.debug((" (GraphicalElement) Identifier : " + this.identifier)); - }; - this.calculateFinalTeint(); + _log.debug(" (GraphicalElement) Element id : " + this.elementId); } - catch(e) + this.hue = new ColorMultiplicator(raw.readByte(),raw.readByte(),raw.readByte()); + if(AtouinConstants.DEBUG_FILES_PARSING_ELEMENTS) { - throw (e); - }; - } - - - } -}//package com.ankamagames.atouin.data.map.elements - + _log.debug(" (GraphicalElement) Hue : " + this.hue); + } + this.shadow = new ColorMultiplicator(raw.readByte(),raw.readByte(),raw.readByte()); + if(AtouinConstants.DEBUG_FILES_PARSING_ELEMENTS) + { + _log.debug(" (GraphicalElement) Shadow : " + this.shadow); + } + this.offset = new Point(); + this.pixelOffset = new Point(); + if(mapVersion <= 4) + { + this.offset.x = raw.readByte(); + this.offset.y = raw.readByte(); + this.pixelOffset.x = this.offset.x * AtouinConstants.CELL_HALF_WIDTH; + this.pixelOffset.y = this.offset.y * AtouinConstants.CELL_HALF_HEIGHT; + } + else + { + this.pixelOffset.x = raw.readShort(); + this.pixelOffset.y = raw.readShort(); + this.offset.x = this.pixelOffset.x / AtouinConstants.CELL_HALF_WIDTH; + this.offset.y = this.pixelOffset.y / AtouinConstants.CELL_HALF_HEIGHT; + } + if(AtouinConstants.DEBUG_FILES_PARSING_ELEMENTS) + { + _log.debug(" (GraphicalElement) Offset : (" + this.offset.x + ";" + this.offset.y + ")"); + } + if(AtouinConstants.DEBUG_FILES_PARSING_ELEMENTS) + { + _log.debug(" (GraphicalElement) Pixel Offset : (" + this.pixelOffset.x + ";" + this.pixelOffset.y + ")"); + } + this.altitude = raw.readByte(); + if(AtouinConstants.DEBUG_FILES_PARSING_ELEMENTS) + { + _log.debug(" (GraphicalElement) Altitude : " + this.altitude); + } + this.identifier = raw.readUnsignedInt(); + if(AtouinConstants.DEBUG_FILES_PARSING_ELEMENTS) + { + _log.debug(" (GraphicalElement) Identifier : " + this.identifier); + } + this.calculateFinalTeint(); + } + catch(e:*) + { + throw e; + } + } + } +} diff --git a/com/ankamagames/atouin/data/map/elements/SoundElement.as b/com/ankamagames/atouin/data/map/elements/SoundElement.as index bbff63175..5c4435cc7 100644 --- a/com/ankamagames/atouin/data/map/elements/SoundElement.as +++ b/com/ankamagames/atouin/data/map/elements/SoundElement.as @@ -1,72 +1,76 @@ -package com.ankamagames.atouin.data.map.elements +package com.ankamagames.atouin.data.map.elements { - import com.ankamagames.atouin.data.map.Cell; - import com.ankamagames.atouin.enums.ElementTypesEnum; - import com.ankamagames.atouin.AtouinConstants; - import flash.utils.IDataInput; - - public class SoundElement extends BasicElement - { - - public var soundId:int; - public var minDelayBetweenLoops:int; - public var maxDelayBetweenLoops:int; - public var baseVolume:int; - public var fullVolumeDistance:int; - public var nullVolumeDistance:int; - - public function SoundElement(cell:Cell) - { - super(cell); - } - - override public function get elementType():int - { - return (ElementTypesEnum.SOUND); - } - - override public function fromRaw(raw:IDataInput, mapVersion:int):void - { - try + import com.ankamagames.atouin.enums.ElementTypesEnum; + import flash.utils.IDataInput; + import com.ankamagames.atouin.AtouinConstants; + import com.ankamagames.atouin.data.map.Cell; + + public class SoundElement extends BasicElement + { + + public function SoundElement(param1:Cell) + { + super(param1); + } + + public var soundId:int; + + public var minDelayBetweenLoops:int; + + public var maxDelayBetweenLoops:int; + + public var baseVolume:int; + + public var fullVolumeDistance:int; + + public var nullVolumeDistance:int; + + override public function get elementType() : int + { + return ElementTypesEnum.SOUND; + } + + override public function fromRaw(param1:IDataInput, param2:int) : void + { + var raw:IDataInput = param1; + var mapVersion:int = param2; + try + { + this.soundId = raw.readInt(); + if(AtouinConstants.DEBUG_FILES_PARSING) { - this.soundId = raw.readInt(); - if (AtouinConstants.DEBUG_FILES_PARSING) - { - _log.debug((" (SoundElement) Sound id : " + this.soundId)); - }; - this.baseVolume = raw.readShort(); - if (AtouinConstants.DEBUG_FILES_PARSING) - { - _log.debug((" (SoundElement) Base volume : " + this.baseVolume)); - }; - this.fullVolumeDistance = raw.readInt(); - if (AtouinConstants.DEBUG_FILES_PARSING) - { - _log.debug((" (SoundElement) Full volume distance : " + this.fullVolumeDistance)); - }; - this.nullVolumeDistance = raw.readInt(); - if (AtouinConstants.DEBUG_FILES_PARSING) - { - _log.debug((" (SoundElement) Null volume distance : " + this.nullVolumeDistance)); - }; - this.minDelayBetweenLoops = raw.readShort(); - if (AtouinConstants.DEBUG_FILES_PARSING) - { - _log.debug((" (SoundElement) Minimal delay between loops : " + this.minDelayBetweenLoops)); - }; - this.maxDelayBetweenLoops = raw.readShort(); - if (AtouinConstants.DEBUG_FILES_PARSING) - { - _log.debug((" (SoundElement) Maximal delay between loops : " + this.maxDelayBetweenLoops)); - }; + _log.debug(" (SoundElement) Sound id : " + this.soundId); } - catch(e) + this.baseVolume = raw.readShort(); + if(AtouinConstants.DEBUG_FILES_PARSING) { - throw (e); - }; - } - - - } -}//package com.ankamagames.atouin.data.map.elements - + _log.debug(" (SoundElement) Base volume : " + this.baseVolume); + } + this.fullVolumeDistance = raw.readInt(); + if(AtouinConstants.DEBUG_FILES_PARSING) + { + _log.debug(" (SoundElement) Full volume distance : " + this.fullVolumeDistance); + } + this.nullVolumeDistance = raw.readInt(); + if(AtouinConstants.DEBUG_FILES_PARSING) + { + _log.debug(" (SoundElement) Null volume distance : " + this.nullVolumeDistance); + } + this.minDelayBetweenLoops = raw.readShort(); + if(AtouinConstants.DEBUG_FILES_PARSING) + { + _log.debug(" (SoundElement) Minimal delay between loops : " + this.minDelayBetweenLoops); + } + this.maxDelayBetweenLoops = raw.readShort(); + if(AtouinConstants.DEBUG_FILES_PARSING) + { + _log.debug(" (SoundElement) Maximal delay between loops : " + this.maxDelayBetweenLoops); + } + } + catch(e:*) + { + throw e; + } + } + } +} diff --git a/com/ankamagames/atouin/data/map/elements/UnknownElementError.as b/com/ankamagames/atouin/data/map/elements/UnknownElementError.as index 1001df131..9fae38566 100644 --- a/com/ankamagames/atouin/data/map/elements/UnknownElementError.as +++ b/com/ankamagames/atouin/data/map/elements/UnknownElementError.as @@ -1,13 +1,11 @@ -package com.ankamagames.atouin.data.map.elements +package com.ankamagames.atouin.data.map.elements { - public class UnknownElementError extends Error - { - - public function UnknownElementError(message:String="", id:uint=0) - { - super(message, id); - } - - } -}//package com.ankamagames.atouin.data.map.elements - + public class UnknownElementError extends Error + { + + public function UnknownElementError(param1:String = "", param2:uint = 0) + { + super(param1,param2); + } + } +} diff --git a/com/ankamagames/atouin/entities/behaviours/display/AtouinDisplayBehavior.as b/com/ankamagames/atouin/entities/behaviours/display/AtouinDisplayBehavior.as index 70923c10a..8c1e72d7a 100644 --- a/com/ankamagames/atouin/entities/behaviours/display/AtouinDisplayBehavior.as +++ b/com/ankamagames/atouin/entities/behaviours/display/AtouinDisplayBehavior.as @@ -1,57 +1,59 @@ -package com.ankamagames.atouin.entities.behaviours.display +package com.ankamagames.atouin.entities.behaviours.display { - import com.ankamagames.jerakine.entities.behaviours.IDisplayBehavior; - import com.ankamagames.jerakine.logger.Logger; - import com.ankamagames.jerakine.logger.Log; - import flash.utils.getQualifiedClassName; - import com.ankamagames.jerakine.utils.errors.SingletonError; - import com.ankamagames.jerakine.entities.interfaces.IEntity; - import com.ankamagames.atouin.managers.EntitiesManager; - import com.ankamagames.jerakine.entities.interfaces.IDisplayable; - import com.ankamagames.atouin.managers.EntitiesDisplayManager; - import com.ankamagames.jerakine.interfaces.IRectangle; - - public class AtouinDisplayBehavior implements IDisplayBehavior - { - - protected static const _log:Logger = Log.getLogger(getQualifiedClassName(AtouinDisplayBehavior)); - private static var _self:AtouinDisplayBehavior; - - public function AtouinDisplayBehavior() - { - if (_self != null) - { - throw (new SingletonError("A singleton class shouldn't be instancied directly!")); - }; - } - - public static function getInstance():AtouinDisplayBehavior - { - if (_self == null) - { - _self = new (AtouinDisplayBehavior)(); - }; - return (_self); - } - - - public function display(displayable:IDisplayable, strata:uint=0):void - { - var entity:IEntity = (displayable as IEntity); - EntitiesManager.getInstance().addAnimatedEntity(entity.id, entity, strata); - } - - public function remove(entity:IDisplayable):void - { - EntitiesManager.getInstance().removeEntity((entity as IEntity).id); - } - - public function getAbsoluteBounds(entity:IDisplayable):IRectangle - { - return (EntitiesDisplayManager.getInstance().getAbsoluteBounds(entity)); - } - - - } -}//package com.ankamagames.atouin.entities.behaviours.display - + import com.ankamagames.jerakine.entities.behaviours.IDisplayBehavior; + import com.ankamagames.jerakine.logger.Logger; + import com.ankamagames.jerakine.logger.Log; + import flash.utils.getQualifiedClassName; + import com.ankamagames.jerakine.entities.interfaces.IDisplayable; + import com.ankamagames.jerakine.entities.interfaces.IEntity; + import com.ankamagames.atouin.managers.EntitiesManager; + import com.ankamagames.jerakine.interfaces.IRectangle; + import com.ankamagames.atouin.managers.EntitiesDisplayManager; + import com.ankamagames.jerakine.utils.errors.SingletonError; + + public class AtouinDisplayBehavior extends Object implements IDisplayBehavior + { + + public function AtouinDisplayBehavior() + { + super(); + if(_self != null) + { + throw new SingletonError("A singleton class shouldn\'t be instancied directly!"); + } + else + { + return; + } + } + + protected static const _log:Logger = Log.getLogger(getQualifiedClassName(AtouinDisplayBehavior)); + + private static var _self:AtouinDisplayBehavior; + + public static function getInstance() : AtouinDisplayBehavior + { + if(_self == null) + { + _self = new AtouinDisplayBehavior(); + } + return _self; + } + + public function display(param1:IDisplayable, param2:uint = 0) : void + { + var _loc3_:IEntity = param1 as IEntity; + EntitiesManager.getInstance().addAnimatedEntity(_loc3_.id,_loc3_,param2); + } + + public function remove(param1:IDisplayable) : void + { + EntitiesManager.getInstance().removeEntity((param1 as IEntity).id); + } + + public function getAbsoluteBounds(param1:IDisplayable) : IRectangle + { + return EntitiesDisplayManager.getInstance().getAbsoluteBounds(param1); + } + } +} diff --git a/com/ankamagames/atouin/entities/behaviours/movements/AnimatedMovementBehavior.as b/com/ankamagames/atouin/entities/behaviours/movements/AnimatedMovementBehavior.as index 2f148ef30..a9cec3468 100644 --- a/com/ankamagames/atouin/entities/behaviours/movements/AnimatedMovementBehavior.as +++ b/com/ankamagames/atouin/entities/behaviours/movements/AnimatedMovementBehavior.as @@ -1,399 +1,403 @@ -package com.ankamagames.atouin.entities.behaviours.movements +package com.ankamagames.atouin.entities.behaviours.movements { - import com.ankamagames.jerakine.entities.behaviours.IMovementBehavior; - import com.ankamagames.jerakine.logger.Logger; - import com.ankamagames.jerakine.logger.Log; - import avmplus.getQualifiedClassName; - import flash.utils.Dictionary; - import com.ankamagames.atouin.managers.InteractiveCellManager; - import com.ankamagames.atouin.types.TweenEntityData; - import com.ankamagames.atouin.Atouin; - import com.ankamagames.atouin.messages.EntityMovementStartMessage; - import com.ankamagames.jerakine.entities.interfaces.IMovable; - import com.ankamagames.jerakine.types.positions.MovementPath; - import com.ankamagames.tiphon.display.TiphonSprite; - import flash.display.DisplayObject; - import com.ankamagames.jerakine.types.positions.MapPoint; - import com.ankamagames.jerakine.entities.interfaces.IAnimated; - import com.ankamagames.atouin.utils.errors.AtouinError; - import com.ankamagames.jerakine.types.positions.PathElement; - import com.ankamagames.atouin.messages.EntityMovementStoppedMessage; - import flash.utils.getTimer; - import com.ankamagames.atouin.messages.EntityMovementCompleteMessage; - import com.ankamagames.jerakine.interfaces.ISoundPositionListener; - import flash.geom.Point; - import com.ankamagames.atouin.managers.EntitiesDisplayManager; - import com.ankamagames.jerakine.entities.interfaces.IEntity; - import flash.display.Sprite; - import flash.events.Event; - import com.ankamagames.jerakine.utils.display.EnterFrameDispatcher; - - public class AnimatedMovementBehavior implements IMovementBehavior - { - - protected static const _log:Logger = Log.getLogger(getQualifiedClassName(AnimatedMovementBehavior)); - protected static var _movingCount:uint; - protected static var _aEntitiesMoving:Array = new Array(); - private static var _stoppingEntity:Dictionary = new Dictionary(true); - private static var _enterFrameRegistered:Boolean; - private static var _cellsManager:InteractiveCellManager = InteractiveCellManager.getInstance(); - protected static const _cache:Dictionary = new Dictionary(); - - public var speedAdjust:Number = 0; - - - protected static function getFromCache(speedAdjust:Number, type:Class):AnimatedMovementBehavior - { - var m:*; - var newInstance:AnimatedMovementBehavior; - if (!(_cache[type])) + import com.ankamagames.jerakine.entities.behaviours.IMovementBehavior; + import com.ankamagames.jerakine.logger.Logger; + import flash.utils.Dictionary; + import com.ankamagames.atouin.managers.InteractiveCellManager; + import com.ankamagames.jerakine.logger.Log; + import avmplus.getQualifiedClassName; + import com.ankamagames.jerakine.entities.interfaces.IMovable; + import com.ankamagames.jerakine.types.positions.MovementPath; + import com.ankamagames.atouin.types.TweenEntityData; + import com.ankamagames.atouin.Atouin; + import com.ankamagames.atouin.messages.EntityMovementStartMessage; + import flash.display.DisplayObject; + import com.ankamagames.tiphon.display.TiphonSprite; + import com.ankamagames.jerakine.types.positions.MapPoint; + import com.ankamagames.jerakine.entities.interfaces.IAnimated; + import com.ankamagames.atouin.utils.errors.AtouinError; + import com.ankamagames.jerakine.types.positions.PathElement; + import com.ankamagames.atouin.messages.EntityMovementStoppedMessage; + import flash.utils.getTimer; + import com.ankamagames.atouin.messages.EntityMovementCompleteMessage; + import com.ankamagames.jerakine.interfaces.ISoundPositionListener; + import flash.geom.Point; + import com.ankamagames.atouin.managers.EntitiesDisplayManager; + import com.ankamagames.jerakine.entities.interfaces.IEntity; + import flash.display.Sprite; + import flash.events.Event; + import com.ankamagames.jerakine.utils.display.EnterFrameDispatcher; + + public class AnimatedMovementBehavior extends Object implements IMovementBehavior + { + + public function AnimatedMovementBehavior() + { + super(); + } + + protected static const _log:Logger = Log.getLogger(getQualifiedClassName(AnimatedMovementBehavior)); + + protected static var _movingCount:uint; + + protected static var _aEntitiesMoving:Array = new Array(); + + private static var _stoppingEntity:Dictionary = new Dictionary(true); + + private static var _enterFrameRegistered:Boolean; + + private static var _cellsManager:InteractiveCellManager = InteractiveCellManager.getInstance(); + + protected static const _cache:Dictionary = new Dictionary(); + + protected static function getFromCache(param1:Number, param2:Class) : AnimatedMovementBehavior + { + var _loc3_:* = undefined; + var _loc4_:AnimatedMovementBehavior = null; + if(!_cache[param2]) + { + _cache[param2] = new Dictionary(true); + } + for(_loc3_ in _cache[param2]) + { + if(AnimatedMovementBehavior(_loc3_).speedAdjust == param1) { - _cache[type] = new Dictionary(true); - }; - for (m in _cache[type]) - { - if (AnimatedMovementBehavior(m).speedAdjust == speedAdjust) - { - return (m); - }; - }; - newInstance = (new (type)() as AnimatedMovementBehavior); - newInstance.speedAdjust = speedAdjust; - _cache[type][newInstance] = true; - return (newInstance); - } - - - public function move(entity:IMovable, path:MovementPath, callback:Function=null):void - { - var tweenData:TweenEntityData = new TweenEntityData(); - tweenData.path = path; - tweenData.entity = entity; - if (this.getAnimation()) - { - tweenData.animation = this.getAnimation(); - }; - tweenData.linearVelocity = (this.getLinearVelocity() * ((this.speedAdjust / 10) + 1)); - tweenData.hDiagVelocity = (this.getHorizontalDiagonalVelocity() * ((this.speedAdjust / 10) + 1)); - tweenData.vDiagVelocity = (this.getVerticalDiagonalVelocity() * ((this.speedAdjust / 10) + 1)); - tweenData.callback = callback; - this.initMovement(entity, tweenData); - Atouin.getInstance().handler.process(new EntityMovementStartMessage(entity)); - } - - public function synchroniseSubEntitiesPosition(entityRef:IMovable, subEntityContainer:DisplayObject=null):void - { - var ts:TiphonSprite; - var carriedEntity:IMovable; - var subEntities:Array; - var subEntity:*; - var _local_7:TiphonSprite; - var subSubEntities:Array; - var subSubEntity:*; - if ((entityRef is TiphonSprite)) + return _loc3_; + } + } + _loc4_ = new param2() as AnimatedMovementBehavior; + _loc4_.speedAdjust = param1; + _cache[param2][_loc4_] = true; + return _loc4_; + } + + public var speedAdjust:Number = 0.0; + + public function move(param1:IMovable, param2:MovementPath, param3:Function = null) : void + { + var _loc4_:TweenEntityData = new TweenEntityData(); + _loc4_.path = param2; + _loc4_.entity = param1; + if(this.getAnimation()) + { + _loc4_.animation = this.getAnimation(); + } + _loc4_.linearVelocity = this.getLinearVelocity() * (this.speedAdjust / 10 + 1); + _loc4_.hDiagVelocity = this.getHorizontalDiagonalVelocity() * (this.speedAdjust / 10 + 1); + _loc4_.vDiagVelocity = this.getVerticalDiagonalVelocity() * (this.speedAdjust / 10 + 1); + _loc4_.callback = param3; + this.initMovement(param1,_loc4_); + Atouin.getInstance().handler.process(new EntityMovementStartMessage(param1)); + } + + public function synchroniseSubEntitiesPosition(param1:IMovable, param2:DisplayObject = null) : void + { + var _loc3_:TiphonSprite = null; + var _loc4_:IMovable = null; + var _loc5_:Array = null; + var _loc6_:* = undefined; + var _loc7_:TiphonSprite = null; + var _loc8_:Array = null; + var _loc9_:* = undefined; + if(param1 is TiphonSprite) + { + _loc3_ = param1 as TiphonSprite; + if((param2) && param2 is TiphonSprite) { - ts = (entityRef as TiphonSprite); - if (((subEntityContainer) && ((subEntityContainer is TiphonSprite)))) - { - ts = TiphonSprite(subEntityContainer); - }; - if (ts.carriedEntity) - { - carriedEntity = (ts.carriedEntity as IMovable); - } - else - { - _local_7 = (ts.getSubEntitySlot(2, 0) as TiphonSprite); - if (((_local_7) && (_local_7.carriedEntity))) - { - carriedEntity = (_local_7.carriedEntity as IMovable); - }; - }; - while (carriedEntity) - { - if (((carriedEntity.position) && (entityRef.position))) - { - carriedEntity.position.x = entityRef.position.x; - carriedEntity.position.y = entityRef.position.y; - carriedEntity.position.cellId = entityRef.position.cellId; - }; - carriedEntity = ((carriedEntity as TiphonSprite).carriedEntity as IMovable); - }; - subEntities = ts.getSubEntitiesList(); - for each (subEntity in subEntities) - { - if ((subEntity is IMovable)) - { - if (((subEntity.position) && (entityRef.position))) - { - subEntity.position.x = entityRef.position.x; - subEntity.position.y = entityRef.position.y; - }; - if (((subEntity.movementBehavior) && (!((subEntity == entityRef))))) - { - subEntity.movementBehavior.synchroniseSubEntitiesPosition(subEntity); - }; - } - else - { - if ((subEntity is TiphonSprite)) - { - subSubEntities = TiphonSprite(subEntity).getSubEntitiesList(); - for each (subSubEntity in subSubEntities) - { - if ((((((subSubEntity is IMovable)) && (subSubEntity.movementBehavior))) && (!((subSubEntity == entityRef))))) - { - IMovable(subSubEntity).movementBehavior.synchroniseSubEntitiesPosition(entityRef, subEntity); - }; - }; - }; - }; - }; - }; - } - - public function jump(entity:IMovable, newPosition:MapPoint):void - { - this.processJump(entity, newPosition); - } - - public function stop(entity:IMovable, forceStop:Boolean=false):void - { - var animsList:Array; - if (forceStop) + _loc3_ = TiphonSprite(param2); + } + if(_loc3_.carriedEntity) { - animsList = (entity as TiphonSprite).animationList; - if (((animsList) && (!((animsList.indexOf("AnimStatique") == -1))))) - { - IAnimated(entity).setAnimation("AnimStatique"); - }; - _aEntitiesMoving[entity.id] = null; - delete _aEntitiesMoving[entity.id]; + _loc4_ = _loc3_.carriedEntity as IMovable; } else { - _stoppingEntity[entity] = true; - }; - } - - public function isMoving(entity:IMovable):Boolean - { - return (!((_aEntitiesMoving[entity.id] == null))); - } - - public function getNextCell(entity:IMovable):MapPoint - { - return ((((_aEntitiesMoving[entity.id])!=null) ? TweenEntityData(_aEntitiesMoving[entity.id]).nextCell : null)); - } - - protected function getLinearVelocity():Number - { - throw (new AtouinError("Abstract function call.")); - } - - protected function getHorizontalDiagonalVelocity():Number - { - throw (new AtouinError("Abstract function call.")); - } - - protected function getVerticalDiagonalVelocity():Number - { - throw (new AtouinError("Abstract function call.")); - } - - protected function getAnimation():String - { - throw (new AtouinError("Abstract function call.")); - } - - protected function mustChangeOrientation():Boolean - { - return (true); - } - - protected function initMovement(oMobile:IMovable, tweenData:TweenEntityData, wasLinked:Boolean=false):void - { - var firstPe:PathElement; - if (_aEntitiesMoving[oMobile.id] != null) - { - _log.warn("Moving an already moving entity. Replacing the previous move."); - _movingCount--; - }; - _aEntitiesMoving[oMobile.id] = tweenData; - _movingCount++; - if (!(wasLinked)) - { - firstPe = tweenData.path.path.shift(); - if (((this.mustChangeOrientation()) && (firstPe))) - { - tweenData.orientation = firstPe.orientation; - IAnimated(oMobile).setAnimationAndDirection(tweenData.animation, firstPe.orientation); - } - else - { - IAnimated(oMobile).setAnimation(tweenData.animation); - }; - }; - delete _stoppingEntity[oMobile]; - this.goNextCell(oMobile); - this.checkIfEnterFrameNeeded(); - } - - protected function goNextCell(entity:IMovable):void - { - var pe:PathElement; - var tweenData:TweenEntityData = _aEntitiesMoving[entity.id]; - tweenData.currentCell = entity.position; - if (_stoppingEntity[entity]) + _loc7_ = _loc3_.getSubEntitySlot(2,0) as TiphonSprite; + if((_loc7_) && (_loc7_.carriedEntity)) + { + _loc4_ = _loc7_.carriedEntity as IMovable; + } + } + while(_loc4_) { - this.stopMovement(entity); - Atouin.getInstance().handler.process(new EntityMovementStoppedMessage(entity)); - delete _stoppingEntity[entity]; - return; - }; - if (tweenData.path.path.length > 0) + if((_loc4_.position) && (param1.position)) + { + _loc4_.position.x = param1.position.x; + _loc4_.position.y = param1.position.y; + _loc4_.position.cellId = param1.position.cellId; + } + _loc4_ = (_loc4_ as TiphonSprite).carriedEntity as IMovable; + } + _loc5_ = _loc3_.getSubEntitiesList(); + for each(_loc6_ in _loc5_) { - pe = (tweenData.path.path.shift() as PathElement); - if (this.mustChangeOrientation()) - { - IAnimated(entity).setAnimationAndDirection(tweenData.animation, tweenData.orientation); - } - else - { - IAnimated(entity).setAnimation(tweenData.animation); - }; - tweenData.velocity = this.getVelocity(tweenData, tweenData.orientation); - tweenData.nextCell = pe.step; - if (((this.mustChangeOrientation()) && (pe))) - { - tweenData.orientation = pe.orientation; - }; - tweenData.start = getTimer(); + if(_loc6_ is IMovable) + { + if((_loc6_.position) && (param1.position)) + { + _loc6_.position.x = param1.position.x; + _loc6_.position.y = param1.position.y; + } + if((_loc6_.movementBehavior) && !(_loc6_ == param1)) + { + _loc6_.movementBehavior.synchroniseSubEntitiesPosition(_loc6_); + } + } + else if(_loc6_ is TiphonSprite) + { + _loc8_ = TiphonSprite(_loc6_).getSubEntitiesList(); + for each(_loc9_ in _loc8_) + { + if((_loc9_ is IMovable) && (_loc9_.movementBehavior) && !(_loc9_ == param1)) + { + IMovable(_loc9_).movementBehavior.synchroniseSubEntitiesPosition(param1,_loc6_); + } + } + } + } - else + } + } + + public function jump(param1:IMovable, param2:MapPoint) : void + { + this.processJump(param1,param2); + } + + public function stop(param1:IMovable, param2:Boolean = false) : void + { + var _loc3_:Array = null; + if(param2) + { + _loc3_ = (param1 as TiphonSprite).animationList; + if((_loc3_) && !(_loc3_.indexOf("AnimStatique") == -1)) { - if (!(tweenData.currentCell.equals(tweenData.path.end))) - { - tweenData.velocity = this.getVelocity(tweenData, IAnimated(entity).getDirection()); - if (((this.mustChangeOrientation()) && (!((tweenData.orientation == -1))))) - { - IAnimated(entity).setDirection(tweenData.orientation); - }; - tweenData.nextCell = tweenData.path.end; - tweenData.start = getTimer(); - } - else - { - this.stopMovement(entity); - Atouin.getInstance().handler.process(new EntityMovementCompleteMessage(entity)); - }; - }; - tweenData.barycentre = 0; - } - - protected function stopMovement(entity:IMovable):void - { - IAnimated(entity).setAnimation("AnimStatique"); - var callback:Function = (_aEntitiesMoving[entity.id] as TweenEntityData).callback; - delete _aEntitiesMoving[entity.id]; + IAnimated(param1).setAnimation("AnimStatique"); + } + _aEntitiesMoving[param1.id] = null; + delete _aEntitiesMoving[param1.id]; + true; + } + else + { + _stoppingEntity[param1] = true; + } + } + + public function isMoving(param1:IMovable) : Boolean + { + return !(_aEntitiesMoving[param1.id] == null); + } + + public function getNextCell(param1:IMovable) : MapPoint + { + return _aEntitiesMoving[param1.id] != null?TweenEntityData(_aEntitiesMoving[param1.id]).nextCell:null; + } + + protected function getLinearVelocity() : Number + { + throw new AtouinError("Abstract function call."); + } + + protected function getHorizontalDiagonalVelocity() : Number + { + throw new AtouinError("Abstract function call."); + } + + protected function getVerticalDiagonalVelocity() : Number + { + throw new AtouinError("Abstract function call."); + } + + protected function getAnimation() : String + { + throw new AtouinError("Abstract function call."); + } + + protected function mustChangeOrientation() : Boolean + { + return true; + } + + protected function initMovement(param1:IMovable, param2:TweenEntityData, param3:Boolean = false) : void + { + var _loc4_:PathElement = null; + if(_aEntitiesMoving[param1.id] != null) + { + _log.warn("Moving an already moving entity. Replacing the previous move."); _movingCount--; - this.checkIfEnterFrameNeeded(); - if (callback != null) - { - (callback()); - }; - } - - private function getVelocity(ted:TweenEntityData, orientation:uint):Number - { - if ((orientation % 2) == 0) - { - if ((orientation % 4) == 0) - { - return (ted.hDiagVelocity); - }; - return (ted.vDiagVelocity); - }; - return (ted.linearVelocity); - } - - protected function processMovement(tweenData:TweenEntityData, currentTime:uint):void - { - var listener:ISoundPositionListener; - var newPoint:Point; - tweenData.barycentre = (tweenData.velocity * (currentTime - tweenData.start)); - if (tweenData.barycentre > 1) + } + _aEntitiesMoving[param1.id] = param2; + _movingCount++; + if(!param3) + { + _loc4_ = param2.path.path.shift(); + if((this.mustChangeOrientation()) && (_loc4_)) { - tweenData.barycentre = 1; - }; - if (!(tweenData.currentCellSprite)) - { - tweenData.currentCellSprite = _cellsManager.getCell(tweenData.currentCell.cellId); - tweenData.nextCellSprite = _cellsManager.getCell(tweenData.nextCell.cellId); - }; - var displayObject:DisplayObject = DisplayObject(tweenData.entity); - displayObject.x = ((((1 - tweenData.barycentre) * tweenData.currentCellSprite.x) + (tweenData.barycentre * tweenData.nextCellSprite.x)) + (tweenData.currentCellSprite.width / 2)); - displayObject.y = ((((1 - tweenData.barycentre) * tweenData.currentCellSprite.y) + (tweenData.barycentre * tweenData.nextCellSprite.y)) + (tweenData.currentCellSprite.height / 2)); - for each (listener in Atouin.getInstance().movementListeners) - { - newPoint = new Point(displayObject.x, displayObject.y); - listener.setSoundSourcePosition(tweenData.entity.id, newPoint); - }; - if (((!(tweenData.wasOrdered)) && ((tweenData.barycentre > 0.5)))) + param2.orientation = _loc4_.orientation; + IAnimated(param1).setAnimationAndDirection(param2.animation,_loc4_.orientation); + } + else { - EntitiesDisplayManager.getInstance().orderEntity(displayObject, tweenData.nextCellSprite); - }; - if (tweenData.barycentre >= 1) + IAnimated(param1).setAnimation(param2.animation); + } + } + delete _stoppingEntity[param1]; + true; + this.goNextCell(param1); + this.checkIfEnterFrameNeeded(); + } + + protected function goNextCell(param1:IMovable) : void + { + var _loc3_:PathElement = null; + var _loc2_:TweenEntityData = _aEntitiesMoving[param1.id]; + _loc2_.currentCell = param1.position; + if(_stoppingEntity[param1]) + { + this.stopMovement(param1); + Atouin.getInstance().handler.process(new EntityMovementStoppedMessage(param1)); + delete _stoppingEntity[param1]; + true; + return; + } + if(_loc2_.path.path.length > 0) + { + _loc3_ = _loc2_.path.path.shift() as PathElement; + if(this.mustChangeOrientation()) { - tweenData.clear(); - IEntity(tweenData.entity).position = tweenData.nextCell; - this.synchroniseSubEntitiesPosition(IMovable(tweenData.entity)); - this.goNextCell(IMovable(tweenData.entity)); - }; - } - - protected function processJump(entity:IMovable, newPosition:MapPoint):void - { - var newCellSprite:Sprite = InteractiveCellManager.getInstance().getCell(newPosition.cellId); - var displayObject:DisplayObject = (entity as DisplayObject); - displayObject.x = (newCellSprite.x + (newCellSprite.width / 2)); - displayObject.y = (newCellSprite.y + (newCellSprite.height / 2)); - if (displayObject.stage != null) + IAnimated(param1).setAnimationAndDirection(_loc2_.animation,_loc2_.orientation); + } + else { - EntitiesDisplayManager.getInstance().orderEntity(displayObject, newCellSprite); - }; - entity.position = newPosition; - this.synchroniseSubEntitiesPosition(entity); - } - - private function onEnterFrame(e:Event):void - { - var tweenData:TweenEntityData; - var currentTime:uint = getTimer(); - for each (tweenData in _aEntitiesMoving) + IAnimated(param1).setAnimation(_loc2_.animation); + } + _loc2_.velocity = this.getVelocity(_loc2_,_loc2_.orientation); + _loc2_.nextCell = _loc3_.step; + if((this.mustChangeOrientation()) && (_loc3_)) { - this.processMovement(tweenData, currentTime); - }; - } - - protected function checkIfEnterFrameNeeded():void - { - if ((((_movingCount == 0)) && (_enterFrameRegistered))) + _loc2_.orientation = _loc3_.orientation; + } + _loc2_.start = getTimer(); + } + else if(!_loc2_.currentCell.equals(_loc2_.path.end)) + { + _loc2_.velocity = this.getVelocity(_loc2_,IAnimated(param1).getDirection()); + if((this.mustChangeOrientation()) && !(_loc2_.orientation == -1)) { - EnterFrameDispatcher.removeEventListener(this.onEnterFrame); - _enterFrameRegistered = false; + IAnimated(param1).setDirection(_loc2_.orientation); } - else + _loc2_.nextCell = _loc2_.path.end; + _loc2_.start = getTimer(); + } + else + { + this.stopMovement(param1); + Atouin.getInstance().handler.process(new EntityMovementCompleteMessage(param1)); + } + + _loc2_.barycentre = 0; + } + + protected function stopMovement(param1:IMovable) : void + { + IAnimated(param1).setAnimation("AnimStatique"); + var _loc2_:Function = (_aEntitiesMoving[param1.id] as TweenEntityData).callback; + delete _aEntitiesMoving[param1.id]; + true; + _movingCount--; + this.checkIfEnterFrameNeeded(); + if(_loc2_ != null) + { + _loc2_(); + } + } + + private function getVelocity(param1:TweenEntityData, param2:uint) : Number + { + if(param2 % 2 == 0) + { + if(param2 % 4 == 0) { - if ((((_movingCount > 0)) && (!(_enterFrameRegistered)))) - { - EnterFrameDispatcher.addEventListener(this.onEnterFrame, "AnimatedMovementBehaviour", 50); - _enterFrameRegistered = true; - }; - }; - } - - - } -}//package com.ankamagames.atouin.entities.behaviours.movements - + return param1.hDiagVelocity; + } + return param1.vDiagVelocity; + } + return param1.linearVelocity; + } + + protected function processMovement(param1:TweenEntityData, param2:uint) : void + { + var _loc4_:ISoundPositionListener = null; + var _loc5_:Point = null; + param1.barycentre = param1.velocity * (param2 - param1.start); + if(param1.barycentre > 1) + { + param1.barycentre = 1; + } + if(!param1.currentCellSprite) + { + param1.currentCellSprite = _cellsManager.getCell(param1.currentCell.cellId); + param1.nextCellSprite = _cellsManager.getCell(param1.nextCell.cellId); + } + var _loc3_:DisplayObject = DisplayObject(param1.entity); + _loc3_.x = (1 - param1.barycentre) * param1.currentCellSprite.x + param1.barycentre * param1.nextCellSprite.x + param1.currentCellSprite.width / 2; + _loc3_.y = (1 - param1.barycentre) * param1.currentCellSprite.y + param1.barycentre * param1.nextCellSprite.y + param1.currentCellSprite.height / 2; + for each(_loc4_ in Atouin.getInstance().movementListeners) + { + _loc5_ = new Point(_loc3_.x,_loc3_.y); + _loc4_.setSoundSourcePosition(param1.entity.id,_loc5_); + } + if(!param1.wasOrdered && param1.barycentre > 0.5) + { + EntitiesDisplayManager.getInstance().orderEntity(_loc3_,param1.nextCellSprite); + } + if(param1.barycentre >= 1) + { + param1.clear(); + IEntity(param1.entity).position = param1.nextCell; + this.synchroniseSubEntitiesPosition(IMovable(param1.entity)); + this.goNextCell(IMovable(param1.entity)); + } + } + + protected function processJump(param1:IMovable, param2:MapPoint) : void + { + var _loc3_:Sprite = InteractiveCellManager.getInstance().getCell(param2.cellId); + var _loc4_:DisplayObject = param1 as DisplayObject; + _loc4_.x = _loc3_.x + _loc3_.width / 2; + _loc4_.y = _loc3_.y + _loc3_.height / 2; + if(_loc4_.stage != null) + { + EntitiesDisplayManager.getInstance().orderEntity(_loc4_,_loc3_); + } + param1.position = param2; + this.synchroniseSubEntitiesPosition(param1); + } + + private function onEnterFrame(param1:Event) : void + { + var _loc3_:TweenEntityData = null; + var _loc2_:uint = getTimer(); + for each(_loc3_ in _aEntitiesMoving) + { + this.processMovement(_loc3_,_loc2_); + } + } + + protected function checkIfEnterFrameNeeded() : void + { + if(_movingCount == 0 && (_enterFrameRegistered)) + { + EnterFrameDispatcher.removeEventListener(this.onEnterFrame); + _enterFrameRegistered = false; + } + else if(_movingCount > 0 && !_enterFrameRegistered) + { + EnterFrameDispatcher.addEventListener(this.onEnterFrame,"AnimatedMovementBehaviour",50); + _enterFrameRegistered = true; + } + + } + } +} diff --git a/com/ankamagames/atouin/entities/behaviours/movements/MountedMovementBehavior.as b/com/ankamagames/atouin/entities/behaviours/movements/MountedMovementBehavior.as index 78a525fcf..42626eec2 100644 --- a/com/ankamagames/atouin/entities/behaviours/movements/MountedMovementBehavior.as +++ b/com/ankamagames/atouin/entities/behaviours/movements/MountedMovementBehavior.as @@ -1,55 +1,60 @@ -package com.ankamagames.atouin.entities.behaviours.movements +package com.ankamagames.atouin.entities.behaviours.movements { - import com.ankamagames.jerakine.utils.errors.SingletonError; - - public class MountedMovementBehavior extends AnimatedMovementBehavior - { - - private static const RUN_LINEAR_VELOCITY:Number = (1 / 135);//0.00740740740740741 - private static const RUN_HORIZONTAL_DIAGONAL_VELOCITY:Number = (1 / 200);//0.005 - private static const RUN_VERTICAL_DIAGONAL_VELOCITY:Number = (1 / 120);//0.00833333333333333 - private static const RUN_ANIMATION:String = "AnimCourse"; - private static var _self:MountedMovementBehavior; - - public function MountedMovementBehavior() - { - if (_self) - { - throw (new SingletonError("Warning : MountedMovementBehavior is a singleton class and shoulnd't be instancied directly!")); - }; - } - - public static function getInstance():MountedMovementBehavior - { - if (!(_self)) - { - _self = new (MountedMovementBehavior)(); - }; - return (_self); - } - - - override protected function getLinearVelocity():Number - { - return (RUN_LINEAR_VELOCITY); - } - - override protected function getHorizontalDiagonalVelocity():Number - { - return (RUN_HORIZONTAL_DIAGONAL_VELOCITY); - } - - override protected function getVerticalDiagonalVelocity():Number - { - return (RUN_VERTICAL_DIAGONAL_VELOCITY); - } - - override protected function getAnimation():String - { - return (RUN_ANIMATION); - } - - - } -}//package com.ankamagames.atouin.entities.behaviours.movements - + import com.ankamagames.jerakine.utils.errors.SingletonError; + + public class MountedMovementBehavior extends AnimatedMovementBehavior + { + + public function MountedMovementBehavior() + { + super(); + if(_self) + { + throw new SingletonError("Warning : MountedMovementBehavior is a singleton class and shoulnd\'t be instancied directly!"); + } + else + { + return; + } + } + + private static const RUN_LINEAR_VELOCITY:Number = 1 / 135; + + private static const RUN_HORIZONTAL_DIAGONAL_VELOCITY:Number = 1 / 200; + + private static const RUN_VERTICAL_DIAGONAL_VELOCITY:Number = 1 / 120; + + private static const RUN_ANIMATION:String = "AnimCourse"; + + private static var _self:MountedMovementBehavior; + + public static function getInstance() : MountedMovementBehavior + { + if(!_self) + { + _self = new MountedMovementBehavior(); + } + return _self; + } + + override protected function getLinearVelocity() : Number + { + return RUN_LINEAR_VELOCITY; + } + + override protected function getHorizontalDiagonalVelocity() : Number + { + return RUN_HORIZONTAL_DIAGONAL_VELOCITY; + } + + override protected function getVerticalDiagonalVelocity() : Number + { + return RUN_VERTICAL_DIAGONAL_VELOCITY; + } + + override protected function getAnimation() : String + { + return RUN_ANIMATION; + } + } +} diff --git a/com/ankamagames/atouin/entities/behaviours/movements/ParableMovementBehavior.as b/com/ankamagames/atouin/entities/behaviours/movements/ParableMovementBehavior.as index bab012068..51ea7da84 100644 --- a/com/ankamagames/atouin/entities/behaviours/movements/ParableMovementBehavior.as +++ b/com/ankamagames/atouin/entities/behaviours/movements/ParableMovementBehavior.as @@ -1,133 +1,141 @@ -package com.ankamagames.atouin.entities.behaviours.movements +package com.ankamagames.atouin.entities.behaviours.movements { - import flash.geom.Point; - import com.ankamagames.jerakine.utils.errors.SingletonError; - import com.ankamagames.atouin.types.TweenEntityData; - import com.ankamagames.atouin.managers.InteractiveCellManager; - import flash.display.Sprite; - import flash.display.DisplayObject; - import com.ankamagames.jerakine.entities.interfaces.IMovable; - import com.ankamagames.jerakine.types.positions.MovementPath; - import com.ankamagames.atouin.managers.EntitiesDisplayManager; - import com.ankamagames.jerakine.entities.interfaces.IEntity; - import com.ankamagames.atouin.managers.EntitiesManager; - - public class ParableMovementBehavior extends AnimatedMovementBehavior - { - - private static const LINEAR_VELOCITY:Number = (1 / 400);//0.0025 - private static const HORIZONTAL_DIAGONAL_VELOCITY:Number = (1 / 500);//0.002 - private static const VERTICAL_DIAGONAL_VELOCITY:Number = (1 / 450);//0.00222222222222222 - private static const ANIMATION:String = "FX"; - private static var _curvePoint:Point; - private static var _velocity:Number; - private static var _angle:Number; - private static var _self:ParableMovementBehavior; - - public function ParableMovementBehavior() - { - if (_self) - { - throw (new SingletonError("Warning : ParableMovementBehavior is a singleton class and shoulnd't be instancied directly!")); - }; - } - - public static function getInstance():ParableMovementBehavior - { - if (!(_self)) - { - _self = new (ParableMovementBehavior)(); - }; - return (_self); - } - - - override protected function getLinearVelocity():Number - { - return (LINEAR_VELOCITY); - } - - override protected function getHorizontalDiagonalVelocity():Number - { - return (HORIZONTAL_DIAGONAL_VELOCITY); - } - - override protected function getVerticalDiagonalVelocity():Number - { - return (VERTICAL_DIAGONAL_VELOCITY); - } - - override protected function getAnimation():String - { - return (ANIMATION); - } - - override public function move(entity:IMovable, path:MovementPath, callback:Function=null):void - { - var tweenData:TweenEntityData = new TweenEntityData(); - tweenData.path = path; - tweenData.entity = entity; - var currentCellSprite:Sprite = InteractiveCellManager.getInstance().getCell(tweenData.path.start.cellId); - var nextCellSprite:Sprite = InteractiveCellManager.getInstance().getCell(tweenData.path.end.cellId); - var initPoint:Point = new Point(currentCellSprite.x, currentCellSprite.y); - var finalPoint:Point = new Point(nextCellSprite.x, nextCellSprite.y); - var distance:Number = Point.distance(initPoint, finalPoint); - _curvePoint = Point.interpolate(initPoint, finalPoint, 0.5); - _curvePoint.y = (_curvePoint.y - (distance / 2)); - _velocity = (1 / (500 + (path.start.distanceTo(path.end) * 50))); - _angle = this.checkAngle(initPoint, finalPoint); - var displayObject:DisplayObject = DisplayObject(tweenData.entity); - displayObject.rotation = (displayObject.rotation - (_angle + ((90 - _angle) / 2))); - initMovement(entity, tweenData); - } - - override protected function processMovement(tweenData:TweenEntityData, currentTime:uint):void - { - var gravity2:Number; - tweenData.barycentre = (_velocity * (currentTime - tweenData.start)); - if (tweenData.barycentre > 1) - { - tweenData.barycentre = 1; - }; - var displayObject:DisplayObject = DisplayObject(tweenData.entity); - var currentCellSprite:Sprite = InteractiveCellManager.getInstance().getCell(tweenData.currentCell.cellId); - var nextCellSprite:Sprite = InteractiveCellManager.getInstance().getCell(tweenData.nextCell.cellId); - displayObject.x = (((((1 - tweenData.barycentre) * (1 - tweenData.barycentre)) * currentCellSprite.x) + (((2 * (1 - tweenData.barycentre)) * tweenData.barycentre) * _curvePoint.x)) + ((tweenData.barycentre * tweenData.barycentre) * nextCellSprite.x)); - displayObject.y = (((((1 - tweenData.barycentre) * (1 - tweenData.barycentre)) * currentCellSprite.y) + (((2 * (1 - tweenData.barycentre)) * tweenData.barycentre) * _curvePoint.y)) + ((tweenData.barycentre * tweenData.barycentre) * nextCellSprite.y)); - var initRotation:Number = -((_angle + ((90 - _angle) / 2))); - var gravity:Number = ((2.5 * (90 + initRotation)) * tweenData.barycentre); - displayObject.rotation = (initRotation + gravity); - if (nextCellSprite.y > currentCellSprite.y) - { - gravity2 = ((2 * (90 + initRotation)) * (1 - tweenData.barycentre)); - displayObject.rotation = (-(initRotation) - gravity2); - }; - displayObject.scaleX = (1 - ((tweenData.barycentre * (90 - Math.abs((90 - _angle)))) / 90)); - if (((!(tweenData.wasOrdered)) && ((tweenData.barycentre > 0.5)))) - { - EntitiesDisplayManager.getInstance().orderEntity(displayObject, nextCellSprite); - }; - if (tweenData.barycentre >= 1) - { - IEntity(tweenData.entity).position = tweenData.nextCell; - goNextCell(IMovable(tweenData.entity)); - EntitiesManager.getInstance().removeEntity(IEntity(tweenData.entity).id); - }; - } - - private function checkAngle(initPoint:Point, finalPoint:Point):Number - { - var A:Number = Point.distance(initPoint, new Point(finalPoint.x, initPoint.y)); - var B:Number = Point.distance(initPoint, finalPoint); - var angle:Number = ((Math.acos((A / B)) * 180) / Math.PI); - if (initPoint.x > finalPoint.x) - { - angle = (180 - angle); - }; - return (angle); - } - - - } -}//package com.ankamagames.atouin.entities.behaviours.movements - + import flash.geom.Point; + import com.ankamagames.jerakine.entities.interfaces.IMovable; + import com.ankamagames.jerakine.types.positions.MovementPath; + import com.ankamagames.atouin.types.TweenEntityData; + import com.ankamagames.atouin.managers.InteractiveCellManager; + import flash.display.Sprite; + import flash.display.DisplayObject; + import com.ankamagames.atouin.managers.EntitiesDisplayManager; + import com.ankamagames.jerakine.entities.interfaces.IEntity; + import com.ankamagames.atouin.managers.EntitiesManager; + import com.ankamagames.jerakine.utils.errors.SingletonError; + + public class ParableMovementBehavior extends AnimatedMovementBehavior + { + + public function ParableMovementBehavior() + { + super(); + if(_self) + { + throw new SingletonError("Warning : ParableMovementBehavior is a singleton class and shoulnd\'t be instancied directly!"); + } + else + { + return; + } + } + + private static const LINEAR_VELOCITY:Number = 1 / 400; + + private static const HORIZONTAL_DIAGONAL_VELOCITY:Number = 1 / 500; + + private static const VERTICAL_DIAGONAL_VELOCITY:Number = 1 / 450; + + private static const ANIMATION:String = "FX"; + + private static var _curvePoint:Point; + + private static var _velocity:Number; + + private static var _angle:Number; + + private static var _self:ParableMovementBehavior; + + public static function getInstance() : ParableMovementBehavior + { + if(!_self) + { + _self = new ParableMovementBehavior(); + } + return _self; + } + + override protected function getLinearVelocity() : Number + { + return LINEAR_VELOCITY; + } + + override protected function getHorizontalDiagonalVelocity() : Number + { + return HORIZONTAL_DIAGONAL_VELOCITY; + } + + override protected function getVerticalDiagonalVelocity() : Number + { + return VERTICAL_DIAGONAL_VELOCITY; + } + + override protected function getAnimation() : String + { + return ANIMATION; + } + + override public function move(param1:IMovable, param2:MovementPath, param3:Function = null) : void + { + var _loc4_:TweenEntityData = new TweenEntityData(); + _loc4_.path = param2; + _loc4_.entity = param1; + var _loc5_:Sprite = InteractiveCellManager.getInstance().getCell(_loc4_.path.start.cellId); + var _loc6_:Sprite = InteractiveCellManager.getInstance().getCell(_loc4_.path.end.cellId); + var _loc7_:Point = new Point(_loc5_.x,_loc5_.y); + var _loc8_:Point = new Point(_loc6_.x,_loc6_.y); + var _loc9_:Number = Point.distance(_loc7_,_loc8_); + _curvePoint = Point.interpolate(_loc7_,_loc8_,0.5); + _curvePoint.y = _curvePoint.y - _loc9_ / 2; + _velocity = 1 / (500 + param2.start.distanceTo(param2.end) * 50); + _angle = this.checkAngle(_loc7_,_loc8_); + var _loc10_:* = DisplayObject(_loc4_.entity); + _loc10_.rotation = _loc10_.rotation - (_angle + (90 - _angle) / 2); + initMovement(param1,_loc4_); + } + + override protected function processMovement(param1:TweenEntityData, param2:uint) : void + { + var _loc8_:* = NaN; + param1.barycentre = _velocity * (param2 - param1.start); + if(param1.barycentre > 1) + { + param1.barycentre = 1; + } + var _loc3_:DisplayObject = DisplayObject(param1.entity); + var _loc4_:Sprite = InteractiveCellManager.getInstance().getCell(param1.currentCell.cellId); + var _loc5_:Sprite = InteractiveCellManager.getInstance().getCell(param1.nextCell.cellId); + _loc3_.x = (1 - param1.barycentre) * (1 - param1.barycentre) * _loc4_.x + 2 * (1 - param1.barycentre) * param1.barycentre * _curvePoint.x + param1.barycentre * param1.barycentre * _loc5_.x; + _loc3_.y = (1 - param1.barycentre) * (1 - param1.barycentre) * _loc4_.y + 2 * (1 - param1.barycentre) * param1.barycentre * _curvePoint.y + param1.barycentre * param1.barycentre * _loc5_.y; + var _loc6_:Number = -(_angle + (90 - _angle) / 2); + var _loc7_:Number = 2.5 * (90 + _loc6_) * param1.barycentre; + _loc3_.rotation = _loc6_ + _loc7_; + if(_loc5_.y > _loc4_.y) + { + _loc8_ = 2 * (90 + _loc6_) * (1 - param1.barycentre); + _loc3_.rotation = -_loc6_ - _loc8_; + } + _loc3_.scaleX = 1 - param1.barycentre * (90 - Math.abs(90 - _angle)) / 90; + if(!param1.wasOrdered && param1.barycentre > 0.5) + { + EntitiesDisplayManager.getInstance().orderEntity(_loc3_,_loc5_); + } + if(param1.barycentre >= 1) + { + IEntity(param1.entity).position = param1.nextCell; + goNextCell(IMovable(param1.entity)); + EntitiesManager.getInstance().removeEntity(IEntity(param1.entity).id); + } + } + + private function checkAngle(param1:Point, param2:Point) : Number + { + var _loc3_:Number = Point.distance(param1,new Point(param2.x,param1.y)); + var _loc4_:Number = Point.distance(param1,param2); + var _loc5_:Number = Math.acos(_loc3_ / _loc4_) * 180 / Math.PI; + if(param1.x > param2.x) + { + _loc5_ = 180 - _loc5_; + } + return _loc5_; + } + } +} diff --git a/com/ankamagames/atouin/entities/behaviours/movements/RunningMovementBehavior.as b/com/ankamagames/atouin/entities/behaviours/movements/RunningMovementBehavior.as index ac94b4d12..308e3cd2d 100644 --- a/com/ankamagames/atouin/entities/behaviours/movements/RunningMovementBehavior.as +++ b/com/ankamagames/atouin/entities/behaviours/movements/RunningMovementBehavior.as @@ -1,41 +1,44 @@ -package com.ankamagames.atouin.entities.behaviours.movements +package com.ankamagames.atouin.entities.behaviours.movements { - public class RunningMovementBehavior extends AnimatedMovementBehavior - { - - private static const RUN_LINEAR_VELOCITY:Number = (1 / 170);//0.00588235294117647 - private static const RUN_HORIZONTAL_DIAGONAL_VELOCITY:Number = (1 / 0xFF);//0.00392156862745098 - private static const RUN_VERTICAL_DIAGONAL_VELOCITY:Number = (1 / 150);//0.00666666666666667 - private static const RUN_ANIMATION:String = "AnimCourse"; - - - public static function getInstance(speedAdjust:Number=0):RunningMovementBehavior - { - return ((getFromCache(speedAdjust, RunningMovementBehavior) as RunningMovementBehavior)); - } - - - override protected function getLinearVelocity():Number - { - return (RUN_LINEAR_VELOCITY); - } - - override protected function getHorizontalDiagonalVelocity():Number - { - return (RUN_HORIZONTAL_DIAGONAL_VELOCITY); - } - - override protected function getVerticalDiagonalVelocity():Number - { - return (RUN_VERTICAL_DIAGONAL_VELOCITY); - } - - override protected function getAnimation():String - { - return (RUN_ANIMATION); - } - - - } -}//package com.ankamagames.atouin.entities.behaviours.movements - + public class RunningMovementBehavior extends AnimatedMovementBehavior + { + + public function RunningMovementBehavior() + { + super(); + } + + private static const RUN_LINEAR_VELOCITY:Number = 1 / 170; + + private static const RUN_HORIZONTAL_DIAGONAL_VELOCITY:Number = 1 / 255; + + private static const RUN_VERTICAL_DIAGONAL_VELOCITY:Number = 1 / 150; + + private static const RUN_ANIMATION:String = "AnimCourse"; + + public static function getInstance(param1:Number = 0.0) : RunningMovementBehavior + { + return getFromCache(param1,RunningMovementBehavior) as RunningMovementBehavior; + } + + override protected function getLinearVelocity() : Number + { + return RUN_LINEAR_VELOCITY; + } + + override protected function getHorizontalDiagonalVelocity() : Number + { + return RUN_HORIZONTAL_DIAGONAL_VELOCITY; + } + + override protected function getVerticalDiagonalVelocity() : Number + { + return RUN_VERTICAL_DIAGONAL_VELOCITY; + } + + override protected function getAnimation() : String + { + return RUN_ANIMATION; + } + } +} diff --git a/com/ankamagames/atouin/entities/behaviours/movements/SlideMovementBehavior.as b/com/ankamagames/atouin/entities/behaviours/movements/SlideMovementBehavior.as index 7cddc897d..c18f38b19 100644 --- a/com/ankamagames/atouin/entities/behaviours/movements/SlideMovementBehavior.as +++ b/com/ankamagames/atouin/entities/behaviours/movements/SlideMovementBehavior.as @@ -1,60 +1,65 @@ -package com.ankamagames.atouin.entities.behaviours.movements +package com.ankamagames.atouin.entities.behaviours.movements { - import com.ankamagames.jerakine.utils.errors.SingletonError; - - public class SlideMovementBehavior extends AnimatedMovementBehavior - { - - private static const RUN_LINEAR_VELOCITY:Number = ((1 / 170) * 3);//0.0176470588235294 - private static const RUN_HORIZONTAL_DIAGONAL_VELOCITY:Number = ((1 / 0xFF) * 3);//0.0117647058823529 - private static const RUN_VERTICAL_DIAGONAL_VELOCITY:Number = ((1 / 150) * 3);//0.02 - private static const RUN_ANIMATION:String = "AnimStatique"; - private static var _self:SlideMovementBehavior; - - public function SlideMovementBehavior() - { - if (_self) - { - throw (new SingletonError("Warning : SlideMovementBehavior is a singleton class and shoulnd't be instancied directly!")); - }; - } - - public static function getInstance():SlideMovementBehavior - { - if (!(_self)) - { - _self = new (SlideMovementBehavior)(); - }; - return (_self); - } - - - override protected function getLinearVelocity():Number - { - return (RUN_LINEAR_VELOCITY); - } - - override protected function getHorizontalDiagonalVelocity():Number - { - return (RUN_HORIZONTAL_DIAGONAL_VELOCITY); - } - - override protected function getVerticalDiagonalVelocity():Number - { - return (RUN_VERTICAL_DIAGONAL_VELOCITY); - } - - override protected function getAnimation():String - { - return (null); - } - - override protected function mustChangeOrientation():Boolean - { - return (false); - } - - - } -}//package com.ankamagames.atouin.entities.behaviours.movements - + import com.ankamagames.jerakine.utils.errors.SingletonError; + + public class SlideMovementBehavior extends AnimatedMovementBehavior + { + + public function SlideMovementBehavior() + { + super(); + if(_self) + { + throw new SingletonError("Warning : SlideMovementBehavior is a singleton class and shoulnd\'t be instancied directly!"); + } + else + { + return; + } + } + + private static const RUN_LINEAR_VELOCITY:Number = 1 / 170 * 3; + + private static const RUN_HORIZONTAL_DIAGONAL_VELOCITY:Number = 1 / 255 * 3; + + private static const RUN_VERTICAL_DIAGONAL_VELOCITY:Number = 1 / 150 * 3; + + private static const RUN_ANIMATION:String = "AnimStatique"; + + private static var _self:SlideMovementBehavior; + + public static function getInstance() : SlideMovementBehavior + { + if(!_self) + { + _self = new SlideMovementBehavior(); + } + return _self; + } + + override protected function getLinearVelocity() : Number + { + return RUN_LINEAR_VELOCITY; + } + + override protected function getHorizontalDiagonalVelocity() : Number + { + return RUN_HORIZONTAL_DIAGONAL_VELOCITY; + } + + override protected function getVerticalDiagonalVelocity() : Number + { + return RUN_VERTICAL_DIAGONAL_VELOCITY; + } + + override protected function getAnimation() : String + { + return null; + } + + override protected function mustChangeOrientation() : Boolean + { + return false; + } + } +} diff --git a/com/ankamagames/atouin/entities/behaviours/movements/WalkingMovementBehavior.as b/com/ankamagames/atouin/entities/behaviours/movements/WalkingMovementBehavior.as index eaaa90e26..f685cafb5 100644 --- a/com/ankamagames/atouin/entities/behaviours/movements/WalkingMovementBehavior.as +++ b/com/ankamagames/atouin/entities/behaviours/movements/WalkingMovementBehavior.as @@ -1,41 +1,44 @@ -package com.ankamagames.atouin.entities.behaviours.movements +package com.ankamagames.atouin.entities.behaviours.movements { - public class WalkingMovementBehavior extends AnimatedMovementBehavior - { - - private static const WALK_LINEAR_VELOCITY:Number = (1 / 480);//0.00208333333333333 - private static const WALK_HORIZONTAL_DIAGONAL_VELOCITY:Number = (1 / 510);//0.00196078431372549 - private static const WALK_VERTICAL_DIAGONAL_VELOCITY:Number = (1 / 425);//0.00235294117647059 - private static const WALK_ANIMATION:String = "AnimMarche"; - - - public static function getInstance(speedAdjust:Number=0):WalkingMovementBehavior - { - return ((getFromCache(speedAdjust, WalkingMovementBehavior) as WalkingMovementBehavior)); - } - - - override protected function getLinearVelocity():Number - { - return (WALK_LINEAR_VELOCITY); - } - - override protected function getHorizontalDiagonalVelocity():Number - { - return (WALK_HORIZONTAL_DIAGONAL_VELOCITY); - } - - override protected function getVerticalDiagonalVelocity():Number - { - return (WALK_VERTICAL_DIAGONAL_VELOCITY); - } - - override protected function getAnimation():String - { - return (WALK_ANIMATION); - } - - - } -}//package com.ankamagames.atouin.entities.behaviours.movements - + public class WalkingMovementBehavior extends AnimatedMovementBehavior + { + + public function WalkingMovementBehavior() + { + super(); + } + + private static const WALK_LINEAR_VELOCITY:Number = 1 / 480; + + private static const WALK_HORIZONTAL_DIAGONAL_VELOCITY:Number = 1 / 510; + + private static const WALK_VERTICAL_DIAGONAL_VELOCITY:Number = 1 / 425; + + private static const WALK_ANIMATION:String = "AnimMarche"; + + public static function getInstance(param1:Number = 0.0) : WalkingMovementBehavior + { + return getFromCache(param1,WalkingMovementBehavior) as WalkingMovementBehavior; + } + + override protected function getLinearVelocity() : Number + { + return WALK_LINEAR_VELOCITY; + } + + override protected function getHorizontalDiagonalVelocity() : Number + { + return WALK_HORIZONTAL_DIAGONAL_VELOCITY; + } + + override protected function getVerticalDiagonalVelocity() : Number + { + return WALK_VERTICAL_DIAGONAL_VELOCITY; + } + + override protected function getAnimation() : String + { + return WALK_ANIMATION; + } + } +} diff --git a/com/ankamagames/atouin/enums/ElementTypesEnum.as b/com/ankamagames/atouin/enums/ElementTypesEnum.as index 561dabd68..14271b5b8 100644 --- a/com/ankamagames/atouin/enums/ElementTypesEnum.as +++ b/com/ankamagames/atouin/enums/ElementTypesEnum.as @@ -1,12 +1,15 @@ -package com.ankamagames.atouin.enums +package com.ankamagames.atouin.enums { - public class ElementTypesEnum - { - - public static const GRAPHICAL:int = 2; - public static const SOUND:int = 33; - - - } -}//package com.ankamagames.atouin.enums - + public class ElementTypesEnum extends Object + { + + public function ElementTypesEnum() + { + super(); + } + + public static const GRAPHICAL:int = 2; + + public static const SOUND:int = 33; + } +} diff --git a/com/ankamagames/atouin/enums/GroundCache.as b/com/ankamagames/atouin/enums/GroundCache.as index 1f3e35e3b..e0b55dd21 100644 --- a/com/ankamagames/atouin/enums/GroundCache.as +++ b/com/ankamagames/atouin/enums/GroundCache.as @@ -1,18 +1,27 @@ -package com.ankamagames.atouin.enums +package com.ankamagames.atouin.enums { - public class GroundCache - { - - public static const GROUND_CACHE_DISABLED:int = 0; - public static const GROUND_CACHE_HIGH_QUALITY:int = 1; - public static const GROUND_CACHE_MEDIUM_QUALITY:int = 2; - public static const GROUND_CACHE_LOW_QUALITY:int = 3; - public static const GROUND_CACHE_ERROR:int = 0; - public static const GROUND_CACHE_AVAILABLE:int = 1; - public static const GROUND_CACHE_NOT_AVAILABLE:int = 2; - public static const GROUND_CACHE_SKIP:int = 3; - - - } -}//package com.ankamagames.atouin.enums - + public class GroundCache extends Object + { + + public function GroundCache() + { + super(); + } + + public static const GROUND_CACHE_DISABLED:int = 0; + + public static const GROUND_CACHE_HIGH_QUALITY:int = 1; + + public static const GROUND_CACHE_MEDIUM_QUALITY:int = 2; + + public static const GROUND_CACHE_LOW_QUALITY:int = 3; + + public static const GROUND_CACHE_ERROR:int = 0; + + public static const GROUND_CACHE_AVAILABLE:int = 1; + + public static const GROUND_CACHE_NOT_AVAILABLE:int = 2; + + public static const GROUND_CACHE_SKIP:int = 3; + } +} diff --git a/com/ankamagames/atouin/enums/MapTypesEnum.as b/com/ankamagames/atouin/enums/MapTypesEnum.as index bb0e0304d..c79e85015 100644 --- a/com/ankamagames/atouin/enums/MapTypesEnum.as +++ b/com/ankamagames/atouin/enums/MapTypesEnum.as @@ -1,12 +1,15 @@ -package com.ankamagames.atouin.enums +package com.ankamagames.atouin.enums { - public class MapTypesEnum - { - - public static const OUTDOOR:int = 0; - public static const INDOOR:int = 1; - - - } -}//package com.ankamagames.atouin.enums - + public class MapTypesEnum extends Object + { + + public function MapTypesEnum() + { + super(); + } + + public static const OUTDOOR:int = 0; + + public static const INDOOR:int = 1; + } +} diff --git a/com/ankamagames/atouin/enums/PlacementStrataEnums.as b/com/ankamagames/atouin/enums/PlacementStrataEnums.as index 28f275ddc..fb79f223a 100644 --- a/com/ankamagames/atouin/enums/PlacementStrataEnums.as +++ b/com/ankamagames/atouin/enums/PlacementStrataEnums.as @@ -1,21 +1,33 @@ -package com.ankamagames.atouin.enums +package com.ankamagames.atouin.enums { - public class PlacementStrataEnums - { - - public static const STRATA_NO_Z_ORDER:uint = 0; - public static const STRATA_DEFAULT:uint = 10; - public static const STRATA_PORTAL:uint = 80; - public static const STRATA_AREA:uint = 90; - public static const STRATA_GLYPH:uint = 110; - public static const STRATA_MOVEMENT:uint = 120; - public static const STRATA_SPELL_BACKGROUND:uint = 130; - public static const STRATA_LINK:uint = 160; - public static const STRATA_PLAYER:uint = 200; - public static const STRATA_SPELL_FOREGROUND:uint = 210; - public static const STRATA_FOREGROUND:uint = 300; - - - } -}//package com.ankamagames.atouin.enums - + public class PlacementStrataEnums extends Object + { + + public function PlacementStrataEnums() + { + super(); + } + + public static const STRATA_NO_Z_ORDER:uint = 0; + + public static const STRATA_DEFAULT:uint = 10; + + public static const STRATA_PORTAL:uint = 80; + + public static const STRATA_AREA:uint = 90; + + public static const STRATA_GLYPH:uint = 110; + + public static const STRATA_MOVEMENT:uint = 120; + + public static const STRATA_SPELL_BACKGROUND:uint = 130; + + public static const STRATA_LINK:uint = 160; + + public static const STRATA_PLAYER:uint = 200; + + public static const STRATA_SPELL_FOREGROUND:uint = 210; + + public static const STRATA_FOREGROUND:uint = 300; + } +} diff --git a/com/ankamagames/atouin/managers/AnimatedElementManager.as b/com/ankamagames/atouin/managers/AnimatedElementManager.as index 6d44dd391..62563ba25 100644 --- a/com/ankamagames/atouin/managers/AnimatedElementManager.as +++ b/com/ankamagames/atouin/managers/AnimatedElementManager.as @@ -1,118 +1,115 @@ -package com.ankamagames.atouin.managers +package com.ankamagames.atouin.managers { - import __AS3__.vec.Vector; - import com.ankamagames.atouin.types.AnimatedElementInfo; - import flash.utils.Dictionary; - import com.ankamagames.jerakine.utils.display.StageShareManager; - import flash.events.Event; - import com.ankamagames.tiphon.display.TiphonSprite; - import com.ankamagames.jerakine.sequencer.SerialSequencer; - import com.ankamagames.tiphon.sequence.PlayAnimationStep; - import flash.utils.getTimer; - import com.ankamagames.tiphon.sequence.SetAnimationStep; - import com.ankamagames.jerakine.sequencer.CallbackStep; - import com.ankamagames.jerakine.types.Callback; - import __AS3__.vec.*; - - public final class AnimatedElementManager - { - - private static var _elements:Vector.; - private static const SEQUENCE_TYPE_NAME:String = "AnimatedElementManager_sequence"; - private static const MAX_ANIMATION_LENGTH:int = 20000; - - private var _sequenceRef:Dictionary; - - public function AnimatedElementManager() - { - this._sequenceRef = new Dictionary(true); - super(); - } - - public static function reset():void - { - var num:int; - var i:int; - var info:AnimatedElementInfo; - if (_elements) + import com.ankamagames.atouin.types.AnimatedElementInfo; + import com.ankamagames.jerakine.utils.display.StageShareManager; + import flash.events.Event; + import com.ankamagames.tiphon.display.TiphonSprite; + import com.ankamagames.jerakine.sequencer.SerialSequencer; + import com.ankamagames.tiphon.sequence.PlayAnimationStep; + import flash.utils.getTimer; + import com.ankamagames.tiphon.sequence.SetAnimationStep; + import com.ankamagames.jerakine.sequencer.CallbackStep; + import com.ankamagames.jerakine.types.Callback; + import flash.utils.Dictionary; + + public final class AnimatedElementManager extends Object + { + + public function AnimatedElementManager() + { + this._sequenceRef = new Dictionary(true); + super(); + } + + private static var _elements:Vector.; + + private static const SEQUENCE_TYPE_NAME:String = "AnimatedElementManager_sequence"; + + private static const MAX_ANIMATION_LENGTH:int = 20000; + + public static function reset() : void + { + var _loc1_:* = 0; + var _loc2_:* = 0; + var _loc3_:AnimatedElementInfo = null; + if(_elements) + { + _loc1_ = _elements.length; + _loc2_ = -1; + while(++_loc2_ < _loc1_) { - num = _elements.length; - i = -1; - while (++i < num) - { - info = _elements[i]; - info.tiphonSprite.destroy(); - }; - }; - _elements = new Vector.(); - StageShareManager.stage.removeEventListener(Event.ENTER_FRAME, loop); - } - - public static function addAnimatedElement(tiphonSprite:TiphonSprite, min:int, max:int):void - { - if (_elements.length == 0) + _loc3_ = _elements[_loc2_]; + _loc3_.tiphonSprite.destroy(); + } + } + _elements = new Vector.(); + StageShareManager.stage.removeEventListener(Event.ENTER_FRAME,loop); + } + + public static function addAnimatedElement(param1:TiphonSprite, param2:int, param3:int) : void + { + if(_elements.length == 0) + { + StageShareManager.stage.addEventListener(Event.ENTER_FRAME,loop); + } + _elements.push(new AnimatedElementInfo(param1,param2,param3)); + } + + public static function removeAnimatedElement(param1:TiphonSprite) : void + { + var _loc2_:uint = 0; + var _loc3_:AnimatedElementInfo = null; + while(_loc2_ < _elements.length) + { + _loc3_ = _elements[_loc2_]; + if(_loc3_.tiphonSprite == param1) { - StageShareManager.stage.addEventListener(Event.ENTER_FRAME, loop); - }; - _elements.push(new AnimatedElementInfo(tiphonSprite, min, max)); - } - - public static function removeAnimatedElement(tiphonSprite:TiphonSprite):void - { - var index:uint; - var elem:AnimatedElementInfo; - while (index < _elements.length) + _elements.splice(_loc2_,1); + if(_elements.length == 0) + { + StageShareManager.stage.removeEventListener(Event.ENTER_FRAME,loop); + SerialSequencer.clearByType(SEQUENCE_TYPE_NAME); + } + return; + } + _loc2_++; + } + } + + public static function loop(param1:Event) : void + { + var _loc5_:AnimatedElementInfo = null; + var _loc6_:SerialSequencer = null; + var _loc7_:PlayAnimationStep = null; + var _loc2_:int = getTimer(); + var _loc3_:* = -1; + var _loc4_:int = _elements.length; + while(++_loc3_ < _loc4_) + { + _loc5_ = _elements[_loc3_]; + if(_loc2_ - _loc5_.nextAnimation > 0) { - elem = _elements[index]; - if (elem.tiphonSprite == tiphonSprite) - { - _elements.splice(index, 1); - if (_elements.length == 0) - { - StageShareManager.stage.removeEventListener(Event.ENTER_FRAME, loop); - SerialSequencer.clearByType(SEQUENCE_TYPE_NAME); - }; - return; - }; - index++; - }; - } - - public static function loop(e:Event):void - { - var elementInfo:AnimatedElementInfo; - var seq:SerialSequencer; - var playAnimStep:PlayAnimationStep; - var time:int = getTimer(); - var i:int = -1; - var num:int = _elements.length; - while (++i < num) - { - elementInfo = _elements[i]; - if ((time - elementInfo.nextAnimation) > 0) - { - elementInfo.setNextAnimation(); - seq = new SerialSequencer(SEQUENCE_TYPE_NAME); - playAnimStep = new PlayAnimationStep(elementInfo.tiphonSprite, "AnimStart", false); - playAnimStep.timeout = MAX_ANIMATION_LENGTH; - seq.addStep(playAnimStep); - seq.addStep(new SetAnimationStep(elementInfo.tiphonSprite, "AnimStatique")); - seq.addStep(new CallbackStep(new Callback(onSequenceEnd, seq, elementInfo.tiphonSprite))); - seq.start(); - }; - }; - } - - private static function onSequenceEnd(sequence:SerialSequencer, ts:TiphonSprite):void - { - sequence.clear(); - if (ts.getAnimation() == "AnimStart") - { - ts.stopAnimation(); - }; - } - - - } -}//package com.ankamagames.atouin.managers - + _loc5_.setNextAnimation(); + _loc6_ = new SerialSequencer(SEQUENCE_TYPE_NAME); + _loc7_ = new PlayAnimationStep(_loc5_.tiphonSprite,"AnimStart",false); + _loc7_.timeout = MAX_ANIMATION_LENGTH; + _loc6_.addStep(_loc7_); + _loc6_.addStep(new SetAnimationStep(_loc5_.tiphonSprite,"AnimStatique")); + _loc6_.addStep(new CallbackStep(new Callback(onSequenceEnd,_loc6_,_loc5_.tiphonSprite))); + _loc6_.start(); + } + } + } + + private static function onSequenceEnd(param1:SerialSequencer, param2:TiphonSprite) : void + { + param1.clear(); + if(param2.getAnimation() == "AnimStart") + { + param2.stopAnimation(); + } + } + + private var _sequenceRef:Dictionary; + } +} diff --git a/com/ankamagames/atouin/managers/DataGroundMapManager.as b/com/ankamagames/atouin/managers/DataGroundMapManager.as index b2210d0cd..d4ff54f9b 100644 --- a/com/ankamagames/atouin/managers/DataGroundMapManager.as +++ b/com/ankamagames/atouin/managers/DataGroundMapManager.as @@ -1,293 +1,326 @@ -package com.ankamagames.atouin.managers +package com.ankamagames.atouin.managers { - import com.ankamagames.jerakine.logger.Logger; - import com.ankamagames.jerakine.logger.Log; - import flash.utils.getQualifiedClassName; - import flash.display.Shape; - import com.ankamagames.jerakine.utils.misc.AsyncJPGEncoder; - import flash.filesystem.FileStream; - import flash.filesystem.File; - import flash.display.BitmapData; - import flash.geom.Matrix; - import com.ankamagames.jerakine.types.CustomSharedObject; - import flash.geom.Point; - import com.ankamagames.atouin.AtouinConstants; - import com.ankamagames.atouin.enums.GroundCache; - import com.ankamagames.jerakine.utils.benchmark.monitoring.FpsManager; - import com.ankamagames.atouin.data.map.Map; - import flash.filesystem.FileMode; - import com.ankamagames.atouin.utils.GroundMapLoader; - import flash.errors.IOError; - import flash.utils.ByteArray; - import flash.utils.getTimer; - import by.blooddy.crypto.image.JPEGEncoder; - - public class DataGroundMapManager - { - - private static const _log:Logger = Log.getLogger(getQualifiedClassName(DataGroundMapManager)); - private static const MAPS_DIRECTORY:String = "./maps"; - private static const JPEG_HIGH_QUALITY:uint = 80; - private static const JPEG_MEDIUM_QUALITY:uint = 70; - private static const JPEG_LOW_QUALITY:uint = 60; - private static var _currentQuality:uint; - private static var _mask:Shape; - private static var _currentDiskUsed:Number = 0; - private static var _jpgEncoder:AsyncJPGEncoder; - private static const _currentEncoderQuality:int = -1; - private static var _currentOutputFileStream:FileStream; - private static var _bitmapDataList:Array = new Array(); - private static var _processing:Boolean = false; - private static var _directory:File; - private static var _currentMapId:int = -1; - private static var buffer:BitmapData; - private static var _m:Matrix = new Matrix(); - - - public static function mapsCurrentlyRendered():int - { - return (_bitmapDataList.length); - } - - public static function getCurrentDiskUsed():Number - { - var _local_1:Number; - var _local_2:File; - var _local_3:Array; - var _local_4:int; - var _local_5:int; - var map:File; - if (_currentDiskUsed) + import com.ankamagames.jerakine.logger.Logger; + import cmodule.as3_jpeg_wrapper.CLibInit; + import flash.filesystem.FileStream; + import flash.filesystem.File; + import com.ankamagames.jerakine.types.CustomSharedObject; + import flash.display.BitmapData; + import flash.geom.Matrix; + import com.ankamagames.atouin.data.map.Map; + import flash.geom.Point; + import com.ankamagames.atouin.AtouinConstants; + import com.ankamagames.atouin.enums.GroundCache; + import com.ankamagames.jerakine.utils.benchmark.monitoring.FpsManager; + import flash.errors.IOError; + import flash.filesystem.FileMode; + import com.ankamagames.atouin.utils.GroundMapLoader; + import flash.utils.ByteArray; + import flash.utils.getTimer; + import com.ankamagames.jerakine.logger.Log; + import flash.utils.getQualifiedClassName; + + public class DataGroundMapManager extends Object + { + + public function DataGroundMapManager() + { + super(); + } + + private static const _log:Logger = Log.getLogger(getQualifiedClassName(DataGroundMapManager)); + + private static const MAPS_DIRECTORY:String = "./maps"; + + private static const JPEG_HIGH_QUALITY:uint = 80; + + private static const JPEG_MEDIUM_QUALITY:uint = 70; + + private static const JPEG_LOW_QUALITY:uint = 60; + + private static const INITIAL_ENCODER_QUALITY:int = -1; + + private static var _currentQuality:uint; + + private static var _currentDiskUsed:Number = 0; + + private static var _jpegWrapperInit:CLibInit = new CLibInit(); + + private static var _jpegWrapperLib:Object = _jpegWrapperInit.init(); + + private static var _currentOutputFileStream:FileStream; + + private static var _bitmapDataList:Array = new Array(); + + private static var _processing:Boolean = false; + + private static var _directory:File; + + private static var _currentMapId:int = -1; + + public static function mapsCurrentlyRendered() : int + { + return _bitmapDataList.length; + } + + public static function getCurrentDiskUsed() : Number + { + var _loc1_:* = NaN; + var _loc2_:File = null; + var _loc3_:Array = null; + var _loc4_:* = 0; + var _loc5_:* = 0; + var _loc6_:File = null; + if(_currentDiskUsed) + { + return _currentDiskUsed; + } + _loc1_ = 0; + _loc2_ = new File(CustomSharedObject.getCustomSharedObjectDirectory() + MAPS_DIRECTORY); + if(!_loc2_.exists || !_loc2_.isDirectory) + { + return 0; + } + _loc3_ = _loc2_.getDirectoryListing(); + _loc4_ = _loc3_.length; + _loc5_ = 0; + while(_loc5_ < _loc4_) + { + _loc6_ = _loc3_[_loc5_]; + _loc1_ = _loc1_ + _loc6_.size; + _loc5_++; + } + _currentDiskUsed = _loc1_; + return _loc1_; + } + + public static function clearGroundCache() : void + { + var _loc1_:File = new File(CustomSharedObject.getCustomSharedObjectDirectory() + MAPS_DIRECTORY); + if((_loc1_.exists) && (_loc1_.isDirectory)) + { + _loc1_.deleteDirectory(true); + _directory = null; + _currentDiskUsed = 0; + } + } + + private static var buffer:BitmapData; + + private static var _m:Matrix = new Matrix(); + + public static function saveGroundMap(param1:BitmapData, param2:Map) : void + { + var _loc3_:Point = null; + _m.identity(); + switch(param2.groundCacheCurrentlyUsed) + { + case GroundCache.GROUND_CACHE_LOW_QUALITY: + _loc3_ = AtouinConstants.RESOLUTION_LOW_QUALITY; + _m.scale(0.5,0.5); + break; + case GroundCache.GROUND_CACHE_MEDIUM_QUALITY: + _loc3_ = AtouinConstants.RESOLUTION_MEDIUM_QUALITY; + _m.scale(0.75,0.75); + break; + case GroundCache.GROUND_CACHE_HIGH_QUALITY: + _loc3_ = AtouinConstants.RESOLUTION_HIGH_QUALITY; + break; + } + FpsManager.getInstance().startTracking("groundMap",10621692); + if(!(param1.width == _loc3_.x) || !(param1.height == _loc3_.y)) + { + if(buffer == null || !(buffer.width == _loc3_.x) || !(buffer.height == _loc3_.y)) { - return (_currentDiskUsed); - }; - _local_1 = 0; - _local_2 = new File((CustomSharedObject.getCustomSharedObjectDirectory() + MAPS_DIRECTORY)); - if (((!(_local_2.exists)) || (!(_local_2.isDirectory)))) - { - return (0); - }; - _local_3 = _local_2.getDirectoryListing(); - _local_4 = _local_3.length; - _local_5 = 0; - while (_local_5 < _local_4) - { - map = _local_3[_local_5]; - _local_1 = (_local_1 + map.size); - _local_5++; - }; - _currentDiskUsed = _local_1; - return (_local_1); - } - - public static function clearGroundCache():void - { - var directory:File = new File((CustomSharedObject.getCustomSharedObjectDirectory() + MAPS_DIRECTORY)); - if (((directory.exists) && (directory.isDirectory))) - { - directory.deleteDirectory(true); - _directory = null; - _currentDiskUsed = 0; - }; - } - - public static function saveGroundMap(ground:BitmapData, map:Map):void - { - var cacheSize:Point; - _m.identity(); - switch (map.groundCacheCurrentlyUsed) + buffer = new BitmapData(_loc3_.x,_loc3_.y,false,16711680); + } + buffer.draw(param1,_m); + _bitmapDataList.push(buffer,param2); + } + else + { + _bitmapDataList.push(param1,param2); + } + process(); + FpsManager.getInstance().stopTracking("groundMap"); + } + + public static function loadGroundMap(param1:Map, param2:Function, param3:Function) : int + { + var numMap:int = 0; + var i:int = 0; + var waitingMap:Map = null; + var file:File = null; + var fileStream:FileStream = null; + var fileCRC:int = 0; + var map:Map = param1; + var callBack:Function = param2; + var errorCallBack:Function = param3; + try + { + FpsManager.getInstance().startTracking("groundMap",10621692); + if(!_directory) { - case GroundCache.GROUND_CACHE_LOW_QUALITY: - cacheSize = AtouinConstants.RESOLUTION_LOW_QUALITY; - _m.scale(0.5, 0.5); - break; - case GroundCache.GROUND_CACHE_MEDIUM_QUALITY: - cacheSize = AtouinConstants.RESOLUTION_MEDIUM_QUALITY; - _m.scale(0.75, 0.75); - break; - case GroundCache.GROUND_CACHE_HIGH_QUALITY: - cacheSize = AtouinConstants.RESOLUTION_HIGH_QUALITY; - break; - }; - FpsManager.getInstance().startTracking("groundMap", 10621692); - if (((!((ground.width == cacheSize.x))) || (!((ground.height == cacheSize.y))))) + _directory = new File(CustomSharedObject.getCustomSharedObjectDirectory() + MAPS_DIRECTORY); + if(!_directory.exists) + { + _directory.createDirectory(); + } + } + if(_currentMapId == map.id) { - if ((((((buffer == null)) || (!((buffer.width == cacheSize.x))))) || (!((buffer.height == cacheSize.y))))) - { - buffer = new BitmapData(cacheSize.x, cacheSize.y, false, 0xFF0000); - }; - buffer.draw(ground, _m); - _bitmapDataList.push(buffer, map); + return GroundCache.GROUND_CACHE_SKIP; } - else + numMap = _bitmapDataList.length; + i = 0; + while(i < numMap) { - _bitmapDataList.push(ground, map); - }; - process(); - FpsManager.getInstance().stopTracking("groundMap"); - } - - public static function loadGroundMap(map:Map, callBack:Function, errorCallBack:Function):int - { - var numMap:int; - var i:int; - var waitingMap:Map; - var file:File; - var fileStream:FileStream; - var fileCRC:int; - try + waitingMap = _bitmapDataList[i + 1]; + if(waitingMap.id == map.id) + { + return GroundCache.GROUND_CACHE_SKIP; + } + i = i + 2; + } + if(_directory.spaceAvailable > AtouinConstants.MIN_DISK_SPACE_AVAILABLE) { - FpsManager.getInstance().startTracking("groundMap", 10621692); - if (!(_directory)) - { - _directory = new File((CustomSharedObject.getCustomSharedObjectDirectory() + MAPS_DIRECTORY)); - if (!(_directory.exists)) - { - _directory.createDirectory(); - }; - }; - if (_currentMapId == map.id) - { - return (GroundCache.GROUND_CACHE_SKIP); - }; - numMap = _bitmapDataList.length; - i = 0; - while (i < numMap) - { - waitingMap = _bitmapDataList[(i + 1)]; - if (waitingMap.id == map.id) - { - return (GroundCache.GROUND_CACHE_SKIP); - }; - i = (i + 2); - }; - if (_directory.spaceAvailable > AtouinConstants.MIN_DISK_SPACE_AVAILABLE) - { - file = new File(((((CustomSharedObject.getCustomSharedObjectDirectory() + MAPS_DIRECTORY) + "/") + map.id) + ".bg")); - if (file.exists) - { - fileStream = new FileStream(); - try + file = new File(CustomSharedObject.getCustomSharedObjectDirectory() + MAPS_DIRECTORY + "/" + map.id + ".bg"); + if(file.exists) + { + fileStream = new FileStream(); + try + { + fileStream.open(file,FileMode.READ); + if(fileStream.readInt() == AtouinConstants.GROUND_MAP_VERSION) + { + if(fileStream.readByte() <= map.groundCacheCurrentlyUsed) { - fileStream.open(file, FileMode.READ); - if (fileStream.readInt() == AtouinConstants.GROUND_MAP_VERSION) - { - if (fileStream.readByte() <= map.groundCacheCurrentlyUsed) - { - fileCRC = fileStream.readInt(); - if (fileCRC == map.groundCRC) - { - GroundMapLoader.loadGroundMap(map, file, callBack, errorCallBack); - return (GroundCache.GROUND_CACHE_AVAILABLE); - }; - }; - }; - fileStream.close(); + fileCRC = fileStream.readInt(); + if(fileCRC == map.groundCRC) + { + GroundMapLoader.loadGroundMap(map,file,callBack,errorCallBack); + return GroundCache.GROUND_CACHE_AVAILABLE; + } } - catch(e:IOError) - { - _log.error(e); - return (GroundCache.GROUND_CACHE_SKIP); - }; - }; - } - else - { - _log.info("On ne fait rien, il n'y a plus assez d'espace disque."); - return (GroundCache.GROUND_CACHE_ERROR); - }; - FpsManager.getInstance().stopTracking("groundMap"); + } + fileStream.close(); + } + catch(e:IOError) + { + _log.error(e); + return GroundCache.GROUND_CACHE_SKIP; + } + } + if(file.exists) + { + FpsManager.getInstance().stopTracking("groundMap"); + } + else + { + FpsManager.getInstance().stopTracking("groundMap"); + } } - catch(e:Error) - { - _log.fatal(e.getStackTrace()); - return (GroundCache.GROUND_CACHE_ERROR); - }; - return (GroundCache.GROUND_CACHE_NOT_AVAILABLE); - } - - private static function process():void - { - var bitmapData:BitmapData; - var map:Map; - var file:File; - var t:uint; - var res:ByteArray; - if (((!(_processing)) && (_bitmapDataList.length))) - { - _processing = true; - bitmapData = _bitmapDataList.shift(); - map = _bitmapDataList.shift(); - _currentMapId = map.id; - initEncoder(map.groundCacheCurrentlyUsed); - try - { - file = new File(((((CustomSharedObject.getCustomSharedObjectDirectory() + MAPS_DIRECTORY) + "/") + map.id) + ".bg")); - _currentOutputFileStream = new FileStream(); - _currentOutputFileStream.open(file, FileMode.WRITE); - } - catch(e:Error) - { - _log.info(("Le fichier est locké " + file.nativePath)); - }; - t = getTimer(); - res = JPEGEncoder.encode(bitmapData, _currentQuality); - trace((((((("Encodage " + bitmapData.width) + " x ") + bitmapData.height) + " : ") + (getTimer() - t)) + " ms")); - jpgGenerated(res, map); - }; - } - - private static function initEncoder(qualityEnum:uint):void - { - var quality:uint; - if (_currentEncoderQuality != qualityEnum) - { - switch (true) - { - case (qualityEnum == GroundCache.GROUND_CACHE_HIGH_QUALITY): - quality = JPEG_HIGH_QUALITY; - break; - case (qualityEnum == GroundCache.GROUND_CACHE_MEDIUM_QUALITY): - quality = JPEG_MEDIUM_QUALITY; - break; - case (qualityEnum == GroundCache.GROUND_CACHE_LOW_QUALITY): - quality = JPEG_LOW_QUALITY; - break; - default: - quality = JPEG_MEDIUM_QUALITY; - _log.error("Attention Enum d'encodage pour la qualité JPG non valide, utisation d'une qualité moyenne"); - }; - _currentQuality = quality; - }; - } - - private static function jpgGenerated(rawJPG:ByteArray, map:Map):void - { - try + else { - _currentOutputFileStream.writeInt(AtouinConstants.GROUND_MAP_VERSION); - _currentOutputFileStream.writeByte(map.groundCacheCurrentlyUsed); - _currentOutputFileStream.writeInt(map.groundCRC); - _currentDiskUsed = (_currentDiskUsed + rawJPG.length); - _currentOutputFileStream.writeBytes(rawJPG); - _processing = false; - _currentMapId = -1; + _log.info("On ne fait rien, il n\'y a plus assez d\'espace disque."); + return GroundCache.GROUND_CACHE_ERROR; } - catch(e:IOError) - { - _log.error("Impossible de sauvegarder le background de la map "); - }; + } + catch(e:Error) + { + _log.fatal(e.getStackTrace()); + return GroundCache.GROUND_CACHE_ERROR; + } + return GroundCache.GROUND_CACHE_NOT_AVAILABLE; + } + + private static function process() : void + { + var bitmapData:BitmapData = null; + var map:Map = null; + var file:File = null; + var t:uint = 0; + var baSource:ByteArray = null; + var encodedData:ByteArray = null; + if(!_processing && (_bitmapDataList.length)) + { + _processing = true; + bitmapData = _bitmapDataList.shift(); + map = _bitmapDataList.shift(); + _currentMapId = map.id; + initEncoder(map.groundCacheCurrentlyUsed); try { - _currentOutputFileStream.close(); + file = new File(CustomSharedObject.getCustomSharedObjectDirectory() + MAPS_DIRECTORY + "/" + map.id + ".bg"); + _currentOutputFileStream = new FileStream(); + _currentOutputFileStream.open(file,FileMode.WRITE); } catch(e:Error) { - }; - process(); - } - - - } -}//package com.ankamagames.atouin.managers - + _log.info("Le fichier est locké " + file.nativePath); + } + t = getTimer(); + baSource = bitmapData.getPixels(bitmapData.rect); + baSource.position = 0; + encodedData = _jpegWrapperLib.write_jpeg_file(baSource,bitmapData.width,bitmapData.height,3,2,_currentQuality); + encodedData.position = 0; + _log.debug("Encoded as JPEG a " + bitmapData.width + " x " + bitmapData.height + " ground map bitmap (mapId " + map.id + ") in " + (getTimer() - t) + " ms (" + encodedData.bytesAvailable + " bytes)"); + baSource.clear(); + jpgGenerated(encodedData,map); + } + } + + private static function initEncoder(param1:uint) : void + { + var _loc2_:uint = 0; + if(INITIAL_ENCODER_QUALITY != param1) + { + switch(true) + { + case param1 == GroundCache.GROUND_CACHE_HIGH_QUALITY: + _loc2_ = JPEG_HIGH_QUALITY; + break; + case param1 == GroundCache.GROUND_CACHE_MEDIUM_QUALITY: + _loc2_ = JPEG_MEDIUM_QUALITY; + break; + case param1 == GroundCache.GROUND_CACHE_LOW_QUALITY: + _loc2_ = JPEG_LOW_QUALITY; + break; + default: + _loc2_ = JPEG_MEDIUM_QUALITY; + _log.error("Attention Enum d\'encodage pour la qualité JPG non valide, utisation d\'une qualité moyenne"); + } + _currentQuality = _loc2_; + } + } + + private static function jpgGenerated(param1:ByteArray, param2:Map) : void + { + var rawJPG:ByteArray = param1; + var map:Map = param2; + try + { + _currentOutputFileStream.writeInt(AtouinConstants.GROUND_MAP_VERSION); + _currentOutputFileStream.writeByte(map.groundCacheCurrentlyUsed); + _currentOutputFileStream.writeInt(map.groundCRC); + _currentDiskUsed = _currentDiskUsed + rawJPG.length; + _currentOutputFileStream.writeBytes(rawJPG); + rawJPG.clear(); + _processing = false; + _currentMapId = -1; + } + catch(e:IOError) + { + _log.error("Impossible de sauvegarder le background de la map "); + } + try + { + _currentOutputFileStream.close(); + } + catch(e:Error) + { + } + process(); + } + } +} diff --git a/com/ankamagames/atouin/managers/EntitiesDisplayManager.as b/com/ankamagames/atouin/managers/EntitiesDisplayManager.as index 0577e876c..5a87bacf1 100644 --- a/com/ankamagames/atouin/managers/EntitiesDisplayManager.as +++ b/com/ankamagames/atouin/managers/EntitiesDisplayManager.as @@ -1,241 +1,250 @@ -package com.ankamagames.atouin.managers +package com.ankamagames.atouin.managers { - import com.ankamagames.jerakine.logger.Logger; - import com.ankamagames.jerakine.logger.Log; - import flash.utils.getQualifiedClassName; - import flash.utils.Dictionary; - import com.ankamagames.jerakine.utils.errors.SingletonError; - import flash.display.DisplayObject; - import com.ankamagames.atouin.utils.errors.AtouinError; - import flash.display.Sprite; - import com.ankamagames.atouin.enums.PlacementStrataEnums; - import com.ankamagames.atouin.Atouin; - import com.ankamagames.jerakine.interfaces.ITransparency; - import com.ankamagames.atouin.AtouinConstants; - import com.ankamagames.jerakine.entities.interfaces.IDisplayable; - import com.ankamagames.jerakine.types.positions.MapPoint; - import flash.display.DisplayObjectContainer; - import com.ankamagames.tiphon.display.TiphonSprite; - import com.ankamagames.atouin.types.GraphicCell; - import com.ankamagames.jerakine.utils.display.Rectangle2; - import com.ankamagames.jerakine.utils.display.StageShareManager; - import flash.geom.Rectangle; - import com.ankamagames.jerakine.interfaces.IRectangle; - - public class EntitiesDisplayManager - { - - protected static const _log:Logger = Log.getLogger(getQualifiedClassName(EntitiesDisplayManager)); - private static var _self:EntitiesDisplayManager; - - public var _dStrataRef:Dictionary; - - public function EntitiesDisplayManager() - { - this._dStrataRef = new Dictionary(true); - super(); - if (_self) - { - throw (new SingletonError("Warning : MobilesManager is a singleton class and shoulnd't be instancied directly!")); - }; - } - - public static function getInstance():EntitiesDisplayManager - { - if (!(_self)) - { - _self = new (EntitiesDisplayManager)(); - }; - return (_self); - } - - - public function displayEntity(oEntity:IDisplayable, cellCoords:MapPoint, strata:uint=0):void - { - var displayObject:DisplayObject; - try - { - displayObject = (oEntity as DisplayObject); - } - catch(te:TypeError) - { - throw (new AtouinError("Entities implementing IDisplayable should extends DisplayObject.")); - }; - if (this._dStrataRef[oEntity] != null) - { - strata = this._dStrataRef[oEntity]; + import com.ankamagames.jerakine.logger.Logger; + import com.ankamagames.jerakine.logger.Log; + import flash.utils.getQualifiedClassName; + import flash.utils.Dictionary; + import com.ankamagames.jerakine.entities.interfaces.IDisplayable; + import com.ankamagames.jerakine.types.positions.MapPoint; + import flash.display.Sprite; + import flash.display.DisplayObject; + import com.ankamagames.atouin.utils.errors.AtouinError; + import com.ankamagames.atouin.enums.PlacementStrataEnums; + import com.ankamagames.atouin.Atouin; + import com.ankamagames.jerakine.interfaces.ITransparency; + import com.ankamagames.atouin.AtouinConstants; + import flash.display.DisplayObjectContainer; + import com.ankamagames.tiphon.display.TiphonSprite; + import com.ankamagames.atouin.types.GraphicCell; + import com.ankamagames.jerakine.interfaces.IRectangle; + import com.ankamagames.jerakine.utils.display.Rectangle2; + import com.ankamagames.jerakine.utils.display.StageShareManager; + import flash.geom.Rectangle; + import com.ankamagames.jerakine.utils.errors.SingletonError; + + public class EntitiesDisplayManager extends Object + { + + public function EntitiesDisplayManager() + { + this._dStrataRef = new Dictionary(true); + super(); + if(_self) + { + throw new SingletonError("Warning : MobilesManager is a singleton class and shoulnd\'t be instancied directly!"); + } + else + { + return; + } + } + + protected static const _log:Logger = Log.getLogger(getQualifiedClassName(EntitiesDisplayManager)); + + private static var _self:EntitiesDisplayManager; + + public static function getInstance() : EntitiesDisplayManager + { + if(!_self) + { + _self = new EntitiesDisplayManager(); + } + return _self; + } + + public var _dStrataRef:Dictionary; + + public function displayEntity(param1:IDisplayable, param2:MapPoint, param3:uint = 0) : void + { + var displayObject:DisplayObject = null; + var oEntity:IDisplayable = param1; + var cellCoords:MapPoint = param2; + var strata:uint = param3; + try + { + displayObject = oEntity as DisplayObject; + } + catch(te:TypeError) + { + throw new AtouinError("Entities implementing IDisplayable should extends DisplayObject."); + } + if(this._dStrataRef[oEntity] != null) + { + strata = this._dStrataRef[oEntity]; + } + else + { + this._dStrataRef[oEntity] = strata; + } + if(!cellCoords) + { + return; + } + var cellSprite:Sprite = InteractiveCellManager.getInstance().getCell(cellCoords.cellId); + displayObject.x = cellSprite.x + cellSprite.width / 2; + displayObject.y = cellSprite.y + cellSprite.height / 2; + if(strata == PlacementStrataEnums.STRATA_NO_Z_ORDER) + { + if(Atouin.getInstance().options.transparentOverlayMode) + { + if(displayObject is ITransparency && (ITransparency(displayObject).getIsTransparencyAllowed())) + { + displayObject.alpha = displayObject.alpha != 1?displayObject.alpha:AtouinConstants.OVERLAY_MODE_ALPHA; + } + else + { + displayObject.alpha = 1; + } + Atouin.getInstance().gfxContainer.addChild(displayObject); } else { - this._dStrataRef[oEntity] = strata; - }; - if (!(cellCoords)) - { - return; - }; - var cellSprite:Sprite = InteractiveCellManager.getInstance().getCell(cellCoords.cellId); - displayObject.x = (cellSprite.x + (cellSprite.width / 2)); - displayObject.y = (cellSprite.y + (cellSprite.height / 2)); - if (strata == PlacementStrataEnums.STRATA_NO_Z_ORDER) - { - if (Atouin.getInstance().options.transparentOverlayMode) - { - if ((((displayObject is ITransparency)) && (ITransparency(displayObject).getIsTransparencyAllowed()))) - { - displayObject.alpha = ((!((displayObject.alpha == 1))) ? displayObject.alpha : AtouinConstants.OVERLAY_MODE_ALPHA); - } - else - { - displayObject.alpha = 1; - }; - Atouin.getInstance().gfxContainer.addChild(displayObject); - } - else - { - displayObject.alpha = 1; - Atouin.getInstance().selectionContainer.addChild(displayObject); - }; + displayObject.alpha = 1; + Atouin.getInstance().selectionContainer.addChild(displayObject); } - else - { - if (strata == PlacementStrataEnums.STRATA_FOREGROUND) - { - Atouin.getInstance().gfxContainer.addChild(displayObject); - } - else - { - this.orderEntity(displayObject, cellSprite); - }; - }; - } - - public function refreshAlphaEntity(oEntity:IDisplayable, cellCoords:MapPoint, strata:uint=0):void - { - var displayObject:DisplayObject; - var cellSprite:Sprite; - try - { - displayObject = (oEntity as DisplayObject); + } + else if(strata == PlacementStrataEnums.STRATA_FOREGROUND) + { + Atouin.getInstance().gfxContainer.addChild(displayObject); + } + else + { + this.orderEntity(displayObject,cellSprite); + } + + } + + public function refreshAlphaEntity(param1:IDisplayable, param2:MapPoint, param3:uint = 0) : void + { + var displayObject:DisplayObject = null; + var cellSprite:Sprite = null; + var oEntity:IDisplayable = param1; + var cellCoords:MapPoint = param2; + var strata:uint = param3; + try + { + displayObject = oEntity as DisplayObject; + } + catch(te:TypeError) + { + throw new AtouinError("Entities implementing IDisplayable should extends DisplayObject."); + } + if(cellCoords) + { + cellSprite = InteractiveCellManager.getInstance().getCell(cellCoords.cellId); + this.orderEntity(displayObject,cellSprite); + } + else + { + _log.error("refreshAlphaEntity can\'t handle null position"); + } + } + + public function removeEntity(param1:IDisplayable) : void + { + var displayObject:DisplayObject = null; + var oEntity:IDisplayable = param1; + try + { + displayObject = oEntity as DisplayObject; + } + catch(te:TypeError) + { + throw new AtouinError("Entities implementing IDisplayable should extends DisplayObject."); + } + if(displayObject.parent) + { + displayObject.parent.removeChild(displayObject); + } + } + + public function orderEntity(param1:DisplayObject, param2:Sprite) : void + { + var _loc7_:DisplayObject = null; + var _loc10_:DisplayObjectContainer = null; + var _loc11_:* = 0; + var _loc3_:* = false; + var _loc4_:TiphonSprite = param1 as TiphonSprite; + if((_loc4_) && (_loc4_.parentSprite)) + { + _loc3_ = true; + } + if((Atouin.getInstance().options.transparentOverlayMode) && (param1 is ITransparency) && (ITransparency(param1).getIsTransparencyAllowed())) + { + param1.alpha = param1.alpha != 1?param1.alpha:AtouinConstants.OVERLAY_MODE_ALPHA; + if(_loc3_) + { + return; } - catch(te:TypeError) - { - throw (new AtouinError("Entities implementing IDisplayable should extends DisplayObject.")); - }; - if (cellCoords) + _loc10_ = Atouin.getInstance().overlayContainer; + _loc11_ = _loc10_.numChildren; + var _loc9_:uint = 0; + while(_loc9_ < _loc11_) + { + _loc7_ = _loc10_.getChildAt(_loc9_); + if(param1.y < _loc7_.y) + { + break; + } + _loc9_++; + } + if((_loc10_.contains(param1)) && _loc9_ > 0) { - cellSprite = InteractiveCellManager.getInstance().getCell(cellCoords.cellId); - this.orderEntity(displayObject, cellSprite); + _loc10_.addChildAt(param1,_loc9_ - 1); } else { - _log.error("refreshAlphaEntity can't handle null position"); - }; - } - - public function removeEntity(oEntity:IDisplayable):void - { - var displayObject:DisplayObject; - try - { - displayObject = (oEntity as DisplayObject); + _loc10_.addChildAt(param1,_loc9_); } - catch(te:TypeError) - { - throw (new AtouinError("Entities implementing IDisplayable should extends DisplayObject.")); - }; - if (displayObject.parent) - { - displayObject.parent.removeChild(displayObject); - }; - } - - public function orderEntity(entity:DisplayObject, cellSprite:Sprite):void - { - var currentElem:DisplayObject; - var container:DisplayObjectContainer; - var num:int; - var skipZOrder:Boolean; - var sprite:TiphonSprite = (entity as TiphonSprite); - if (((sprite) && (sprite.parentSprite))) - { - skipZOrder = true; - }; - if (((((Atouin.getInstance().options.transparentOverlayMode) && ((entity is ITransparency)))) && (ITransparency(entity).getIsTransparencyAllowed()))) - { - entity.alpha = ((!((entity.alpha == 1))) ? entity.alpha : AtouinConstants.OVERLAY_MODE_ALPHA); - if (skipZOrder) - { - return; - }; - container = Atouin.getInstance().overlayContainer; - num = container.numChildren; - var i:uint; - while (i < num) - { - currentElem = container.getChildAt(i); - if (entity.y < currentElem.y) - { - break; - }; - i++; - }; - if (((container.contains(entity)) && ((i > 0)))) - { - container.addChildAt(entity, (i - 1)); - } - else - { - container.addChildAt(entity, i); - }; - return; - }; - if (Math.round((entity.alpha * 10)) == (AtouinConstants.OVERLAY_MODE_ALPHA * 10)) - { - entity.alpha = 1; - }; - if (skipZOrder) - { - return; - }; - if (((!(cellSprite)) || (!(cellSprite.parent)))) + return; + } + if(Math.round(param1.alpha * 10) == AtouinConstants.OVERLAY_MODE_ALPHA * 10) + { + param1.alpha = 1; + } + if(_loc3_) + { + return; + } + if(!param2 || !param2.parent) + { + return; + } + var _loc5_:uint = param2.parent.getChildIndex(param2); + var _loc6_:int = param2.parent.numChildren; + var _loc8_:* = true; + _loc9_ = _loc5_ + 1; + while(_loc9_ < _loc6_) + { + _loc7_ = param2.parent.getChildAt(_loc9_); + if(_loc7_ is GraphicCell) + { + break; + } + if(this._dStrataRef[param1] < this._dStrataRef[_loc7_]) { - return; - }; - var depth:uint = cellSprite.parent.getChildIndex(cellSprite); - var nb:int = cellSprite.parent.numChildren; - var firstLoop:Boolean = true; - i = (depth + 1); - while (i < nb) + break; + } + if(!(_loc7_ === param2) && !(_loc7_ == param1)) { - currentElem = cellSprite.parent.getChildAt(i); - if ((currentElem is GraphicCell)) - { - break; - }; - if (this._dStrataRef[entity] < this._dStrataRef[currentElem]) break; - if (((!((currentElem === cellSprite))) && (!((currentElem == entity))))) - { - depth++; - }; - firstLoop = false; - i++; - }; - cellSprite.parent.addChildAt(entity, (depth + 1)); - } - - public function getAbsoluteBounds(entity:IDisplayable):IRectangle - { - var d:DisplayObject = (entity as DisplayObject); - var r:Rectangle2 = new Rectangle2(); - var r2:Rectangle = d.getBounds(StageShareManager.stage); - r.x = r2.x; - r.width = r2.width; - r.height = r2.height; - r.y = r2.y; - return (r); - } - - - } -}//package com.ankamagames.atouin.managers - + _loc5_++; + } + _loc8_ = false; + _loc9_++; + } + param2.parent.addChildAt(param1,_loc5_ + 1); + } + + public function getAbsoluteBounds(param1:IDisplayable) : IRectangle + { + var _loc2_:DisplayObject = param1 as DisplayObject; + var _loc3_:Rectangle2 = new Rectangle2(); + var _loc4_:Rectangle = _loc2_.getBounds(StageShareManager.stage); + _loc3_.x = _loc4_.x; + _loc3_.width = _loc4_.width; + _loc3_.height = _loc4_.height; + _loc3_.y = _loc4_.y; + return _loc3_; + } + } +} diff --git a/com/ankamagames/atouin/managers/EntitiesManager.as b/com/ankamagames/atouin/managers/EntitiesManager.as index 664489f2b..c8423d140 100644 --- a/com/ankamagames/atouin/managers/EntitiesManager.as +++ b/com/ankamagames/atouin/managers/EntitiesManager.as @@ -1,286 +1,293 @@ -package com.ankamagames.atouin.managers +package com.ankamagames.atouin.managers { - import com.ankamagames.jerakine.logger.Logger; - import com.ankamagames.jerakine.logger.Log; - import flash.utils.getQualifiedClassName; - import com.ankamagames.jerakine.utils.errors.SingletonError; - import com.ankamagames.atouin.Atouin; - import com.ankamagames.jerakine.types.events.PropertyChangeEvent; - import com.ankamagames.jerakine.entities.interfaces.IDisplayable; - import com.ankamagames.jerakine.entities.interfaces.IInteractive; - import flash.display.Sprite; - import com.ankamagames.jerakine.entities.interfaces.IEntity; - import com.ankamagames.jerakine.entities.interfaces.IMovable; - import com.ankamagames.tiphon.display.TiphonSprite; - import com.ankamagames.jerakine.types.enums.InteractionsEnum; - import flash.events.Event; - - public class EntitiesManager - { - - private static const RANDOM_ENTITIES_ID_START:uint = 1000000; - protected static const _log:Logger = Log.getLogger(getQualifiedClassName(EntitiesManager)); - private static var _self:EntitiesManager; - - private var _entities:Array; - private var _currentRandomEntity:uint = 1000000; - - public function EntitiesManager() - { - if (_self) - { - throw (new SingletonError("Warning : MobilesManager is a singleton class and shoulnd't be instancied directly!")); - }; + import com.ankamagames.jerakine.logger.Logger; + import com.ankamagames.jerakine.logger.Log; + import flash.utils.getQualifiedClassName; + import com.ankamagames.atouin.Atouin; + import com.ankamagames.jerakine.types.events.PropertyChangeEvent; + import com.ankamagames.jerakine.entities.interfaces.IEntity; + import com.ankamagames.jerakine.entities.interfaces.IDisplayable; + import com.ankamagames.jerakine.entities.interfaces.IInteractive; + import flash.display.Sprite; + import com.ankamagames.jerakine.entities.interfaces.IMovable; + import com.ankamagames.tiphon.display.TiphonSprite; + import com.ankamagames.jerakine.types.enums.InteractionsEnum; + import flash.events.Event; + import com.ankamagames.jerakine.utils.errors.SingletonError; + + public class EntitiesManager extends Object + { + + public function EntitiesManager() + { + super(); + if(_self) + { + throw new SingletonError("Warning : MobilesManager is a singleton class and shoulnd\'t be instancied directly!"); + } + else + { this._entities = new Array(); - Atouin.getInstance().options.addEventListener(PropertyChangeEvent.PROPERTY_CHANGED, this.onPropertyChanged); - } - - public static function getInstance():EntitiesManager - { - if (!(_self)) - { - _self = new (EntitiesManager)(); - }; - return (_self); - } - - - public function initManager():void - { - Atouin.getInstance().options.addEventListener(PropertyChangeEvent.PROPERTY_CHANGED, this.onPropertyChanged); - } - - public function addAnimatedEntity(entityID:int, entity:IEntity, strata:uint):void - { - if (this._entities[entityID] != null) - { - _log.warn((("Entity overwriting! Entity " + entityID) + " has been replaced.")); - }; - this._entities[entityID] = entity; - if ((entity is IDisplayable)) + Atouin.getInstance().options.addEventListener(PropertyChangeEvent.PROPERTY_CHANGED,this.onPropertyChanged); + return; + } + } + + private static const RANDOM_ENTITIES_ID_START:uint = 1000000; + + protected static const _log:Logger = Log.getLogger(getQualifiedClassName(EntitiesManager)); + + private static var _self:EntitiesManager; + + public static function getInstance() : EntitiesManager + { + if(!_self) + { + _self = new EntitiesManager(); + } + return _self; + } + + private var _entities:Array; + + private var _currentRandomEntity:uint = 1000000; + + public function initManager() : void + { + Atouin.getInstance().options.addEventListener(PropertyChangeEvent.PROPERTY_CHANGED,this.onPropertyChanged); + } + + public function addAnimatedEntity(param1:int, param2:IEntity, param3:uint) : void + { + if(this._entities[param1] != null) + { + _log.warn("Entity overwriting! Entity " + param1 + " has been replaced."); + } + this._entities[param1] = param2; + if(param2 is IDisplayable) + { + EntitiesDisplayManager.getInstance().displayEntity(param2 as IDisplayable,param2.position,param3); + } + if(param2 is IInteractive) + { + this.registerInteractions(IInteractive(param2),true); + Sprite(param2).buttonMode = IInteractive(param2).useHandCursor; + } + } + + public function getEntity(param1:int) : IEntity + { + return this._entities[param1]; + } + + public function getEntityID(param1:IEntity) : int + { + var _loc2_:String = null; + for(_loc2_ in this._entities) + { + if(param1 === this._entities[_loc2_]) { - EntitiesDisplayManager.getInstance().displayEntity((entity as IDisplayable), entity.position, strata); - }; - if ((entity is IInteractive)) + return parseInt(_loc2_); + } + } + return 0; + } + + public function removeEntity(param1:int) : void + { + if(this._entities[param1]) + { + if(this._entities[param1] is IDisplayable) { - this.registerInteractions(IInteractive(entity), true); - Sprite(entity).buttonMode = IInteractive(entity).useHandCursor; - }; - } - - public function getEntity(entityID:int):IEntity - { - return (this._entities[entityID]); - } - - public function getEntityID(entity:IEntity):int - { - var i:String; - for (i in this._entities) + EntitiesDisplayManager.getInstance().removeEntity(this._entities[param1] as IDisplayable); + } + if(this._entities[param1] is IInteractive) { - if (entity === this._entities[i]) - { - return (parseInt(i)); - }; - }; - return (0); - } - - public function removeEntity(entityID:int):void - { - if (this._entities[entityID]) + this.registerInteractions(IInteractive(this._entities[param1]),false); + } + if(this._entities[param1] is IMovable && (IMovable(this._entities[param1]).isMoving)) { - if ((this._entities[entityID] is IDisplayable)) - { - EntitiesDisplayManager.getInstance().removeEntity((this._entities[entityID] as IDisplayable)); - }; - if ((this._entities[entityID] is IInteractive)) - { - this.registerInteractions(IInteractive(this._entities[entityID]), false); - }; - if ((((this._entities[entityID] is IMovable)) && (IMovable(this._entities[entityID]).isMoving))) - { - IMovable(this._entities[entityID]).stop(true); - }; - delete this._entities[entityID]; - }; - } - - public function clearEntities():void - { - var id:String; - var i:int; - var num:int; - var entityId:int; - var ts:TiphonSprite; - var entityBuffer:Array = new Array(); - for (id in this._entities) - { - entityBuffer.push(id); - }; - i = -1; - num = entityBuffer.length; - while (++i < num) - { - entityId = entityBuffer[i]; - ts = (this._entities[entityId] as TiphonSprite); - this.removeEntity(entityId); - if (ts) - { - ts.destroy(); - }; - }; - this._entities = new Array(); - } - - public function get entities():Array - { - return (this._entities); - } - - public function get entitiesCount():int - { - var e:*; - var count:int; - for each (e in this._entities) + IMovable(this._entities[param1]).stop(true); + } + delete this._entities[param1]; + true; + } + } + + public function clearEntities() : void + { + var _loc2_:String = null; + var _loc3_:* = 0; + var _loc4_:* = 0; + var _loc5_:* = 0; + var _loc6_:TiphonSprite = null; + var _loc1_:Array = new Array(); + for(_loc2_ in this._entities) + { + _loc1_.push(_loc2_); + } + _loc3_ = -1; + _loc4_ = _loc1_.length; + while(++_loc3_ < _loc4_) + { + _loc5_ = _loc1_[_loc3_]; + _loc6_ = this._entities[_loc5_] as TiphonSprite; + this.removeEntity(_loc5_); + if(_loc6_) { - count++; - }; - return (count); - } - - public function getFreeEntityId():int - { - while (this._entities[++this._currentRandomEntity] != null) + _loc6_.destroy(); + } + } + this._entities = new Array(); + } + + public function get entities() : Array + { + return this._entities; + } + + public function get entitiesCount() : int + { + var _loc2_:* = undefined; + var _loc1_:* = 0; + for each(_loc2_ in this._entities) + { + _loc1_++; + } + return _loc1_; + } + + public function getFreeEntityId() : int + { + while(true) + { + if(this._entities[++this._currentRandomEntity] == null) { - this._currentRandomEntity++; - }; - return (this._currentRandomEntity); - } - - private function registerInteractions(entity:IInteractive, register:Boolean):void - { - var index:uint; - var interactions:uint = entity.enabledInteractions; - while (interactions > 0) + break; + } + this._currentRandomEntity++; + } + return this._currentRandomEntity; + } + + private function registerInteractions(param1:IInteractive, param2:Boolean) : void + { + var _loc3_:uint = 0; + var _loc4_:uint = param1.enabledInteractions; + while(_loc4_ > 0) + { + this.registerInteraction(param1,1 << _loc3_++,param2); + _loc4_ = _loc4_ >> 1; + } + } + + public function registerInteraction(param1:IInteractive, param2:uint, param3:Boolean) : void + { + var _loc5_:String = null; + var _loc4_:Array = InteractionsEnum.getEvents(param2); + for each(_loc5_ in _loc4_) + { + if((param3) && !param1.hasEventListener(_loc5_)) { - this.registerInteraction(entity, (1 << index++), register); - interactions = (interactions >> 1); - }; - } - - public function registerInteraction(entity:IInteractive, interactionType:uint, enabled:Boolean):void - { - var event:String; - var events:Array = InteractionsEnum.getEvents(interactionType); - for each (event in events) + param1.addEventListener(_loc5_,this.onInteraction,false,0,true); + } + else if(!param3 && (param1.hasEventListener(_loc5_))) { - if (((enabled) && (!(entity.hasEventListener(event))))) - { - entity.addEventListener(event, this.onInteraction, false, 0, true); - } - else - { - if (((!(enabled)) && (entity.hasEventListener(event)))) - { - entity.removeEventListener(event, this.onInteraction, false); - }; - }; - }; - } - - public function getEntityOnCell(cellId:uint, oClass:*=null):IEntity - { - var e:IEntity; - var _local_6:uint; - var useFilter:Boolean = !((oClass == null)); - var isMultiFilter:Boolean = ((useFilter) && ((oClass is Array))); - for each (e in this._entities) + param1.removeEventListener(_loc5_,this.onInteraction,false); + } + + } + } + + public function getEntityOnCell(param1:uint, param2:* = null) : IEntity + { + var _loc5_:IEntity = null; + var _loc6_:uint = 0; + var _loc3_:* = !(param2 == null); + var _loc4_:Boolean = (_loc3_) && param2 is Array; + for each(_loc5_ in this._entities) + { + if((_loc5_) && (_loc5_.position) && _loc5_.position.cellId == param1) { - if (((((e) && (e.position))) && ((e.position.cellId == cellId)))) - { - if (!(isMultiFilter)) - { - if (((!(useFilter)) || (((!(isMultiFilter)) && ((e is oClass)))))) - { - return (e); - }; - } - else - { - _local_6 = 0; - while (_local_6 < (oClass as Array).length) - { - if ((e is oClass[_local_6])) - { - return (e); - }; - _local_6++; - }; - }; - }; - }; - return (null); - } - - public function getEntitiesOnCell(cellId:uint, oClass:*=null):Array - { - var e:IEntity; - var _local_7:uint; - var useFilter:Boolean = !((oClass == null)); - var isMultiFilter:Boolean = ((useFilter) && ((oClass is Array))); - var result:Array = []; - for each (e in this._entities) + if(!_loc4_) + { + if(!_loc3_ || !_loc4_ && _loc5_ is param2) + { + return _loc5_; + } + } + else + { + _loc6_ = 0; + while(_loc6_ < (param2 as Array).length) + { + if(_loc5_ is param2[_loc6_]) + { + return _loc5_; + } + _loc6_++; + } + } + } + } + return null; + } + + public function getEntitiesOnCell(param1:uint, param2:* = null) : Array + { + var _loc6_:IEntity = null; + var _loc7_:uint = 0; + var _loc3_:* = !(param2 == null); + var _loc4_:Boolean = (_loc3_) && param2 is Array; + var _loc5_:Array = []; + for each(_loc6_ in this._entities) + { + if((_loc6_) && (_loc6_.position) && _loc6_.position.cellId == param1) { - if (((((e) && (e.position))) && ((e.position.cellId == cellId)))) - { - if (!(isMultiFilter)) - { - if (((!(useFilter)) || (((!(isMultiFilter)) && ((e is oClass)))))) - { - result.push(e); - }; - } - else - { - _local_7 = 0; - while (_local_7 < (oClass as Array).length) - { - if ((e is oClass[_local_7])) - { - result.push(e); - }; - _local_7++; - }; - }; - }; - }; - return (result); - } - - private function onInteraction(e:Event):void - { - var entity:IInteractive = IInteractive(e.target); - var clazz:Class = InteractionsEnum.getMessage(e.type); - entity.handler.process(new (clazz)(entity)); - } - - private function onPropertyChanged(e:PropertyChangeEvent):void - { - var ent:IEntity; - if (e.propertyName == "transparentOverlayMode") + if(!_loc4_) + { + if(!_loc3_ || !_loc4_ && _loc6_ is param2) + { + _loc5_.push(_loc6_); + } + } + else + { + _loc7_ = 0; + while(_loc7_ < (param2 as Array).length) + { + if(_loc6_ is param2[_loc7_]) + { + _loc5_.push(_loc6_); + } + _loc7_++; + } + } + } + } + return _loc5_; + } + + private function onInteraction(param1:Event) : void + { + var _loc2_:IInteractive = IInteractive(param1.target); + var _loc3_:Class = InteractionsEnum.getMessage(param1.type); + _loc2_.handler.process(new _loc3_(_loc2_)); + } + + private function onPropertyChanged(param1:PropertyChangeEvent) : void + { + var _loc2_:IEntity = null; + if(param1.propertyName == "transparentOverlayMode") + { + for each(_loc2_ in this._entities) { - for each (ent in this._entities) - { - if ((ent is IDisplayable)) - { - EntitiesDisplayManager.getInstance().refreshAlphaEntity((ent as IDisplayable), ent.position); - }; - }; - }; - } - - - } -}//package com.ankamagames.atouin.managers - + if(_loc2_ is IDisplayable) + { + EntitiesDisplayManager.getInstance().refreshAlphaEntity(_loc2_ as IDisplayable,_loc2_.position); + } + } + } + } + } +} diff --git a/com/ankamagames/atouin/managers/FrustumManager.as b/com/ankamagames/atouin/managers/FrustumManager.as index 50657be28..bece07e92 100644 --- a/com/ankamagames/atouin/managers/FrustumManager.as +++ b/com/ankamagames/atouin/managers/FrustumManager.as @@ -1,562 +1,570 @@ -package com.ankamagames.atouin.managers +package com.ankamagames.atouin.managers { - import com.ankamagames.jerakine.logger.Logger; - import com.ankamagames.jerakine.logger.Log; - import flash.utils.getQualifiedClassName; - import flash.display.DisplayObjectContainer; - import com.ankamagames.atouin.types.FrustumShape; - import com.ankamagames.atouin.types.Frustum; - import com.ankamagames.jerakine.utils.errors.SingletonError; - import com.ankamagames.jerakine.types.enums.DirectionsEnum; - import flash.events.MouseEvent; - import flash.display.Sprite; - import flash.geom.Point; - import com.ankamagames.atouin.AtouinConstants; - import __AS3__.vec.Vector; - import flash.display.Bitmap; - import com.ankamagames.jerakine.utils.display.StageShareManager; - import flash.display.BitmapData; - import flash.display.Shape; - import com.ankamagames.atouin.data.map.Map; - import com.ankamagames.atouin.data.map.Cell; - import com.ankamagames.atouin.data.map.CellData; - import com.ankamagames.atouin.utils.CellIdConverter; - import com.ankamagames.atouin.messages.AdjacentMapClickMessage; - import com.ankamagames.atouin.Atouin; - import com.ankamagames.atouin.messages.CellClickMessage; - import com.ankamagames.atouin.messages.AdjacentMapOutMessage; - import flash.display.DisplayObject; - import com.ankamagames.atouin.messages.AdjacentMapOverMessage; - import __AS3__.vec.*; - - public class FrustumManager - { - - protected static const _log:Logger = Log.getLogger(getQualifiedClassName(FrustumManager)); - private static var _self:FrustumManager; - - private var _frustumContainer:DisplayObjectContainer; - private var _shapeTop:FrustumShape; - private var _shapeRight:FrustumShape; - private var _shapeBottom:FrustumShape; - private var _shapeLeft:FrustumShape; - private var _frustrum:Frustum; - private var _lastCellId:int; - private var _enable:Boolean; - - public function FrustumManager() - { - if (_self) - { - throw (new SingletonError()); - }; - } - - public static function getInstance():FrustumManager - { - if (!(_self)) - { - _self = new (FrustumManager)(); - }; - return (_self); - } - - - public function init(frustumContainer:DisplayObjectContainer):void - { - this._frustumContainer = frustumContainer; - this._shapeTop = new FrustumShape(DirectionsEnum.UP); - this._shapeRight = new FrustumShape(DirectionsEnum.RIGHT); - this._shapeBottom = new FrustumShape(DirectionsEnum.DOWN); - this._shapeLeft = new FrustumShape(DirectionsEnum.LEFT); - this._frustumContainer.addChild(this._shapeLeft); - this._frustumContainer.addChild(this._shapeTop); - this._frustumContainer.addChild(this._shapeRight); - this._frustumContainer.addChild(this._shapeBottom); - this._shapeLeft.buttonMode = true; - this._shapeTop.buttonMode = true; - this._shapeRight.buttonMode = true; - this._shapeBottom.buttonMode = true; - this._shapeLeft.addEventListener(MouseEvent.CLICK, this.click); - this._shapeTop.addEventListener(MouseEvent.CLICK, this.click); - this._shapeRight.addEventListener(MouseEvent.CLICK, this.click); - this._shapeBottom.addEventListener(MouseEvent.CLICK, this.click); - this._shapeLeft.addEventListener(MouseEvent.MOUSE_OVER, this.mouseMove); - this._shapeTop.addEventListener(MouseEvent.MOUSE_OVER, this.mouseMove); - this._shapeRight.addEventListener(MouseEvent.MOUSE_OVER, this.mouseMove); - this._shapeBottom.addEventListener(MouseEvent.MOUSE_OVER, this.mouseMove); - this._shapeLeft.addEventListener(MouseEvent.MOUSE_OUT, this.out); - this._shapeTop.addEventListener(MouseEvent.MOUSE_OUT, this.out); - this._shapeRight.addEventListener(MouseEvent.MOUSE_OUT, this.out); - this._shapeBottom.addEventListener(MouseEvent.MOUSE_OUT, this.out); - this._shapeLeft.addEventListener(MouseEvent.MOUSE_MOVE, this.mouseMove); - this._shapeTop.addEventListener(MouseEvent.MOUSE_MOVE, this.mouseMove); - this._shapeRight.addEventListener(MouseEvent.MOUSE_MOVE, this.mouseMove); - this._shapeBottom.addEventListener(MouseEvent.MOUSE_MOVE, this.mouseMove); - this.setBorderInteraction(false); - this._lastCellId = -1; - } - - public function setBorderInteraction(enable:Boolean):void - { - this._enable = enable; - this._shapeTop.mouseEnabled = enable; - this._shapeRight.mouseEnabled = enable; - this._shapeBottom.mouseEnabled = enable; - this._shapeLeft.mouseEnabled = enable; - this.updateMap(); - } - - public function updateMap():void - { - this._lastCellId = -1; - if (this._enable) - { - this._shapeTop.mouseEnabled = !((this.findNearestCell(this._shapeTop).cell == -1)); - this._shapeRight.mouseEnabled = !((this.findNearestCell(this._shapeRight).cell == -1)); - this._shapeBottom.mouseEnabled = !((this.findNearestCell(this._shapeBottom).cell == -1)); - this._shapeLeft.mouseEnabled = !((this.findNearestCell(this._shapeLeft).cell == -1)); - }; - } - - public function getShape(direction:int):Sprite - { - switch (direction) - { - case DirectionsEnum.UP: - return (this._shapeTop); - case DirectionsEnum.LEFT: - return (this._shapeLeft); - case DirectionsEnum.RIGHT: - return (this._shapeRight); - case DirectionsEnum.DOWN: - return (this._shapeBottom); - }; - return (null); - } - - public function set frustum(rFrustum:Frustum):void - { - this._frustrum = rFrustum; - var pTopLeftInner:Point = new Point((rFrustum.x + (AtouinConstants.CELL_HALF_WIDTH * rFrustum.scale)), (rFrustum.y + (AtouinConstants.CELL_HALF_HEIGHT * rFrustum.scale))); - var pTopRightInner:Point = new Point(((rFrustum.x - (AtouinConstants.CELL_HALF_WIDTH * rFrustum.scale)) + rFrustum.width), (rFrustum.y + (AtouinConstants.CELL_HALF_HEIGHT * rFrustum.scale))); - var pBottomLeftInner:Point = new Point((rFrustum.x + (AtouinConstants.CELL_HALF_WIDTH * rFrustum.scale)), ((rFrustum.y - (AtouinConstants.CELL_HEIGHT * rFrustum.scale)) + rFrustum.height)); - var pBottomRightInner:Point = new Point(((rFrustum.x - (AtouinConstants.CELL_HALF_WIDTH * rFrustum.scale)) + rFrustum.width), ((rFrustum.y - (AtouinConstants.CELL_HEIGHT * rFrustum.scale)) + rFrustum.height)); - var pTopLeft:Point = new Point(rFrustum.x, rFrustum.y); - var pTopRight:Point = new Point((rFrustum.x + rFrustum.width), rFrustum.y); - var pBottomLeft:Point = new Point(rFrustum.x, ((rFrustum.y + rFrustum.height) - (AtouinConstants.CELL_HALF_HEIGHT * rFrustum.scale))); - var pBottomRight:Point = new Point((rFrustum.x + rFrustum.width), ((rFrustum.y + rFrustum.height) - (AtouinConstants.CELL_HALF_HEIGHT * rFrustum.scale))); - var alphaShape:Number = 1; - var commands:Vector. = new Vector.(7, true); - commands[0] = 1; - commands[1] = 2; - commands[2] = 2; - commands[3] = 2; - commands[4] = 2; - commands[5] = 2; - commands[6] = 2; - var leftCoords:Vector. = new Vector.(14, true); - leftCoords[0] = 0; - leftCoords[1] = pTopLeft.y; - leftCoords[2] = pTopLeft.x; - leftCoords[3] = pTopLeft.y; - leftCoords[4] = pTopLeftInner.x; - leftCoords[5] = pTopLeftInner.y; - leftCoords[6] = pBottomLeftInner.x; - leftCoords[7] = pBottomLeftInner.y; - leftCoords[8] = pBottomLeft.x; - leftCoords[9] = pBottomLeft.y; - leftCoords[10] = 0; - leftCoords[11] = pBottomLeft.y; - leftCoords[12] = 0; - leftCoords[13] = pTopLeft.y; - var bmpShape:Bitmap = this.drawShape(16746564, commands, leftCoords); - if (bmpShape != null) - { - this._shapeLeft.addChild(bmpShape); + import com.ankamagames.jerakine.logger.Logger; + import com.ankamagames.jerakine.logger.Log; + import flash.utils.getQualifiedClassName; + import flash.display.DisplayObjectContainer; + import com.ankamagames.atouin.types.FrustumShape; + import com.ankamagames.atouin.types.Frustum; + import com.ankamagames.jerakine.types.enums.DirectionsEnum; + import flash.events.MouseEvent; + import flash.display.Sprite; + import flash.geom.Point; + import com.ankamagames.atouin.AtouinConstants; + import flash.display.Bitmap; + import com.ankamagames.jerakine.utils.display.StageShareManager; + import flash.display.BitmapData; + import flash.display.Shape; + import com.ankamagames.atouin.data.map.Map; + import com.ankamagames.atouin.data.map.Cell; + import com.ankamagames.atouin.data.map.CellData; + import com.ankamagames.atouin.utils.CellIdConverter; + import com.ankamagames.atouin.messages.AdjacentMapClickMessage; + import com.ankamagames.atouin.Atouin; + import com.ankamagames.atouin.messages.CellClickMessage; + import com.ankamagames.atouin.messages.AdjacentMapOutMessage; + import flash.display.DisplayObject; + import com.ankamagames.atouin.messages.AdjacentMapOverMessage; + import com.ankamagames.jerakine.utils.errors.SingletonError; + + public class FrustumManager extends Object + { + + public function FrustumManager() + { + super(); + if(_self) + { + throw new SingletonError(); + } + else + { + return; + } + } + + protected static const _log:Logger = Log.getLogger(getQualifiedClassName(FrustumManager)); + + private static var _self:FrustumManager; + + public static function getInstance() : FrustumManager + { + if(!_self) + { + _self = new FrustumManager(); + } + return _self; + } + + private var _frustumContainer:DisplayObjectContainer; + + private var _shapeTop:FrustumShape; + + private var _shapeRight:FrustumShape; + + private var _shapeBottom:FrustumShape; + + private var _shapeLeft:FrustumShape; + + private var _frustrum:Frustum; + + private var _lastCellId:int; + + private var _enable:Boolean; + + public function init(param1:DisplayObjectContainer) : void + { + this._frustumContainer = param1; + this._shapeTop = new FrustumShape(DirectionsEnum.UP); + this._shapeRight = new FrustumShape(DirectionsEnum.RIGHT); + this._shapeBottom = new FrustumShape(DirectionsEnum.DOWN); + this._shapeLeft = new FrustumShape(DirectionsEnum.LEFT); + this._frustumContainer.addChild(this._shapeLeft); + this._frustumContainer.addChild(this._shapeTop); + this._frustumContainer.addChild(this._shapeRight); + this._frustumContainer.addChild(this._shapeBottom); + this._shapeLeft.buttonMode = true; + this._shapeTop.buttonMode = true; + this._shapeRight.buttonMode = true; + this._shapeBottom.buttonMode = true; + this._shapeLeft.addEventListener(MouseEvent.CLICK,this.click); + this._shapeTop.addEventListener(MouseEvent.CLICK,this.click); + this._shapeRight.addEventListener(MouseEvent.CLICK,this.click); + this._shapeBottom.addEventListener(MouseEvent.CLICK,this.click); + this._shapeLeft.addEventListener(MouseEvent.MOUSE_OVER,this.mouseMove); + this._shapeTop.addEventListener(MouseEvent.MOUSE_OVER,this.mouseMove); + this._shapeRight.addEventListener(MouseEvent.MOUSE_OVER,this.mouseMove); + this._shapeBottom.addEventListener(MouseEvent.MOUSE_OVER,this.mouseMove); + this._shapeLeft.addEventListener(MouseEvent.MOUSE_OUT,this.out); + this._shapeTop.addEventListener(MouseEvent.MOUSE_OUT,this.out); + this._shapeRight.addEventListener(MouseEvent.MOUSE_OUT,this.out); + this._shapeBottom.addEventListener(MouseEvent.MOUSE_OUT,this.out); + this._shapeLeft.addEventListener(MouseEvent.MOUSE_MOVE,this.mouseMove); + this._shapeTop.addEventListener(MouseEvent.MOUSE_MOVE,this.mouseMove); + this._shapeRight.addEventListener(MouseEvent.MOUSE_MOVE,this.mouseMove); + this._shapeBottom.addEventListener(MouseEvent.MOUSE_MOVE,this.mouseMove); + this.setBorderInteraction(false); + this._lastCellId = -1; + } + + public function setBorderInteraction(param1:Boolean) : void + { + this._enable = param1; + this._shapeTop.mouseEnabled = param1; + this._shapeRight.mouseEnabled = param1; + this._shapeBottom.mouseEnabled = param1; + this._shapeLeft.mouseEnabled = param1; + this.updateMap(); + } + + public function updateMap() : void + { + this._lastCellId = -1; + if(this._enable) + { + this._shapeTop.mouseEnabled = !(this.findNearestCell(this._shapeTop).cell == -1); + this._shapeRight.mouseEnabled = !(this.findNearestCell(this._shapeRight).cell == -1); + this._shapeBottom.mouseEnabled = !(this.findNearestCell(this._shapeBottom).cell == -1); + this._shapeLeft.mouseEnabled = !(this.findNearestCell(this._shapeLeft).cell == -1); + } + } + + public function getShape(param1:int) : Sprite + { + switch(param1) + { + case DirectionsEnum.UP: + return this._shapeTop; + case DirectionsEnum.LEFT: + return this._shapeLeft; + case DirectionsEnum.RIGHT: + return this._shapeRight; + case DirectionsEnum.DOWN: + return this._shapeBottom; + default: + return null; + } + } + + public function set frustum(param1:Frustum) : void + { + this._frustrum = param1; + var _loc2_:Point = new Point(param1.x + AtouinConstants.CELL_HALF_WIDTH * param1.scale,param1.y + AtouinConstants.CELL_HALF_HEIGHT * param1.scale); + var _loc3_:Point = new Point(param1.x - AtouinConstants.CELL_HALF_WIDTH * param1.scale + param1.width,param1.y + AtouinConstants.CELL_HALF_HEIGHT * param1.scale); + var _loc4_:Point = new Point(param1.x + AtouinConstants.CELL_HALF_WIDTH * param1.scale,param1.y - AtouinConstants.CELL_HEIGHT * param1.scale + param1.height); + var _loc5_:Point = new Point(param1.x - AtouinConstants.CELL_HALF_WIDTH * param1.scale + param1.width,param1.y - AtouinConstants.CELL_HEIGHT * param1.scale + param1.height); + var _loc6_:Point = new Point(param1.x,param1.y); + var _loc7_:Point = new Point(param1.x + param1.width,param1.y); + var _loc8_:Point = new Point(param1.x,param1.y + param1.height - AtouinConstants.CELL_HALF_HEIGHT * param1.scale); + var _loc9_:Point = new Point(param1.x + param1.width,param1.y + param1.height - AtouinConstants.CELL_HALF_HEIGHT * param1.scale); + var _loc10_:Number = 1; + var _loc11_:Vector. = new Vector.(7,true); + _loc11_[0] = 1; + _loc11_[1] = 2; + _loc11_[2] = 2; + _loc11_[3] = 2; + _loc11_[4] = 2; + _loc11_[5] = 2; + _loc11_[6] = 2; + var _loc12_:Vector. = new Vector.(14,true); + _loc12_[0] = 0; + _loc12_[1] = _loc6_.y; + _loc12_[2] = _loc6_.x; + _loc12_[3] = _loc6_.y; + _loc12_[4] = _loc2_.x; + _loc12_[5] = _loc2_.y; + _loc12_[6] = _loc4_.x; + _loc12_[7] = _loc4_.y; + _loc12_[8] = _loc8_.x; + _loc12_[9] = _loc8_.y; + _loc12_[10] = 0; + _loc12_[11] = _loc8_.y; + _loc12_[12] = 0; + _loc12_[13] = _loc6_.y; + var _loc13_:Bitmap = this.drawShape(16746564,_loc11_,_loc12_); + if(_loc13_ != null) + { + this._shapeLeft.addChild(_loc13_); + } + var _loc14_:Vector. = new Vector.(14,true); + _loc14_[0] = _loc6_.x; + _loc14_[1] = 0; + _loc14_[2] = _loc6_.x; + _loc14_[3] = _loc6_.y; + _loc14_[4] = _loc2_.x; + _loc14_[5] = _loc2_.y; + _loc14_[6] = _loc3_.x; + _loc14_[7] = _loc3_.y; + _loc14_[8] = _loc7_.x; + _loc14_[9] = _loc7_.y; + _loc14_[10] = _loc7_.x; + _loc14_[11] = 0; + _loc14_[12] = 0; + _loc14_[13] = 0; + _loc13_ = this.drawShape(7803289,_loc11_,_loc14_); + if(_loc13_ != null) + { + this._shapeTop.addChild(_loc13_); + } + var _loc15_:Vector. = new Vector.(14,true); + _loc15_[0] = StageShareManager.startWidth; + _loc15_[1] = _loc7_.y; + _loc15_[2] = _loc7_.x; + _loc15_[3] = _loc7_.y; + _loc15_[4] = _loc3_.x; + _loc15_[5] = _loc3_.y; + _loc15_[6] = _loc5_.x; + _loc15_[7] = _loc5_.y; + _loc15_[8] = _loc9_.x; + _loc15_[9] = _loc9_.y; + _loc15_[10] = StageShareManager.startWidth; + _loc15_[11] = _loc9_.y; + _loc15_[12] = StageShareManager.startWidth; + _loc15_[13] = _loc7_.y; + _loc13_ = this.drawShape(1218969,_loc11_,_loc15_); + if(_loc13_ != null) + { + _loc13_.x = StageShareManager.startWidth - _loc13_.width; + _loc13_.y = 15; + this._shapeRight.addChild(_loc13_); + } + var _loc16_:Vector. = new Vector.(14,true); + _loc16_[0] = _loc9_.x; + _loc16_[1] = StageShareManager.startHeight; + _loc16_[2] = _loc9_.x; + _loc16_[3] = _loc9_.y; + _loc16_[4] = _loc5_.x; + _loc16_[5] = _loc5_.y + 10; + _loc16_[6] = _loc4_.x; + _loc16_[7] = _loc4_.y + 10; + _loc16_[8] = _loc8_.x; + _loc16_[9] = _loc8_.y; + _loc16_[10] = _loc8_.x; + _loc16_[11] = StageShareManager.startHeight; + _loc16_[12] = _loc9_.x; + _loc16_[13] = StageShareManager.startHeight; + _loc13_ = this.drawShape(7807590,_loc11_,_loc16_); + if(_loc13_ != null) + { + _loc13_.y = StageShareManager.startHeight - _loc13_.height; + this._shapeBottom.addChild(_loc13_); + } + } + + private function drawShape(param1:uint, param2:Vector., param3:Vector.) : Bitmap + { + var _loc5_:BitmapData = null; + var _loc4_:Shape = new Shape(); + _loc4_.graphics.beginFill(param1,0); + _loc4_.graphics.drawPath(param2,param3); + _loc4_.graphics.endFill(); + if(_loc4_.width > 0 && _loc4_.height > 0) + { + _loc5_ = new BitmapData(_loc4_.width,_loc4_.height,true,16777215); + _loc5_.draw(_loc4_); + _loc4_.graphics.clear(); + _loc4_ = null; + return new Bitmap(_loc5_); + } + return null; + } + + private function click(param1:MouseEvent) : void + { + var _loc2_:uint = 0; + var _loc3_:Map = MapDisplayManager.getInstance().getDataMapContainer().dataMap; + switch(param1.target) + { + case this._shapeRight: + _loc2_ = _loc3_.rightNeighbourId; + break; + case this._shapeLeft: + _loc2_ = _loc3_.leftNeighbourId; + break; + case this._shapeBottom: + _loc2_ = _loc3_.bottomNeighbourId; + break; + case this._shapeTop: + _loc2_ = _loc3_.topNeighbourId; + break; + } + var _loc4_:Point = new Point(isNaN(param1.localX)?Sprite(param1.target).mouseX:param1.localX,isNaN(param1.localY)?Sprite(param1.target).mouseY:param1.localY); + var _loc5_:Object = this.findNearestCell(param1.target as Sprite,_loc4_); + if(_loc5_.cell == -1) + { + return; + } + if(!_loc5_.custom) + { + this.sendClickAdjacentMsg(_loc2_,_loc5_.cell); + } + else + { + this.sendCellClickMsg(_loc2_,_loc5_.cell); + } + } + + private function findCustomNearestCell(param1:Sprite, param2:Point = null) : Object + { + var _loc6_:Array = null; + var _loc7_:Point = null; + var _loc8_:* = NaN; + var _loc9_:* = 0; + var _loc10_:uint = 0; + var _loc11_:uint = 0; + var _loc3_:Map = MapDisplayManager.getInstance().getDataMapContainer().dataMap; + var _loc4_:uint = 0; + var _loc5_:uint = 0; + if(!param2) + { + var param2:Point = new Point(param1.mouseX,param1.mouseY); + } + switch(param1) + { + case this._shapeRight: + _loc5_ = 1; + _loc6_ = _loc3_.rightArrowCell; + break; + case this._shapeLeft: + _loc5_ = 1; + _loc6_ = _loc3_.leftArrowCell; + break; + case this._shapeBottom: + _loc4_ = 1; + _loc6_ = _loc3_.bottomArrowCell; + break; + case this._shapeTop: + _loc4_ = 1; + _loc6_ = _loc3_.topArrowCell; + break; + } + if(!_loc6_ || !_loc6_.length) + { + return { + "cell":-1, + "distance":Number.MAX_VALUE }; - var topCoords:Vector. = new Vector.(14, true); - topCoords[0] = pTopLeft.x; - topCoords[1] = 0; - topCoords[2] = pTopLeft.x; - topCoords[3] = pTopLeft.y; - topCoords[4] = pTopLeftInner.x; - topCoords[5] = pTopLeftInner.y; - topCoords[6] = pTopRightInner.x; - topCoords[7] = pTopRightInner.y; - topCoords[8] = pTopRight.x; - topCoords[9] = pTopRight.y; - topCoords[10] = pTopRight.x; - topCoords[11] = 0; - topCoords[12] = 0; - topCoords[13] = 0; - bmpShape = this.drawShape(7803289, commands, topCoords); - if (bmpShape != null) + } + var _loc12_:Number = Number.MAX_VALUE; + var _loc13_:uint = 0; + while(_loc13_ < _loc6_.length) + { + _loc10_ = _loc6_[_loc13_]; + _loc7_ = Cell.cellPixelCoords(_loc10_); + _loc9_ = CellData(_loc3_.cells[_loc10_]).floor; + if(_loc5_ == 1) { - this._shapeTop.addChild(bmpShape); - }; - var rightCoords:Vector. = new Vector.(14, true); - rightCoords[0] = StageShareManager.startWidth; - rightCoords[1] = pTopRight.y; - rightCoords[2] = pTopRight.x; - rightCoords[3] = pTopRight.y; - rightCoords[4] = pTopRightInner.x; - rightCoords[5] = pTopRightInner.y; - rightCoords[6] = pBottomRightInner.x; - rightCoords[7] = pBottomRightInner.y; - rightCoords[8] = pBottomRight.x; - rightCoords[9] = pBottomRight.y; - rightCoords[10] = StageShareManager.startWidth; - rightCoords[11] = pBottomRight.y; - rightCoords[12] = StageShareManager.startWidth; - rightCoords[13] = pTopRight.y; - bmpShape = this.drawShape(1218969, commands, rightCoords); - if (bmpShape != null) - { - bmpShape.x = (StageShareManager.startWidth - bmpShape.width); - bmpShape.y = 15; - this._shapeRight.addChild(bmpShape); - }; - var bottomCoords:Vector. = new Vector.(14, true); - bottomCoords[0] = pBottomRight.x; - bottomCoords[1] = StageShareManager.startHeight; - bottomCoords[2] = pBottomRight.x; - bottomCoords[3] = pBottomRight.y; - bottomCoords[4] = pBottomRightInner.x; - bottomCoords[5] = (pBottomRightInner.y + 10); - bottomCoords[6] = pBottomLeftInner.x; - bottomCoords[7] = (pBottomLeftInner.y + 10); - bottomCoords[8] = pBottomLeft.x; - bottomCoords[9] = pBottomLeft.y; - bottomCoords[10] = pBottomLeft.x; - bottomCoords[11] = StageShareManager.startHeight; - bottomCoords[12] = pBottomRight.x; - bottomCoords[13] = StageShareManager.startHeight; - bmpShape = this.drawShape(7807590, commands, bottomCoords); - if (bmpShape != null) - { - bmpShape.y = (StageShareManager.startHeight - bmpShape.height); - this._shapeBottom.addChild(bmpShape); - }; - } - - private function drawShape(pColor:uint, pCommands:Vector., pCoords:Vector.):Bitmap - { - var sBmp:BitmapData; - var sShape:Shape = new Shape(); - sShape.graphics.beginFill(pColor, 0); - sShape.graphics.drawPath(pCommands, pCoords); - sShape.graphics.endFill(); - if ((((sShape.width > 0)) && ((sShape.height > 0)))) - { - sBmp = new BitmapData(sShape.width, sShape.height, true, 0xFFFFFF); - sBmp.draw(sShape); - sShape.graphics.clear(); - sShape = null; - return (new Bitmap(sBmp)); - }; - return (null); - } - - private function click(e:MouseEvent):void - { - var destMapId:uint; - var currentMap:Map = MapDisplayManager.getInstance().getDataMapContainer().dataMap; - switch (e.target) - { - case this._shapeRight: - destMapId = currentMap.rightNeighbourId; - break; - case this._shapeLeft: - destMapId = currentMap.leftNeighbourId; - break; - case this._shapeBottom: - destMapId = currentMap.bottomNeighbourId; - break; - case this._shapeTop: - destMapId = currentMap.topNeighbourId; - break; - }; - var localMousePosition:Point = new Point(((isNaN(e.localX)) ? Sprite(e.target).mouseX : e.localX), ((isNaN(e.localY)) ? Sprite(e.target).mouseY : e.localY)); - var cellData:Object = this.findNearestCell((e.target as Sprite), localMousePosition); - if (cellData.cell == -1) - { - return; - }; - if (!(cellData.custom)) - { - this.sendClickAdjacentMsg(destMapId, cellData.cell); + _loc8_ = Math.abs(param2.x - this._frustrum.y - (_loc7_.y - _loc9_ + AtouinConstants.CELL_HALF_HEIGHT) * this._frustrum.scale); } - else - { - this.sendCellClickMsg(destMapId, cellData.cell); - }; - } - - private function findCustomNearestCell(target:Sprite, localMousePosition:Point=null):Object - { - var cellList:Array; - var p:Point; - var d:Number; - var floor:int; - var cellId:uint; - var currentCellId:uint; - var currentMap:Map = MapDisplayManager.getInstance().getDataMapContainer().dataMap; - var x:uint; - var y:uint; - if (!(localMousePosition)) + if(_loc4_ == 1) { - localMousePosition = new Point(target.mouseX, target.mouseY); - }; - switch (target) - { - case this._shapeRight: - y = 1; - cellList = currentMap.rightArrowCell; - break; - case this._shapeLeft: - y = 1; - cellList = currentMap.leftArrowCell; - break; - case this._shapeBottom: - x = 1; - cellList = currentMap.bottomArrowCell; - break; - case this._shapeTop: - x = 1; - cellList = currentMap.topArrowCell; - break; - }; - if (((!(cellList)) || (!(cellList.length)))) - { - return ({ - "cell":-1, - "distance":Number.MAX_VALUE - }); - }; - var currentDist:Number = Number.MAX_VALUE; - var i:uint; - while (i < cellList.length) - { - cellId = cellList[i]; - p = Cell.cellPixelCoords(cellId); - floor = CellData(currentMap.cells[cellId]).floor; - if (y == 1) - { - d = Math.abs(((localMousePosition.x - this._frustrum.y) - (((p.y - floor) + AtouinConstants.CELL_HALF_HEIGHT) * this._frustrum.scale))); - }; - if (x == 1) - { - d = Math.abs(((localMousePosition.x - this._frustrum.x) - ((p.x + AtouinConstants.CELL_HALF_WIDTH) * this._frustrum.scale))); - }; - if (d < currentDist) - { - currentDist = d; - currentCellId = cellId; - }; - i++; - }; - return ({ - "cell":currentCellId, - "distance":currentDist - }); - } - - private function findNearestCell(target:Sprite, localMousePosition:Point=null):Object - { - var x:int; - var y:int; - var sx:int; - var sy:int; - var p:Point; - var floor:int; - var d:Number; - var destMapId:uint; - var i:uint; - var limit:uint; - var cellId:int; - var cellData:CellData; - var mapChangeData:uint; - var currentMap:Map = MapDisplayManager.getInstance().getDataMapContainer().dataMap; - var near:Number = Number.MAX_VALUE; - if (!(localMousePosition)) - { - localMousePosition = new Point(target.mouseX, target.mouseY); - }; - switch (target) - { - case this._shapeRight: - x = (AtouinConstants.MAP_WIDTH - 1); - y = (AtouinConstants.MAP_WIDTH - 1); - destMapId = currentMap.rightNeighbourId; - break; - case this._shapeLeft: - x = 0; - y = 0; - destMapId = currentMap.leftNeighbourId; - break; - case this._shapeBottom: - x = (AtouinConstants.MAP_HEIGHT - 1); - y = -((AtouinConstants.MAP_HEIGHT - 1)); - destMapId = currentMap.bottomNeighbourId; - break; - case this._shapeTop: - x = 0; - y = 0; - destMapId = currentMap.topNeighbourId; - break; - }; - var customData:Object = this.findCustomNearestCell(target); - if (customData.cell != -1) - { - near = customData.distance; - sx = CellIdConverter.cellIdToCoord(customData.cell).x; - sy = CellIdConverter.cellIdToCoord(customData.cell).y; - }; - if ((((target == this._shapeRight)) || ((target == this._shapeLeft)))) - { - limit = (AtouinConstants.MAP_HEIGHT * 2); - i = 0; - while (i < limit) - { - cellId = CellIdConverter.coordToCellId(x, y); - p = Cell.cellPixelCoords(cellId); - floor = CellData(currentMap.cells[cellId]).floor; - d = Math.abs(((localMousePosition.y - this._frustrum.y) - (((p.y - floor) + AtouinConstants.CELL_HALF_HEIGHT) * this._frustrum.scale))); - if (d < near) - { - cellData = (currentMap.cells[cellId] as CellData); - mapChangeData = cellData.mapChangeData; - if (((mapChangeData) && ((((((target == this._shapeRight)) && ((((((mapChangeData & 1)) || ((((((cellId + 1) % (AtouinConstants.MAP_WIDTH * 2)) == 0)) && ((mapChangeData & 2)))))) || ((((((cellId + 1) % (AtouinConstants.MAP_WIDTH * 2)) == 0)) && ((mapChangeData & 128)))))))) || ((((target == this._shapeLeft)) && ((((((((x == -(y))) && ((mapChangeData & 8)))) || ((mapChangeData & 16)))) || ((((x == -(y))) && ((mapChangeData & 32)))))))))))) - { - sx = x; - sy = y; - near = d; - }; - }; - if (!((i % 2))) - { - x++; - } - else - { - y--; - }; - i++; - }; + _loc8_ = Math.abs(param2.x - this._frustrum.x - (_loc7_.x + AtouinConstants.CELL_HALF_WIDTH) * this._frustrum.scale); } - else - { - i = 0; - while (i < (AtouinConstants.MAP_WIDTH * 2)) - { - cellId = CellIdConverter.coordToCellId(x, y); - p = Cell.cellPixelCoords(cellId); - d = Math.abs(((localMousePosition.x - this._frustrum.x) - ((p.x + AtouinConstants.CELL_HALF_WIDTH) * this._frustrum.scale))); - if (d < near) - { - cellData = (currentMap.cells[cellId] as CellData); - mapChangeData = cellData.mapChangeData; - if (((mapChangeData) && ((((((target == this._shapeTop)) && ((((((((cellId < AtouinConstants.MAP_WIDTH)) && ((mapChangeData & 32)))) || ((mapChangeData & 64)))) || ((((cellId < AtouinConstants.MAP_WIDTH)) && ((mapChangeData & 128)))))))) || ((((target == this._shapeBottom)) && ((((((((cellId >= (AtouinConstants.MAP_CELLS_COUNT - AtouinConstants.MAP_WIDTH))) && ((mapChangeData & 2)))) || ((mapChangeData & 4)))) || ((((cellId >= (AtouinConstants.MAP_CELLS_COUNT - AtouinConstants.MAP_WIDTH))) && ((mapChangeData & 8)))))))))))) - { - sx = x; - sy = y; - near = d; - }; - }; - if (!((i % 2))) - { - x++; - } - else - { - y++; - }; - i++; - }; - }; - if (near != Number.MAX_VALUE) - { - return ({ - "cell":CellIdConverter.coordToCellId(sx, sy), - "custom":(near == customData.distance) - }); - }; - return ({ - "cell":-1, - "custom":false - }); - } - - private function sendClickAdjacentMsg(mapId:uint, cellId:uint):void - { - var msg:AdjacentMapClickMessage = new AdjacentMapClickMessage(); - msg.cellId = cellId; - msg.adjacentMapId = mapId; - Atouin.getInstance().handler.process(msg); - } - - private function sendCellClickMsg(mapId:uint, cellId:uint):void - { - var msg:CellClickMessage = new CellClickMessage(); - msg.cellId = cellId; - msg.id = mapId; - Atouin.getInstance().handler.process(msg); - } - - private function out(e:MouseEvent):void - { - var n:uint; - switch (e.target) + if(_loc8_ < _loc12_) { - case this._shapeRight: - n = DirectionsEnum.RIGHT; - break; - case this._shapeLeft: - n = DirectionsEnum.LEFT; - break; - case this._shapeBottom: - n = DirectionsEnum.DOWN; - break; - case this._shapeTop: - n = DirectionsEnum.UP; - break; - }; - this._lastCellId = -1; - var msg:AdjacentMapOutMessage = new AdjacentMapOutMessage(n, DisplayObject(e.target)); - Atouin.getInstance().handler.process(msg); - } - - private function mouseMove(e:MouseEvent):void - { - var n:uint; - switch (e.target) + _loc12_ = _loc8_; + _loc11_ = _loc10_; + } + _loc13_++; + } + return { + "cell":_loc11_, + "distance":_loc12_ + }; + } + + private function findNearestCell(param1:Sprite, param2:Point = null) : Object + { + var _loc3_:* = 0; + var _loc4_:* = 0; + var _loc5_:* = 0; + var _loc6_:* = 0; + var _loc7_:Point = null; + var _loc8_:* = 0; + var _loc9_:* = NaN; + var _loc10_:uint = 0; + var _loc11_:uint = 0; + var _loc12_:uint = 0; + var _loc14_:* = 0; + var _loc16_:CellData = null; + var _loc17_:uint = 0; + var _loc13_:Map = MapDisplayManager.getInstance().getDataMapContainer().dataMap; + var _loc15_:Number = Number.MAX_VALUE; + if(!param2) + { + var param2:Point = new Point(param1.mouseX,param1.mouseY); + } + switch(param1) + { + case this._shapeRight: + _loc3_ = AtouinConstants.MAP_WIDTH - 1; + _loc4_ = AtouinConstants.MAP_WIDTH - 1; + _loc10_ = _loc13_.rightNeighbourId; + break; + case this._shapeLeft: + _loc3_ = 0; + _loc4_ = 0; + _loc10_ = _loc13_.leftNeighbourId; + break; + case this._shapeBottom: + _loc3_ = AtouinConstants.MAP_HEIGHT - 1; + _loc4_ = -(AtouinConstants.MAP_HEIGHT - 1); + _loc10_ = _loc13_.bottomNeighbourId; + break; + case this._shapeTop: + _loc3_ = 0; + _loc4_ = 0; + _loc10_ = _loc13_.topNeighbourId; + break; + } + var _loc18_:Object = this.findCustomNearestCell(param1); + if(_loc18_.cell != -1) + { + _loc15_ = _loc18_.distance; + _loc5_ = CellIdConverter.cellIdToCoord(_loc18_.cell).x; + _loc6_ = CellIdConverter.cellIdToCoord(_loc18_.cell).y; + } + if(param1 == this._shapeRight || param1 == this._shapeLeft) + { + _loc12_ = AtouinConstants.MAP_HEIGHT * 2; + _loc11_ = 0; + while(_loc11_ < _loc12_) { - case this._shapeRight: - n = DirectionsEnum.RIGHT; - break; - case this._shapeLeft: - n = DirectionsEnum.LEFT; - break; - case this._shapeBottom: - n = DirectionsEnum.DOWN; - break; - case this._shapeTop: - n = DirectionsEnum.UP; - break; - }; - var cellId:int = this.findNearestCell((e.target as Sprite)).cell; - if ((((cellId == -1)) || ((cellId == this._lastCellId)))) + _loc14_ = CellIdConverter.coordToCellId(_loc3_,_loc4_); + _loc7_ = Cell.cellPixelCoords(_loc14_); + _loc8_ = CellData(_loc13_.cells[_loc14_]).floor; + _loc9_ = Math.abs(param2.y - this._frustrum.y - (_loc7_.y - _loc8_ + AtouinConstants.CELL_HALF_HEIGHT) * this._frustrum.scale); + if(_loc9_ < _loc15_) + { + _loc16_ = _loc13_.cells[_loc14_] as CellData; + _loc17_ = _loc16_.mapChangeData; + if((_loc17_) && ((param1 == this._shapeRight) && (_loc17_ & 1 || (_loc14_ + 1) % (AtouinConstants.MAP_WIDTH * 2) == 0 && _loc17_ & 2 || (_loc14_ + 1) % (AtouinConstants.MAP_WIDTH * 2) == 0 && _loc17_ & 128) || (param1 == this._shapeLeft) && (_loc3_ == -_loc4_ && _loc17_ & 8 || _loc17_ & 16 || _loc3_ == -_loc4_ && _loc17_ & 32))) + { + _loc5_ = _loc3_; + _loc6_ = _loc4_; + _loc15_ = _loc9_; + } + } + if(!(_loc11_ % 2)) + { + _loc3_++; + } + else + { + _loc4_--; + } + _loc11_++; + } + } + else + { + _loc11_ = 0; + while(_loc11_ < AtouinConstants.MAP_WIDTH * 2) { - return; + _loc14_ = CellIdConverter.coordToCellId(_loc3_,_loc4_); + _loc7_ = Cell.cellPixelCoords(_loc14_); + _loc9_ = Math.abs(param2.x - this._frustrum.x - (_loc7_.x + AtouinConstants.CELL_HALF_WIDTH) * this._frustrum.scale); + if(_loc9_ < _loc15_) + { + _loc16_ = _loc13_.cells[_loc14_] as CellData; + _loc17_ = _loc16_.mapChangeData; + if((_loc17_) && ((param1 == this._shapeTop) && (_loc14_ < AtouinConstants.MAP_WIDTH && _loc17_ & 32 || _loc17_ & 64 || _loc14_ < AtouinConstants.MAP_WIDTH && _loc17_ & 128) || (param1 == this._shapeBottom) && (_loc14_ >= AtouinConstants.MAP_CELLS_COUNT - AtouinConstants.MAP_WIDTH && _loc17_ & 2 || _loc17_ & 4 || _loc14_ >= AtouinConstants.MAP_CELLS_COUNT - AtouinConstants.MAP_WIDTH && _loc17_ & 8))) + { + _loc5_ = _loc3_; + _loc6_ = _loc4_; + _loc15_ = _loc9_; + } + } + if(!(_loc11_ % 2)) + { + _loc3_++; + } + else + { + _loc4_++; + } + _loc11_++; + } + } + if(_loc15_ != Number.MAX_VALUE) + { + return { + "cell":CellIdConverter.coordToCellId(_loc5_,_loc6_), + "custom":_loc15_ == _loc18_.distance }; - this._lastCellId = cellId; - var cellData:CellData = (MapDisplayManager.getInstance().getDataMapContainer().dataMap.cells[cellId] as CellData); - var msg:AdjacentMapOverMessage = new AdjacentMapOverMessage(n, DisplayObject(e.target), cellId, cellData); - Atouin.getInstance().handler.process(msg); - } - - - } -}//package com.ankamagames.atouin.managers - + } + return { + "cell":-1, + "custom":false + }; + } + + private function sendClickAdjacentMsg(param1:uint, param2:uint) : void + { + var _loc3_:AdjacentMapClickMessage = new AdjacentMapClickMessage(); + _loc3_.cellId = param2; + _loc3_.adjacentMapId = param1; + Atouin.getInstance().handler.process(_loc3_); + } + + private function sendCellClickMsg(param1:uint, param2:uint) : void + { + var _loc3_:CellClickMessage = new CellClickMessage(); + _loc3_.cellId = param2; + _loc3_.id = param1; + Atouin.getInstance().handler.process(_loc3_); + } + + private function out(param1:MouseEvent) : void + { + var _loc2_:uint = 0; + switch(param1.target) + { + case this._shapeRight: + _loc2_ = DirectionsEnum.RIGHT; + break; + case this._shapeLeft: + _loc2_ = DirectionsEnum.LEFT; + break; + case this._shapeBottom: + _loc2_ = DirectionsEnum.DOWN; + break; + case this._shapeTop: + _loc2_ = DirectionsEnum.UP; + break; + } + this._lastCellId = -1; + var _loc3_:AdjacentMapOutMessage = new AdjacentMapOutMessage(_loc2_,DisplayObject(param1.target)); + Atouin.getInstance().handler.process(_loc3_); + } + + private function mouseMove(param1:MouseEvent) : void + { + var _loc2_:uint = 0; + switch(param1.target) + { + case this._shapeRight: + _loc2_ = DirectionsEnum.RIGHT; + break; + case this._shapeLeft: + _loc2_ = DirectionsEnum.LEFT; + break; + case this._shapeBottom: + _loc2_ = DirectionsEnum.DOWN; + break; + case this._shapeTop: + _loc2_ = DirectionsEnum.UP; + break; + } + var _loc3_:int = this.findNearestCell(param1.target as Sprite).cell; + if(_loc3_ == -1 || _loc3_ == this._lastCellId) + { + return; + } + this._lastCellId = _loc3_; + var _loc4_:CellData = MapDisplayManager.getInstance().getDataMapContainer().dataMap.cells[_loc3_] as CellData; + var _loc5_:AdjacentMapOverMessage = new AdjacentMapOverMessage(_loc2_,DisplayObject(param1.target),_loc3_,_loc4_); + Atouin.getInstance().handler.process(_loc5_); + } + } +} diff --git a/com/ankamagames/atouin/managers/InteractiveCellManager.as b/com/ankamagames/atouin/managers/InteractiveCellManager.as index e0f2609ec..bb085ec8d 100644 --- a/com/ankamagames/atouin/managers/InteractiveCellManager.as +++ b/com/ankamagames/atouin/managers/InteractiveCellManager.as @@ -1,422 +1,424 @@ -package com.ankamagames.atouin.managers +package com.ankamagames.atouin.managers { - import com.ankamagames.jerakine.logger.Logger; - import com.ankamagames.jerakine.logger.Log; - import flash.utils.getQualifiedClassName; - import com.ankamagames.atouin.renderers.TrapZoneRenderer; - import com.ankamagames.atouin.Atouin; - import com.ankamagames.jerakine.utils.errors.SingletonError; - import com.ankamagames.jerakine.types.events.PropertyChangeEvent; - import com.ankamagames.atouin.types.GraphicCell; - import flash.events.MouseEvent; - import com.ankamagames.atouin.types.CellReference; - import flash.display.DisplayObject; - import com.ankamagames.atouin.data.map.Layer; - import com.ankamagames.atouin.types.LayerContainer; - import com.ankamagames.atouin.types.CellContainer; - import com.ankamagames.atouin.types.DataMapContainer; - import com.ankamagames.atouin.utils.DataMapProvider; - import com.ankamagames.atouin.AtouinConstants; - import com.ankamagames.jerakine.entities.interfaces.IEntity; - import com.ankamagames.atouin.messages.CellClickMessage; - import flash.display.Sprite; - import com.ankamagames.atouin.utils.CellIdConverter; - import flash.geom.Point; - import com.ankamagames.jerakine.entities.interfaces.IMovable; - import com.ankamagames.jerakine.types.positions.MapPoint; - import com.ankamagames.atouin.data.map.CellData; - import com.ankamagames.atouin.types.Selection; - import com.ankamagames.atouin.types.DebugToolTip; - import com.ankamagames.jerakine.types.Color; - import com.ankamagames.atouin.renderers.ZoneDARenderer; - import com.ankamagames.jerakine.types.zones.Lozenge; - import com.ankamagames.jerakine.utils.display.StageShareManager; - import com.ankamagames.atouin.messages.CellOverMessage; - import com.ankamagames.atouin.messages.CellOutMessage; - - public class InteractiveCellManager - { - - protected static const _log:Logger = Log.getLogger(getQualifiedClassName(InteractiveCellManager)); - private static var _self:InteractiveCellManager; - - private var _cellOverEnabled:Boolean = false; - private var _aCells:Array; - private var _aCellPool:Array; - private var _bShowGrid:Boolean; - private var _interaction_click:Boolean; - private var _interaction_out:Boolean; - private var _trapZoneRenderer:TrapZoneRenderer; - - public function InteractiveCellManager() - { - this._aCellPool = new Array(); - this._bShowGrid = Atouin.getInstance().options.alwaysShowGrid; - super(); - if (_self) - { - throw (new SingletonError()); - }; + import com.ankamagames.jerakine.logger.Logger; + import com.ankamagames.jerakine.logger.Log; + import flash.utils.getQualifiedClassName; + import com.ankamagames.atouin.renderers.TrapZoneRenderer; + import com.ankamagames.atouin.Atouin; + import com.ankamagames.jerakine.types.events.PropertyChangeEvent; + import com.ankamagames.atouin.types.GraphicCell; + import flash.events.MouseEvent; + import com.ankamagames.atouin.types.DataMapContainer; + import com.ankamagames.atouin.types.CellReference; + import flash.display.DisplayObject; + import com.ankamagames.atouin.data.map.Layer; + import com.ankamagames.atouin.types.LayerContainer; + import com.ankamagames.atouin.types.CellContainer; + import com.ankamagames.atouin.utils.DataMapProvider; + import com.ankamagames.atouin.AtouinConstants; + import com.ankamagames.jerakine.entities.interfaces.IEntity; + import com.ankamagames.atouin.messages.CellClickMessage; + import flash.display.Sprite; + import com.ankamagames.atouin.utils.CellIdConverter; + import flash.geom.Point; + import com.ankamagames.jerakine.entities.interfaces.IMovable; + import com.ankamagames.jerakine.types.positions.MapPoint; + import com.ankamagames.atouin.data.map.CellData; + import com.ankamagames.atouin.types.Selection; + import com.ankamagames.atouin.types.DebugToolTip; + import com.ankamagames.jerakine.types.Color; + import com.ankamagames.atouin.renderers.ZoneDARenderer; + import com.ankamagames.jerakine.types.zones.Lozenge; + import com.ankamagames.jerakine.utils.display.StageShareManager; + import com.ankamagames.atouin.messages.CellOverMessage; + import com.ankamagames.atouin.messages.CellOutMessage; + import com.ankamagames.jerakine.utils.errors.SingletonError; + + public class InteractiveCellManager extends Object + { + + public function InteractiveCellManager() + { + this._aCellPool = new Array(); + this._bShowGrid = Atouin.getInstance().options.alwaysShowGrid; + super(); + if(_self) + { + throw new SingletonError(); + } + else + { this.init(); - } - - public static function getInstance():InteractiveCellManager - { - if (!(_self)) - { - _self = new (InteractiveCellManager)(); - }; - return (_self); - } - - - public function get cellOverEnabled():Boolean - { - return (this._cellOverEnabled); - } - - public function set cellOverEnabled(value:Boolean):void - { - this.overStateChanged(this._cellOverEnabled, value); - this._cellOverEnabled = value; - } - - public function get cellOutEnabled():Boolean - { - return (this._interaction_out); - } - - public function get cellClickEnabled():Boolean - { - return (this._interaction_click); - } - - public function initManager():void - { - this._aCells = new Array(); - Atouin.getInstance().options.addEventListener(PropertyChangeEvent.PROPERTY_CHANGED, this.onPropertyChanged); - } - - public function setInteraction(click:Boolean=true, over:Boolean=false, out:Boolean=false):void - { - var cell:GraphicCell; - this._interaction_click = click; - this._cellOverEnabled = over; - this._interaction_out = out; - for each (cell in this._aCells) - { - if (click) - { - cell.addEventListener(MouseEvent.CLICK, this.mouseClick); - } - else - { - cell.removeEventListener(MouseEvent.CLICK, this.mouseClick); - }; - if (over) - { - cell.addEventListener(MouseEvent.MOUSE_OVER, this.mouseOver); - } - else - { - cell.removeEventListener(MouseEvent.MOUSE_OVER, this.mouseOver); - }; - if (out) - { - cell.addEventListener(MouseEvent.MOUSE_OUT, this.mouseOut); - } - else - { - cell.removeEventListener(MouseEvent.MOUSE_OUT, this.mouseOut); - }; - cell.mouseEnabled = ((((click) || (over))) || (out)); - }; - } - - public function getCell(cellId:uint):GraphicCell - { - this._aCells[cellId] = this._aCellPool[cellId]; - return (this._aCells[cellId]); - } - - public function updateInteractiveCell(container:DataMapContainer):void - { - var cellRef:CellReference; - var gCell:GraphicCell; - var lastZCell:DisplayObject; - if (!(container)) - { - _log.error("Can't update interactive cell of a NULL container"); - return; - }; - this.setInteraction(true, Atouin.getInstance().options.showCellIdOnOver, Atouin.getInstance().options.showCellIdOnOver); - var aCell:Array = container.getCell(); - var showTransitions:Boolean = Atouin.getInstance().options.showTransitions; - var alpha:Number = ((((this._bShowGrid) || (Atouin.getInstance().options.alwaysShowGrid))) ? 1 : 0); - var layer:LayerContainer = container.getLayer(Layer.LAYER_DECOR); - var cellIndex:uint; - var cellIndexMax:uint = this._aCells.length; - var ind:uint; - var currentCell:GraphicCell = this._aCells[0]; - if (!(currentCell)) - { - while (((!(currentCell)) && ((cellIndex < cellIndexMax)))) - { - currentCell = this._aCells[cellIndex++]; - }; - cellIndex--; - }; - while ((((ind < layer.numChildren)) && ((cellIndex < cellIndexMax)))) - { - if (((!((currentCell == null))) && ((currentCell.cellId <= CellContainer(layer.getChildAt(ind)).cellId)))) - { - cellRef = aCell[cellIndex]; - gCell = this._aCells[cellIndex]; - gCell.y = cellRef.elevation; - gCell.visible = ((cellRef.mov) && (!(cellRef.isDisabled))); - gCell.alpha = alpha; - layer.addChildAt(gCell, ind); - currentCell = this._aCells[++cellIndex]; - }; - ind++; - }; - } - - public function updateCell(cellId:uint, enabled:Boolean):Boolean - { - DataMapProvider.getInstance().updateCellMovLov(cellId, enabled); - if (this._aCells[cellId] != null) + return; + } + } + + protected static const _log:Logger = Log.getLogger(getQualifiedClassName(InteractiveCellManager)); + + private static var _self:InteractiveCellManager; + + public static function getInstance() : InteractiveCellManager + { + if(!_self) + { + _self = new InteractiveCellManager(); + } + return _self; + } + + private var _cellOverEnabled:Boolean = false; + + private var _aCells:Array; + + private var _aCellPool:Array; + + private var _bShowGrid:Boolean; + + private var _interaction_click:Boolean; + + private var _interaction_out:Boolean; + + private var _trapZoneRenderer:TrapZoneRenderer; + + public function get cellOverEnabled() : Boolean + { + return this._cellOverEnabled; + } + + public function set cellOverEnabled(param1:Boolean) : void + { + this.overStateChanged(this._cellOverEnabled,param1); + this._cellOverEnabled = param1; + } + + public function get cellOutEnabled() : Boolean + { + return this._interaction_out; + } + + public function get cellClickEnabled() : Boolean + { + return this._interaction_click; + } + + public function initManager() : void + { + this._aCells = new Array(); + Atouin.getInstance().options.addEventListener(PropertyChangeEvent.PROPERTY_CHANGED,this.onPropertyChanged); + } + + public function setInteraction(param1:Boolean = true, param2:Boolean = false, param3:Boolean = false) : void + { + var _loc4_:GraphicCell = null; + this._interaction_click = param1; + this._cellOverEnabled = param2; + this._interaction_out = param3; + for each(_loc4_ in this._aCells) + { + if(param1) { - this._aCells[cellId].visible = enabled; + _loc4_.addEventListener(MouseEvent.CLICK,this.mouseClick); } else { - return (false); - }; - return (true); - } - - public function show(b:Boolean, pIsInFight:Boolean=false):void - { - var cell:GraphicCell; - this._bShowGrid = b; - var alpha:Number = ((((this._bShowGrid) || (Atouin.getInstance().options.alwaysShowGrid))) ? 1 : 0); - var cellsData:Array = MapDisplayManager.getInstance().getDataMapContainer().dataMap.cells; - var i:uint; - while (i < this._aCells.length) - { - cell = GraphicCell(this._aCells[i]); - if (cell) - { - if (((((((pIsInFight) || (this._cellOverEnabled))) && ((alpha == 1)))) && (cellsData[i].nonWalkableDuringFight))) - { - cell.alpha = 0; - } - else - { - cell.alpha = alpha; - }; - }; - i++; - }; - } - - public function clean():void - { - var i:uint; - if (this._aCells) - { - i = 0; - while (i < this._aCells.length) - { - if (!((!(this._aCells[i])) || (!(this._aCells[i].parent)))) - { - this._aCells[i].parent.removeChild(this._aCells[i]); - }; - i++; - }; - }; - } - - private function init():void - { - var c:GraphicCell; - var i:uint; - while (i < AtouinConstants.MAP_CELLS_COUNT) - { - c = new GraphicCell(i); - c.mouseEnabled = false; - c.mouseChildren = false; - this._aCellPool[i] = c; - i++; - }; - } - - private function overStateChanged(oldValue:Boolean, newValue:Boolean):void - { - if (oldValue == newValue) - { - return; - }; - if (((!(oldValue)) && (newValue))) + _loc4_.removeEventListener(MouseEvent.CLICK,this.mouseClick); + } + if(param2) { - this.registerOver(true); + _loc4_.addEventListener(MouseEvent.MOUSE_OVER,this.mouseOver); } else { - if (((oldValue) && (!(newValue)))) - { - this.registerOver(false); - }; - }; - } - - private function registerOver(enabled:Boolean):void - { - var i:uint; - while (i < AtouinConstants.MAP_CELLS_COUNT) + _loc4_.removeEventListener(MouseEvent.MOUSE_OVER,this.mouseOver); + } + if(param3) { - if (!!(this._aCells[i])) - { - if (enabled) - { - this._aCells[i].addEventListener(MouseEvent.ROLL_OVER, this.mouseOver); - this._aCells[i].addEventListener(MouseEvent.ROLL_OUT, this.mouseOut); - } - else - { - this._aCells[i].removeEventListener(MouseEvent.ROLL_OVER, this.mouseOver); - this._aCells[i].removeEventListener(MouseEvent.ROLL_OUT, this.mouseOut); - }; - }; - i++; - }; - } - - private function mouseClick(e:MouseEvent):void - { - var a:Array; - var entity:IEntity; - var _local_7:CellClickMessage; - var target:Sprite = Sprite(e.target); - if (!(target.parent)) + _loc4_.addEventListener(MouseEvent.MOUSE_OUT,this.mouseOut); + } + else { - return; - }; - var index:int = target.parent.getChildIndex(target); - var targetCell:Point = CellIdConverter.cellIdToCoord(parseInt(target.name)); - if (!(DataMapProvider.getInstance().pointCanStop(targetCell.x, targetCell.y))) + _loc4_.removeEventListener(MouseEvent.MOUSE_OUT,this.mouseOut); + } + _loc4_.mouseEnabled = (param1) || (param2) || (param3); + } + } + + public function getCell(param1:uint) : GraphicCell + { + this._aCells[param1] = this._aCellPool[param1]; + return this._aCells[param1]; + } + + public function updateInteractiveCell(param1:DataMapContainer) : void + { + var _loc3_:CellReference = null; + var _loc4_:GraphicCell = null; + var _loc5_:DisplayObject = null; + if(!param1) + { + _log.error("Can\'t update interactive cell of a NULL container"); + return; + } + this.setInteraction(true,Atouin.getInstance().options.showCellIdOnOver,Atouin.getInstance().options.showCellIdOnOver); + var _loc2_:Array = param1.getCell(); + var _loc6_:Boolean = Atouin.getInstance().options.showTransitions; + var _loc7_:Number = (this._bShowGrid) || (Atouin.getInstance().options.alwaysShowGrid)?1:0; + var _loc8_:LayerContainer = param1.getLayer(Layer.LAYER_DECOR); + var _loc9_:uint = 0; + var _loc10_:uint = this._aCells.length; + var _loc11_:uint = 0; + var _loc12_:GraphicCell = this._aCells[0]; + if(!_loc12_) + { + while(!_loc12_ && _loc9_ < _loc10_) { - _log.info("Cannot move to this cell in RP"); - return; - }; - if (Atouin.getInstance().options.virtualPlayerJump) + _loc12_ = this._aCells[_loc9_++]; + } + _loc9_--; + } + while(_loc11_ < _loc8_.numChildren && _loc9_ < _loc10_) + { + if(!(_loc12_ == null) && _loc12_.cellId <= CellContainer(_loc8_.getChildAt(_loc11_)).cellId) { - a = EntitiesManager.getInstance().entities; - for each (entity in a) - { - if ((entity is IMovable)) - { - IMovable(entity).jump(MapPoint.fromCellId(parseInt(target.name))); - break; - }; - }; + _loc3_ = _loc2_[_loc9_]; + _loc4_ = this._aCells[_loc9_]; + _loc4_.y = _loc3_.elevation; + _loc4_.visible = (_loc3_.mov) && !_loc3_.isDisabled; + _loc4_.alpha = _loc7_; + _loc8_.addChildAt(_loc4_,_loc11_); + _loc12_ = this._aCells[++_loc9_]; } - else + _loc11_++; + } + } + + public function updateCell(param1:uint, param2:Boolean) : Boolean + { + DataMapProvider.getInstance().updateCellMovLov(param1,param2); + if(this._aCells[param1] != null) + { + this._aCells[param1].visible = param2; + return true; + } + return false; + } + + public function show(param1:Boolean, param2:Boolean = false) : void + { + var _loc5_:GraphicCell = null; + this._bShowGrid = param1; + var _loc3_:Number = (this._bShowGrid) || (Atouin.getInstance().options.alwaysShowGrid)?1:0; + var _loc4_:Array = MapDisplayManager.getInstance().getDataMapContainer().dataMap.cells; + var _loc6_:uint = 0; + while(_loc6_ < this._aCells.length) + { + _loc5_ = GraphicCell(this._aCells[_loc6_]); + if(_loc5_) { - _local_7 = new CellClickMessage(); - _local_7.cellContainer = target; - _local_7.cellDepth = index; - _local_7.cell = MapPoint.fromCoords(targetCell.x, targetCell.y); - _local_7.cellId = parseInt(target.name); - Atouin.getInstance().handler.process(_local_7); - }; - } - - private function mouseOver(e:MouseEvent):void - { - var _cellColor:uint; - var textInfo:String; - var mp:MapPoint; - var cellData:CellData; - var sel:Selection; - var target:Sprite = Sprite(e.target); - if (!(target.parent)) + if(((param2) || (this._cellOverEnabled)) && _loc3_ == 1 && (_loc4_[_loc6_].nonWalkableDuringFight)) + { + _loc5_.alpha = 0; + } + else + { + _loc5_.alpha = _loc3_; + } + } + _loc6_++; + } + } + + public function clean() : void + { + var _loc1_:uint = 0; + if(this._aCells) + { + _loc1_ = 0; + while(_loc1_ < this._aCells.length) { - return; - }; - var index:int = target.parent.getChildIndex(target); - var targetCell:Point = CellIdConverter.cellIdToCoord(parseInt(target.name)); - if (Atouin.getInstance().options.showCellIdOnOver) + if(!(!this._aCells[_loc1_] || !this._aCells[_loc1_].parent)) + { + this._aCells[_loc1_].parent.removeChild(this._aCells[_loc1_]); + } + _loc1_++; + } + } + } + + private function init() : void + { + var _loc2_:GraphicCell = null; + var _loc1_:uint = 0; + while(_loc1_ < AtouinConstants.MAP_CELLS_COUNT) + { + _loc2_ = new GraphicCell(_loc1_); + _loc2_.mouseEnabled = false; + _loc2_.mouseChildren = false; + this._aCellPool[_loc1_] = _loc2_; + _loc1_++; + } + } + + private function overStateChanged(param1:Boolean, param2:Boolean) : void + { + if(param1 == param2) + { + return; + } + if(!param1 && (param2)) + { + this.registerOver(true); + } + else if((param1) && !param2) + { + this.registerOver(false); + } + + } + + private function registerOver(param1:Boolean) : void + { + var _loc2_:uint = 0; + while(_loc2_ < AtouinConstants.MAP_CELLS_COUNT) + { + if(this._aCells[_loc2_]) { - _cellColor = 0; - textInfo = (((((target.name + " (") + targetCell.x) + "/") + targetCell.y) + ")"); - mp = MapPoint.fromCoords(targetCell.x, targetCell.y); - textInfo = (textInfo + ("\nLigne de vue : " + !(DataMapProvider.getInstance().pointLos(mp.x, mp.y)))); - textInfo = (textInfo + ("\nBlocage éditeur : " + !(DataMapProvider.getInstance().pointMov(mp.x, mp.y)))); - textInfo = (textInfo + ("\nBlocage entitée : " + !(DataMapProvider.getInstance().pointMov(mp.x, mp.y, false)))); - cellData = CellData(MapDisplayManager.getInstance().getDataMapContainer().dataMap.cells[parseInt(target.name)]); - textInfo = (textInfo + ("\nForcage fleche bas : " + cellData.useBottomArrow)); - textInfo = (textInfo + ("\nForcage fleche haut : " + cellData.useTopArrow)); - textInfo = (textInfo + ("\nForcage fleche droite : " + cellData.useRightArrow)); - textInfo = (textInfo + ("\nForcage fleche gauche : " + cellData.useLeftArrow)); - textInfo = (textInfo + ("\nID de zone : " + cellData.moveZone)); - textInfo = (textInfo + (("\nHauteur : " + cellData.floor) + " px")); - textInfo = (textInfo + ("\nSpeed : " + cellData.speed)); - DebugToolTip.getInstance().text = textInfo; - sel = SelectionManager.getInstance().getSelection("infoOverCell"); - if (!(sel)) - { - sel = new Selection(); - sel.color = new Color(_cellColor); - sel.renderer = new ZoneDARenderer(); - sel.zone = new Lozenge(0, 0, DataMapProvider.getInstance()); - SelectionManager.getInstance().addSelection(sel, "infoOverCell", parseInt(target.name)); - } - else - { - SelectionManager.getInstance().update("infoOverCell", parseInt(target.name)); - }; - StageShareManager.stage.addChild(DebugToolTip.getInstance()); - }; - var msg:CellOverMessage = new CellOverMessage(); - msg.cellContainer = target; - msg.cellDepth = index; - msg.cell = MapPoint.fromCoords(targetCell.x, targetCell.y); - msg.cellId = parseInt(target.name); - Atouin.getInstance().handler.process(msg); - } - - private function mouseOut(e:MouseEvent):void - { - var target:Sprite = Sprite(e.target); - if (!(target.parent)) + if(param1) + { + this._aCells[_loc2_].addEventListener(MouseEvent.ROLL_OVER,this.mouseOver); + this._aCells[_loc2_].addEventListener(MouseEvent.ROLL_OUT,this.mouseOut); + } + else + { + this._aCells[_loc2_].removeEventListener(MouseEvent.ROLL_OVER,this.mouseOver); + this._aCells[_loc2_].removeEventListener(MouseEvent.ROLL_OUT,this.mouseOut); + } + } + _loc2_++; + } + } + + private function mouseClick(param1:MouseEvent) : void + { + var _loc5_:Array = null; + var _loc6_:IEntity = null; + var _loc7_:CellClickMessage = null; + var _loc2_:Sprite = Sprite(param1.target); + if(!_loc2_.parent) + { + return; + } + var _loc3_:int = _loc2_.parent.getChildIndex(_loc2_); + var _loc4_:Point = CellIdConverter.cellIdToCoord(parseInt(_loc2_.name)); + if(!DataMapProvider.getInstance().pointCanStop(_loc4_.x,_loc4_.y)) + { + _log.info("Cannot move to this cell in RP"); + return; + } + if(Atouin.getInstance().options.virtualPlayerJump) + { + _loc5_ = EntitiesManager.getInstance().entities; + for each(_loc6_ in _loc5_) { - return; - }; - var index:int = target.parent.getChildIndex(target); - var targetCell:Point = CellIdConverter.cellIdToCoord(parseInt(target.name)); - if (Atouin.getInstance().worldContainer.contains(DebugToolTip.getInstance())) + if(_loc6_ is IMovable) + { + IMovable(_loc6_).jump(MapPoint.fromCellId(parseInt(_loc2_.name))); + break; + } + } + } + else + { + _loc7_ = new CellClickMessage(); + _loc7_.cellContainer = _loc2_; + _loc7_.cellDepth = _loc3_; + _loc7_.cell = MapPoint.fromCoords(_loc4_.x,_loc4_.y); + _loc7_.cellId = parseInt(_loc2_.name); + Atouin.getInstance().handler.process(_loc7_); + } + } + + private function mouseOver(param1:MouseEvent) : void + { + var _loc6_:uint = 0; + var _loc7_:String = null; + var _loc8_:MapPoint = null; + var _loc9_:CellData = null; + var _loc10_:Selection = null; + var _loc2_:Sprite = Sprite(param1.target); + if(!_loc2_.parent) + { + return; + } + var _loc3_:int = _loc2_.parent.getChildIndex(_loc2_); + var _loc4_:Point = CellIdConverter.cellIdToCoord(parseInt(_loc2_.name)); + if(Atouin.getInstance().options.showCellIdOnOver) + { + _loc6_ = 0; + _loc7_ = _loc2_.name + " (" + _loc4_.x + "/" + _loc4_.y + ")"; + _loc8_ = MapPoint.fromCoords(_loc4_.x,_loc4_.y); + _loc7_ = _loc7_ + ("\nLigne de vue : " + !DataMapProvider.getInstance().pointLos(_loc8_.x,_loc8_.y)); + _loc7_ = _loc7_ + ("\nBlocage éditeur : " + !DataMapProvider.getInstance().pointMov(_loc8_.x,_loc8_.y)); + _loc7_ = _loc7_ + ("\nBlocage entitée : " + !DataMapProvider.getInstance().pointMov(_loc8_.x,_loc8_.y,false)); + _loc9_ = CellData(MapDisplayManager.getInstance().getDataMapContainer().dataMap.cells[parseInt(_loc2_.name)]); + _loc7_ = _loc7_ + ("\nForcage fleche bas : " + _loc9_.useBottomArrow); + _loc7_ = _loc7_ + ("\nForcage fleche haut : " + _loc9_.useTopArrow); + _loc7_ = _loc7_ + ("\nForcage fleche droite : " + _loc9_.useRightArrow); + _loc7_ = _loc7_ + ("\nForcage fleche gauche : " + _loc9_.useLeftArrow); + _loc7_ = _loc7_ + ("\nID de zone : " + _loc9_.moveZone); + _loc7_ = _loc7_ + ("\nHauteur : " + _loc9_.floor + " px"); + _loc7_ = _loc7_ + ("\nSpeed : " + _loc9_.speed); + DebugToolTip.getInstance().text = _loc7_; + _loc10_ = SelectionManager.getInstance().getSelection("infoOverCell"); + if(!_loc10_) { - Atouin.getInstance().worldContainer.removeChild(DebugToolTip.getInstance()); - }; - var msg:CellOutMessage = new CellOutMessage(); - msg.cellContainer = target; - msg.cellDepth = index; - msg.cell = MapPoint.fromCoords(targetCell.x, targetCell.y); - msg.cellId = parseInt(target.name); - Atouin.getInstance().handler.process(msg); - } - - private function onPropertyChanged(e:PropertyChangeEvent):void - { - if (e.propertyName == "alwaysShowGrid") + _loc10_ = new Selection(); + _loc10_.color = new Color(_loc6_); + _loc10_.renderer = new ZoneDARenderer(); + _loc10_.zone = new Lozenge(0,0,DataMapProvider.getInstance()); + SelectionManager.getInstance().addSelection(_loc10_,"infoOverCell",parseInt(_loc2_.name)); + } + else { - this.show(e.propertyValue); - }; - } - - - } -}//package com.ankamagames.atouin.managers - + SelectionManager.getInstance().update("infoOverCell",parseInt(_loc2_.name)); + } + StageShareManager.stage.addChild(DebugToolTip.getInstance()); + } + var _loc5_:CellOverMessage = new CellOverMessage(); + _loc5_.cellContainer = _loc2_; + _loc5_.cellDepth = _loc3_; + _loc5_.cell = MapPoint.fromCoords(_loc4_.x,_loc4_.y); + _loc5_.cellId = parseInt(_loc2_.name); + Atouin.getInstance().handler.process(_loc5_); + } + + private function mouseOut(param1:MouseEvent) : void + { + var _loc2_:Sprite = Sprite(param1.target); + if(!_loc2_.parent) + { + return; + } + var _loc3_:int = _loc2_.parent.getChildIndex(_loc2_); + var _loc4_:Point = CellIdConverter.cellIdToCoord(parseInt(_loc2_.name)); + if(Atouin.getInstance().worldContainer.contains(DebugToolTip.getInstance())) + { + Atouin.getInstance().worldContainer.removeChild(DebugToolTip.getInstance()); + } + var _loc5_:CellOutMessage = new CellOutMessage(); + _loc5_.cellContainer = _loc2_; + _loc5_.cellDepth = _loc3_; + _loc5_.cell = MapPoint.fromCoords(_loc4_.x,_loc4_.y); + _loc5_.cellId = parseInt(_loc2_.name); + Atouin.getInstance().handler.process(_loc5_); + } + + private function onPropertyChanged(param1:PropertyChangeEvent) : void + { + if(param1.propertyName == "alwaysShowGrid") + { + this.show(param1.propertyValue); + } + } + } +} diff --git a/com/ankamagames/atouin/managers/MapDisplayManager.as b/com/ankamagames/atouin/managers/MapDisplayManager.as index 4e92222b3..eb730bbf3 100644 --- a/com/ankamagames/atouin/managers/MapDisplayManager.as +++ b/com/ankamagames/atouin/managers/MapDisplayManager.as @@ -1,506 +1,531 @@ -package com.ankamagames.atouin.managers +package com.ankamagames.atouin.managers { - import flash.utils.Dictionary; - import com.ankamagames.jerakine.logger.Logger; - import com.ankamagames.jerakine.logger.Log; - import flash.utils.getQualifiedClassName; - import com.ankamagames.jerakine.types.positions.WorldPoint; - import com.ankamagames.jerakine.resources.loaders.IResourceLoader; - import com.ankamagames.atouin.types.DataMapContainer; - import com.ankamagames.jerakine.newCache.ICache; - import com.ankamagames.atouin.renderers.MapRenderer; - import flash.display.Bitmap; - import flash.display.BitmapData; - import flash.geom.Matrix; - import com.ankamagames.jerakine.newCache.impl.Cache; - import com.ankamagames.jerakine.newCache.garbage.LruGarbageCollector; - import com.ankamagames.jerakine.utils.errors.SingletonError; - import com.ankamagames.atouin.Atouin; - import com.ankamagames.jerakine.resources.events.ResourceLoadedEvent; - import com.ankamagames.atouin.data.map.Map; - import flash.utils.ByteArray; - import flash.display.DisplayObjectContainer; - import com.ankamagames.jerakine.utils.display.StageShareManager; - import com.ankamagames.jerakine.utils.system.AirScanner; - import flash.filters.BlurFilter; - import com.ankamagames.tiphon.display.TiphonSprite; - import flash.display.InteractiveObject; - import com.ankamagames.jerakine.types.positions.MapPoint; - import com.ankamagames.atouin.data.elements.Elements; - import com.ankamagames.atouin.types.events.RenderMapEvent; - import flash.events.ProgressEvent; - import com.ankamagames.jerakine.resources.adapters.AdapterFactory; - import com.ankamagames.atouin.resources.adapters.MapsAdapter; - import com.ankamagames.jerakine.resources.loaders.ResourceLoaderFactory; - import com.ankamagames.jerakine.resources.loaders.ResourceLoaderType; - import com.ankamagames.jerakine.resources.events.ResourceErrorEvent; - import com.ankamagames.atouin.messages.MapsLoadingCompleteMessage; - import com.ankamagames.atouin.messages.MapsLoadingStartedMessage; - import flash.utils.getTimer; - import com.ankamagames.jerakine.types.Uri; - import com.ankamagames.atouin.utils.map.getMapUriFromId; - import com.ankamagames.atouin.data.DefaultMap; - import com.ankamagames.atouin.utils.DataMapProvider; - import com.ankamagames.atouin.messages.MapLoadingFailedMessage; - import flash.events.Event; - import com.ankamagames.jerakine.utils.display.EnterFrameDispatcher; - import com.ankamagames.atouin.messages.MapRenderProgressMessage; - import com.ankamagames.atouin.messages.MapLoadedMessage; - import flash.geom.Rectangle; - - public class MapDisplayManager - { - - public static var MEMORY_LOG:Dictionary = new Dictionary(true); - protected static const _log:Logger = Log.getLogger(getQualifiedClassName(MapDisplayManager)); - private static var _self:MapDisplayManager; - - private var _currentMap:WorldPoint; - private var _currentRenderId:uint; - private var _isDefaultMap:Boolean; - private var _lastMap:WorldPoint; - private var _loader:IResourceLoader; - private var _currentDataMap:DataMapContainer; - private var _mapFileCache:ICache; - private var _currentMapRendered:Boolean = true; - private var _forceReloadWithoutCache:Boolean; - private var _renderRequestStack:Array; - private var _renderer:MapRenderer; - private var _screenshot:Bitmap; - private var _screenshotData:BitmapData; - private var _nMapLoadStart:uint; - private var _nMapLoadEnd:uint; - private var _nGfxLoadStart:uint; - private var _nGfxLoadEnd:uint; - private var _nRenderMapStart:uint; - private var _nRenderMapEnd:uint; - private var matrix:Matrix; - - public function MapDisplayManager() - { - this._mapFileCache = new Cache(20, new LruGarbageCollector()); - this.matrix = new Matrix(); - super(); - if (_self) - { - throw (new SingletonError()); - }; + import flash.utils.Dictionary; + import com.ankamagames.jerakine.logger.Logger; + import com.ankamagames.jerakine.logger.Log; + import flash.utils.getQualifiedClassName; + import com.ankamagames.jerakine.types.positions.WorldPoint; + import com.ankamagames.jerakine.resources.loaders.IResourceLoader; + import com.ankamagames.atouin.types.DataMapContainer; + import com.ankamagames.jerakine.newCache.ICache; + import com.ankamagames.atouin.renderers.MapRenderer; + import flash.display.Bitmap; + import flash.display.BitmapData; + import com.ankamagames.atouin.data.map.Map; + import flash.utils.ByteArray; + import com.ankamagames.atouin.Atouin; + import com.ankamagames.jerakine.resources.events.ResourceLoadedEvent; + import flash.geom.Matrix; + import flash.display.DisplayObjectContainer; + import com.ankamagames.jerakine.utils.display.StageShareManager; + import com.ankamagames.jerakine.utils.system.AirScanner; + import flash.filters.BlurFilter; + import com.ankamagames.tiphon.display.TiphonSprite; + import flash.display.InteractiveObject; + import com.ankamagames.jerakine.types.positions.MapPoint; + import com.ankamagames.atouin.data.elements.Elements; + import com.ankamagames.atouin.types.events.RenderMapEvent; + import flash.events.ProgressEvent; + import com.ankamagames.jerakine.resources.adapters.AdapterFactory; + import com.ankamagames.atouin.resources.adapters.MapsAdapter; + import com.ankamagames.jerakine.resources.loaders.ResourceLoaderFactory; + import com.ankamagames.jerakine.resources.loaders.ResourceLoaderType; + import com.ankamagames.jerakine.resources.events.ResourceErrorEvent; + import com.ankamagames.atouin.messages.MapsLoadingCompleteMessage; + import com.ankamagames.atouin.messages.MapsLoadingStartedMessage; + import flash.utils.getTimer; + import com.ankamagames.jerakine.types.Uri; + import com.ankamagames.atouin.utils.map.getMapUriFromId; + import com.ankamagames.atouin.data.DefaultMap; + import com.ankamagames.atouin.utils.DataMapProvider; + import com.ankamagames.atouin.messages.MapLoadingFailedMessage; + import flash.events.Event; + import com.ankamagames.jerakine.utils.display.EnterFrameDispatcher; + import com.ankamagames.atouin.messages.MapRenderProgressMessage; + import com.ankamagames.atouin.messages.MapLoadedMessage; + import flash.geom.Rectangle; + import com.ankamagames.jerakine.newCache.impl.Cache; + import com.ankamagames.jerakine.newCache.garbage.LruGarbageCollector; + import com.ankamagames.jerakine.utils.errors.SingletonError; + + public class MapDisplayManager extends Object + { + + public function MapDisplayManager() + { + this._mapFileCache = new Cache(20,new LruGarbageCollector()); + this.matrix = new Matrix(); + super(); + if(_self) + { + throw new SingletonError(); + } + else + { this.init(); - } - - public static function getInstance():MapDisplayManager - { - if (!(_self)) - { - _self = new (MapDisplayManager)(); - }; - return (_self); - } - - - public function get isDefaultMap():Boolean - { - return (this._isDefaultMap); - } - - public function get renderer():MapRenderer - { - return (this._renderer); - } - - public function get currentRenderId():uint - { - return (this._currentRenderId); - } - - public function fromMap(map:Map, decryptionKey:ByteArray=null, renderFixture:Boolean=true):uint - { - this._currentMap = WorldPoint.fromMapId(map.id); - var request:RenderRequest = new RenderRequest(this._currentMap, false, decryptionKey, renderFixture); - this._renderRequestStack.push(request); - this._currentRenderId = request.renderId; - Atouin.getInstance().showWorld(true); - this._renderer.initRenderContainer(Atouin.getInstance().worldContainer); - Atouin.getInstance().options.groundCacheMode = 0; - var rle:ResourceLoadedEvent = new ResourceLoadedEvent(ResourceLoadedEvent.LOADED); - rle.resource = map; - this.onMapLoaded(rle); - return (this._currentRenderId); - } - - public function display(pMap:WorldPoint, forceReloadWithoutCache:Boolean=false, decryptionKey:ByteArray=null, renderFixture:Boolean=true):uint - { - var request:RenderRequest = new RenderRequest(pMap, forceReloadWithoutCache, decryptionKey, renderFixture); - _log.debug(((("Ask render map " + pMap.mapId) + ", renderRequestID: ") + request.renderId)); - this._renderRequestStack.push(request); - this.checkForRender(); - return (request.renderId); - } - - public function isBoundingBox(pictoId:int):Boolean - { - if (MapRenderer.boundingBoxElements[pictoId]) - { - return (true); - }; - return (false); - } - - public function cacheAsBitmapEnabled(yes:Boolean):void - { - var ls:Array = MapRenderer.cachedAsBitmapElement; - var num:int = ls.length; - var i:int; - while (i < num) - { - ls[i].cacheAsBitmap = yes; - i++; - }; - } - - public function get currentMapPoint():WorldPoint - { - return (this._currentMap); - } - - public function get currentMapRendered():Boolean - { - return (this._currentMapRendered); - } - - public function getDataMapContainer():DataMapContainer - { - return (this._currentDataMap); - } - - public function activeIdentifiedElements(active:Boolean):void - { - var ie:Object; - var identifiedElements:Dictionary = this._renderer.identifiedElements; - for each (ie in identifiedElements) - { - ie.sprite.mouseEnabled = active; - }; - } - - public function unloadMap():void - { - this._renderer.unload(); - } - - public function capture():void - { - var ctr:DisplayObjectContainer; - if (((Atouin.getInstance().options.tweentInterMap) || (Atouin.getInstance().options.hideInterMap))) - { - if (this._screenshotData == null) - { - this._screenshotData = new BitmapData(StageShareManager.startWidth, StageShareManager.startHeight, true, 0); - this._screenshot = new Bitmap(this._screenshotData); - this._screenshot.smoothing = true; - }; - ctr = Atouin.getInstance().rootContainer; - this.matrix.identity(); - this.matrix.scale(ctr.scaleX, ctr.scaleY); - this.matrix.translate(ctr.x, ctr.y); - this._screenshotData.draw(ctr, this.matrix, null, null, null, true); - if (AirScanner.isStreamingVersion()) - { - this._screenshot.filters = [new BlurFilter()]; - }; - ctr.addChild(this._screenshot); - }; - } - - public function getIdentifiedEntityElement(id:uint):TiphonSprite - { - if (((((this._renderer) && (this._renderer.identifiedElements))) && (this._renderer.identifiedElements[id]))) + return; + } + } + + public static var MEMORY_LOG:Dictionary = new Dictionary(true); + + protected static const _log:Logger = Log.getLogger(getQualifiedClassName(MapDisplayManager)); + + private static var _self:MapDisplayManager; + + public static function getInstance() : MapDisplayManager + { + if(!_self) + { + _self = new MapDisplayManager(); + } + return _self; + } + + private var _currentMap:WorldPoint; + + private var _currentRenderId:uint; + + private var _isDefaultMap:Boolean; + + private var _lastMap:WorldPoint; + + private var _loader:IResourceLoader; + + private var _currentDataMap:DataMapContainer; + + private var _mapFileCache:ICache; + + private var _currentMapRendered:Boolean = true; + + private var _forceReloadWithoutCache:Boolean; + + private var _renderRequestStack:Array; + + private var _renderer:MapRenderer; + + private var _screenshot:Bitmap; + + private var _screenshotData:BitmapData; + + private var _nMapLoadStart:uint; + + private var _nMapLoadEnd:uint; + + private var _nGfxLoadStart:uint; + + private var _nGfxLoadEnd:uint; + + private var _nRenderMapStart:uint; + + private var _nRenderMapEnd:uint; + + public function get isDefaultMap() : Boolean + { + return this._isDefaultMap; + } + + public function get renderer() : MapRenderer + { + return this._renderer; + } + + public function get currentRenderId() : uint + { + return this._currentRenderId; + } + + public function fromMap(param1:Map, param2:ByteArray = null, param3:Boolean = true) : uint + { + this._currentMap = WorldPoint.fromMapId(param1.id); + var _loc4_:RenderRequest = new RenderRequest(this._currentMap,false,param2,param3); + this._renderRequestStack.push(_loc4_); + this._currentRenderId = _loc4_.renderId; + Atouin.getInstance().showWorld(true); + this._renderer.initRenderContainer(Atouin.getInstance().worldContainer); + Atouin.getInstance().options.groundCacheMode = 0; + var _loc5_:ResourceLoadedEvent = new ResourceLoadedEvent(ResourceLoadedEvent.LOADED); + _loc5_.resource = param1; + this.onMapLoaded(_loc5_); + return this._currentRenderId; + } + + public function display(param1:WorldPoint, param2:Boolean = false, param3:ByteArray = null, param4:Boolean = true) : uint + { + var _loc5_:RenderRequest = new RenderRequest(param1,param2,param3,param4); + _log.debug("Ask render map " + param1.mapId + ", renderRequestID: " + _loc5_.renderId); + this._renderRequestStack.push(_loc5_); + this.checkForRender(); + return _loc5_.renderId; + } + + public function isBoundingBox(param1:int) : Boolean + { + if(MapRenderer.boundingBoxElements[param1]) + { + return true; + } + return false; + } + + public function cacheAsBitmapEnabled(param1:Boolean) : void + { + var _loc2_:Array = MapRenderer.cachedAsBitmapElement; + var _loc3_:int = _loc2_.length; + var _loc4_:* = 0; + while(_loc4_ < _loc3_) + { + _loc2_[_loc4_].cacheAsBitmap = param1; + _loc4_++; + } + } + + public function get currentMapPoint() : WorldPoint + { + return this._currentMap; + } + + public function get currentMapRendered() : Boolean + { + return this._currentMapRendered; + } + + public function getDataMapContainer() : DataMapContainer + { + return this._currentDataMap; + } + + public function activeIdentifiedElements(param1:Boolean) : void + { + var _loc3_:Object = null; + var _loc2_:Dictionary = this._renderer.identifiedElements; + for each(_loc3_ in _loc2_) + { + _loc3_.sprite.mouseEnabled = param1; + } + } + + public function unloadMap() : void + { + this._renderer.unload(); + } + + private var matrix:Matrix; + + public function capture() : void + { + var _loc1_:DisplayObjectContainer = null; + if((Atouin.getInstance().options.tweentInterMap) || (Atouin.getInstance().options.hideInterMap)) + { + if(this._screenshotData == null) { - if ((this._renderer.identifiedElements[id].sprite is TiphonSprite)) - { - return ((this._renderer.identifiedElements[id].sprite as TiphonSprite)); - }; - }; - return (null); - } - - public function getIdentifiedElement(id:uint):InteractiveObject - { - if (((((this._renderer) && (this._renderer.identifiedElements))) && (this._renderer.identifiedElements[id]))) + this._screenshotData = new BitmapData(StageShareManager.startWidth,StageShareManager.startHeight,true,0); + this._screenshot = new Bitmap(this._screenshotData); + this._screenshot.smoothing = true; + } + _loc1_ = Atouin.getInstance().rootContainer; + this.matrix.identity(); + this.matrix.scale(_loc1_.scaleX,_loc1_.scaleY); + this.matrix.translate(_loc1_.x,_loc1_.y); + this._screenshotData.draw(_loc1_,this.matrix,null,null,null,true); + if(AirScanner.isStreamingVersion()) { - return (this._renderer.identifiedElements[id].sprite); - }; - return (null); - } - - public function getIdentifiedElementPosition(id:uint):MapPoint - { - if (((((this._renderer) && (this._renderer.identifiedElements))) && (this._renderer.identifiedElements[id]))) + this._screenshot.filters = [new BlurFilter()]; + } + _loc1_.addChild(this._screenshot); + } + } + + public function getIdentifiedEntityElement(param1:uint) : TiphonSprite + { + if((this._renderer) && (this._renderer.identifiedElements) && (this._renderer.identifiedElements[param1])) + { + if(this._renderer.identifiedElements[param1].sprite is TiphonSprite) { - return (this._renderer.identifiedElements[id].position); - }; - return (null); - } - - public function reset():void - { - this.unloadMap(); - this._currentMap = null; - this._currentMapRendered = true; - this._lastMap = null; - this._renderRequestStack = []; - } - - public function hideBackgroundForTacticMode(yes:Boolean):void - { - this._renderer.modeTactic(yes); - } - - private function init():void - { - this._renderRequestStack = []; - this._renderer = new MapRenderer(Atouin.getInstance().worldContainer, Elements.getInstance()); - this._renderer.addEventListener(RenderMapEvent.GFX_LOADING_START, this.logGfxLoadTime, false, 0, true); - this._renderer.addEventListener(RenderMapEvent.GFX_LOADING_END, this.logGfxLoadTime, false, 0, true); - this._renderer.addEventListener(RenderMapEvent.MAP_RENDER_START, this.mapRendered, false, 0, true); - this._renderer.addEventListener(RenderMapEvent.MAP_RENDER_END, this.mapRendered, false, 0, true); - this._renderer.addEventListener(ProgressEvent.PROGRESS, this.mapRenderProgress, false, 0, true); - AdapterFactory.addAdapter("dlm", MapsAdapter); - this._loader = ResourceLoaderFactory.getLoader(ResourceLoaderType.SERIAL_LOADER); - this._loader.addEventListener(ResourceLoadedEvent.LOADED, this.onMapLoaded, false, 0, true); - this._loader.addEventListener(ResourceErrorEvent.ERROR, this.onMapFailed, false, 0, true); - } - - private function mapDisplayed():void - { - this._currentMapRendered = true; - InteractiveCellManager.getInstance().updateInteractiveCell(this._currentDataMap); + return this._renderer.identifiedElements[param1].sprite as TiphonSprite; + } + } + return null; + } + + public function getIdentifiedElement(param1:uint) : InteractiveObject + { + if((this._renderer) && (this._renderer.identifiedElements) && (this._renderer.identifiedElements[param1])) + { + return this._renderer.identifiedElements[param1].sprite; + } + return null; + } + + public function getIdentifiedElementPosition(param1:uint) : MapPoint + { + if((this._renderer) && (this._renderer.identifiedElements) && (this._renderer.identifiedElements[param1])) + { + return this._renderer.identifiedElements[param1].position; + } + return null; + } + + public function reset() : void + { + this.unloadMap(); + this._currentMap = null; + this._currentMapRendered = true; + this._lastMap = null; + this._renderRequestStack = []; + } + + public function hideBackgroundForTacticMode(param1:Boolean) : void + { + this._renderer.modeTactic(param1); + } + + private function init() : void + { + this._renderRequestStack = []; + this._renderer = new MapRenderer(Atouin.getInstance().worldContainer,Elements.getInstance()); + this._renderer.addEventListener(RenderMapEvent.GFX_LOADING_START,this.logGfxLoadTime,false,0,true); + this._renderer.addEventListener(RenderMapEvent.GFX_LOADING_END,this.logGfxLoadTime,false,0,true); + this._renderer.addEventListener(RenderMapEvent.MAP_RENDER_START,this.mapRendered,false,0,true); + this._renderer.addEventListener(RenderMapEvent.MAP_RENDER_END,this.mapRendered,false,0,true); + this._renderer.addEventListener(ProgressEvent.PROGRESS,this.mapRenderProgress,false,0,true); + AdapterFactory.addAdapter("dlm",MapsAdapter); + this._loader = ResourceLoaderFactory.getLoader(ResourceLoaderType.SERIAL_LOADER); + this._loader.addEventListener(ResourceLoadedEvent.LOADED,this.onMapLoaded,false,0,true); + this._loader.addEventListener(ResourceErrorEvent.ERROR,this.onMapFailed,false,0,true); + } + + private function mapDisplayed() : void + { + this._currentMapRendered = true; + InteractiveCellManager.getInstance().updateInteractiveCell(this._currentDataMap); + this._renderRequestStack.shift(); + var _loc1_:MapsLoadingCompleteMessage = new MapsLoadingCompleteMessage(this._currentMap,MapDisplayManager.getInstance().getDataMapContainer().dataMap); + _loc1_.renderRequestId = this._currentRenderId; + Atouin.getInstance().handler.process(_loc1_); + this.checkForRender(); + } + + private function checkForRender() : void + { + var _loc5_:Map = null; + var _loc6_:MapsLoadingCompleteMessage = null; + var _loc7_:Atouin = null; + if(!this._currentMapRendered && (this._currentMap)) + { + return; + } + if(this._renderRequestStack.length == 0) + { + return; + } + var _loc1_:RenderRequest = RenderRequest(this._renderRequestStack[0]); + var _loc2_:WorldPoint = _loc1_.map; + var _loc3_:Boolean = _loc1_.forceReloadWithoutCache; + Atouin.getInstance().showWorld(true); + this._renderer.initRenderContainer(Atouin.getInstance().worldContainer); + if((!_loc3_ && this._currentMap) && (this._currentMap.mapId == _loc2_.mapId) && !Atouin.getInstance().options.reloadLoadedMap) + { this._renderRequestStack.shift(); - var msg:MapsLoadingCompleteMessage = new MapsLoadingCompleteMessage(this._currentMap, MapDisplayManager.getInstance().getDataMapContainer().dataMap); - msg.renderRequestId = this._currentRenderId; - Atouin.getInstance().handler.process(msg); - this.checkForRender(); - } - - private function checkForRender():void - { - var dataMap:Map; - var msg:MapsLoadingCompleteMessage; - var atouin:Atouin; - if (((!(this._currentMapRendered)) && (this._currentMap))) - { - return; - }; - if (this._renderRequestStack.length == 0) - { - return; - }; - var request:RenderRequest = RenderRequest(this._renderRequestStack[0]); - var pMap:WorldPoint = request.map; - var forceReloadWithoutCache:Boolean = request.forceReloadWithoutCache; - Atouin.getInstance().showWorld(true); - this._renderer.initRenderContainer(Atouin.getInstance().worldContainer); - if (((((((!(forceReloadWithoutCache)) && (this._currentMap))) && ((this._currentMap.mapId == pMap.mapId)))) && (!(Atouin.getInstance().options.reloadLoadedMap)))) + _log.debug("Map " + _loc2_.mapId + " is the same, renderRequestID: " + _loc1_.renderId); + _loc5_ = MapDisplayManager.getInstance().getDataMapContainer().dataMap; + _loc6_ = new MapsLoadingCompleteMessage(this._currentMap,_loc5_); + _loc7_ = Atouin.getInstance(); + _loc7_.handler.process(_loc6_); + _loc6_.renderRequestId = _loc1_.renderId; + if(!(_loc5_.zoomScale == 1) && (_loc7_.options.useInsideAutoZoom)) { - this._renderRequestStack.shift(); - _log.debug(((("Map " + pMap.mapId) + " is the same, renderRequestID: ") + request.renderId)); - dataMap = MapDisplayManager.getInstance().getDataMapContainer().dataMap; - msg = new MapsLoadingCompleteMessage(this._currentMap, dataMap); - atouin = Atouin.getInstance(); - atouin.handler.process(msg); - msg.renderRequestId = request.renderId; - if (((!((dataMap.zoomScale == 1))) && (atouin.options.useInsideAutoZoom))) - { - atouin.rootContainer.scaleX = dataMap.zoomScale; - atouin.rootContainer.scaleY = dataMap.zoomScale; - atouin.rootContainer.x = dataMap.zoomOffsetX; - atouin.rootContainer.y = dataMap.zoomOffsetY; - atouin.currentZoom = dataMap.zoomScale; - }; - this.checkForRender(); - return; - }; - this._currentMapRendered = false; - this._lastMap = this._currentMap; - this._currentMap = pMap; - this._currentRenderId = request.renderId; - this._forceReloadWithoutCache = forceReloadWithoutCache; - var msg2:MapsLoadingStartedMessage = new MapsLoadingStartedMessage(); - Atouin.getInstance().handler.process(msg2); - this._nMapLoadStart = getTimer(); - this._loader.cancel(); - this._loader.load(new Uri(getMapUriFromId(pMap.mapId)), null); - } - - private function onMapLoaded(e:ResourceLoadedEvent):void - { - var request:RenderRequest = RenderRequest(this._renderRequestStack[0]); - this._nMapLoadEnd = getTimer(); - var map:Map = new Map(); - if ((e.resource is Map)) - { - map = e.resource; + _loc7_.rootContainer.scaleX = _loc5_.zoomScale; + _loc7_.rootContainer.scaleY = _loc5_.zoomScale; + _loc7_.rootContainer.x = _loc5_.zoomOffsetX; + _loc7_.rootContainer.y = _loc5_.zoomOffsetY; + _loc7_.currentZoom = _loc5_.zoomScale; } - else - { - try - { - map.fromRaw(e.resource, request.decryptionKey); - } - catch(e:Error) - { - _log.fatal(("Exception sur le parsing du fichier de map :\n" + e.getStackTrace())); - map = new DefaultMap(); - }; - }; - this._isDefaultMap = (map is DefaultMap); - this.unloadMap(); - DataMapProvider.getInstance().resetUpdatedCell(); - DataMapProvider.getInstance().resetSpecialEffects(); - if (!(request)) - { - return; - }; - this._currentDataMap = new DataMapContainer(map); - MEMORY_LOG[DataMapContainer] = 1; - this._renderer.render(this._currentDataMap, this._forceReloadWithoutCache, request.renderId, request.renderFixture); - FrustumManager.getInstance().updateMap(); - } - - private function onMapFailed(e:ResourceErrorEvent):void - { - _log.error(((("Impossible de charger la map " + e.uri) + " : ") + e.errorMsg)); - this._currentMapRendered = true; - this._renderRequestStack.shift(); this.checkForRender(); - this.signalMapLoadingFailure(MapLoadingFailedMessage.NO_FILE); - } - - private function logGfxLoadTime(e:Event):void - { - if (e.type == RenderMapEvent.GFX_LOADING_START) - { - this._nGfxLoadStart = getTimer(); - }; - if (e.type == RenderMapEvent.GFX_LOADING_END) - { - this._nGfxLoadEnd = getTimer(); - }; - } - - private function tweenInterMap(e:Event):void - { - this._screenshot.alpha = (this._screenshot.alpha - (this._screenshot.alpha / 3)); - if (this._screenshot.alpha < 0.01) - { - Atouin.getInstance().worldContainer.cacheAsBitmap = false; - this.removeScreenShot(); - EnterFrameDispatcher.removeEventListener(this.tweenInterMap); - }; - } - - private function mapRenderProgress(e:ProgressEvent):void - { - if (!(this._currentMap)) + return; + } + this._currentMapRendered = false; + this._lastMap = this._currentMap; + this._currentMap = _loc2_; + this._currentRenderId = _loc1_.renderId; + this._forceReloadWithoutCache = _loc3_; + var _loc4_:MapsLoadingStartedMessage = new MapsLoadingStartedMessage(); + Atouin.getInstance().handler.process(_loc4_); + this._nMapLoadStart = getTimer(); + this._loader.cancel(); + this._loader.load(new Uri(getMapUriFromId(_loc2_.mapId)),null); + } + + private function onMapLoaded(param1:ResourceLoadedEvent) : void + { + var e:ResourceLoadedEvent = param1; + var request:RenderRequest = RenderRequest(this._renderRequestStack[0]); + this._nMapLoadEnd = getTimer(); + var map:Map = new Map(); + if(e.resource is Map) + { + map = e.resource; + } + else + { + try { - this._currentMapRendered = true; - this.unloadMap(); - this.signalMapLoadingFailure(MapLoadingFailedMessage.CLIENT_SHUTDOWN); - return; - }; - var msg:MapRenderProgressMessage = new MapRenderProgressMessage(((e.bytesLoaded / e.bytesTotal) * 100)); - msg.id = this._currentMap.mapId; - msg.renderRequestId = this._currentRenderId; - Atouin.getInstance().handler.process(msg); - } - - private function signalMapLoadingFailure(errorReasonId:uint):void - { - var msg:MapLoadingFailedMessage = new MapLoadingFailedMessage(); - if (!(this._currentMap)) - { - msg.id = 0; + map.fromRaw(e.resource,request.decryptionKey); } - else + catch(e:Error) { - msg.id = this._currentMap.mapId; - }; - msg.errorReason = errorReasonId; - Atouin.getInstance().handler.process(msg); - } - - private function mapRendered(e:RenderMapEvent):void - { - var tt:uint; - var tml:uint; - var tgl:int; - var msg:MapLoadedMessage; - if (e.type == RenderMapEvent.MAP_RENDER_START) - { - this._nRenderMapStart = getTimer(); - }; - if (e.type == RenderMapEvent.MAP_RENDER_END) + _log.fatal("Exception sur le parsing du fichier de map :\n" + e.getStackTrace()); + map = new DefaultMap(); + } + } + this._isDefaultMap = map is DefaultMap; + this.unloadMap(); + DataMapProvider.getInstance().resetUpdatedCell(); + DataMapProvider.getInstance().resetSpecialEffects(); + if(!request) + { + return; + } + this._currentDataMap = new DataMapContainer(map); + MEMORY_LOG[DataMapContainer] = 1; + this._renderer.render(this._currentDataMap,this._forceReloadWithoutCache,request.renderId,request.renderFixture); + FrustumManager.getInstance().updateMap(); + } + + private function onMapFailed(param1:ResourceErrorEvent) : void + { + _log.error("Impossible de charger la map " + param1.uri + " : " + param1.errorMsg); + this._currentMapRendered = true; + this._renderRequestStack.shift(); + this.checkForRender(); + this.signalMapLoadingFailure(MapLoadingFailedMessage.NO_FILE); + } + + private function logGfxLoadTime(param1:Event) : void + { + if(param1.type == RenderMapEvent.GFX_LOADING_START) + { + this._nGfxLoadStart = getTimer(); + } + if(param1.type == RenderMapEvent.GFX_LOADING_END) + { + this._nGfxLoadEnd = getTimer(); + } + } + + private function tweenInterMap(param1:Event) : void + { + this._screenshot.alpha = this._screenshot.alpha - this._screenshot.alpha / 3; + if(this._screenshot.alpha < 0.01) + { + Atouin.getInstance().worldContainer.cacheAsBitmap = false; + this.removeScreenShot(); + EnterFrameDispatcher.removeEventListener(this.tweenInterMap); + } + } + + private function mapRenderProgress(param1:ProgressEvent) : void + { + if(!this._currentMap) + { + this._currentMapRendered = true; + this.unloadMap(); + this.signalMapLoadingFailure(MapLoadingFailedMessage.CLIENT_SHUTDOWN); + return; + } + var _loc2_:MapRenderProgressMessage = new MapRenderProgressMessage(param1.bytesLoaded / param1.bytesTotal * 100); + _loc2_.id = this._currentMap.mapId; + _loc2_.renderRequestId = this._currentRenderId; + Atouin.getInstance().handler.process(_loc2_); + } + + private function signalMapLoadingFailure(param1:uint) : void + { + var _loc2_:MapLoadingFailedMessage = new MapLoadingFailedMessage(); + if(!this._currentMap) + { + _loc2_.id = 0; + } + else + { + _loc2_.id = this._currentMap.mapId; + } + _loc2_.errorReason = param1; + Atouin.getInstance().handler.process(_loc2_); + } + + private function mapRendered(param1:RenderMapEvent) : void + { + var _loc2_:uint = 0; + var _loc3_:uint = 0; + var _loc4_:* = 0; + var _loc5_:MapLoadedMessage = null; + if(param1.type == RenderMapEvent.MAP_RENDER_START) + { + this._nRenderMapStart = getTimer(); + } + if(param1.type == RenderMapEvent.MAP_RENDER_END) + { + this.mapDisplayed(); + this._nRenderMapEnd = getTimer(); + _loc2_ = this._nRenderMapEnd - this._nMapLoadStart; + _loc3_ = this._nMapLoadEnd - this._nMapLoadStart; + _loc4_ = this._nGfxLoadEnd - this._nGfxLoadStart; + _loc5_ = new MapLoadedMessage(); + _loc5_.dataLoadingTime = _loc3_; + _loc5_.gfxLoadingTime = _loc4_; + _loc5_.renderingTime = this._nRenderMapEnd - this._nRenderMapStart; + _loc5_.globalRenderingTime = _loc2_; + _log.info("map rendered [total : " + _loc2_ + "ms, " + (_loc2_ < 100?" " + (_loc2_ < 10?" ":""):"") + "map load : " + _loc3_ + "ms, " + (_loc3_ < 100?" " + (_loc3_ < 10?" ":""):"") + "gfx load : " + _loc4_ + "ms, " + (_loc4_ < 100?" " + (_loc4_ < 10?" ":""):"") + "render : " + (this._nRenderMapEnd - this._nRenderMapStart) + "ms] file : " + (this._currentMap?this._currentMap.mapId.toString():"???") + ".dlm" + (this._isDefaultMap?" (/!\\ DEFAULT MAP) ":"") + " / renderRequestID #" + this._currentRenderId); + if((this._screenshot) && (this._screenshot.parent)) { - this.mapDisplayed(); - this._nRenderMapEnd = getTimer(); - tt = (this._nRenderMapEnd - this._nMapLoadStart); - tml = (this._nMapLoadEnd - this._nMapLoadStart); - tgl = (this._nGfxLoadEnd - this._nGfxLoadStart); - msg = new MapLoadedMessage(); - msg.dataLoadingTime = tml; - msg.gfxLoadingTime = tgl; - msg.renderingTime = (this._nRenderMapEnd - this._nRenderMapStart); - msg.globalRenderingTime = tt; - _log.info(((((((((((((((((((("map rendered [total : " + tt) + "ms, ") + (((tt < 100)) ? (" " + (((tt < 10)) ? " " : "")) : "")) + "map load : ") + tml) + "ms, ") + (((tml < 100)) ? (" " + (((tml < 10)) ? " " : "")) : "")) + "gfx load : ") + tgl) + "ms, ") + (((tgl < 100)) ? (" " + (((tgl < 10)) ? " " : "")) : "")) + "render : ") + (this._nRenderMapEnd - this._nRenderMapStart)) + "ms] file : ") + ((this._currentMap) ? this._currentMap.mapId.toString() : "???")) + ".dlm") + ((this._isDefaultMap) ? " (/!\\ DEFAULT MAP) " : "")) + " / renderRequestID #") + this._currentRenderId)); - if (((this._screenshot) && (this._screenshot.parent))) - { - if (Atouin.getInstance().options.tweentInterMap) - { - Atouin.getInstance().worldContainer.cacheAsBitmap = true; - EnterFrameDispatcher.addEventListener(this.tweenInterMap, "tweentInterMap"); - } - else - { - this.removeScreenShot(); - }; - }; - msg.id = this._currentMap.mapId; - Atouin.getInstance().handler.process(msg); - }; - } - - private function removeScreenShot():void - { - this._screenshot.parent.removeChild(this._screenshot); - this._screenshotData.fillRect(new Rectangle(0, 0, this._screenshotData.width, this._screenshotData.height), 0xFF000000); - } - - - } -}//package com.ankamagames.atouin.managers - + if(Atouin.getInstance().options.tweentInterMap) + { + Atouin.getInstance().worldContainer.cacheAsBitmap = true; + EnterFrameDispatcher.addEventListener(this.tweenInterMap,"tweentInterMap"); + } + else + { + this.removeScreenShot(); + } + } + _loc5_.id = this._currentMap.mapId; + Atouin.getInstance().handler.process(_loc5_); + } + } + + private function removeScreenShot() : void + { + this._screenshot.parent.removeChild(this._screenshot); + this._screenshotData.fillRect(new Rectangle(0,0,this._screenshotData.width,this._screenshotData.height),4.27819008E9); + } + } +} import com.ankamagames.jerakine.types.positions.WorldPoint; import flash.utils.ByteArray; -class RenderRequest +class RenderRequest extends Object { - - /*private*/ static var RENDER_ID:uint = 0; - - public var renderId:uint; - public var map:WorldPoint; - public var forceReloadWithoutCache:Boolean; - public var decryptionKey:ByteArray; - public var renderFixture:Boolean; - - public function RenderRequest(map:WorldPoint, forceReloadWithoutCache:Boolean, decryptionKey:ByteArray, renderFixture:Boolean=true) - { - this.renderId = RENDER_ID++; - this.map = map; - this.forceReloadWithoutCache = forceReloadWithoutCache; - this.decryptionKey = decryptionKey; - this.renderFixture = renderFixture; - } - + + function RenderRequest(param1:WorldPoint, param2:Boolean, param3:ByteArray, param4:Boolean = true) + { + super(); + this.renderId = RENDER_ID++; + this.map = param1; + this.forceReloadWithoutCache = param2; + this.decryptionKey = param3; + this.renderFixture = param4; + } + + private static var RENDER_ID:uint = 0; + + public var renderId:uint; + + public var map:WorldPoint; + + public var forceReloadWithoutCache:Boolean; + + public var decryptionKey:ByteArray; + + public var renderFixture:Boolean; } - diff --git a/com/ankamagames/atouin/managers/SelectionManager.as b/com/ankamagames/atouin/managers/SelectionManager.as index 4c0bdb7ed..d1e3537fa 100644 --- a/com/ankamagames/atouin/managers/SelectionManager.as +++ b/com/ankamagames/atouin/managers/SelectionManager.as @@ -1,149 +1,149 @@ -package com.ankamagames.atouin.managers +package com.ankamagames.atouin.managers { - import com.ankamagames.jerakine.logger.Logger; - import com.ankamagames.jerakine.logger.Log; - import flash.utils.getQualifiedClassName; - import com.ankamagames.atouin.utils.errors.AtouinError; - import com.ankamagames.atouin.Atouin; - import com.ankamagames.jerakine.types.events.PropertyChangeEvent; - import com.ankamagames.atouin.types.Selection; - import com.ankamagames.atouin.AtouinConstants; - import __AS3__.vec.Vector; - import com.ankamagames.atouin.renderers.ZoneDARenderer; - import com.ankamagames.atouin.enums.PlacementStrataEnums; - import __AS3__.vec.*; - - public class SelectionManager - { - - private static var _self:SelectionManager; - protected static const _log:Logger = Log.getLogger(getQualifiedClassName(SelectionManager)); - - private var _aSelection:Array; - - public function SelectionManager() - { - if (_self) - { - throw (new AtouinError("SelectionManager is a singleton class. Please acces it through getInstance()")); - }; + import com.ankamagames.jerakine.logger.Logger; + import com.ankamagames.jerakine.logger.Log; + import flash.utils.getQualifiedClassName; + import com.ankamagames.atouin.Atouin; + import com.ankamagames.jerakine.types.events.PropertyChangeEvent; + import com.ankamagames.atouin.types.Selection; + import com.ankamagames.atouin.AtouinConstants; + import com.ankamagames.atouin.renderers.ZoneDARenderer; + import com.ankamagames.atouin.enums.PlacementStrataEnums; + import com.ankamagames.atouin.utils.errors.AtouinError; + + public class SelectionManager extends Object + { + + public function SelectionManager() + { + super(); + if(_self) + { + throw new AtouinError("SelectionManager is a singleton class. Please acces it through getInstance()"); + } + else + { this.init(); - } - - public static function getInstance():SelectionManager - { - if (!(_self)) - { - _self = new (SelectionManager)(); - }; - return (_self); - } - - - public function init():void - { - this._aSelection = new Array(); - Atouin.getInstance().options.addEventListener(PropertyChangeEvent.PROPERTY_CHANGED, this.onPropertyChanged); - } - - public function addSelection(s:Selection, name:String, cellId:uint=561):void - { - if (this._aSelection[name]) - { - Selection(this._aSelection[name]).remove(); - }; - this._aSelection[name] = s; - if (cellId != (AtouinConstants.MAP_CELLS_COUNT + 1)) - { - this.update(name, cellId); - }; - } - - public function getSelection(name:String):Selection - { - return (this._aSelection[name]); - } - - public function update(name:String, cellId:uint=0, updateStrata:Boolean=false):void - { - var aCell:Vector.; - var aOldCells:Vector.; - var s:Selection = this.getSelection(name); - if (!(s)) - { - return; - }; - if (s.zone) + return; + } + } + + private static var _self:SelectionManager; + + protected static const _log:Logger = Log.getLogger(getQualifiedClassName(SelectionManager)); + + public static function getInstance() : SelectionManager + { + if(!_self) + { + _self = new SelectionManager(); + } + return _self; + } + + private var _aSelection:Array; + + public function init() : void + { + this._aSelection = new Array(); + Atouin.getInstance().options.addEventListener(PropertyChangeEvent.PROPERTY_CHANGED,this.onPropertyChanged); + } + + public function addSelection(param1:Selection, param2:String, param3:uint = 561.0) : void + { + if(this._aSelection[param2]) + { + Selection(this._aSelection[param2]).remove(); + } + this._aSelection[param2] = param1; + if(param3 != AtouinConstants.MAP_CELLS_COUNT + 1) + { + this.update(param2,param3); + } + } + + public function getSelection(param1:String) : Selection + { + return this._aSelection[param1]; + } + + public function update(param1:String, param2:uint = 0, param3:Boolean = false) : void + { + var _loc5_:Vector. = null; + var _loc6_:Vector. = null; + var _loc4_:Selection = this.getSelection(param1); + if(!_loc4_) + { + return; + } + if(_loc4_.zone) + { + _loc5_ = _loc4_.zone.getCells(param2); + _loc6_ = !_loc4_.cells?null:_loc4_.cells.concat(); + _loc4_.remove(_loc6_); + _loc4_.cells = _loc5_; + if(_loc4_.renderer) { - aCell = s.zone.getCells(cellId); - aOldCells = ((!(s.cells)) ? null : s.cells.concat()); - s.remove(aOldCells); - s.cells = aCell; - if (s.renderer) - { - s.update(updateStrata); - } - else - { - _log.error((("No renderer set for selection [" + name) + "]")); - }; + _loc4_.update(param3); } else { - _log.error((("No zone set for selection [" + name) + "]")); - }; - } - - public function isInside(cellId:uint, selectionName:String):Boolean - { - var s:Selection = this.getSelection(selectionName); - if (!(s)) - { - return (false); - }; - return (s.isInside(cellId)); - } - - private function onPropertyChanged(pEvent:PropertyChangeEvent):void - { - var s:Selection; - var renderer:ZoneDARenderer; - if (pEvent.propertyName == "transparentOverlayMode") + _log.error("No renderer set for selection [" + param1 + "]"); + } + } + else + { + _log.error("No zone set for selection [" + param1 + "]"); + } + } + + public function isInside(param1:uint, param2:String) : Boolean + { + var _loc3_:Selection = this.getSelection(param2); + if(!_loc3_) + { + return false; + } + return _loc3_.isInside(param1); + } + + private function onPropertyChanged(param1:PropertyChangeEvent) : void + { + var _loc2_:Selection = null; + var _loc3_:ZoneDARenderer = null; + if(param1.propertyName == "transparentOverlayMode") + { + for each(_loc2_ in this._aSelection) { - for each (s in this._aSelection) - { - renderer = (s.renderer as ZoneDARenderer); - if (((((renderer) && (s.visible))) && (!(renderer.fixedStrata)))) - { - if (pEvent.propertyValue == true) - { - renderer.currentStrata = PlacementStrataEnums.STRATA_NO_Z_ORDER; - } - else - { - renderer.restoreStrata(); - }; - s.update(true); - }; - }; - }; - } - - private function diff(a1:Vector., a2:Vector.):Vector. - { - var elem:*; - var res:Vector. = new Vector.(); - for each (elem in a2) + _loc3_ = _loc2_.renderer as ZoneDARenderer; + if((_loc3_) && (_loc2_.visible) && !_loc3_.fixedStrata) + { + if(param1.propertyValue == true) + { + _loc3_.currentStrata = PlacementStrataEnums.STRATA_NO_Z_ORDER; + } + else + { + _loc3_.restoreStrata(); + } + _loc2_.update(true); + } + } + } + } + + private function diff(param1:Vector., param2:Vector.) : Vector. + { + var _loc4_:* = undefined; + var _loc3_:Vector. = new Vector.(); + for each(_loc4_ in param2) + { + if(-1 == param1.indexOf(_loc4_)) { - if (-1 == a1.indexOf(elem)) - { - res.push(elem); - }; - }; - return (res); - } - - - } -}//package com.ankamagames.atouin.managers - + _loc3_.push(_loc4_); + } + } + return _loc3_; + } + } +} diff --git a/com/ankamagames/atouin/messages/AdjacentMapClickMessage.as b/com/ankamagames/atouin/messages/AdjacentMapClickMessage.as index bc5988dc5..dbec864b5 100644 --- a/com/ankamagames/atouin/messages/AdjacentMapClickMessage.as +++ b/com/ankamagames/atouin/messages/AdjacentMapClickMessage.as @@ -1,14 +1,17 @@ -package com.ankamagames.atouin.messages +package com.ankamagames.atouin.messages { - import com.ankamagames.jerakine.messages.Message; - - public class AdjacentMapClickMessage implements Message - { - - public var adjacentMapId:uint; - public var cellId:uint; - - - } -}//package com.ankamagames.atouin.messages - + import com.ankamagames.jerakine.messages.Message; + + public class AdjacentMapClickMessage extends Object implements Message + { + + public function AdjacentMapClickMessage() + { + super(); + } + + public var adjacentMapId:uint; + + public var cellId:uint; + } +} diff --git a/com/ankamagames/atouin/messages/AdjacentMapOutMessage.as b/com/ankamagames/atouin/messages/AdjacentMapOutMessage.as index 75cb7998e..fda0a5ae1 100644 --- a/com/ankamagames/atouin/messages/AdjacentMapOutMessage.as +++ b/com/ankamagames/atouin/messages/AdjacentMapOutMessage.as @@ -1,31 +1,30 @@ -package com.ankamagames.atouin.messages +package com.ankamagames.atouin.messages { - import com.ankamagames.jerakine.messages.Message; - import flash.display.DisplayObject; - - public class AdjacentMapOutMessage implements Message - { - - private var _nDirection:uint; - private var _spZone:DisplayObject; - - public function AdjacentMapOutMessage(nDirection:uint, zone:DisplayObject) - { - this._nDirection = nDirection; - this._spZone = zone; - } - - public function get direction():uint - { - return (this._nDirection); - } - - public function get zone():DisplayObject - { - return (this._spZone); - } - - - } -}//package com.ankamagames.atouin.messages - + import com.ankamagames.jerakine.messages.Message; + import flash.display.DisplayObject; + + public class AdjacentMapOutMessage extends Object implements Message + { + + public function AdjacentMapOutMessage(param1:uint, param2:DisplayObject) + { + super(); + this._nDirection = param1; + this._spZone = param2; + } + + private var _nDirection:uint; + + private var _spZone:DisplayObject; + + public function get direction() : uint + { + return this._nDirection; + } + + public function get zone() : DisplayObject + { + return this._spZone; + } + } +} diff --git a/com/ankamagames/atouin/messages/AdjacentMapOverMessage.as b/com/ankamagames/atouin/messages/AdjacentMapOverMessage.as index 40cb902f6..b881b6d52 100644 --- a/com/ankamagames/atouin/messages/AdjacentMapOverMessage.as +++ b/com/ankamagames/atouin/messages/AdjacentMapOverMessage.as @@ -1,47 +1,49 @@ -package com.ankamagames.atouin.messages +package com.ankamagames.atouin.messages { - import com.ankamagames.jerakine.messages.Message; - import flash.display.DisplayObject; - import com.ankamagames.atouin.data.map.CellData; - - public class AdjacentMapOverMessage implements Message - { - - private var _nDirection:uint; - private var _spZone:DisplayObject; - private var _cellId:int; - private var _cellData:CellData; - private var _neighborMapId:uint; - - public function AdjacentMapOverMessage(nDirection:uint, zone:DisplayObject, cellId:int, cellData:CellData) - { - this._nDirection = nDirection; - this._spZone = zone; - this._cellId = cellId; - this._cellData = cellData; - } - - public function get direction():uint - { - return (this._nDirection); - } - - public function get zone():DisplayObject - { - return (this._spZone); - } - - public function get cellId():int - { - return (this._cellId); - } - - public function get cellData():CellData - { - return (this._cellData); - } - - - } -}//package com.ankamagames.atouin.messages - + import com.ankamagames.jerakine.messages.Message; + import flash.display.DisplayObject; + import com.ankamagames.atouin.data.map.CellData; + + public class AdjacentMapOverMessage extends Object implements Message + { + + public function AdjacentMapOverMessage(param1:uint, param2:DisplayObject, param3:int, param4:CellData) + { + super(); + this._nDirection = param1; + this._spZone = param2; + this._cellId = param3; + this._cellData = param4; + } + + private var _nDirection:uint; + + private var _spZone:DisplayObject; + + private var _cellId:int; + + private var _cellData:CellData; + + private var _neighborMapId:uint; + + public function get direction() : uint + { + return this._nDirection; + } + + public function get zone() : DisplayObject + { + return this._spZone; + } + + public function get cellId() : int + { + return this._cellId; + } + + public function get cellData() : CellData + { + return this._cellData; + } + } +} diff --git a/com/ankamagames/atouin/messages/CellClickMessage.as b/com/ankamagames/atouin/messages/CellClickMessage.as index e877b5bfe..2cb0960a1 100644 --- a/com/ankamagames/atouin/messages/CellClickMessage.as +++ b/com/ankamagames/atouin/messages/CellClickMessage.as @@ -1,14 +1,13 @@ -package com.ankamagames.atouin.messages +package com.ankamagames.atouin.messages { - public class CellClickMessage extends CellInteractionMessage - { - - public function CellClickMessage(cellId:uint=0, mapId:uint=0) - { - this.cellId = cellId; - this.id = mapId; - } - - } -}//package com.ankamagames.atouin.messages - + public class CellClickMessage extends CellInteractionMessage + { + + public function CellClickMessage(param1:uint = 0, param2:uint = 0) + { + super(); + this.cellId = param1; + this.id = param2; + } + } +} diff --git a/com/ankamagames/atouin/messages/CellInteractionMessage.as b/com/ankamagames/atouin/messages/CellInteractionMessage.as index c600e71d5..e7bc86907 100644 --- a/com/ankamagames/atouin/messages/CellInteractionMessage.as +++ b/com/ankamagames/atouin/messages/CellInteractionMessage.as @@ -1,58 +1,62 @@ -package com.ankamagames.atouin.messages +package com.ankamagames.atouin.messages { - import flash.display.Sprite; - import com.ankamagames.jerakine.types.positions.MapPoint; - - public class CellInteractionMessage extends MapMessage - { - - private var _cellId:uint; - private var _cellDepth:uint; - private var _cellContainer:Sprite; - private var _cellCoords:MapPoint; - - - public function get cellId():uint - { - return (this._cellId); - } - - public function set cellId(nValue:uint):void - { - this._cellId = nValue; - } - - public function get cellContainer():Sprite - { - return (this._cellContainer); - } - - public function set cellContainer(sSprite:Sprite):void - { - this._cellContainer = sSprite; - } - - public function get cellDepth():uint - { - return (this._cellDepth); - } - - public function set cellDepth(nValue:uint):void - { - this._cellDepth = nValue; - } - - public function get cell():MapPoint - { - return (this._cellCoords); - } - - public function set cell(pValue:MapPoint):void - { - this._cellCoords = pValue; - } - - - } -}//package com.ankamagames.atouin.messages - + import flash.display.Sprite; + import com.ankamagames.jerakine.types.positions.MapPoint; + + public class CellInteractionMessage extends MapMessage + { + + public function CellInteractionMessage() + { + super(); + } + + private var _cellId:uint; + + private var _cellDepth:uint; + + private var _cellContainer:Sprite; + + private var _cellCoords:MapPoint; + + public function get cellId() : uint + { + return this._cellId; + } + + public function set cellId(param1:uint) : void + { + this._cellId = param1; + } + + public function get cellContainer() : Sprite + { + return this._cellContainer; + } + + public function set cellContainer(param1:Sprite) : void + { + this._cellContainer = param1; + } + + public function get cellDepth() : uint + { + return this._cellDepth; + } + + public function set cellDepth(param1:uint) : void + { + this._cellDepth = param1; + } + + public function get cell() : MapPoint + { + return this._cellCoords; + } + + public function set cell(param1:MapPoint) : void + { + this._cellCoords = param1; + } + } +} diff --git a/com/ankamagames/atouin/messages/CellOutMessage.as b/com/ankamagames/atouin/messages/CellOutMessage.as index 7661b9e69..ec4f90c18 100644 --- a/com/ankamagames/atouin/messages/CellOutMessage.as +++ b/com/ankamagames/atouin/messages/CellOutMessage.as @@ -1,9 +1,11 @@ -package com.ankamagames.atouin.messages +package com.ankamagames.atouin.messages { - public class CellOutMessage extends CellInteractionMessage - { - - - } -}//package com.ankamagames.atouin.messages - + public class CellOutMessage extends CellInteractionMessage + { + + public function CellOutMessage() + { + super(); + } + } +} diff --git a/com/ankamagames/atouin/messages/CellOverMessage.as b/com/ankamagames/atouin/messages/CellOverMessage.as index ec6a4e1fc..7de05054c 100644 --- a/com/ankamagames/atouin/messages/CellOverMessage.as +++ b/com/ankamagames/atouin/messages/CellOverMessage.as @@ -1,9 +1,11 @@ -package com.ankamagames.atouin.messages +package com.ankamagames.atouin.messages { - public class CellOverMessage extends CellInteractionMessage - { - - - } -}//package com.ankamagames.atouin.messages - + public class CellOverMessage extends CellInteractionMessage + { + + public function CellOverMessage() + { + super(); + } + } +} diff --git a/com/ankamagames/atouin/messages/EntityMovementCompleteMessage.as b/com/ankamagames/atouin/messages/EntityMovementCompleteMessage.as index 090c36c30..ccb436a06 100644 --- a/com/ankamagames/atouin/messages/EntityMovementCompleteMessage.as +++ b/com/ankamagames/atouin/messages/EntityMovementCompleteMessage.as @@ -1,30 +1,29 @@ -package com.ankamagames.atouin.messages +package com.ankamagames.atouin.messages { - import com.ankamagames.jerakine.messages.Message; - import com.ankamagames.jerakine.messages.ILogableMessage; - import com.ankamagames.jerakine.entities.interfaces.IEntity; - - public class EntityMovementCompleteMessage implements Message, ILogableMessage - { - - private var _entity:IEntity; - public var id:int; - - public function EntityMovementCompleteMessage(entity:IEntity=null) - { - this._entity = entity; - if (this._entity) - { - this.id = entity.id; - }; - } - - public function get entity():IEntity - { - return (this._entity); - } - - - } -}//package com.ankamagames.atouin.messages - + import com.ankamagames.jerakine.messages.Message; + import com.ankamagames.jerakine.messages.ILogableMessage; + import com.ankamagames.jerakine.entities.interfaces.IEntity; + + public class EntityMovementCompleteMessage extends Object implements Message, ILogableMessage + { + + public function EntityMovementCompleteMessage(param1:IEntity = null) + { + super(); + this._entity = param1; + if(this._entity) + { + this.id = param1.id; + } + } + + private var _entity:IEntity; + + public function get entity() : IEntity + { + return this._entity; + } + + public var id:int; + } +} diff --git a/com/ankamagames/atouin/messages/EntityMovementStartMessage.as b/com/ankamagames/atouin/messages/EntityMovementStartMessage.as index 0d4ddc2a0..329a3233b 100644 --- a/com/ankamagames/atouin/messages/EntityMovementStartMessage.as +++ b/com/ankamagames/atouin/messages/EntityMovementStartMessage.as @@ -1,30 +1,29 @@ -package com.ankamagames.atouin.messages +package com.ankamagames.atouin.messages { - import com.ankamagames.jerakine.messages.Message; - import com.ankamagames.jerakine.messages.ILogableMessage; - import com.ankamagames.jerakine.entities.interfaces.IEntity; - - public class EntityMovementStartMessage implements Message, ILogableMessage - { - - private var _entity:IEntity; - public var id:int; - - public function EntityMovementStartMessage(entity:IEntity=null) - { - this._entity = entity; - if (this._entity) - { - this.id = entity.id; - }; - } - - public function get entity():IEntity - { - return (this._entity); - } - - - } -}//package com.ankamagames.atouin.messages - + import com.ankamagames.jerakine.messages.Message; + import com.ankamagames.jerakine.messages.ILogableMessage; + import com.ankamagames.jerakine.entities.interfaces.IEntity; + + public class EntityMovementStartMessage extends Object implements Message, ILogableMessage + { + + public function EntityMovementStartMessage(param1:IEntity = null) + { + super(); + this._entity = param1; + if(this._entity) + { + this.id = param1.id; + } + } + + private var _entity:IEntity; + + public function get entity() : IEntity + { + return this._entity; + } + + public var id:int; + } +} diff --git a/com/ankamagames/atouin/messages/EntityMovementStoppedMessage.as b/com/ankamagames/atouin/messages/EntityMovementStoppedMessage.as index 747962f43..9ec9ab2e2 100644 --- a/com/ankamagames/atouin/messages/EntityMovementStoppedMessage.as +++ b/com/ankamagames/atouin/messages/EntityMovementStoppedMessage.as @@ -1,29 +1,28 @@ -package com.ankamagames.atouin.messages +package com.ankamagames.atouin.messages { - import com.ankamagames.jerakine.messages.Message; - import com.ankamagames.jerakine.entities.interfaces.IEntity; - - public class EntityMovementStoppedMessage implements Message - { - - private var _entity:IEntity; - public var id:int; - - public function EntityMovementStoppedMessage(entity:IEntity) - { - this._entity = entity; - if (this._entity) - { - this.id = entity.id; - }; - } - - public function get entity():IEntity - { - return (this._entity); - } - - - } -}//package com.ankamagames.atouin.messages - + import com.ankamagames.jerakine.messages.Message; + import com.ankamagames.jerakine.entities.interfaces.IEntity; + + public class EntityMovementStoppedMessage extends Object implements Message + { + + public function EntityMovementStoppedMessage(param1:IEntity) + { + super(); + this._entity = param1; + if(this._entity) + { + this.id = param1.id; + } + } + + private var _entity:IEntity; + + public function get entity() : IEntity + { + return this._entity; + } + + public var id:int; + } +} diff --git a/com/ankamagames/atouin/messages/MapContainerRollOutMessage.as b/com/ankamagames/atouin/messages/MapContainerRollOutMessage.as index 472840ab5..7cda30bac 100644 --- a/com/ankamagames/atouin/messages/MapContainerRollOutMessage.as +++ b/com/ankamagames/atouin/messages/MapContainerRollOutMessage.as @@ -1,11 +1,13 @@ -package com.ankamagames.atouin.messages +package com.ankamagames.atouin.messages { - import com.ankamagames.jerakine.messages.Message; - - public class MapContainerRollOutMessage implements Message - { - - - } -}//package com.ankamagames.atouin.messages - + import com.ankamagames.jerakine.messages.Message; + + public class MapContainerRollOutMessage extends Object implements Message + { + + public function MapContainerRollOutMessage() + { + super(); + } + } +} diff --git a/com/ankamagames/atouin/messages/MapContainerRollOverMessage.as b/com/ankamagames/atouin/messages/MapContainerRollOverMessage.as index 969b966b9..9efc3f5e2 100644 --- a/com/ankamagames/atouin/messages/MapContainerRollOverMessage.as +++ b/com/ankamagames/atouin/messages/MapContainerRollOverMessage.as @@ -1,11 +1,13 @@ -package com.ankamagames.atouin.messages +package com.ankamagames.atouin.messages { - import com.ankamagames.jerakine.messages.Message; - - public class MapContainerRollOverMessage implements Message - { - - - } -}//package com.ankamagames.atouin.messages - + import com.ankamagames.jerakine.messages.Message; + + public class MapContainerRollOverMessage extends Object implements Message + { + + public function MapContainerRollOverMessage() + { + super(); + } + } +} diff --git a/com/ankamagames/atouin/messages/MapLoadedMessage.as b/com/ankamagames/atouin/messages/MapLoadedMessage.as index 98676d2be..29bd15141 100644 --- a/com/ankamagames/atouin/messages/MapLoadedMessage.as +++ b/com/ankamagames/atouin/messages/MapLoadedMessage.as @@ -1,16 +1,21 @@ -package com.ankamagames.atouin.messages +package com.ankamagames.atouin.messages { - import com.ankamagames.jerakine.messages.ILogableMessage; - - public class MapLoadedMessage extends MapMessage implements ILogableMessage - { - - public var globalRenderingTime:uint; - public var dataLoadingTime:uint; - public var gfxLoadingTime:uint; - public var renderingTime:uint; - - - } -}//package com.ankamagames.atouin.messages - + import com.ankamagames.jerakine.messages.ILogableMessage; + + public class MapLoadedMessage extends MapMessage implements ILogableMessage + { + + public function MapLoadedMessage() + { + super(); + } + + public var globalRenderingTime:uint; + + public var dataLoadingTime:uint; + + public var gfxLoadingTime:uint; + + public var renderingTime:uint; + } +} diff --git a/com/ankamagames/atouin/messages/MapLoadingFailedMessage.as b/com/ankamagames/atouin/messages/MapLoadingFailedMessage.as index f1990f52d..09099e1a6 100644 --- a/com/ankamagames/atouin/messages/MapLoadingFailedMessage.as +++ b/com/ankamagames/atouin/messages/MapLoadingFailedMessage.as @@ -1,14 +1,17 @@ -package com.ankamagames.atouin.messages +package com.ankamagames.atouin.messages { - public class MapLoadingFailedMessage extends MapMessage - { - - public static const NO_FILE:uint = 0; - public static const CLIENT_SHUTDOWN:uint = 1; - - public var errorReason:uint; - - - } -}//package com.ankamagames.atouin.messages - + public class MapLoadingFailedMessage extends MapMessage + { + + public function MapLoadingFailedMessage() + { + super(); + } + + public static const NO_FILE:uint = 0; + + public static const CLIENT_SHUTDOWN:uint = 1; + + public var errorReason:uint; + } +} diff --git a/com/ankamagames/atouin/messages/MapMessage.as b/com/ankamagames/atouin/messages/MapMessage.as index 48f8fb688..7e703de91 100644 --- a/com/ankamagames/atouin/messages/MapMessage.as +++ b/com/ankamagames/atouin/messages/MapMessage.as @@ -1,36 +1,39 @@ -package com.ankamagames.atouin.messages +package com.ankamagames.atouin.messages { - import com.ankamagames.jerakine.messages.Message; - - public class MapMessage implements Message - { - - private var _id:uint; - private var _transitionType:String; - public var renderRequestId:uint; - - - public function get id():uint - { - return (this._id); - } - - public function set id(nValue:uint):void - { - this._id = nValue; - } - - public function get transitionType():String - { - return (this._transitionType); - } - - public function set transitionType(sValue:String):void - { - this._transitionType = sValue; - } - - - } -}//package com.ankamagames.atouin.messages - + import com.ankamagames.jerakine.messages.Message; + + public class MapMessage extends Object implements Message + { + + public function MapMessage() + { + super(); + } + + private var _id:uint; + + private var _transitionType:String; + + public var renderRequestId:uint; + + public function get id() : uint + { + return this._id; + } + + public function set id(param1:uint) : void + { + this._id = param1; + } + + public function get transitionType() : String + { + return this._transitionType; + } + + public function set transitionType(param1:String) : void + { + this._transitionType = param1; + } + } +} diff --git a/com/ankamagames/atouin/messages/MapRenderProgressMessage.as b/com/ankamagames/atouin/messages/MapRenderProgressMessage.as index 9acf5dc83..48464bf0e 100644 --- a/com/ankamagames/atouin/messages/MapRenderProgressMessage.as +++ b/com/ankamagames/atouin/messages/MapRenderProgressMessage.as @@ -1,21 +1,19 @@ -package com.ankamagames.atouin.messages +package com.ankamagames.atouin.messages { - public class MapRenderProgressMessage extends MapMessage - { - - private var _percent:Number = 0; - - public function MapRenderProgressMessage(percent:Number) - { - this._percent = percent; - } - - public function get percent():Number - { - return (this._percent); - } - - - } -}//package com.ankamagames.atouin.messages - + public class MapRenderProgressMessage extends MapMessage + { + + public function MapRenderProgressMessage(param1:Number) + { + super(); + this._percent = param1; + } + + private var _percent:Number = 0; + + public function get percent() : Number + { + return this._percent; + } + } +} diff --git a/com/ankamagames/atouin/messages/MapZoomMessage.as b/com/ankamagames/atouin/messages/MapZoomMessage.as index 98ef559d3..a878b3938 100644 --- a/com/ankamagames/atouin/messages/MapZoomMessage.as +++ b/com/ankamagames/atouin/messages/MapZoomMessage.as @@ -1,37 +1,37 @@ -package com.ankamagames.atouin.messages +package com.ankamagames.atouin.messages { - import com.ankamagames.jerakine.messages.Message; - - public class MapZoomMessage implements Message - { - - private var _value:Number; - private var _posX:int; - private var _posY:int; - - public function MapZoomMessage(value:Number, posX:int, posY:int) - { - this._value = value; - this._posX = posX; - this._posY = posY; - } - - public function get value():Number - { - return (this._value); - } - - public function get posX():int - { - return (this._posX); - } - - public function get posY():int - { - return (this._posY); - } - - - } -}//package com.ankamagames.atouin.messages - + import com.ankamagames.jerakine.messages.Message; + + public class MapZoomMessage extends Object implements Message + { + + public function MapZoomMessage(param1:Number, param2:int, param3:int) + { + super(); + this._value = param1; + this._posX = param2; + this._posY = param3; + } + + private var _value:Number; + + private var _posX:int; + + private var _posY:int; + + public function get value() : Number + { + return this._value; + } + + public function get posX() : int + { + return this._posX; + } + + public function get posY() : int + { + return this._posY; + } + } +} diff --git a/com/ankamagames/atouin/messages/MapsLoadingCompleteMessage.as b/com/ankamagames/atouin/messages/MapsLoadingCompleteMessage.as index 66fc3b47d..66045a2f4 100644 --- a/com/ankamagames/atouin/messages/MapsLoadingCompleteMessage.as +++ b/com/ankamagames/atouin/messages/MapsLoadingCompleteMessage.as @@ -1,31 +1,30 @@ -package com.ankamagames.atouin.messages +package com.ankamagames.atouin.messages { - import com.ankamagames.jerakine.types.positions.WorldPoint; - import com.ankamagames.atouin.data.map.Map; - - public class MapsLoadingCompleteMessage extends MapMessage - { - - private var _map:WorldPoint; - private var _mapData:Map; - - public function MapsLoadingCompleteMessage(mapPoint:WorldPoint, mapData:Map):void - { - this._map = mapPoint; - this._mapData = mapData; - } - - public function get mapPoint():WorldPoint - { - return (this._map); - } - - public function get mapData():Map - { - return (this._mapData); - } - - - } -}//package com.ankamagames.atouin.messages - + import com.ankamagames.jerakine.types.positions.WorldPoint; + import com.ankamagames.atouin.data.map.Map; + + public class MapsLoadingCompleteMessage extends MapMessage + { + + public function MapsLoadingCompleteMessage(param1:WorldPoint, param2:Map) + { + super(); + this._map = param1; + this._mapData = param2; + } + + private var _map:WorldPoint; + + private var _mapData:Map; + + public function get mapPoint() : WorldPoint + { + return this._map; + } + + public function get mapData() : Map + { + return this._mapData; + } + } +} diff --git a/com/ankamagames/atouin/messages/MapsLoadingStartedMessage.as b/com/ankamagames/atouin/messages/MapsLoadingStartedMessage.as index 9f3025fc1..2d9bd8149 100644 --- a/com/ankamagames/atouin/messages/MapsLoadingStartedMessage.as +++ b/com/ankamagames/atouin/messages/MapsLoadingStartedMessage.as @@ -1,9 +1,11 @@ -package com.ankamagames.atouin.messages +package com.ankamagames.atouin.messages { - public class MapsLoadingStartedMessage extends MapMessage - { - - - } -}//package com.ankamagames.atouin.messages - + public class MapsLoadingStartedMessage extends MapMessage + { + + public function MapsLoadingStartedMessage() + { + super(); + } + } +} diff --git a/com/ankamagames/atouin/renderers/CellLinkRenderer.as b/com/ankamagames/atouin/renderers/CellLinkRenderer.as index 37b845be2..99a833d19 100644 --- a/com/ankamagames/atouin/renderers/CellLinkRenderer.as +++ b/com/ankamagames/atouin/renderers/CellLinkRenderer.as @@ -1,97 +1,98 @@ -package com.ankamagames.atouin.renderers +package com.ankamagames.atouin.renderers { - import com.ankamagames.atouin.utils.IZoneRenderer; - import __AS3__.vec.Vector; - import com.ankamagames.atouin.data.map.Cell; - import com.ankamagames.atouin.types.CellLink; - import flash.geom.Point; - import com.ankamagames.jerakine.types.positions.MapPoint; - import com.ankamagames.atouin.utils.CellUtil; - import com.ankamagames.jerakine.types.Color; - import com.ankamagames.atouin.types.DataMapContainer; - import __AS3__.vec.*; - - public class CellLinkRenderer implements IZoneRenderer - { - - public var strata:uint; - public var cells:Vector.; - private var _cellLinks:Vector.; - private var _useThicknessMalus:Boolean; - private var _thickness:Number; - private var _alpha:Number; - - public function CellLinkRenderer(thickness:Number=10, alpha:Number=1, useThicknessMalus:Boolean=false, nStrata:uint=160) - { - this.strata = nStrata; - this._thickness = thickness; - this._alpha = alpha; - this._useThicknessMalus = useThicknessMalus; - } - - public function render(cells:Vector., oColor:Color, mapContainer:DataMapContainer, alpha:Boolean=false, updateStrata:Boolean=false):void - { - var cellLink:CellLink; - var p1:Point; - var p2:Point; - var lineToPoint:Point; - var start:MapPoint; - var end:MapPoint; - var i:int; - this._cellLinks = new Vector.(); - var orderedCheckPoints:Vector. = new Vector.(); - while (cells.length) + import com.ankamagames.atouin.utils.IZoneRenderer; + import com.ankamagames.atouin.data.map.Cell; + import com.ankamagames.atouin.types.CellLink; + import com.ankamagames.jerakine.types.Color; + import com.ankamagames.atouin.types.DataMapContainer; + import flash.geom.Point; + import com.ankamagames.jerakine.types.positions.MapPoint; + import com.ankamagames.atouin.utils.CellUtil; + + public class CellLinkRenderer extends Object implements IZoneRenderer + { + + public function CellLinkRenderer(param1:Number = 10, param2:Number = 1, param3:Boolean = false, param4:uint = 160) + { + super(); + this.strata = param4; + this._thickness = param1; + this._alpha = param2; + this._useThicknessMalus = param3; + } + + public var strata:uint; + + public var cells:Vector.; + + private var _cellLinks:Vector.; + + private var _useThicknessMalus:Boolean; + + private var _thickness:Number; + + private var _alpha:Number; + + public function render(param1:Vector., param2:Color, param3:DataMapContainer, param4:Boolean = false, param5:Boolean = false) : void + { + var _loc7_:CellLink = null; + var _loc8_:Point = null; + var _loc9_:Point = null; + var _loc10_:Point = null; + var _loc11_:MapPoint = null; + var _loc12_:MapPoint = null; + var _loc14_:* = 0; + this._cellLinks = new Vector.(); + var _loc6_:Vector. = new Vector.(); + while(param1.length) + { + _loc6_.push(MapPoint.fromCellId(param1.shift())); + } + var _loc13_:Number = this._thickness; + var _loc15_:int = _loc6_.length - 1; + _loc14_ = 0; + while(_loc14_ < _loc15_) + { + _loc8_ = CellUtil.getPixelsPointFromMapPoint(_loc6_[_loc14_],false); + _loc9_ = CellUtil.getPixelsPointFromMapPoint(_loc6_[_loc14_ + 1],false); + if(_loc8_.y > _loc9_.y || _loc8_.y == _loc9_.y && _loc8_.x > _loc9_.x) { - orderedCheckPoints.push(MapPoint.fromCellId(cells.shift())); - }; - var thickness:Number = this._thickness; - var l:int = (orderedCheckPoints.length - 1); - i = 0; - while (i < l) + _loc11_ = _loc6_[_loc14_]; + _loc12_ = _loc6_[_loc14_ + 1]; + _loc10_ = new Point(_loc9_.x - _loc8_.x,_loc9_.y - _loc8_.y); + } + else { - p1 = CellUtil.getPixelsPointFromMapPoint(orderedCheckPoints[i], false); - p2 = CellUtil.getPixelsPointFromMapPoint(orderedCheckPoints[(i + 1)], false); - if ((((p1.y > p2.y)) || ((((p1.y == p2.y)) && ((p1.x > p2.x)))))) - { - start = orderedCheckPoints[i]; - end = orderedCheckPoints[(i + 1)]; - lineToPoint = new Point((p2.x - p1.x), (p2.y - p1.y)); - } - else - { - start = orderedCheckPoints[(i + 1)]; - end = orderedCheckPoints[i]; - lineToPoint = new Point((p1.x - p2.x), (p1.y - p2.y)); - }; - cellLink = new CellLink(); - cellLink.graphics.lineStyle(thickness, oColor.color, this._alpha); - cellLink.graphics.moveTo(0, 0); - cellLink.graphics.lineTo(lineToPoint.x, lineToPoint.y); - cellLink.orderedCheckpoints = new [start, end]; - cellLink.display(this.strata); - this._cellLinks.push(cellLink); - thickness = (thickness - 2); - if (thickness < 1) - { - thickness = 1; - }; - i++; - }; - } - - public function remove(cells:Vector., mapContainer:DataMapContainer):void - { - if (this._cellLinks) + _loc11_ = _loc6_[_loc14_ + 1]; + _loc12_ = _loc6_[_loc14_]; + _loc10_ = new Point(_loc8_.x - _loc9_.x,_loc8_.y - _loc9_.y); + } + _loc7_ = new CellLink(); + _loc7_.graphics.lineStyle(_loc13_,param2.color,this._alpha); + _loc7_.graphics.moveTo(0,0); + _loc7_.graphics.lineTo(_loc10_.x,_loc10_.y); + _loc7_.orderedCheckpoints = new [_loc11_,_loc12_]; + _loc7_.display(this.strata); + this._cellLinks.push(_loc7_); + _loc13_ = _loc13_ - 2; + if(_loc13_ < 1) { - while (this._cellLinks.length) - { - this._cellLinks.pop().remove(); - }; - }; - this._cellLinks = null; - } - - - } -}//package com.ankamagames.atouin.renderers - + _loc13_ = 1; + } + _loc14_++; + } + } + + public function remove(param1:Vector., param2:DataMapContainer) : void + { + if(this._cellLinks) + { + while(this._cellLinks.length) + { + this._cellLinks.pop().remove(); + } + } + this._cellLinks = null; + } + } +} diff --git a/com/ankamagames/atouin/renderers/MapRenderer.as b/com/ankamagames/atouin/renderers/MapRenderer.as index a8a459826..4fd960bcd 100644 --- a/com/ankamagames/atouin/renderers/MapRenderer.as +++ b/com/ankamagames/atouin/renderers/MapRenderer.as @@ -1,1249 +1,1297 @@ -package com.ankamagames.atouin.renderers +package com.ankamagames.atouin.renderers { - import flash.events.EventDispatcher; - import flash.utils.Dictionary; - import com.ankamagames.jerakine.logger.Logger; - import com.ankamagames.jerakine.logger.Log; - import flash.utils.getQualifiedClassName; - import flash.geom.Point; - import flash.display.DisplayObjectContainer; - import com.ankamagames.atouin.data.elements.Elements; - import com.ankamagames.jerakine.resources.loaders.IResourceLoader; - import com.ankamagames.atouin.data.map.Map; - import com.ankamagames.atouin.types.DataMapContainer; - import com.ankamagames.atouin.managers.InteractiveCellManager; - import flash.display.Sprite; - import flash.display.Shape; - import flash.utils.Timer; - import flash.display.Bitmap; - import flash.geom.ColorTransform; - import flash.geom.Matrix; - import flash.geom.Rectangle; - import flash.display.BitmapData; - import com.ankamagames.atouin.Atouin; - import com.ankamagames.jerakine.data.XmlConfig; - import com.ankamagames.jerakine.utils.display.StageShareManager; - import com.ankamagames.jerakine.resources.loaders.ResourceLoaderFactory; - import com.ankamagames.jerakine.resources.loaders.ResourceLoaderType; - import com.ankamagames.jerakine.resources.events.ResourceLoaderProgressEvent; - import com.ankamagames.jerakine.resources.events.ResourceLoadedEvent; - import com.ankamagames.jerakine.resources.events.ResourceErrorEvent; - import flash.events.TimerEvent; - import com.ankamagames.jerakine.types.Uri; - import com.ankamagames.atouin.data.elements.subtypes.NormalGraphicalElementData; - import flash.system.ApplicationDomain; - import com.ankamagames.atouin.data.elements.GraphicalElementData; - import com.ankamagames.atouin.data.map.Fixture; - import com.ankamagames.atouin.managers.AnimatedElementManager; - import com.ankamagames.jerakine.utils.system.AirScanner; - import com.ankamagames.atouin.managers.DataGroundMapManager; - import com.ankamagames.atouin.AtouinConstants; - import com.ankamagames.atouin.enums.GroundCache; - import com.ankamagames.atouin.data.elements.subtypes.AnimatedGraphicalElementData; - import flash.system.LoaderContext; - import com.ankamagames.atouin.types.events.RenderMapEvent; - import com.ankamagames.jerakine.resources.adapters.impl.AdvancedSwfAdapter; - import com.ankamagames.tiphon.display.RasterizedAnimation; - import flash.display.DisplayObject; - import com.ankamagames.atouin.types.LayerContainer; - import com.ankamagames.atouin.types.CellReference; - import com.ankamagames.atouin.types.ICellContainer; - import com.ankamagames.atouin.data.map.Cell; - import com.ankamagames.atouin.data.map.Layer; - import com.ankamagames.atouin.managers.EntitiesManager; - import com.ankamagames.jerakine.managers.OptionManager; - import com.ankamagames.atouin.types.BitmapCellContainer; - import com.ankamagames.atouin.types.CellContainer; - import com.ankamagames.atouin.types.InteractiveCell; - import com.ankamagames.atouin.data.map.CellData; - import flash.utils.getTimer; - import com.ankamagames.atouin.managers.MapDisplayManager; - import com.ankamagames.atouin.data.map.elements.GraphicalElement; - import com.ankamagames.atouin.data.map.elements.BasicElement; - import com.ankamagames.atouin.data.elements.subtypes.EntityGraphicalElementData; - import com.ankamagames.tiphon.types.look.TiphonEntityLook; - import com.ankamagames.atouin.types.WorldEntitySprite; - import com.ankamagames.atouin.data.elements.subtypes.ParticlesGraphicalElementData; - import org.flintparticles.twoD.renderers.DisplayObjectRenderer; - import com.ankamagames.jerakine.types.ASwf; - import flash.display.MovieClip; - import com.ankamagames.jerakine.utils.display.FpsControler; - import com.ankamagames.jerakine.utils.display.MovieClipUtils; - import com.ankamagames.atouin.types.MapGfxBitmap; - import com.ankamagames.atouin.data.elements.subtypes.BoundingBoxGraphicalElementData; - import flash.display.InteractiveObject; - import com.ankamagames.atouin.data.elements.subtypes.BlendedGraphicalElementData; - import com.ankamagames.jerakine.script.ScriptExec; - import com.ankamagames.sweevo.runners.EmitterRunner; - import com.ankamagames.atouin.types.SpriteWrapper; - import com.ankamagames.jerakine.types.positions.MapPoint; - import com.ankamagames.atouin.enums.ElementTypesEnum; - import com.ankamagames.jerakine.managers.ErrorManager; - import flash.events.Event; - import flash.events.ProgressEvent; - - [Event(name="MAP_RENDER_START", type="com.ankamagames.atouin.types.events.RenderMapEvent")] - public class MapRenderer extends EventDispatcher - { - - public static var MEMORY_LOG_1:Dictionary = new Dictionary(true); - public static var MEMORY_LOG_2:Dictionary = new Dictionary(true); - protected static const _log:Logger = Log.getLogger(getQualifiedClassName(MapRenderer)); - public static var cachedAsBitmapElement:Array = new Array(); - public static var boundingBoxElements:Array; - private static var _bitmapOffsetPoint:Point; - private static var _groundGlobalScaleRatio:Number; - - public var useDefautState:Boolean; - private var _container:DisplayObjectContainer; - private var _elements:Elements; - private var _gfxLoader:IResourceLoader; - private var _swfLoader:IResourceLoader; - private var _map:Map; - private var _useSmooth:Boolean; - private var _cacheRef:Array; - private var _bitmapsGfx:Array; - private var _swfGfx:Array; - private var _swfApplicationDomain:Array; - private var _dataMapContainer:DataMapContainer; - private var _icm:InteractiveCellManager; - private var _hideForeground:Boolean; - private var _identifiedElements:Dictionary; - private var _gfxPath:String; - private var _gfxSubPathJpg:String; - private var _gfxSubPathPng:String; - private var _particlesPath:String; - private var _hasSwfGxf:Boolean; - private var _hasBitmapGxf:Boolean; - private var _loadedGfxListCount:uint = 0; - private var _pictoAsBitmap:Boolean; - private var _mapLoaded:Boolean = true; - private var _groundLayerCtrIndex:int; - private var _hasGroundJPG:Boolean = false; - private var _skipGroundCache:Boolean = false; - private var _forceReloadWithoutCache:Boolean = false; - private var _groundIsLoaded:Boolean = false; - private var _mapIsReady:Boolean = false; - private var _allowAnimatedGfx:Boolean; - private var _debugLayer:Boolean; - private var _allowParticlesFx:Boolean; - private var _gfxMemorySize:uint = 0; - private var _renderId:uint = 0; - private var _extension:String; - private var _renderFixture:Boolean = true; - private var _renderBackgroundColor:Boolean = true; - private var _progressBarCtr:Sprite; - private var _downloadProgressBar:Shape; - private var _downloadTimer:Timer; - private var _fileToLoad:uint; - private var _fileLoaded:uint; - private var _cancelRender:Boolean; - private var _bitmapForegroundContainer:Bitmap; - private var _layersData:Array; - private var _tacticModeActivated:Boolean = false; - private var colorTransform:ColorTransform; - private var _m:Matrix; - private var _srcRect:Rectangle; - private var _destPoint:Point; - private var _ceilBitmapData:BitmapData; - private var _clTrans:ColorTransform; - - public function MapRenderer(container:DisplayObjectContainer, elements:Elements) - { - var val:*; - this._bitmapsGfx = []; - this._swfGfx = []; - this._swfApplicationDomain = new Array(); - this._hideForeground = Atouin.getInstance().options.hideForeground; - this._downloadTimer = new Timer(2500); - this.colorTransform = new ColorTransform(); - this._m = new Matrix(); - this._srcRect = new Rectangle(); - this._destPoint = new Point(); - this._clTrans = new ColorTransform(); - super(); - this._container = container; - if (isNaN(_groundGlobalScaleRatio)) + import flash.events.EventDispatcher; + import flash.utils.Dictionary; + import com.ankamagames.jerakine.logger.Logger; + import flash.geom.Point; + import com.ankamagames.jerakine.logger.Log; + import flash.utils.getQualifiedClassName; + import flash.display.DisplayObjectContainer; + import com.ankamagames.atouin.data.elements.Elements; + import com.ankamagames.jerakine.resources.loaders.IResourceLoader; + import com.ankamagames.atouin.data.map.Map; + import com.ankamagames.atouin.types.DataMapContainer; + import com.ankamagames.atouin.managers.InteractiveCellManager; + import flash.display.Sprite; + import flash.display.Shape; + import flash.utils.Timer; + import flash.display.Bitmap; + import com.ankamagames.jerakine.types.Uri; + import com.ankamagames.atouin.data.elements.subtypes.NormalGraphicalElementData; + import flash.system.ApplicationDomain; + import com.ankamagames.atouin.data.elements.GraphicalElementData; + import com.ankamagames.atouin.data.map.Fixture; + import com.ankamagames.atouin.Atouin; + import com.ankamagames.atouin.managers.AnimatedElementManager; + import com.ankamagames.jerakine.utils.system.AirScanner; + import com.ankamagames.atouin.managers.DataGroundMapManager; + import com.ankamagames.atouin.AtouinConstants; + import com.ankamagames.atouin.enums.GroundCache; + import com.ankamagames.atouin.data.elements.subtypes.AnimatedGraphicalElementData; + import flash.system.LoaderContext; + import com.ankamagames.atouin.types.events.RenderMapEvent; + import com.ankamagames.jerakine.resources.events.ResourceLoaderProgressEvent; + import com.ankamagames.jerakine.resources.events.ResourceLoadedEvent; + import com.ankamagames.jerakine.resources.events.ResourceErrorEvent; + import com.ankamagames.jerakine.resources.loaders.ResourceLoaderFactory; + import com.ankamagames.jerakine.resources.loaders.ResourceLoaderType; + import com.ankamagames.jerakine.resources.adapters.impl.AdvancedSwfAdapter; + import flash.display.DisplayObject; + import com.ankamagames.tiphon.display.RasterizedAnimation; + import com.ankamagames.atouin.types.LayerContainer; + import com.ankamagames.atouin.types.CellReference; + import flash.geom.Rectangle; + import com.ankamagames.atouin.types.ICellContainer; + import com.ankamagames.atouin.data.map.Cell; + import com.ankamagames.atouin.data.map.Layer; + import flash.geom.ColorTransform; + import flash.display.BitmapData; + import flash.geom.Matrix; + import com.ankamagames.jerakine.utils.display.StageShareManager; + import com.ankamagames.atouin.managers.EntitiesManager; + import com.ankamagames.jerakine.managers.OptionManager; + import com.ankamagames.atouin.types.BitmapCellContainer; + import com.ankamagames.atouin.types.CellContainer; + import com.ankamagames.atouin.types.InteractiveCell; + import com.ankamagames.atouin.data.map.CellData; + import flash.utils.getTimer; + import com.ankamagames.atouin.managers.MapDisplayManager; + import com.ankamagames.atouin.data.map.elements.GraphicalElement; + import com.ankamagames.atouin.data.map.elements.BasicElement; + import com.ankamagames.atouin.data.elements.subtypes.EntityGraphicalElementData; + import com.ankamagames.tiphon.types.look.TiphonEntityLook; + import com.ankamagames.atouin.types.WorldEntitySprite; + import com.ankamagames.atouin.data.elements.subtypes.ParticlesGraphicalElementData; + import org.flintparticles.twoD.renderers.DisplayObjectRenderer; + import com.ankamagames.jerakine.types.ASwf; + import flash.display.MovieClip; + import com.ankamagames.jerakine.utils.display.FpsControler; + import com.ankamagames.jerakine.utils.display.MovieClipUtils; + import com.ankamagames.atouin.types.MapGfxBitmap; + import com.ankamagames.atouin.data.elements.subtypes.BoundingBoxGraphicalElementData; + import flash.display.InteractiveObject; + import com.ankamagames.atouin.data.elements.subtypes.BlendedGraphicalElementData; + import com.ankamagames.jerakine.script.ScriptExec; + import com.ankamagames.sweevo.runners.EmitterRunner; + import com.ankamagames.atouin.types.SpriteWrapper; + import com.ankamagames.jerakine.types.positions.MapPoint; + import com.ankamagames.atouin.enums.ElementTypesEnum; + import com.ankamagames.jerakine.managers.ErrorManager; + import flash.events.Event; + import flash.events.ProgressEvent; + import flash.events.TimerEvent; + import com.ankamagames.jerakine.data.XmlConfig; + + public class MapRenderer extends EventDispatcher + { + + public function MapRenderer(param1:DisplayObjectContainer, param2:Elements) + { + var _loc4_:* = undefined; + this._bitmapsGfx = []; + this._swfGfx = []; + this._swfApplicationDomain = new Array(); + this._hideForeground = Atouin.getInstance().options.hideForeground; + this._downloadTimer = new Timer(2500); + this.colorTransform = new ColorTransform(); + this._m = new Matrix(); + this._srcRect = new Rectangle(); + this._destPoint = new Point(); + this._clTrans = new ColorTransform(); + super(); + this._container = param1; + if(isNaN(_groundGlobalScaleRatio)) + { + _loc4_ = XmlConfig.getInstance().getEntry("config.gfx.world.scaleRatio"); + _groundGlobalScaleRatio = _loc4_ == null?1:parseFloat(_loc4_); + } + if(_bitmapOffsetPoint == null) + { + _bitmapOffsetPoint = StageShareManager.stage.localToGlobal(new Point(this._container.x,this._container.y)); + } + this._elements = param2; + this._icm = InteractiveCellManager.getInstance(); + this._gfxPath = Atouin.getInstance().options.elementsPath; + this._gfxSubPathJpg = Atouin.getInstance().options.jpgSubPath; + this._gfxSubPathPng = Atouin.getInstance().options.pngSubPath; + this._particlesPath = Atouin.getInstance().options.particlesScriptsPath; + this._extension = Atouin.getInstance().options.mapPictoExtension; + var _loc3_:Shape = new Shape(); + _loc3_.graphics.lineStyle(1,8947848); + _loc3_.graphics.beginFill(2236962); + _loc3_.graphics.drawRect(0,0,600,10); + _loc3_.x = 0; + _loc3_.y = 0; + this._downloadProgressBar = new Shape(); + this._downloadProgressBar.graphics.beginFill(10077440); + this._downloadProgressBar.graphics.drawRect(0,0,597,7); + this._downloadProgressBar.graphics.endFill(); + this._downloadProgressBar.x = 2; + this._downloadProgressBar.y = 2; + this._progressBarCtr = new Sprite(); + this._progressBarCtr.addChild(_loc3_); + this._progressBarCtr.addChild(this._downloadProgressBar); + this._progressBarCtr.x = (StageShareManager.startWidth - this._progressBarCtr.width) / 2; + this._progressBarCtr.y = (StageShareManager.startHeight - this._progressBarCtr.height) / 2; + this._gfxLoader = ResourceLoaderFactory.getLoader(ResourceLoaderType.PARALLEL_LOADER); + this._gfxLoader.addEventListener(ResourceLoaderProgressEvent.LOADER_COMPLETE,this.onAllGfxLoaded,false,0,true); + this._gfxLoader.addEventListener(ResourceLoadedEvent.LOADED,this.onBitmapGfxLoaded,false,0,true); + this._gfxLoader.addEventListener(ResourceErrorEvent.ERROR,this.onGfxError,false,0,true); + this._swfLoader = ResourceLoaderFactory.getLoader(ResourceLoaderType.PARALLEL_LOADER); + this._swfLoader.addEventListener(ResourceLoaderProgressEvent.LOADER_COMPLETE,this.onAllGfxLoaded,false,0,true); + this._swfLoader.addEventListener(ResourceLoadedEvent.LOADED,this.onSwfGfxLoaded,false,0,true); + this._swfLoader.addEventListener(ResourceErrorEvent.ERROR,this.onGfxError,false,0,true); + this._downloadTimer.addEventListener(TimerEvent.TIMER,this.onDownloadTimer); + } + + public static var MEMORY_LOG_1:Dictionary = new Dictionary(true); + + public static var MEMORY_LOG_2:Dictionary = new Dictionary(true); + + protected static const _log:Logger = Log.getLogger(getQualifiedClassName(MapRenderer)); + + public static var cachedAsBitmapElement:Array = new Array(); + + public static var boundingBoxElements:Array; + + private static var _bitmapOffsetPoint:Point; + + private static var _groundGlobalScaleRatio:Number; + + public var useDefautState:Boolean; + + public function get gfxMemorySize() : uint + { + return this._gfxMemorySize; + } + + private var _container:DisplayObjectContainer; + + private var _elements:Elements; + + private var _gfxLoader:IResourceLoader; + + private var _swfLoader:IResourceLoader; + + private var _map:Map; + + private var _useSmooth:Boolean; + + private var _cacheRef:Array; + + private var _bitmapsGfx:Array; + + private var _swfGfx:Array; + + private var _swfApplicationDomain:Array; + + private var _dataMapContainer:DataMapContainer; + + private var _icm:InteractiveCellManager; + + private var _hideForeground:Boolean; + + private var _identifiedElements:Dictionary; + + private var _gfxPath:String; + + private var _gfxSubPathJpg:String; + + private var _gfxSubPathPng:String; + + private var _particlesPath:String; + + private var _hasSwfGxf:Boolean; + + private var _hasBitmapGxf:Boolean; + + private var _loadedGfxListCount:uint = 0; + + private var _pictoAsBitmap:Boolean; + + private var _mapLoaded:Boolean = true; + + private var _groundLayerCtrIndex:int; + + private var _hasGroundJPG:Boolean = false; + + private var _skipGroundCache:Boolean = false; + + private var _forceReloadWithoutCache:Boolean = false; + + private var _groundIsLoaded:Boolean = false; + + private var _mapIsReady:Boolean = false; + + private var _allowAnimatedGfx:Boolean; + + private var _debugLayer:Boolean; + + private var _allowParticlesFx:Boolean; + + private var _gfxMemorySize:uint = 0; + + private var _renderId:uint = 0; + + private var _extension:String; + + private var _renderFixture:Boolean = true; + + private var _renderBackgroundColor:Boolean = true; + + private var _progressBarCtr:Sprite; + + private var _downloadProgressBar:Shape; + + private var _downloadTimer:Timer; + + private var _fileToLoad:uint; + + private var _fileLoaded:uint; + + private var _cancelRender:Boolean; + + private var _bitmapForegroundContainer:Bitmap; + + private var _layersData:Array; + + private var _tacticModeActivated:Boolean = false; + + public function get identifiedElements() : Dictionary + { + return this._identifiedElements; + } + + public function initRenderContainer(param1:DisplayObjectContainer) : void + { + this._container = param1; + } + + public function render(param1:DataMapContainer, param2:Boolean = false, param3:uint = 0, param4:Boolean = true) : void + { + var _loc12_:Uri = null; + var _loc13_:* = false; + var _loc14_:NormalGraphicalElementData = null; + var _loc15_:ApplicationDomain = null; + var _loc16_:GraphicalElementData = null; + var _loc17_:Fixture = null; + var _loc18_:* = 0; + this._cancelRender = false; + this._renderFixture = param4; + this._renderBackgroundColor = param4; + this._downloadTimer.reset(); + this._gfxMemorySize = 0; + this._fileLoaded = 0; + this._renderId = param3; + Atouin.getInstance().cancelZoom(); + AnimatedElementManager.reset(); + boundingBoxElements = new Array(); + this._allowAnimatedGfx = Atouin.getInstance().options.allowAnimatedGfx; + this._debugLayer = Atouin.getInstance().options.debugLayer; + this._allowParticlesFx = Atouin.getInstance().options.allowParticlesFx; + var _loc5_:* = !this._mapLoaded; + this._mapLoaded = false; + this._groundIsLoaded = false; + this._mapIsReady = false; + this._map = param1.dataMap; + this._downloadProgressBar.scaleX = 0; + this._forceReloadWithoutCache = param2; + var _loc6_:int = AirScanner.isStreamingVersion()?0:Atouin.getInstance().options.groundCacheMode; + if(param2) + { + this._skipGroundCache = true; + this._hasGroundJPG = false; + } + else + { + this._skipGroundCache = DataGroundMapManager.mapsCurrentlyRendered() > AtouinConstants.MAX_GROUND_CACHE_MEMORY || _loc6_ == 0; + this._map.groundCacheCurrentlyUsed = _loc6_; + if((_loc6_) && !this._skipGroundCache) { - val = XmlConfig.getInstance().getEntry("config.gfx.world.scaleRatio"); - _groundGlobalScaleRatio = (((val == null)) ? 1 : parseFloat(val)); - }; - if (_bitmapOffsetPoint == null) - { - _bitmapOffsetPoint = StageShareManager.stage.localToGlobal(new Point(this._container.x, this._container.y)); - }; - this._elements = elements; - this._icm = InteractiveCellManager.getInstance(); - this._gfxPath = Atouin.getInstance().options.elementsPath; - this._gfxSubPathJpg = Atouin.getInstance().options.jpgSubPath; - this._gfxSubPathPng = Atouin.getInstance().options.pngSubPath; - this._particlesPath = Atouin.getInstance().options.particlesScriptsPath; - this._extension = Atouin.getInstance().options.mapPictoExtension; - var downloadProgressBarBorder:Shape = new Shape(); - downloadProgressBarBorder.graphics.lineStyle(1, 0x888888); - downloadProgressBarBorder.graphics.beginFill(0x222222); - downloadProgressBarBorder.graphics.drawRect(0, 0, 600, 10); - downloadProgressBarBorder.x = 0; - downloadProgressBarBorder.y = 0; - this._downloadProgressBar = new Shape(); - this._downloadProgressBar.graphics.beginFill(0x99C500); - this._downloadProgressBar.graphics.drawRect(0, 0, 597, 7); - this._downloadProgressBar.graphics.endFill(); - this._downloadProgressBar.x = 2; - this._downloadProgressBar.y = 2; - this._progressBarCtr = new Sprite(); - this._progressBarCtr.addChild(downloadProgressBarBorder); - this._progressBarCtr.addChild(this._downloadProgressBar); - this._progressBarCtr.x = ((StageShareManager.startWidth - this._progressBarCtr.width) / 2); - this._progressBarCtr.y = ((StageShareManager.startHeight - this._progressBarCtr.height) / 2); - this._gfxLoader = ResourceLoaderFactory.getLoader(ResourceLoaderType.PARALLEL_LOADER); - this._gfxLoader.addEventListener(ResourceLoaderProgressEvent.LOADER_COMPLETE, this.onAllGfxLoaded, false, 0, true); - this._gfxLoader.addEventListener(ResourceLoadedEvent.LOADED, this.onBitmapGfxLoaded, false, 0, true); - this._gfxLoader.addEventListener(ResourceErrorEvent.ERROR, this.onGfxError, false, 0, true); - this._swfLoader = ResourceLoaderFactory.getLoader(ResourceLoaderType.PARALLEL_LOADER); - this._swfLoader.addEventListener(ResourceLoaderProgressEvent.LOADER_COMPLETE, this.onAllGfxLoaded, false, 0, true); - this._swfLoader.addEventListener(ResourceLoadedEvent.LOADED, this.onSwfGfxLoaded, false, 0, true); - this._swfLoader.addEventListener(ResourceErrorEvent.ERROR, this.onGfxError, false, 0, true); - this._downloadTimer.addEventListener(TimerEvent.TIMER, this.onDownloadTimer); - } - - public function get gfxMemorySize():uint - { - return (this._gfxMemorySize); - } - - public function get identifiedElements():Dictionary - { - return (this._identifiedElements); - } - - public function initRenderContainer(container:DisplayObjectContainer):void - { - this._container = container; - } - - public function render(dataContainer:DataMapContainer, forceReloadWithoutCache:Boolean=false, renderId:uint=0, renderFixture:Boolean=true):void - { - var uri:Uri; - var isJpg:Boolean; - var nged:NormalGraphicalElementData; - var applicationDomain:ApplicationDomain; - var elementData:GraphicalElementData; - var bg:Fixture; - var cacheStatus:int; - this._cancelRender = false; - this._renderFixture = renderFixture; - this._renderBackgroundColor = renderFixture; - this._downloadTimer.reset(); - this._gfxMemorySize = 0; - this._fileLoaded = 0; - this._renderId = renderId; - Atouin.getInstance().cancelZoom(); - AnimatedElementManager.reset(); - boundingBoxElements = new Array(); - this._allowAnimatedGfx = Atouin.getInstance().options.allowAnimatedGfx; - this._debugLayer = Atouin.getInstance().options.debugLayer; - this._allowParticlesFx = Atouin.getInstance().options.allowParticlesFx; - var newLoader:Boolean = !(this._mapLoaded); - this._mapLoaded = false; - this._groundIsLoaded = false; - this._mapIsReady = false; - this._map = dataContainer.dataMap; - this._downloadProgressBar.scaleX = 0; - this._forceReloadWithoutCache = forceReloadWithoutCache; - var groundCacheMode:int = ((AirScanner.isStreamingVersion()) ? 0 : Atouin.getInstance().options.groundCacheMode); - if (forceReloadWithoutCache) - { - this._skipGroundCache = true; - this._hasGroundJPG = false; + _loc18_ = DataGroundMapManager.loadGroundMap(this._map,this.groundMapLoaded,this.groundMapNotLoaded); + if(_loc18_ == GroundCache.GROUND_CACHE_AVAILABLE) + { + this._hasGroundJPG = true; + } + else if(_loc18_ == GroundCache.GROUND_CACHE_NOT_AVAILABLE) + { + this._hasGroundJPG = false; + } + else if(_loc18_ == GroundCache.GROUND_CACHE_ERROR) + { + this._hasGroundJPG = false; + _loc6_ = 0; + Atouin.getInstance().options.groundCacheMode = 0; + } + else if(_loc18_ == GroundCache.GROUND_CACHE_SKIP) + { + this._skipGroundCache = true; + this._hasGroundJPG = false; + } + + + } else { - this._skipGroundCache = (((DataGroundMapManager.mapsCurrentlyRendered() > AtouinConstants.MAX_GROUND_CACHE_MEMORY)) || ((groundCacheMode == 0))); - this._map.groundCacheCurrentlyUsed = groundCacheMode; - if (((groundCacheMode) && (!(this._skipGroundCache)))) - { - cacheStatus = DataGroundMapManager.loadGroundMap(this._map, this.groundMapLoaded, this.groundMapNotLoaded); - if (cacheStatus == GroundCache.GROUND_CACHE_AVAILABLE) - { - this._hasGroundJPG = true; - } - else - { - if (cacheStatus == GroundCache.GROUND_CACHE_NOT_AVAILABLE) - { - this._hasGroundJPG = false; - } - else - { - if (cacheStatus == GroundCache.GROUND_CACHE_ERROR) - { - this._hasGroundJPG = false; - groundCacheMode = 0; - Atouin.getInstance().options.groundCacheMode = 0; - } - else - { - if (cacheStatus == GroundCache.GROUND_CACHE_SKIP) - { - this._skipGroundCache = true; - this._hasGroundJPG = false; - }; - }; - }; - }; - } - else - { - this._hasGroundJPG = false; - }; - }; - if (this._hasGroundJPG) - { - Atouin.getInstance().worldContainer.visible = false; - }; - this._cacheRef = new Array(); - var bitmapsGfx:Array = new Array(); - var swfGfx:Array = new Array(); - this._useSmooth = Atouin.getInstance().options.useSmooth; - this._dataMapContainer = dataContainer; - this._identifiedElements = new Dictionary(true); - this._loadedGfxListCount = 0; - this._hasSwfGxf = false; - this._hasBitmapGxf = false; - var gfxUri:Array = new Array(); - var swfUri:Array = new Array(); - var gfxList:Array = this._map.getGfxList(this._hasGroundJPG); - for each (elementData in gfxList) - { - if (!((elementData is NormalGraphicalElementData))) - { - } - else - { - nged = (elementData as NormalGraphicalElementData); - if ((nged is AnimatedGraphicalElementData)) - { - applicationDomain = new ApplicationDomain(); - uri = new Uri((((this._gfxPath + "/swf/") + nged.gfxId) + ".swf")); - uri.loaderContext = new LoaderContext(false, applicationDomain); - AirScanner.allowByteCodeExecution(uri.loaderContext, true); - swfUri.push(uri); - this._hasSwfGxf = true; - uri.tag = nged.gfxId; - this._cacheRef[nged.gfxId] = ("RES_" + uri.toSum()); - this._swfApplicationDomain[nged.gfxId] = applicationDomain; - } - else - { - if (this._bitmapsGfx[nged.gfxId]) - { - bitmapsGfx[nged.gfxId] = this._bitmapsGfx[nged.gfxId]; - } - else - { - isJpg = Elements.getInstance().isJpg(nged.gfxId); - uri = new Uri(((((((this._gfxPath + "/") + ((isJpg) ? this._gfxSubPathJpg : this._gfxSubPathPng)) + "/") + nged.gfxId) + ".") + ((isJpg) ? "jpg" : this._extension))); - gfxUri.push(uri); - this._hasBitmapGxf = true; - uri.tag = nged.gfxId; - this._cacheRef[nged.gfxId] = ("RES_" + uri.toSum()); - }; - }; - }; - }; - if (((!(this._hasGroundJPG)) && (renderFixture))) - { - for each (bg in this._map.backgroundFixtures) - { - if (this._bitmapsGfx[bg.fixtureId]) - { - bitmapsGfx[bg.fixtureId] = this._bitmapsGfx[bg.fixtureId]; - } - else - { - isJpg = Elements.getInstance().isJpg(bg.fixtureId); - uri = new Uri(((((((this._gfxPath + "/") + ((isJpg) ? this._gfxSubPathJpg : this._gfxSubPathPng)) + "/") + bg.fixtureId) + ".") + ((isJpg) ? "jpg" : this._extension))); - uri.tag = bg.fixtureId; - gfxUri.push(uri); - this._hasBitmapGxf = true; - this._cacheRef[bg.fixtureId] = ("RES_" + uri.toSum()); - }; - }; - }; - if (renderFixture) + this._hasGroundJPG = false; + } + } + if(this._hasGroundJPG) + { + Atouin.getInstance().worldContainer.visible = false; + } + this._cacheRef = new Array(); + var _loc7_:Array = new Array(); + var _loc8_:Array = new Array(); + this._useSmooth = Atouin.getInstance().options.useSmooth; + this._dataMapContainer = param1; + this._identifiedElements = new Dictionary(true); + this._loadedGfxListCount = 0; + this._hasSwfGxf = false; + this._hasBitmapGxf = false; + var _loc9_:Array = new Array(); + var _loc10_:Array = new Array(); + var _loc11_:Array = this._map.getGfxList(this._hasGroundJPG); + for each(_loc16_ in _loc11_) + { + if(_loc16_ is NormalGraphicalElementData) { - for each (bg in this._map.foregroundFixtures) - { - if (this._bitmapsGfx[bg.fixtureId]) - { - bitmapsGfx[bg.fixtureId] = this._bitmapsGfx[bg.fixtureId]; - } - else - { - isJpg = Elements.getInstance().isJpg(bg.fixtureId); - uri = new Uri(((((((this._gfxPath + "/") + ((isJpg) ? this._gfxSubPathJpg : this._gfxSubPathPng)) + "/") + bg.fixtureId) + ".") + ((isJpg) ? "jpg" : this._extension))); - uri.tag = bg.fixtureId; - gfxUri.push(uri); - this._hasBitmapGxf = true; - this._cacheRef[bg.fixtureId] = ("RES_" + uri.toSum()); - }; - }; - }; - dispatchEvent(new RenderMapEvent(RenderMapEvent.GFX_LOADING_START, false, false, this._map.id, this._renderId)); - this._bitmapsGfx = bitmapsGfx; - this._swfGfx = new Array(); - if (newLoader) + _loc14_ = _loc16_ as NormalGraphicalElementData; + if(_loc14_ is AnimatedGraphicalElementData) + { + _loc15_ = new ApplicationDomain(); + _loc12_ = new Uri(this._gfxPath + "/swf/" + _loc14_.gfxId + ".swf"); + _loc12_.loaderContext = new LoaderContext(false,_loc15_); + AirScanner.allowByteCodeExecution(_loc12_.loaderContext,true); + _loc10_.push(_loc12_); + this._hasSwfGxf = true; + _loc12_.tag = _loc14_.gfxId; + this._cacheRef[_loc14_.gfxId] = "RES_" + _loc12_.toSum(); + this._swfApplicationDomain[_loc14_.gfxId] = _loc15_; + } + else if(this._bitmapsGfx[_loc14_.gfxId]) + { + _loc7_[_loc14_.gfxId] = this._bitmapsGfx[_loc14_.gfxId]; + } + else + { + _loc13_ = Elements.getInstance().isJpg(_loc14_.gfxId); + _loc12_ = new Uri(this._gfxPath + "/" + (_loc13_?this._gfxSubPathJpg:this._gfxSubPathPng) + "/" + _loc14_.gfxId + "." + (_loc13_?"jpg":this._extension)); + _loc9_.push(_loc12_); + this._hasBitmapGxf = true; + _loc12_.tag = _loc14_.gfxId; + this._cacheRef[_loc14_.gfxId] = "RES_" + _loc12_.toSum(); + } + + } + } + if(!this._hasGroundJPG && (param4)) + { + for each(_loc17_ in this._map.backgroundFixtures) { - this._gfxLoader.removeEventListener(ResourceLoaderProgressEvent.LOADER_COMPLETE, this.onAllGfxLoaded); - this._gfxLoader.removeEventListener(ResourceLoadedEvent.LOADED, this.onBitmapGfxLoaded); - this._gfxLoader.removeEventListener(ResourceErrorEvent.ERROR, this.onGfxError); - this._swfLoader.removeEventListener(ResourceLoaderProgressEvent.LOADER_COMPLETE, this.onAllGfxLoaded); - this._swfLoader.removeEventListener(ResourceLoadedEvent.LOADED, this.onSwfGfxLoaded); - this._swfLoader.removeEventListener(ResourceErrorEvent.ERROR, this.onGfxError); - this._gfxLoader.cancel(); - this._swfLoader.cancel(); - this._gfxLoader = ResourceLoaderFactory.getLoader(ResourceLoaderType.PARALLEL_LOADER); - this._gfxLoader.addEventListener(ResourceLoaderProgressEvent.LOADER_COMPLETE, this.onAllGfxLoaded, false, 0, true); - this._gfxLoader.addEventListener(ResourceLoadedEvent.LOADED, this.onBitmapGfxLoaded, false, 0, true); - this._gfxLoader.addEventListener(ResourceErrorEvent.ERROR, this.onGfxError, false, 0, true); - this._swfLoader = ResourceLoaderFactory.getLoader(ResourceLoaderType.PARALLEL_LOADER); - this._swfLoader.addEventListener(ResourceLoaderProgressEvent.LOADER_COMPLETE, this.onAllGfxLoaded, false, 0, true); - this._swfLoader.addEventListener(ResourceLoadedEvent.LOADED, this.onSwfGfxLoaded, false, 0, true); - this._swfLoader.addEventListener(ResourceErrorEvent.ERROR, this.onGfxError, false, 0, true); - }; - this._fileToLoad = (gfxUri.length + swfUri.length); - this._gfxLoader.load(gfxUri); - this._swfLoader.load(swfUri, null, AdvancedSwfAdapter); - this._downloadTimer.start(); - if ((((gfxUri.length == 0)) && ((swfUri.length == 0)))) + if(this._bitmapsGfx[_loc17_.fixtureId]) + { + _loc7_[_loc17_.fixtureId] = this._bitmapsGfx[_loc17_.fixtureId]; + } + else + { + _loc13_ = Elements.getInstance().isJpg(_loc17_.fixtureId); + _loc12_ = new Uri(this._gfxPath + "/" + (_loc13_?this._gfxSubPathJpg:this._gfxSubPathPng) + "/" + _loc17_.fixtureId + "." + (_loc13_?"jpg":this._extension)); + _loc12_.tag = _loc17_.fixtureId; + _loc9_.push(_loc12_); + this._hasBitmapGxf = true; + this._cacheRef[_loc17_.fixtureId] = "RES_" + _loc12_.toSum(); + } + } + } + if(param4) + { + for each(_loc17_ in this._map.foregroundFixtures) { - this.onAllGfxLoaded(null); - }; - } - - public function unload():void - { - this._cancelRender = true; - this._mapLoaded = true; + if(this._bitmapsGfx[_loc17_.fixtureId]) + { + _loc7_[_loc17_.fixtureId] = this._bitmapsGfx[_loc17_.fixtureId]; + } + else + { + _loc13_ = Elements.getInstance().isJpg(_loc17_.fixtureId); + _loc12_ = new Uri(this._gfxPath + "/" + (_loc13_?this._gfxSubPathJpg:this._gfxSubPathPng) + "/" + _loc17_.fixtureId + "." + (_loc13_?"jpg":this._extension)); + _loc12_.tag = _loc17_.fixtureId; + _loc9_.push(_loc12_); + this._hasBitmapGxf = true; + this._cacheRef[_loc17_.fixtureId] = "RES_" + _loc12_.toSum(); + } + } + } + dispatchEvent(new RenderMapEvent(RenderMapEvent.GFX_LOADING_START,false,false,this._map.id,this._renderId)); + this._bitmapsGfx = _loc7_; + this._swfGfx = new Array(); + if(_loc5_) + { + this._gfxLoader.removeEventListener(ResourceLoaderProgressEvent.LOADER_COMPLETE,this.onAllGfxLoaded); + this._gfxLoader.removeEventListener(ResourceLoadedEvent.LOADED,this.onBitmapGfxLoaded); + this._gfxLoader.removeEventListener(ResourceErrorEvent.ERROR,this.onGfxError); + this._swfLoader.removeEventListener(ResourceLoaderProgressEvent.LOADER_COMPLETE,this.onAllGfxLoaded); + this._swfLoader.removeEventListener(ResourceLoadedEvent.LOADED,this.onSwfGfxLoaded); + this._swfLoader.removeEventListener(ResourceErrorEvent.ERROR,this.onGfxError); this._gfxLoader.cancel(); this._swfLoader.cancel(); - this._fileToLoad = 0; - this._fileLoaded = 0; - RasterizedAnimation.optimize(1); - AnimatedElementManager.reset(); - while (cachedAsBitmapElement.length) - { - cachedAsBitmapElement.shift().cacheAsBitmap = false; - }; - this._map = null; - if (this._dataMapContainer) + this._gfxLoader = ResourceLoaderFactory.getLoader(ResourceLoaderType.PARALLEL_LOADER); + this._gfxLoader.addEventListener(ResourceLoaderProgressEvent.LOADER_COMPLETE,this.onAllGfxLoaded,false,0,true); + this._gfxLoader.addEventListener(ResourceLoadedEvent.LOADED,this.onBitmapGfxLoaded,false,0,true); + this._gfxLoader.addEventListener(ResourceErrorEvent.ERROR,this.onGfxError,false,0,true); + this._swfLoader = ResourceLoaderFactory.getLoader(ResourceLoaderType.PARALLEL_LOADER); + this._swfLoader.addEventListener(ResourceLoaderProgressEvent.LOADER_COMPLETE,this.onAllGfxLoaded,false,0,true); + this._swfLoader.addEventListener(ResourceLoadedEvent.LOADED,this.onSwfGfxLoaded,false,0,true); + this._swfLoader.addEventListener(ResourceErrorEvent.ERROR,this.onGfxError,false,0,true); + } + this._fileToLoad = _loc9_.length + _loc10_.length; + this._gfxLoader.load(_loc9_); + this._swfLoader.load(_loc10_,null,AdvancedSwfAdapter); + this._downloadTimer.start(); + if(_loc9_.length == 0 && _loc10_.length == 0) + { + this.onAllGfxLoaded(null); + } + } + + public function unload() : void + { + var _loc1_:DisplayObject = null; + this._cancelRender = true; + this._mapLoaded = true; + this._gfxLoader.cancel(); + this._swfLoader.cancel(); + this._fileToLoad = 0; + this._fileLoaded = 0; + RasterizedAnimation.optimize(1); + AnimatedElementManager.reset(); + while(cachedAsBitmapElement.length) + { + cachedAsBitmapElement.shift().cacheAsBitmap = false; + } + this._map = null; + if(this._dataMapContainer) + { + this._dataMapContainer.removeContainer(); + } + while(this._container.numChildren) + { + _loc1_ = this._container.removeChildAt(0); + if(_loc1_ is Bitmap && (Bitmap(_loc1_).bitmapData)) { - this._dataMapContainer.removeContainer(); - }; - while (this._container.numChildren) + Bitmap(_loc1_).bitmapData.dispose(); + } + _loc1_ = null; + } + } + + public function modeTactic(param1:Boolean) : void + { + var _loc2_:Object = null; + var _loc3_:DisplayObject = null; + var _loc4_:* = 0; + if((param1) && !(this._container.opaqueBackground == 0)) + { + this._container.opaqueBackground = 0; + } + else if(!param1 && (this._map)) + { + if(this._renderBackgroundColor) { - this._container.removeChildAt(0); - }; - } - - public function modeTactic(activated:Boolean):void - { - var o:Object; - var layerCtr:DisplayObject; - var i:int; - if (((activated) && (!((this._container.opaqueBackground == 0))))) + this._container.opaqueBackground = this._map.backgroundColor; + } + } + + this._tacticModeActivated = param1; + if((!param1) && (this._layersData) && this._layersData.length > 0) + { + for each(_loc2_ in this._layersData) { - this._container.opaqueBackground = 0; + _loc2_.data.visible = true; } - else + this._layersData = null; + } + else if((param1) && (this._groundIsLoaded)) + { + this._layersData = new Array(); + _loc2_ = new Object(); + _loc2_.data = this._container.getChildAt(0); + _loc2_.index = 0; + this._layersData.push(_loc2_); + _loc2_.data.visible = false; + } + else if(param1) + { + this._layersData = new Array(); + while(!(this._container.getChildAt(_loc4_) is LayerContainer)) { - if (((!(activated)) && (this._map))) - { - if (this._renderBackgroundColor) - { - this._container.opaqueBackground = this._map.backgroundColor; - }; - }; - }; - this._tacticModeActivated = activated; - if (((((!(activated)) && (this._layersData))) && ((this._layersData.length > 0)))) + _loc2_ = new Object(); + _loc3_ = this._container.getChildAt(_loc4_); + _loc2_.data = _loc3_; + _loc2_.index = _loc4_; + this._layersData.push(_loc2_); + _loc3_.visible = false; + _loc4_++; + } + } + + + if((param1) && !(this._bitmapForegroundContainer == null)) + { + this._bitmapForegroundContainer.visible = false; + } + else if(!param1 && !(this._bitmapForegroundContainer == null)) + { + this._bitmapForegroundContainer.visible = true; + } + + } + + public function isCellUnderFixture(param1:uint) : Boolean + { + var _loc2_:CellReference = this._dataMapContainer.getCellReference(param1); + return this._bitmapForegroundContainer.bitmapData.hitTest(new Point(this._bitmapForegroundContainer.x,this._bitmapForegroundContainer.y),255,new Rectangle(_loc2_.x,_loc2_.y,AtouinConstants.CELL_WIDTH,AtouinConstants.CELL_HEIGHT)); + } + + private function makeMap() : void + { + var layerCtr:DisplayObjectContainer = null; + var cellInteractionCtr:DisplayObjectContainer = null; + var groundLayerCtr:Bitmap = null; + var cellCtr:ICellContainer = null; + var cellPnt:Point = null; + var cellDisabled:Boolean = false; + var hideFg:Boolean = false; + var skipLayer:Boolean = false; + var groundLayer:Boolean = false; + var i:uint = 0; + var nbCell:uint = 0; + var cell:Cell = null; + var layer:Layer = null; + var endCell:Cell = null; + var t:ColorTransform = null; + var reelBmpDt:BitmapData = null; + var m:Matrix = null; + var tmp:Bitmap = null; + var tsJpeg:uint = 0; + this._downloadTimer.stop(); + if(this._progressBarCtr.parent) + { + this._progressBarCtr.parent.removeChild(this._progressBarCtr); + } + this._pictoAsBitmap = Atouin.getInstance().options.useCacheAsBitmap; + groundLayerCtr = new Bitmap(new BitmapData(StageShareManager.startWidth * _groundGlobalScaleRatio,StageShareManager.startHeight * _groundGlobalScaleRatio,!this._renderBackgroundColor,this._renderBackgroundColor?this._map.backgroundColor:0),"auto",true); + groundLayerCtr.x = groundLayerCtr.x - _bitmapOffsetPoint.x; + var aInteractiveCell:Array = new Array(); + dispatchEvent(new RenderMapEvent(RenderMapEvent.MAP_RENDER_START,false,false,this._map.id,this._renderId)); + if(!this._hasGroundJPG) + { + this.renderFixture(this._map.backgroundFixtures,groundLayerCtr); + } + InteractiveCellManager.getInstance().initManager(); + EntitiesManager.getInstance().initManager(); + if(this._renderBackgroundColor) + { + this._container.opaqueBackground = this._map.backgroundColor; + } + var layerId:uint = 0; + var groundOnly:Boolean = OptionManager.getOptionManager("atouin").groundOnly; + var lastCellId:int = 0; + var currentCellId:uint = 0; + for each(layer in this._map.layers) + { + layerId = layer.layerId; + if(layer.layerId != Layer.LAYER_GROUND) { - for each (o in this._layersData) - { - o.data.visible = true; - }; - this._layersData = null; + layerCtr = this._dataMapContainer.getLayer(layerId); } else { - if (((activated) && (this._groundIsLoaded))) - { - this._layersData = new Array(); - o = new Object(); - o.data = this._container.getChildAt(0); - o.index = 0; - this._layersData.push(o); - o.data.visible = false; - } - else - { - if (activated) - { - this._layersData = new Array(); - while (!((this._container.getChildAt(i) is LayerContainer))) + layerCtr = null; + } + groundLayer = layerCtr == null; + hideFg = (layerId) && (this._hideForeground); + skipLayer = groundOnly; + if(layer.cellsCount != 0) + { + if((layer.cells[layer.cells.length - 1] as Cell).cellId != AtouinConstants.MAP_CELLS_COUNT - 1) + { + endCell = new Cell(layer); + endCell.cellId = AtouinConstants.MAP_CELLS_COUNT - 1; + endCell.elementsCount = 0; + endCell.elements = []; + layer.cells.push(endCell); + } + i = 0; + nbCell = layer.cells.length; + while(i < nbCell) + { + cell = layer.cells[i]; + currentCellId = cell.cellId; + if(layerId == Layer.LAYER_GROUND) + { + if(currentCellId - lastCellId > 1) + { + currentCellId = lastCellId + 1; + cell = null; + } + else + { + i++; + } + } + else + { + i++; + } + if(groundLayer) + { + cellCtr = new BitmapCellContainer(currentCellId); + } + else + { + cellCtr = new CellContainer(currentCellId); + } + cellCtr.layerId = layerId; + cellCtr.mouseEnabled = false; + if(cell) + { + cellPnt = cell.pixelCoords; + cellCtr.x = cellCtr.startX = int(Math.round(cellPnt.x)) * (cellCtr is CellContainer?_groundGlobalScaleRatio:1); + cellCtr.y = cellCtr.startY = int(Math.round(cellPnt.y)) * (cellCtr is CellContainer?_groundGlobalScaleRatio:1); + if(!skipLayer) + { + if(!this._hasGroundJPG || !groundLayer) { - o = new Object(); - layerCtr = this._container.getChildAt(i); - o.data = layerCtr; - o.index = i; - this._layersData.push(o); - layerCtr.visible = false; - i++; - }; - }; - }; - }; - if (((activated) && (!((this._bitmapForegroundContainer == null))))) + cellDisabled = this.addCellBitmapsElements(cell,cellCtr,hideFg,groundLayer); + } + } + } + else + { + cellDisabled = false; + cellPnt = Cell.cellPixelCoords(currentCellId); + cellCtr.x = cellCtr.startX = cellPnt.x; + cellCtr.y = cellCtr.startY = cellPnt.y; + } + if(!groundLayer) + { + layerCtr.addChild(cellCtr as DisplayObject); + } + else if(!this._hasGroundJPG && (groundLayer)) + { + this.drawGround(groundLayerCtr,cellCtr as BitmapCellContainer); + } + + this._dataMapContainer.getCellReference(currentCellId).addSprite(cellCtr as DisplayObject); + this._dataMapContainer.getCellReference(currentCellId).x = cellCtr.x; + this._dataMapContainer.getCellReference(currentCellId).y = cellCtr.y; + this._dataMapContainer.getCellReference(currentCellId).isDisabled = cellDisabled; + if(layerId == Layer.LAYER_DECOR) + { + this._dataMapContainer.getCellReference(currentCellId).heightestDecor = cellCtr as Sprite; + } + if(!aInteractiveCell[currentCellId] && !(layerId == Layer.LAYER_ADDITIONAL_DECOR)) + { + aInteractiveCell[currentCellId] = true; + cellInteractionCtr = this._icm.getCell(currentCellId); + cellInteractionCtr.y = cellCtr.y - (this._tacticModeActivated?0:this._map.cells[currentCellId].floor); + cellInteractionCtr.x = cellCtr.x; + if(!this._dataMapContainer.getChildByName(currentCellId.toString())) + { + DataMapContainer.interactiveCell[currentCellId] = new InteractiveCell(currentCellId,cellInteractionCtr,cellCtr.x,cellCtr.y - (this._tacticModeActivated?0:this._map.cells[currentCellId].floor)); + } + this._dataMapContainer.getCellReference(currentCellId).elevation = cellCtr.y - (this._tacticModeActivated?0:this._map.cells[currentCellId].floor); + this._dataMapContainer.getCellReference(currentCellId).mov = CellData(this._map.cells[currentCellId]).mov; + } + lastCellId = currentCellId; + } + if(!groundLayer) + { + layerCtr.mouseEnabled = false; + } + if(this._debugLayer) + { + t = new ColorTransform(); + t.color = Math.random() * 16777215; + layerCtr.transform.colorTransform = t; + } + if(!groundLayer) + { + layerCtr.scaleX = layerCtr.scaleY = 1 / _groundGlobalScaleRatio; + this._container.addChild(layerCtr); + } + else if(!this._hasGroundJPG && (groundLayer)) + { + reelBmpDt = new BitmapData(AtouinConstants.RESOLUTION_HIGH_QUALITY.x,AtouinConstants.RESOLUTION_HIGH_QUALITY.y,!this._renderBackgroundColor,this._renderBackgroundColor?this._map.backgroundColor:0); + m = new Matrix(); + m.scale(1 / _groundGlobalScaleRatio,1 / _groundGlobalScaleRatio); + reelBmpDt.lock(); + reelBmpDt.draw(groundLayerCtr.bitmapData,m,null,null,null,true); + reelBmpDt.unlock(); + tmp = new Bitmap(reelBmpDt,"auto",true); + tmp.x = -_bitmapOffsetPoint.x; + this._container.addChild(tmp); + } + + if(!this._skipGroundCache && !this._hasGroundJPG && layerId == Layer.LAYER_GROUND) + { + try + { + tsJpeg = getTimer(); + DataGroundMapManager.saveGroundMap(groundLayerCtr.bitmapData,this._map); + _log.info("Temps d\'encodage jpeg : " + (getTimer() - tsJpeg)) + " ms"; + } + catch(e:Error) + { + _log.fatal("Impossible de sauvegarder le sol de la map " + _map.id + " sous forme JPEG"); + _log.fatal(e.getStackTrace()); + continue; + } + } + } + } + this._bitmapForegroundContainer = new Bitmap(new BitmapData(StageShareManager.startWidth,StageShareManager.startHeight,true,this._map.backgroundColor),"auto",true); + this._bitmapForegroundContainer.x = -_bitmapOffsetPoint.x; + this.renderFixture(this._map.foregroundFixtures,this._bitmapForegroundContainer); + this._bitmapForegroundContainer.visible = !this._tacticModeActivated; + this._container.addChild(this._bitmapForegroundContainer); + if(!this._hasGroundJPG) + { + groundLayerCtr.cacheAsBitmap = true; + } + var selectionContainer:Sprite = new Sprite(); + this._container.addChild(selectionContainer); + selectionContainer.mouseEnabled = false; + selectionContainer.mouseChildren = false; + if(!this._hasGroundJPG || (this._groundIsLoaded)) + { + dispatchEvent(new RenderMapEvent(RenderMapEvent.MAP_RENDER_END,false,false,this._map.id,this._renderId)); + Atouin.getInstance().worldContainer.visible = true; + } + var atouin:Atouin = Atouin.getInstance(); + if(!(this._map.zoomScale == 1) && (atouin.options.useInsideAutoZoom)) + { + atouin.rootContainer.scaleX = this._map.zoomScale; + atouin.rootContainer.scaleY = this._map.zoomScale; + atouin.rootContainer.x = this._map.zoomOffsetX; + atouin.rootContainer.y = this._map.zoomOffsetY; + atouin.currentZoom = this._map.zoomScale; + } + else + { + Atouin.getInstance().zoom(1); + } + this._mapIsReady = true; + } + + private var colorTransform:ColorTransform; + + private function drawGround(param1:Bitmap, param2:BitmapCellContainer) : void + { + var _loc4_:Object = null; + var _loc5_:BitmapData = null; + var _loc6_:* = false; + var _loc7_:* = 0; + var _loc3_:BitmapData = param1.bitmapData; + var _loc8_:int = param2.numChildren; + _loc3_.lock(); + _loc7_ = 0; + while(_loc7_ < _loc8_) + { + if(!(param2.bitmaps[_loc7_] is BitmapData || param2.bitmaps[_loc7_] is Bitmap)) { - this._bitmapForegroundContainer.visible = false; + _log.error("Attention, un élément non bitmap tente d\'être ajouter au sol " + param2.bitmaps[_loc7_]); } else { - if (((!(activated)) && (!((this._bitmapForegroundContainer == null))))) - { - this._bitmapForegroundContainer.visible = true; - }; - }; - } - - public function isCellUnderFixture(pCellId:uint):Boolean - { - var cellRef:CellReference = this._dataMapContainer.getCellReference(pCellId); - return (this._bitmapForegroundContainer.bitmapData.hitTest(new Point(this._bitmapForegroundContainer.x, this._bitmapForegroundContainer.y), 0xFF, new Rectangle(cellRef.x, cellRef.y, AtouinConstants.CELL_WIDTH, AtouinConstants.CELL_HEIGHT))); - } - - private function makeMap():void - { - var layerCtr:DisplayObjectContainer; - var cellInteractionCtr:DisplayObjectContainer; - var groundLayerCtr:Bitmap; - var cellCtr:ICellContainer; - var cellPnt:Point; - var cellDisabled:Boolean; - var hideFg:Boolean; - var skipLayer:Boolean; - var groundLayer:Boolean; - var i:uint; - var nbCell:uint; - var cell:Cell; - var layer:Layer; - var endCell:Cell; - var t:ColorTransform; - var reelBmpDt:BitmapData; - var m:Matrix; - var tmp:Bitmap; - var tsJpeg:uint; - this._downloadTimer.stop(); - if (this._progressBarCtr.parent) - { - this._progressBarCtr.parent.removeChild(this._progressBarCtr); - }; - this._pictoAsBitmap = Atouin.getInstance().options.useCacheAsBitmap; - groundLayerCtr = new Bitmap(new BitmapData((StageShareManager.startWidth * _groundGlobalScaleRatio), (StageShareManager.startHeight * _groundGlobalScaleRatio), !(this._renderBackgroundColor), ((this._renderBackgroundColor) ? this._map.backgroundColor : 0)), "auto", true); - groundLayerCtr.x = (groundLayerCtr.x - _bitmapOffsetPoint.x); - var aInteractiveCell:Array = new Array(); - dispatchEvent(new RenderMapEvent(RenderMapEvent.MAP_RENDER_START, false, false, this._map.id, this._renderId)); - if (!(this._hasGroundJPG)) - { - this.renderFixture(this._map.backgroundFixtures, groundLayerCtr); - }; - InteractiveCellManager.getInstance().initManager(); - EntitiesManager.getInstance().initManager(); - if (this._renderBackgroundColor) - { - this._container.opaqueBackground = this._map.backgroundColor; - }; - var layerId:uint; - var groundOnly:Boolean = OptionManager.getOptionManager("atouin").groundOnly; - var lastCellId:int; - var currentCellId:uint; - for each (layer in this._map.layers) + _loc5_ = param2.bitmaps[_loc7_] is Bitmap?Bitmap(param2.bitmaps[_loc7_]).bitmapData:param2.bitmaps[_loc7_]; + _loc4_ = param2.datas[_loc7_]; + if(!(_loc5_ == null || _loc4_ == null)) + { + if(param2.colorTransforms[_loc7_] != null) + { + _loc6_ = true; + this.colorTransform.redMultiplier = param2.colorTransforms[_loc7_].red; + this.colorTransform.greenMultiplier = param2.colorTransforms[_loc7_].green; + this.colorTransform.blueMultiplier = param2.colorTransforms[_loc7_].blue; + this.colorTransform.alphaMultiplier = param2.colorTransforms[_loc7_].alpha; + } + else + { + _loc6_ = false; + } + this._destPoint.x = _loc4_.x + param2.x; + if(_groundGlobalScaleRatio != 1) + { + this._destPoint.x = this._destPoint.x * _groundGlobalScaleRatio; + } + this._destPoint.x = this._destPoint.x + _bitmapOffsetPoint.x; + this._destPoint.y = _loc4_.y + param2.y; + if(_groundGlobalScaleRatio != 1) + { + this._destPoint.y = this._destPoint.y * _groundGlobalScaleRatio; + } + this._srcRect.width = _loc5_.width; + this._srcRect.height = _loc5_.height; + if(!(_loc4_.scaleX == 1) || !(_loc4_.scaleY == 1) || (_loc6_)) + { + this._m.identity(); + this._m.scale(_loc4_.scaleX,_loc4_.scaleY); + this._m.translate(this._destPoint.x,this._destPoint.y); + _loc3_.draw(_loc5_,this._m,this.colorTransform,null,null,false); + } + else + { + _loc3_.copyPixels(_loc5_,this._srcRect,this._destPoint); + } + } + } + _loc7_++; + } + _loc3_.unlock(); + } + + private var _m:Matrix; + + private var _srcRect:Rectangle; + + private var _destPoint:Point; + + private function groundMapLoaded(param1:Bitmap) : void + { + this._groundIsLoaded = true; + if(this._mapIsReady) + { + dispatchEvent(new RenderMapEvent(RenderMapEvent.MAP_RENDER_END,false,false,this._map.id,this._renderId)); + Atouin.getInstance().worldContainer.visible = true; + } + if(!this._tacticModeActivated) + { + param1.x = param1.x - _bitmapOffsetPoint.x; + this._container.addChildAt(param1,0); + } + param1.smoothing = true; + } + + private function groundMapNotLoaded(param1:int) : void + { + var _loc2_:MapDisplayManager = null; + if(this._map.id == param1) + { + _loc2_ = MapDisplayManager.getInstance(); + _loc2_.display(_loc2_.currentMapPoint,true); + } + } + + private function addCellBitmapsElements(param1:Cell, param2:ICellContainer, param3:Boolean = false, param4:Boolean = false) : Boolean + { + var elementDo:Object = null; + var data:VisualData = null; + var colors:Object = null; + var ge:GraphicalElement = null; + var ed:GraphicalElementData = null; + var bounds:Rectangle = null; + var element:BasicElement = null; + var ged:NormalGraphicalElementData = null; + var eed:EntityGraphicalElementData = null; + var elementLook:TiphonEntityLook = null; + var ts:WorldEntitySprite = null; + var ped:ParticlesGraphicalElementData = null; + var objectInfo:Object = null; + var applicationDomain:ApplicationDomain = null; + var ra:RasterizedAnimation = null; + var renderer:DisplayObjectRenderer = null; + var elemenForDebug:DisplayObject = null; + var ie:Object = null; + var namedSprite:Sprite = null; + var elementDOC:DisplayObjectContainer = null; + var bmp:Bitmap = null; + var shape:Shape = null; + var cell:Cell = param1; + var cellCtr:ICellContainer = param2; + var transparent:Boolean = param3; + var ground:Boolean = param4; + var disabled:Boolean = false; + var mouseChildren:Boolean = false; + var cacheAsBitmap:Boolean = true; + var hasBlendMode:Boolean = false; + var lsElements:Array = cell.elements; + var nbElements:int = lsElements.length; + var i:int = 0; + for(;i < nbElements;i++) + { + data = new VisualData(); + element = lsElements[i]; + switch(element.elementType) { - layerId = layer.layerId; - if (layer.layerId != Layer.LAYER_GROUND) - { - layerCtr = this._dataMapContainer.getLayer(layerId); - } - else - { - layerCtr = null; - }; - groundLayer = (layerCtr == null); - hideFg = ((layerId) && (this._hideForeground)); - skipLayer = groundOnly; - if (layer.cellsCount != 0) - { - if ((layer.cells[(layer.cells.length - 1)] as Cell).cellId != (AtouinConstants.MAP_CELLS_COUNT - 1)) - { - endCell = new Cell(layer); - endCell.cellId = (AtouinConstants.MAP_CELLS_COUNT - 1); - endCell.elementsCount = 0; - endCell.elements = []; - layer.cells.push(endCell); - }; - i = 0; - nbCell = layer.cells.length; - while (i < nbCell) - { - cell = layer.cells[i]; - currentCellId = cell.cellId; - if (layerId == Layer.LAYER_GROUND) + case ElementTypesEnum.GRAPHICAL: + ge = GraphicalElement(element); + ed = this._elements.getElementData(ge.elementId); + if(!ed) + { + continue; + } + switch(true) + { + case ed is NormalGraphicalElementData: + ged = ed as NormalGraphicalElementData; + if(ged is AnimatedGraphicalElementData) { - if ((currentCellId - lastCellId) > 1) - { - currentCellId = (lastCellId + 1); - cell = null; - } - else - { - i++; - }; + objectInfo = this._swfGfx[ged.gfxId]; + applicationDomain = this._swfApplicationDomain[ged.gfxId]; + if(objectInfo == null) + { + _log.fatal("Impossible d\'afficher l\'élément " + ged.gfxId + " : instance non trouvée"); + break; + } + if(applicationDomain.hasDefinition("FX_0")) + { + elementDo = new applicationDomain.getDefinition("FX_0")() as Sprite; + } + else if(this._map.getGfxCount(ged.gfxId) > 1) + { + if(ASwf(objectInfo).content == null) + { + _log.fatal("Impossible d\'afficher le picto " + ged.gfxId + " (format swf), le swf est probablement compilé en AS2"); + continue; + } + ra = new RasterizedAnimation(ASwf(objectInfo).content as MovieClip,String(ged.gfxId)); + ra.gotoAndStop("1"); + ra.smoothing = true; + elementDo = FpsControler.controlFps(ra,uint.MAX_VALUE); + cacheAsBitmap = false; + } + else + { + elementDo = ASwf(objectInfo).content; + if(elementDo is MovieClip) + { + if(!MovieClipUtils.isSingleFrame(elementDo as MovieClip)) + { + cacheAsBitmap = false; + } + } + } + + data.scaleX = 1; + data.x = data.y = 0; } - else + else if(ground) { - i++; - }; - if (groundLayer) - { - cellCtr = new BitmapCellContainer(currentCellId); + elementDo = this._bitmapsGfx[ged.gfxId]; } else { - cellCtr = new CellContainer(currentCellId); - }; - cellCtr.layerId = layerId; - cellCtr.mouseEnabled = false; - if (cell) - { - cellPnt = cell.pixelCoords; - cellCtr.x = (cellCtr.startX = (int(Math.round(cellPnt.x)) * (((cellCtr is CellContainer)) ? _groundGlobalScaleRatio : 1))); - cellCtr.y = (cellCtr.startY = (int(Math.round(cellPnt.y)) * (((cellCtr is CellContainer)) ? _groundGlobalScaleRatio : 1))); - if (!(skipLayer)) - { - if (((!(this._hasGroundJPG)) || (!(groundLayer)))) - { - cellDisabled = this.addCellBitmapsElements(cell, cellCtr, hideFg, groundLayer); - }; - }; + elementDo = new MapGfxBitmap(this._bitmapsGfx[ged.gfxId],"never",this._useSmooth,ge.identifier); + elementDo.cacheAsBitmap = this._pictoAsBitmap; + if(this._pictoAsBitmap) + { + cachedAsBitmapElement.push(elementDo); + } } - else + + data.x = data.x - ged.origin.x; + data.y = data.y - ged.origin.y; + if(ged.horizontalSymmetry) { - cellDisabled = false; - cellPnt = Cell.cellPixelCoords(currentCellId); - cellCtr.x = (cellCtr.startX = cellPnt.x); - cellCtr.y = (cellCtr.startY = cellPnt.y); - }; - if (!(groundLayer)) - { - layerCtr.addChild((cellCtr as DisplayObject)); + data.scaleX = data.scaleX * -1; + if(ged is AnimatedGraphicalElementData) + { + data.x = data.x + ASwf(this._swfGfx[ged.gfxId]).loaderWidth; + } + else if(elementDo) + { + data.x = data.x + elementDo.width; + } + } - else + if(ged is BoundingBoxGraphicalElementData) { - if (((!(this._hasGroundJPG)) && (groundLayer))) - { - this.drawGround(groundLayerCtr, (cellCtr as BitmapCellContainer)); - }; - }; - this._dataMapContainer.getCellReference(currentCellId).addSprite((cellCtr as DisplayObject)); - this._dataMapContainer.getCellReference(currentCellId).x = cellCtr.x; - this._dataMapContainer.getCellReference(currentCellId).y = cellCtr.y; - this._dataMapContainer.getCellReference(currentCellId).isDisabled = cellDisabled; - if (layerId == Layer.LAYER_DECOR) - { - this._dataMapContainer.getCellReference(currentCellId).heightestDecor = (cellCtr as Sprite); - }; - if (((!(aInteractiveCell[currentCellId])) && (!((layerId == Layer.LAYER_ADDITIONAL_DECOR))))) + data.alpha = 0; + boundingBoxElements[ge.identifier] = true; + } + if(elementDo is InteractiveObject) { - aInteractiveCell[currentCellId] = true; - cellInteractionCtr = this._icm.getCell(currentCellId); - cellInteractionCtr.y = (cellCtr.y - ((this._tacticModeActivated) ? 0 : this._map.cells[currentCellId].floor)); - cellInteractionCtr.x = cellCtr.x; - if (!(this._dataMapContainer.getChildByName(currentCellId.toString()))) - { - DataMapContainer.interactiveCell[currentCellId] = new InteractiveCell(currentCellId, cellInteractionCtr, cellCtr.x, (cellCtr.y - ((this._tacticModeActivated) ? 0 : this._map.cells[currentCellId].floor))); - }; - this._dataMapContainer.getCellReference(currentCellId).elevation = (cellCtr.y - ((this._tacticModeActivated) ? 0 : this._map.cells[currentCellId].floor)); - this._dataMapContainer.getCellReference(currentCellId).mov = CellData(this._map.cells[currentCellId]).mov; - }; - lastCellId = currentCellId; - }; - if (!(groundLayer)) - { - layerCtr.mouseEnabled = false; - }; - if (this._debugLayer) - { - t = new ColorTransform(); - t.color = (Math.random() * 0xFFFFFF); - layerCtr.transform.colorTransform = t; - }; - if (!(groundLayer)) - { - layerCtr.scaleX = (layerCtr.scaleY = (1 / _groundGlobalScaleRatio)); - this._container.addChild(layerCtr); - } - else - { - if (((!(this._hasGroundJPG)) && (groundLayer))) + (elementDo as InteractiveObject).mouseEnabled = false; + if(elementDo is DisplayObjectContainer) + { + (elementDo as DisplayObjectContainer).mouseChildren = false; + } + } + if(ed is BlendedGraphicalElementData && (elementDo.hasOwnProperty("blendMode"))) { - reelBmpDt = new BitmapData(AtouinConstants.RESOLUTION_HIGH_QUALITY.x, AtouinConstants.RESOLUTION_HIGH_QUALITY.y, !(this._renderBackgroundColor), ((this._renderBackgroundColor) ? this._map.backgroundColor : 0)); - m = new Matrix(); - m.scale((1 / _groundGlobalScaleRatio), (1 / _groundGlobalScaleRatio)); - reelBmpDt.lock(); - reelBmpDt.draw(groundLayerCtr.bitmapData, m, null, null, null, true); - reelBmpDt.unlock(); - tmp = new Bitmap(reelBmpDt, "auto", true); - tmp.x = -(_bitmapOffsetPoint.x); - this._container.addChild(tmp); - }; - }; - if (((((!(this._skipGroundCache)) && (!(this._hasGroundJPG)))) && ((layerId == Layer.LAYER_GROUND)))) - { + elementDo.blendMode = (ed as BlendedGraphicalElementData).blendMode; + elementDo.cacheAsBitmap = false; + hasBlendMode = true; + } + break; + case ed is EntityGraphicalElementData: + eed = ed as EntityGraphicalElementData; + elementLook = null; try { - tsJpeg = getTimer(); - DataGroundMapManager.saveGroundMap(groundLayerCtr.bitmapData, this._map); - (_log.info(("Temps d'encodage jpeg : " + (getTimer() - tsJpeg))) + " ms"); + elementLook = TiphonEntityLook.fromString(eed.entityLook); } catch(e:Error) { - _log.fatal((("Impossible de sauvegarder le sol de la map " + _map.id) + " sous forme JPEG")); - _log.fatal(e.getStackTrace()); - }; - }; - }; - }; - this._bitmapForegroundContainer = new Bitmap(new BitmapData(StageShareManager.startWidth, StageShareManager.startHeight, true, this._map.backgroundColor), "auto", true); - this._bitmapForegroundContainer.x = -(_bitmapOffsetPoint.x); - this.renderFixture(this._map.foregroundFixtures, this._bitmapForegroundContainer); - this._bitmapForegroundContainer.visible = !(this._tacticModeActivated); - this._container.addChild(this._bitmapForegroundContainer); - if (!(this._hasGroundJPG)) - { - groundLayerCtr.cacheAsBitmap = true; - }; - var selectionContainer:Sprite = new Sprite(); - this._container.addChild(selectionContainer); - selectionContainer.mouseEnabled = false; - selectionContainer.mouseChildren = false; - if (((!(this._hasGroundJPG)) || (this._groundIsLoaded))) - { - dispatchEvent(new RenderMapEvent(RenderMapEvent.MAP_RENDER_END, false, false, this._map.id, this._renderId)); - Atouin.getInstance().worldContainer.visible = true; - }; - var atouin:Atouin = Atouin.getInstance(); - if (((!((this._map.zoomScale == 1))) && (atouin.options.useInsideAutoZoom))) - { - atouin.rootContainer.scaleX = this._map.zoomScale; - atouin.rootContainer.scaleY = this._map.zoomScale; - atouin.rootContainer.x = this._map.zoomOffsetX; - atouin.rootContainer.y = this._map.zoomOffsetY; - atouin.currentZoom = this._map.zoomScale; - } - else - { - Atouin.getInstance().zoom(1); - }; - this._mapIsReady = true; - } - - private function drawGround(groundLayerCtr:Bitmap, cellCtr:BitmapCellContainer):void - { - var data:Object; - var bmpdt:BitmapData; - var hasColorTransform:Boolean; - var i:int; - var ground:BitmapData = groundLayerCtr.bitmapData; - var len:int = cellCtr.numChildren; - ground.lock(); - i = 0; - while (i < len) - { - if (!((((cellCtr.bitmaps[i] is BitmapData)) || ((cellCtr.bitmaps[i] is Bitmap))))) - { - _log.error(("Attention, un élément non bitmap tente d'être ajouter au sol " + cellCtr.bitmaps[i])); - } - else - { - bmpdt = (((cellCtr.bitmaps[i] is Bitmap)) ? Bitmap(cellCtr.bitmaps[i]).bitmapData : cellCtr.bitmaps[i]); - data = cellCtr.datas[i]; - if (!(((bmpdt == null)) || ((data == null)))) - { - if (cellCtr.colorTransforms[i] != null) - { - hasColorTransform = true; - this.colorTransform.redMultiplier = cellCtr.colorTransforms[i].red; - this.colorTransform.greenMultiplier = cellCtr.colorTransforms[i].green; - this.colorTransform.blueMultiplier = cellCtr.colorTransforms[i].blue; - this.colorTransform.alphaMultiplier = cellCtr.colorTransforms[i].alpha; + _log.warn("Error in the Entity Element " + ed.id + "; misconstructed look string."); + break; } - else - { - hasColorTransform = false; - }; - this._destPoint.x = (data.x + cellCtr.x); - if (_groundGlobalScaleRatio != 1) - { - this._destPoint.x = (this._destPoint.x * _groundGlobalScaleRatio); - }; - this._destPoint.x = (this._destPoint.x + _bitmapOffsetPoint.x); - this._destPoint.y = (data.y + cellCtr.y); - if (_groundGlobalScaleRatio != 1) + ts = new WorldEntitySprite(elementLook,cell.cellId,ge.identifier); + ts.setDirection(0); + ts.mouseChildren = false; + ts.mouseEnabled = false; + ts.cacheAsBitmap = this._pictoAsBitmap; + if(this._pictoAsBitmap) { - this._destPoint.y = (this._destPoint.y * _groundGlobalScaleRatio); - }; - this._srcRect.width = bmpdt.width; - this._srcRect.height = bmpdt.height; - if (((((!((data.scaleX == 1))) || (!((data.scaleY == 1))))) || (hasColorTransform))) - { - this._m.identity(); - this._m.scale(data.scaleX, data.scaleY); - this._m.translate(this._destPoint.x, this._destPoint.y); - ground.draw(bmpdt, this._m, this.colorTransform, null, null, false); + cachedAsBitmapElement.push(ts); } - else + if(this.useDefautState) { - ground.copyPixels(bmpdt, this._srcRect, this._destPoint); - }; - }; - }; - i++; - }; - ground.unlock(); - } - - private function groundMapLoaded(ground:Bitmap):void - { - this._groundIsLoaded = true; - if (this._mapIsReady) - { - dispatchEvent(new RenderMapEvent(RenderMapEvent.MAP_RENDER_END, false, false, this._map.id, this._renderId)); - Atouin.getInstance().worldContainer.visible = true; - }; - if (!(this._tacticModeActivated)) - { - ground.x = (ground.x - _bitmapOffsetPoint.x); - this._container.addChildAt(ground, 0); - }; - ground.smoothing = true; - } - - private function groundMapNotLoaded(mapId:int):void - { - var mapDisplayManager:MapDisplayManager; - if (this._map.id == mapId) - { - mapDisplayManager = MapDisplayManager.getInstance(); - mapDisplayManager.display(mapDisplayManager.currentMapPoint, true); - }; - } - - private function addCellBitmapsElements(cell:Cell, cellCtr:ICellContainer, transparent:Boolean=false, ground:Boolean=false):Boolean - { - var elementDo:Object; - var data:VisualData; - var colors:Object; - var ge:GraphicalElement; - var ed:GraphicalElementData; - var bounds:Rectangle; - var element:BasicElement; - var ged:NormalGraphicalElementData; - var eed:EntityGraphicalElementData; - var elementLook:TiphonEntityLook; - var ts:WorldEntitySprite; - var ped:ParticlesGraphicalElementData; - var objectInfo:Object; - var applicationDomain:ApplicationDomain; - var ra:RasterizedAnimation; - var renderer:DisplayObjectRenderer; - var elemenForDebug:DisplayObject; - var ie:Object; - var namedSprite:Sprite; - var elementDOC:DisplayObjectContainer; - var bmp:Bitmap; - var shape:Shape; - var disabled:Boolean; - var mouseChildren:Boolean; - var cacheAsBitmap:Boolean = true; - var hasBlendMode:Boolean; - var lsElements:Array = cell.elements; - var nbElements:int = lsElements.length; - var i:int; - for (;i < nbElements;(i = (i + 1))) - { - data = new VisualData(); - element = lsElements[i]; - switch (element.elementType) - { - case ElementTypesEnum.GRAPHICAL: - ge = GraphicalElement(element); - ed = this._elements.getElementData(ge.elementId); - if (!(ed)) continue; - switch (true) - { - case (ed is NormalGraphicalElementData): - ged = (ed as NormalGraphicalElementData); - if ((ged is AnimatedGraphicalElementData)) - { - objectInfo = this._swfGfx[ged.gfxId]; - applicationDomain = this._swfApplicationDomain[ged.gfxId]; - if (objectInfo == null) - { - _log.fatal((("Impossible d'afficher l'élément " + ged.gfxId) + " : instance non trouvée")); - break; - }; - if (applicationDomain.hasDefinition("FX_0")) - { - elementDo = (new (applicationDomain.getDefinition("FX_0"))() as Sprite); - } - else - { - if (this._map.getGfxCount(ged.gfxId) > 1) - { - if (ASwf(objectInfo).content == null) - { - _log.fatal((("Impossible d'afficher le picto " + ged.gfxId) + " (format swf), le swf est probablement compilé en AS2")); - continue; - }; - ra = new RasterizedAnimation((ASwf(objectInfo).content as MovieClip), String(ged.gfxId)); - ra.gotoAndStop("1"); - ra.smoothing = true; - elementDo = FpsControler.controlFps(ra, uint.MAX_VALUE); - cacheAsBitmap = false; - } - else - { - elementDo = ASwf(objectInfo).content; - if ((elementDo is MovieClip)) - { - if (!(MovieClipUtils.isSingleFrame((elementDo as MovieClip)))) - { - cacheAsBitmap = false; - }; - }; - }; - }; - data.scaleX = 1; - data.x = (data.y = 0); - } - else - { - if (ground) - { - elementDo = this._bitmapsGfx[ged.gfxId]; - } - else - { - elementDo = new MapGfxBitmap(this._bitmapsGfx[ged.gfxId], "never", this._useSmooth, ge.identifier); - elementDo.cacheAsBitmap = this._pictoAsBitmap; - if (this._pictoAsBitmap) - { - cachedAsBitmapElement.push(elementDo); - }; - }; - }; - data.x = (data.x - ged.origin.x); - data.y = (data.y - ged.origin.y); - if (ged.horizontalSymmetry) - { - data.scaleX = (data.scaleX * -1); - if ((ged is AnimatedGraphicalElementData)) - { - data.x = (data.x + ASwf(this._swfGfx[ged.gfxId]).loaderWidth); - } - else - { - if (elementDo) - { - data.x = (data.x + elementDo.width); - }; - }; - }; - if ((ged is BoundingBoxGraphicalElementData)) - { - data.alpha = 0; - boundingBoxElements[ge.identifier] = true; - }; - if ((elementDo is InteractiveObject)) - { - (elementDo as InteractiveObject).mouseEnabled = false; - if ((elementDo is DisplayObjectContainer)) - { - (elementDo as DisplayObjectContainer).mouseChildren = false; - }; - }; - if ((((ed is BlendedGraphicalElementData)) && (elementDo.hasOwnProperty("blendMode")))) - { - elementDo.blendMode = (ed as BlendedGraphicalElementData).blendMode; - elementDo.cacheAsBitmap = false; - hasBlendMode = true; - }; - break; - case (ed is EntityGraphicalElementData): - eed = (ed as EntityGraphicalElementData); - elementLook = null; - try - { - elementLook = TiphonEntityLook.fromString(eed.entityLook); - } - catch(e:Error) - { - _log.warn((("Error in the Entity Element " + ed.id) + "; misconstructed look string.")); - break; - }; - ts = new WorldEntitySprite(elementLook, cell.cellId, ge.identifier); - ts.setDirection(0); - ts.mouseChildren = false; - ts.mouseEnabled = false; - ts.cacheAsBitmap = this._pictoAsBitmap; - if (this._pictoAsBitmap) - { - cachedAsBitmapElement.push(ts); - }; - if (this.useDefautState) - { - ts.setAnimationAndDirection("AnimState0", 0); - }; - if (eed.horizontalSymmetry) - { - data.scaleX = (data.scaleX * -1); - }; - this._dataMapContainer.addAnimatedElement(ts, eed); - elementDo = ts; - break; - case (ed is ParticlesGraphicalElementData): - ped = (ed as ParticlesGraphicalElementData); - if (this._allowParticlesFx) - { - renderer = new DisplayObjectRenderer(); - renderer.mouseChildren = false; - renderer.mouseEnabled = false; - cacheAsBitmap = false; - ScriptExec.exec(new Uri(((this._particlesPath + ped.scriptId) + ".dx")), new EmitterRunner(renderer, null), true, null); - elementDo = (renderer as DisplayObject); - }; - break; - }; - if (elementDo == null) - { - _log.warn((((("A graphical element was missed (Element ID " + ge.elementId) + "; Cell ") + ge.cell.cellId) + ").")); - break; - }; - if (!(ge.colorMultiplicator.isOne())) - { - colors = { - "red":(ge.colorMultiplicator.red / 0xFF), - "green":(ge.colorMultiplicator.green / 0xFF), - "blue":(ge.colorMultiplicator.blue / 0xFF), - "alpha":data.alpha - }; - }; - if (transparent) + ts.setAnimationAndDirection("AnimState0",0); + } + if(eed.horizontalSymmetry) { - data.alpha = 0.5; - }; - if (ge.identifier > 0) + data.scaleX = data.scaleX * -1; + } + this._dataMapContainer.addAnimatedElement(ts,eed); + elementDo = ts; + break; + case ed is ParticlesGraphicalElementData: + ped = ed as ParticlesGraphicalElementData; + if(this._allowParticlesFx) { - elemenForDebug = (elementDo as DisplayObject); - if (((!((elementDo is InteractiveObject))) || ((elementDo is DisplayObjectContainer)))) - { - namedSprite = new SpriteWrapper((elementDo as DisplayObject), ge.identifier); - namedSprite.alpha = elementDo.alpha; - elementDo.alpha = 1; - if (colors.alpha > 0) - { - elementDo.transform.colorTransform = new ColorTransform(colors.red, colors.green, colors.blue, colors.alpha); - }; - colors = null; - elementDo = namedSprite; - }; - mouseChildren = true; - elementDo.cacheAsBitmap = true; - cachedAsBitmapElement.push(elementDo); - if ((elementDo is DisplayObjectContainer)) - { - elementDOC = (elementDo as DisplayObjectContainer); - elementDOC.mouseChildren = false; - }; - ie = new Object(); - this._identifiedElements[ge.identifier] = ie; - ie.sprite = elementDo; - ie.position = MapPoint.fromCellId(cell.cellId); - }; - data.x = (data.x + Math.round((AtouinConstants.CELL_HALF_WIDTH + ge.pixelOffset.x))); - data.y = (data.y + Math.round(((AtouinConstants.CELL_HALF_HEIGHT - (ge.altitude * 10)) + ge.pixelOffset.y))); + renderer = new DisplayObjectRenderer(); + renderer.mouseChildren = false; + renderer.mouseEnabled = false; + cacheAsBitmap = false; + ScriptExec.exec(new Uri(this._particlesPath + ped.scriptId + ".dx"),new EmitterRunner(renderer,null),true,null); + elementDo = renderer as DisplayObject; + } break; - }; - if (elementDo) - { - cellCtr.addFakeChild(elementDo, data, colors); - } - else - { - if (element.elementType != ElementTypesEnum.SOUND) - { - if (this._ceilBitmapData == null) + } + if(elementDo == null) + { + _log.warn("A graphical element was missed (Element ID " + ge.elementId + "; Cell " + ge.cell.cellId + ")."); + break; + } + if(!ge.colorMultiplicator.isOne()) + { + colors = { + "red":ge.colorMultiplicator.red / 255, + "green":ge.colorMultiplicator.green / 255, + "blue":ge.colorMultiplicator.blue / 255, + "alpha":data.alpha + }; + } + if(transparent) + { + data.alpha = 0.5; + } + if(ge.identifier > 0) + { + elemenForDebug = elementDo as DisplayObject; + if(!(elementDo is InteractiveObject) || elementDo is DisplayObjectContainer) + { + namedSprite = new SpriteWrapper(elementDo as DisplayObject,ge.identifier); + namedSprite.alpha = elementDo.alpha; + elementDo.alpha = 1; + if(colors.alpha > 0) { - this._ceilBitmapData = new BitmapData(AtouinConstants.CELL_WIDTH, AtouinConstants.CELL_HEIGHT, false, 0xCC00CC); - shape = new Shape(); - shape.graphics.beginFill(0xCC00CC); - shape.graphics.drawRect(0, 0, AtouinConstants.CELL_WIDTH, AtouinConstants.CELL_HEIGHT); - shape.graphics.endFill(); - this._ceilBitmapData.draw(shape); - }; - bmp = new Bitmap(this._ceilBitmapData); - cellCtr.addFakeChild(bmp, null, null); - }; - }; - }; - if (((this._pictoAsBitmap) && (!(hasBlendMode)))) + elementDo.transform.colorTransform = new ColorTransform(colors.red,colors.green,colors.blue,colors.alpha); + } + colors = null; + elementDo = namedSprite; + } + mouseChildren = true; + elementDo.cacheAsBitmap = true; + cachedAsBitmapElement.push(elementDo); + if(elementDo is DisplayObjectContainer) + { + elementDOC = elementDo as DisplayObjectContainer; + elementDOC.mouseChildren = false; + } + ie = new Object(); + this._identifiedElements[ge.identifier] = ie; + ie.sprite = elementDo; + ie.position = MapPoint.fromCellId(cell.cellId); + } + data.x = data.x + Math.round(AtouinConstants.CELL_HALF_WIDTH + ge.pixelOffset.x); + data.y = data.y + Math.round(AtouinConstants.CELL_HALF_HEIGHT - ge.altitude * 10 + ge.pixelOffset.y); + break; + } + if(elementDo) { - cellCtr.cacheAsBitmap = cacheAsBitmap; - if (cacheAsBitmap) - { - cachedAsBitmapElement.push(cellCtr); - }; + cellCtr.addFakeChild(elementDo,data,colors); } else { - cellCtr.cacheAsBitmap = false; - }; - cellCtr.mouseChildren = mouseChildren; - return (disabled); - } - - private function renderFixture(fixtures:Array, container:Bitmap):void - { - var bmpdt:BitmapData; - var fixture:Fixture; - var width:Number; - var height:Number; - var halfWidth:Number; - var halfHeight:Number; - if ((((((fixtures == null)) || ((fixtures.length == 0)))) || (!(this._renderFixture)))) - { - return; - }; - var smoothing:Boolean = OptionManager.getOptionManager("atouin").useSmooth; - for each (fixture in fixtures) - { - bmpdt = this._bitmapsGfx[fixture.fixtureId]; - if (!(bmpdt)) - { - ErrorManager.addError((("Fixture " + fixture.fixtureId) + " file is missing ")); - } - else - { - width = bmpdt.width; - height = bmpdt.height; - halfWidth = (width * 0.5); - halfHeight = (height * 0.5); - this._m.identity(); - this._m.translate(-(halfWidth), -(halfHeight)); - this._m.scale((fixture.xScale / 1000), (fixture.yScale / 1000)); - this._m.rotate(((fixture.rotation / 100) * (Math.PI / 180))); - this._m.translate((((fixture.offset.x + _bitmapOffsetPoint.x) + halfWidth) + AtouinConstants.CELL_HALF_WIDTH), ((fixture.offset.y + AtouinConstants.CELL_HEIGHT) + halfHeight)); - container.bitmapData.lock(); - if (((((((fixture.redMultiplier) || (fixture.greenMultiplier))) || (fixture.blueMultiplier))) || (!((fixture.alpha == 1))))) - { - this._clTrans.redMultiplier = ((fixture.redMultiplier / 127) + 1); - this._clTrans.greenMultiplier = ((fixture.greenMultiplier / 127) + 1); - this._clTrans.blueMultiplier = ((fixture.blueMultiplier / 127) + 1); - this._clTrans.alphaMultiplier = (fixture.alpha / 0xFF); - container.bitmapData.draw(bmpdt, this._m, this._clTrans, null, null, smoothing); - } - else - { - container.bitmapData.draw(bmpdt, this._m, null, null, null, smoothing); - }; - container.bitmapData.unlock(); - }; - }; - } - - public function get container():DisplayObjectContainer - { - return (this._container); - } - - private function onAllGfxLoaded(e:ResourceLoaderProgressEvent):void - { - if (this._cancelRender) - { - return; - }; - this._loadedGfxListCount++; - if (((((this._hasBitmapGxf) && (this._hasSwfGxf))) && (!((this._loadedGfxListCount == 2))))) + if(element.elementType != ElementTypesEnum.SOUND) + { + if(this._ceilBitmapData == null) + { + this._ceilBitmapData = new BitmapData(AtouinConstants.CELL_WIDTH,AtouinConstants.CELL_HEIGHT,false,13369548); + shape = new Shape(); + shape.graphics.beginFill(13369548); + shape.graphics.drawRect(0,0,AtouinConstants.CELL_WIDTH,AtouinConstants.CELL_HEIGHT); + shape.graphics.endFill(); + this._ceilBitmapData.draw(shape); + } + bmp = new Bitmap(this._ceilBitmapData); + cellCtr.addFakeChild(bmp,null,null); + } + continue; + } + } + if((this._pictoAsBitmap) && !hasBlendMode) + { + cellCtr.cacheAsBitmap = cacheAsBitmap; + if(cacheAsBitmap) { - return; - }; - this._mapLoaded = true; - dispatchEvent(new Event(RenderMapEvent.GFX_LOADING_END)); - this.makeMap(); - } - - private function onBitmapGfxLoaded(e:ResourceLoadedEvent):void - { - if (this._cancelRender) + cachedAsBitmapElement.push(cellCtr); + } + } + else + { + cellCtr.cacheAsBitmap = false; + } + cellCtr.mouseChildren = mouseChildren; + return disabled; + } + + private var _ceilBitmapData:BitmapData; + + private function renderFixture(param1:Array, param2:Bitmap) : void + { + var _loc4_:BitmapData = null; + var _loc5_:Fixture = null; + var _loc6_:* = NaN; + var _loc7_:* = NaN; + var _loc8_:* = NaN; + var _loc9_:* = NaN; + if(param1 == null || param1.length == 0 || !this._renderFixture) + { + return; + } + var _loc3_:Boolean = OptionManager.getOptionManager("atouin").useSmooth; + for each(_loc5_ in param1) + { + _loc4_ = this._bitmapsGfx[_loc5_.fixtureId]; + if(!_loc4_) { - return; - }; - this._fileLoaded++; - this._downloadProgressBar.scaleX = (this._fileLoaded / this._fileToLoad); - dispatchEvent(new ProgressEvent(ProgressEvent.PROGRESS, false, false, this._fileLoaded, this._fileToLoad)); - this._bitmapsGfx[e.uri.tag] = e.resource; - this._gfxMemorySize = (this._gfxMemorySize + ((BitmapData(e.resource).width * BitmapData(e.resource).height) * 4)); - MEMORY_LOG_1[e.resource] = 1; - } - - private function onSwfGfxLoaded(e:ResourceLoadedEvent):void - { - this._fileLoaded++; - this._downloadProgressBar.scaleX = (this._fileLoaded / this._fileToLoad); - dispatchEvent(new ProgressEvent(ProgressEvent.PROGRESS, false, false, this._fileLoaded, this._fileToLoad)); - this._swfGfx[e.uri.tag] = e.resource; - MEMORY_LOG_2[e.resource] = 1; - } - - private function onGfxError(e:ResourceErrorEvent):void - { - _log.error(("Unable to load " + e.uri)); - } - - private function onDownloadTimer(e:TimerEvent):void - { - if (Atouin.getInstance().options.showProgressBar) + ErrorManager.addError("Fixture " + _loc5_.fixtureId + " file is missing "); + } + else { - this._container.addChild(this._progressBarCtr); - }; - } - - - } -}//package com.ankamagames.atouin.renderers - -class VisualData + _loc6_ = _loc4_.width; + _loc7_ = _loc4_.height; + _loc8_ = _loc6_ * 0.5; + _loc9_ = _loc7_ * 0.5; + this._m.identity(); + this._m.translate(-_loc8_,-_loc9_); + this._m.scale(_loc5_.xScale / 1000,_loc5_.yScale / 1000); + this._m.rotate(_loc5_.rotation / 100 * Math.PI / 180); + this._m.translate(_loc5_.offset.x + _bitmapOffsetPoint.x + _loc8_ + AtouinConstants.CELL_HALF_WIDTH,_loc5_.offset.y + AtouinConstants.CELL_HEIGHT + _loc9_); + param2.bitmapData.lock(); + if((_loc5_.redMultiplier) || (_loc5_.greenMultiplier) || (_loc5_.blueMultiplier) || !(_loc5_.alpha == 1)) + { + this._clTrans.redMultiplier = _loc5_.redMultiplier / 127 + 1; + this._clTrans.greenMultiplier = _loc5_.greenMultiplier / 127 + 1; + this._clTrans.blueMultiplier = _loc5_.blueMultiplier / 127 + 1; + this._clTrans.alphaMultiplier = _loc5_.alpha / 255; + param2.bitmapData.draw(_loc4_,this._m,this._clTrans,null,null,_loc3_); + } + else + { + param2.bitmapData.draw(_loc4_,this._m,null,null,null,_loc3_); + } + param2.bitmapData.unlock(); + } + } + } + + private var _clTrans:ColorTransform; + + public function get container() : DisplayObjectContainer + { + return this._container; + } + + private function onAllGfxLoaded(param1:ResourceLoaderProgressEvent) : void + { + if(this._cancelRender) + { + return; + } + this._loadedGfxListCount++; + if((this._hasBitmapGxf) && (this._hasSwfGxf) && !(this._loadedGfxListCount == 2)) + { + return; + } + this._mapLoaded = true; + dispatchEvent(new Event(RenderMapEvent.GFX_LOADING_END)); + this.makeMap(); + } + + private function onBitmapGfxLoaded(param1:ResourceLoadedEvent) : void + { + if(this._cancelRender) + { + return; + } + this._fileLoaded++; + this._downloadProgressBar.scaleX = this._fileLoaded / this._fileToLoad; + dispatchEvent(new ProgressEvent(ProgressEvent.PROGRESS,false,false,this._fileLoaded,this._fileToLoad)); + this._bitmapsGfx[param1.uri.tag] = param1.resource; + this._gfxMemorySize = this._gfxMemorySize + BitmapData(param1.resource).width * BitmapData(param1.resource).height * 4; + MEMORY_LOG_1[param1.resource] = 1; + } + + private function onSwfGfxLoaded(param1:ResourceLoadedEvent) : void + { + this._fileLoaded++; + this._downloadProgressBar.scaleX = this._fileLoaded / this._fileToLoad; + dispatchEvent(new ProgressEvent(ProgressEvent.PROGRESS,false,false,this._fileLoaded,this._fileToLoad)); + this._swfGfx[param1.uri.tag] = param1.resource; + MEMORY_LOG_2[param1.resource] = 1; + } + + private function onGfxError(param1:ResourceErrorEvent) : void + { + _log.error("Unable to load " + param1.uri); + } + + private function onDownloadTimer(param1:TimerEvent) : void + { + if(Atouin.getInstance().options.showProgressBar) + { + this._container.addChild(this._progressBarCtr); + } + } + } +} +class VisualData extends Object { - - public var scaleX:Number = 1; - public var scaleY:Number = 1; - public var x:Number = 0; - public var y:Number = 0; - public var width:Number = 0; - public var height:Number = 0; - public var alpha:Number = 1; - - + + function VisualData() + { + super(); + } + + public var scaleX:Number = 1; + + public var scaleY:Number = 1; + + public var x:Number = 0; + + public var y:Number = 0; + + public var width:Number = 0; + + public var height:Number = 0; + + public var alpha:Number = 1; } - diff --git a/com/ankamagames/atouin/renderers/MovementZoneRenderer.as b/com/ankamagames/atouin/renderers/MovementZoneRenderer.as index 56c9bd7d7..77f823e5a 100644 --- a/com/ankamagames/atouin/renderers/MovementZoneRenderer.as +++ b/com/ankamagames/atouin/renderers/MovementZoneRenderer.as @@ -1,32 +1,31 @@ -package com.ankamagames.atouin.renderers +package com.ankamagames.atouin.renderers { - import com.ankamagames.atouin.enums.PlacementStrataEnums; - import com.ankamagames.atouin.Atouin; - - public class MovementZoneRenderer extends ZoneDARenderer - { - - private var _showText:Boolean; - private var _startAt:int; - - public function MovementZoneRenderer(showText:Boolean, startAt:int=1) - { - this._showText = showText; - this._startAt = startAt; - _strata = PlacementStrataEnums.STRATA_AREA; - currentStrata = ((Atouin.getInstance().options.transparentOverlayMode) ? PlacementStrataEnums.STRATA_NO_Z_ORDER : _strata); - } - - override protected function getText(count:int):String - { - if (this._showText) - { - return (String((count + this._startAt))); - }; - return (null); - } - - - } -}//package com.ankamagames.atouin.renderers - + import com.ankamagames.atouin.enums.PlacementStrataEnums; + import com.ankamagames.atouin.Atouin; + + public class MovementZoneRenderer extends ZoneDARenderer + { + + public function MovementZoneRenderer(param1:Boolean, param2:int = 1) + { + super(); + this._showText = param1; + this._startAt = param2; + _strata = PlacementStrataEnums.STRATA_AREA; + currentStrata = Atouin.getInstance().options.transparentOverlayMode?PlacementStrataEnums.STRATA_NO_Z_ORDER:_strata; + } + + private var _showText:Boolean; + + private var _startAt:int; + + override protected function getText(param1:int) : String + { + if(this._showText) + { + return String(param1 + this._startAt); + } + return null; + } + } +} diff --git a/com/ankamagames/atouin/renderers/TrapZoneRenderer.as b/com/ankamagames/atouin/renderers/TrapZoneRenderer.as index deddd1e02..32d462e97 100644 --- a/com/ankamagames/atouin/renderers/TrapZoneRenderer.as +++ b/com/ankamagames/atouin/renderers/TrapZoneRenderer.as @@ -1,146 +1,138 @@ -package com.ankamagames.atouin.renderers +package com.ankamagames.atouin.renderers { - import com.ankamagames.atouin.utils.IZoneRenderer; - import com.ankamagames.atouin.types.TrapZoneTile; - import com.ankamagames.jerakine.types.positions.MapPoint; - import flash.filters.ColorMatrixFilter; - import __AS3__.vec.Vector; - import com.ankamagames.jerakine.types.Color; - import com.ankamagames.atouin.types.DataMapContainer; - - public class TrapZoneRenderer implements IZoneRenderer - { - - private var _aZoneTile:Array; - private var _aCellTile:Array; - private var _visible:Boolean; - public var strata:uint; - - public function TrapZoneRenderer(nStrata:uint=10, visible:Boolean=true) - { - this._aZoneTile = new Array(); - this._aCellTile = new Array(); - this._visible = visible; - this.strata = nStrata; - } - - public function render(cells:Vector., oColor:Color, mapContainer:DataMapContainer, alpha:Boolean=false, updateStrata:Boolean=false):void - { - var tzt:TrapZoneTile; - var daCellId:uint; - var daPoint:MapPoint; - var zzTop:Boolean; - var zzBottom:Boolean; - var zzRight:Boolean; - var zzLeft:Boolean; - var cid:uint; - var mp:MapPoint; - var j:int; - while (j < cells.length) + import com.ankamagames.atouin.utils.IZoneRenderer; + import com.ankamagames.jerakine.types.Color; + import com.ankamagames.atouin.types.DataMapContainer; + import com.ankamagames.atouin.types.TrapZoneTile; + import com.ankamagames.jerakine.types.positions.MapPoint; + import flash.filters.ColorMatrixFilter; + + public class TrapZoneRenderer extends Object implements IZoneRenderer + { + + public function TrapZoneRenderer(param1:uint = 10, param2:Boolean = true) + { + super(); + this._aZoneTile = new Array(); + this._aCellTile = new Array(); + this._visible = param2; + this.strata = param1; + } + + private var _aZoneTile:Array; + + private var _aCellTile:Array; + + private var _visible:Boolean; + + public var strata:uint; + + public function render(param1:Vector., param2:Color, param3:DataMapContainer, param4:Boolean = false, param5:Boolean = false) : void + { + var _loc6_:TrapZoneTile = null; + var _loc8_:uint = 0; + var _loc9_:MapPoint = null; + var _loc10_:* = false; + var _loc11_:* = false; + var _loc12_:* = false; + var _loc13_:* = false; + var _loc14_:uint = 0; + var _loc15_:MapPoint = null; + var _loc7_:* = 0; + while(_loc7_ < param1.length) + { + if(!this._aZoneTile[_loc7_]) { - if (!(this._aZoneTile[j])) - { - tzt = new TrapZoneTile(); - this._aZoneTile[j] = tzt; - tzt.mouseChildren = false; - tzt.mouseEnabled = false; - tzt.strata = this.strata; - tzt.visible = this._visible; - tzt.filters = [new ColorMatrixFilter([0, 0, 0, 0, oColor.red, 0, 0, 0, 0, oColor.green, 0, 0, 0, 0, oColor.blue, 0, 0, 0, 0.7, 0])]; - }; - this._aCellTile[j] = cells[j]; - daCellId = cells[j]; - daPoint = MapPoint.fromCellId(daCellId); - TrapZoneTile(this._aZoneTile[j]).cellId = daCellId; - zzTop = false; - zzBottom = false; - zzRight = false; - zzLeft = false; - for each (cid in cells) - { - if (cid == daCellId) - { - } - else - { - mp = MapPoint.fromCellId(cid); - if (mp.x == daPoint.x) - { - if (mp.y == (daPoint.y - 1)) - { - zzTop = true; - } - else - { - if (mp.y == (daPoint.y + 1)) - { - zzBottom = true; - }; - }; - } - else - { - if (mp.y == daPoint.y) - { - if (mp.x == (daPoint.x - 1)) - { - zzRight = true; - } - else - { - if (mp.x == (daPoint.x + 1)) - { - zzLeft = true; - }; - }; - }; - }; - }; - }; - TrapZoneTile(this._aZoneTile[j]).drawStroke(zzTop, zzRight, zzBottom, zzLeft); - TrapZoneTile(this._aZoneTile[j]).display(this.strata); - j++; - }; - while (j < this._aZoneTile.length) + this._aZoneTile[_loc7_] = _loc6_ = new TrapZoneTile(); + _loc6_.mouseChildren = false; + _loc6_.mouseEnabled = false; + _loc6_.strata = this.strata; + _loc6_.visible = this._visible; + _loc6_.filters = [new ColorMatrixFilter([0,0,0,0,param2.red,0,0,0,0,param2.green,0,0,0,0,param2.blue,0,0,0,0.7,0])]; + } + this._aCellTile[_loc7_] = param1[_loc7_]; + _loc8_ = param1[_loc7_]; + _loc9_ = MapPoint.fromCellId(_loc8_); + TrapZoneTile(this._aZoneTile[_loc7_]).cellId = _loc8_; + _loc10_ = false; + _loc11_ = false; + _loc12_ = false; + _loc13_ = false; + for each(_loc14_ in param1) { - if (this._aZoneTile[j]) - { - (this._aZoneTile[j] as TrapZoneTile).remove(); - }; - j++; - }; - } - - public function remove(cells:Vector., mapContainer:DataMapContainer):void - { - if (!(cells)) + if(_loc14_ != _loc8_) + { + _loc15_ = MapPoint.fromCellId(_loc14_); + if(_loc15_.x == _loc9_.x) + { + if(_loc15_.y == _loc9_.y - 1) + { + _loc10_ = true; + } + else if(_loc15_.y == _loc9_.y + 1) + { + _loc11_ = true; + } + + } + else if(_loc15_.y == _loc9_.y) + { + if(_loc15_.x == _loc9_.x - 1) + { + _loc12_ = true; + } + else if(_loc15_.x == _loc9_.x + 1) + { + _loc13_ = true; + } + + } + + } + } + TrapZoneTile(this._aZoneTile[_loc7_]).drawStroke(_loc10_,_loc12_,_loc11_,_loc13_); + TrapZoneTile(this._aZoneTile[_loc7_]).display(this.strata); + _loc7_++; + } + while(_loc7_ < this._aZoneTile.length) + { + if(this._aZoneTile[_loc7_]) { - return; - }; - var mapping:Array = new Array(); - var j:int; - while (j < cells.length) + (this._aZoneTile[_loc7_] as TrapZoneTile).remove(); + } + _loc7_++; + } + } + + public function remove(param1:Vector., param2:DataMapContainer) : void + { + if(!param1) + { + return; + } + var _loc3_:Array = new Array(); + var _loc4_:* = 0; + while(_loc4_ < param1.length) + { + _loc3_[param1[_loc4_]] = true; + _loc4_++; + } + _loc4_ = 0; + while(_loc4_ < this._aCellTile.length) + { + if(_loc3_[this._aCellTile[_loc4_]]) { - mapping[cells[j]] = true; - j++; - }; - j = 0; - while (j < this._aCellTile.length) - { - if (mapping[this._aCellTile[j]]) - { - if (this._aZoneTile[j]) - { - TrapZoneTile(this._aZoneTile[j]).remove(); - }; - delete this._aZoneTile[j]; - delete this._aCellTile[j]; - }; - j++; - }; - } - - - } -}//package com.ankamagames.atouin.renderers - + if(this._aZoneTile[_loc4_]) + { + TrapZoneTile(this._aZoneTile[_loc4_]).remove(); + } + delete this._aZoneTile[_loc4_]; + true; + delete this._aCellTile[_loc4_]; + true; + } + _loc4_++; + } + } + } +} diff --git a/com/ankamagames/atouin/renderers/ZoneClipRenderer.as b/com/ankamagames/atouin/renderers/ZoneClipRenderer.as index c865a541a..2f91a1ed8 100644 --- a/com/ankamagames/atouin/renderers/ZoneClipRenderer.as +++ b/com/ankamagames/atouin/renderers/ZoneClipRenderer.as @@ -1,208 +1,242 @@ -package com.ankamagames.atouin.renderers +package com.ankamagames.atouin.renderers { - import com.ankamagames.atouin.utils.IZoneRenderer; - import com.ankamagames.jerakine.types.Uri; - import __AS3__.vec.Vector; - import com.ankamagames.atouin.Atouin; - import com.ankamagames.jerakine.types.events.PropertyChangeEvent; - import com.ankamagames.atouin.types.ZoneClipTile; - import com.ankamagames.jerakine.utils.prng.ParkMillerCarta; - import com.ankamagames.jerakine.utils.prng.PRNG; - import com.ankamagames.jerakine.types.Color; - import com.ankamagames.atouin.types.DataMapContainer; - - public class ZoneClipRenderer implements IZoneRenderer - { - - private static var zoneTile:Array = new Array(); - - private var _uri:Uri; - private var _clipName:Array; - private var _currentMapId:int; - private var _needBorders:Boolean; - protected var _aZoneTile:Array; - protected var _aCellTile:Array; - public var strata:uint = 0; - protected var _cells:Vector.; - - public function ZoneClipRenderer(nStrata:uint, pClipUri:String, pClipName:Array, pCurrentMap:int=-1, pNeedBorders:Boolean=false) - { - this._aZoneTile = new Array(); - this._aCellTile = new Array(); - this.strata = nStrata; - this._currentMapId = pCurrentMap; - this._needBorders = pNeedBorders; - this._uri = new Uri(pClipUri); - this._clipName = pClipName; - Atouin.getInstance().options.addEventListener(PropertyChangeEvent.PROPERTY_CHANGED, this.onPropertyChanged); - } - - private static function getZoneTile(pUri:Uri, pClipName:String, pNeedBorders:Boolean):ZoneClipTile - { - var _local_5:ZoneClipTile; - var ct:CachedTile = getData(pUri.fileName, pClipName); - if (ct.length) + import com.ankamagames.atouin.utils.IZoneRenderer; + import com.ankamagames.atouin.types.ZoneClipTile; + import com.ankamagames.jerakine.types.Uri; + import com.ankamagames.jerakine.types.Color; + import com.ankamagames.atouin.types.DataMapContainer; + import com.ankamagames.jerakine.utils.prng.PRNG; + import com.ankamagames.jerakine.utils.prng.ParkMillerCarta; + import com.ankamagames.jerakine.types.events.PropertyChangeEvent; + import com.ankamagames.atouin.Atouin; + + public class ZoneClipRenderer extends Object implements IZoneRenderer + { + + public function ZoneClipRenderer(param1:uint, param2:String, param3:Array, param4:int = -1, param5:Boolean = false) + { + super(); + this._aZoneTile = new Array(); + this._aCellTile = new Array(); + this.strata = param1; + this._currentMapId = param4; + this._needBorders = param5; + this._uri = new Uri(param2); + this._clipName = param3; + Atouin.getInstance().options.addEventListener(PropertyChangeEvent.PROPERTY_CHANGED,this.onPropertyChanged); + } + + private static var zoneTile:Array = new Array(); + + private static function getZoneTile(param1:Uri, param2:String, param3:Boolean) : ZoneClipTile + { + var _loc5_:ZoneClipTile = null; + var _loc4_:CachedTile = getData(param1.fileName,param2); + if(_loc4_.length) + { + return _loc4_.shift(); + } + _loc5_ = new ZoneClipTile(param1,param2,param3); + return _loc5_; + } + + private static function destroyZoneTile(param1:ZoneClipTile) : void + { + param1.remove(); + var _loc2_:CachedTile = getData(param1.uri.fileName,param1.clipName); + _loc2_.push(param1); + } + + private static function getData(param1:String, param2:String) : CachedTile + { + var _loc3_:* = 0; + var _loc4_:int = zoneTile.length; + _loc3_ = 0; + while(_loc3_ < _loc4_) + { + if(zoneTile[_loc3_].uriName == param1 && zoneTile[_loc3_].clipName == param2) { - return (ct.shift()); - }; - _local_5 = new ZoneClipTile(pUri, pClipName, pNeedBorders); - return (_local_5); - } - - private static function destroyZoneTile(zt:ZoneClipTile):void - { - zt.remove(); - var ct:CachedTile = getData(zt.uri.fileName, zt.clipName); - ct.push(zt); - } - - private static function getData(uri:String, clip:String):CachedTile - { - var i:int; - var len:int = zoneTile.length; - i = 0; - while (i < len) + return zoneTile[_loc3_] as ZoneClipRenderer; + } + _loc3_ = _loc3_ + 1; + } + var _loc5_:CachedTile = new CachedTile(param1,param2); + zoneTile.push(_loc5_); + return _loc5_; + } + + private var _uri:Uri; + + private var _clipName:Array; + + private var _currentMapId:int; + + private var _needBorders:Boolean; + + protected var _aZoneTile:Array; + + protected var _aCellTile:Array; + + public var strata:uint = 0; + + protected var _cells:Vector.; + + public function render(param1:Vector., param2:Color, param3:DataMapContainer, param4:Boolean = false, param5:Boolean = false) : void + { + var _loc6_:* = 0; + var _loc7_:ZoneClipTile = null; + var _loc9_:PRNG = null; + var _loc10_:* = 0; + var _loc11_:* = 0; + var _loc12_:String = null; + this._cells = param1; + var _loc8_:int = param1.length; + if(this._currentMapId > -1) + { + _loc9_ = new ParkMillerCarta(); + _loc9_.seed(this._currentMapId + 5435); + _loc6_ = 0; + while(_loc6_ < _loc8_) { - if ((((zoneTile[i].uriName == uri)) && ((zoneTile[i].clipName == clip)))) - { - return ((zoneTile[i] as CachedTile)); - }; - i = (i + 1); - }; - var e:CachedTile = new CachedTile(uri, clip); - zoneTile.push(e); - return (e); - } - - - public function render(cells:Vector., oColor:Color, mapContainer:DataMapContainer, bAlpha:Boolean=false, updateStrata:Boolean=false):void - { - var rndNum:int; - var j:int; - var zt:ZoneClipTile; - this._cells = cells; - var rnd:PRNG = new ParkMillerCarta(); - rnd.seed((this._currentMapId + 5435)); - var num:int = cells.length; - j = 0; - while (j < num) - { - zt = this._aZoneTile[j]; - if (!(zt)) - { - rndNum = rnd.nextIntR(0, (this._clipName.length * 8)); - zt = getZoneTile(this._uri, this._clipName[(((((rndNum < 0)) || ((rndNum > (this._clipName.length - 1))))) ? 0 : rndNum)], this._needBorders); - this._aZoneTile[j] = zt; - zt.strata = this.strata; - }; - this._aCellTile[j] = cells[j]; - zt.cellId = cells[j]; - zt.display(); - j++; - }; - while (j < num) + _loc7_ = this._aZoneTile[_loc6_]; + if(!_loc7_) + { + _loc10_ = _loc9_.nextIntR(0,this._clipName.length * 8); + _loc7_ = getZoneTile(this._uri,this._clipName[_loc10_ < 0 || _loc10_ > this._clipName.length - 1?0:_loc10_],this._needBorders); + this._aZoneTile[_loc6_] = _loc7_; + _loc7_.strata = this.strata; + } + this._aCellTile[_loc6_] = param1[_loc6_]; + _loc7_.cellId = param1[_loc6_]; + _loc7_.display(); + _loc6_++; + } + } + else + { + _loc6_ = 0; + while(_loc6_ < _loc8_) { - zt = this._aZoneTile[j]; - if (zt) - { - destroyZoneTile(zt); - }; - j++; - }; - } - - public function remove(cells:Vector., mapContainer:DataMapContainer):void - { - var j:int; - var zt:ZoneClipTile; - if (!(cells)) - { - return; - }; - var count:int; - var mapping:Array = new Array(); - var num:int = cells.length; - j = 0; - while (j < num) + _loc7_ = this._aZoneTile[_loc6_]; + if(!_loc7_) + { + if((this._clipName) && this._clipName.length > 1) + { + _loc11_ = Math.floor(param1[_loc6_] / 14); + _loc12_ = this._clipName[_loc11_ % 2]; + } + else + { + _loc12_ = this._clipName[0]; + } + _loc7_ = getZoneTile(this._uri,_loc12_,this._needBorders); + this._aZoneTile[_loc6_] = _loc7_; + _loc7_.strata = this.strata; + } + this._aCellTile[_loc6_] = param1[_loc6_]; + _loc7_.cellId = param1[_loc6_]; + _loc7_.display(); + _loc6_++; + } + } + while(_loc6_ < _loc8_) + { + _loc7_ = this._aZoneTile[_loc6_]; + if(_loc7_) { - mapping[cells[j]] = true; - j++; - }; - num = this._aCellTile.length; - var i:int; - while (i < num) + destroyZoneTile(_loc7_); + } + _loc6_++; + } + } + + public function remove(param1:Vector., param2:DataMapContainer) : void + { + var _loc4_:* = 0; + var _loc8_:ZoneClipTile = null; + if(!param1) + { + return; + } + var _loc3_:* = 0; + var _loc5_:Array = new Array(); + var _loc6_:int = param1.length; + _loc4_ = 0; + while(_loc4_ < _loc6_) + { + _loc5_[param1[_loc4_]] = true; + _loc4_++; + } + _loc6_ = this._aCellTile.length; + var _loc7_:* = 0; + while(_loc7_ < _loc6_) + { + if(_loc5_[this._aCellTile[_loc7_]]) { - if (mapping[this._aCellTile[i]]) - { - count++; - zt = this._aZoneTile[i]; - if (zt) - { - destroyZoneTile(zt); - }; - this._aCellTile.splice(i, 1); - this._aZoneTile.splice(i, 1); - i--; - num--; - }; - i++; - }; - } - - private function onPropertyChanged(e:PropertyChangeEvent):void - { - var j:int; - var zt:ZoneClipTile; - if (e.propertyName == "transparentOverlayMode") + _loc3_++; + _loc8_ = this._aZoneTile[_loc7_]; + if(_loc8_) + { + destroyZoneTile(_loc8_); + } + this._aCellTile.splice(_loc7_,1); + this._aZoneTile.splice(_loc7_,1); + _loc7_--; + _loc6_--; + } + _loc7_++; + } + } + + private function onPropertyChanged(param1:PropertyChangeEvent) : void + { + var _loc2_:* = 0; + var _loc3_:ZoneClipTile = null; + if(param1.propertyName == "transparentOverlayMode") + { + _loc2_ = 0; + while(_loc2_ < this._aZoneTile.length) { - j = 0; - while (j < this._aZoneTile.length) - { - zt = this._aZoneTile[j]; - zt.remove(); - zt.display(); - j++; - }; - }; - } - - - } -}//package com.ankamagames.atouin.renderers - -import __AS3__.vec.Vector; + _loc3_ = this._aZoneTile[_loc2_]; + _loc3_.remove(); + _loc3_.display(); + _loc2_++; + } + } + } + } +} import com.ankamagames.atouin.types.ZoneClipTile; -import __AS3__.vec.*; -class CachedTile +class CachedTile extends Object { - - public var uriName:String; - public var clipName:String; - /*private*/ var _list:Vector.; - - public function CachedTile(pName:String, pClip:String):void - { - this.uriName = pName; - this.clipName = pClip; - this._list = new Vector.(); - } - - public function push(value:ZoneClipTile):void - { - this._list.push(value); - } - - public function shift():ZoneClipTile - { - return (this._list.shift()); - } - - public function get length():uint - { - return (this._list.length); - } - - + + function CachedTile(param1:String, param2:String) + { + super(); + this.uriName = param1; + this.clipName = param2; + this._list = new Vector.(); + } + + public var uriName:String; + + public var clipName:String; + + private var _list:Vector.; + + public function push(param1:ZoneClipTile) : void + { + this._list.push(param1); + } + + public function shift() : ZoneClipTile + { + return this._list.shift(); + } + + public function get length() : uint + { + return this._list.length; + } } - diff --git a/com/ankamagames/atouin/renderers/ZoneDARenderer.as b/com/ankamagames/atouin/renderers/ZoneDARenderer.as index 842be0f66..7cec2fa5b 100644 --- a/com/ankamagames/atouin/renderers/ZoneDARenderer.as +++ b/com/ankamagames/atouin/renderers/ZoneDARenderer.as @@ -1,163 +1,164 @@ -package com.ankamagames.atouin.renderers +package com.ankamagames.atouin.renderers { - import com.ankamagames.atouin.utils.IZoneRenderer; - import com.ankamagames.jerakine.logger.Logger; - import com.ankamagames.jerakine.logger.Log; - import flash.utils.getQualifiedClassName; - import __AS3__.vec.Vector; - import com.ankamagames.atouin.Atouin; - import com.ankamagames.atouin.enums.PlacementStrataEnums; - import com.ankamagames.atouin.types.ZoneTile; - import com.ankamagames.atouin.data.map.CellData; - import flash.geom.ColorTransform; - import com.ankamagames.atouin.managers.MapDisplayManager; - import com.ankamagames.atouin.managers.EntitiesDisplayManager; - import com.ankamagames.jerakine.types.Color; - import com.ankamagames.atouin.types.DataMapContainer; - - public class ZoneDARenderer implements IZoneRenderer - { - - protected static const _log:Logger = Log.getLogger(getQualifiedClassName(ZoneDARenderer)); - private static var zoneTileCache:Array = new Array(); - - protected var _cells:Vector.; - protected var _aZoneTile:Array; - protected var _aCellTile:Array; - private var _alpha:Number = 0.7; - protected var _fixedStrata:Boolean; - protected var _strata:uint; - public var currentStrata:uint = 0; - public var showFarmCell:Boolean = true; - - public function ZoneDARenderer(nStrata:uint=0, alpha:Number=1, fixedStrata:Boolean=false) - { - this._aZoneTile = new Array(); - this._aCellTile = new Array(); - this._strata = nStrata; - this._fixedStrata = fixedStrata; - this.currentStrata = ((((!(this._fixedStrata)) && (Atouin.getInstance().options.transparentOverlayMode))) ? PlacementStrataEnums.STRATA_NO_Z_ORDER : this._strata); - this._alpha = alpha; - } - - private static function getZoneTile():ZoneTile - { - if (zoneTileCache.length) + import com.ankamagames.atouin.utils.IZoneRenderer; + import com.ankamagames.jerakine.logger.Logger; + import com.ankamagames.atouin.types.ZoneTile; + import com.ankamagames.jerakine.logger.Log; + import flash.utils.getQualifiedClassName; + import com.ankamagames.jerakine.types.Color; + import com.ankamagames.atouin.types.DataMapContainer; + import com.ankamagames.atouin.data.map.CellData; + import flash.geom.ColorTransform; + import com.ankamagames.atouin.managers.MapDisplayManager; + import com.ankamagames.atouin.managers.EntitiesDisplayManager; + import com.ankamagames.atouin.Atouin; + import com.ankamagames.atouin.enums.PlacementStrataEnums; + + public class ZoneDARenderer extends Object implements IZoneRenderer + { + + public function ZoneDARenderer(param1:uint = 0, param2:Number = 1, param3:Boolean = false) + { + super(); + this._aZoneTile = new Array(); + this._aCellTile = new Array(); + this._strata = param1; + this._fixedStrata = param3; + this.currentStrata = !this._fixedStrata && (Atouin.getInstance().options.transparentOverlayMode)?PlacementStrataEnums.STRATA_NO_Z_ORDER:this._strata; + this._alpha = param2; + } + + protected static const _log:Logger = Log.getLogger(getQualifiedClassName(ZoneDARenderer)); + + private static var zoneTileCache:Array = new Array(); + + private static function getZoneTile() : ZoneTile + { + if(zoneTileCache.length) + { + return zoneTileCache.shift(); + } + return new ZoneTile(); + } + + private static function destroyZoneTile(param1:ZoneTile) : void + { + param1.remove(); + zoneTileCache.push(param1); + } + + protected var _cells:Vector.; + + protected var _aZoneTile:Array; + + protected var _aCellTile:Array; + + private var _alpha:Number = 0.7; + + protected var _fixedStrata:Boolean; + + protected var _strata:uint; + + public var currentStrata:uint = 0; + + public var showFarmCell:Boolean = true; + + public function render(param1:Vector., param2:Color, param3:DataMapContainer, param4:Boolean = false, param5:Boolean = false) : void + { + var _loc6_:* = 0; + var _loc7_:ZoneTile = null; + var _loc9_:CellData = null; + var _loc10_:ColorTransform = null; + this._cells = param1; + var _loc8_:int = param1.length; + _loc6_ = 0; + while(_loc6_ < _loc8_) + { + _loc9_ = MapDisplayManager.getInstance().getDataMapContainer().dataMap.cells[param1[_loc6_]]; + if(!(!this.showFarmCell && (_loc9_.farmCell))) { - return (zoneTileCache.shift()); - }; - return (new ZoneTile()); - } - - private static function destroyZoneTile(zt:ZoneTile):void - { - zt.remove(); - zoneTileCache.push(zt); - } - - - public function render(cells:Vector., oColor:Color, mapContainer:DataMapContainer, bAlpha:Boolean=false, updateStrata:Boolean=false):void - { - var j:int; - var zt:ZoneTile; - var cellData:CellData; - var ct:ColorTransform; - this._cells = cells; - var num:int = cells.length; - j = 0; - while (j < num) + _loc7_ = this._aZoneTile[_loc6_]; + if(!_loc7_) + { + _loc7_ = getZoneTile(); + this._aZoneTile[_loc6_] = _loc7_; + _loc7_.strata = this.currentStrata; + _loc10_ = new ColorTransform(); + _loc7_.color = param2.color; + } + this._aCellTile[_loc6_] = param1[_loc6_]; + _loc7_.cellId = param1[_loc6_]; + _loc7_.text = this.getText(_loc6_); + if((param5) || !(EntitiesDisplayManager.getInstance()._dStrataRef[_loc7_] == this.currentStrata)) + { + _loc7_.strata = EntitiesDisplayManager.getInstance()._dStrataRef[_loc7_] = this.currentStrata; + } + _loc7_.display(); + } + _loc6_++; + } + while(_loc6_ < _loc8_) + { + _loc7_ = this._aZoneTile[_loc6_]; + if(_loc7_) { - cellData = MapDisplayManager.getInstance().getDataMapContainer().dataMap.cells[cells[j]]; - if (((!(this.showFarmCell)) && (cellData.farmCell))) - { - } - else - { - zt = this._aZoneTile[j]; - if (!(zt)) - { - zt = getZoneTile(); - this._aZoneTile[j] = zt; - zt.strata = this.currentStrata; - ct = new ColorTransform(); - zt.color = oColor.color; - }; - this._aCellTile[j] = cells[j]; - zt.cellId = cells[j]; - zt.text = this.getText(j); - if (((updateStrata) || (!((EntitiesDisplayManager.getInstance()._dStrataRef[zt] == this.currentStrata))))) - { - zt.strata = (EntitiesDisplayManager.getInstance()._dStrataRef[zt] = this.currentStrata); - }; - zt.display(); - }; - j++; - }; - while (j < num) + destroyZoneTile(_loc7_); + } + _loc6_++; + } + } + + protected function getText(param1:int) : String + { + return null; + } + + public function remove(param1:Vector., param2:DataMapContainer) : void + { + var _loc4_:* = 0; + var _loc8_:ZoneTile = null; + if(!param1) + { + return; + } + var _loc3_:* = 0; + var _loc5_:Array = new Array(); + var _loc6_:int = param1.length; + _loc4_ = 0; + while(_loc4_ < _loc6_) + { + _loc5_[param1[_loc4_]] = true; + _loc4_++; + } + _loc6_ = this._aCellTile.length; + var _loc7_:* = 0; + while(_loc7_ < _loc6_) + { + if(_loc5_[this._aCellTile[_loc7_]]) { - zt = this._aZoneTile[j]; - if (zt) - { - destroyZoneTile(zt); - }; - j++; - }; - } - - protected function getText(count:int):String - { - return (null); - } - - public function remove(cells:Vector., mapContainer:DataMapContainer):void - { - var j:int; - var zt:ZoneTile; - if (!(cells)) - { - return; - }; - var count:int; - var mapping:Array = new Array(); - var num:int = cells.length; - j = 0; - while (j < num) - { - mapping[cells[j]] = true; - j++; - }; - num = this._aCellTile.length; - var i:int; - while (i < num) - { - if (mapping[this._aCellTile[i]]) - { - count++; - zt = this._aZoneTile[i]; - if (zt) - { - destroyZoneTile(zt); - }; - this._aCellTile.splice(i, 1); - this._aZoneTile.splice(i, 1); - i--; - num--; - }; - i++; - }; - } - - public function get fixedStrata():Boolean - { - return (this._fixedStrata); - } - - public function restoreStrata():void - { - this.currentStrata = this._strata; - } - - - } -}//package com.ankamagames.atouin.renderers - + _loc3_++; + _loc8_ = this._aZoneTile[_loc7_]; + if(_loc8_) + { + destroyZoneTile(_loc8_); + } + this._aCellTile.splice(_loc7_,1); + this._aZoneTile.splice(_loc7_,1); + _loc7_--; + _loc6_--; + } + _loc7_++; + } + } + + public function get fixedStrata() : Boolean + { + return this._fixedStrata; + } + + public function restoreStrata() : void + { + this.currentStrata = this._strata; + } + } +} diff --git a/com/ankamagames/atouin/resources/AtouinResourceType.as b/com/ankamagames/atouin/resources/AtouinResourceType.as index 7a2b82136..d092e18de 100644 --- a/com/ankamagames/atouin/resources/AtouinResourceType.as +++ b/com/ankamagames/atouin/resources/AtouinResourceType.as @@ -1,12 +1,15 @@ -package com.ankamagames.atouin.resources +package com.ankamagames.atouin.resources { - public class AtouinResourceType - { - - public static const RESOURCE_ELEMENTS:uint = 0x0100; - public static const RESOURCE_MAP:uint = 0x0101; - - - } -}//package com.ankamagames.atouin.resources - + public class AtouinResourceType extends Object + { + + public function AtouinResourceType() + { + super(); + } + + public static const RESOURCE_ELEMENTS:uint = 256; + + public static const RESOURCE_MAP:uint = 257; + } +} diff --git a/com/ankamagames/atouin/resources/adapters/ElementsAdapter.as b/com/ankamagames/atouin/resources/adapters/ElementsAdapter.as index 3976fc34b..faf08cd73 100644 --- a/com/ankamagames/atouin/resources/adapters/ElementsAdapter.as +++ b/com/ankamagames/atouin/resources/adapters/ElementsAdapter.as @@ -1,61 +1,64 @@ -package com.ankamagames.atouin.resources.adapters +package com.ankamagames.atouin.resources.adapters { - import com.ankamagames.jerakine.resources.adapters.AbstractUrlLoaderAdapter; - import com.ankamagames.jerakine.resources.adapters.IAdapter; - import flash.utils.ByteArray; - import flash.utils.Endian; - import flash.errors.IOError; - import com.ankamagames.jerakine.resources.ResourceErrorCode; - import com.ankamagames.atouin.data.elements.Elements; - import com.ankamagames.atouin.resources.AtouinResourceType; - import flash.net.URLLoaderDataFormat; - - public class ElementsAdapter extends AbstractUrlLoaderAdapter implements IAdapter - { - - - override protected function getResource(dataFormat:String, data:*) - { - var ba:ByteArray = (data as ByteArray); - ba.endian = Endian.BIG_ENDIAN; - var header:int = ba.readByte(); - if (header != 69) - { - ba.position = 0; - try - { - ba.uncompress(); - } - catch(ioe:IOError) - { - dispatchFailure("Wrong header and non-compressed file.", ResourceErrorCode.MALFORMED_ELE_FILE); - return (null); - }; - header = ba.readByte(); - if (header != 69) - { - dispatchFailure("Wrong header file.", ResourceErrorCode.MALFORMED_ELE_FILE); - return (null); - }; - trace("Using a compressed ELE file !!"); - }; + import com.ankamagames.jerakine.resources.adapters.AbstractUrlLoaderAdapter; + import com.ankamagames.jerakine.resources.adapters.IAdapter; + import flash.utils.ByteArray; + import com.ankamagames.atouin.data.elements.Elements; + import flash.errors.IOError; + import flash.utils.Endian; + import com.ankamagames.jerakine.resources.ResourceErrorCode; + import com.ankamagames.atouin.resources.AtouinResourceType; + import flash.net.URLLoaderDataFormat; + + public class ElementsAdapter extends AbstractUrlLoaderAdapter implements IAdapter + { + + public function ElementsAdapter() + { + super(); + } + + override protected function getResource(param1:String, param2:*) : * + { + var dataFormat:String = param1; + var data:* = param2; + var ba:ByteArray = data as ByteArray; + ba.endian = Endian.BIG_ENDIAN; + var header:int = ba.readByte(); + if(header != 69) + { ba.position = 0; - var ele:Elements = Elements.getInstance(); - ele.fromRaw(ba); - return (ele); - } - - override public function getResourceType():uint - { - return (AtouinResourceType.RESOURCE_ELEMENTS); - } - - override protected function getDataFormat():String - { - return (URLLoaderDataFormat.BINARY); - } - - - } -}//package com.ankamagames.atouin.resources.adapters - + try + { + ba.uncompress(); + } + catch(ioe:IOError) + { + dispatchFailure("Wrong header and non-compressed file.",ResourceErrorCode.MALFORMED_ELE_FILE); + return null; + } + header = ba.readByte(); + if(header != 69) + { + dispatchFailure("Wrong header file.",ResourceErrorCode.MALFORMED_ELE_FILE); + return null; + } + trace("Using a compressed ELE file !!"); + } + ba.position = 0; + var ele:Elements = Elements.getInstance(); + ele.fromRaw(ba); + return ele; + } + + override public function getResourceType() : uint + { + return AtouinResourceType.RESOURCE_ELEMENTS; + } + + override protected function getDataFormat() : String + { + return URLLoaderDataFormat.BINARY; + } + } +} diff --git a/com/ankamagames/atouin/resources/adapters/MapsAdapter.as b/com/ankamagames/atouin/resources/adapters/MapsAdapter.as index 6d8334eb6..223fdae9f 100644 --- a/com/ankamagames/atouin/resources/adapters/MapsAdapter.as +++ b/com/ankamagames/atouin/resources/adapters/MapsAdapter.as @@ -1,57 +1,60 @@ -package com.ankamagames.atouin.resources.adapters +package com.ankamagames.atouin.resources.adapters { - import com.ankamagames.jerakine.resources.adapters.AbstractUrlLoaderAdapter; - import com.ankamagames.jerakine.resources.adapters.IAdapter; - import flash.utils.ByteArray; - import flash.utils.Endian; - import flash.errors.IOError; - import com.ankamagames.jerakine.resources.ResourceErrorCode; - import com.ankamagames.atouin.resources.AtouinResourceType; - import flash.net.URLLoaderDataFormat; - - public class MapsAdapter extends AbstractUrlLoaderAdapter implements IAdapter - { - - - override protected function getResource(dataFormat:String, data:*) - { - var ba:ByteArray = (data as ByteArray); - ba.endian = Endian.BIG_ENDIAN; - var header:int = ba.readByte(); - if (header != 77) - { - ba.position = 0; - try - { - ba.uncompress(); - } - catch(ioe:IOError) - { - dispatchFailure("Wrong header and non-compressed file.", ResourceErrorCode.MALFORMED_MAP_FILE); - return (null); - }; - header = ba.readByte(); - if (header != 77) - { - dispatchFailure("Wrong header file.", ResourceErrorCode.MALFORMED_MAP_FILE); - return (null); - }; - }; + import com.ankamagames.jerakine.resources.adapters.AbstractUrlLoaderAdapter; + import com.ankamagames.jerakine.resources.adapters.IAdapter; + import flash.utils.ByteArray; + import flash.errors.IOError; + import flash.utils.Endian; + import com.ankamagames.jerakine.resources.ResourceErrorCode; + import com.ankamagames.atouin.resources.AtouinResourceType; + import flash.net.URLLoaderDataFormat; + + public class MapsAdapter extends AbstractUrlLoaderAdapter implements IAdapter + { + + public function MapsAdapter() + { + super(); + } + + override protected function getResource(param1:String, param2:*) : * + { + var dataFormat:String = param1; + var data:* = param2; + var ba:ByteArray = data as ByteArray; + ba.endian = Endian.BIG_ENDIAN; + var header:int = ba.readByte(); + if(header != 77) + { ba.position = 0; - return (ba); - } - - override public function getResourceType():uint - { - return (AtouinResourceType.RESOURCE_MAP); - } - - override protected function getDataFormat():String - { - return (URLLoaderDataFormat.BINARY); - } - - - } -}//package com.ankamagames.atouin.resources.adapters - + try + { + ba.uncompress(); + } + catch(ioe:IOError) + { + dispatchFailure("Wrong header and non-compressed file.",ResourceErrorCode.MALFORMED_MAP_FILE); + return null; + } + header = ba.readByte(); + if(header != 77) + { + dispatchFailure("Wrong header file.",ResourceErrorCode.MALFORMED_MAP_FILE); + return null; + } + } + ba.position = 0; + return ba; + } + + override public function getResourceType() : uint + { + return AtouinResourceType.RESOURCE_MAP; + } + + override protected function getDataFormat() : String + { + return URLLoaderDataFormat.BINARY; + } + } +} diff --git a/com/ankamagames/atouin/types/AnimatedElementInfo.as b/com/ankamagames/atouin/types/AnimatedElementInfo.as index d6d11c3b8..b477da671 100644 --- a/com/ankamagames/atouin/types/AnimatedElementInfo.as +++ b/com/ankamagames/atouin/types/AnimatedElementInfo.as @@ -1,30 +1,31 @@ -package com.ankamagames.atouin.types +package com.ankamagames.atouin.types { - import com.ankamagames.tiphon.display.TiphonSprite; - import flash.utils.getTimer; - - public final class AnimatedElementInfo - { - - public var tiphonSprite:TiphonSprite; - public var min:int; - public var max:int; - public var nextAnimation:int; - - public function AnimatedElementInfo(tiphonSprite:TiphonSprite, min:int, max:int) - { - this.tiphonSprite = tiphonSprite; - this.min = min; - this.max = max; - this.setNextAnimation(); - } - - public function setNextAnimation():void - { - this.nextAnimation = ((getTimer() + this.min) + int((Math.random() * (this.max - this.min)))); - } - - - } -}//package com.ankamagames.atouin.types - + import com.ankamagames.tiphon.display.TiphonSprite; + import flash.utils.getTimer; + + public final class AnimatedElementInfo extends Object + { + + public function AnimatedElementInfo(param1:TiphonSprite, param2:int, param3:int) + { + super(); + this.tiphonSprite = param1; + this.min = param2; + this.max = param3; + this.setNextAnimation(); + } + + public var tiphonSprite:TiphonSprite; + + public var min:int; + + public var max:int; + + public var nextAnimation:int; + + public function setNextAnimation() : void + { + this.nextAnimation = getTimer() + this.min + int(Math.random() * (this.max - this.min)); + } + } +} diff --git a/com/ankamagames/atouin/types/AtouinOptions.as b/com/ankamagames/atouin/types/AtouinOptions.as index 001a3aa97..6810ff88a 100644 --- a/com/ankamagames/atouin/types/AtouinOptions.as +++ b/com/ankamagames/atouin/types/AtouinOptions.as @@ -1,61 +1,59 @@ -package com.ankamagames.atouin.types +package com.ankamagames.atouin.types { - import com.ankamagames.jerakine.managers.OptionManager; - import flash.display.DisplayObjectContainer; - import com.ankamagames.jerakine.messages.MessageHandler; - import com.ankamagames.jerakine.utils.system.AirScanner; - - public dynamic class AtouinOptions extends OptionManager - { - - private var _container:DisplayObjectContainer; - private var _handler:MessageHandler; - - public function AtouinOptions(docContainer:DisplayObjectContainer, mhHandler:MessageHandler) - { - super("atouin"); - add("groundCacheMode", 1); - add("useInsideAutoZoom", AirScanner.isStreamingVersion()); - add("useCacheAsBitmap", true); - add("useSmooth", true); - add("frustum", new Frustum(), false); - add("alwaysShowGrid", false); - add("debugLayer", false); - add("showCellIdOnOver", false); - add("tweentInterMap", false); - add("hideInterMap", false); - add("virtualPlayerJump", false); - add("reloadLoadedMap", false); - add("hideForeground", false); - add("allowAnimatedGfx", true); - add("allowParticlesFx", true); - add("elementsPath"); - add("pngSubPath"); - add("jpgSubPath"); - add("mapsPath"); - add("elementsIndexPath"); - add("particlesScriptsPath"); - add("transparentOverlayMode", false); - add("groundOnly", false); - add("showTransitions", false); - add("useLowDefSkin", true); - add("showProgressBar", AirScanner.isStreamingVersion()); - add("mapPictoExtension", "png"); - this._container = docContainer; - this._handler = mhHandler; - } - - public function get container():DisplayObjectContainer - { - return (this._container); - } - - public function get handler():MessageHandler - { - return (this._handler); - } - - - } -}//package com.ankamagames.atouin.types - + import com.ankamagames.jerakine.managers.OptionManager; + import flash.display.DisplayObjectContainer; + import com.ankamagames.jerakine.messages.MessageHandler; + import com.ankamagames.jerakine.utils.system.AirScanner; + + public dynamic class AtouinOptions extends OptionManager + { + + public function AtouinOptions(param1:DisplayObjectContainer, param2:MessageHandler) + { + super("atouin"); + add("groundCacheMode",1); + add("useInsideAutoZoom",AirScanner.isStreamingVersion()); + add("useCacheAsBitmap",true); + add("useSmooth",true); + add("frustum",new Frustum(),false); + add("alwaysShowGrid",false); + add("debugLayer",false); + add("showCellIdOnOver",false); + add("tweentInterMap",false); + add("hideInterMap",false); + add("virtualPlayerJump",false); + add("reloadLoadedMap",false); + add("hideForeground",false); + add("allowAnimatedGfx",true); + add("allowParticlesFx",true); + add("elementsPath"); + add("pngSubPath"); + add("jpgSubPath"); + add("mapsPath"); + add("elementsIndexPath"); + add("particlesScriptsPath"); + add("transparentOverlayMode",false); + add("groundOnly",false); + add("showTransitions",false); + add("useLowDefSkin",true); + add("showProgressBar",AirScanner.isStreamingVersion()); + add("mapPictoExtension","png"); + this._container = param1; + this._handler = param2; + } + + private var _container:DisplayObjectContainer; + + private var _handler:MessageHandler; + + public function get container() : DisplayObjectContainer + { + return this._container; + } + + public function get handler() : MessageHandler + { + return this._handler; + } + } +} diff --git a/com/ankamagames/atouin/types/BitmapCellContainer.as b/com/ankamagames/atouin/types/BitmapCellContainer.as index c39c9b3cb..dfba10002 100644 --- a/com/ankamagames/atouin/types/BitmapCellContainer.as +++ b/com/ankamagames/atouin/types/BitmapCellContainer.as @@ -1,144 +1,153 @@ -package com.ankamagames.atouin.types +package com.ankamagames.atouin.types { - import flash.geom.Point; - import flash.geom.Rectangle; - - public class BitmapCellContainer implements ICellContainer - { - - private var _destPoint:Point; - private var _srcRect:Rectangle; - private var _cellId:int = 0; - private var _layerId:int = 0; - private var _startX:int = 0; - private var _startY:int = 0; - private var _x:Number = 0; - private var _y:Number = 0; - private var _depth:int = 0; - public var datas:Array; - public var bitmaps:Array; - public var colorTransforms:Array; - private var _numChildren:int = 0; - - public function BitmapCellContainer(id:uint) - { - this.datas = new Array(); - this.bitmaps = new Array(); - this.colorTransforms = new Array(); - super(); - } - - public function get cacheAsBitmap():Boolean - { - return (false); - } - - public function set cacheAsBitmap(val:Boolean):void - { - } - - public function get mouseChildren():Boolean - { - return (false); - } - - public function set mouseChildren(val:Boolean):void - { - } - - public function get mouseEnabled():Boolean - { - return (false); - } - - public function set mouseEnabled(val:Boolean):void - { - } - - public function get cellId():uint - { - return (this._cellId); - } - - public function set cellId(val:uint):void - { - this._cellId = val; - } - - public function get layerId():int - { - return (this._layerId); - } - - public function set layerId(val:int):void - { - this._layerId = val; - } - - public function get startX():int - { - return (this._startX); - } - - public function set startX(val:int):void - { - this._startX = val; - } - - public function get startY():int - { - return (this._startY); - } - - public function set startY(val:int):void - { - this._startY = val; - } - - public function get x():Number - { - return (this._x); - } - - public function set x(val:Number):void - { - this._x = val; - } - - public function get y():Number - { - return (this._y); - } - - public function set y(val:Number):void - { - this._y = val; - } - - public function get depth():int - { - return (this._depth); - } - - public function set depth(val:int):void - { - this._depth = val; - } - - public function get numChildren():int - { - return (this._numChildren); - } - - public function addFakeChild(child:Object, data:Object, colors:Object):void - { - this.colorTransforms[this._numChildren] = colors; - this.datas[this._numChildren] = data; - var _local_4 = this._numChildren++; - this.bitmaps[_local_4] = child; - } - - - } -}//package com.ankamagames.atouin.types - + import flash.geom.Point; + import flash.geom.Rectangle; + + public class BitmapCellContainer extends Object implements ICellContainer + { + + public function BitmapCellContainer(param1:uint) + { + this.datas = new Array(); + this.bitmaps = new Array(); + this.colorTransforms = new Array(); + super(); + } + + private var _destPoint:Point; + + private var _srcRect:Rectangle; + + public function get cacheAsBitmap() : Boolean + { + return false; + } + + public function set cacheAsBitmap(param1:Boolean) : void + { + } + + public function get mouseChildren() : Boolean + { + return false; + } + + public function set mouseChildren(param1:Boolean) : void + { + } + + public function get mouseEnabled() : Boolean + { + return false; + } + + public function set mouseEnabled(param1:Boolean) : void + { + } + + private var _cellId:int = 0; + + public function get cellId() : uint + { + return this._cellId; + } + + public function set cellId(param1:uint) : void + { + this._cellId = param1; + } + + private var _layerId:int = 0; + + public function get layerId() : int + { + return this._layerId; + } + + public function set layerId(param1:int) : void + { + this._layerId = param1; + } + + private var _startX:int = 0; + + public function get startX() : int + { + return this._startX; + } + + public function set startX(param1:int) : void + { + this._startX = param1; + } + + private var _startY:int = 0; + + public function get startY() : int + { + return this._startY; + } + + public function set startY(param1:int) : void + { + this._startY = param1; + } + + private var _x:Number = 0; + + public function get x() : Number + { + return this._x; + } + + public function set x(param1:Number) : void + { + this._x = param1; + } + + private var _y:Number = 0; + + public function get y() : Number + { + return this._y; + } + + public function set y(param1:Number) : void + { + this._y = param1; + } + + private var _depth:int = 0; + + public function get depth() : int + { + return this._depth; + } + + public function set depth(param1:int) : void + { + this._depth = param1; + } + + public var datas:Array; + + public var bitmaps:Array; + + public var colorTransforms:Array; + + private var _numChildren:int = 0; + + public function get numChildren() : int + { + return this._numChildren; + } + + public function addFakeChild(param1:Object, param2:Object, param3:Object) : void + { + this.colorTransforms[this._numChildren] = param3; + this.datas[this._numChildren] = param2; + var _loc4_:* = this._numChildren++; + this.bitmaps[_loc4_] = param1; + } + } +} diff --git a/com/ankamagames/atouin/types/CellContainer.as b/com/ankamagames/atouin/types/CellContainer.as index f7707de16..8cdfa1557 100644 --- a/com/ankamagames/atouin/types/CellContainer.as +++ b/com/ankamagames/atouin/types/CellContainer.as @@ -1,120 +1,123 @@ -package com.ankamagames.atouin.types +package com.ankamagames.atouin.types { - import flash.display.Sprite; - import flash.geom.ColorTransform; - import com.ankamagames.jerakine.data.XmlConfig; - import flash.display.DisplayObject; - import flash.display.Bitmap; - - public class CellContainer extends Sprite implements ICellContainer - { - - private static var _ratio:Number; - private static var cltr:ColorTransform; - - private var _cellId:int = 0; - private var _layerId:int = 0; - private var _startX:int = 0; - private var _startY:int = 0; - private var _depth:int = 0; - - public function CellContainer(id:uint) - { - this.cellId = id; - name = ("Cell_" + this.cellId); - } - - public function get cellId():uint - { - return (this._cellId); - } - - public function set cellId(val:uint):void - { - this._cellId = val; - } - - public function get layerId():int - { - return (this._layerId); - } - - public function set layerId(val:int):void - { - this._layerId = val; - } - - public function get startX():int - { - return (this._startX); - } - - public function set startX(val:int):void - { - this._startX = val; - } - - public function get startY():int - { - return (this._startY); - } - - public function set startY(val:int):void - { - this._startY = val; - } - - public function get depth():int - { - return (this._depth); - } - - public function set depth(val:int):void - { - this._depth = val; - } - - public function addFakeChild(pChild:Object, pData:Object, colors:Object):void - { - var val:*; - if (isNaN(_ratio)) + import flash.display.Sprite; + import flash.geom.ColorTransform; + import com.ankamagames.jerakine.data.XmlConfig; + import flash.display.DisplayObject; + import flash.display.Bitmap; + + public class CellContainer extends Sprite implements ICellContainer + { + + public function CellContainer(param1:uint) + { + super(); + this.cellId = param1; + name = "Cell_" + this.cellId; + } + + private static var _ratio:Number; + + private static var cltr:ColorTransform; + + private var _cellId:int = 0; + + public function get cellId() : uint + { + return this._cellId; + } + + public function set cellId(param1:uint) : void + { + this._cellId = param1; + } + + private var _layerId:int = 0; + + public function get layerId() : int + { + return this._layerId; + } + + public function set layerId(param1:int) : void + { + this._layerId = param1; + } + + private var _startX:int = 0; + + public function get startX() : int + { + return this._startX; + } + + public function set startX(param1:int) : void + { + this._startX = param1; + } + + private var _startY:int = 0; + + public function get startY() : int + { + return this._startY; + } + + public function set startY(param1:int) : void + { + this._startY = param1; + } + + private var _depth:int = 0; + + public function get depth() : int + { + return this._depth; + } + + public function set depth(param1:int) : void + { + this._depth = param1; + } + + public function addFakeChild(param1:Object, param2:Object, param3:Object) : void + { + var _loc5_:* = undefined; + if(isNaN(_ratio)) + { + _loc5_ = XmlConfig.getInstance().getEntry("config.gfx.world.scaleRatio"); + _ratio = _loc5_ == null?1:parseFloat(_loc5_); + } + var _loc4_:DisplayObject = param1 as DisplayObject; + if(param2 != null) + { + if(param1 is Bitmap) { - val = XmlConfig.getInstance().getEntry("config.gfx.world.scaleRatio"); - _ratio = (((val == null)) ? 1 : parseFloat(val)); - }; - var child:DisplayObject = (pChild as DisplayObject); - if (pData != null) + _loc4_.x = param2.x * _ratio; + _loc4_.y = param2.y * _ratio; + } + else { - if ((pChild is Bitmap)) - { - child.x = (pData.x * _ratio); - child.y = (pData.y * _ratio); - } - else - { - child.x = pData.x; - child.y = pData.y; - }; - child.alpha = pData.alpha; - child.scaleX = pData.scaleX; - child.scaleY = pData.scaleY; - }; - if (colors != null) + _loc4_.x = param2.x; + _loc4_.y = param2.y; + } + _loc4_.alpha = param2.alpha; + _loc4_.scaleX = param2.scaleX; + _loc4_.scaleY = param2.scaleY; + } + if(param3 != null) + { + if(cltr == null) { - if (cltr == null) - { - cltr = new ColorTransform(); - }; - cltr.redMultiplier = colors.red; - cltr.greenMultiplier = colors.green; - cltr.blueMultiplier = colors.blue; - cltr.alphaMultiplier = colors.alpha; - child.transform.colorTransform = cltr; - }; - addChild(child); - } - - - } -}//package com.ankamagames.atouin.types - + cltr = new ColorTransform(); + } + cltr.redMultiplier = param3.red; + cltr.greenMultiplier = param3.green; + cltr.blueMultiplier = param3.blue; + cltr.alphaMultiplier = param3.alpha; + _loc4_.transform.colorTransform = cltr; + } + addChild(_loc4_); + } + } +} diff --git a/com/ankamagames/atouin/types/CellLink.as b/com/ankamagames/atouin/types/CellLink.as index 733269da1..f041801e4 100644 --- a/com/ankamagames/atouin/types/CellLink.as +++ b/com/ankamagames/atouin/types/CellLink.as @@ -1,59 +1,63 @@ -package com.ankamagames.atouin.types +package com.ankamagames.atouin.types { - import flash.display.Shape; - import com.ankamagames.jerakine.entities.interfaces.IDisplayable; - import com.ankamagames.jerakine.entities.behaviours.IDisplayBehavior; - import __AS3__.vec.Vector; - import com.ankamagames.jerakine.types.positions.MapPoint; - import com.ankamagames.atouin.managers.EntitiesDisplayManager; - import com.ankamagames.jerakine.interfaces.IRectangle; - - public class CellLink extends Shape implements IDisplayable - { - - private var _displayBehaviors:IDisplayBehavior; - private var _displayed:Boolean; - public var strata:uint; - public var orderedCheckpoints:Vector.; - - - public function display(strata:uint=0):void - { - if (((this.orderedCheckpoints) && (this.orderedCheckpoints.length))) - { - EntitiesDisplayManager.getInstance().displayEntity(this, this.orderedCheckpoints[0], strata); - this._displayed = true; - }; - } - - public function remove():void - { - this.orderedCheckpoints = null; - this._displayed = false; - EntitiesDisplayManager.getInstance().removeEntity(this); - } - - public function get displayBehaviors():IDisplayBehavior - { - return (this._displayBehaviors); - } - - public function set displayBehaviors(value:IDisplayBehavior):void - { - this._displayBehaviors = value; - } - - public function get displayed():Boolean - { - return (this._displayed); - } - - public function get absoluteBounds():IRectangle - { - return (this._displayBehaviors.getAbsoluteBounds(this)); - } - - - } -}//package com.ankamagames.atouin.types - + import flash.display.Shape; + import com.ankamagames.jerakine.entities.interfaces.IDisplayable; + import com.ankamagames.jerakine.entities.behaviours.IDisplayBehavior; + import com.ankamagames.jerakine.types.positions.MapPoint; + import com.ankamagames.atouin.managers.EntitiesDisplayManager; + import com.ankamagames.jerakine.interfaces.IRectangle; + + public class CellLink extends Shape implements IDisplayable + { + + public function CellLink() + { + super(); + } + + private var _displayBehaviors:IDisplayBehavior; + + private var _displayed:Boolean; + + public var strata:uint; + + public var orderedCheckpoints:Vector.; + + public function display(param1:uint = 0) : void + { + if((this.orderedCheckpoints) && (this.orderedCheckpoints.length)) + { + EntitiesDisplayManager.getInstance().displayEntity(this,this.orderedCheckpoints[0],param1); + this._displayed = true; + var param1:uint = param1; + } + } + + public function remove() : void + { + this.orderedCheckpoints = null; + this._displayed = false; + EntitiesDisplayManager.getInstance().removeEntity(this); + } + + public function get displayBehaviors() : IDisplayBehavior + { + return this._displayBehaviors; + } + + public function set displayBehaviors(param1:IDisplayBehavior) : void + { + this._displayBehaviors = param1; + } + + public function get displayed() : Boolean + { + return this._displayed; + } + + public function get absoluteBounds() : IRectangle + { + return this._displayBehaviors.getAbsoluteBounds(this); + } + } +} diff --git a/com/ankamagames/atouin/types/CellReference.as b/com/ankamagames/atouin/types/CellReference.as index 664d4b77a..4f36b6819 100644 --- a/com/ankamagames/atouin/types/CellReference.as +++ b/com/ankamagames/atouin/types/CellReference.as @@ -1,123 +1,134 @@ -package com.ankamagames.atouin.types +package com.ankamagames.atouin.types { - import com.ankamagames.jerakine.logger.Logger; - import com.ankamagames.jerakine.logger.Log; - import flash.utils.getQualifiedClassName; - import flash.display.Sprite; - import flash.display.DisplayObject; - import com.ankamagames.jerakine.pools.PoolsManager; - import com.ankamagames.jerakine.pools.PoolableRectangle; - import flash.geom.Rectangle; - import flash.geom.ColorTransform; - - public class CellReference - { - - protected static const _log:Logger = Log.getLogger(getQualifiedClassName(CellReference)); - - private var _visible:Boolean; - private var _lock:Boolean = false; - public var id:uint; - public var listSprites:Array; - public var elevation:int = 0; - public var x:Number = 0; - public var y:Number = 0; - public var width:Number = 0; - public var height:Number = 0; - public var mov:Boolean; - public var isDisabled:Boolean = false; - public var rendered:Boolean = false; - public var heightestDecor:Sprite; - public var gfxId:Array; - - public function CellReference(nId:uint) - { - this.id = nId; - this.listSprites = new Array(); - this.gfxId = new Array(); - } - - public function addSprite(d:DisplayObject):void - { - this.listSprites.push(d); - } - - public function addGfx(nGfxId:int):void - { - this.gfxId.push(nGfxId); - } - - public function lock():void - { - this._lock = true; - } - - public function get locked():Boolean - { - return (this._lock); - } - - public function get visible():Boolean - { - return (this._visible); - } - - public function set visible(bValue:Boolean):void - { - var i:uint; - if (this._visible != bValue) + import com.ankamagames.jerakine.logger.Logger; + import com.ankamagames.jerakine.logger.Log; + import flash.utils.getQualifiedClassName; + import flash.display.Sprite; + import flash.display.DisplayObject; + import flash.geom.Rectangle; + import com.ankamagames.jerakine.pools.PoolsManager; + import com.ankamagames.jerakine.pools.PoolableRectangle; + import flash.geom.ColorTransform; + + public class CellReference extends Object + { + + public function CellReference(param1:uint) + { + super(); + this.id = param1; + this.listSprites = new Array(); + this.gfxId = new Array(); + } + + protected static const _log:Logger = Log.getLogger(getQualifiedClassName(CellReference)); + + private var _visible:Boolean; + + private var _lock:Boolean = false; + + public var id:uint; + + public var listSprites:Array; + + public var elevation:int = 0; + + public var x:Number = 0; + + public var y:Number = 0; + + public var width:Number = 0; + + public var height:Number = 0; + + public var mov:Boolean; + + public var isDisabled:Boolean = false; + + public var rendered:Boolean = false; + + public var heightestDecor:Sprite; + + public var gfxId:Array; + + public function addSprite(param1:DisplayObject) : void + { + this.listSprites.push(param1); + } + + public function addGfx(param1:int) : void + { + this.gfxId.push(param1); + } + + public function lock() : void + { + this._lock = true; + } + + public function get locked() : Boolean + { + return this._lock; + } + + public function get visible() : Boolean + { + return this._visible; + } + + public function set visible(param1:Boolean) : void + { + var _loc2_:uint = 0; + if(this._visible != param1) + { + this._visible = param1; + _loc2_ = 0; + while(_loc2_ < this.listSprites.length) { - this._visible = bValue; - i = 0; - while (i < this.listSprites.length) - { - if (this.listSprites[i] != null) - { - this.listSprites[i].visible = bValue; - }; - i++; - }; - }; - } - - public function get bounds():Rectangle - { - var sprite:DisplayObject; - var rectangle:PoolableRectangle = (PoolsManager.getInstance().getRectanglePool().checkOut() as PoolableRectangle).renew(); - var boundRect:PoolableRectangle = (PoolsManager.getInstance().getRectanglePool().checkOut() as PoolableRectangle); - for each (sprite in this.listSprites) - { - rectangle.extend(boundRect.renew(sprite.x, sprite.y, sprite.width, sprite.height)); - }; - PoolsManager.getInstance().getRectanglePool().checkIn(boundRect); - PoolsManager.getInstance().getRectanglePool().checkIn(rectangle); - return ((rectangle as Rectangle)); - } - - public function getAvgColor():uint - { - var t:ColorTransform; - var i:int; - var red:Number = 0; - var green:Number = 0; - var blue:Number = 0; - var len:int = this.listSprites.length; - i = 0; - while (i < len) - { - t = (this.listSprites[i] as DisplayObject).transform.colorTransform; - red = (red + (t.redOffset * t.redMultiplier)); - green = (green + (t.greenOffset * t.greenMultiplier)); - blue = (blue + (t.blueOffset * t.blueMultiplier)); - i = (i + 1); - }; - red = (red / len); - green = (green / len); - blue = (blue / len); - return ((((red << 16) | (green << 8)) | blue)); - } - - - } -}//package com.ankamagames.atouin.types - + if(this.listSprites[_loc2_] != null) + { + this.listSprites[_loc2_].visible = param1; + } + _loc2_++; + } + } + } + + public function get bounds() : Rectangle + { + var _loc3_:DisplayObject = null; + var _loc1_:PoolableRectangle = (PoolsManager.getInstance().getRectanglePool().checkOut() as PoolableRectangle).renew(); + var _loc2_:PoolableRectangle = PoolsManager.getInstance().getRectanglePool().checkOut() as PoolableRectangle; + for each(_loc3_ in this.listSprites) + { + _loc1_.extend(_loc2_.renew(_loc3_.x,_loc3_.y,_loc3_.width,_loc3_.height)); + } + PoolsManager.getInstance().getRectanglePool().checkIn(_loc2_); + PoolsManager.getInstance().getRectanglePool().checkIn(_loc1_); + return _loc1_ as Rectangle; + } + + public function getAvgColor() : uint + { + var _loc4_:ColorTransform = null; + var _loc5_:* = 0; + var _loc1_:Number = 0; + var _loc2_:Number = 0; + var _loc3_:Number = 0; + var _loc6_:int = this.listSprites.length; + _loc5_ = 0; + while(_loc5_ < _loc6_) + { + _loc4_ = (this.listSprites[_loc5_] as DisplayObject).transform.colorTransform; + _loc1_ = _loc1_ + _loc4_.redOffset * _loc4_.redMultiplier; + _loc2_ = _loc2_ + _loc4_.greenOffset * _loc4_.greenMultiplier; + _loc3_ = _loc3_ + _loc4_.blueOffset * _loc4_.blueMultiplier; + _loc5_ = _loc5_ + 1; + } + _loc1_ = _loc1_ / _loc6_; + _loc2_ = _loc2_ / _loc6_; + _loc3_ = _loc3_ / _loc6_; + return _loc1_ << 16 | _loc2_ << 8 | _loc3_; + } + } +} diff --git a/com/ankamagames/atouin/types/DataMapContainer.as b/com/ankamagames/atouin/types/DataMapContainer.as index 27d430cdb..f2ba553ef 100644 --- a/com/ankamagames/atouin/types/DataMapContainer.as +++ b/com/ankamagames/atouin/types/DataMapContainer.as @@ -1,366 +1,385 @@ -package com.ankamagames.atouin.types +package com.ankamagames.atouin.types { - import com.ankamagames.jerakine.logger.Logger; - import com.ankamagames.jerakine.logger.Log; - import flash.utils.getQualifiedClassName; - import flash.display.Sprite; - import com.ankamagames.atouin.data.map.Map; - import com.ankamagames.atouin.Atouin; - import com.ankamagames.jerakine.types.events.PropertyChangeEvent; - import com.ankamagames.jerakine.types.positions.WorldPoint; - import com.ankamagames.atouin.utils.VisibleCellDetection; - import com.ankamagames.atouin.managers.MapDisplayManager; - import com.ankamagames.atouin.data.elements.subtypes.EntityGraphicalElementData; - import flash.display.DisplayObject; - import com.ankamagames.atouin.managers.AnimatedElementManager; - import com.ankamagames.tiphon.events.TiphonEvent; - - public class DataMapContainer - { - - private static var _aInteractiveCell:Array; - protected static const _log:Logger = Log.getLogger(getQualifiedClassName(DataMapContainer)); - - private var _spMap:Sprite; - private var _aLayers:Array; - private var _aCell:Array; - private var _map:Map; - private var _animatedElement:Array; - private var _allowAnimatedGfx:Boolean; - private var _temporaryEnable:Boolean = true; - public var layerDepth:Array; - public var id:int; - public var rendered:Boolean = false; - - public function DataMapContainer(mapData:Map) - { - if (!(this._spMap)) + import com.ankamagames.jerakine.logger.Logger; + import com.ankamagames.jerakine.logger.Log; + import flash.utils.getQualifiedClassName; + import flash.display.Sprite; + import com.ankamagames.atouin.data.map.Map; + import com.ankamagames.jerakine.interfaces.IDestroyable; + import com.ankamagames.atouin.Atouin; + import com.ankamagames.jerakine.types.events.PropertyChangeEvent; + import com.ankamagames.jerakine.types.positions.WorldPoint; + import com.ankamagames.atouin.utils.VisibleCellDetection; + import com.ankamagames.atouin.managers.MapDisplayManager; + import com.ankamagames.atouin.data.elements.subtypes.EntityGraphicalElementData; + import flash.display.DisplayObject; + import com.ankamagames.atouin.managers.AnimatedElementManager; + import com.ankamagames.tiphon.events.TiphonEvent; + + public class DataMapContainer extends Object + { + + public function DataMapContainer(param1:Map) + { + super(); + if(!this._spMap) + { + this._spMap = new Sprite(); + this._aLayers = new Array(); + _aInteractiveCell = new Array(); + } + Atouin.getInstance().options.addEventListener(PropertyChangeEvent.PROPERTY_CHANGED,this.onOptionChange); + this.id = param1.id; + this.layerDepth = new Array(); + this._aCell = new Array(); + this._map = param1; + this._animatedElement = new Array(); + this._allowAnimatedGfx = Atouin.getInstance().options.allowAnimatedGfx; + } + + private static var _aInteractiveCell:Array; + + protected static const _log:Logger = Log.getLogger(getQualifiedClassName(DataMapContainer)); + + public static function get interactiveCell() : Array + { + return _aInteractiveCell; + } + + private var _spMap:Sprite; + + private var _aLayers:Array; + + private var _aCell:Array; + + private var _map:Map; + + private var _animatedElement:Array; + + private var _allowAnimatedGfx:Boolean; + + private var _temporaryEnable:Boolean = true; + + public var layerDepth:Array; + + public var id:int; + + public var rendered:Boolean = false; + + public function removeContainer() : void + { + var _loc1_:Sprite = null; + var _loc2_:Sprite = null; + var _loc3_:CellReference = null; + var _loc4_:uint = 0; + var _loc5_:Object = null; + var _loc6_:uint = 0; + for each(_loc5_ in this._animatedElement) + { + if(_loc5_.element is IDestroyable) { - this._spMap = new Sprite(); - this._aLayers = new Array(); - _aInteractiveCell = new Array(); - }; - Atouin.getInstance().options.addEventListener(PropertyChangeEvent.PROPERTY_CHANGED, this.onOptionChange); - this.id = mapData.id; - this.layerDepth = new Array(); - this._aCell = new Array(); - this._map = mapData; - this._animatedElement = new Array(); - this._allowAnimatedGfx = Atouin.getInstance().options.allowAnimatedGfx; - } - - public static function get interactiveCell():Array - { - return (_aInteractiveCell); - } - - - public function removeContainer():void - { - var sprite:Sprite; - var parentSprite:Sprite; - var cellReference:CellReference; - var i:uint; - var k:uint; - while (k < this._aCell.length) + (_loc5_.element as IDestroyable).destroy(); + } + } + _loc6_ = 0; + while(_loc6_ < this._aCell.length) + { + _loc3_ = this._aCell[_loc6_]; + if(_loc3_) { - cellReference = this._aCell[k]; - if (!!(cellReference)) - { - i = 0; - while (i < cellReference.listSprites.length) - { - if (!!((cellReference.listSprites[i] is Sprite))) + _loc4_ = 0; + while(_loc4_ < _loc3_.listSprites.length) + { + if(_loc3_.listSprites[_loc4_] is Sprite) + { + _loc1_ = _loc3_.listSprites[_loc4_]; + if(_loc1_) + { + _loc1_.cacheAsBitmap = false; + _loc2_ = Sprite(_loc1_.parent); + if(_loc2_) { - sprite = cellReference.listSprites[i]; - if (sprite) - { - sprite.cacheAsBitmap = false; - parentSprite = Sprite(sprite.parent); - if (parentSprite) - { - parentSprite.removeChild(sprite); - delete cellReference.listSprites[i]; - if (!(parentSprite.numChildren)) - { - parentSprite.parent.removeChild(parentSprite); - }; - }; - }; - }; - i++; - }; - delete this._aCell[k]; - }; - k++; - }; - Atouin.getInstance().options.removeEventListener(PropertyChangeEvent.PROPERTY_CHANGED, this.onOptionChange); - } - - public function getCellReference(nId:uint):CellReference - { - if (!(this._aCell[nId])) - { - this._aCell[nId] = new CellReference(nId); - }; - return (this._aCell[nId]); - } - - public function isRegisteredCell(nId:uint):Boolean - { - return (!((this._aCell[nId] == null))); - } - - public function getCell():Array - { - return (this._aCell); - } - - public function getLayer(nId:int):LayerContainer - { - if (!(this._aLayers[nId])) - { - this._aLayers[nId] = new LayerContainer(nId); - }; - return (this._aLayers[nId]); - } - - public function clean(bForceCleaning:Boolean=false):Boolean - { - var sprite:Sprite; - var parentSprite:Sprite; - var cellReference:CellReference; - var i:uint; - var provider:Array; - var k:String; - var p:WorldPoint; - if (!(bForceCleaning)) + _loc2_.removeChild(_loc1_); + delete _loc3_.listSprites[_loc4_]; + true; + if(!_loc2_.numChildren) + { + _loc2_.parent.removeChild(_loc2_); + } + } + } + } + _loc4_++; + } + delete this._aCell[_loc6_]; + true; + } + _loc6_++; + } + Atouin.getInstance().options.removeEventListener(PropertyChangeEvent.PROPERTY_CHANGED,this.onOptionChange); + } + + public function getCellReference(param1:uint) : CellReference + { + if(!this._aCell[param1]) + { + this._aCell[param1] = new CellReference(param1); + } + return this._aCell[param1]; + } + + public function isRegisteredCell(param1:uint) : Boolean + { + return !(this._aCell[param1] == null); + } + + public function getCell() : Array + { + return this._aCell; + } + + public function getLayer(param1:int) : LayerContainer + { + if(!this._aLayers[param1]) + { + this._aLayers[param1] = new LayerContainer(param1); + } + return this._aLayers[param1]; + } + + public function clean(param1:Boolean = false) : Boolean + { + var _loc2_:Sprite = null; + var _loc3_:Sprite = null; + var _loc4_:CellReference = null; + var _loc5_:uint = 0; + var _loc6_:Array = null; + var _loc7_:String = null; + var _loc8_:WorldPoint = null; + if(!param1) + { + _loc6_ = VisibleCellDetection.detectCell(false,this._map,WorldPoint.fromMapId(this.id),Atouin.getInstance().options.frustum,MapDisplayManager.getInstance().currentMapPoint).cell; + } + else + { + _loc6_ = new Array(); + _loc5_ = 0; + while(_loc5_ < this._aCell.length) { - provider = VisibleCellDetection.detectCell(false, this._map, WorldPoint.fromMapId(this.id), Atouin.getInstance().options.frustum, MapDisplayManager.getInstance().currentMapPoint).cell; + _loc6_[_loc5_] = _loc5_; + _loc5_++; } - else + } + for(_loc7_ in _loc6_) + { + _loc4_ = this._aCell[_loc7_]; + if(_loc4_) { - provider = new Array(); - i = 0; - while (i < this._aCell.length) - { - provider[i] = i; - i++; - }; - }; - for (k in provider) + _loc5_ = 0; + while(_loc5_ < _loc4_.listSprites.length) + { + _loc2_ = _loc4_.listSprites[_loc5_]; + if(_loc2_) + { + _loc2_.cacheAsBitmap = false; + _loc3_ = Sprite(_loc2_.parent); + _loc3_.removeChild(_loc2_); + delete _loc4_.listSprites[_loc5_]; + true; + if(!_loc3_.numChildren) + { + _loc3_.parent.removeChild(_loc3_); + } + } + _loc5_++; + } + delete this._aCell[_loc7_]; + true; + } + } + _loc8_ = WorldPoint.fromMapId(this._map.id); + _loc8_.x = _loc8_.x - MapDisplayManager.getInstance().currentMapPoint.x; + _loc8_.y = _loc8_.y - MapDisplayManager.getInstance().currentMapPoint.y; + return Math.abs(_loc8_.x) > 1 || Math.abs(_loc8_.y) > 1; + } + + public function get mapContainer() : Sprite + { + return this._spMap; + } + + public function get dataMap() : Map + { + return this._map; + } + + public function addAnimatedElement(param1:WorldEntitySprite, param2:EntityGraphicalElementData) : void + { + var _loc3_:Object = { + "element":param1, + "data":param2 + }; + this._animatedElement.push(_loc3_); + this.updateAnimatedElement(_loc3_); + } + + public function setTemporaryAnimatedElementState(param1:Boolean) : void + { + var _loc2_:Object = null; + this._temporaryEnable = param1; + for each(_loc2_ in this._animatedElement) + { + this.updateAnimatedElement(_loc2_); + } + } + + public function get x() : Number + { + return this._spMap.x; + } + + public function get y() : Number + { + return this._spMap.y; + } + + public function set x(param1:Number) : void + { + this._spMap.x = param1; + } + + public function set y(param1:Number) : void + { + this._spMap.y = param1; + } + + public function get scaleX() : Number + { + return this._spMap.scaleX; + } + + public function get scaleY() : Number + { + return this._spMap.scaleY; + } + + public function set scaleX(param1:Number) : void + { + this._spMap.scaleX = param1; + } + + public function set scaleY(param1:Number) : void + { + this._spMap.scaleX = param1; + } + + public function addChild(param1:DisplayObject) : DisplayObject + { + return this._spMap.addChild(param1); + } + + public function addChildAt(param1:DisplayObject, param2:int) : DisplayObject + { + return this._spMap.addChildAt(param1,param2); + } + + public function getChildIndex(param1:DisplayObject) : int + { + return this._spMap.getChildIndex(param1); + } + + public function contains(param1:DisplayObject) : Boolean + { + return this._spMap.contains(param1); + } + + public function getChildByName(param1:String) : DisplayObject + { + return this._spMap.getChildByName(param1); + } + + public function removeChild(param1:DisplayObject) : DisplayObject + { + if((param1.parent) && param1.parent == this._spMap) + { + return this._spMap.removeChild(param1); + } + return null; + } + + private function updateAnimatedElement(param1:Object) : void + { + var _loc2_:WorldEntitySprite = param1.element; + var _loc3_:EntityGraphicalElementData = param1.data; + var _loc4_:Boolean = (this._temporaryEnable) && (this._allowAnimatedGfx); + if((_loc4_) && (_loc3_.playAnimation)) + { + if(_loc3_.maxDelay > 0) { - cellReference = this._aCell[k]; - if (!!(cellReference)) - { - i = 0; - while (i < cellReference.listSprites.length) - { - sprite = cellReference.listSprites[i]; - if (sprite) - { - sprite.cacheAsBitmap = false; - parentSprite = Sprite(sprite.parent); - parentSprite.removeChild(sprite); - delete cellReference.listSprites[i]; - if (!(parentSprite.numChildren)) - { - parentSprite.parent.removeChild(parentSprite); - }; - }; - i++; - }; - delete this._aCell[k]; - }; - }; - p = WorldPoint.fromMapId(this._map.id); - p.x = (p.x - MapDisplayManager.getInstance().currentMapPoint.x); - p.y = (p.y - MapDisplayManager.getInstance().currentMapPoint.y); - return ((((Math.abs(p.x) > 1)) || ((Math.abs(p.y) > 1)))); - } - - public function get mapContainer():Sprite - { - return (this._spMap); - } - - public function get dataMap():Map - { - return (this._map); - } - - public function addAnimatedElement(element:WorldEntitySprite, data:EntityGraphicalElementData):void - { - var d:Object = { - "element":element, - "data":data - }; - this._animatedElement.push(d); - this.updateAnimatedElement(d); - } - - public function setTemporaryAnimatedElementState(active:Boolean):void - { - var d:Object; - this._temporaryEnable = active; - for each (d in this._animatedElement) + AnimatedElementManager.removeAnimatedElement(_loc2_); + AnimatedElementManager.addAnimatedElement(_loc2_,_loc3_.minDelay * 1000,_loc3_.maxDelay * 1000); + if(_loc3_.playAnimStatic) + { + _loc2_.setAnimation("AnimStatique"); + } + } + else if(_loc2_.getAnimation() != "AnimStart") { - this.updateAnimatedElement(d); - }; - } - - public function get x():Number - { - return (this._spMap.x); - } - - public function get y():Number - { - return (this._spMap.y); - } - - public function set x(nValue:Number):void - { - this._spMap.x = nValue; - } - - public function set y(nValue:Number):void - { - this._spMap.y = nValue; - } - - public function get scaleX():Number - { - return (this._spMap.scaleX); - } - - public function get scaleY():Number - { - return (this._spMap.scaleY); - } - - public function set scaleX(nValue:Number):void - { - this._spMap.scaleX = nValue; - } - - public function set scaleY(nValue:Number):void - { - this._spMap.scaleX = nValue; - } - - public function addChild(item:DisplayObject):DisplayObject - { - return (this._spMap.addChild(item)); - } - - public function addChildAt(item:DisplayObject, index:int):DisplayObject - { - return (this._spMap.addChildAt(item, index)); - } - - public function getChildIndex(item:DisplayObject):int - { - return (this._spMap.getChildIndex(item)); - } - - public function contains(item:DisplayObject):Boolean - { - return (this._spMap.contains(item)); - } - - public function getChildByName(name:String):DisplayObject - { - return (this._spMap.getChildByName(name)); - } - - public function removeChild(item:DisplayObject):DisplayObject - { - if (((item.parent) && ((item.parent == this._spMap)))) + _loc2_.setAnimation("AnimStart"); + } + else { - return (this._spMap.removeChild(item)); - }; - return (null); - } - - private function updateAnimatedElement(target:Object):void - { - var ts:WorldEntitySprite = target.element; - var eed:EntityGraphicalElementData = target.data; - var allowAnimatedGfx:Boolean = ((this._temporaryEnable) && (this._allowAnimatedGfx)); - if (((allowAnimatedGfx) && (eed.playAnimation))) + _loc2_.restartAnimation(); + } + + } + else + { + AnimatedElementManager.removeAnimatedElement(_loc2_); + if(_loc3_.playAnimation) { - if (eed.maxDelay > 0) - { - AnimatedElementManager.removeAnimatedElement(ts); - AnimatedElementManager.addAnimatedElement(ts, (eed.minDelay * 1000), (eed.maxDelay * 1000)); - if (eed.playAnimStatic) - { - ts.setAnimation("AnimStatique"); - }; - } - else - { - if (ts.getAnimation() != "AnimStart") - { - ts.setAnimation("AnimStart"); - } - else - { - ts.restartAnimation(); - }; - }; + if(_loc2_.hasAnimation("AnimStatique")) + { + _loc2_.setAnimation("AnimStatique"); + } + else + { + _loc2_.stopAnimation(); + } } else { - AnimatedElementManager.removeAnimatedElement(ts); - if (eed.playAnimation) - { - if (ts.hasAnimation("AnimStatique")) - { - ts.setAnimation("AnimStatique"); - } - else - { - ts.stopAnimation(); - }; - } - else - { - ts.stopAnimation(); - }; - }; - } - - private function onEntityRendered(e:TiphonEvent):void - { - var d:Object; - for each (d in this._animatedElement) + _loc2_.stopAnimation(); + } + } + } + + private function onEntityRendered(param1:TiphonEvent) : void + { + var _loc2_:Object = null; + for each(_loc2_ in this._animatedElement) + { + if(_loc2_.element == param1.sprite) { - if (d.element == e.sprite) - { - e.sprite.removeEventListener(TiphonEvent.RENDER_SUCCEED, this.onEntityRendered); - this.updateAnimatedElement(d); - break; - }; - }; - e.sprite.removeEventListener(TiphonEvent.RENDER_SUCCEED, this.onEntityRendered); - } - - private function onOptionChange(e:PropertyChangeEvent):void - { - var d:Object; - if (e.propertyName == "allowAnimatedGfx") + param1.sprite.removeEventListener(TiphonEvent.RENDER_SUCCEED,this.onEntityRendered); + this.updateAnimatedElement(_loc2_); + break; + } + } + param1.sprite.removeEventListener(TiphonEvent.RENDER_SUCCEED,this.onEntityRendered); + } + + private function onOptionChange(param1:PropertyChangeEvent) : void + { + var _loc2_:Object = null; + if(param1.propertyName == "allowAnimatedGfx") + { + this._allowAnimatedGfx = param1.propertyValue; + for each(_loc2_ in this._animatedElement) { - this._allowAnimatedGfx = e.propertyValue; - for each (d in this._animatedElement) - { - this.updateAnimatedElement(d); - }; - }; - } - - - } -}//package com.ankamagames.atouin.types - + this.updateAnimatedElement(_loc2_); + } + } + } + } +} diff --git a/com/ankamagames/atouin/types/DebugToolTip.as b/com/ankamagames/atouin/types/DebugToolTip.as index 1edbea933..6f0f84898 100644 --- a/com/ankamagames/atouin/types/DebugToolTip.as +++ b/com/ankamagames/atouin/types/DebugToolTip.as @@ -1,77 +1,84 @@ -package com.ankamagames.atouin.types +package com.ankamagames.atouin.types { - import flash.display.Sprite; - import flash.display.Shape; - import flash.text.TextField; - import flash.text.TextFormat; - import com.ankamagames.jerakine.utils.errors.SingletonError; - import flash.filters.DropShadowFilter; - import flash.text.TextFieldAutoSize; - - public class DebugToolTip extends Sprite - { - - private static var _self:DebugToolTip; - - private var _shape:Shape; - private var _textfield:TextField; - private var _textformat:TextFormat; - private var _minWidth:Number = 300; - private var _minHeight:Number = 100; - private var _defautX:Number = 0x0500; - private var _defautY:Number = 880; - - public function DebugToolTip() - { - if (_self) - { - throw (new SingletonError()); - }; + import flash.display.Sprite; + import flash.display.Shape; + import flash.text.TextField; + import flash.text.TextFormat; + import com.ankamagames.jerakine.utils.errors.SingletonError; + import flash.filters.DropShadowFilter; + import flash.text.TextFieldAutoSize; + + public class DebugToolTip extends Sprite + { + + public function DebugToolTip() + { + super(); + if(_self) + { + throw new SingletonError(); + } + else + { this._textformat = new TextFormat(); this._textformat.size = 15; this._textformat.color = 0; mouseEnabled = false; mouseChildren = false; this._shape = new Shape(); - var f:DropShadowFilter = new DropShadowFilter(0, 45, 0x444444, 0.5, 4, 4, 1, 1); - filters = [f]; + var _loc1_:DropShadowFilter = new DropShadowFilter(0,45,4473924,0.5,4,4,1,1); + filters = [_loc1_]; addChild(this._shape); this._textfield = new TextField(); this._textfield.defaultTextFormat = this._textformat; this._textfield.autoSize = TextFieldAutoSize.LEFT; addChild(this._textfield); - } - - public static function getInstance():DebugToolTip - { - if (!(_self)) - { - _self = new (DebugToolTip)(); - }; - return (_self); - } - - - public function setPosition(pX:Number, pY:Number):void - { - x = pX; - y = pY; - } - - public function set text(s:String):void - { - this._textfield.text = s; - this._shape.x = (this._textfield.x - 4); - this._shape.y = (this._textfield.y - 4); - var pw:Number = (((this._minWidth)<(this._textfield.textWidth + 8)) ? (this._textfield.textWidth + 8) : this._minWidth); - var ph:Number = (((this._minHeight)<(this._textfield.textHeight + 8)) ? (this._textfield.textHeight + 8) : this._minHeight); - this._shape.graphics.clear(); - this._shape.graphics.beginFill(0xFFFFFF, 0.7); - this._shape.graphics.drawRect(0, 0, pw, ph); - this.setPosition((this._defautX - pw), (this._defautY - ph)); - } - - - } -}//package com.ankamagames.atouin.types - + return; + } + } + + private static var _self:DebugToolTip; + + public static function getInstance() : DebugToolTip + { + if(!_self) + { + _self = new DebugToolTip(); + } + return _self; + } + + private var _shape:Shape; + + private var _textfield:TextField; + + private var _textformat:TextFormat; + + private var _minWidth:Number = 300; + + private var _minHeight:Number = 100; + + private var _defautX:Number = 1280; + + private var _defautY:Number = 880; + + public function setPosition(param1:Number, param2:Number) : void + { + x = param1; + y = param2; + } + + public function set text(param1:String) : void + { + this._textfield.text = param1; + this._shape.x = this._textfield.x - 4; + this._shape.y = this._textfield.y - 4; + var _loc2_:Number = this._minWidth < this._textfield.textWidth + 8?this._textfield.textWidth + 8:this._minWidth; + var _loc3_:Number = this._minHeight < this._textfield.textHeight + 8?this._textfield.textHeight + 8:this._minHeight; + this._shape.graphics.clear(); + this._shape.graphics.beginFill(16777215,0.7); + this._shape.graphics.drawRect(0,0,_loc2_,_loc3_); + this.setPosition(this._defautX - _loc2_,this._defautY - _loc3_); + } + } +} diff --git a/com/ankamagames/atouin/types/Frustum.as b/com/ankamagames/atouin/types/Frustum.as index 4b38eb833..caded2c7f 100644 --- a/com/ankamagames/atouin/types/Frustum.as +++ b/com/ankamagames/atouin/types/Frustum.as @@ -1,110 +1,107 @@ -package com.ankamagames.atouin.types +package com.ankamagames.atouin.types { - import flash.geom.Rectangle; - import com.ankamagames.jerakine.logger.Logger; - import com.ankamagames.jerakine.logger.Log; - import flash.utils.getQualifiedClassName; - import com.ankamagames.atouin.AtouinConstants; - import com.ankamagames.jerakine.utils.display.StageShareManager; - - public class Frustum extends Rectangle - { - - protected static const _log:Logger = Log.getLogger(getQualifiedClassName(Frustum)); - public static const MAX_WIDTH:Number = ((AtouinConstants.MAP_WIDTH + 0.5) * AtouinConstants.CELL_WIDTH);//1247 - public static const MAX_HEIGHT:Number = ((AtouinConstants.MAP_HEIGHT + 0.5) * AtouinConstants.CELL_HEIGHT);//881.5 - public static const RATIO:Number = (MAX_WIDTH / MAX_HEIGHT);//1.41463414634146 - - private var _marginLeft:int; - private var _marginRight:int; - private var _marginTop:int; - private var _marginBottom:int; - public var scale:Number; - - public function Frustum(marginRight:uint=0, marginTop:uint=0, marginLeft:uint=0, marginBottom:uint=0) - { - this._marginTop = marginTop; - this._marginRight = marginRight; - this._marginBottom = marginBottom; - this._marginLeft = marginLeft; - this.refresh(); - } - - public function refresh():Frustum - { - var divX:Number; - var divY:Number; - width = ((MAX_WIDTH + this._marginRight) + this._marginLeft); - height = ((MAX_HEIGHT + this._marginTop) + this._marginBottom); - var yScale:Number = (StageShareManager.startHeight / height); - width = (MAX_WIDTH * yScale); - height = (MAX_HEIGHT * yScale); - if ((width / height) < RATIO) - { - height = (width / RATIO); - }; - if ((width / height) > RATIO) - { - width = (height * RATIO); - }; - this.scale = yScale; - var xSpace:Number = (((StageShareManager.startWidth - (MAX_WIDTH * this.scale)) + this._marginLeft) - this._marginRight); - var ySpace:Number = (((StageShareManager.startHeight - (MAX_HEIGHT * this.scale)) + this._marginTop) - this._marginBottom); - if (((this._marginLeft) && (this._marginRight))) - { - divX = ((this._marginLeft + this._marginRight) / this._marginLeft); - } - else - { - if (this._marginLeft) - { - divX = (2 + (xSpace / this._marginLeft)); - } - else - { - if (this._marginRight) - { - divX = (2 - (xSpace / this._marginRight)); - } - else - { - divX = 2; - }; - }; - }; - if (((this._marginTop) && (this._marginBottom))) - { - divY = ((this._marginTop + this._marginBottom) / this._marginTop); - } - else - { - if (this._marginTop) - { - divY = (2 + (ySpace / this._marginTop)); - } - else - { - if (this._marginBottom) - { - divY = ((ySpace / this._marginBottom) - 2); - } - else - { - divY = 2; - }; - }; - }; - x = (xSpace / divX); - y = (ySpace / divY); - return (this); - } - - override public function toString():String - { - return (((super.toString() + " scale=") + this.scale)); - } - - - } -}//package com.ankamagames.atouin.types - + import flash.geom.Rectangle; + import com.ankamagames.jerakine.logger.Logger; + import com.ankamagames.jerakine.logger.Log; + import flash.utils.getQualifiedClassName; + import com.ankamagames.atouin.AtouinConstants; + import com.ankamagames.jerakine.utils.display.StageShareManager; + + public class Frustum extends Rectangle + { + + public function Frustum(param1:uint = 0, param2:uint = 0, param3:uint = 0, param4:uint = 0) + { + super(); + this._marginTop = param2; + this._marginRight = param1; + this._marginBottom = param4; + this._marginLeft = param3; + this.refresh(); + } + + protected static const _log:Logger = Log.getLogger(getQualifiedClassName(Frustum)); + + public static const MAX_WIDTH:Number = (AtouinConstants.MAP_WIDTH + 0.5) * AtouinConstants.CELL_WIDTH; + + public static const MAX_HEIGHT:Number = (AtouinConstants.MAP_HEIGHT + 0.5) * AtouinConstants.CELL_HEIGHT; + + public static const RATIO:Number = MAX_WIDTH / MAX_HEIGHT; + + private var _marginLeft:int; + + private var _marginRight:int; + + private var _marginTop:int; + + private var _marginBottom:int; + + public var scale:Number; + + public function refresh() : Frustum + { + var _loc4_:* = NaN; + var _loc5_:* = NaN; + width = MAX_WIDTH + this._marginRight + this._marginLeft; + height = MAX_HEIGHT + this._marginTop + this._marginBottom; + var _loc1_:Number = StageShareManager.startHeight / height; + width = MAX_WIDTH * _loc1_; + height = MAX_HEIGHT * _loc1_; + if(width / height < RATIO) + { + height = width / RATIO; + } + if(width / height > RATIO) + { + width = height * RATIO; + } + this.scale = _loc1_; + var _loc2_:Number = StageShareManager.startWidth - MAX_WIDTH * this.scale + this._marginLeft - this._marginRight; + var _loc3_:Number = StageShareManager.startHeight - MAX_HEIGHT * this.scale + this._marginTop - this._marginBottom; + if((this._marginLeft) && (this._marginRight)) + { + _loc4_ = (this._marginLeft + this._marginRight) / this._marginLeft; + } + else if(this._marginLeft) + { + _loc4_ = 2 + _loc2_ / this._marginLeft; + } + else if(this._marginRight) + { + _loc4_ = 2 - _loc2_ / this._marginRight; + } + else + { + _loc4_ = 2; + } + + + if((this._marginTop) && (this._marginBottom)) + { + _loc5_ = (this._marginTop + this._marginBottom) / this._marginTop; + } + else if(this._marginTop) + { + _loc5_ = 2 + _loc3_ / this._marginTop; + } + else if(this._marginBottom) + { + _loc5_ = _loc3_ / this._marginBottom - 2; + } + else + { + _loc5_ = 2; + } + + + x = _loc2_ / _loc4_; + y = _loc3_ / _loc5_; + return this; + } + + override public function toString() : String + { + return super.toString() + " scale=" + this.scale; + } + } +} diff --git a/com/ankamagames/atouin/types/FrustumShape.as b/com/ankamagames/atouin/types/FrustumShape.as index cb0fc6c56..a39322433 100644 --- a/com/ankamagames/atouin/types/FrustumShape.as +++ b/com/ankamagames/atouin/types/FrustumShape.as @@ -1,23 +1,21 @@ -package com.ankamagames.atouin.types +package com.ankamagames.atouin.types { - import flash.display.Sprite; - - public class FrustumShape extends Sprite - { - - private var _direction:uint; - - public function FrustumShape(direction:uint) - { - this._direction = direction; - } - - public function get direction():uint - { - return (this._direction); - } - - - } -}//package com.ankamagames.atouin.types - + import flash.display.Sprite; + + public class FrustumShape extends Sprite + { + + public function FrustumShape(param1:uint) + { + super(); + this._direction = param1; + } + + private var _direction:uint; + + public function get direction() : uint + { + return this._direction; + } + } +} diff --git a/com/ankamagames/atouin/types/GraphicCell.as b/com/ankamagames/atouin/types/GraphicCell.as index 5d75c9a93..1f09006e1 100644 --- a/com/ankamagames/atouin/types/GraphicCell.as +++ b/com/ankamagames/atouin/types/GraphicCell.as @@ -1,72 +1,73 @@ -package com.ankamagames.atouin.types +package com.ankamagames.atouin.types { - import flash.display.Sprite; - import com.ankamagames.jerakine.interfaces.ICustomUnicNameGetter; - - public class GraphicCell extends Sprite implements ICustomUnicNameGetter - { - - private var _dropValidator:Function; - private var _removeDropSource:Function; - private var _processDrop:Function; - private var _name:String; - public var cellId:uint; - - public function GraphicCell(cellId:uint) - { - this._dropValidator = this.returnTrueFunction; - this._removeDropSource = this.returnTrueFunction; - this._processDrop = this.returnTrueFunction; - super(); - this.cellId = cellId; - name = cellId.toString(); - this._name = ("cell::" + cellId); - buttonMode = true; - mouseChildren = false; - cacheAsBitmap = true; - } - - public function get customUnicName():String - { - return (this._name); - } - - public function set dropValidator(dv:Function):void - { - this._dropValidator = dv; - } - - public function get dropValidator():Function - { - return (this._dropValidator); - } - - public function set removeDropSource(rds:Function):void - { - this._removeDropSource = rds; - } - - public function get removeDropSource():Function - { - return (this._removeDropSource); - } - - public function set processDrop(pd:Function):void - { - this._processDrop = pd; - } - - public function get processDrop():Function - { - return (this._processDrop); - } - - private function returnTrueFunction(... args):Boolean - { - return (true); - } - - - } -}//package com.ankamagames.atouin.types - + import flash.display.Sprite; + import com.ankamagames.jerakine.interfaces.ICustomUnicNameGetter; + + public class GraphicCell extends Sprite implements ICustomUnicNameGetter + { + + public function GraphicCell(param1:uint) + { + this._dropValidator = this.returnTrueFunction; + this._removeDropSource = this.returnTrueFunction; + this._processDrop = this.returnTrueFunction; + super(); + this.cellId = param1; + name = param1.toString(); + this._name = "cell::" + param1; + buttonMode = true; + mouseChildren = false; + cacheAsBitmap = true; + } + + private var _dropValidator:Function; + + private var _removeDropSource:Function; + + private var _processDrop:Function; + + private var _name:String; + + public var cellId:uint; + + public function get customUnicName() : String + { + return this._name; + } + + public function set dropValidator(param1:Function) : void + { + this._dropValidator = param1; + } + + public function get dropValidator() : Function + { + return this._dropValidator; + } + + public function set removeDropSource(param1:Function) : void + { + this._removeDropSource = param1; + } + + public function get removeDropSource() : Function + { + return this._removeDropSource; + } + + public function set processDrop(param1:Function) : void + { + this._processDrop = param1; + } + + public function get processDrop() : Function + { + return this._processDrop; + } + + private function returnTrueFunction(... rest) : Boolean + { + return true; + } + } +} diff --git a/com/ankamagames/atouin/types/ICellContainer.as b/com/ankamagames/atouin/types/ICellContainer.as index 9006de9d3..dc17330cf 100644 --- a/com/ankamagames/atouin/types/ICellContainer.as +++ b/com/ankamagames/atouin/types/ICellContainer.as @@ -1,30 +1,48 @@ -package com.ankamagames.atouin.types +package com.ankamagames.atouin.types { - public interface ICellContainer - { - - function get cellId():uint; - function set cellId(_arg_1:uint):void; - function get layerId():int; - function set layerId(_arg_1:int):void; - function get cacheAsBitmap():Boolean; - function set cacheAsBitmap(_arg_1:Boolean):void; - function get mouseChildren():Boolean; - function set mouseChildren(_arg_1:Boolean):void; - function get mouseEnabled():Boolean; - function set mouseEnabled(_arg_1:Boolean):void; - function get startX():int; - function set startX(_arg_1:int):void; - function get startY():int; - function set startY(_arg_1:int):void; - function get depth():int; - function set depth(_arg_1:int):void; - function get x():Number; - function set x(_arg_1:Number):void; - function get y():Number; - function set y(_arg_1:Number):void; - function addFakeChild(_arg_1:Object, _arg_2:Object, _arg_3:Object):void; - - } -}//package com.ankamagames.atouin.types - + public interface ICellContainer + { + + function get cellId() : uint; + + function set cellId(param1:uint) : void; + + function get layerId() : int; + + function set layerId(param1:int) : void; + + function get cacheAsBitmap() : Boolean; + + function set cacheAsBitmap(param1:Boolean) : void; + + function get mouseChildren() : Boolean; + + function set mouseChildren(param1:Boolean) : void; + + function get mouseEnabled() : Boolean; + + function set mouseEnabled(param1:Boolean) : void; + + function get startX() : int; + + function set startX(param1:int) : void; + + function get startY() : int; + + function set startY(param1:int) : void; + + function get depth() : int; + + function set depth(param1:int) : void; + + function get x() : Number; + + function set x(param1:Number) : void; + + function get y() : Number; + + function set y(param1:Number) : void; + + function addFakeChild(param1:Object, param2:Object, param3:Object) : void; + } +} diff --git a/com/ankamagames/atouin/types/InteractiveCell.as b/com/ankamagames/atouin/types/InteractiveCell.as index 8a3a0d9f0..7117c2f6d 100644 --- a/com/ankamagames/atouin/types/InteractiveCell.as +++ b/com/ankamagames/atouin/types/InteractiveCell.as @@ -1,23 +1,25 @@ -package com.ankamagames.atouin.types +package com.ankamagames.atouin.types { - import flash.display.DisplayObjectContainer; - - public class InteractiveCell - { - - public var cellId:uint; - public var sprite:DisplayObjectContainer; - public var x:Number; - public var y:Number; - - public function InteractiveCell(_cellId:uint, _sprite:DisplayObjectContainer, _x:Number, _y:Number) - { - this.cellId = _cellId; - this.sprite = _sprite; - this.x = _x; - this.y = _y; - } - - } -}//package com.ankamagames.atouin.types - + import flash.display.DisplayObjectContainer; + + public class InteractiveCell extends Object + { + + public function InteractiveCell(param1:uint, param2:DisplayObjectContainer, param3:Number, param4:Number) + { + super(); + this.cellId = param1; + this.sprite = param2; + this.x = param3; + this.y = param4; + } + + public var cellId:uint; + + public var sprite:DisplayObjectContainer; + + public var x:Number; + + public var y:Number; + } +} diff --git a/com/ankamagames/atouin/types/LayerContainer.as b/com/ankamagames/atouin/types/LayerContainer.as index 17d39b430..3684f8d6c 100644 --- a/com/ankamagames/atouin/types/LayerContainer.as +++ b/com/ankamagames/atouin/types/LayerContainer.as @@ -1,53 +1,52 @@ -package com.ankamagames.atouin.types +package com.ankamagames.atouin.types { - import flash.display.Sprite; - import com.ankamagames.jerakine.logger.Logger; - import com.ankamagames.jerakine.logger.Log; - import flash.utils.getQualifiedClassName; - - public class LayerContainer extends Sprite - { - - protected static const _log:Logger = Log.getLogger(getQualifiedClassName(LayerContainer)); - - private var _nLayerId:int; - private var _lastIndexCell:uint; - - public function LayerContainer(nId:int) - { - this._nLayerId = nId; - name = ("layer" + nId); - } - - public function get layerId():int - { - return (this._nLayerId); - } - - public function addCell(cellCtr:CellContainer):void - { - var currentCell:CellContainer; - var startIndex:uint; - var i:uint = startIndex; - while (i < numChildren) + import flash.display.Sprite; + import com.ankamagames.jerakine.logger.Logger; + import com.ankamagames.jerakine.logger.Log; + import flash.utils.getQualifiedClassName; + + public class LayerContainer extends Sprite + { + + public function LayerContainer(param1:int) + { + super(); + this._nLayerId = param1; + name = "layer" + param1; + } + + protected static const _log:Logger = Log.getLogger(getQualifiedClassName(LayerContainer)); + + private var _nLayerId:int; + + private var _lastIndexCell:uint; + + public function get layerId() : int + { + return this._nLayerId; + } + + public function addCell(param1:CellContainer) : void + { + var _loc2_:CellContainer = null; + var _loc3_:uint = 0; + var _loc4_:uint = _loc3_; + while(_loc4_ < numChildren) + { + _loc2_ = getChildAt(_loc4_) as CellContainer; + if(_loc2_) { - currentCell = (getChildAt(i) as CellContainer); - if (!!(currentCell)) - { - if (cellCtr.depth < currentCell.depth) - { - this._lastIndexCell = i; - addChildAt(cellCtr, i); - return; - }; - }; - i++; - }; - this._lastIndexCell = numChildren; - addChild(cellCtr); - } - - - } -}//package com.ankamagames.atouin.types - + if(param1.depth < _loc2_.depth) + { + this._lastIndexCell = _loc4_; + addChildAt(param1,_loc4_); + return; + } + } + _loc4_++; + } + this._lastIndexCell = numChildren; + addChild(param1); + } + } +} diff --git a/com/ankamagames/atouin/types/MapGfxBitmap.as b/com/ankamagames/atouin/types/MapGfxBitmap.as index b61d07a0b..60ef0931a 100644 --- a/com/ankamagames/atouin/types/MapGfxBitmap.as +++ b/com/ankamagames/atouin/types/MapGfxBitmap.as @@ -1,26 +1,23 @@ -package com.ankamagames.atouin.types +package com.ankamagames.atouin.types { - import flash.display.Bitmap; - import com.ankamagames.jerakine.interfaces.ICustomUnicNameGetter; - import flash.display.BitmapData; - - public class MapGfxBitmap extends Bitmap implements ICustomUnicNameGetter - { - - private var _name:String; - - public function MapGfxBitmap(bitmapdata:BitmapData, pixelSnapping:String="auto", smoothing:Boolean=false, identifier:uint=0) - { - super(bitmapdata, pixelSnapping, smoothing); - this._name = ("mapGfx::" + identifier); - } - - public function get customUnicName():String - { - return (this._name); - } - - - } -}//package com.ankamagames.atouin.types - + import flash.display.Bitmap; + import com.ankamagames.jerakine.interfaces.ICustomUnicNameGetter; + import flash.display.BitmapData; + + public class MapGfxBitmap extends Bitmap implements ICustomUnicNameGetter + { + + public function MapGfxBitmap(param1:BitmapData, param2:String = "auto", param3:Boolean = false, param4:uint = 0) + { + super(param1,param2,param3); + this._name = "mapGfx::" + param4; + } + + private var _name:String; + + public function get customUnicName() : String + { + return this._name; + } + } +} diff --git a/com/ankamagames/atouin/types/Selection.as b/com/ankamagames/atouin/types/Selection.as index 3f00eb99f..e980b03b5 100644 --- a/com/ankamagames/atouin/types/Selection.as +++ b/com/ankamagames/atouin/types/Selection.as @@ -1,87 +1,94 @@ -package com.ankamagames.atouin.types +package com.ankamagames.atouin.types { - import com.ankamagames.jerakine.logger.Logger; - import com.ankamagames.jerakine.logger.Log; - import flash.utils.getQualifiedClassName; - import com.ankamagames.atouin.utils.IZoneRenderer; - import com.ankamagames.jerakine.types.zones.IZone; - import __AS3__.vec.Vector; - import com.ankamagames.jerakine.types.Color; - import com.ankamagames.atouin.managers.MapDisplayManager; - - public class Selection - { - - protected static const _log:Logger = Log.getLogger(getQualifiedClassName(Selection)); - - private var _mapId:uint; - public var renderer:IZoneRenderer; - public var zone:IZone; - public var cells:Vector.; - public var color:Color; - public var alpha:Boolean = true; - public var cellId:uint; - public var visible:Boolean; - - - public function set mapId(id:uint):void - { - this._mapId = id; - } - - public function get mapId():uint - { - if (isNaN(this._mapId)) + import com.ankamagames.jerakine.logger.Logger; + import com.ankamagames.jerakine.logger.Log; + import flash.utils.getQualifiedClassName; + import com.ankamagames.atouin.utils.IZoneRenderer; + import com.ankamagames.jerakine.types.zones.IZone; + import com.ankamagames.jerakine.types.Color; + import com.ankamagames.atouin.managers.MapDisplayManager; + + public class Selection extends Object + { + + public function Selection() + { + super(); + } + + protected static const _log:Logger = Log.getLogger(getQualifiedClassName(Selection)); + + private var _mapId:uint; + + public var renderer:IZoneRenderer; + + public var zone:IZone; + + public var cells:Vector.; + + public var color:Color; + + public var alpha:Boolean = true; + + public var cellId:uint; + + public var visible:Boolean; + + public function set mapId(param1:uint) : void + { + this._mapId = param1; + } + + public function get mapId() : uint + { + if(isNaN(this._mapId)) + { + return MapDisplayManager.getInstance().currentMapPoint.mapId; + } + return this._mapId; + } + + public function update(param1:Boolean = false) : void + { + if(this.renderer) + { + this.renderer.render(this.cells,this.color,MapDisplayManager.getInstance().getDataMapContainer(),this.alpha,param1); + } + this.visible = true; + } + + public function remove(param1:Vector. = null) : void + { + if(this.renderer) + { + if(!param1) { - return (MapDisplayManager.getInstance().currentMapPoint.mapId); - }; - return (this._mapId); - } - - public function update(pUpdateStrata:Boolean=false):void - { - if (this.renderer) + this.renderer.remove(this.cells,MapDisplayManager.getInstance().getDataMapContainer()); + } + else { - this.renderer.render(this.cells, this.color, MapDisplayManager.getInstance().getDataMapContainer(), this.alpha, pUpdateStrata); - }; - this.visible = true; - } - - public function remove(aCells:Vector.=null):void - { - if (this.renderer) + this.renderer.remove(param1,MapDisplayManager.getInstance().getDataMapContainer()); + } + } + this.visible = false; + } + + public function isInside(param1:uint) : Boolean + { + if(!this.cells) + { + return false; + } + var _loc2_:uint = 0; + while(_loc2_ < this.cells.length) + { + if(this.cells[_loc2_] == param1) { - if (!(aCells)) - { - this.renderer.remove(this.cells, MapDisplayManager.getInstance().getDataMapContainer()); - } - else - { - this.renderer.remove(aCells, MapDisplayManager.getInstance().getDataMapContainer()); - }; - }; - this.visible = false; - } - - public function isInside(cellId:uint):Boolean - { - if (!(this.cells)) - { - return (false); - }; - var i:uint; - while (i < this.cells.length) - { - if (this.cells[i] == cellId) - { - return (true); - }; - i++; - }; - return (false); - } - - - } -}//package com.ankamagames.atouin.types - + return true; + } + _loc2_++; + } + return false; + } + } +} diff --git a/com/ankamagames/atouin/types/SpriteWrapper.as b/com/ankamagames/atouin/types/SpriteWrapper.as index 0eef5d0f9..56ac5b0ba 100644 --- a/com/ankamagames/atouin/types/SpriteWrapper.as +++ b/com/ankamagames/atouin/types/SpriteWrapper.as @@ -1,26 +1,24 @@ -package com.ankamagames.atouin.types +package com.ankamagames.atouin.types { - import flash.display.Sprite; - import com.ankamagames.jerakine.interfaces.ICustomUnicNameGetter; - import flash.display.DisplayObject; - - public class SpriteWrapper extends Sprite implements ICustomUnicNameGetter - { - - private var _name:String; - - public function SpriteWrapper(content:DisplayObject, identifier:uint) - { - addChild(content); - this._name = ("mapGfx::" + identifier); - } - - public function get customUnicName():String - { - return (this._name); - } - - - } -}//package com.ankamagames.atouin.types - + import flash.display.Sprite; + import com.ankamagames.jerakine.interfaces.ICustomUnicNameGetter; + import flash.display.DisplayObject; + + public class SpriteWrapper extends Sprite implements ICustomUnicNameGetter + { + + public function SpriteWrapper(param1:DisplayObject, param2:uint) + { + super(); + addChild(param1); + this._name = "mapGfx::" + param2; + } + + private var _name:String; + + public function get customUnicName() : String + { + return this._name; + } + } +} diff --git a/com/ankamagames/atouin/types/TrapZoneTile.as b/com/ankamagames/atouin/types/TrapZoneTile.as index be8d58cdd..2fae67e7f 100644 --- a/com/ankamagames/atouin/types/TrapZoneTile.as +++ b/com/ankamagames/atouin/types/TrapZoneTile.as @@ -1,102 +1,107 @@ -package com.ankamagames.atouin.types +package com.ankamagames.atouin.types { - import flash.display.Sprite; - import com.ankamagames.jerakine.entities.interfaces.IDisplayable; - import com.ankamagames.jerakine.entities.behaviours.IDisplayBehavior; - import flash.geom.Point; - import com.ankamagames.atouin.managers.EntitiesDisplayManager; - import com.ankamagames.jerakine.types.positions.MapPoint; - import com.ankamagames.atouin.AtouinConstants; - import com.ankamagames.jerakine.interfaces.IRectangle; - - public class TrapZoneTile extends Sprite implements IDisplayable - { - - private var _displayBehaviors:IDisplayBehavior; - private var _displayed:Boolean; - private var _currentCell:Point; - private var _cellId:uint; - public var strata:uint = 10; - - - public function display(strata:uint=0):void - { - EntitiesDisplayManager.getInstance().displayEntity(this, MapPoint.fromCellId(this._cellId), strata); - this._displayed = true; - } - - public function drawStroke(t:Boolean, r:Boolean, b:Boolean, l:Boolean):void - { - graphics.lineStyle(3, 0); - if (!(t)) - { - graphics.moveTo(-(AtouinConstants.CELL_HALF_WIDTH), 0); - graphics.lineTo(0, AtouinConstants.CELL_HALF_HEIGHT); - }; - if (!(b)) - { - graphics.moveTo(0, -(AtouinConstants.CELL_HALF_HEIGHT)); - graphics.lineTo(AtouinConstants.CELL_HALF_WIDTH, 0); - }; - if (!(r)) - { - graphics.moveTo(-(AtouinConstants.CELL_HALF_WIDTH), 0); - graphics.lineTo(0, -(AtouinConstants.CELL_HALF_HEIGHT)); - }; - if (!(l)) - { - graphics.moveTo(AtouinConstants.CELL_HALF_WIDTH, 0); - graphics.lineTo(0, AtouinConstants.CELL_HALF_HEIGHT); - }; - } - - public function remove():void - { - this._displayed = false; - EntitiesDisplayManager.getInstance().removeEntity(this); - } - - public function get displayBehaviors():IDisplayBehavior - { - return (this._displayBehaviors); - } - - public function set displayBehaviors(value:IDisplayBehavior):void - { - this._displayBehaviors = value; - } - - public function get currentCell():Point - { - return (this._currentCell); - } - - public function set currentCell(value:Point):void - { - this._currentCell = value; - } - - public function get displayed():Boolean - { - return (this._displayed); - } - - public function get absoluteBounds():IRectangle - { - return (this._displayBehaviors.getAbsoluteBounds(this)); - } - - public function get cellId():uint - { - return (this._cellId); - } - - public function set cellId(value:uint):void - { - this._cellId = value; - } - - - } -}//package com.ankamagames.atouin.types - + import flash.display.Sprite; + import com.ankamagames.jerakine.entities.interfaces.IDisplayable; + import com.ankamagames.jerakine.entities.behaviours.IDisplayBehavior; + import flash.geom.Point; + import com.ankamagames.atouin.managers.EntitiesDisplayManager; + import com.ankamagames.jerakine.types.positions.MapPoint; + import com.ankamagames.atouin.AtouinConstants; + import com.ankamagames.jerakine.interfaces.IRectangle; + + public class TrapZoneTile extends Sprite implements IDisplayable + { + + public function TrapZoneTile() + { + super(); + } + + private var _displayBehaviors:IDisplayBehavior; + + private var _displayed:Boolean; + + private var _currentCell:Point; + + private var _cellId:uint; + + public var strata:uint = 10; + + public function display(param1:uint = 0) : void + { + EntitiesDisplayManager.getInstance().displayEntity(this,MapPoint.fromCellId(this._cellId),param1); + this._displayed = true; + } + + public function drawStroke(param1:Boolean, param2:Boolean, param3:Boolean, param4:Boolean) : void + { + graphics.lineStyle(3,0); + if(!param1) + { + graphics.moveTo(-AtouinConstants.CELL_HALF_WIDTH,0); + graphics.lineTo(0,AtouinConstants.CELL_HALF_HEIGHT); + } + if(!param3) + { + graphics.moveTo(0,-AtouinConstants.CELL_HALF_HEIGHT); + graphics.lineTo(AtouinConstants.CELL_HALF_WIDTH,0); + } + if(!param2) + { + graphics.moveTo(-AtouinConstants.CELL_HALF_WIDTH,0); + graphics.lineTo(0,-AtouinConstants.CELL_HALF_HEIGHT); + } + if(!param4) + { + graphics.moveTo(AtouinConstants.CELL_HALF_WIDTH,0); + graphics.lineTo(0,AtouinConstants.CELL_HALF_HEIGHT); + } + } + + public function remove() : void + { + this._displayed = false; + EntitiesDisplayManager.getInstance().removeEntity(this); + } + + public function get displayBehaviors() : IDisplayBehavior + { + return this._displayBehaviors; + } + + public function set displayBehaviors(param1:IDisplayBehavior) : void + { + this._displayBehaviors = param1; + } + + public function get currentCell() : Point + { + return this._currentCell; + } + + public function set currentCell(param1:Point) : void + { + this._currentCell = param1; + } + + public function get displayed() : Boolean + { + return this._displayed; + } + + public function get absoluteBounds() : IRectangle + { + return this._displayBehaviors.getAbsoluteBounds(this); + } + + public function get cellId() : uint + { + return this._cellId; + } + + public function set cellId(param1:uint) : void + { + this._cellId = param1; + } + } +} diff --git a/com/ankamagames/atouin/types/TweenEntityData.as b/com/ankamagames/atouin/types/TweenEntityData.as index cbd7cd0bf..2d585d358 100644 --- a/com/ankamagames/atouin/types/TweenEntityData.as +++ b/com/ankamagames/atouin/types/TweenEntityData.as @@ -1,38 +1,54 @@ -package com.ankamagames.atouin.types +package com.ankamagames.atouin.types { - import com.ankamagames.jerakine.types.positions.MovementPath; - import com.ankamagames.jerakine.entities.interfaces.IEntity; - import com.ankamagames.jerakine.types.positions.MapPoint; - import flash.display.Sprite; - - public class TweenEntityData - { - - public var path:MovementPath; - public var entity:IEntity; - public var animation:String; - public var linearVelocity:Number; - public var hDiagVelocity:Number; - public var vDiagVelocity:Number; - public var barycentre:Number = 0; - public var currentCell:MapPoint; - public var nextCell:MapPoint; - public var wasOrdered:Boolean; - public var start:uint; - public var velocity:Number; - public var orientation:uint = 1; - public var currentCellSprite:Sprite; - public var nextCellSprite:Sprite; - public var callback:Function; - - - public function clear():void - { - this.currentCellSprite = null; - this.nextCellSprite = null; - } - - - } -}//package com.ankamagames.atouin.types - + import com.ankamagames.jerakine.types.positions.MovementPath; + import com.ankamagames.jerakine.entities.interfaces.IEntity; + import com.ankamagames.jerakine.types.positions.MapPoint; + import flash.display.Sprite; + + public class TweenEntityData extends Object + { + + public function TweenEntityData() + { + super(); + } + + public var path:MovementPath; + + public var entity:IEntity; + + public var animation:String; + + public var linearVelocity:Number; + + public var hDiagVelocity:Number; + + public var vDiagVelocity:Number; + + public var barycentre:Number = 0; + + public var currentCell:MapPoint; + + public var nextCell:MapPoint; + + public var wasOrdered:Boolean; + + public var start:uint; + + public var velocity:Number; + + public var orientation:uint = 1.0; + + public var currentCellSprite:Sprite; + + public var nextCellSprite:Sprite; + + public var callback:Function; + + public function clear() : void + { + this.currentCellSprite = null; + this.nextCellSprite = null; + } + } +} diff --git a/com/ankamagames/atouin/types/WorldEntitySprite.as b/com/ankamagames/atouin/types/WorldEntitySprite.as index 6dc09a40b..6f873e8f0 100644 --- a/com/ankamagames/atouin/types/WorldEntitySprite.as +++ b/com/ankamagames/atouin/types/WorldEntitySprite.as @@ -1,40 +1,39 @@ -package com.ankamagames.atouin.types +package com.ankamagames.atouin.types { - import com.ankamagames.tiphon.display.TiphonSprite; - import com.ankamagames.jerakine.interfaces.ICustomUnicNameGetter; - import com.ankamagames.tiphon.types.look.TiphonEntityLook; - - public class WorldEntitySprite extends TiphonSprite implements ICustomUnicNameGetter - { - - private var _cellId:int; - private var _identifier:int; - private var _name:String; - - public function WorldEntitySprite(look:TiphonEntityLook, cellId:int, identifier:int) - { - super(look); - this._name = ("mapGfx::" + identifier); - this._cellId = cellId; - this._identifier = identifier; - } - - public function get cellId():int - { - return (this._cellId); - } - - public function get identifier():int - { - return (this._identifier); - } - - public function get customUnicName():String - { - return (this._name); - } - - - } -}//package com.ankamagames.atouin.types - + import com.ankamagames.tiphon.display.TiphonSprite; + import com.ankamagames.jerakine.interfaces.ICustomUnicNameGetter; + import com.ankamagames.tiphon.types.look.TiphonEntityLook; + + public class WorldEntitySprite extends TiphonSprite implements ICustomUnicNameGetter + { + + public function WorldEntitySprite(param1:TiphonEntityLook, param2:int, param3:int) + { + super(param1); + this._name = "mapGfx::" + param3; + this._cellId = param2; + this._identifier = param3; + } + + private var _cellId:int; + + private var _identifier:int; + + private var _name:String; + + public function get cellId() : int + { + return this._cellId; + } + + public function get identifier() : int + { + return this._identifier; + } + + public function get customUnicName() : String + { + return this._name; + } + } +} diff --git a/com/ankamagames/atouin/types/ZoneClipTile.as b/com/ankamagames/atouin/types/ZoneClipTile.as index a94bceaa2..e0fcd8f29 100644 --- a/com/ankamagames/atouin/types/ZoneClipTile.as +++ b/com/ankamagames/atouin/types/ZoneClipTile.as @@ -1,408 +1,409 @@ -package com.ankamagames.atouin.types +package com.ankamagames.atouin.types { - import flash.display.Sprite; - import com.ankamagames.jerakine.entities.interfaces.IDisplayable; - import com.ankamagames.jerakine.interfaces.ITransparency; - import com.ankamagames.jerakine.resources.loaders.IResourceLoader; - import com.ankamagames.jerakine.types.Uri; - import flash.display.BitmapData; - import com.ankamagames.jerakine.entities.behaviours.IDisplayBehavior; - import flash.geom.Point; - import com.ankamagames.jerakine.resources.loaders.ResourceLoaderFactory; - import com.ankamagames.jerakine.resources.loaders.ResourceLoaderType; - import com.ankamagames.jerakine.resources.events.ResourceLoadedEvent; - import com.ankamagames.jerakine.resources.adapters.impl.AdvancedSwfAdapter; - import flash.system.ApplicationDomain; - import com.ankamagames.atouin.AtouinConstants; - import com.ankamagames.atouin.enums.PlacementStrataEnums; - import com.ankamagames.atouin.managers.EntitiesDisplayManager; - import com.ankamagames.jerakine.types.positions.MapPoint; - import com.ankamagames.atouin.managers.InteractiveCellManager; - import com.ankamagames.atouin.Atouin; - import com.ankamagames.jerakine.interfaces.IRectangle; - import flash.display.Shape; - import flash.display.Bitmap; - - public class ZoneClipTile extends Sprite implements IDisplayable, ITransparency - { - - private static var clips:Array = new Array(); - private static var loader:IResourceLoader; - private static var no_z_render_strata:Sprite = new Sprite(); - private static const BORDER_CLIP:String = "BlocageMvt"; - - private var _uri:Uri; - private var _clipName:String; - private var _needBorders:Boolean; - private var _borderSprites:Array; - private var _borderBitmapData:BitmapData; - private var _displayMe:Boolean = false; - private var _currentRessource:LoadedTile; - private var _displayBehavior:IDisplayBehavior; - protected var _displayed:Boolean; - private var _currentCell:Point; - private var _cellId:uint; - public var strata:uint = 0; - protected var _cellInstance:Sprite; - - public function ZoneClipTile(pUri:Uri, pClipName:String="Bloc", pNeedBorders:Boolean=false) - { - var o:LoadedTile; - this._borderSprites = new Array(); - super(); - mouseEnabled = false; - mouseChildren = false; - this._needBorders = pNeedBorders; - this._uri = pUri; - this._clipName = pClipName; - this._currentRessource = getRessource(pUri.fileName); - if ((((this._currentRessource == null)) || ((((loader == null)) && ((this._currentRessource == null)))))) + import flash.display.Sprite; + import com.ankamagames.jerakine.entities.interfaces.IDisplayable; + import com.ankamagames.jerakine.interfaces.ITransparency; + import com.ankamagames.jerakine.resources.loaders.IResourceLoader; + import com.ankamagames.jerakine.types.Uri; + import flash.display.BitmapData; + import com.ankamagames.jerakine.entities.behaviours.IDisplayBehavior; + import flash.geom.Point; + import com.ankamagames.jerakine.resources.events.ResourceLoadedEvent; + import flash.system.ApplicationDomain; + import com.ankamagames.atouin.AtouinConstants; + import com.ankamagames.atouin.enums.PlacementStrataEnums; + import com.ankamagames.atouin.managers.EntitiesDisplayManager; + import com.ankamagames.jerakine.types.positions.MapPoint; + import com.ankamagames.atouin.managers.InteractiveCellManager; + import com.ankamagames.atouin.Atouin; + import com.ankamagames.jerakine.interfaces.IRectangle; + import flash.display.Shape; + import flash.display.Bitmap; + import com.ankamagames.jerakine.resources.loaders.ResourceLoaderFactory; + import com.ankamagames.jerakine.resources.loaders.ResourceLoaderType; + import com.ankamagames.jerakine.resources.adapters.impl.AdvancedSwfAdapter; + + public class ZoneClipTile extends Sprite implements IDisplayable, ITransparency + { + + public function ZoneClipTile(param1:Uri, param2:String = "Bloc", param3:Boolean = false) + { + var _loc4_:LoadedTile = null; + this._borderSprites = new Array(); + super(); + mouseEnabled = false; + mouseChildren = false; + this._needBorders = param3; + this._uri = param1; + this._clipName = param2; + this._currentRessource = getRessource(param1.fileName); + if(this._currentRessource == null || loader == null && this._currentRessource == null) + { + _loc4_ = new LoadedTile(this._uri.fileName); + _loc4_.addClip(this._clipName); + clips.push(_loc4_); + this._currentRessource = _loc4_; + loader = ResourceLoaderFactory.getLoader(ResourceLoaderType.SINGLE_LOADER); + loader.addEventListener(ResourceLoadedEvent.LOADED,this.onClipLoaded); + loader.load(this._uri,null,AdvancedSwfAdapter); + } + else if(this._currentRessource.getClip(this._clipName) == null || this._currentRessource.getClip(this._clipName).clip == null) + { + if(!this._currentRessource.appDomain) { - o = new LoadedTile(this._uri.fileName); - o.addClip(this._clipName); - clips.push(o); - this._currentRessource = o; - loader = ResourceLoaderFactory.getLoader(ResourceLoaderType.SINGLE_LOADER); - loader.addEventListener(ResourceLoadedEvent.LOADED, this.onClipLoaded); - loader.load(this._uri, null, AdvancedSwfAdapter); + loader.addEventListener(ResourceLoadedEvent.LOADED,this.onClipLoaded); } else { - if ((((this._currentRessource.getClip(this._clipName) == null)) || ((this._currentRessource.getClip(this._clipName).clip == null)))) - { - if (!(this._currentRessource.appDomain)) - { - loader.addEventListener(ResourceLoadedEvent.LOADED, this.onClipLoaded); - } - else - { - this._currentRessource.addClip(this._clipName, this._currentRessource.appDomain.getDefinition(this._clipName)); - this.display(); - }; - } - else - { - this.display(); - }; - }; - } - - private static function getRessource(pFileName:String):LoadedTile - { - var i:int; - var len:int = clips.length; - i = 0; - while (i < len) - { - if (clips[i].fileName == pFileName) - { - return ((clips[i] as LoadedTile)); - }; - i = (i + 1); - }; - return (null); - } - - public static function getTile(pUriName:String, pClipName:String):Sprite - { - var o:LoadedTile = getRessource(pUriName); - return (new (o.getClip(pClipName).clip)()); - } - - - private function onClipLoaded(e:ResourceLoadedEvent):void - { - loader.removeEventListener(ResourceLoadedEvent.LOADED, this.onClipLoaded); - var appDomain:ApplicationDomain = e.resource.applicationDomain; - var o:LoadedTile = getRessource(e.uri.fileName); - if (o == null) - { - o = new LoadedTile(e.uri.fileName); - o.addClip(this._clipName, appDomain.getDefinition(this._clipName)); - clips.push(o); + this._currentRessource.addClip(this._clipName,this._currentRessource.appDomain.getDefinition(this._clipName)); + this.display(); } - else + } + else + { + this.display(); + } + + } + + private static var clips:Array = new Array(); + + private static var loader:IResourceLoader; + + private static var no_z_render_strata:Sprite = new Sprite(); + + private static const BORDER_CLIP:String = "BlocageMvt"; + + private static function getRessource(param1:String) : LoadedTile + { + var _loc2_:* = 0; + var _loc3_:int = clips.length; + _loc2_ = 0; + while(_loc2_ < _loc3_) + { + if(clips[_loc2_].fileName == param1) { - if ((((o.getClip(this._clipName) == null)) || ((o.getClip(this._clipName).clip == null)))) - { - o.addClip(this._clipName, appDomain.getDefinition(this._clipName)); - }; - }; - if (!(o.appDomain)) + return clips[_loc2_] as LoadedTile; + } + _loc2_ = _loc2_ + 1; + } + return null; + } + + public static function getTile(param1:String, param2:String) : Sprite + { + var _loc3_:LoadedTile = getRessource(param1); + return new _loc3_.getClip(param2).clip(); + } + + private var _uri:Uri; + + private var _clipName:String; + + private var _needBorders:Boolean; + + private var _borderSprites:Array; + + private var _borderBitmapData:BitmapData; + + private var _displayMe:Boolean = false; + + private var _currentRessource:LoadedTile; + + private var _displayBehavior:IDisplayBehavior; + + protected var _displayed:Boolean; + + private var _currentCell:Point; + + private var _cellId:uint; + + public var strata:uint = 0; + + protected var _cellInstance:Sprite; + + private function onClipLoaded(param1:ResourceLoadedEvent) : void + { + loader.removeEventListener(ResourceLoadedEvent.LOADED,this.onClipLoaded); + var _loc2_:ApplicationDomain = param1.resource.applicationDomain; + var _loc3_:LoadedTile = getRessource(param1.uri.fileName); + if(_loc3_ == null) + { + _loc3_ = new LoadedTile(param1.uri.fileName); + _loc3_.addClip(this._clipName,_loc2_.getDefinition(this._clipName)); + clips.push(_loc3_); + } + else if(_loc3_.getClip(this._clipName) == null || _loc3_.getClip(this._clipName).clip == null) + { + _loc3_.addClip(this._clipName,_loc2_.getDefinition(this._clipName)); + } + + if(!_loc3_.appDomain) + { + _loc3_.appDomain = _loc2_; + } + this._currentRessource = _loc3_; + if(this._displayMe) + { + this._displayMe = false; + this.display(); + } + } + + public function display(param1:uint = 0) : void + { + var _loc2_:Object = null; + var _loc3_:Sprite = null; + var _loc4_:* = false; + var _loc5_:* = false; + var _loc6_:* = false; + var _loc7_:Sprite = null; + var _loc8_:Sprite = null; + var _loc9_:Sprite = null; + if(this._currentRessource == null || this._currentRessource.getClip(this._clipName) == null || this._currentRessource.getClip(this._clipName).clip == null) + { + this._displayMe = true; + } + else + { + _loc2_ = this._currentRessource.getClip(this._clipName); + if(_loc2_.clip != null) { - o.appDomain = appDomain; - }; - this._currentRessource = o; - if (this._displayMe) + this._cellInstance = new _loc2_.clip(); + addChild(this._cellInstance); + } + if(this._needBorders) { - this._displayMe = false; - this.display(); - }; - } - - public function display(wishedStrata:uint=0):void - { - var _local_2:Object; - var spr:Sprite; - var isLeftCol:Boolean; - var isRightCol:Boolean; - var isEvenRow:Boolean; - var spr2:Sprite; - var spr3:Sprite; - var _local_9:Sprite; - if ((((((this._currentRessource == null)) || ((this._currentRessource.getClip(this._clipName) == null)))) || ((this._currentRessource.getClip(this._clipName).clip == null)))) + this._borderSprites = new Array(); + _loc4_ = this.cellId % 14 == 0; + _loc5_ = (this.cellId + 1) % 14 == 0; + _loc6_ = Math.floor(this.cellId / 14) % 2 == 0; + if((_loc4_) && (_loc6_)) + { + _loc3_ = this.getFakeTile(); + _loc3_.x = -AtouinConstants.CELL_HALF_WIDTH; + _loc3_.y = -AtouinConstants.CELL_HALF_HEIGHT; + this._borderSprites.push(_loc3_); + addChildAt(_loc3_,0); + } + else if((_loc5_) && !_loc6_) + { + _loc3_ = this.getFakeTile(); + _loc3_.x = AtouinConstants.CELL_HALF_WIDTH; + _loc3_.y = -AtouinConstants.CELL_HALF_HEIGHT; + this._borderSprites.push(_loc3_); + addChildAt(_loc3_,0); + } + + if(this.cellId < 14) + { + _loc3_ = this.getFakeTile(); + _loc3_.x = AtouinConstants.CELL_HALF_WIDTH; + _loc3_.y = -AtouinConstants.CELL_HALF_HEIGHT; + this._borderSprites.push(_loc3_); + addChildAt(_loc3_,0); + } + else if(this.cellId > 545) + { + _loc3_ = this.getFakeTile(); + _loc3_.x = -AtouinConstants.CELL_HALF_WIDTH; + _loc3_.y = AtouinConstants.CELL_HALF_HEIGHT; + this._borderSprites.push(_loc3_); + addChild(_loc3_); + } + + if(this.cellId == 532) + { + _loc7_ = this.getFakeTile(); + _loc7_.x = -AtouinConstants.CELL_HALF_WIDTH; + _loc7_.y = AtouinConstants.CELL_HALF_HEIGHT; + this._borderSprites.push(_loc7_); + addChild(_loc7_); + } + else if(this.cellId == 559) + { + _loc8_ = this.getFakeTile(); + _loc8_.x = AtouinConstants.CELL_HALF_WIDTH; + _loc8_.y = AtouinConstants.CELL_HALF_HEIGHT; + this._borderSprites.push(_loc8_); + addChild(_loc8_); + } + + } + if(this.strata != PlacementStrataEnums.STRATA_NO_Z_ORDER) { - this._displayMe = true; + EntitiesDisplayManager.getInstance().displayEntity(this,MapPoint.fromCellId(this.cellId),this.strata); } else { - _local_2 = this._currentRessource.getClip(this._clipName); - if (_local_2.clip != null) - { - this._cellInstance = new (_local_2.clip)(); - addChild(this._cellInstance); - }; - if (this._needBorders) - { - this._borderSprites = new Array(); - isLeftCol = ((this.cellId % 14) == 0); - isRightCol = (((this.cellId + 1) % 14) == 0); - isEvenRow = ((Math.floor((this.cellId / 14)) % 2) == 0); - if (((isLeftCol) && (isEvenRow))) - { - spr = this.getFakeTile(); - spr.x = -(AtouinConstants.CELL_HALF_WIDTH); - spr.y = -(AtouinConstants.CELL_HALF_HEIGHT); - this._borderSprites.push(spr); - addChildAt(spr, 0); - } - else - { - if (((isRightCol) && (!(isEvenRow)))) - { - spr = this.getFakeTile(); - spr.x = AtouinConstants.CELL_HALF_WIDTH; - spr.y = -(AtouinConstants.CELL_HALF_HEIGHT); - this._borderSprites.push(spr); - addChildAt(spr, 0); - }; - }; - if (this.cellId < 14) - { - spr = this.getFakeTile(); - spr.x = AtouinConstants.CELL_HALF_WIDTH; - spr.y = -(AtouinConstants.CELL_HALF_HEIGHT); - this._borderSprites.push(spr); - addChildAt(spr, 0); - } - else - { - if (this.cellId > 545) - { - spr = this.getFakeTile(); - spr.x = -(AtouinConstants.CELL_HALF_WIDTH); - spr.y = AtouinConstants.CELL_HALF_HEIGHT; - this._borderSprites.push(spr); - addChild(spr); - }; - }; - if (this.cellId == 532) - { - spr2 = this.getFakeTile(); - spr2.x = -(AtouinConstants.CELL_HALF_WIDTH); - spr2.y = AtouinConstants.CELL_HALF_HEIGHT; - this._borderSprites.push(spr2); - addChild(spr2); - } - else - { - if (this.cellId == 559) - { - spr3 = this.getFakeTile(); - spr3.x = AtouinConstants.CELL_HALF_WIDTH; - spr3.y = AtouinConstants.CELL_HALF_HEIGHT; - this._borderSprites.push(spr3); - addChild(spr3); - }; - }; - }; - if (this.strata != PlacementStrataEnums.STRATA_NO_Z_ORDER) - { - EntitiesDisplayManager.getInstance().displayEntity(this, MapPoint.fromCellId(this.cellId), this.strata); - } - else - { - _local_9 = InteractiveCellManager.getInstance().getCell(MapPoint.fromCellId(this.cellId).cellId); - this.x = (_local_9.x + (_local_9.width / 2)); - this.y = (_local_9.y + (_local_9.height / 2)); - no_z_render_strata.addChild(this); - if (((!((Atouin.getInstance().selectionContainer == null))) && (!(Atouin.getInstance().selectionContainer.contains(no_z_render_strata))))) - { - Atouin.getInstance().selectionContainer.addChildAt(no_z_render_strata, 0); - }; - }; - this._displayed = true; - }; - } - - public function get displayBehaviors():IDisplayBehavior - { - return (this._displayBehavior); - } - - public function set displayBehaviors(oValue:IDisplayBehavior):void - { - this._displayBehavior = oValue; - } - - public function get currentCellPosition():Point - { - return (this._currentCell); - } - - public function set currentCellPosition(pValue:Point):void - { - this._currentCell = pValue; - } - - public function get displayed():Boolean - { - return (this._displayed); - } - - public function get absoluteBounds():IRectangle - { - return (this._displayBehavior.getAbsoluteBounds(this)); - } - - public function get cellId():uint - { - return (this._cellId); - } - - public function set cellId(nValue:uint):void - { - this._cellId = nValue; - } - - public function remove():void - { - var spr:Sprite; - this._displayed = false; - if (this._borderSprites.length) - { - while ((spr = this._borderSprites.pop())) - { - removeChild(spr); - }; - }; - if (this._cellInstance != null) - { - removeChild(this._cellInstance); - }; - if (this.strata != PlacementStrataEnums.STRATA_NO_Z_ORDER) + _loc9_ = InteractiveCellManager.getInstance().getCell(MapPoint.fromCellId(this.cellId).cellId); + this.x = _loc9_.x + _loc9_.width / 2; + this.y = _loc9_.y + _loc9_.height / 2; + no_z_render_strata.addChild(this); + if(!(Atouin.getInstance().selectionContainer == null) && !Atouin.getInstance().selectionContainer.contains(no_z_render_strata)) + { + Atouin.getInstance().selectionContainer.addChildAt(no_z_render_strata,0); + } + } + this._displayed = true; + } + } + + public function get displayBehaviors() : IDisplayBehavior + { + return this._displayBehavior; + } + + public function set displayBehaviors(param1:IDisplayBehavior) : void + { + this._displayBehavior = param1; + } + + public function get currentCellPosition() : Point + { + return this._currentCell; + } + + public function set currentCellPosition(param1:Point) : void + { + this._currentCell = param1; + } + + public function get displayed() : Boolean + { + return this._displayed; + } + + public function get absoluteBounds() : IRectangle + { + return this._displayBehavior.getAbsoluteBounds(this); + } + + public function get cellId() : uint + { + return this._cellId; + } + + public function set cellId(param1:uint) : void + { + this._cellId = param1; + } + + public function remove() : void + { + var _loc1_:Sprite = null; + this._displayed = false; + if(this._borderSprites.length) + { + while(_loc1_ = this._borderSprites.pop()) { - EntitiesDisplayManager.getInstance().removeEntity(this); + removeChild(_loc1_); } - else + } + if(this._cellInstance != null) + { + removeChild(this._cellInstance); + } + if(this.strata != PlacementStrataEnums.STRATA_NO_Z_ORDER) + { + EntitiesDisplayManager.getInstance().removeEntity(this); + } + else + { + if(no_z_render_strata.contains(this)) { - if (no_z_render_strata.contains(this)) - { - no_z_render_strata.removeChild(this); - }; - if ((((((no_z_render_strata.numChildren <= 0)) && (Atouin.getInstance().selectionContainer))) && (Atouin.getInstance().selectionContainer.contains(no_z_render_strata)))) - { - Atouin.getInstance().selectionContainer.removeChild(no_z_render_strata); - }; - }; - } - - public function getIsTransparencyAllowed():Boolean - { - return (true); - } - - public function get uri():Uri - { - return (this._uri); - } - - public function get clipName():String - { - return (this._clipName); - } - - public function getFakeTile():Sprite - { - var s:Shape; - if (this._borderBitmapData == null) + no_z_render_strata.removeChild(this); + } + if((no_z_render_strata.numChildren <= 0) && (Atouin.getInstance().selectionContainer) && (Atouin.getInstance().selectionContainer.contains(no_z_render_strata))) { - s = new Shape(); - s.graphics.beginFill(0xFF0000); - s.graphics.moveTo((86 / 2), 0); - s.graphics.lineTo(86, (43 / 2)); - s.graphics.lineTo((86 / 2), 43); - s.graphics.lineTo(0, (43 / 2)); - s.graphics.endFill(); - this._borderBitmapData = new BitmapData(86, 43, true, 0xFF0000); - this._borderBitmapData.draw(s); - }; - var bmp:Bitmap = new Bitmap(this._borderBitmapData); - bmp.x = (-86 / 2); - bmp.y = (-43 / 2); - var spr:Sprite = new Sprite(); - spr.addChild(bmp); - return (spr); - } - - - } -}//package com.ankamagames.atouin.types - + Atouin.getInstance().selectionContainer.removeChild(no_z_render_strata); + } + } + } + + public function getIsTransparencyAllowed() : Boolean + { + return true; + } + + public function get uri() : Uri + { + return this._uri; + } + + public function get clipName() : String + { + return this._clipName; + } + + public function getFakeTile() : Sprite + { + var _loc3_:Shape = null; + if(this._borderBitmapData == null) + { + _loc3_ = new Shape(); + _loc3_.graphics.beginFill(16711680); + _loc3_.graphics.moveTo(86 / 2,0); + _loc3_.graphics.lineTo(86,43 / 2); + _loc3_.graphics.lineTo(86 / 2,43); + _loc3_.graphics.lineTo(0,43 / 2); + _loc3_.graphics.endFill(); + this._borderBitmapData = new BitmapData(86,43,true,16711680); + this._borderBitmapData.draw(_loc3_); + } + var _loc1_:Bitmap = new Bitmap(this._borderBitmapData); + _loc1_.x = -86 / 2; + _loc1_.y = -43 / 2; + var _loc2_:Sprite = new Sprite(); + _loc2_.addChild(_loc1_); + return _loc2_; + } + } +} import flash.system.ApplicationDomain; -class LoadedTile +class LoadedTile extends Object { - - public var fileName:String; - public var appDomain:ApplicationDomain; - /*private*/ var _clips:Array; - - public function LoadedTile(pName:String):void - { - this.fileName = pName; - this._clips = new Array(); - } - - public function addClip(pName:String, pClip:Object=null):void - { - var o:Object = this.getClip(pName); - if (o == null) - { - o = new Object(); - o.clipName = pName; - o.clip = pClip; - this._clips.push(o); - } - else - { - o.clip = pClip; - }; - } - - public function getClip(pName:String):Object - { - var o:Object; - for each (o in this._clips) - { - if (o.clipName == pName) - { - return (o); - }; - }; - return (null); - } - - + + function LoadedTile(param1:String) + { + super(); + this.fileName = param1; + this._clips = new Array(); + } + + public var fileName:String; + + public var appDomain:ApplicationDomain; + + private var _clips:Array; + + public function addClip(param1:String, param2:Object = null) : void + { + var _loc3_:Object = this.getClip(param1); + if(_loc3_ == null) + { + _loc3_ = new Object(); + _loc3_.clipName = param1; + _loc3_.clip = param2; + this._clips.push(_loc3_); + } + else + { + _loc3_.clip = param2; + } + } + + public function getClip(param1:String) : Object + { + var _loc2_:Object = null; + for each(_loc2_ in this._clips) + { + if(_loc2_.clipName == param1) + { + return _loc2_; + } + } + return null; + } } - diff --git a/com/ankamagames/atouin/types/ZoneTile.as b/com/ankamagames/atouin/types/ZoneTile.as index efa17c2f1..7e5c7f68b 100644 --- a/com/ankamagames/atouin/types/ZoneTile.as +++ b/com/ankamagames/atouin/types/ZoneTile.as @@ -1,147 +1,154 @@ -package com.ankamagames.atouin.types +package com.ankamagames.atouin.types { - import flash.display.Sprite; - import com.ankamagames.jerakine.entities.interfaces.IDisplayable; - import com.ankamagames.jerakine.interfaces.ITransparency; - import com.ankamagames.jerakine.entities.behaviours.IDisplayBehavior; - import flash.geom.Point; - import flash.text.TextField; - import flash.text.TextFormat; - import com.ankamagames.jerakine.interfaces.IRectangle; - import com.ankamagames.jerakine.managers.FontManager; - import flash.text.TextFormatAlign; - import com.ankamagames.atouin.AtouinConstants; - import flash.geom.ColorTransform; - import com.ankamagames.atouin.managers.EntitiesDisplayManager; - import com.ankamagames.jerakine.types.positions.MapPoint; - - public class ZoneTile extends Sprite implements IDisplayable, ITransparency - { - - private static const _cell:Class = ZoneTile__cell; - - private var _displayBehavior:IDisplayBehavior; - protected var _displayed:Boolean; - private var _currentCell:Point; - private var _cellId:uint; - protected var _cellInstance:Sprite; - private var _tf:TextField; - private var _color:uint; - public var text:String; - public var format:TextFormat; - public var strata:uint = 0; - - public function ZoneTile() - { - mouseEnabled = false; - mouseChildren = false; - } - - public function get displayBehaviors():IDisplayBehavior - { - return (this._displayBehavior); - } - - public function set displayBehaviors(oValue:IDisplayBehavior):void - { - this._displayBehavior = oValue; - } - - public function get currentCellPosition():Point - { - return (this._currentCell); - } - - public function set currentCellPosition(pValue:Point):void - { - this._currentCell = pValue; - } - - public function get displayed():Boolean - { - return (this._displayed); - } - - public function get absoluteBounds():IRectangle - { - return (this._displayBehavior.getAbsoluteBounds(this)); - } - - public function set color(c:uint):void - { - this._color = c; - } - - public function get color():uint - { - return (this._color); - } - - public function get cellId():uint - { - return (this._cellId); - } - - public function set cellId(nValue:uint):void - { - this._cellId = nValue; - } - - public function display(wishedStrata:uint=0):void - { - if (this.text) + import flash.display.Sprite; + import com.ankamagames.jerakine.entities.interfaces.IDisplayable; + import com.ankamagames.jerakine.interfaces.ITransparency; + import com.ankamagames.jerakine.entities.behaviours.IDisplayBehavior; + import flash.geom.Point; + import flash.text.TextField; + import flash.text.TextFormat; + import com.ankamagames.jerakine.interfaces.IRectangle; + import com.ankamagames.jerakine.managers.FontManager; + import flash.text.TextFormatAlign; + import com.ankamagames.atouin.AtouinConstants; + import flash.geom.ColorTransform; + import com.ankamagames.atouin.managers.EntitiesDisplayManager; + import com.ankamagames.jerakine.types.positions.MapPoint; + + public class ZoneTile extends Sprite implements IDisplayable, ITransparency + { + + public function ZoneTile() + { + super(); + mouseEnabled = false; + mouseChildren = false; + } + + private static const _cell:Class = ZoneTile__cell; + + private var _displayBehavior:IDisplayBehavior; + + protected var _displayed:Boolean; + + private var _currentCell:Point; + + private var _cellId:uint; + + protected var _cellInstance:Sprite; + + private var _tf:TextField; + + private var _color:uint; + + public var text:String; + + public var format:TextFormat; + + public var strata:uint = 0; + + public function get displayBehaviors() : IDisplayBehavior + { + return this._displayBehavior; + } + + public function set displayBehaviors(param1:IDisplayBehavior) : void + { + this._displayBehavior = param1; + } + + public function get currentCellPosition() : Point + { + return this._currentCell; + } + + public function set currentCellPosition(param1:Point) : void + { + this._currentCell = param1; + } + + public function get displayed() : Boolean + { + return this._displayed; + } + + public function get absoluteBounds() : IRectangle + { + return this._displayBehavior.getAbsoluteBounds(this); + } + + public function set color(param1:uint) : void + { + this._color = param1; + } + + public function get color() : uint + { + return this._color; + } + + public function get cellId() : uint + { + return this._cellId; + } + + public function set cellId(param1:uint) : void + { + this._cellId = param1; + } + + public function display(param1:uint = 0) : void + { + if(this.text) + { + if(!this.format) { - if (!(this.format)) - { - this.format = new TextFormat(FontManager.getInstance().getRealFontName("Verdana"), 20, 0xFFFFFF, true); - this.format.align = TextFormatAlign.CENTER; - }; - this._tf = new TextField(); - this._tf.selectable = false; - this._tf.defaultTextFormat = this.format; - this._tf.setTextFormat(this.format); - this._tf.embedFonts = true; - this._tf.text = this.text; - this._tf.width = AtouinConstants.CELL_WIDTH; - this._tf.height = AtouinConstants.CELL_HEIGHT; - this._tf.x = -(AtouinConstants.CELL_HALF_WIDTH); - this._tf.y = (-(AtouinConstants.CELL_HALF_HEIGHT) + 7); - this._tf.alpha = 0.8; + this.format = new TextFormat(FontManager.getInstance().getRealFontName("Verdana"),20,16777215,true); + this.format.align = TextFormatAlign.CENTER; } - else - { - this._tf = null; - }; - this._cellInstance = new _cell(); - var ct:ColorTransform = new ColorTransform(); - ct.color = this._color; - this._cellInstance.transform.colorTransform = ct; - addChild(this._cellInstance); - if (this._tf) - { - addChild(this._tf); - }; - EntitiesDisplayManager.getInstance().displayEntity(this, MapPoint.fromCellId(this._cellId), this.strata); - this._displayed = true; - } - - public function remove():void - { - this._displayed = false; - if (this._tf) - { - removeChild(this._tf); - }; - removeChild(this._cellInstance); - EntitiesDisplayManager.getInstance().removeEntity(this); - } - - public function getIsTransparencyAllowed():Boolean - { - return (false); - } - - - } -}//package com.ankamagames.atouin.types - + this._tf = new TextField(); + this._tf.selectable = false; + this._tf.defaultTextFormat = this.format; + this._tf.setTextFormat(this.format); + this._tf.embedFonts = true; + this._tf.text = this.text; + this._tf.width = AtouinConstants.CELL_WIDTH; + this._tf.height = AtouinConstants.CELL_HEIGHT; + this._tf.x = -AtouinConstants.CELL_HALF_WIDTH; + this._tf.y = -AtouinConstants.CELL_HALF_HEIGHT + 7; + this._tf.alpha = 0.8; + } + else + { + this._tf = null; + } + this._cellInstance = new _cell(); + var _loc2_:ColorTransform = new ColorTransform(); + _loc2_.color = this._color; + this._cellInstance.transform.colorTransform = _loc2_; + addChild(this._cellInstance); + if(this._tf) + { + addChild(this._tf); + } + EntitiesDisplayManager.getInstance().displayEntity(this,MapPoint.fromCellId(this._cellId),this.strata); + this._displayed = true; + } + + public function remove() : void + { + this._displayed = false; + if(this._tf) + { + removeChild(this._tf); + } + removeChild(this._cellInstance); + EntitiesDisplayManager.getInstance().removeEntity(this); + } + + public function getIsTransparencyAllowed() : Boolean + { + return false; + } + } +} diff --git a/com/ankamagames/atouin/types/ZoneTile__cell.as b/com/ankamagames/atouin/types/ZoneTile__cell.as index a25afaeb6..76a37c6d5 100644 --- a/com/ankamagames/atouin/types/ZoneTile__cell.as +++ b/com/ankamagames/atouin/types/ZoneTile__cell.as @@ -1,12 +1,13 @@ -package com.ankamagames.atouin.types +package com.ankamagames.atouin.types { - import mx.core.SpriteAsset; - - [ExcludeClass] - public class ZoneTile__cell extends SpriteAsset - { - - - } -}//package com.ankamagames.atouin.types - + import mx.core.SpriteAsset; + + public class ZoneTile__cell extends SpriteAsset + { + + public function ZoneTile__cell() + { + super(); + } + } +} diff --git a/com/ankamagames/atouin/types/events/RenderMapEvent.as b/com/ankamagames/atouin/types/events/RenderMapEvent.as index bcefed4af..94de1d1c6 100644 --- a/com/ankamagames/atouin/types/events/RenderMapEvent.as +++ b/com/ankamagames/atouin/types/events/RenderMapEvent.as @@ -1,36 +1,37 @@ -package com.ankamagames.atouin.types.events +package com.ankamagames.atouin.types.events { - import flash.events.Event; - - public class RenderMapEvent extends Event - { - - public static const GFX_LOADING_START:String = "GFX_LOADING_START"; - public static const GFX_LOADING_END:String = "GFX_LOADING_END"; - public static const MAP_RENDER_START:String = "MAP_RENDER_START"; - public static const MAP_RENDER_END:String = "MAP_RENDER_END"; - - private var _mapId:uint; - private var _renderId:uint; - - public function RenderMapEvent(type:String, bubbles:Boolean=false, cancelable:Boolean=false, mapId:uint=0, renderId:uint=0) - { - super(type, bubbles, cancelable); - this._mapId = mapId; - this._renderId = renderId; - } - - public function get mapId():uint - { - return (this._mapId); - } - - public function get renderId():uint - { - return (this._renderId); - } - - - } -}//package com.ankamagames.atouin.types.events - + import flash.events.Event; + + public class RenderMapEvent extends Event + { + + public function RenderMapEvent(param1:String, param2:Boolean = false, param3:Boolean = false, param4:uint = 0, param5:uint = 0) + { + super(param1,param2,param3); + this._mapId = param4; + this._renderId = param5; + } + + public static const GFX_LOADING_START:String = "GFX_LOADING_START"; + + public static const GFX_LOADING_END:String = "GFX_LOADING_END"; + + public static const MAP_RENDER_START:String = "MAP_RENDER_START"; + + public static const MAP_RENDER_END:String = "MAP_RENDER_END"; + + private var _mapId:uint; + + private var _renderId:uint; + + public function get mapId() : uint + { + return this._mapId; + } + + public function get renderId() : uint + { + return this._renderId; + } + } +} diff --git a/com/ankamagames/atouin/types/miscs/PartialDataMap.as b/com/ankamagames/atouin/types/miscs/PartialDataMap.as index ac90b6447..78fbc4e9c 100644 --- a/com/ankamagames/atouin/types/miscs/PartialDataMap.as +++ b/com/ankamagames/atouin/types/miscs/PartialDataMap.as @@ -1,18 +1,17 @@ -package com.ankamagames.atouin.types.miscs +package com.ankamagames.atouin.types.miscs { - public class PartialDataMap - { - - public var cell:Array; - public var gfx:Array; - - public function PartialDataMap() - { - this.cell = new Array(); - this.gfx = new Array(); - super(); - } - - } -}//package com.ankamagames.atouin.types.miscs - + public class PartialDataMap extends Object + { + + public function PartialDataMap() + { + this.cell = new Array(); + this.gfx = new Array(); + super(); + } + + public var cell:Array; + + public var gfx:Array; + } +} diff --git a/com/ankamagames/atouin/types/sequences/AddWorldEntityStep.as b/com/ankamagames/atouin/types/sequences/AddWorldEntityStep.as index bf6c314d5..7c1d3517b 100644 --- a/com/ankamagames/atouin/types/sequences/AddWorldEntityStep.as +++ b/com/ankamagames/atouin/types/sequences/AddWorldEntityStep.as @@ -1,27 +1,25 @@ -package com.ankamagames.atouin.types.sequences +package com.ankamagames.atouin.types.sequences { - import com.ankamagames.jerakine.sequencer.AbstractSequencable; - import com.ankamagames.jerakine.entities.interfaces.IEntity; - import com.ankamagames.jerakine.entities.interfaces.IDisplayable; - import com.ankamagames.atouin.enums.PlacementStrataEnums; - - public class AddWorldEntityStep extends AbstractSequencable - { - - private var _entity:IEntity; - - public function AddWorldEntityStep(entity:IEntity) - { - this._entity = entity; - } - - override public function start():void - { - (this._entity as IDisplayable).display(PlacementStrataEnums.STRATA_PLAYER); - executeCallbacks(); - } - - - } -}//package com.ankamagames.atouin.types.sequences - + import com.ankamagames.jerakine.sequencer.AbstractSequencable; + import com.ankamagames.jerakine.entities.interfaces.IEntity; + import com.ankamagames.jerakine.entities.interfaces.IDisplayable; + import com.ankamagames.atouin.enums.PlacementStrataEnums; + + public class AddWorldEntityStep extends AbstractSequencable + { + + public function AddWorldEntityStep(param1:IEntity) + { + super(); + this._entity = param1; + } + + private var _entity:IEntity; + + override public function start() : void + { + (this._entity as IDisplayable).display(PlacementStrataEnums.STRATA_PLAYER); + executeCallbacks(); + } + } +} diff --git a/com/ankamagames/atouin/types/sequences/DestroyEntityStep.as b/com/ankamagames/atouin/types/sequences/DestroyEntityStep.as index 858edf715..328f7fadd 100644 --- a/com/ankamagames/atouin/types/sequences/DestroyEntityStep.as +++ b/com/ankamagames/atouin/types/sequences/DestroyEntityStep.as @@ -1,34 +1,32 @@ -package com.ankamagames.atouin.types.sequences +package com.ankamagames.atouin.types.sequences { - import com.ankamagames.jerakine.sequencer.AbstractSequencable; - import com.ankamagames.jerakine.entities.interfaces.IEntity; - import com.ankamagames.jerakine.entities.interfaces.IDisplayable; - import com.ankamagames.tiphon.display.TiphonSprite; - - public class DestroyEntityStep extends AbstractSequencable - { - - private var _entity:IEntity; - - public function DestroyEntityStep(entity:IEntity) - { - this._entity = entity; - } - - override public function start():void - { - if ((this._entity is IDisplayable)) - { - (this._entity as IDisplayable).remove(); - }; - if ((this._entity is TiphonSprite)) - { - (this._entity as TiphonSprite).destroy(); - }; - executeCallbacks(); - } - - - } -}//package com.ankamagames.atouin.types.sequences - + import com.ankamagames.jerakine.sequencer.AbstractSequencable; + import com.ankamagames.jerakine.entities.interfaces.IEntity; + import com.ankamagames.jerakine.entities.interfaces.IDisplayable; + import com.ankamagames.tiphon.display.TiphonSprite; + + public class DestroyEntityStep extends AbstractSequencable + { + + public function DestroyEntityStep(param1:IEntity) + { + super(); + this._entity = param1; + } + + private var _entity:IEntity; + + override public function start() : void + { + if(this._entity is IDisplayable) + { + (this._entity as IDisplayable).remove(); + } + if(this._entity is TiphonSprite) + { + (this._entity as TiphonSprite).destroy(); + } + executeCallbacks(); + } + } +} diff --git a/com/ankamagames/atouin/types/sequences/ParableGfxMovementStep.as b/com/ankamagames/atouin/types/sequences/ParableGfxMovementStep.as index 031ec59cc..7a023a579 100644 --- a/com/ankamagames/atouin/types/sequences/ParableGfxMovementStep.as +++ b/com/ankamagames/atouin/types/sequences/ParableGfxMovementStep.as @@ -1,83 +1,87 @@ -package com.ankamagames.atouin.types.sequences +package com.ankamagames.atouin.types.sequences { - import com.ankamagames.jerakine.sequencer.AbstractSequencable; - import com.ankamagames.jerakine.entities.interfaces.IMovable; - import com.ankamagames.jerakine.types.positions.MapPoint; - import flash.geom.Point; - import com.ankamagames.atouin.utils.CellUtil; - import com.ankamagames.jerakine.entities.interfaces.IEntity; - import flash.display.DisplayObject; - import gs.TweenMax; - import gs.easing.Linear; - import gs.events.TweenEvent; - - public class ParableGfxMovementStep extends AbstractSequencable - { - - private var _gfxEntity:IMovable; - private var _targetPoint:MapPoint; - private var _curvePrc:Number; - private var _yOffset:int; - private var _yOffsetOnHit:int; - private var _waitEnd:Boolean; - private var _speed:uint; - - public function ParableGfxMovementStep(gfxEntity:IMovable, targetPoint:MapPoint, speed:uint, curvePrc:Number=0.5, yOffset:int=0, waitEnd:Boolean=true, yOffsetOnHit:int=0) - { - this._gfxEntity = gfxEntity; - this._targetPoint = targetPoint; - this._curvePrc = curvePrc; - this._waitEnd = waitEnd; - this._speed = speed; - this._yOffset = yOffset; - this._yOffsetOnHit = yOffsetOnHit; - } - - override public function start():void - { - var distance:Number; - if (this._targetPoint.equals(this._gfxEntity.position)) - { - this.onTweenEnd(null); - return; - }; - var start:Point = new Point(CellUtil.getPixelXFromMapPoint((this._gfxEntity as IEntity).position), (CellUtil.getPixelYFromMapPoint((this._gfxEntity as IEntity).position) + this._yOffset)); - var end:Point = new Point(CellUtil.getPixelXFromMapPoint(this._targetPoint), (CellUtil.getPixelYFromMapPoint(this._targetPoint) + ((!((this._yOffsetOnHit == 0))) ? this._yOffsetOnHit : this._yOffset))); - distance = Point.distance(start, end); - var curvePoint:Point = Point.interpolate(start, end, 0.5); - curvePoint.y = (curvePoint.y - (distance * this._curvePrc)); - DisplayObject(this._gfxEntity).y = (DisplayObject(this._gfxEntity).y + this._yOffset); - var tweener:TweenMax = new TweenMax(this._gfxEntity, (((distance / 100) * this._speed) / 1000), { - "x":end.x, - "y":end.y, - "orientToBezier":true, - "bezier":[{ - "x":curvePoint.x, - "y":curvePoint.y - }], - "scaleX":1, - "scaleY":1, - "rotation":15, - "alpha":1, - "ease":Linear.easeNone, - "renderOnStart":true - }); - tweener.addEventListener(TweenEvent.COMPLETE, this.onTweenEnd); - if (!(this._waitEnd)) - { - executeCallbacks(); - }; - } - - private function onTweenEnd(e:TweenEvent):void - { - if (this._waitEnd) - { - executeCallbacks(); - }; - } - - - } -}//package com.ankamagames.atouin.types.sequences - + import com.ankamagames.jerakine.sequencer.AbstractSequencable; + import com.ankamagames.jerakine.entities.interfaces.IMovable; + import com.ankamagames.jerakine.types.positions.MapPoint; + import flash.geom.Point; + import com.ankamagames.atouin.utils.CellUtil; + import com.ankamagames.jerakine.entities.interfaces.IEntity; + import flash.display.DisplayObject; + import gs.TweenMax; + import gs.easing.Linear; + import gs.events.TweenEvent; + + public class ParableGfxMovementStep extends AbstractSequencable + { + + public function ParableGfxMovementStep(param1:IMovable, param2:MapPoint, param3:uint, param4:Number = 0.5, param5:int = 0, param6:Boolean = true, param7:int = 0) + { + super(); + this._gfxEntity = param1; + this._targetPoint = param2; + this._curvePrc = param4; + this._waitEnd = param6; + this._speed = param3; + this._yOffset = param5; + this._yOffsetOnHit = param7; + } + + private var _gfxEntity:IMovable; + + private var _targetPoint:MapPoint; + + private var _curvePrc:Number; + + private var _yOffset:int; + + private var _yOffsetOnHit:int; + + private var _waitEnd:Boolean; + + private var _speed:uint; + + override public function start() : void + { + var _loc3_:* = NaN; + if(this._targetPoint.equals(this._gfxEntity.position)) + { + this.onTweenEnd(null); + return; + } + var _loc1_:Point = new Point(CellUtil.getPixelXFromMapPoint((this._gfxEntity as IEntity).position),CellUtil.getPixelYFromMapPoint((this._gfxEntity as IEntity).position) + this._yOffset); + var _loc2_:Point = new Point(CellUtil.getPixelXFromMapPoint(this._targetPoint),CellUtil.getPixelYFromMapPoint(this._targetPoint) + (this._yOffsetOnHit != 0?this._yOffsetOnHit:this._yOffset)); + _loc3_ = Point.distance(_loc1_,_loc2_); + var _loc4_:* = Point.interpolate(_loc1_,_loc2_,0.5); + _loc4_.y = _loc4_.y - _loc3_ * this._curvePrc; + DisplayObject(this._gfxEntity).y = DisplayObject(this._gfxEntity).y + this._yOffset; + var _loc5_:TweenMax = new TweenMax(this._gfxEntity,_loc3_ / 100 * this._speed / 1000,{ + "x":_loc2_.x, + "y":_loc2_.y, + "orientToBezier":true, + "bezier":[{ + "x":_loc4_.x, + "y":_loc4_.y + }], + "scaleX":1, + "scaleY":1, + "rotation":15, + "alpha":1, + "ease":Linear.easeNone, + "renderOnStart":true + }); + _loc5_.addEventListener(TweenEvent.COMPLETE,this.onTweenEnd); + if(!this._waitEnd) + { + executeCallbacks(); + } + } + + private function onTweenEnd(param1:TweenEvent) : void + { + if(this._waitEnd) + { + executeCallbacks(); + } + } + } +} diff --git a/com/ankamagames/atouin/utils/CellIdConverter.as b/com/ankamagames/atouin/utils/CellIdConverter.as index f4ae83ac7..2ff4fe9aa 100644 --- a/com/ankamagames/atouin/utils/CellIdConverter.as +++ b/com/ankamagames/atouin/utils/CellIdConverter.as @@ -1,68 +1,70 @@ -package com.ankamagames.atouin.utils +package com.ankamagames.atouin.utils { - import com.ankamagames.atouin.AtouinConstants; - import flash.geom.Point; - - public class CellIdConverter - { - - public static var CELLPOS:Array = new Array(); - private static var _bInit:Boolean = false; - - - private static function init():void - { - var b:int; - _bInit = true; - var startX:int; - var startY:int; - var cell:int; - var a:int; - while (a < AtouinConstants.MAP_HEIGHT) + import flash.geom.Point; + import com.ankamagames.atouin.AtouinConstants; + + public class CellIdConverter extends Object + { + + public function CellIdConverter() + { + super(); + } + + public static var CELLPOS:Array = new Array(); + + private static var _bInit:Boolean = false; + + private static function init() : void + { + var _loc4_:* = 0; + _bInit = true; + var _loc1_:* = 0; + var _loc2_:* = 0; + var _loc3_:* = 0; + var _loc5_:* = 0; + while(_loc5_ < AtouinConstants.MAP_HEIGHT) + { + _loc4_ = 0; + while(_loc4_ < AtouinConstants.MAP_WIDTH) { - b = 0; - while (b < AtouinConstants.MAP_WIDTH) - { - CELLPOS[cell] = new Point((startX + b), (startY + b)); - cell++; - b++; - }; - startX++; - b = 0; - while (b < AtouinConstants.MAP_WIDTH) - { - CELLPOS[cell] = new Point((startX + b), (startY + b)); - cell++; - b++; - }; - startY--; - a++; - }; - } - - public static function coordToCellId(x:int, y:int):uint - { - if (!(_bInit)) + CELLPOS[_loc3_] = new Point(_loc1_ + _loc4_,_loc2_ + _loc4_); + _loc3_++; + _loc4_++; + } + _loc1_++; + _loc4_ = 0; + while(_loc4_ < AtouinConstants.MAP_WIDTH) { - init(); - }; - return (((((x - y) * AtouinConstants.MAP_WIDTH) + y) + ((x - y) / 2))); - } - - public static function cellIdToCoord(cellId:uint):Point - { - if (!(_bInit)) - { - init(); - }; - if (!(CELLPOS[cellId])) - { - return (null); - }; - return (CELLPOS[cellId]); - } - - - } -}//package com.ankamagames.atouin.utils - + CELLPOS[_loc3_] = new Point(_loc1_ + _loc4_,_loc2_ + _loc4_); + _loc3_++; + _loc4_++; + } + _loc2_--; + _loc5_++; + } + } + + public static function coordToCellId(param1:int, param2:int) : uint + { + if(!_bInit) + { + init(); + } + return (param1 - param2) * AtouinConstants.MAP_WIDTH + param2 + (param1 - param2) / 2; + } + + public static function cellIdToCoord(param1:uint) : Point + { + if(!_bInit) + { + init(); + } + if(!CELLPOS[param1]) + { + return null; + } + return CELLPOS[param1]; + } + } +} diff --git a/com/ankamagames/atouin/utils/CellUtil.as b/com/ankamagames/atouin/utils/CellUtil.as index 9f74fb6f5..969f1a99a 100644 --- a/com/ankamagames/atouin/utils/CellUtil.as +++ b/com/ankamagames/atouin/utils/CellUtil.as @@ -1,59 +1,60 @@ -package com.ankamagames.atouin.utils +package com.ankamagames.atouin.utils { - import com.ankamagames.atouin.managers.InteractiveCellManager; - import flash.display.Sprite; - import com.ankamagames.jerakine.types.positions.MapPoint; - import flash.geom.Point; - - public class CellUtil - { - - - public static function getPixelXFromMapPoint(p:MapPoint):int - { - var cellSprite:Sprite = InteractiveCellManager.getInstance().getCell(p.cellId); - return ((cellSprite.x + (cellSprite.width / 2))); - } - - public static function getPixelYFromMapPoint(p:MapPoint):int - { - var cellSprite:Sprite = InteractiveCellManager.getInstance().getCell(p.cellId); - return ((cellSprite.y + (cellSprite.height / 2))); - } - - public static function getPixelsPointFromMapPoint(p:MapPoint, pivotInCenter:Boolean=true):Point - { - var cellSprite:Sprite = InteractiveCellManager.getInstance().getCell(p.cellId); - var point:Point = new Point(((pivotInCenter) ? (cellSprite.x + (cellSprite.width / 2)) : (cellSprite.x)), ((pivotInCenter) ? (cellSprite.y + (cellSprite.height / 2)) : cellSprite.y)); - return (point); - } - - public static function isLeftCol(cellId:int):Boolean - { - return (((cellId % 14) == 0)); - } - - public static function isRightCol(cellId:int):Boolean - { - return (isLeftCol((cellId + 1))); - } - - public static function isTopRow(cellId:int):Boolean - { - return ((cellId < 28)); - } - - public static function isBottomRow(cellId:int):Boolean - { - return ((cellId > 531)); - } - - public static function isEvenRow(cellId:int):Boolean - { - return (((Math.floor((cellId / 14)) % 2) == 0)); - } - - - } -}//package com.ankamagames.atouin.utils - + import com.ankamagames.jerakine.types.positions.MapPoint; + import com.ankamagames.atouin.managers.InteractiveCellManager; + import flash.display.Sprite; + import flash.geom.Point; + + public class CellUtil extends Object + { + + public function CellUtil() + { + super(); + } + + public static function getPixelXFromMapPoint(param1:MapPoint) : int + { + var _loc2_:Sprite = InteractiveCellManager.getInstance().getCell(param1.cellId); + return _loc2_.x + _loc2_.width / 2; + } + + public static function getPixelYFromMapPoint(param1:MapPoint) : int + { + var _loc2_:Sprite = InteractiveCellManager.getInstance().getCell(param1.cellId); + return _loc2_.y + _loc2_.height / 2; + } + + public static function getPixelsPointFromMapPoint(param1:MapPoint, param2:Boolean = true) : Point + { + var _loc3_:Sprite = InteractiveCellManager.getInstance().getCell(param1.cellId); + var _loc4_:Point = new Point(param2?_loc3_.x + _loc3_.width / 2:_loc3_.x,param2?_loc3_.y + _loc3_.height / 2:_loc3_.y); + return _loc4_; + } + + public static function isLeftCol(param1:int) : Boolean + { + return param1 % 14 == 0; + } + + public static function isRightCol(param1:int) : Boolean + { + return isLeftCol(param1 + 1); + } + + public static function isTopRow(param1:int) : Boolean + { + return param1 < 28; + } + + public static function isBottomRow(param1:int) : Boolean + { + return param1 > 531; + } + + public static function isEvenRow(param1:int) : Boolean + { + return Math.floor(param1 / 14) % 2 == 0; + } + } +} diff --git a/com/ankamagames/atouin/utils/DataMapProvider.as b/com/ankamagames/atouin/utils/DataMapProvider.as index 9cbc31fdf..ae2948999 100644 --- a/com/ankamagames/atouin/utils/DataMapProvider.as +++ b/com/ankamagames/atouin/utils/DataMapProvider.as @@ -1,281 +1,282 @@ -package com.ankamagames.atouin.utils +package com.ankamagames.atouin.utils { - import com.ankamagames.jerakine.map.IDataMapProvider; - import com.ankamagames.jerakine.logger.Logger; - import com.ankamagames.jerakine.logger.Log; - import flash.utils.getQualifiedClassName; - import flash.utils.Dictionary; - import com.ankamagames.jerakine.utils.errors.SingletonError; - import com.ankamagames.jerakine.interfaces.IObstacle; - import com.ankamagames.jerakine.types.positions.MapPoint; - import com.ankamagames.atouin.data.map.CellData; - import com.ankamagames.atouin.managers.MapDisplayManager; - import com.ankamagames.atouin.managers.EntitiesManager; - import com.ankamagames.jerakine.entities.interfaces.IEntity; - import com.ankamagames.atouin.data.map.Cell; - import com.ankamagames.atouin.AtouinConstants; - - public class DataMapProvider implements IDataMapProvider - { - - private static const TOLERANCE_ELEVATION:int = 11; - protected static const _log:Logger = Log.getLogger(getQualifiedClassName(DataMapProvider)); - private static var _self:DataMapProvider; - private static var _playerClass:Class; - - public var isInFight:Boolean; - private var _updatedCell:Dictionary; - private var _specialEffects:Dictionary; - - public function DataMapProvider() - { - this._updatedCell = new Dictionary(); - this._specialEffects = new Dictionary(); - super(); - } - - public static function getInstance():DataMapProvider - { - if (!(_self)) + import com.ankamagames.jerakine.map.IDataMapProvider; + import com.ankamagames.jerakine.logger.Logger; + import com.ankamagames.jerakine.utils.errors.SingletonError; + import com.ankamagames.jerakine.logger.Log; + import flash.utils.getQualifiedClassName; + import flash.utils.Dictionary; + import com.ankamagames.jerakine.interfaces.IObstacle; + import com.ankamagames.jerakine.types.positions.MapPoint; + import com.ankamagames.atouin.data.map.CellData; + import com.ankamagames.atouin.managers.MapDisplayManager; + import com.ankamagames.atouin.managers.EntitiesManager; + import com.ankamagames.jerakine.entities.interfaces.IEntity; + import com.ankamagames.atouin.data.map.Cell; + import com.ankamagames.atouin.AtouinConstants; + + public class DataMapProvider extends Object implements IDataMapProvider + { + + public function DataMapProvider() + { + this._updatedCell = new Dictionary(); + this._specialEffects = new Dictionary(); + super(); + } + + private static const TOLERANCE_ELEVATION:int = 11; + + protected static const _log:Logger = Log.getLogger(getQualifiedClassName(DataMapProvider)); + + private static var _self:DataMapProvider; + + private static var _playerClass:Class; + + public static function getInstance() : DataMapProvider + { + if(!_self) + { + throw new SingletonError("Init function wasn\'t call"); + } + else + { + return _self; + } + } + + public static function init(param1:Class) : void + { + _playerClass = param1; + if(!_self) + { + _self = new DataMapProvider(); + } + } + + public var isInFight:Boolean; + + private var _updatedCell:Dictionary; + + private var _specialEffects:Dictionary; + + public function pointLos(param1:int, param2:int, param3:Boolean = true) : Boolean + { + var _loc6_:Array = null; + var _loc7_:IObstacle = null; + var _loc4_:uint = MapPoint.fromCoords(param1,param2).cellId; + var _loc5_:Boolean = CellData(MapDisplayManager.getInstance().getDataMapContainer().dataMap.cells[_loc4_]).los; + if(this._updatedCell[_loc4_] != null) + { + _loc5_ = this._updatedCell[_loc4_]; + } + if(!param3) + { + _loc6_ = EntitiesManager.getInstance().getEntitiesOnCell(_loc4_,IObstacle); + if(_loc6_.length) { - throw (new SingletonError("Init function wasn't call")); - }; - return (_self); - } - - public static function init(playerClass:Class):void - { - _playerClass = playerClass; - if (!(_self)) + for each(_loc7_ in _loc6_) + { + if(!IObstacle(_loc7_).canSeeThrough()) + { + return false; + } + } + } + } + return _loc5_; + } + + public function farmCell(param1:int, param2:int) : Boolean + { + var _loc3_:uint = MapPoint.fromCoords(param1,param2).cellId; + return CellData(MapDisplayManager.getInstance().getDataMapContainer().dataMap.cells[_loc3_]).farmCell; + } + + public function isChangeZone(param1:uint, param2:uint) : Boolean + { + var _loc3_:CellData = CellData(MapDisplayManager.getInstance().getDataMapContainer().dataMap.cells[param1]); + var _loc4_:CellData = CellData(MapDisplayManager.getInstance().getDataMapContainer().dataMap.cells[param2]); + var _loc5_:int = Math.abs(Math.abs(_loc3_.floor) - Math.abs(_loc4_.floor)); + if(!(_loc3_.moveZone == _loc4_.moveZone) && _loc5_ == 0) + { + return true; + } + return false; + } + + public function pointMov(param1:int, param2:int, param3:Boolean = true, param4:int = -1, param5:int = -1) : Boolean + { + var _loc6_:* = false; + var _loc7_:uint = 0; + var _loc8_:CellData = null; + var _loc9_:* = false; + var _loc10_:CellData = null; + var _loc11_:* = 0; + var _loc12_:Array = null; + var _loc13_:IObstacle = null; + if(MapPoint.isInMap(param1,param2)) + { + _loc6_ = MapDisplayManager.getInstance().getDataMapContainer().dataMap.isUsingNewMovementSystem; + _loc7_ = MapPoint.fromCoords(param1,param2).cellId; + _loc8_ = CellData(MapDisplayManager.getInstance().getDataMapContainer().dataMap.cells[_loc7_]); + _loc9_ = (_loc8_.mov) && (!this.isInFight || !_loc8_.nonWalkableDuringFight); + if(this._updatedCell[_loc7_] != null) { - _self = new (DataMapProvider)(); - }; - } - - - public function pointLos(x:int, y:int, bAllowTroughEntity:Boolean=true):Boolean - { - var cellEntities:Array; - var o:IObstacle; - var cellId:uint = MapPoint.fromCoords(x, y).cellId; - var los:Boolean = CellData(MapDisplayManager.getInstance().getDataMapContainer().dataMap.cells[cellId]).los; - if (this._updatedCell[cellId] != null) + _loc9_ = this._updatedCell[_loc7_]; + } + if((_loc9_) && (_loc6_) && !(param4 == -1) && !(param4 == _loc7_)) { - los = this._updatedCell[cellId]; - }; - if (!(bAllowTroughEntity)) + _loc10_ = CellData(MapDisplayManager.getInstance().getDataMapContainer().dataMap.cells[param4]); + _loc11_ = Math.abs(Math.abs(_loc8_.floor) - Math.abs(_loc10_.floor)); + if(!(_loc10_.moveZone == _loc8_.moveZone) && _loc11_ > 0 || _loc10_.moveZone == _loc8_.moveZone && _loc8_.moveZone == 0 && _loc11_ > TOLERANCE_ELEVATION) + { + _loc9_ = false; + } + } + if(!param3) { - cellEntities = EntitiesManager.getInstance().getEntitiesOnCell(cellId, IObstacle); - if (cellEntities.length) - { - for each (o in cellEntities) - { - if (!(IObstacle(o).canSeeThrough())) + _loc12_ = EntitiesManager.getInstance().getEntitiesOnCell(_loc7_,IObstacle); + if(_loc12_.length) + { + for each(_loc13_ in _loc12_) + { + if(!(param5 == _loc7_ && (_loc13_.canWalkTo()))) + { + if(!_loc13_.canWalkThrough()) { - return (false); - }; - }; - }; - }; - return (los); - } - - public function farmCell(x:int, y:int):Boolean - { - var cellId:uint = MapPoint.fromCoords(x, y).cellId; - return (CellData(MapDisplayManager.getInstance().getDataMapContainer().dataMap.cells[cellId]).farmCell); - } - - public function isChangeZone(cell1:uint, cell2:uint):Boolean - { - var cellData1:CellData = CellData(MapDisplayManager.getInstance().getDataMapContainer().dataMap.cells[cell1]); - var cellData2:CellData = CellData(MapDisplayManager.getInstance().getDataMapContainer().dataMap.cells[cell2]); - var dif:int = Math.abs((Math.abs(cellData1.floor) - Math.abs(cellData2.floor))); - if (((!((cellData1.moveZone == cellData2.moveZone))) && ((dif == 0)))) - { - return (true); - }; - return (false); - } - - public function pointMov(x:int, y:int, bAllowTroughEntity:Boolean=true, previousCellId:int=-1, endCellId:int=-1):Boolean - { - var useNewSystem:Boolean; - var cellId:uint; - var cellData:CellData; - var mov:Boolean; - var previousCellData:CellData; - var dif:int; - var cellEntities:Array; - var o:IObstacle; - if (MapPoint.isInMap(x, y)) + return false; + } + } + } + } + } + } + else + { + _loc9_ = false; + } + return _loc9_; + } + + public function pointCanStop(param1:int, param2:int, param3:Boolean = true) : Boolean + { + var _loc4_:uint = MapPoint.fromCoords(param1,param2).cellId; + var _loc5_:CellData = CellData(MapDisplayManager.getInstance().getDataMapContainer().dataMap.cells[_loc4_]); + return (this.pointMov(param1,param2,param3)) && ((this.isInFight) || !_loc5_.nonWalkableDuringRP); + } + + public function pointWeight(param1:int, param2:int, param3:Boolean = true) : Number + { + var _loc6_:IEntity = null; + var _loc4_:Number = 1; + var _loc5_:int = this.getCellSpeed(MapPoint.fromCoords(param1,param2).cellId); + if(param3) + { + if(_loc5_ >= 0) { - useNewSystem = MapDisplayManager.getInstance().getDataMapContainer().dataMap.isUsingNewMovementSystem; - cellId = MapPoint.fromCoords(x, y).cellId; - cellData = CellData(MapDisplayManager.getInstance().getDataMapContainer().dataMap.cells[cellId]); - mov = ((cellData.mov) && (((!(this.isInFight)) || (!(cellData.nonWalkableDuringFight))))); - if (this._updatedCell[cellId] != null) - { - mov = this._updatedCell[cellId]; - }; - if (((((((mov) && (useNewSystem))) && (!((previousCellId == -1))))) && (!((previousCellId == cellId))))) - { - previousCellData = CellData(MapDisplayManager.getInstance().getDataMapContainer().dataMap.cells[previousCellId]); - dif = Math.abs((Math.abs(cellData.floor) - Math.abs(previousCellData.floor))); - if (((((!((previousCellData.moveZone == cellData.moveZone))) && ((dif > 0)))) || ((((((previousCellData.moveZone == cellData.moveZone)) && ((cellData.moveZone == 0)))) && ((dif > TOLERANCE_ELEVATION)))))) - { - mov = false; - }; - }; - if (!(bAllowTroughEntity)) - { - cellEntities = EntitiesManager.getInstance().getEntitiesOnCell(cellId, IObstacle); - if (cellEntities.length) - { - for each (o in cellEntities) - { - if ((((endCellId == cellId)) && (o.canWalkTo()))) - { - } - else - { - if (!(o.canWalkThrough())) - { - return (false); - }; - }; - }; - }; - }; + _loc4_ = _loc4_ + (5 - _loc5_); } else { - mov = false; - }; - return (mov); - } - - public function pointCanStop(x:int, y:int, bAllowTroughEntity:Boolean=true):Boolean - { - var cellId:uint = MapPoint.fromCoords(x, y).cellId; - var cellData:CellData = CellData(MapDisplayManager.getInstance().getDataMapContainer().dataMap.cells[cellId]); - return (((this.pointMov(x, y, bAllowTroughEntity)) && (((this.isInFight) || (!(cellData.nonWalkableDuringRP)))))); - } - - public function pointWeight(x:int, y:int, bAllowTroughEntity:Boolean=true):Number - { - var entity:IEntity; - var weight:Number = 1; - var speed:int = this.getCellSpeed(MapPoint.fromCoords(x, y).cellId); - if (bAllowTroughEntity) + _loc4_ = _loc4_ + (11 + Math.abs(_loc5_)); + } + _loc6_ = EntitiesManager.getInstance().getEntityOnCell(Cell.cellIdByXY(param1,param2),_playerClass); + if((_loc6_) && !_loc6_["allowMovementThrough"]) { - if (speed >= 0) - { - weight = (weight + (5 - speed)); - } - else - { - weight = (weight + (11 + Math.abs(speed))); - }; - entity = EntitiesManager.getInstance().getEntityOnCell(Cell.cellIdByXY(x, y), _playerClass); - if (((entity) && (!(entity["allowMovementThrough"])))) - { - weight = 20; - }; + _loc4_ = 20; } - else + } + else + { + if(EntitiesManager.getInstance().getEntityOnCell(Cell.cellIdByXY(param1,param2),_playerClass) != null) { - if (EntitiesManager.getInstance().getEntityOnCell(Cell.cellIdByXY(x, y), _playerClass) != null) - { - weight = (weight + 0.3); - }; - if (EntitiesManager.getInstance().getEntityOnCell(Cell.cellIdByXY((x + 1), y), _playerClass) != null) - { - weight = (weight + 0.3); - }; - if (EntitiesManager.getInstance().getEntityOnCell(Cell.cellIdByXY(x, (y + 1)), _playerClass) != null) - { - weight = (weight + 0.3); - }; - if (EntitiesManager.getInstance().getEntityOnCell(Cell.cellIdByXY((x - 1), y), _playerClass) != null) - { - weight = (weight + 0.3); - }; - if (EntitiesManager.getInstance().getEntityOnCell(Cell.cellIdByXY(x, (y - 1)), _playerClass) != null) - { - weight = (weight + 0.3); - }; - if ((this.pointSpecialEffects(x, y) & 2) == 2) - { - weight = (weight + 0.2); - }; - }; - return (weight); - } - - public function getCellSpeed(cellId:uint):int - { - return ((MapDisplayManager.getInstance().getDataMapContainer().dataMap.cells[cellId] as CellData).speed); - } - - public function pointSpecialEffects(x:int, y:int):uint - { - var cellId:uint = MapPoint.fromCoords(x, y).cellId; - if (this._specialEffects[cellId]) + _loc4_ = _loc4_ + 0.3; + } + if(EntitiesManager.getInstance().getEntityOnCell(Cell.cellIdByXY(param1 + 1,param2),_playerClass) != null) { - return (this._specialEffects[cellId]); - }; - return (0); - } - - public function get width():int - { - return (((AtouinConstants.MAP_HEIGHT + AtouinConstants.MAP_WIDTH) - 2)); - } - - public function get height():int - { - return (((AtouinConstants.MAP_HEIGHT + AtouinConstants.MAP_WIDTH) - 1)); - } - - public function hasEntity(x:int, y:int):Boolean - { - var o:IObstacle; - var cellEntities:Array = EntitiesManager.getInstance().getEntitiesOnCell(MapPoint.fromCoords(x, y).cellId, IObstacle); - if (cellEntities.length) + _loc4_ = _loc4_ + 0.3; + } + if(EntitiesManager.getInstance().getEntityOnCell(Cell.cellIdByXY(param1,param2 + 1),_playerClass) != null) { - for each (o in cellEntities) - { - if (!(IObstacle(o).canWalkTo())) - { - return (true); - }; - }; - }; - return (false); - } - - public function updateCellMovLov(cellId:uint, canMove:Boolean):void - { - this._updatedCell[cellId] = canMove; - } - - public function resetUpdatedCell():void - { - this._updatedCell = new Dictionary(); - } - - public function setSpecialEffects(cellId:uint, value:uint):void - { - this._specialEffects[cellId] = value; - } - - public function resetSpecialEffects():void - { - this._specialEffects = new Dictionary(); - } - - - } -}//package com.ankamagames.atouin.utils - + _loc4_ = _loc4_ + 0.3; + } + if(EntitiesManager.getInstance().getEntityOnCell(Cell.cellIdByXY(param1 - 1,param2),_playerClass) != null) + { + _loc4_ = _loc4_ + 0.3; + } + if(EntitiesManager.getInstance().getEntityOnCell(Cell.cellIdByXY(param1,param2 - 1),_playerClass) != null) + { + _loc4_ = _loc4_ + 0.3; + } + if((this.pointSpecialEffects(param1,param2) & 2) == 2) + { + _loc4_ = _loc4_ + 0.2; + } + } + return _loc4_; + } + + public function getCellSpeed(param1:uint) : int + { + return (MapDisplayManager.getInstance().getDataMapContainer().dataMap.cells[param1] as CellData).speed; + } + + public function pointSpecialEffects(param1:int, param2:int) : uint + { + var _loc3_:uint = MapPoint.fromCoords(param1,param2).cellId; + if(this._specialEffects[_loc3_]) + { + return this._specialEffects[_loc3_]; + } + return 0; + } + + public function get width() : int + { + return AtouinConstants.MAP_HEIGHT + AtouinConstants.MAP_WIDTH - 2; + } + + public function get height() : int + { + return AtouinConstants.MAP_HEIGHT + AtouinConstants.MAP_WIDTH - 1; + } + + public function hasEntity(param1:int, param2:int) : Boolean + { + var _loc4_:IObstacle = null; + var _loc3_:Array = EntitiesManager.getInstance().getEntitiesOnCell(MapPoint.fromCoords(param1,param2).cellId,IObstacle); + if(_loc3_.length) + { + for each(_loc4_ in _loc3_) + { + if(!IObstacle(_loc4_).canWalkTo()) + { + return true; + } + } + } + return false; + } + + public function updateCellMovLov(param1:uint, param2:Boolean) : void + { + this._updatedCell[param1] = param2; + } + + public function resetUpdatedCell() : void + { + this._updatedCell = new Dictionary(); + } + + public function setSpecialEffects(param1:uint, param2:uint) : void + { + this._specialEffects[param1] = param2; + } + + public function resetSpecialEffects() : void + { + this._specialEffects = new Dictionary(); + } + } +} diff --git a/com/ankamagames/atouin/utils/GroundMapLoader.as b/com/ankamagames/atouin/utils/GroundMapLoader.as index 228502f28..bfd545647 100644 --- a/com/ankamagames/atouin/utils/GroundMapLoader.as +++ b/com/ankamagames/atouin/utils/GroundMapLoader.as @@ -1,136 +1,157 @@ -package com.ankamagames.atouin.utils +package com.ankamagames.atouin.utils { - import com.ankamagames.jerakine.logger.Logger; - import com.ankamagames.jerakine.logger.Log; - import flash.utils.getQualifiedClassName; - import flash.display.Loader; - import com.ankamagames.atouin.data.map.Map; - import flash.filesystem.FileStream; - import flash.utils.ByteArray; - import flash.events.Event; - import flash.events.IOErrorEvent; - import flash.events.ProgressEvent; - import flash.filesystem.FileMode; - import flash.filesystem.File; - import flash.display.Bitmap; - import com.ankamagames.atouin.enums.GroundCache; - import com.ankamagames.atouin.AtouinConstants; - import com.ankamagames.jerakine.utils.display.EnterFrameDispatcher; - - public class GroundMapLoader - { - - private static const _log:Logger = Log.getLogger(getQualifiedClassName(GroundMapLoader)); - - private var _callBack:Function; - private var _errorCallBack:Function; - private var _loader:Loader; - private var _map:Map; - private var _groundIsLoaded:Boolean = false; - private var _time:int = 0; - - public function GroundMapLoader(map:Map, file:File, callBack:Function, errorCallBack:Function) - { - var fileStream:FileStream; - var rawJPG:ByteArray; - super(); - try + import com.ankamagames.jerakine.logger.Logger; + import com.ankamagames.atouin.data.map.Map; + import flash.filesystem.File; + import com.ankamagames.jerakine.logger.Log; + import flash.utils.getQualifiedClassName; + import com.ankamagames.jerakine.pools.PoolableLoader; + import flash.events.Event; + import flash.display.Bitmap; + import com.ankamagames.atouin.enums.GroundCache; + import com.ankamagames.atouin.AtouinConstants; + import flash.events.ProgressEvent; + import com.ankamagames.jerakine.utils.display.EnterFrameDispatcher; + import flash.events.IOErrorEvent; + import com.ankamagames.jerakine.pools.PoolsManager; + import flash.filesystem.FileStream; + import flash.utils.ByteArray; + import flash.filesystem.FileMode; + + public class GroundMapLoader extends Object + { + + public function GroundMapLoader(param1:Map, param2:File, param3:Function, param4:Function) + { + var fileStream:FileStream = null; + var rawJPG:ByteArray = null; + var map:Map = param1; + var file:File = param2; + var callBack:Function = param3; + var errorCallBack:Function = param4; + super(); + try + { + this._map = map; + this._callBack = callBack; + this._errorCallBack = errorCallBack; + this._loader = PoolsManager.getInstance().getLoadersPool().checkOut() as PoolableLoader; + this._loader.contentLoaderInfo.addEventListener(Event.COMPLETE,this.onJPGReady); + this._loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR,this.onError); + this._loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS,this.onProgress); + fileStream = new FileStream(); + fileStream.open(file,FileMode.READ); + rawJPG = new ByteArray(); + fileStream.readInt(); + fileStream.readByte(); + fileStream.readInt(); + fileStream.readBytes(rawJPG); + fileStream.close(); + this._loader.loadBytes(rawJPG); + } + catch(error:Error) + { + if(error) { - this._map = map; - this._callBack = callBack; - this._errorCallBack = errorCallBack; - this._loader = new Loader(); - this._loader.contentLoaderInfo.addEventListener(Event.COMPLETE, this.onJPGReady); - this._loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, this.onError); - this._loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, this.onProgress); - fileStream = new FileStream(); - fileStream.open(file, FileMode.READ); - rawJPG = new ByteArray(); - fileStream.readInt(); - fileStream.readByte(); - fileStream.readInt(); - fileStream.readBytes(rawJPG); - fileStream.close(); - this._loader.loadBytes(rawJPG); + _log.fatal(error.getStackTrace()); } - catch(e:Error) + onError(null); + } + } + + private static const _log:Logger = Log.getLogger(getQualifiedClassName(GroundMapLoader)); + + public static function loadGroundMap(param1:Map, param2:File, param3:Function, param4:Function) : void + { + new GroundMapLoader(param1,param2,param3,param4); + } + + private var _callBack:Function; + + private var _errorCallBack:Function; + + private var _loader:PoolableLoader; + + private var _map:Map; + + private var _groundIsLoaded:Boolean = false; + + private var _time:int = 0; + + private function onJPGReady(param1:Event) : void + { + var bitmap:Bitmap = null; + var e:Event = param1; + try + { + this._groundIsLoaded = true; + bitmap = this._loader.content as Bitmap; + if(this._map.groundCacheCurrentlyUsed == GroundCache.GROUND_CACHE_LOW_QUALITY || this._map.groundCacheCurrentlyUsed == GroundCache.GROUND_CACHE_MEDIUM_QUALITY) { - if (e) - { - _log.fatal(e.getStackTrace()); - }; - onError(null); - }; - } - - public static function loadGroundMap(map:Map, file:File, callBack:Function, errorCallBack:Function):void - { - new (GroundMapLoader)(map, file, callBack, errorCallBack); - } - - - private function onJPGReady(e:Event):void - { - var bitmap:Bitmap; - try - { - this._groundIsLoaded = true; - bitmap = (this._loader.content as Bitmap); - if ((((this._map.groundCacheCurrentlyUsed == GroundCache.GROUND_CACHE_LOW_QUALITY)) || ((this._map.groundCacheCurrentlyUsed == GroundCache.GROUND_CACHE_MEDIUM_QUALITY)))) - { - bitmap.width = AtouinConstants.RESOLUTION_HIGH_QUALITY.x; - bitmap.height = AtouinConstants.RESOLUTION_HIGH_QUALITY.y; - }; - this._loader.contentLoaderInfo.removeEventListener(Event.INIT, this.onJPGReady); - this._loader.contentLoaderInfo.removeEventListener(IOErrorEvent.IO_ERROR, this.onError); - this._loader.contentLoaderInfo.removeEventListener(ProgressEvent.PROGRESS, this.onProgress); - this._callBack(bitmap); + bitmap.width = AtouinConstants.RESOLUTION_HIGH_QUALITY.x; + bitmap.height = AtouinConstants.RESOLUTION_HIGH_QUALITY.y; } - catch(e:Error) + this._callBack(bitmap); + this.destroy(); + } + catch(error:Error) + { + if(error) { - if (e) - { - _log.fatal(e.getStackTrace()); - }; - onError(null); - }; - } - - private function onError(e:Event):void - { - _log.info("On a pas pu charger la map :/"); + _log.fatal(error.getStackTrace()); + } + onError(null); + } + } + + private function onError(param1:Event) : void + { + if(this._map) + { + _log.info("Failed to load ground resource for map " + this._map.id); this._errorCallBack(this._map.id); - this._loader.contentLoaderInfo.removeEventListener(Event.INIT, this.onJPGReady); - this._loader.contentLoaderInfo.removeEventListener(IOErrorEvent.IO_ERROR, this.onError); - this._loader.contentLoaderInfo.removeEventListener(ProgressEvent.PROGRESS, this.onProgress); - } - - private function onProgress(e:ProgressEvent):void - { - if (e.bytesLoaded == e.bytesTotal) + this.destroy(); + } + } + + private function onProgress(param1:ProgressEvent) : void + { + if(param1.bytesLoaded == param1.bytesTotal) + { + EnterFrameDispatcher.addEventListener(this.check,"GroundMapLoader"); + } + } + + private function check(param1:Event) : void + { + if(this._time > 5) + { + if(!this._groundIsLoaded) { - EnterFrameDispatcher.addEventListener(this.check, "GroundMapLoader"); - }; - } - - private function check(e:Event):void - { - if (this._time > 5) - { - if (!(this._groundIsLoaded)) - { - this._groundIsLoaded = true; - this.onError(null); - }; - EnterFrameDispatcher.removeEventListener(this.check); + this._groundIsLoaded = true; + this.onError(null); } - else - { - this._time++; - }; - } - - - } -}//package com.ankamagames.atouin.utils - + EnterFrameDispatcher.removeEventListener(this.check); + } + else + { + this._time++; + } + } + + private function destroy() : void + { + if(this._loader) + { + this._loader.contentLoaderInfo.removeEventListener(Event.COMPLETE,this.onJPGReady); + this._loader.contentLoaderInfo.removeEventListener(IOErrorEvent.IO_ERROR,this.onError); + this._loader.contentLoaderInfo.removeEventListener(ProgressEvent.PROGRESS,this.onProgress); + PoolsManager.getInstance().getLoadersPool().checkIn(this._loader); + this._loader = null; + } + this._map = null; + this._callBack = null; + this._errorCallBack = null; + } + } +} diff --git a/com/ankamagames/atouin/utils/IZoneRenderer.as b/com/ankamagames/atouin/utils/IZoneRenderer.as index c0b7293bf..54563d5bd 100644 --- a/com/ankamagames/atouin/utils/IZoneRenderer.as +++ b/com/ankamagames/atouin/utils/IZoneRenderer.as @@ -1,15 +1,13 @@ -package com.ankamagames.atouin.utils +package com.ankamagames.atouin.utils { - import __AS3__.vec.Vector; - import com.ankamagames.jerakine.types.Color; - import com.ankamagames.atouin.types.DataMapContainer; - - public interface IZoneRenderer - { - - function render(_arg_1:Vector., _arg_2:Color, _arg_3:DataMapContainer, _arg_4:Boolean=false, _arg_5:Boolean=false):void; - function remove(_arg_1:Vector., _arg_2:DataMapContainer):void; - - } -}//package com.ankamagames.atouin.utils - + import com.ankamagames.jerakine.types.Color; + import com.ankamagames.atouin.types.DataMapContainer; + + public interface IZoneRenderer + { + + function render(param1:Vector., param2:Color, param3:DataMapContainer, param4:Boolean = false, param5:Boolean = false) : void; + + function remove(param1:Vector., param2:DataMapContainer) : void; + } +} diff --git a/com/ankamagames/atouin/utils/VisibleCellDetection.as b/com/ankamagames/atouin/utils/VisibleCellDetection.as index 8a81ae50a..0d80f153d 100644 --- a/com/ankamagames/atouin/utils/VisibleCellDetection.as +++ b/com/ankamagames/atouin/utils/VisibleCellDetection.as @@ -1,163 +1,161 @@ -package com.ankamagames.atouin.utils +package com.ankamagames.atouin.utils { - import com.ankamagames.jerakine.logger.Logger; - import com.ankamagames.jerakine.logger.Log; - import flash.utils.getQualifiedClassName; - import flash.geom.Point; - import com.ankamagames.atouin.data.elements.GraphicalElementData; - import com.ankamagames.atouin.data.map.Layer; - import com.ankamagames.atouin.data.map.Cell; - import com.ankamagames.atouin.data.map.elements.BasicElement; - import com.ankamagames.atouin.data.elements.subtypes.NormalGraphicalElementData; - import com.ankamagames.atouin.types.miscs.PartialDataMap; - import com.ankamagames.atouin.AtouinConstants; - import flash.geom.Rectangle; - import com.ankamagames.jerakine.utils.display.StageShareManager; - import flash.display.Sprite; - import com.ankamagames.atouin.Atouin; - import com.ankamagames.atouin.data.elements.Elements; - import com.ankamagames.atouin.enums.ElementTypesEnum; - import com.ankamagames.atouin.data.map.elements.GraphicalElement; - import com.ankamagames.atouin.data.map.Map; - import com.ankamagames.jerakine.types.positions.WorldPoint; - import com.ankamagames.atouin.types.Frustum; - - public class VisibleCellDetection - { - - protected static const _log:Logger = Log.getLogger(getQualifiedClassName(VisibleCellDetection)); - - - public static function detectCell(visible:Boolean, map:Map, pMap:WorldPoint, frustum:Frustum, currentMapPoint:WorldPoint):PartialDataMap - { - var p:Point; - var alt:int; - var width:int; - var i:uint; - var left:int; - var elementData:GraphicalElementData; - var bottom:int; - var bottomTmp:int; - var layer:Layer; - var s:String; - var cell:Cell; - var element:BasicElement; - var ged:NormalGraphicalElementData; - var j:uint; - if (currentMapPoint == null) + import com.ankamagames.jerakine.logger.Logger; + import com.ankamagames.atouin.types.miscs.PartialDataMap; + import com.ankamagames.atouin.data.map.Map; + import com.ankamagames.jerakine.types.positions.WorldPoint; + import com.ankamagames.atouin.types.Frustum; + import flash.geom.Point; + import com.ankamagames.atouin.data.elements.GraphicalElementData; + import com.ankamagames.atouin.data.map.Layer; + import com.ankamagames.atouin.data.map.Cell; + import com.ankamagames.atouin.data.map.elements.BasicElement; + import com.ankamagames.atouin.data.elements.subtypes.NormalGraphicalElementData; + import com.ankamagames.atouin.AtouinConstants; + import flash.geom.Rectangle; + import com.ankamagames.jerakine.utils.display.StageShareManager; + import flash.display.Sprite; + import com.ankamagames.atouin.Atouin; + import com.ankamagames.atouin.data.elements.Elements; + import com.ankamagames.atouin.enums.ElementTypesEnum; + import com.ankamagames.atouin.data.map.elements.GraphicalElement; + import com.ankamagames.jerakine.logger.Log; + import flash.utils.getQualifiedClassName; + + public class VisibleCellDetection extends Object + { + + public function VisibleCellDetection() + { + super(); + } + + protected static const _log:Logger = Log.getLogger(getQualifiedClassName(VisibleCellDetection)); + + public static function detectCell(param1:Boolean, param2:Map, param3:WorldPoint, param4:Frustum, param5:WorldPoint) : PartialDataMap + { + var _loc7_:Point = null; + var _loc8_:* = 0; + var _loc9_:* = 0; + var _loc10_:uint = 0; + var _loc11_:* = 0; + var _loc12_:GraphicalElementData = null; + var _loc19_:* = 0; + var _loc20_:* = 0; + var _loc23_:Layer = null; + var _loc24_:String = null; + var _loc25_:Cell = null; + var _loc26_:BasicElement = null; + var _loc27_:NormalGraphicalElementData = null; + var _loc28_:uint = 0; + if(param5 == null) + { + _log.error("Cannot detect visible cells with no current map point."); + return null; + } + var _loc6_:PartialDataMap = new PartialDataMap(); + var _loc13_:int = (param3.x - param5.x) * AtouinConstants.CELL_WIDTH * AtouinConstants.MAP_WIDTH; + var _loc14_:int = (param3.y - param5.y) * AtouinConstants.CELL_HEIGHT * AtouinConstants.MAP_HEIGHT; + var _loc15_:Rectangle = new Rectangle(-param4.x / param4.scale,-param4.y / param4.scale,StageShareManager.startHeight / param4.scale,StageShareManager.stage.stageHeight / param4.scale); + var _loc16_:Rectangle = new Rectangle(); + var _loc17_:Array = new Array(); + var _loc18_:Array = new Array(); + var _loc21_:Sprite = Sprite(Atouin.getInstance().worldContainer.parent).addChild(new Sprite()) as Sprite; + _loc21_.graphics.beginFill(0,0); + _loc21_.graphics.lineStyle(1,16711680); + var _loc22_:Elements = Elements.getInstance(); + for each(_loc23_ in param2.layers) + { + for each(_loc25_ in _loc23_.cells) { - _log.error("Cannot detect visible cells with no current map point."); - return (null); - }; - var pdm:PartialDataMap = new PartialDataMap(); - var ox:int = (((pMap.x - currentMapPoint.x) * AtouinConstants.CELL_WIDTH) * AtouinConstants.MAP_WIDTH); - var oy:int = (((pMap.y - currentMapPoint.y) * AtouinConstants.CELL_HEIGHT) * AtouinConstants.MAP_HEIGHT); - var rv:Rectangle = new Rectangle((-(frustum.x) / frustum.scale), (-(frustum.y) / frustum.scale), (StageShareManager.startHeight / frustum.scale), (StageShareManager.stage.stageHeight / frustum.scale)); - var rcv:Rectangle = new Rectangle(); - var aCell:Array = new Array(); - var aGfx:Array = new Array(); - var spDebug:Sprite = (Sprite(Atouin.getInstance().worldContainer.parent).addChild(new Sprite()) as Sprite); - spDebug.graphics.beginFill(0, 0); - spDebug.graphics.lineStyle(1, 0xFF0000); - var ele:Elements = Elements.getInstance(); - for each (layer in map.layers) - { - for each (cell in layer.cells) - { - alt = 0; - width = 0; - left = 100000; - bottom = 0; - aGfx = new Array(); - for each (element in cell.elements) - { - if (element.elementType == ElementTypesEnum.GRAPHICAL) + _loc8_ = 0; + _loc9_ = 0; + _loc11_ = 100000; + _loc19_ = 0; + _loc18_ = new Array(); + for each(_loc26_ in _loc25_.elements) + { + if(_loc26_.elementType == ElementTypesEnum.GRAPHICAL) + { + _loc12_ = _loc22_.getElementData(GraphicalElement(_loc26_).elementId); + _loc20_ = GraphicalElement(_loc26_).altitude * AtouinConstants.ALTITUDE_PIXEL_UNIT; + _loc19_ = _loc20_ < _loc19_?_loc20_:_loc19_; + if((_loc12_) && _loc12_ is NormalGraphicalElementData) + { + _loc27_ = _loc12_ as NormalGraphicalElementData; + if(-_loc27_.origin.x + AtouinConstants.CELL_WIDTH < _loc11_) { - elementData = ele.getElementData(GraphicalElement(element).elementId); - bottomTmp = (GraphicalElement(element).altitude * AtouinConstants.ALTITUDE_PIXEL_UNIT); - bottom = (((bottomTmp < bottom)) ? bottomTmp : bottom); - if (((elementData) && ((elementData is NormalGraphicalElementData)))) - { - ged = (elementData as NormalGraphicalElementData); - if ((-(ged.origin.x) + AtouinConstants.CELL_WIDTH) < left) - { - left = (-(ged.origin.x) + AtouinConstants.CELL_WIDTH); - }; - if (ged.size.x > width) - { - width = ged.size.x; - }; - alt = (alt + (ged.origin.y + ged.size.y)); - aGfx.push(ged.gfxId); - } - else - { - alt = (alt + Math.abs(bottomTmp)); - }; - }; - }; - if (!(alt)) - { - alt = AtouinConstants.CELL_HEIGHT; - }; - if (left == 100000) - { - left = 0; - }; - if (width < AtouinConstants.CELL_WIDTH) - { - width = AtouinConstants.CELL_WIDTH; - }; - p = Cell.cellPixelCoords(cell.cellId); - rcv.left = (((p.x + ox) + left) - AtouinConstants.CELL_HALF_WIDTH); - rcv.top = (((p.y + oy) - bottom) - alt); - rcv.width = width; - rcv.height = (alt + (AtouinConstants.CELL_HEIGHT * 2)); - if (!(aCell[cell.cellId])) - { - aCell[cell.cellId] = { - "r":rcv.clone(), - "gfx":aGfx - }; - } - else - { - aCell[cell.cellId].r = aCell[cell.cellId].r.union(rcv); - aCell[cell.cellId].gfx = aCell[cell.cellId].gfx.concat(aGfx); - }; - }; - }; - aGfx = new Array(); - i = 0; - while (i < aCell.length) - { - if (!(aCell[i])) - { - } - else - { - rcv = aCell[i].r; - if (((rcv) && ((rcv.intersects(rv) == visible)))) - { - pdm.cell[i] = true; - j = 0; - while (j < aCell[i].gfx.length) + _loc11_ = -_loc27_.origin.x + AtouinConstants.CELL_WIDTH; + } + if(_loc27_.size.x > _loc9_) { - aGfx[aCell[i].gfx[j]] = true; - j++; - }; - }; - }; - i++; - }; - for (s in aGfx) + _loc9_ = _loc27_.size.x; + } + _loc8_ = _loc8_ + (_loc27_.origin.y + _loc27_.size.y); + _loc18_.push(_loc27_.gfxId); + } + else + { + _loc8_ = _loc8_ + Math.abs(_loc20_); + } + } + } + if(!_loc8_) + { + _loc8_ = AtouinConstants.CELL_HEIGHT; + } + if(_loc11_ == 100000) + { + _loc11_ = 0; + } + if(_loc9_ < AtouinConstants.CELL_WIDTH) + { + _loc9_ = AtouinConstants.CELL_WIDTH; + } + _loc7_ = Cell.cellPixelCoords(_loc25_.cellId); + _loc16_.left = _loc7_.x + _loc13_ + _loc11_ - AtouinConstants.CELL_HALF_WIDTH; + _loc16_.top = _loc7_.y + _loc14_ - _loc19_ - _loc8_; + _loc16_.width = _loc9_; + _loc16_.height = _loc8_ + AtouinConstants.CELL_HEIGHT * 2; + if(!_loc17_[_loc25_.cellId]) + { + _loc17_[_loc25_.cellId] = { + "r":_loc16_.clone(), + "gfx":_loc18_ + }; + } + else + { + _loc17_[_loc25_.cellId].r = _loc17_[_loc25_.cellId].r.union(_loc16_); + _loc17_[_loc25_.cellId].gfx = _loc17_[_loc25_.cellId].gfx.concat(_loc18_); + } + } + } + _loc18_ = new Array(); + _loc10_ = 0; + while(_loc10_ < _loc17_.length) + { + if(_loc17_[_loc10_]) { - pdm.gfx.push(s); - }; - return (pdm); - } - - - } -}//package com.ankamagames.atouin.utils - + _loc16_ = _loc17_[_loc10_].r; + if((_loc16_) && _loc16_.intersects(_loc15_) == param1) + { + _loc6_.cell[_loc10_] = true; + _loc28_ = 0; + while(_loc28_ < _loc17_[_loc10_].gfx.length) + { + _loc18_[_loc17_[_loc10_].gfx[_loc28_]] = true; + _loc28_++; + } + } + } + _loc10_++; + } + for(_loc24_ in _loc18_) + { + _loc6_.gfx.push(_loc24_); + } + return _loc6_; + } + } +} diff --git a/com/ankamagames/atouin/utils/errors/AtouinError.as b/com/ankamagames/atouin/utils/errors/AtouinError.as index 90235b0ed..cff1ca5ea 100644 --- a/com/ankamagames/atouin/utils/errors/AtouinError.as +++ b/com/ankamagames/atouin/utils/errors/AtouinError.as @@ -1,13 +1,11 @@ -package com.ankamagames.atouin.utils.errors +package com.ankamagames.atouin.utils.errors { - public class AtouinError extends Error - { - - public function AtouinError(message:String="", id:uint=0) - { - super(message, id); - } - - } -}//package com.ankamagames.atouin.utils.errors - + public class AtouinError extends Error + { + + public function AtouinError(param1:String = "", param2:uint = 0) + { + super(param1,param2); + } + } +} diff --git a/com/ankamagames/atouin/utils/map/getMapIdFromCoord.as b/com/ankamagames/atouin/utils/map/getMapIdFromCoord.as index 065383901..a67a01a34 100644 --- a/com/ankamagames/atouin/utils/map/getMapIdFromCoord.as +++ b/com/ankamagames/atouin/utils/map/getMapIdFromCoord.as @@ -1,26 +1,24 @@ -package com.ankamagames.atouin.utils.map +package com.ankamagames.atouin.utils.map { - public function getMapIdFromCoord(worldId:int, x:int, y:int):int - { - var worldIdMax:int = (2 << 12); - var mapCoordMax:int = (2 << 8); - if ((((((x > mapCoordMax)) || ((y > mapCoordMax)))) || ((worldId > worldIdMax)))) - { - return (-1); - }; - var newWorldId:int = (worldId & 4095); - var newX:int = (Math.abs(x) & 0xFF); - if (x < 0) - { - newX = (newX | 0x0100); - }; - var newY:int = (Math.abs(y) & 0xFF); - if (y < 0) - { - newY = (newY | 0x0100); - }; - return (((newWorldId << 18) | ((newX << 9) | newY))); - } - -}//package com.ankamagames.atouin.utils.map - + public function getMapIdFromCoord(param1:int, param2:int, param3:int) : int + { + var _loc4_:* = 2 << 12; + var _loc5_:* = 2 << 8; + if(param2 > _loc5_ || param3 > _loc5_ || param1 > _loc4_) + { + return -1; + } + var _loc6_:* = param1 & 4095; + var _loc7_:* = Math.abs(param2) & 255; + if(param2 < 0) + { + _loc7_ = _loc7_ | 256; + } + var _loc8_:* = Math.abs(param3) & 255; + if(param3 < 0) + { + _loc8_ = _loc8_ | 256; + } + return _loc6_ << 18 | _loc7_ << 9 | _loc8_; + } +} diff --git a/com/ankamagames/atouin/utils/map/getMapUriFromId.as b/com/ankamagames/atouin/utils/map/getMapUriFromId.as index ac564515e..032b96eee 100644 --- a/com/ankamagames/atouin/utils/map/getMapUriFromId.as +++ b/com/ankamagames/atouin/utils/map/getMapUriFromId.as @@ -1,11 +1,7 @@ -package com.ankamagames.atouin.utils.map +package com.ankamagames.atouin.utils.map { - import com.ankamagames.atouin.Atouin; - - public function getMapUriFromId(mapId:int):String - { - return (((((Atouin.getInstance().options.mapsPath + (mapId % 10)) + "/") + mapId) + ".dlm")); - } - -}//package com.ankamagames.atouin.utils.map - + public function getMapUriFromId(param1:int) : String + { + return Atouin.getInstance().options.mapsPath + param1 % 10 + "/" + param1 + ".dlm"; + } +} diff --git a/com/ankamagames/atouin/utils/map/getWorldPointFromMapId.as b/com/ankamagames/atouin/utils/map/getWorldPointFromMapId.as index fc304f764..2f7823040 100644 --- a/com/ankamagames/atouin/utils/map/getWorldPointFromMapId.as +++ b/com/ankamagames/atouin/utils/map/getWorldPointFromMapId.as @@ -1,22 +1,18 @@ -package com.ankamagames.atouin.utils.map +package com.ankamagames.atouin.utils.map { - import com.ankamagames.jerakine.types.positions.WorldPoint; - - public function getWorldPointFromMapId(nMapId:uint):WorldPoint - { - var worldId:uint = ((nMapId & 0x3FFC0000) >> 18); - var x:int = ((nMapId >> 9) & 511); - var y:int = (nMapId & 511); - if ((x & 0x0100) == 0x0100) - { - x = -((x & 0xFF)); - }; - if ((y & 0x0100) == 0x0100) - { - y = -((y & 0xFF)); - }; - return (WorldPoint.fromCoords(worldId, x, y)); - } - -}//package com.ankamagames.atouin.utils.map - + public function getWorldPointFromMapId(param1:uint) : WorldPoint + { + var _loc2_:uint = (param1 & 1073479680) >> 18; + var _loc3_:* = param1 >> 9 & 511; + var _loc4_:* = param1 & 511; + if((_loc3_ & 256) == 256) + { + _loc3_ = -(_loc3_ & 255); + } + if((_loc4_ & 256) == 256) + { + _loc4_ = -(_loc4_ & 255); + } + return WorldPoint.fromCoords(_loc2_,_loc3_,_loc4_); + } +} diff --git a/com/ankamagames/berilia/Berilia.as b/com/ankamagames/berilia/Berilia.as index 019c249fa..012f0bcae 100644 --- a/com/ankamagames/berilia/Berilia.as +++ b/com/ankamagames/berilia/Berilia.as @@ -1,741 +1,785 @@ -package com.ankamagames.berilia +package com.ankamagames.berilia { - import flash.events.EventDispatcher; - import com.ankamagames.jerakine.logger.Logger; - import com.ankamagames.jerakine.logger.Log; - import flash.utils.getQualifiedClassName; - import flash.utils.Dictionary; - import com.ankamagames.berilia.utils.EmbedIcons; - import com.ankamagames.jerakine.cache.Cache; - import com.ankamagames.berilia.types.BeriliaOptions; - import flash.display.Sprite; - import com.ankamagames.jerakine.messages.MessageHandler; - import com.ankamagames.jerakine.utils.errors.SingletonError; - import flash.display.DisplayObjectContainer; - import com.ankamagames.jerakine.utils.benchmark.monitoring.FpsManager; - import com.ankamagames.jerakine.interfaces.IInterfaceListener; - import com.ankamagames.berilia.utils.BeriliaHookList; - import com.ankamagames.jerakine.utils.system.SystemManager; - import com.ankamagames.jerakine.enum.OperatingSystem; - import com.ankamagames.berilia.components.Label; - import com.ankamagames.berilia.types.data.UiModule; - import com.ankamagames.berilia.types.graphic.UiRootContainer; - import com.ankamagames.berilia.types.graphic.TimeoutHTMLLoader; - import com.ankamagames.berilia.managers.UiModuleManager; - import com.ankamagames.berilia.managers.KernelEventsManager; - import com.ankamagames.berilia.managers.BindsManager; - import com.ankamagames.berilia.managers.UiGroupManager; - import flash.utils.getTimer; - import com.ankamagames.jerakine.managers.ErrorManager; - import com.ankamagames.berilia.types.data.UiData; - import com.ankamagames.jerakine.utils.display.StageShareManager; - import com.ankamagames.berilia.utils.errors.BeriliaError; - import com.ankamagames.berilia.types.event.UiRenderAskEvent; - import com.ankamagames.berilia.types.event.UiRenderEvent; - import com.ankamagames.berilia.managers.UiRenderManager; - import com.ankamagames.berilia.types.data.LinkedCursorData; - import com.ankamagames.berilia.types.event.UiUnloadEvent; - import com.ankamagames.jerakine.types.DynamicSecureObject; - import com.ankamagames.berilia.types.graphic.ChatTextContainer; - import flash.text.TextField; - import flash.display.InteractiveObject; - import flash.display.DisplayObject; - import com.ankamagames.jerakine.utils.misc.DescribeTypeCache; - import com.ankamagames.berilia.managers.SecureCenter; - import com.ankamagames.berilia.managers.UIEventManager; - import com.ankamagames.berilia.managers.LinkedCursorSpriteManager; - import com.ankamagames.jerakine.handlers.HumanInputHandler; - import com.ankamagames.berilia.types.graphic.GraphicContainer; - import com.ankamagames.berilia.api.ApiBinder; - - public class Berilia extends EventDispatcher - { - - private static var _self:Berilia; - protected static const _log:Logger = Log.getLogger(getQualifiedClassName(Berilia)); - public static var _uiCache:Dictionary = new Dictionary(); - public static var embedIcons:Class = EmbedIcons; - - private const _cache:Cache = new Cache(Cache.CHECK_SYSTEM_MEMORY, 0x1DCD6500, 0x11E1A300); - - private var _UISoundListeners:Array; - private var _bOptions:BeriliaOptions; - private var _applicationVersion:uint; - private var _checkModuleAuthority:Boolean = true; - private var _docMain:Sprite; - private var _aUiList:Dictionary; - private var _highestModalDepth:int; - private var _aContainerList:Array; - private var _docStrataWorld:Sprite; - private var _docStrataLow:Sprite; - private var _docStrataMedium:Sprite; - private var _docStrataHight:Sprite; - private var _docStrataTop:Sprite; - private var _docStrataTooltip:Sprite; - private var _docStrataSuperTooltip:Sprite; - private var _handler:MessageHandler; - private var _aLoadingUi:Array; - private var _globalScale:Number = 1; - private var _verboseException:Boolean = false; - public var useIME:Boolean; - - public function Berilia() - { - this._UISoundListeners = new Array(); - super(); - if (_self != null) - { - throw (new SingletonError("Berilia is a singleton and should not be instanciated directly.")); - }; - } - - public static function getInstance():Berilia - { - if (_self == null) - { - _self = new (Berilia)(); - }; - return (_self); - } - - - public function get handler():MessageHandler - { - return (this._handler); - } - - public function set handler(value:MessageHandler):void - { - this._handler = value; - } - - public function get docMain():Sprite - { - return (this._docMain); - } - - public function get uiList():Dictionary - { - return (this._aUiList); - } - - public function get highestModalDepth():int - { - return (this._highestModalDepth); - } - - public function get containerList():Array - { - return (this._aContainerList); - } - - public function get strataLow():DisplayObjectContainer - { - return (this._docStrataLow); - } - - public function get strataMedium():DisplayObjectContainer - { - return (this._docStrataMedium); - } - - public function get strataHigh():DisplayObjectContainer - { - return (this._docStrataHight); - } - - public function get strataTop():DisplayObjectContainer - { - return (this._docStrataTop); - } - - public function get strataTooltip():DisplayObjectContainer - { - return (this._docStrataTooltip); - } - - public function get strataSuperTooltip():DisplayObjectContainer - { - return (this._docStrataSuperTooltip); - } - - public function get loadingUi():Array - { - return (this._aLoadingUi); - } - - public function get scale():Number - { - return (this._globalScale); - } - - public function set scale(nScale:Number):void - { - this._globalScale = nScale; - this.updateUiScale(); - } - - public function get cache():Cache - { - return (this._cache); - } - - public function get verboseException():Boolean - { - return (this._verboseException); - } - - public function set verboseException(v:Boolean):void - { - this._verboseException = v; - } - - public function get UISoundListeners():Array - { - return (this._UISoundListeners); - } - - public function get options():BeriliaOptions - { - return (this._bOptions); - } - - public function get applicationVersion():uint - { - return (this._applicationVersion); - } - - public function get checkModuleAuthority():Boolean - { - return (this._checkModuleAuthority); - } - - public function setDisplayOptions(bopt:BeriliaOptions):void - { - this._bOptions = bopt; - } - - public function addUIListener(pListener:IInterfaceListener):void - { - FpsManager.getInstance().startTracking("ui", 16525567); - var index:int = this._UISoundListeners.indexOf(pListener); - if (index == -1) - { - this._UISoundListeners.push(pListener); - }; - FpsManager.getInstance().stopTracking("ui"); - } - - public function removeUIListener(pListener:IInterfaceListener):void - { - FpsManager.getInstance().startTracking("ui", 16525567); - var index:int = this._UISoundListeners.indexOf(pListener); - if (index >= 0) - { - this._UISoundListeners.splice(index, 1); - }; - FpsManager.getInstance().stopTracking("ui"); - } - - public function init(docContainer:Sprite, verboseException:Boolean, applicationVersion:uint, checkModuleAuthority:Boolean=true):void - { - this._docMain = docContainer; - this._docMain.mouseEnabled = false; - this._applicationVersion = applicationVersion; - this._checkModuleAuthority = checkModuleAuthority; - this._docStrataWorld = new Sprite(); - this._docStrataWorld.name = "strataWorld"; - this._docStrataLow = new Sprite(); - this._docStrataLow.name = "strataLow"; - this._docStrataMedium = new Sprite(); - this._docStrataMedium.name = "strataMedium"; - this._docStrataHight = new Sprite(); - this._docStrataHight.name = "strataHight"; - this._docStrataTop = new Sprite(); - this._docStrataTop.name = "strataTop"; - this._docStrataTooltip = new Sprite(); - this._docStrataTooltip.name = "strataTooltip"; - this._docStrataSuperTooltip = new Sprite(); - this._docStrataSuperTooltip.name = "strataSuperTooltip"; - this._docStrataWorld.mouseEnabled = false; - this._docStrataLow.mouseEnabled = false; - this._docStrataMedium.mouseEnabled = false; - this._docStrataHight.mouseEnabled = false; - this._docStrataTop.mouseEnabled = false; - this._docStrataTooltip.mouseChildren = false; - this._docStrataTooltip.mouseEnabled = false; - this._docStrataSuperTooltip.mouseChildren = false; - this._docStrataSuperTooltip.mouseEnabled = false; - this._docMain.addChild(this._docStrataWorld); - this._docMain.addChild(this._docStrataLow); - this._docMain.addChild(this._docStrataMedium); - this._docMain.addChild(this._docStrataHight); - this._docMain.addChild(this._docStrataTop); - this._docMain.addChild(this._docStrataTooltip); - this._docMain.addChild(this._docStrataSuperTooltip); - this._aUiList = new Dictionary(); - this._aContainerList = new Array(); - this._aLoadingUi = new Array(); - BeriliaHookList.MouseClick; - if (SystemManager.getSingleton().os == OperatingSystem.LINUX) - { - Label.HEIGHT_OFFSET = 1; - }; - } - - public function reset():void - { - var uiName:String; - var tmpUiNameList:Array; - var n:String; - var m:UiModule; - var ui:UiRootContainer; - TimeoutHTMLLoader.resetCache(); - FpsManager.getInstance().startTracking("ui", 16525567); - for (uiName in _uiCache) - { - ui = _uiCache[uiName]; - this._aUiList[uiName] = ui; - ui.cached = false; - }; - _uiCache = new Dictionary(); - tmpUiNameList = []; - for (n in this._aUiList) - { - tmpUiNameList.push(n); - }; - for each (n in tmpUiNameList) - { - this.unloadUi(n); - }; - for each (m in UiModuleManager.getInstance().getModules()) - { - KernelEventsManager.getInstance().removeAllEventListeners(("__module_" + m.id)); - BindsManager.getInstance().removeAllEventListeners(("__module_" + m.id)); - }; - UiGroupManager.getInstance().destroy(); - FpsManager.getInstance().stopTracking("ui"); - } - - public function loadUi(uiModule:UiModule, uiData:UiData, sName:String, properties:*=null, bReplace:Boolean=false, nStrata:int=1, hide:Boolean=false, cacheName:String=null):UiRootContainer - { - var container:UiRootContainer; - var highestDepth:int; - var uiContainer:Sprite; - var i:uint; - var t:int; - FpsManager.getInstance().startTracking("ui", 16525567); - if (cacheName) - { - container = _uiCache[cacheName]; - if (container) - { - container.name = sName; - container.strata = nStrata; - highestDepth = int.MIN_VALUE; - uiContainer = Sprite(this._docMain.getChildAt((nStrata + 1))); - i = 0; - while (i < uiContainer.numChildren) - { - if ((((uiContainer.getChildAt(i) is UiRootContainer)) && ((UiRootContainer(uiContainer.getChildAt(i)).depth > highestDepth)))) - { - highestDepth = UiRootContainer(uiContainer.getChildAt(i)).depth; - }; - i++; - }; - if (highestDepth < 0) - { - highestDepth = 0; - }; - container.depth = (((nStrata * 10000) + highestDepth) + 1); - container.uiModule = uiModule; - DisplayObjectContainer(this._docMain.getChildAt((nStrata + 1))).addChild(container); - this._aUiList[sName] = container; - try - { - t = getTimer(); - FpsManager.getInstance().startTracking("hook", 7108545); - container.uiClass.main(properties); - FpsManager.getInstance().stopTracking("hook"); - KernelEventsManager.getInstance().processCallback(BeriliaHookList.UiLoaded, sName); - } - catch(e:Error) - { - ErrorManager.addError(((("Impossible d'utiliser le cache d'interface pour " + container.name) + " du module ") + ((container.uiModule) ? container.uiModule.id : "???"))); - delete _uiCache[cacheName]; - container.cached = false; - unloadUi(sName); - }; - return (null); - }; - }; - container = new UiRootContainer(this._docMain.stage, uiData, Sprite(this._docMain.getChildAt((nStrata + 1)))); - container.name = sName; - container.strata = nStrata; - highestDepth = int.MIN_VALUE; - uiContainer = Sprite(this._docMain.getChildAt((nStrata + 1))); - i = 0; - while (i < uiContainer.numChildren) - { - if ((((uiContainer.getChildAt(i) is UiRootContainer)) && ((UiRootContainer(uiContainer.getChildAt(i)).depth > highestDepth)))) - { - highestDepth = UiRootContainer(uiContainer.getChildAt(i)).depth; - }; - i++; - }; - if (highestDepth < 0) - { - highestDepth = 0; - }; - container.depth = (((nStrata * 10000) + (highestDepth % 10000)) + 1); - container.uiModule = uiModule; - if (cacheName) - { - container.cached = true; - _uiCache[cacheName] = container; - }; - if (((!(container.parent)) && (!(hide)))) - { - DisplayObjectContainer(this._docMain.getChildAt((nStrata + 1))).addChild(container); - }; - this.loadUiInside(uiData, sName, container, properties, bReplace); - FpsManager.getInstance().stopTracking("ui"); - return (container); - } - - public function giveFocus(container:UiRootContainer):void - { - var onTop:Boolean; - var ui:Object; - if (container.strata == 1) - { - onTop = true; - for each (ui in this._aUiList) - { - if (((((ui.visible) && ((ui.depth > container.depth)))) && ((ui.strata == 1)))) - { - onTop = false; - }; - }; - if (((container.visible) && (onTop))) - { - StageShareManager.stage.focus = container; - }; - }; - } - - public function loadUiInside(uiData:UiData, sName:String, suiContainer:UiRootContainer, properties:*=null, bReplace:Boolean=false):UiRootContainer - { - if (bReplace) - { - this.unloadUi(sName); - }; - if (this.isRegisteredUiName(sName)) - { - throw (new BeriliaError((sName + " is already used by an other UI"))); - }; - dispatchEvent(new UiRenderAskEvent(sName, uiData)); - suiContainer.name = sName; - this._aLoadingUi[sName] = true; - this._aUiList[sName] = suiContainer; - suiContainer.addEventListener(UiRenderEvent.UIRenderComplete, this.onUiLoaded); - UiRenderManager.getInstance().loadUi(uiData, suiContainer, properties); - return (suiContainer); - } - - public function unloadUi(sName:String, forceUnload:Boolean=false):Boolean - { - var ui:UiRootContainer; - var j:Object; - var linkCursor:LinkedCursorData; - var currObj:Object; - var i:Object; - var topUi:Object; - var variables:Array; - var varName:String; - var holder:Object; - var rootContainer:UiRootContainer; - var u:Object; - var startTimer:int = getTimer(); - FpsManager.getInstance().startTracking("ui", 16525567); - dispatchEvent(new UiUnloadEvent(UiUnloadEvent.UNLOAD_UI_STARTED, sName)); - ui = this._aUiList[sName]; - if (ui == null) - { - return (false); - }; - var obj:DynamicSecureObject = new DynamicSecureObject(); - obj.cancel = false; - KernelEventsManager.getInstance().processCallback(BeriliaHookList.UiUnloading, sName, obj); - if (((!(forceUnload)) && (obj.cancel))) - { - return (false); - }; - if (ui.cached) - { - if (ui.parent) - { - ui.parent.removeChild(ui); - }; - this.unloadUiEvents(sName, true); - ui.hideAfterLoading = true; - delete this._aUiList[sName]; - if (((ui.uiClass) && (ui.uiClass.unload))) - { - try - { - ui.uiClass.unload(); - } - catch(e:Error) - { - ErrorManager.addError(((("Une erreur est survenu dans la fonction unload() de l'interface " + ui.name) + " du module ") + ((ui.uiModule) ? ui.uiModule.id : "???"))); - }; - }; - if (((ui.transmitFocus) && (((!(StageShareManager.stage.focus)) || (!((((StageShareManager.stage.focus is TextField)) || ((StageShareManager.stage.focus is ChatTextContainer))))))))) - { - StageShareManager.stage.focus = (((topUi == null)) ? StageShareManager.stage : InteractiveObject(topUi)); - }; - KernelEventsManager.getInstance().processCallback(BeriliaHookList.UiUnloaded, sName); - return (true); - }; - ui.disableRender = true; - delete this._aLoadingUi[sName]; - var doIt:DisplayObject = StageShareManager.stage.focus; - while (doIt) - { - if ((((doIt is UiRootContainer)) && ((doIt == ui)))) - { - StageShareManager.stage.focus = null; - break; - }; - doIt = doIt.parent; - }; - if (UiRootContainer(ui).uiClass) - { - if (Object(UiRootContainer(ui).uiClass).hasOwnProperty("unload")) - { - try - { - UiRootContainer(ui).uiClass.unload(); - } - catch(e:Error) - { - ErrorManager.addError(((((("Une erreur est survenu dans la fonction unload() de l'interface " + ui.name) + " du module ") + ((ui.uiModule) ? ui.uiModule.id : "???")) + ": ") + e.message)); - }; - }; - variables = DescribeTypeCache.getVariables(UiRootContainer(ui).uiClass, true, false); - for each (varName in variables) - { - if ((UiRootContainer(ui).uiClass[varName] is Object)) - { - if (((((getQualifiedClassName(UiRootContainer(ui).uiClass[varName]).indexOf("Api")) && ((UiRootContainer(ui).uiClass[varName] is Object)))) && (Object(UiRootContainer(ui).uiClass[varName]).hasOwnProperty("destroy")))) - { - if (UiRootContainer(ui).uiModule.trusted) - { - UiRootContainer(ui).uiClass[varName].destroy(); - } - else - { - UiRootContainer(ui).uiClass[varName].destroy(SecureCenter.ACCESS_KEY); - }; - }; - UiRootContainer(ui).uiClass[varName] = null; - }; - }; - UiRootContainer(ui).uiClass = null; - }; - for (j in UIEventManager.getInstance().instances) - { - if (((!((j == "null"))) && ((UIEventManager.getInstance().instances[j].instance.getUi() == ui)))) - { - UIEventManager.getInstance().instances[j] = null; - delete UIEventManager.getInstance().instances[j]; - }; - }; - linkCursor = LinkedCursorSpriteManager.getInstance().getItem("DragAndDrop"); - if (((linkCursor) && (linkCursor.data.hasOwnProperty("currentHolder")))) - { - holder = linkCursor.data.currentHolder; - rootContainer = holder.getUi(); - if (rootContainer == ui) - { - LinkedCursorSpriteManager.getInstance().removeItem("DragAndDrop"); - HumanInputHandler.getInstance().resetClick(); - }; - }; - UiRootContainer(ui).remove(); - for (i in ui.getElements()) - { - currObj = ui.getElements()[i]; - if ((currObj is GraphicContainer)) - { - this._aContainerList[currObj["name"]] = null; - delete this._aContainerList[currObj["name"]]; - }; - ui.getElements()[i] = null; - delete ui.getElements()[i]; - }; - KernelEventsManager.getInstance().removeAllEventListeners(sName); - BindsManager.getInstance().removeAllEventListeners(sName); - UiRenderManager.getInstance().cancelRender(ui.uiData); - SecureCenter.destroy(ui); - ui.destroyUi(SecureCenter.ACCESS_KEY); - if (ApiBinder.getApiData("currentUi") == ui) - { - ApiBinder.removeApiData("currentUi"); - }; - UiRootContainer(ui).free(); + import flash.events.EventDispatcher; + import com.ankamagames.jerakine.logger.Logger; + import flash.utils.Dictionary; + import com.ankamagames.jerakine.logger.Log; + import flash.utils.getQualifiedClassName; + import com.ankamagames.berilia.utils.EmbedIcons; + import com.ankamagames.jerakine.cache.Cache; + import com.ankamagames.berilia.types.BeriliaOptions; + import flash.display.Sprite; + import com.ankamagames.jerakine.messages.MessageHandler; + import flash.display.DisplayObjectContainer; + import com.ankamagames.jerakine.interfaces.IInterfaceListener; + import com.ankamagames.jerakine.utils.benchmark.monitoring.FpsManager; + import com.ankamagames.berilia.utils.BeriliaHookList; + import com.ankamagames.jerakine.utils.system.SystemManager; + import com.ankamagames.jerakine.enum.OperatingSystem; + import com.ankamagames.berilia.components.Label; + import com.ankamagames.berilia.types.data.UiModule; + import com.ankamagames.berilia.types.graphic.UiRootContainer; + import com.ankamagames.berilia.types.graphic.TimeoutHTMLLoader; + import com.ankamagames.berilia.managers.UiModuleManager; + import com.ankamagames.berilia.managers.KernelEventsManager; + import com.ankamagames.berilia.managers.BindsManager; + import com.ankamagames.berilia.managers.UiGroupManager; + import com.ankamagames.berilia.types.data.UiData; + import flash.utils.getTimer; + import com.ankamagames.jerakine.managers.ErrorManager; + import com.ankamagames.jerakine.utils.display.StageShareManager; + import com.ankamagames.berilia.utils.errors.BeriliaError; + import com.ankamagames.berilia.types.event.UiRenderAskEvent; + import com.ankamagames.berilia.types.event.UiRenderEvent; + import com.ankamagames.berilia.managers.UiRenderManager; + import com.ankamagames.jerakine.types.DynamicSecureObject; + import flash.display.DisplayObject; + import com.ankamagames.berilia.types.data.LinkedCursorData; + import com.ankamagames.berilia.types.event.UiUnloadEvent; + import flash.text.TextField; + import com.ankamagames.berilia.types.graphic.ChatTextContainer; + import flash.display.InteractiveObject; + import com.ankamagames.jerakine.utils.misc.DescribeTypeCache; + import com.ankamagames.berilia.managers.SecureCenter; + import com.ankamagames.berilia.managers.UIEventManager; + import com.ankamagames.berilia.managers.LinkedCursorSpriteManager; + import com.ankamagames.jerakine.handlers.HumanInputHandler; + import com.ankamagames.berilia.types.graphic.GraphicContainer; + import com.ankamagames.berilia.api.ApiBinder; + import com.ankamagames.jerakine.utils.errors.SingletonError; + + public class Berilia extends EventDispatcher + { + + public function Berilia() + { + this._UISoundListeners = new Array(); + super(); + if(_self != null) + { + throw new SingletonError("Berilia is a singleton and should not be instanciated directly."); + } + else + { + return; + } + } + + private static var _self:Berilia; + + protected static const _log:Logger = Log.getLogger(getQualifiedClassName(Berilia)); + + public static var _uiCache:Dictionary = new Dictionary(); + + public static var embedIcons:Class = EmbedIcons; + + public static function getInstance() : Berilia + { + if(_self == null) + { + _self = new Berilia(); + } + return _self; + } + + private const _cache:Cache = new Cache(Cache.CHECK_SYSTEM_MEMORY,500000000,300000000); + + private var _UISoundListeners:Array; + + private var _bOptions:BeriliaOptions; + + private var _applicationVersion:uint; + + private var _checkModuleAuthority:Boolean = true; + + private var _docMain:Sprite; + + private var _aUiList:Dictionary; + + private var _highestModalDepth:int; + + private var _aContainerList:Array; + + private var _docStrataWorld:Sprite; + + private var _docStrataLow:Sprite; + + private var _docStrataMedium:Sprite; + + private var _docStrataHight:Sprite; + + private var _docStrataTop:Sprite; + + private var _docStrataTooltip:Sprite; + + private var _docStrataSuperTooltip:Sprite; + + private var _handler:MessageHandler; + + private var _aLoadingUi:Array; + + private var _globalScale:Number = 1; + + private var _verboseException:Boolean = false; + + public var useIME:Boolean; + + public function get handler() : MessageHandler + { + return this._handler; + } + + public function set handler(param1:MessageHandler) : void + { + this._handler = param1; + } + + public function get docMain() : Sprite + { + return this._docMain; + } + + public function get uiList() : Dictionary + { + return this._aUiList; + } + + public function get highestModalDepth() : int + { + return this._highestModalDepth; + } + + public function get containerList() : Array + { + return this._aContainerList; + } + + public function get strataLow() : DisplayObjectContainer + { + return this._docStrataLow; + } + + public function get strataMedium() : DisplayObjectContainer + { + return this._docStrataMedium; + } + + public function get strataHigh() : DisplayObjectContainer + { + return this._docStrataHight; + } + + public function get strataTop() : DisplayObjectContainer + { + return this._docStrataTop; + } + + public function get strataTooltip() : DisplayObjectContainer + { + return this._docStrataTooltip; + } + + public function get strataSuperTooltip() : DisplayObjectContainer + { + return this._docStrataSuperTooltip; + } + + public function get loadingUi() : Array + { + return this._aLoadingUi; + } + + public function get scale() : Number + { + return this._globalScale; + } + + public function set scale(param1:Number) : void + { + this._globalScale = param1; + this.updateUiScale(); + } + + public function get cache() : Cache + { + return this._cache; + } + + public function get verboseException() : Boolean + { + return this._verboseException; + } + + public function set verboseException(param1:Boolean) : void + { + this._verboseException = param1; + } + + public function get UISoundListeners() : Array + { + return this._UISoundListeners; + } + + public function get options() : BeriliaOptions + { + return this._bOptions; + } + + public function get applicationVersion() : uint + { + return this._applicationVersion; + } + + public function get checkModuleAuthority() : Boolean + { + return this._checkModuleAuthority; + } + + public function setDisplayOptions(param1:BeriliaOptions) : void + { + this._bOptions = param1; + } + + public function addUIListener(param1:IInterfaceListener) : void + { + FpsManager.getInstance().startTracking("ui",16525567); + var _loc2_:int = this._UISoundListeners.indexOf(param1); + if(_loc2_ == -1) + { + this._UISoundListeners.push(param1); + } + FpsManager.getInstance().stopTracking("ui"); + } + + public function removeUIListener(param1:IInterfaceListener) : void + { + FpsManager.getInstance().startTracking("ui",16525567); + var _loc2_:int = this._UISoundListeners.indexOf(param1); + if(_loc2_ >= 0) + { + this._UISoundListeners.splice(_loc2_,1); + } + FpsManager.getInstance().stopTracking("ui"); + } + + public function init(param1:Sprite, param2:Boolean, param3:uint, param4:Boolean = true) : void + { + this._docMain = param1; + this._docMain.mouseEnabled = false; + this._applicationVersion = param3; + this._checkModuleAuthority = param4; + this._docStrataWorld = new Sprite(); + this._docStrataWorld.name = "strataWorld"; + this._docStrataLow = new Sprite(); + this._docStrataLow.name = "strataLow"; + this._docStrataMedium = new Sprite(); + this._docStrataMedium.name = "strataMedium"; + this._docStrataHight = new Sprite(); + this._docStrataHight.name = "strataHight"; + this._docStrataTop = new Sprite(); + this._docStrataTop.name = "strataTop"; + this._docStrataTooltip = new Sprite(); + this._docStrataTooltip.name = "strataTooltip"; + this._docStrataSuperTooltip = new Sprite(); + this._docStrataSuperTooltip.name = "strataSuperTooltip"; + this._docStrataWorld.mouseEnabled = false; + this._docStrataLow.mouseEnabled = false; + this._docStrataMedium.mouseEnabled = false; + this._docStrataHight.mouseEnabled = false; + this._docStrataTop.mouseEnabled = false; + this._docStrataTooltip.mouseChildren = false; + this._docStrataTooltip.mouseEnabled = false; + this._docStrataSuperTooltip.mouseChildren = false; + this._docStrataSuperTooltip.mouseEnabled = false; + this._docMain.addChild(this._docStrataWorld); + this._docMain.addChild(this._docStrataLow); + this._docMain.addChild(this._docStrataMedium); + this._docMain.addChild(this._docStrataHight); + this._docMain.addChild(this._docStrataTop); + this._docMain.addChild(this._docStrataTooltip); + this._docMain.addChild(this._docStrataSuperTooltip); + this._aUiList = new Dictionary(); + this._aContainerList = new Array(); + this._aLoadingUi = new Array(); + BeriliaHookList.MouseClick; + if(SystemManager.getSingleton().os == OperatingSystem.LINUX) + { + Label.HEIGHT_OFFSET = 1; + } + } + + public function reset() : void + { + var _loc1_:String = null; + var _loc2_:Array = null; + var _loc3_:String = null; + var _loc4_:UiModule = null; + var _loc5_:UiRootContainer = null; + TimeoutHTMLLoader.resetCache(); + FpsManager.getInstance().startTracking("ui",16525567); + for(_loc1_ in _uiCache) + { + _loc5_ = _uiCache[_loc1_]; + this._aUiList[_loc1_] = _loc5_; + _loc5_.cached = false; + } + _uiCache = new Dictionary(); + _loc2_ = []; + for(_loc3_ in this._aUiList) + { + _loc2_.push(_loc3_); + } + for each(_loc3_ in _loc2_) + { + this.unloadUi(_loc3_); + } + for each(_loc4_ in UiModuleManager.getInstance().getModules()) + { + KernelEventsManager.getInstance().removeAllEventListeners("__module_" + _loc4_.id); + BindsManager.getInstance().removeAllEventListeners("__module_" + _loc4_.id); + } + UiGroupManager.getInstance().destroy(); + FpsManager.getInstance().stopTracking("ui"); + } + + public function loadUi(param1:UiModule, param2:UiData, param3:String, param4:* = null, param5:Boolean = false, param6:int = 1, param7:Boolean = false, param8:String = null) : UiRootContainer + { + var container:UiRootContainer = null; + var highestDepth:int = 0; + var uiContainer:Sprite = null; + var i:uint = 0; + var t:int = 0; + var uiModule:UiModule = param1; + var uiData:UiData = param2; + var sName:String = param3; + var properties:* = param4; + var bReplace:Boolean = param5; + var nStrata:int = param6; + var hide:Boolean = param7; + var cacheName:String = param8; + FpsManager.getInstance().startTracking("ui",16525567); + if(cacheName) + { + container = _uiCache[cacheName]; + if(container) + { + container.name = sName; + container.strata = nStrata; + highestDepth = int.MIN_VALUE; + uiContainer = Sprite(this._docMain.getChildAt(nStrata + 1)); + i = 0; + while(i < uiContainer.numChildren) + { + if(uiContainer.getChildAt(i) is UiRootContainer && UiRootContainer(uiContainer.getChildAt(i)).depth > highestDepth) + { + highestDepth = UiRootContainer(uiContainer.getChildAt(i)).depth; + } + i++; + } + if(highestDepth < 0) + { + highestDepth = 0; + } + container.depth = nStrata * 10000 + highestDepth + 1; + container.uiModule = uiModule; + DisplayObjectContainer(this._docMain.getChildAt(nStrata + 1)).addChild(container); + this._aUiList[sName] = container; + try + { + t = getTimer(); + FpsManager.getInstance().startTracking("hook",7108545); + container.uiClass.main(properties); + FpsManager.getInstance().stopTracking("hook"); + KernelEventsManager.getInstance().processCallback(BeriliaHookList.UiLoaded,sName); + } + catch(e:Error) + { + ErrorManager.addError("Impossible d\'utiliser le cache d\'interface pour " + container.name + " du module " + (container.uiModule?container.uiModule.id:"???")); + delete _uiCache[cacheName]; + true; + container.cached = false; + unloadUi(sName); + } + return null; + } + } + container = new UiRootContainer(this._docMain.stage,uiData,Sprite(this._docMain.getChildAt(nStrata + 1))); + container.name = sName; + container.strata = nStrata; + highestDepth = int.MIN_VALUE; + uiContainer = Sprite(this._docMain.getChildAt(nStrata + 1)); + i = 0; + while(i < uiContainer.numChildren) + { + if(uiContainer.getChildAt(i) is UiRootContainer && UiRootContainer(uiContainer.getChildAt(i)).depth > highestDepth) + { + highestDepth = UiRootContainer(uiContainer.getChildAt(i)).depth; + } + i++; + } + if(highestDepth < 0) + { + highestDepth = 0; + } + container.depth = nStrata * 10000 + highestDepth % 10000 + 1; + container.uiModule = uiModule; + if(cacheName) + { + container.cached = true; + _uiCache[cacheName] = container; + } + if(!container.parent && !hide) + { + DisplayObjectContainer(this._docMain.getChildAt(nStrata + 1)).addChild(container); + } + this.loadUiInside(uiData,sName,container,properties,bReplace); + FpsManager.getInstance().stopTracking("ui"); + return container; + } + + public function giveFocus(param1:UiRootContainer) : void + { + var _loc2_:* = false; + var _loc3_:Object = null; + if(param1.strata == 1) + { + _loc2_ = true; + for each(_loc3_ in this._aUiList) + { + if((_loc3_.visible) && (_loc3_.depth > param1.depth) && _loc3_.strata == 1) + { + _loc2_ = false; + } + } + if((param1.visible) && (_loc2_)) + { + StageShareManager.stage.focus = param1; + } + } + } + + public function loadUiInside(param1:UiData, param2:String, param3:UiRootContainer, param4:* = null, param5:Boolean = false) : UiRootContainer + { + if(param5) + { + this.unloadUi(param2); + } + if(this.isRegisteredUiName(param2)) + { + throw new BeriliaError(param2 + " is already used by an other UI"); + } + else + { + dispatchEvent(new UiRenderAskEvent(param2,param1)); + param3.name = param2; + this._aLoadingUi[param2] = true; + this._aUiList[param2] = param3; + param3.addEventListener(UiRenderEvent.UIRenderComplete,this.onUiLoaded); + UiRenderManager.getInstance().loadUi(param1,param3,param4); + return param3; + } + } + + public function unloadUi(param1:String, param2:Boolean = false) : Boolean + { + var ui:UiRootContainer = null; + var j:Object = null; + var linkCursor:LinkedCursorData = null; + var currObj:Object = null; + var i:Object = null; + var topUi:Object = null; + var variables:Array = null; + var varName:String = null; + var holder:Object = null; + var rootContainer:UiRootContainer = null; + var u:Object = null; + var sName:String = param1; + var forceUnload:Boolean = param2; + var startTimer:int = getTimer(); + FpsManager.getInstance().startTracking("ui",16525567); + dispatchEvent(new UiUnloadEvent(UiUnloadEvent.UNLOAD_UI_STARTED,sName)); + ui = this._aUiList[sName]; + if(ui == null) + { + return false; + } + var obj:DynamicSecureObject = new DynamicSecureObject(); + obj.cancel = false; + KernelEventsManager.getInstance().processCallback(BeriliaHookList.UiUnloading,sName,obj); + if(!forceUnload && (obj.cancel)) + { + return false; + } + if(ui.cached) + { + if(ui.parent) + { + ui.parent.removeChild(ui); + } + this.unloadUiEvents(sName,true); + ui.hideAfterLoading = true; delete this._aUiList[sName]; - this.updateHighestModalDepth(); - topUi = null; - if ((((ui.strata > 0)) && ((ui.strata < 4)))) - { - for each (u in this._aUiList) - { - if (topUi == null) - { - if ((((u.strata == 1)) && (u.visible))) - { - topUi = u; - }; - } - else - { - if ((((((u.depth > topUi.depth)) && ((u.strata == 1)))) && (u.visible))) - { - topUi = u; - }; - }; - }; - if (((!(StageShareManager.stage.focus)) || (((ui.transmitFocus) && (!((((StageShareManager.stage.focus is TextField)) || ((StageShareManager.stage.focus is ChatTextContainer))))))))) - { - StageShareManager.stage.focus = (((topUi == null)) ? StageShareManager.stage : InteractiveObject(topUi)); - }; - }; - FpsManager.getInstance().stopTracking("ui"); - KernelEventsManager.getInstance().processCallback(BeriliaHookList.UiUnloaded, sName); - dispatchEvent(new UiUnloadEvent(UiUnloadEvent.UNLOAD_UI_COMPLETE, sName)); - var stopTimer:int = getTimer(); - _log.info((((sName + " correctly unloaded in ") + (stopTimer - startTimer)) + "ms")); - return (true); - } - - public function unloadUiEvents(sName:String, useCache:Boolean=false):void - { - var currObj:Object; - var i:Object; - var j:Object; - FpsManager.getInstance().startTracking("ui", 16525567); - if (this._aUiList[sName] == null) - { - return; - }; - for (i in this._aUiList[sName].getElements()) - { - currObj = this._aUiList[sName].getElements()[i]; - if ((currObj is GraphicContainer)) - { - this._aContainerList[currObj["name"]] = null; - delete this._aContainerList[currObj["name"]]; - }; - if (!(useCache)) - { - this._aUiList[sName].getElements()[i] = null; - delete this._aUiList[sName].getElements()[i]; - }; - }; - KernelEventsManager.getInstance().removeAllEventListeners(sName); - BindsManager.getInstance().removeAllEventListeners(sName); - for (j in UIEventManager.getInstance().instances) - { - if (((((((((((!((j == null))) || (!((j == "null"))))) && (UIEventManager.getInstance().instances[j]))) && (UIEventManager.getInstance().instances[j].instance))) && (UIEventManager.getInstance().instances[j].instance.topParent))) && ((UIEventManager.getInstance().instances[j].instance.topParent.name == sName)))) - { - if (UIEventManager.getInstance().instances[j].instance.topParent.name == sName) - { - UIEventManager.getInstance().instances[j] = null; - delete UIEventManager.getInstance().instances[j]; - }; - }; - }; - FpsManager.getInstance().stopTracking("ui"); - } - - public function getUi(sName:String):UiRootContainer - { - return (this._aUiList[sName]); - } - - public function isUiDisplayed(sName:String):Boolean - { - return (!((this._aUiList[sName] == null))); - } - - public function updateUiRender():void - { - var i:String; - for (i in this.uiList) - { - UiRootContainer(this.uiList[i]).render(); - }; - } - - public function updateUiScale():void - { - var ui:UiRootContainer; - var i:String; - for (i in this.uiList) - { - ui = UiRootContainer(this.uiList[i]); - if (ui.scalable) - { - ui.scale = this.scale; - ui.render(); - }; - }; - } - - public function isRegisteredContainerId(sName:String):Boolean - { - return (!((this._aContainerList[sName] == null))); - } - - public function registerContainerId(sName:String, doc:DisplayObjectContainer):Boolean - { - if (this.isRegisteredContainerId(sName)) - { - return (false); - }; - this._aContainerList[sName] = doc; - return (true); - } - - private function onUiLoaded(ure:UiRenderEvent):void - { - delete this._aLoadingUi[ure.uiTarget.name]; - this.updateHighestModalDepth(); - dispatchEvent(ure); - KernelEventsManager.getInstance().processCallback(BeriliaHookList.UiLoaded, ure.uiTarget.name); - } - - private function updateHighestModalDepth():void - { - var uiContainer:UiRootContainer; - this._highestModalDepth = -1; - for each (uiContainer in this._aUiList) - { - if (((uiContainer.modal) && ((this._highestModalDepth < uiContainer.depth)))) - { - this._highestModalDepth = uiContainer.depth; - }; - }; - } - - private function isRegisteredUiName(sName:String):Boolean - { - return (!((this._aUiList[sName] == null))); - } - - - } -}//package com.ankamagames.berilia - + true; + if((ui.uiClass) && (ui.uiClass.unload)) + { + try + { + ui.uiClass.unload(); + } + catch(e:Error) + { + ErrorManager.addError("Une erreur est survenu dans la fonction unload() de l\'interface " + ui.name + " du module " + (ui.uiModule?ui.uiModule.id:"???")); + } + } + if((ui.transmitFocus) && (!StageShareManager.stage.focus || !(StageShareManager.stage.focus is TextField || StageShareManager.stage.focus is ChatTextContainer))) + { + StageShareManager.stage.focus = topUi == null?StageShareManager.stage:InteractiveObject(topUi); + } + KernelEventsManager.getInstance().processCallback(BeriliaHookList.UiUnloaded,sName); + return true; + } + ui.disableRender = true; + delete this._aLoadingUi[sName]; + true; + var doIt:DisplayObject = StageShareManager.stage.focus; + while(doIt) + { + if(doIt is UiRootContainer && doIt == ui) + { + StageShareManager.stage.focus = null; + break; + } + doIt = doIt.parent; + } + if(UiRootContainer(ui).uiClass) + { + if(Object(UiRootContainer(ui).uiClass).hasOwnProperty("unload")) + { + try + { + UiRootContainer(ui).uiClass.unload(); + } + catch(e:Error) + { + ErrorManager.addError("Une erreur est survenu dans la fonction unload() de l\'interface " + ui.name + " du module " + (ui.uiModule?ui.uiModule.id:"???") + ": " + e.message); + } + } + variables = DescribeTypeCache.getVariables(UiRootContainer(ui).uiClass,true,false); + for each(varName in variables) + { + if(UiRootContainer(ui).uiClass[varName] is Object) + { + if((getQualifiedClassName(UiRootContainer(ui).uiClass[varName]).indexOf("Api")) && (UiRootContainer(ui).uiClass[varName] is Object) && (Object(UiRootContainer(ui).uiClass[varName]).hasOwnProperty("destroy"))) + { + if(UiRootContainer(ui).uiModule.trusted) + { + UiRootContainer(ui).uiClass[varName].destroy(); + } + else + { + UiRootContainer(ui).uiClass[varName].destroy(SecureCenter.ACCESS_KEY); + } + } + UiRootContainer(ui).uiClass[varName] = null; + } + } + UiRootContainer(ui).uiClass = null; + } + for(j in UIEventManager.getInstance().instances) + { + if(!(j == "null") && UIEventManager.getInstance().instances[j].instance.getUi() == ui) + { + UIEventManager.getInstance().instances[j] = null; + delete UIEventManager.getInstance().instances[j]; + true; + } + } + linkCursor = LinkedCursorSpriteManager.getInstance().getItem("DragAndDrop"); + if((linkCursor) && (linkCursor.data.hasOwnProperty("currentHolder"))) + { + holder = linkCursor.data.currentHolder; + rootContainer = holder.getUi(); + if(rootContainer == ui) + { + LinkedCursorSpriteManager.getInstance().removeItem("DragAndDrop"); + HumanInputHandler.getInstance().resetClick(); + } + } + UiRootContainer(ui).remove(); + for(i in ui.getElements()) + { + currObj = ui.getElements()[i]; + if(currObj is GraphicContainer) + { + this._aContainerList[currObj["name"]] = null; + delete this._aContainerList[currObj["name"]]; + true; + } + ui.getElements()[i] = null; + delete ui.getElements()[i]; + true; + } + KernelEventsManager.getInstance().removeAllEventListeners(sName); + BindsManager.getInstance().removeAllEventListeners(sName); + UiRenderManager.getInstance().cancelRender(ui.uiData); + SecureCenter.destroy(ui); + ui.destroyUi(SecureCenter.ACCESS_KEY); + if(ApiBinder.getApiData("currentUi") == ui) + { + ApiBinder.removeApiData("currentUi"); + } + UiRootContainer(ui).free(); + delete this._aUiList[sName]; + true; + this.updateHighestModalDepth(); + topUi = null; + if(ui.strata > 0 && ui.strata < 4) + { + for each(u in this._aUiList) + { + if(topUi == null) + { + if(u.strata == 1 && (u.visible)) + { + topUi = u; + } + } + else if(u.depth > topUi.depth && u.strata == 1 && (u.visible)) + { + topUi = u; + } + + } + if(!StageShareManager.stage.focus || (ui.transmitFocus) && !(StageShareManager.stage.focus is TextField || StageShareManager.stage.focus is ChatTextContainer)) + { + StageShareManager.stage.focus = topUi == null?StageShareManager.stage:InteractiveObject(topUi); + } + } + FpsManager.getInstance().stopTracking("ui"); + KernelEventsManager.getInstance().processCallback(BeriliaHookList.UiUnloaded,sName); + dispatchEvent(new UiUnloadEvent(UiUnloadEvent.UNLOAD_UI_COMPLETE,sName)); + var stopTimer:int = getTimer(); + _log.info(sName + " correctly unloaded in " + (stopTimer - startTimer) + "ms"); + return true; + } + + public function unloadUiEvents(param1:String, param2:Boolean = false) : void + { + var _loc3_:Object = null; + var _loc4_:Object = null; + var _loc5_:Object = null; + FpsManager.getInstance().startTracking("ui",16525567); + if(this._aUiList[param1] == null) + { + return; + } + for(_loc4_ in this._aUiList[param1].getElements()) + { + _loc3_ = this._aUiList[param1].getElements()[_loc4_]; + if(_loc3_ is GraphicContainer) + { + this._aContainerList[_loc3_["name"]] = null; + delete this._aContainerList[_loc3_["name"]]; + true; + } + if(!param2) + { + this._aUiList[param1].getElements()[_loc4_] = null; + delete this._aUiList[param1].getElements()[_loc4_]; + true; + } + } + KernelEventsManager.getInstance().removeAllEventListeners(param1); + BindsManager.getInstance().removeAllEventListeners(param1); + for(_loc5_ in UIEventManager.getInstance().instances) + { + if((!(_loc5_ == null) || !(_loc5_ == "null")) && (UIEventManager.getInstance().instances[_loc5_]) && (UIEventManager.getInstance().instances[_loc5_].instance) && (UIEventManager.getInstance().instances[_loc5_].instance.topParent) && UIEventManager.getInstance().instances[_loc5_].instance.topParent.name == param1) + { + if(UIEventManager.getInstance().instances[_loc5_].instance.topParent.name == param1) + { + UIEventManager.getInstance().instances[_loc5_] = null; + delete UIEventManager.getInstance().instances[_loc5_]; + true; + } + } + } + FpsManager.getInstance().stopTracking("ui"); + } + + public function getUi(param1:String) : UiRootContainer + { + return this._aUiList[param1]; + } + + public function isUiDisplayed(param1:String) : Boolean + { + return !(this._aUiList[param1] == null); + } + + public function updateUiRender() : void + { + var _loc1_:String = null; + for(_loc1_ in this.uiList) + { + UiRootContainer(this.uiList[_loc1_]).render(); + } + } + + public function updateUiScale() : void + { + var _loc1_:UiRootContainer = null; + var _loc2_:String = null; + for(_loc2_ in this.uiList) + { + _loc1_ = UiRootContainer(this.uiList[_loc2_]); + if(_loc1_.scalable) + { + _loc1_.scale = this.scale; + _loc1_.render(); + } + } + } + + public function isRegisteredContainerId(param1:String) : Boolean + { + return !(this._aContainerList[param1] == null); + } + + public function registerContainerId(param1:String, param2:DisplayObjectContainer) : Boolean + { + if(this.isRegisteredContainerId(param1)) + { + return false; + } + this._aContainerList[param1] = param2; + return true; + } + + private function onUiLoaded(param1:UiRenderEvent) : void + { + delete this._aLoadingUi[param1.uiTarget.name]; + true; + this.updateHighestModalDepth(); + dispatchEvent(param1); + KernelEventsManager.getInstance().processCallback(BeriliaHookList.UiLoaded,param1.uiTarget.name); + } + + private function updateHighestModalDepth() : void + { + var _loc1_:UiRootContainer = null; + this._highestModalDepth = -1; + for each(_loc1_ in this._aUiList) + { + if((_loc1_.modal) && this._highestModalDepth < _loc1_.depth) + { + this._highestModalDepth = _loc1_.depth; + } + } + } + + private function isRegisteredUiName(param1:String) : Boolean + { + return !(this._aUiList[param1] == null); + } + } +} diff --git a/com/ankamagames/berilia/BeriliaConstants.as b/com/ankamagames/berilia/BeriliaConstants.as index 0af3258cb..305b4996a 100644 --- a/com/ankamagames/berilia/BeriliaConstants.as +++ b/com/ankamagames/berilia/BeriliaConstants.as @@ -1,34 +1,48 @@ -package com.ankamagames.berilia +package com.ankamagames.berilia { - import org.as3commons.bytecode.io.AbcDeserializer; - import org.as3commons.bytecode.abc.AbcFile; - import org.as3commons.bytecode.swf.SWFFileIO; - import org.as3commons.bytecode.swf.SWFFile; - import org.as3commons.bytecode.tags.DoABCTag; - import org.as3commons.bytecode.tags.FileAttributesTag; - import org.as3commons.bytecode.abc.ClassInfo; - import com.ankamagames.jerakine.types.DataStoreType; - import com.ankamagames.jerakine.types.enums.DataStoreEnum; - import com.ankamagames.jerakine.managers.StoreDataManager; - - public class BeriliaConstants - { - - private static var _include_abcDeserializer:AbcDeserializer = null; - private static var _include_abcFile:AbcFile = null; - private static var _include_swfFileIO:SWFFileIO = null; - private static var _include_swfFile:SWFFile = null; - private static var _include_doAbcTag:DoABCTag = null; - private static var _include_fileAttributesTag:FileAttributesTag = null; - private static var _include_classInfos:ClassInfo = null; - public static var DATASTORE_UI_DEFINITION:DataStoreType = new DataStoreType("Berilia_ui_definition", true, DataStoreEnum.LOCATION_LOCAL, DataStoreEnum.BIND_COMPUTER); - public static var DATASTORE_UI_VERSION:DataStoreType = new DataStoreType("Berilia_ui_version", true, DataStoreEnum.LOCATION_LOCAL, DataStoreEnum.BIND_COMPUTER); - public static var DATASTORE_UI_CSS:DataStoreType = new DataStoreType("Berilia_ui_css", true, DataStoreEnum.LOCATION_LOCAL, DataStoreEnum.BIND_COMPUTER); - public static var DATASTORE_BINDS:DataStoreType = new DataStoreType("Berilia_binds", true, DataStoreEnum.LOCATION_LOCAL, DataStoreEnum.BIND_ACCOUNT); - public static var DATASTORE_MOD:DataStoreType = new DataStoreType("Berilia_mod", true, DataStoreEnum.LOCATION_LOCAL, DataStoreEnum.BIND_CHARACTER); - public static var USE_UI_CACHE:Boolean = StoreDataManager.getInstance().getSetData(DATASTORE_UI_DEFINITION, "useCache", true); - - - } -}//package com.ankamagames.berilia - + import org.as3commons.bytecode.io.AbcDeserializer; + import org.as3commons.bytecode.abc.AbcFile; + import org.as3commons.bytecode.swf.SWFFileIO; + import org.as3commons.bytecode.swf.SWFFile; + import org.as3commons.bytecode.tags.DoABCTag; + import org.as3commons.bytecode.tags.FileAttributesTag; + import org.as3commons.bytecode.abc.ClassInfo; + import com.ankamagames.jerakine.types.DataStoreType; + import com.ankamagames.jerakine.types.enums.DataStoreEnum; + import com.ankamagames.jerakine.managers.StoreDataManager; + + public class BeriliaConstants extends Object + { + + public function BeriliaConstants() + { + super(); + } + + private static var _include_abcDeserializer:AbcDeserializer = null; + + private static var _include_abcFile:AbcFile = null; + + private static var _include_swfFileIO:SWFFileIO = null; + + private static var _include_swfFile:SWFFile = null; + + private static var _include_doAbcTag:DoABCTag = null; + + private static var _include_fileAttributesTag:FileAttributesTag = null; + + private static var _include_classInfos:ClassInfo = null; + + public static var DATASTORE_UI_DEFINITION:DataStoreType = new DataStoreType("Berilia_ui_definition",true,DataStoreEnum.LOCATION_LOCAL,DataStoreEnum.BIND_COMPUTER); + + public static var DATASTORE_UI_VERSION:DataStoreType = new DataStoreType("Berilia_ui_version",true,DataStoreEnum.LOCATION_LOCAL,DataStoreEnum.BIND_COMPUTER); + + public static var DATASTORE_UI_CSS:DataStoreType = new DataStoreType("Berilia_ui_css",true,DataStoreEnum.LOCATION_LOCAL,DataStoreEnum.BIND_COMPUTER); + + public static var DATASTORE_BINDS:DataStoreType = new DataStoreType("Berilia_binds",true,DataStoreEnum.LOCATION_LOCAL,DataStoreEnum.BIND_ACCOUNT); + + public static var DATASTORE_MOD:DataStoreType = new DataStoreType("Berilia_mod",true,DataStoreEnum.LOCATION_LOCAL,DataStoreEnum.BIND_CHARACTER); + + public static var USE_UI_CACHE:Boolean = StoreDataManager.getInstance().getSetData(DATASTORE_UI_DEFINITION,"useCache",true); + } +} diff --git a/com/ankamagames/berilia/FinalizableUIComponent.as b/com/ankamagames/berilia/FinalizableUIComponent.as index c57d307c5..7d29412f3 100644 --- a/com/ankamagames/berilia/FinalizableUIComponent.as +++ b/com/ankamagames/berilia/FinalizableUIComponent.as @@ -1,12 +1,12 @@ -package com.ankamagames.berilia +package com.ankamagames.berilia { - public interface FinalizableUIComponent extends UIComponent - { - - function get finalized():Boolean; - function set finalized(_arg_1:Boolean):void; - function finalize():void; - - } -}//package com.ankamagames.berilia - + public interface FinalizableUIComponent extends UIComponent + { + + function get finalized() : Boolean; + + function set finalized(param1:Boolean) : void; + + function finalize() : void; + } +} diff --git a/com/ankamagames/berilia/UIComponent.as b/com/ankamagames/berilia/UIComponent.as index fc0851924..af86594ff 100644 --- a/com/ankamagames/berilia/UIComponent.as +++ b/com/ankamagames/berilia/UIComponent.as @@ -1,12 +1,10 @@ -package com.ankamagames.berilia +package com.ankamagames.berilia { - import com.ankamagames.jerakine.messages.MessageHandler; - - public interface UIComponent extends MessageHandler - { - - function remove():void; - - } -}//package com.ankamagames.berilia - + import com.ankamagames.jerakine.messages.MessageHandler; + + public interface UIComponent extends MessageHandler + { + + function remove() : void; + } +} diff --git a/com/ankamagames/berilia/api/ApiBinder.as b/com/ankamagames/berilia/api/ApiBinder.as index 1b580409d..7003d6ffc 100644 --- a/com/ankamagames/berilia/api/ApiBinder.as +++ b/com/ankamagames/berilia/api/ApiBinder.as @@ -1,277 +1,296 @@ -package com.ankamagames.berilia.api +package com.ankamagames.berilia.api { - import com.ankamagames.jerakine.logger.Logger; - import com.ankamagames.jerakine.logger.Log; - import flash.utils.getQualifiedClassName; - import flash.utils.Dictionary; - import com.ankamagames.jerakine.utils.misc.DescribeTypeCache; - import com.ankamagames.berilia.managers.UiModuleManager; - import com.ankamagames.berilia.utils.errors.ApiError; - import com.ankamagames.berilia.types.data.UiModule; - import com.ankamagames.berilia.managers.SecureCenter; - import flash.system.ApplicationDomain; - import com.ankamagames.jerakine.utils.misc.CallWithParameters; - - public class ApiBinder - { - - protected static const _log:Logger = Log.getLogger(getQualifiedClassName(ApiBinder)); - private static var _apiClass:Array = new Array(); - private static var _apiInstance:Array = new Array(); - private static var _apiData:Array = new Array(); - private static var _isComplexFctCache:Dictionary = new Dictionary(); - - - public static function addApi(name:String, apiClass:Class):void - { - _apiClass[name] = apiClass; - } - - public static function removeApi(name:String):void - { - delete _apiClass[name]; - } - - public static function reset():void - { - _apiInstance = []; - _apiData = []; - } - - public static function addApiData(name:String, value:*):void - { - _apiData[name] = value; - } - - public static function getApiData(name:String) - { - return (_apiData[name]); - } - - public static function removeApiData(name:String):void - { - _apiData[name] = null; - } - - public static function initApi(target:Object, module:UiModule, sharedDefinition:ApplicationDomain=null):String - { - var api:Object; - var metaTag:XML; - var metaData:*; - var apiName:String; - var modName:String; - addApiData("module", module); - var desc:XML = DescribeTypeCache.typeDescription(target); - for each (metaTag in desc..variable) + import com.ankamagames.jerakine.logger.Logger; + import flash.utils.Dictionary; + import com.ankamagames.berilia.types.data.UiModule; + import flash.system.ApplicationDomain; + import com.ankamagames.jerakine.utils.misc.DescribeTypeCache; + import com.ankamagames.berilia.managers.UiModuleManager; + import com.ankamagames.berilia.utils.errors.ApiError; + import com.ankamagames.berilia.managers.SecureCenter; + import com.ankamagames.jerakine.utils.misc.CallWithParameters; + import com.ankamagames.jerakine.logger.Log; + import flash.utils.getQualifiedClassName; + + public class ApiBinder extends Object + { + + public function ApiBinder() + { + super(); + } + + protected static const _log:Logger = Log.getLogger(getQualifiedClassName(ApiBinder)); + + private static var _apiClass:Array = new Array(); + + private static var _apiInstance:Array = new Array(); + + private static var _apiData:Array = new Array(); + + private static var _isComplexFctCache:Dictionary = new Dictionary(); + + public static function addApi(param1:String, param2:Class) : void + { + _apiClass[param1] = param2; + } + + public static function removeApi(param1:String) : void + { + delete _apiClass[param1]; + true; + } + + public static function reset() : void + { + _apiInstance = []; + _apiData = []; + } + + public static function addApiData(param1:String, param2:*) : void + { + _apiData[param1] = param2; + } + + public static function getApiData(param1:String) : * + { + return _apiData[param1]; + } + + public static function removeApiData(param1:String) : void + { + _apiData[param1] = null; + } + + public static function initApi(param1:Object, param2:UiModule, param3:ApplicationDomain = null) : String + { + var _loc4_:Object = null; + var _loc6_:XML = null; + var _loc7_:* = undefined; + var _loc8_:String = null; + var _loc9_:String = null; + addApiData("module",param2); + var _loc5_:XML = DescribeTypeCache.typeDescription(param1); + for each(_loc6_ in _loc5_..variable) + { + for each(_loc7_ in _loc6_.metadata) { - for each (metaData in metaTag.metadata) - { - if ((((metaData.@name == "Module")) && (!(UiModuleManager.getInstance().getModules()[metaData.arg.@value])))) - { - return (metaData.arg.@value); - }; - }; - if (metaTag.@type.toString().indexOf("d2api::") == 0) - { - apiName = metaTag.@type.toString(); - apiName = apiName.substr(7, (apiName.length - 10)); - api = getApiInstance(apiName, module.trusted, sharedDefinition); - module.apiList.push(api); - target[metaTag.@name] = api; - } - else - { - for each (metaData in metaTag.metadata) - { - if (metaData.@name == "Api") - { - if (metaData.arg.@key == "name") - { - api = getApiInstance(metaData.arg.@value, module.trusted, sharedDefinition); - module.apiList.push(api); - target[metaTag.@name] = api; - } - else - { - throw (new ApiError((((module.id + ' module, unknow property "') + metaTag..metadata.arg.@key) + '" in Api tag'))); - }; - }; - if (metaData.@name == "Module") - { - if (metaData.arg.@key == "name") - { - modName = metaData.arg.@value; - if (!(UiModuleManager.getInstance().getModules()[modName])) - { - throw (new ApiError((((("Module " + modName) + " does not exist (in ") + module.id) + ")"))); - }; - if (((((((module.trusted) || ((modName == "Ankama_Common")))) || ((modName == "Ankama_ContextMenu")))) || (!(UiModuleManager.getInstance().getModules()[modName].trusted)))) - { - target[metaTag.@name] = new ModuleReference(UiModule(UiModuleManager.getInstance().getModules()[modName]).mainClass, SecureCenter.ACCESS_KEY); - } - else - { - throw (new ApiError(((module.id + ", untrusted module cannot acces to trusted modules ") + modName))); - }; - } - else - { - throw (new ApiError((((module.id + ' module, unknow property "') + metaData.arg.@key) + '" in Api tag'))); - }; - }; - }; - }; - }; - return (null); - } - - private static function getApiInstance(name:String, trusted:Boolean, sharedDefinition:ApplicationDomain):Object - { - var apiDesc:XML; - var api:Object; - var apiRef:* = undefined; - var instancied:Boolean; - var meta:XML; - var tag:String; - var help:String; - var boxing:Boolean; - var method:XML; - var accessor:XML; - var metaData:XML; - var metaData2:* = undefined; - if (((_apiInstance[name]) && (_apiInstance[name][trusted]))) + if(_loc7_.@name == "Module" && !UiModuleManager.getInstance().getModules()[_loc7_.arg.@value]) + { + return _loc7_.arg.@value; + } + } + if(_loc6_.@type.toString().indexOf("d2api::") == 0) { - return (_apiInstance[name][trusted]); - }; - if (_apiClass[name]) + _loc8_ = _loc6_.@type.toString(); + _loc8_ = _loc8_.substr(7,_loc8_.length - 10); + _loc4_ = getApiInstance(_loc8_,param2.trusted,param3); + param2.apiList.push(_loc4_); + param1[_loc6_.@name] = _loc4_; + } + else { - apiDesc = DescribeTypeCache.typeDescription(_apiClass[name]); - api = new ((sharedDefinition.getDefinition((("d2api::" + name) + "Api")) as Class))(); - apiRef = _apiClass[name]; - instancied = false; - for each (meta in apiDesc..metadata) - { - if (meta.@name == "InstanciedApi") - { - apiRef = new (_apiClass[name])(); - instancied = true; - break; - }; - }; - for each (method in apiDesc..method) - { - boxing = true; - for each (metaData in method.metadata) - { - if ((((((metaData.@name == "Untrusted")) || ((metaData.@name == "Trusted")))) || ((metaData.@name == "Deprecated")))) - { - tag = metaData.@name; - if (metaData.@name == "Deprecated") - { - help = metaData.arg.(@key == "help").@value; - }; - }; - if (metaData.@name == "NoBoxing") + for each(_loc7_ in _loc6_.metadata) + { + if(_loc7_.@name == "Api") + { + if(_loc7_.arg.@key == "name") + { + _loc4_ = getApiInstance(_loc7_.arg.@value,param2.trusted,param3); + param2.apiList.push(_loc4_); + param1[_loc6_.@name] = _loc4_; + } + else + { + throw new ApiError(param2.id + " module, unknow property \"" + _loc6_..metadata.arg.@key + "\" in Api tag"); + } + } + if(_loc7_.@name == "Module") + { + if(_loc7_.arg.@key == "name") + { + _loc9_ = _loc7_.arg.@value; + if(!UiModuleManager.getInstance().getModules()[_loc9_]) { - boxing = false; - }; - }; - if (((((!((tag == "Untrusted"))) && (!((tag == "Trusted"))))) && (!((tag == "Deprecated"))))) - { - throw (new ApiError(((('Missing tag [Untrusted / Trusted] before function "' + method.@name) + '" in ') + _apiClass[name]))); - }; - if ((((tag == "Untrusted")) || ((((((tag == "Trusted")) || ((tag == "Deprecated")))) && (trusted))))) - { - if (tag == "Deprecated") - { - api[method.@name] = createDepreciatedMethod(apiRef[method.@name], method.@name, help); + throw new ApiError("Module " + _loc9_ + " does not exist (in " + param2.id + ")"); } else { - if (((boxing) && (!(isComplexFct(method))))) - { - api[method.@name] = SecureCenter.secure(apiRef[method.@name]); - } - else - { - api[method.@name] = apiRef[method.@name]; - }; - }; - } - else - { - api[method.@name] = GenericApiFunction.getRestrictedFunctionAccess(apiRef[method.@name]); - }; - }; - for each (accessor in apiDesc..accessor) - { - for each (metaData2 in accessor.metadata) - { - if (metaData2.@name == "ApiData") - { - apiRef[accessor.@name] = _apiData[metaData2.arg.@value]; - break; - }; - }; - }; - if (!(instancied)) - { - if (!(_apiInstance[name])) - { - _apiInstance[name] = new Array(); - }; - _apiInstance[name][trusted] = api; - }; - return (api); - }; - _log.error((("Api [" + name) + "] is not avaible")); - return (null); - } - - private static function isComplexFct(methodDesc:XML):Boolean - { - var paramType:String; - var cacheKey:String = ((methodDesc.@declaredBy + "_") + methodDesc.@name); - if (_isComplexFctCache[cacheKey] != null) + if((param2.trusted) || _loc9_ == "Ankama_Common" || _loc9_ == "Ankama_ContextMenu" || !UiModuleManager.getInstance().getModules()[_loc9_].trusted) + { + param1[_loc6_.@name] = new ModuleReference(UiModule(UiModuleManager.getInstance().getModules()[_loc9_]).mainClass,SecureCenter.ACCESS_KEY); + continue; + } + throw new ApiError(param2.id + ", untrusted module cannot acces to trusted modules " + _loc9_); + } + } + else + { + throw new ApiError(param2.id + " module, unknow property \"" + _loc7_.arg.@key + "\" in Api tag"); + } + } + else + { + continue; + } + } + } + } + return null; + } + + private static function getApiInstance(param1:String, param2:Boolean, param3:ApplicationDomain) : Object + { + var apiDesc:XML = null; + var api:Object = null; + var apiRef:* = undefined; + var instancied:Boolean = false; + var meta:XML = null; + var tag:String = null; + var help:String = null; + var boxing:Boolean = false; + var method:XML = null; + var accessor:XML = null; + var metaData:XML = null; + var metaData2:* = undefined; + var name:String = param1; + var trusted:Boolean = param2; + var sharedDefinition:ApplicationDomain = param3; + if((_apiInstance[name]) && (_apiInstance[name][trusted])) + { + return _apiInstance[name][trusted]; + } + if(_apiClass[name]) + { + apiDesc = DescribeTypeCache.typeDescription(_apiClass[name]); + api = new (sharedDefinition.getDefinition("d2api::" + name + "Api") as Class)(); + apiRef = _apiClass[name]; + instancied = false; + for each(meta in apiDesc..metadata) + { + if(meta.@name == "InstanciedApi") + { + apiRef = new _apiClass[name](); + instancied = true; + break; + } + } + for each(method in apiDesc..method) + { + boxing = true; + for each(metaData in method.metadata) + { + if(metaData.@name == "Untrusted" || metaData.@name == "Trusted" || metaData.@name == "Deprecated") + { + tag = metaData.@name; + if(metaData.@name == "Deprecated") + { + help = metaData.arg.(@key == "help").@value; + } + } + if(metaData.@name == "NoBoxing") + { + boxing = false; + } + } + if(!(tag == "Untrusted") && !(tag == "Trusted") && !(tag == "Deprecated")) + { + throw new ApiError("Missing tag [Untrusted / Trusted] before function \"" + method.@name + "\" in " + _apiClass[name]); + } + else + { + if(tag == "Untrusted" || (tag == "Trusted" || tag == "Deprecated") && (trusted)) + { + if(tag == "Deprecated") + { + api[method.@name] = createDepreciatedMethod(apiRef[method.@name],method.@name,help); + } + else if((boxing) && !isComplexFct(method)) + { + api[method.@name] = SecureCenter.secure(apiRef[method.@name]); + } + else + { + api[method.@name] = apiRef[method.@name]; + } + + } + else + { + api[method.@name] = GenericApiFunction.getRestrictedFunctionAccess(apiRef[method.@name]); + } + continue; + } + } + for each(accessor in apiDesc..accessor) + { + for each(metaData2 in accessor.metadata) + { + if(metaData2.@name == "ApiData") + { + apiRef[accessor.@name] = _apiData[metaData2.arg.@value]; + break; + } + } + } + if(!instancied) { - return (_isComplexFctCache[cacheKey]); - }; - var simpleType:Array = ["int", "uint", "Number", "Boolean", "String", "void"]; - if (simpleType.indexOf(methodDesc.@returnType.toString()) == -1) + if(!_apiInstance[name]) + { + _apiInstance[name] = new Array(); + } + _apiInstance[name][trusted] = api; + } + return api; + } + _log.error("Api [" + name + "] is not avaible"); + return null; + } + + private static function isComplexFct(param1:XML) : Boolean + { + var _loc4_:String = null; + var _loc2_:String = param1.@declaredBy + "_" + param1.@name; + if(_isComplexFctCache[_loc2_] != null) + { + return _isComplexFctCache[_loc2_]; + } + var _loc3_:Array = ["int","uint","Number","Boolean","String","void"]; + if(_loc3_.indexOf(param1.@returnType.toString()) == -1) + { + _isComplexFctCache[_loc2_] = false; + return false; + } + for each(_loc4_ in param1..parameter..@type) + { + if(_loc3_.indexOf(_loc4_) == -1) { - _isComplexFctCache[cacheKey] = false; - return (false); - }; - for each (paramType in methodDesc..parameter..@type) + _isComplexFctCache[_loc2_] = false; + return false; + } + } + _isComplexFctCache[_loc2_] = true; + return true; + } + + private static function createDepreciatedMethod(param1:Function, param2:String, param3:String) : Function + { + var fct:Function = param1; + var fctName:String = param2; + var help:String = param3; + return function(... rest):* + { + var _loc2_:* = new Error(); + if(_loc2_.getStackTrace()) { - if (simpleType.indexOf(paramType) == -1) - { - _isComplexFctCache[cacheKey] = false; - return (false); - }; - }; - _isComplexFctCache[cacheKey] = true; - return (true); - } - - private static function createDepreciatedMethod(fct:Function, fctName:String, help:String):Function - { - return (function (... args) + _log.fatal(fctName + " is a deprecated api function, called at " + _loc2_.getStackTrace().split("at ")[2] + (help.length?help + "\n":"")); + } + else { - var e:* = new Error(); - if (e.getStackTrace()) - { - _log.fatal((((fctName + " is a deprecated api function, called at ") + e.getStackTrace().split("at ")[2]) + ((help.length) ? (help + "\n") : ""))); - } - else - { - _log.fatal((fctName + " is a deprecated api function. No stack trace available")); - }; - return (CallWithParameters.callR(fct, args)); - }); - } - - - } -}//package com.ankamagames.berilia.api - + _log.fatal(fctName + " is a deprecated api function. No stack trace available"); + } + return CallWithParameters.callR(fct,rest); + }; + } + } +} diff --git a/com/ankamagames/berilia/api/GenericApiFunction.as b/com/ankamagames/berilia/api/GenericApiFunction.as index 126245056..269a01f2b 100644 --- a/com/ankamagames/berilia/api/GenericApiFunction.as +++ b/com/ankamagames/berilia/api/GenericApiFunction.as @@ -1,38 +1,40 @@ -package com.ankamagames.berilia.api +package com.ankamagames.berilia.api { - import com.ankamagames.berilia.utils.errors.UntrustedApiCallError; - import com.ankamagames.berilia.managers.SecureCenter; - - public class GenericApiFunction - { - - - public static function throwUntrustedCallError(... args):void - { - throw (new UntrustedApiCallError("Unstrusted script called a trusted method")); - } - - public static function getRestrictedFunctionAccess(target:Function):Function - { - return (function (... args) + import com.ankamagames.berilia.utils.errors.UntrustedApiCallError; + import com.ankamagames.berilia.managers.SecureCenter; + + public class GenericApiFunction extends Object + { + + public function GenericApiFunction() + { + super(); + } + + public static function throwUntrustedCallError(... rest) : void + { + throw new UntrustedApiCallError("Unstrusted script called a trusted method"); + } + + public static function getRestrictedFunctionAccess(param1:Function) : Function + { + var target:Function = param1; + return function(... rest):* + { + var _loc4_:* = undefined; + var _loc2_:* = SecureCenter.ACCESS_KEY; + var _loc3_:* = 0; + for each(_loc4_ in rest) { - var arg:*; - var accessKey:* = SecureCenter.ACCESS_KEY; - var i:* = 0; - for each (arg in args) - { - if (arg == accessKey) - { - args.splice(i, 1); - return (target.apply(null, args)); - }; - i++; - }; - throw (new UntrustedApiCallError("Unstrusted script called a trusted method")); - }); - } - - - } -}//package com.ankamagames.berilia.api - + if(_loc4_ == _loc2_) + { + rest.splice(_loc3_,1); + return target.apply(null,rest); + } + _loc3_++; + } + throw new UntrustedApiCallError("Unstrusted script called a trusted method"); + }; + } + } +} diff --git a/com/ankamagames/berilia/api/ModuleReference.as b/com/ankamagames/berilia/api/ModuleReference.as index 874ae6b95..f85bf5881 100644 --- a/com/ankamagames/berilia/api/ModuleReference.as +++ b/com/ankamagames/berilia/api/ModuleReference.as @@ -1,72 +1,75 @@ -package com.ankamagames.berilia.api +package com.ankamagames.berilia.api { - import flash.utils.Proxy; - import com.ankamagames.jerakine.interfaces.Secure; - import com.ankamagames.jerakine.utils.memory.WeakReference; - import com.ankamagames.berilia.managers.SecureCenter; - import flash.errors.IllegalOperationError; - import flash.utils.getQualifiedClassName; - import flash.utils.flash_proxy; - - use namespace flash.utils.flash_proxy; - - public class ModuleReference extends Proxy implements Secure - { - - private var _object:WeakReference; - - public function ModuleReference(o:Object, accessKey:Object) - { - SecureCenter.checkAccessKey(accessKey); - this._object = new WeakReference(o); - } - - public function getObject(accessKey:Object) - { - if (accessKey != SecureCenter.ACCESS_KEY) - { - throw (new IllegalOperationError()); - }; - return (this._object.object); - } - - override flash_proxy function callProperty(name:*, ... rest) - { - var result:* = this._object.object[name].apply(this, rest); - this.verify(result); - return (result); - } - - override flash_proxy function getProperty(name:*) - { - var result:* = this._object.object[name]; - if ((result is Function)) - { - return (result); - }; - throw (new IllegalOperationError("You cannot access to property. You have access only to functions")); - } - - override flash_proxy function setProperty(name:*, value:*):void - { - throw (new IllegalOperationError("You cannot access to property. You have access only to functions")); - } - - override flash_proxy function hasProperty(name:*):Boolean - { - return (this._object.object.hasOwnProperty(name)); - } - - private function verify(o:*):void - { - var pkg:String = getQualifiedClassName(o); - if (pkg.indexOf("d2api") == 0) - { - throw (new IllegalOperationError("You cannot get API from an other module")); - }; - } - - - } -}//package com.ankamagames.berilia.api - + import flash.utils.Proxy; + import com.ankamagames.jerakine.interfaces.Secure; + import com.ankamagames.jerakine.utils.memory.WeakReference; + import com.ankamagames.berilia.managers.SecureCenter; + import flash.errors.IllegalOperationError; + import flash.utils.flash_proxy; + import flash.utils.getQualifiedClassName; + + public class ModuleReference extends Proxy implements Secure + { + + public function ModuleReference(param1:Object, param2:Object) + { + super(); + SecureCenter.checkAccessKey(param2); + this._object = new WeakReference(param1); + } + + private var _object:WeakReference; + + public function getObject(param1:Object) : * + { + if(param1 != SecureCenter.ACCESS_KEY) + { + throw new IllegalOperationError(); + } + else + { + return this._object.object; + } + } + + override flash_proxy function callProperty(param1:*, ... rest) : * + { + var _loc3_:* = this._object.object[param1].apply(this,rest); + this.verify(_loc3_); + return _loc3_; + } + + override flash_proxy function getProperty(param1:*) : * + { + var _loc2_:* = this._object.object[param1]; + if(_loc2_ is Function) + { + return _loc2_; + } + throw new IllegalOperationError("You cannot access to property. You have access only to functions"); + } + + override flash_proxy function setProperty(param1:*, param2:*) : void + { + throw new IllegalOperationError("You cannot access to property. You have access only to functions"); + } + + override flash_proxy function hasProperty(param1:*) : Boolean + { + return this._object.object.hasOwnProperty(param1); + } + + private function verify(param1:*) : void + { + var _loc2_:String = getQualifiedClassName(param1); + if(_loc2_.indexOf("d2api") == 0) + { + throw new IllegalOperationError("You cannot get API from an other module"); + } + else + { + return; + } + } + } +} diff --git a/com/ankamagames/berilia/api/ReadOnlyObject.as b/com/ankamagames/berilia/api/ReadOnlyObject.as index e17469332..88319c38c 100644 --- a/com/ankamagames/berilia/api/ReadOnlyObject.as +++ b/com/ankamagames/berilia/api/ReadOnlyObject.as @@ -1,241 +1,250 @@ -package com.ankamagames.berilia.api +package com.ankamagames.berilia.api { - import flash.utils.Proxy; - import com.ankamagames.jerakine.interfaces.Secure; - import flash.utils.Dictionary; - import com.ankamagames.jerakine.logger.Logger; - import com.ankamagames.jerakine.logger.Log; - import flash.utils.getQualifiedClassName; - import com.ankamagames.berilia.managers.SecureCenter; - import com.ankamagames.jerakine.utils.misc.DescribeTypeCache; - import flash.errors.IllegalOperationError; - import com.ankamagames.jerakine.utils.misc.CallWithParameters; - import com.ankamagames.jerakine.interfaces.ISecurizable; - import com.ankamagames.jerakine.interfaces.ICustomSecureObject; - import __AS3__.vec.*; - import flash.utils.flash_proxy; - - use namespace flash.utils.flash_proxy; - - public dynamic class ReadOnlyObject extends Proxy implements Secure - { - - public static var MEMORY_LOG:Dictionary = new Dictionary(true); - private static const _createdObjectProperties:Dictionary = new Dictionary(true); - private static const _log:Logger = Log.getLogger(getQualifiedClassName(ReadOnlyObject)); - private static const _readOnlyObjectList:Dictionary = new Dictionary(true); - private static const _readOnlyObjectExist:Dictionary = new Dictionary(true); - - private var _object:Object; - private var _getQualifiedClassName:String; - private var _properties:Array; - private var _simplyfiedQualifiedClassName:String; - private var _testHaveOP:Boolean = true; - - public function ReadOnlyObject(o:Object, accessKey:Object) - { - SecureCenter.checkAccessKey(accessKey); - this._object = o; - this._getQualifiedClassName = getQualifiedClassName(o); - if (!(((this._properties) && ((((o is Array)) || ((o is Vector.<*>))))))) - { - this._properties = DescribeTypeCache.getVariables(this._object); - if (((_createdObjectProperties[this._getQualifiedClassName]) || ((this._getQualifiedClassName == "Object")))) - { - return; - }; - _createdObjectProperties[this._getQualifiedClassName] = DescribeTypeCache.getVariables(this._object); - this._properties = _createdObjectProperties[this._getQualifiedClassName]; - }; - MEMORY_LOG[this] = 1; - } - - public static function create(o:Object):ReadOnlyObject - { - var roo:*; - if ((o is ReadOnlyObject)) - { - return ((o as ReadOnlyObject)); - }; - if (_readOnlyObjectExist[o]) - { - for (roo in _readOnlyObjectList) - { - if (((roo) && ((roo._object == o)))) - { - return (roo); - }; - }; - }; - var newReadOnlyObject:ReadOnlyObject = new (ReadOnlyObject)(o, SecureCenter.ACCESS_KEY); - _readOnlyObjectList[newReadOnlyObject] = true; - _readOnlyObjectExist[o] = true; - return (newReadOnlyObject); - } - - - public function get simplyfiedQualifiedClassName():String - { - var splitedClassName:Array; - if (this._simplyfiedQualifiedClassName == null) - { - splitedClassName = this._getQualifiedClassName.split("::"); - this._simplyfiedQualifiedClassName = splitedClassName[(splitedClassName.length - 1)]; - }; - return (this._simplyfiedQualifiedClassName); - } - - public function getObject(accessKey:Object) - { - if (accessKey != SecureCenter.ACCESS_KEY) - { - throw (new IllegalOperationError()); - }; - return (this._object); - } - - override flash_proxy function callProperty(name:*, ... rest) - { - var haveOP:Boolean; - switch (QName(name).localName) - { - case "toString": - try - { - if (!(this._testHaveOP)) - { - haveOP = this._object.hasOwnProperty("toString"); - }; - } - catch(e:Error) - { - haveOP = false; - _testHaveOP = false; - }; - if (haveOP) - { - return (CallWithParameters.callR(this._object.toString, rest)); - }; - return ((this._object + "")); - case "getBounds": - return (this._object[name](SecureCenter.unsecure(rest[0]))); - case "hasOwnProperty": - return (CallWithParameters.callR(this._object.hasOwnProperty, rest)); - case "propertyIsEnumerable": - return (CallWithParameters.callR(this._object.propertyIsEnumerable, rest)); - case "indexOf": - if ((((((((((((((this._object is Dictionary)) || ((this._object is Array)))) || ((this._object is Vector.<*>)))) || ((this._object is Vector.)))) || ((this._object is Vector.)))) || ((this._object is Vector.)))) || ((this._object is Vector.)))) - { - return (CallWithParameters.callR(this._object.indexOf, rest)); - }; - _log.error("Try to use 'indexOf' method on a simple ReadOnlyObject."); - return (null); - }; - var e:Error = new Error(); - if (e.getStackTrace()) - { - _log.error(((("Cannot call method on ReadOnlyObject : " + name) + ", ") + e.getStackTrace().split("at ")[2])); + import flash.utils.Proxy; + import com.ankamagames.jerakine.interfaces.Secure; + import flash.utils.Dictionary; + import com.ankamagames.jerakine.logger.Logger; + import com.ankamagames.berilia.managers.SecureCenter; + import com.ankamagames.jerakine.logger.Log; + import flash.utils.getQualifiedClassName; + import flash.errors.IllegalOperationError; + import flash.utils.flash_proxy; + import com.ankamagames.jerakine.utils.misc.CallWithParameters; + import com.ankamagames.jerakine.interfaces.ISecurizable; + import com.ankamagames.jerakine.interfaces.ICustomSecureObject; + import com.ankamagames.jerakine.utils.misc.DescribeTypeCache; + + public dynamic class ReadOnlyObject extends Proxy implements Secure + { + + public function ReadOnlyObject(param1:Object, param2:Object) + { + super(); + SecureCenter.checkAccessKey(param2); + this._object = param1; + this._getQualifiedClassName = getQualifiedClassName(param1); + if(!(this._properties && (param1 is Array || param1 is Vector.<*>))) + { + this._properties = DescribeTypeCache.getVariables(this._object); + if((_createdObjectProperties[this._getQualifiedClassName]) || this._getQualifiedClassName == "Object") + { + return; } - else - { - _log.error((("Cannot call method on ReadOnlyObject : " + name) + ", no stack trace available")); - }; - return (null); - } - - override flash_proxy function getProperty(name:*) - { - if (this._object[name] === null) - { - return (null); - }; - var o:* = this._object[name]; - switch (true) - { - case (o is uint): - case (o is int): - case (o is Number): - case (o is String): - case (o is Boolean): - return (o); - case (o == null): - case (o == undefined): - case (o is Secure): - return (o); - case (o is ISecurizable): - return ((o as ISecurizable).getSecureObject()); - }; - return (SecureCenter.secure(o)); - } - - override flash_proxy function nextNameIndex(index:int):int - { - var x:*; - if ((((index == 0)) && ((((((((((((((this._object is Dictionary)) || ((this._object is Array)))) || ((this._object is Vector.<*>)))) || ((this._object is Vector.)))) || ((this._object is Vector.)))) || ((this._object is Vector.)))) || ((this._object is Vector.)))))) - { - this._properties = new Array(); - for (x in this._object) - { - this._properties.push(x); - }; - }; - if (index < this._properties.length) - { - return ((index + 1)); - }; - return (0); - } - - override flash_proxy function nextValue(index:int) - { - var prop:* = this._properties[(index - 1)]; - var o:* = this._object[prop]; - switch (true) - { - case (o == null): - case (o is uint): - case (o is int): - case (o is Number): - case (o is String): - case (o is Boolean): - case (o == undefined): - case (o is Secure): - return (o); - case (o is ISecurizable): - return ((o as ISecurizable).getSecureObject()); - }; - return (SecureCenter.secure(o)); - } - - override flash_proxy function nextName(index:int):String - { - return (this._properties[(index - 1)]); - } - - override flash_proxy function setProperty(name:*, value:*):void - { - if ((((this._object is ICustomSecureObject)) && (DescribeTypeCache.getTags(this._object)[name.localName]["Untrusted"]))) - { - this._object[name] = value; - return; - }; - var e:Error = new Error(); - if (e.getStackTrace()) - { - _log.error(((("Cannot set property on ReadOnlyObject : " + name) + ", ") + e.getStackTrace().split("at ")[2])); + _createdObjectProperties[this._getQualifiedClassName] = DescribeTypeCache.getVariables(this._object); + this._properties = _createdObjectProperties[this._getQualifiedClassName]; + } + MEMORY_LOG[this] = 1; + } + + public static var MEMORY_LOG:Dictionary = new Dictionary(true); + + private static const _createdObjectProperties:Dictionary = new Dictionary(true); + + private static const _log:Logger = Log.getLogger(getQualifiedClassName(ReadOnlyObject)); + + private static const _readOnlyObjectList:Dictionary = new Dictionary(true); + + private static const _readOnlyObjectExist:Dictionary = new Dictionary(true); + + public static function create(param1:Object) : ReadOnlyObject + { + var _loc3_:* = undefined; + if(param1 is ReadOnlyObject) + { + return param1 as ReadOnlyObject; + } + if(_readOnlyObjectExist[param1]) + { + for(_loc3_ in _readOnlyObjectList) + { + if((_loc3_) && _loc3_._object == param1) + { + return _loc3_; + } } - else - { - _log.error((("Cannot set property on ReadOnlyObject : " + name) + ", no stack trace available")); - }; - } - - override flash_proxy function hasProperty(name:*):Boolean - { - return (this._object.hasOwnProperty(name)); - } - - - } -}//package com.ankamagames.berilia.api - + } + var _loc2_:ReadOnlyObject = new ReadOnlyObject(param1,SecureCenter.ACCESS_KEY); + _readOnlyObjectList[_loc2_] = true; + _readOnlyObjectExist[param1] = true; + return _loc2_; + } + + private var _object:Object; + + private var _getQualifiedClassName:String; + + private var _properties:Array; + + private var _simplyfiedQualifiedClassName:String; + + public function get simplyfiedQualifiedClassName() : String + { + var _loc1_:Array = null; + if(this._simplyfiedQualifiedClassName == null) + { + _loc1_ = this._getQualifiedClassName.split("::"); + this._simplyfiedQualifiedClassName = _loc1_[_loc1_.length - 1]; + } + return this._simplyfiedQualifiedClassName; + } + + public function getObject(param1:Object) : * + { + if(param1 != SecureCenter.ACCESS_KEY) + { + throw new IllegalOperationError(); + } + else + { + return this._object; + } + } + + private var _testHaveOP:Boolean = true; + + override flash_proxy function callProperty(param1:*, ... rest) : * + { + var haveOP:Boolean = false; + var name:* = param1; + switch(QName(name).localName) + { + case "toString": + try + { + if(!this._testHaveOP) + { + haveOP = this._object.hasOwnProperty("toString"); + } + } + catch(e:Error) + { + haveOP = false; + _testHaveOP = false; + } + if(haveOP) + { + return CallWithParameters.callR(this._object.toString,rest); + } + return this._object + ""; + case "getBounds": + return this._object[name](SecureCenter.unsecure(rest[0])); + case "hasOwnProperty": + return CallWithParameters.callR(this._object.hasOwnProperty,rest); + case "propertyIsEnumerable": + return CallWithParameters.callR(this._object.propertyIsEnumerable,rest); + case "indexOf": + if(this._object is Dictionary || this._object is Array || this._object is Vector.<*> || this._object is Vector. || this._object is Vector. || this._object is Vector. || this._object is Vector.) + { + return CallWithParameters.callR(this._object.indexOf,rest); + } + _log.error("Try to use \'indexOf\' method on a simple ReadOnlyObject."); + return null; + default: + var e:Error = new Error(); + if(e.getStackTrace()) + { + _log.error("Cannot call method on ReadOnlyObject : " + name + ", " + e.getStackTrace().split("at ")[2]); + } + else + { + _log.error("Cannot call method on ReadOnlyObject : " + name + ", no stack trace available"); + } + return null; + } + } + + override flash_proxy function getProperty(param1:*) : * + { + if(this._object[param1] === null) + { + return null; + } + var _loc2_:* = this._object[param1]; + switch(true) + { + case _loc2_ is uint: + case _loc2_ is int: + case _loc2_ is Number: + case _loc2_ is String: + case _loc2_ is Boolean: + return _loc2_; + case _loc2_ == null: + case _loc2_ == undefined: + case _loc2_ is Secure: + return _loc2_; + case _loc2_ is ISecurizable: + return (_loc2_ as ISecurizable).getSecureObject(); + default: + return SecureCenter.secure(_loc2_); + } + } + + override flash_proxy function nextNameIndex(param1:int) : int + { + var _loc2_:* = undefined; + if(param1 == 0 && (this._object is Dictionary || this._object is Array || this._object is Vector.<*> || this._object is Vector. || this._object is Vector. || this._object is Vector. || this._object is Vector.)) + { + this._properties = new Array(); + for(_loc2_ in this._object) + { + this._properties.push(_loc2_); + } + } + if(param1 < this._properties.length) + { + return param1 + 1; + } + return 0; + } + + override flash_proxy function nextValue(param1:int) : * + { + var _loc2_:* = this._properties[param1 - 1]; + var _loc3_:* = this._object[_loc2_]; + switch(true) + { + case _loc3_ == null: + case _loc3_ is uint: + case _loc3_ is int: + case _loc3_ is Number: + case _loc3_ is String: + case _loc3_ is Boolean: + case _loc3_ == undefined: + case _loc3_ is Secure: + return _loc3_; + case _loc3_ is ISecurizable: + return (_loc3_ as ISecurizable).getSecureObject(); + default: + return SecureCenter.secure(_loc3_); + } + } + + override flash_proxy function nextName(param1:int) : String + { + return this._properties[param1 - 1]; + } + + override flash_proxy function setProperty(param1:*, param2:*) : void + { + if(this._object is ICustomSecureObject && (DescribeTypeCache.getTags(this._object)[param1.localName]["Untrusted"])) + { + this._object[param1] = param2; + return; + } + var _loc3_:Error = new Error(); + if(_loc3_.getStackTrace()) + { + _log.error("Cannot set property on ReadOnlyObject : " + param1 + ", " + _loc3_.getStackTrace().split("at ")[2]); + } + else + { + _log.error("Cannot set property on ReadOnlyObject : " + param1 + ", no stack trace available"); + } + } + + override flash_proxy function hasProperty(param1:*) : Boolean + { + return this._object.hasOwnProperty(param1); + } + } +} diff --git a/com/ankamagames/berilia/api/UiApi.as b/com/ankamagames/berilia/api/UiApi.as index cf3d741d3..3be9be165 100644 --- a/com/ankamagames/berilia/api/UiApi.as +++ b/com/ankamagames/berilia/api/UiApi.as @@ -1,800 +1,772 @@ -package com.ankamagames.berilia.api +package com.ankamagames.berilia.api { - import com.ankamagames.berilia.interfaces.IApi; - import flash.utils.Dictionary; - import com.ankamagames.jerakine.logger.Logger; - import com.ankamagames.jerakine.logger.Log; - import flash.utils.getQualifiedClassName; - import com.ankamagames.berilia.components.Label; - import com.ankamagames.berilia.types.data.UiModule; - import com.ankamagames.berilia.types.graphic.UiRootContainer; - import flash.geom.Rectangle; - import com.ankamagames.berilia.managers.UiModuleManager; - import com.ankamagames.berilia.utils.errors.BeriliaError; - import com.ankamagames.berilia.utils.errors.ApiError; - import com.ankamagames.berilia.Berilia; - import com.ankamagames.jerakine.handlers.FocusHandler; - import com.ankamagames.berilia.managers.SecureCenter; - import com.ankamagames.jerakine.utils.display.StageShareManager; - import com.ankamagames.berilia.types.graphic.GraphicContainer; - import __AS3__.vec.Vector; - import com.ankamagames.jerakine.managers.StoreDataManager; - import com.ankamagames.berilia.BeriliaConstants; - import com.ankamagames.berilia.managers.BindsManager; - import com.ankamagames.berilia.types.shortcut.Shortcut; - import com.ankamagames.berilia.types.listener.GenericListener; - import com.ankamagames.jerakine.utils.memory.WeakReference; - import com.ankamagames.berilia.types.event.InstanceEvent; - import com.ankamagames.berilia.managers.UIEventManager; - import flash.display.DisplayObject; - import com.ankamagames.berilia.components.ComponentInternalAccessor; - import com.ankamagames.berilia.components.Texture; - import com.ankamagames.jerakine.utils.misc.CallWithParameters; - import flash.utils.getDefinitionByName; - import com.ankamagames.berilia.enums.EventEnums; - import com.ankamagames.jerakine.types.Uri; - import com.ankamagames.berilia.types.tooltip.Tooltip; - import com.ankamagames.berilia.managers.TooltipManager; - import com.ankamagames.berilia.types.data.TextTooltipInfo; - import com.ankamagames.berilia.types.data.RadioGroup; - import com.ankamagames.berilia.interfaces.IRadioItem; - import com.ankamagames.jerakine.utils.display.KeyPoll; - import com.ankamagames.berilia.types.data.TreeData; - import com.ankamagames.berilia.types.data.LinkedCursorData; - import flash.geom.Point; - import com.ankamagames.berilia.managers.LinkedCursorSpriteManager; - import com.ankamagames.berilia.types.data.SlotDragAndDropData; - import com.ankamagames.berilia.managers.KernelEventsManager; - import com.ankamagames.berilia.utils.BeriliaHookList; - import com.ankamagames.berilia.managers.CssManager; - import flash.display.StageDisplayState; - import flash.display.MovieClip; - import flash.display.DisplayObjectContainer; - import com.ankamagames.berilia.types.graphic.GraphicSize; - import com.ankamagames.jerakine.data.I18n; - import com.ankamagames.jerakine.managers.LangManager; - import com.ankamagames.jerakine.utils.pattern.PatternDecoder; - import __AS3__.vec.*; - - [InstanciedApi] - public class UiApi implements IApi - { - - public static var MEMORY_LOG:Dictionary = new Dictionary(true); - public static const _log:Logger = Log.getLogger(getQualifiedClassName(UiApi)); - private static var _label:Label; - - private var _module:UiModule; - private var _currentUi:UiRootContainer; - private var oldTextureUri:String; - private var oldTextureBounds:Rectangle; - - public function UiApi() - { - this.oldTextureBounds = new Rectangle(); - super(); - MEMORY_LOG[this] = 1; - } - - [ApiData(name="module")] - public function set module(value:UiModule):void - { - if (!(this._module)) - { - this._module = value; - }; - } - - [ApiData(name="currentUi")] - public function set currentUi(value:UiRootContainer):void - { - if (!(this._currentUi)) - { - this._currentUi = value; - }; - } - - [Trusted] - public function destroy():void - { - this._currentUi = null; - this._module = null; - } - - [Untrusted] - public function loadUi(name:String, instanceName:String=null, params:*=null, strata:uint=1, cacheName:String=null, replace:Boolean=false):Object - { - var tmp:Array; - var rootCtr:UiRootContainer; - var mod:UiModule = this._module; - var uiName:String = name; - if (!(this._module.uis[name])) - { - if (name.indexOf("::") != -1) - { - tmp = name.split("::"); - mod = UiModuleManager.getInstance().getModule(tmp[0]); - if (!(mod)) - { - throw (new BeriliaError((("Module [" + tmp[0]) + "] does not exist"))); - }; - if (((mod.trusted) && (!(this._module.trusted)))) - { - throw (new ApiError("You cannot load trusted UI")); - }; - uiName = tmp[1]; - } - else - { - throw (new BeriliaError(((name + " not found in module ") + this._module.name))); - }; - }; - if (!(instanceName)) - { - instanceName = uiName; - }; - if (mod.uis[uiName]) - { - rootCtr = Berilia.getInstance().loadUi(mod, mod.uis[uiName], instanceName, params, replace, strata, false, cacheName); - if (((!((uiName == "tips"))) && (!((uiName == "buffUi"))))) - { - FocusHandler.getInstance().setFocus(rootCtr); - }; - return (SecureCenter.secure(rootCtr, mod.trusted)); - }; - return (null); - } - - [Untrusted] - public function loadUiInside(name:String, container:GraphicContainer, instanceName:String=null, params:*=null):Object - { - var tmp:Array; - var newContainer:UiRootContainer; - var mod:UiModule = this._module; - var uiName:String = name; - if (!(this._module.uis[name])) - { - if (name.indexOf("::") != -1) - { - tmp = name.split("::"); - mod = UiModuleManager.getInstance().getModule(tmp[0]); - if (!(mod)) - { - throw (new BeriliaError((("Module [" + tmp[0]) + "] does not exist"))); - }; - if (((mod.trusted) && (!(this._module.trusted)))) - { - throw (new ApiError("You cannot load trusted UI")); - }; - uiName = tmp[1]; - } - else - { - throw (new BeriliaError(((name + " not found in module ") + this._module.name))); - }; - }; - if (!(instanceName)) - { - instanceName = uiName; - }; - if (mod.uis[uiName]) - { - newContainer = new UiRootContainer(StageShareManager.stage, mod.uis[uiName]); - newContainer.uiModule = mod; - newContainer.strata = container.getUi().strata; - newContainer.depth = (container.getUi().depth + 1); - Berilia.getInstance().loadUiInside(mod.uis[uiName], instanceName, newContainer, params, false); - container.addChild(newContainer); - return (SecureCenter.secure(newContainer, mod.trusted)); - }; - return (null); - } - - [Untrusted] - public function unloadUi(instanceName:String=null):void - { - Berilia.getInstance().unloadUi(instanceName); - } - - [Untrusted] - public function getUi(instanceName:String) - { - var sui:UiRootContainer = Berilia.getInstance().getUi(instanceName); - if (!(sui)) - { - return (null); - }; - if (((!((sui.uiModule == this._module))) && (!(this._module.trusted)))) - { - throw (new ArgumentError("Cannot get access to an UI owned by another module.")); - }; - return (SecureCenter.secure(sui, this._module.trusted)); - } - - [Untrusted] - public function getUiInstances():Vector. - { - var ui:UiRootContainer; - var uiList:Dictionary = Berilia.getInstance().uiList; - var res:Vector. = new Vector.(); - for each (ui in uiList) - { - if (ui.uiModule == this._module) - { - res.push(ui); - }; - }; - return (res); - } - - [Untrusted] - public function getModuleList():Array - { - var m:UiModule; - var dml:Array; - var l:Array = []; - var ml:Array = UiModuleManager.getInstance().getModules(); - for each (m in ml) - { - l.push(m); - }; - dml = UiModuleManager.getInstance().disabledModules; - for each (m in dml) - { - l.push(m); - }; - l.sortOn(["trusted", "name"], [(Array.NUMERIC | Array.DESCENDING), 0]); - return (l); - } - - [Untrusted] - public function getModule(moduleName:String, includeUnInitialized:Boolean=false):UiModule - { - return (UiModuleManager.getInstance().getModule(moduleName, includeUnInitialized)); - } - - [Trusted] - public function setModuleEnable(id:String, b:Boolean):void - { - var mods:Array; - var mod:UiModule; - if (b) - { - mods = UiModuleManager.getInstance().disabledModules; + import com.ankamagames.berilia.interfaces.IApi; + import flash.utils.Dictionary; + import com.ankamagames.jerakine.logger.Logger; + import com.ankamagames.berilia.components.Label; + import com.ankamagames.jerakine.logger.Log; + import flash.utils.getQualifiedClassName; + import com.ankamagames.berilia.types.data.UiModule; + import com.ankamagames.berilia.types.graphic.UiRootContainer; + import com.ankamagames.berilia.managers.UiModuleManager; + import com.ankamagames.berilia.utils.errors.BeriliaError; + import com.ankamagames.berilia.utils.errors.ApiError; + import com.ankamagames.berilia.Berilia; + import com.ankamagames.jerakine.handlers.FocusHandler; + import com.ankamagames.berilia.managers.SecureCenter; + import com.ankamagames.berilia.types.graphic.GraphicContainer; + import com.ankamagames.jerakine.utils.display.StageShareManager; + import com.ankamagames.jerakine.managers.StoreDataManager; + import com.ankamagames.berilia.BeriliaConstants; + import com.ankamagames.berilia.managers.BindsManager; + import com.ankamagames.berilia.types.shortcut.Shortcut; + import com.ankamagames.berilia.types.listener.GenericListener; + import com.ankamagames.jerakine.utils.memory.WeakReference; + import com.ankamagames.berilia.types.event.InstanceEvent; + import com.ankamagames.berilia.managers.UIEventManager; + import com.ankamagames.berilia.components.Texture; + import flash.display.DisplayObject; + import com.ankamagames.berilia.components.ComponentInternalAccessor; + import com.ankamagames.jerakine.utils.misc.CallWithParameters; + import flash.utils.getDefinitionByName; + import com.ankamagames.berilia.enums.EventEnums; + import com.ankamagames.jerakine.types.Uri; + import com.ankamagames.berilia.types.tooltip.Tooltip; + import com.ankamagames.berilia.managers.TooltipManager; + import com.ankamagames.berilia.types.data.TextTooltipInfo; + import com.ankamagames.berilia.interfaces.IRadioItem; + import com.ankamagames.berilia.types.data.RadioGroup; + import com.ankamagames.jerakine.utils.display.KeyPoll; + import com.ankamagames.berilia.types.data.TreeData; + import com.ankamagames.berilia.types.data.LinkedCursorData; + import flash.geom.Point; + import com.ankamagames.berilia.managers.LinkedCursorSpriteManager; + import com.ankamagames.berilia.types.data.SlotDragAndDropData; + import com.ankamagames.berilia.managers.KernelEventsManager; + import com.ankamagames.berilia.utils.BeriliaHookList; + import com.ankamagames.berilia.managers.CssManager; + import flash.display.StageDisplayState; + import flash.geom.Rectangle; + import flash.display.MovieClip; + import flash.display.DisplayObjectContainer; + import com.ankamagames.berilia.types.graphic.GraphicSize; + import com.ankamagames.jerakine.data.I18n; + import com.ankamagames.jerakine.managers.LangManager; + import com.ankamagames.jerakine.utils.pattern.PatternDecoder; + + public class UiApi extends Object implements IApi + { + + public function UiApi() + { + this.oldTextureBounds = new Rectangle(); + super(); + MEMORY_LOG[this] = 1; + } + + public static var MEMORY_LOG:Dictionary = new Dictionary(true); + + public static const _log:Logger = Log.getLogger(getQualifiedClassName(UiApi)); + + private static var _label:Label; + + private var _module:UiModule; + + private var _currentUi:UiRootContainer; + + public function set module(param1:UiModule) : void + { + if(!this._module) + { + this._module = param1; + } + } + + public function set currentUi(param1:UiRootContainer) : void + { + if(!this._currentUi) + { + this._currentUi = param1; + } + } + + public function destroy() : void + { + this._currentUi = null; + this._module = null; + } + + public function loadUi(param1:String, param2:String = null, param3:* = null, param4:uint = 1, param5:String = null, param6:Boolean = false) : Object + { + var _loc9_:Array = null; + var _loc10_:UiRootContainer = null; + var _loc7_:UiModule = this._module; + var _loc8_:String = param1; + if(!this._module.uis[param1]) + { + if(param1.indexOf("::") != -1) + { + _loc9_ = param1.split("::"); + _loc7_ = UiModuleManager.getInstance().getModule(_loc9_[0]); + if(!_loc7_) + { + throw new BeriliaError("Module [" + _loc9_[0] + "] does not exist"); + } + else if((_loc7_.trusted) && !this._module.trusted) + { + throw new ApiError("You cannot load trusted UI"); + } + else + { + _loc8_ = _loc9_[1]; + } + } else { - mods = UiModuleManager.getInstance().getModules(); - }; - var moduleFound:Boolean; - for each (mod in mods) - { - if ((((mod.id == id)) && ((mod.enable == !(b))))) - { - mod.enable = b; - moduleFound = true; - break; - }; - }; - if (!(moduleFound)) - { - StoreDataManager.getInstance().setData(BeriliaConstants.DATASTORE_MOD, id, b); - }; - } - - [Trusted] - public function addChild(target:Object, child:Object):void - { - SecureCenter.unsecure(target).addChild(SecureCenter.unsecure(child)); - } - - [Untrusted] - public function me() - { - return (SecureCenter.secure(this._currentUi, this._module.trusted)); - } - - [Trusted] - public function initDefaultBinds():void - { - BindsManager.getInstance(); - } - - [Untrusted] - public function addShortcutHook(shortcutName:String, hook:Function, lowPriority:Boolean=false):void - { - var targetedShortcut:Shortcut = Shortcut.getShortcutByName(shortcutName); - if (((!(targetedShortcut)) && (!((shortcutName == "ALL"))))) - { - throw (new ApiError((("Shortcut [" + shortcutName) + "] does not exist"))); - }; - var priority:int = ((this._currentUi) ? this._currentUi.depth : 0); - if (lowPriority) - { - priority = 1; - }; - var listener:GenericListener = new GenericListener(shortcutName, ((this._currentUi) ? this._currentUi.name : (("__module_" + this._module.id))), hook, priority, ((this._currentUi) ? GenericListener.LISTENER_TYPE_UI : (GenericListener.LISTENER_TYPE_MODULE)), ((this._currentUi) ? new WeakReference(this._currentUi) : null)); - BindsManager.getInstance().registerEvent(listener); - } - - [Untrusted] - public function addComponentHook(target:GraphicContainer, hookName:String):void - { - var ie:InstanceEvent; - var eventMsg:String = this.getEventClassName(hookName); - if (!(eventMsg)) - { - throw (new ApiError((("Hook [" + hookName) + "] does not exist"))); - }; - if (!(UIEventManager.getInstance().instances[target])) - { - ie = new InstanceEvent(target, this._currentUi.uiClass); - UIEventManager.getInstance().registerInstance(ie); + throw new BeriliaError(param1 + " not found in module " + this._module.name); + } + } + if(!param2) + { + var param2:String = _loc8_; + } + if(_loc7_.uis[_loc8_]) + { + _loc10_ = Berilia.getInstance().loadUi(_loc7_,_loc7_.uis[_loc8_],param2,param3,param6,param4,false,param5); + if(!(_loc8_ == "tips") && !(_loc8_ == "buffUi")) + { + FocusHandler.getInstance().setFocus(_loc10_); + } + return SecureCenter.secure(_loc10_,_loc7_.trusted); + } + return null; + } + + public function loadUiInside(param1:String, param2:GraphicContainer, param3:String = null, param4:* = null) : Object + { + var _loc7_:Array = null; + var _loc8_:UiRootContainer = null; + var _loc5_:UiModule = this._module; + var _loc6_:String = param1; + if(!this._module.uis[param1]) + { + if(param1.indexOf("::") != -1) + { + _loc7_ = param1.split("::"); + _loc5_ = UiModuleManager.getInstance().getModule(_loc7_[0]); + if(!_loc5_) + { + throw new BeriliaError("Module [" + _loc7_[0] + "] does not exist"); + } + else if((_loc5_.trusted) && !this._module.trusted) + { + throw new ApiError("You cannot load trusted UI"); + } + else + { + _loc6_ = _loc7_[1]; + } + } else { - ie = UIEventManager.getInstance().instances[target]; - }; - ie.events[eventMsg] = eventMsg; - } - - [Untrusted] - public function removeComponentHook(target:GraphicContainer, hookName:String):void - { - var eventMsg:String = this.getEventClassName(hookName); - if (!(eventMsg)) - { - throw (new ApiError((("Hook [" + hookName) + "] does not exist"))); - }; - var ie:InstanceEvent = UIEventManager.getInstance().instances[target]; - if (((((ie) && (ie.events))) && (ie.events[eventMsg]))) - { - delete ie.events[eventMsg]; - }; - } - - [Trusted] - public function bindApi(targetTexture:Texture, propertyName:String, value:*):Boolean - { - var internalContent:DisplayObject = ComponentInternalAccessor.access(targetTexture, "_child"); - if (!(internalContent)) - { - return (false); - }; - try - { - internalContent[propertyName] = value; + throw new BeriliaError(param1 + " not found in module " + this._module.name); } - catch(e:Error) - { - return (false); - }; - return (true); - } - - [Untrusted] - public function createComponent(type:String, ... params):GraphicContainer - { - return (CallWithParameters.callConstructor((getDefinitionByName(("com.ankamagames.berilia.components::" + type)) as Class), params)); - } - - [Untrusted] - public function createContainer(type:String, ... params) - { - return (CallWithParameters.callConstructor((getDefinitionByName(("com.ankamagames.berilia.types.graphic::" + type)) as Class), params)); - } - - [Untrusted] - [Deprecated(help="use addComponentHook to add event")] - public function createInstanceEvent(target:DisplayObject, instance:*):InstanceEvent - { - return (new InstanceEvent(target, instance)); - } - - [Untrusted] - public function getEventClassName(event:String):String - { - switch (event) - { - case EventEnums.EVENT_ONPRESS: - return (EventEnums.EVENT_ONPRESS_MSG); - case EventEnums.EVENT_ONRELEASE: - return (EventEnums.EVENT_ONRELEASE_MSG); - case EventEnums.EVENT_ONROLLOUT: - return (EventEnums.EVENT_ONROLLOUT_MSG); - case EventEnums.EVENT_ONROLLOVER: - return (EventEnums.EVENT_ONROLLOVER_MSG); - case EventEnums.EVENT_ONRELEASEOUTSIDE: - return (EventEnums.EVENT_ONRELEASEOUTSIDE_MSG); - case EventEnums.EVENT_ONDOUBLECLICK: - return (EventEnums.EVENT_ONDOUBLECLICK_MSG); - case EventEnums.EVENT_ONRIGHTCLICK: - return (EventEnums.EVENT_ONRIGHTCLICK_MSG); - case EventEnums.EVENT_ONTEXTCLICK: - return (EventEnums.EVENT_ONTEXTCLICK_MSG); - case EventEnums.EVENT_ONCOLORCHANGE: - return (EventEnums.EVENT_ONCOLORCHANGE_MSG); - case EventEnums.EVENT_ONENTITYREADY: - return (EventEnums.EVENT_ONENTITYREADY_MSG); - case EventEnums.EVENT_ONSELECTITEM: - return (EventEnums.EVENT_ONSELECTITEM_MSG); - case EventEnums.EVENT_ONSELECTEMPTYITEM: - return (EventEnums.EVENT_ONSELECTEMPTYITEM_MSG); - case EventEnums.EVENT_ONCREATETAB: - return (EventEnums.EVENT_ONCREATETAB_MSG); - case EventEnums.EVENT_ONDELETETAB: - return (EventEnums.EVENT_ONDELETETAB_MSG); - case EventEnums.EVENT_ONRENAMETAB: - return (EventEnums.EVENT_ONRENAMETAB_MSG); - case EventEnums.EVENT_ONITEMROLLOUT: - return (EventEnums.EVENT_ONITEMROLLOUT_MSG); - case EventEnums.EVENT_ONITEMROLLOVER: - return (EventEnums.EVENT_ONITEMROLLOVER_MSG); - case EventEnums.EVENT_ONITEMRIGHTCLICK: - return (EventEnums.EVENT_ONITEMRIGHTCLICK_MSG); - case EventEnums.EVENT_ONDROP: - return (EventEnums.EVENT_ONDROP_MSG); - case EventEnums.EVENT_ONTEXTUREREADY: - return (EventEnums.EVENT_ONTEXTUREREADY_MSG); - case EventEnums.EVENT_ONTEXTURELOADFAIL: - return (EventEnums.EVENT_ONTEXTURELOADFAIL_MSG); - case EventEnums.EVENT_ONMAPELEMENTROLLOUT: - return (EventEnums.EVENT_ONMAPELEMENTROLLOUT_MSG); - case EventEnums.EVENT_ONMAPELEMENTROLLOVER: - return (EventEnums.EVENT_ONMAPELEMENTROLLOVER_MSG); - case EventEnums.EVENT_ONMAPELEMENTRIGHTCLICK: - return (EventEnums.EVENT_ONMAPELEMENTRIGHTCLICK_MSG); - case EventEnums.EVENT_ONMAPMOVE: - return (EventEnums.EVENT_ONMAPMOVE_MSG); - case EventEnums.EVENT_ONMAPROLLOVER: - return (EventEnums.EVENT_ONMAPROLLOVER_MSG); - case EventEnums.EVENT_ONVIDEOCONNECTFAILED: - return (EventEnums.EVENT_ONVIDEOCONNECTFAILED_MSG); - case EventEnums.EVENT_ONVIDEOCONNECTSUCCESS: - return (EventEnums.EVENT_ONVIDEOCONNECTSUCCESS_MSG); - case EventEnums.EVENT_ONVIDEOBUFFERCHANGE: - return (EventEnums.EVENT_ONVIDEOBUFFERCHANGE_MSG); - case EventEnums.EVENT_ONCOMPONENTREADY: - return (EventEnums.EVENT_ONCOMPONENTREADY_MSG); - case EventEnums.EVENT_ONWHEEL: - return (EventEnums.EVENT_ONWHEEL_MSG); - case EventEnums.EVENT_ONMOUSEUP: - return (EventEnums.EVENT_ONMOUSEUP_MSG); - case EventEnums.EVENT_ONCHANGE: - return (EventEnums.EVENT_ONCHANGE_MSG); - case EventEnums.EVENT_ONBROWSER_SESSION_TIMEOUT: - return (EventEnums.EVENT_ONBROWSER_SESSION_TIMEOUT_MSG); - case EventEnums.EVENT_ONBROWSER_DOM_READY: - return (EventEnums.EVENT_ONBROWSER_DOM_READY_MSG); - case EventEnums.EVENT_MIDDLECLICK: - return (EventEnums.EVENT_MIDDLECLICK_MSG); - }; - return (null); - } - - [Untrusted] - [Deprecated(help="use addComponentHook to add event")] - public function addInstanceEvent(event:InstanceEvent):void - { - UIEventManager.getInstance().registerInstance(event); - } - - [Untrusted] - [NoBoxing] - public function createUri(uri:String):Uri - { - if (((((((uri) && ((uri.indexOf(":") == -1)))) && (!((uri.indexOf("./") == 0))))) && (!((uri.indexOf("\\\\") == 0))))) - { - uri = ((("mod://" + this._module.id) + "/") + uri); - }; - return (new Uri(uri)); - } - - [Untrusted] - public function showTooltip(data:*, target:*, autoHide:Boolean=false, name:String="standard", point:uint=0, relativePoint:uint=2, offset:int=3, tooltipMaker:String=null, script:Class=null, makerParam:Object=null, cacheName:String=null, mouseEnabled:Boolean=false, strata:int=4, zoom:Number=1, uiModuleName:String=""):void - { - var tt:Tooltip; - if (((uiModuleName) || (this._currentUi))) - { - tt = TooltipManager.show(data, target, this._module, autoHide, name, point, relativePoint, offset, true, tooltipMaker, script, makerParam, cacheName, mouseEnabled, strata, zoom); - if (tt) - { - tt.uiModuleName = ((uiModuleName) ? uiModuleName : this._currentUi.name); - }; - }; - } - - [Untrusted] - public function hideTooltip(name:String=null):void - { - TooltipManager.hide(name); - } - - [Untrusted] - public function textTooltipInfo(content:String, css:String=null, cssClass:String=null, maxWidth:int=400):Object - { - return (new TextTooltipInfo(content, css, cssClass, maxWidth)); - } - - [Untrusted] - public function getRadioGroupSelectedItem(rgName:String, me:UiRootContainer):IRadioItem - { - var rg:RadioGroup = me.getRadioGroup(rgName); - return (rg.selectedItem); - } - - [Untrusted] - public function setRadioGroupSelectedItem(rgName:String, item:IRadioItem, me:UiRootContainer):void - { - var rg:RadioGroup = me.getRadioGroup(rgName); - rg.selectedItem = item; - } - - [Untrusted] - public function keyIsDown(keyCode:uint):Boolean - { - return (KeyPoll.getInstance().isDown(keyCode)); - } - - [Untrusted] - public function keyIsUp(keyCode:uint):Boolean - { - return (KeyPoll.getInstance().isUp(keyCode)); - } - - [Untrusted] - [NoBoxing] - public function convertToTreeData(array:*):Vector. - { - return (TreeData.fromArray(array)); - } - - [Untrusted] - public function setFollowCursorUri(uri:*, lockX:Boolean=false, lockY:Boolean=false, xOffset:int=0, yOffset:int=0, scale:Number=1):void - { - var cd:LinkedCursorData; - if (uri) - { - cd = new LinkedCursorData(); - cd.sprite = new Texture(); - Texture(cd.sprite).uri = (((uri is String)) ? new Uri(uri) : uri); - cd.sprite.scaleX = scale; - cd.sprite.scaleY = scale; - Texture(cd.sprite).finalize(); - cd.lockX = lockX; - cd.lockY = lockY; - cd.offset = new Point(xOffset, yOffset); - LinkedCursorSpriteManager.getInstance().addItem("customUserCursor", cd); + } + if(!param3) + { + var param3:String = _loc6_; + } + if(_loc5_.uis[_loc6_]) + { + _loc8_ = new UiRootContainer(StageShareManager.stage,_loc5_.uis[_loc6_]); + _loc8_.uiModule = _loc5_; + _loc8_.strata = param2.getUi().strata; + _loc8_.depth = param2.getUi().depth + 1; + Berilia.getInstance().loadUiInside(_loc5_.uis[_loc6_],param3,_loc8_,param4,false); + param2.addChild(_loc8_); + return SecureCenter.secure(_loc8_,_loc5_.trusted); + } + return null; + } + + public function unloadUi(param1:String = null) : void + { + Berilia.getInstance().unloadUi(param1); + } + + public function getUi(param1:String) : * + { + var _loc2_:UiRootContainer = Berilia.getInstance().getUi(param1); + if(!_loc2_) + { + return null; + } + if(!(_loc2_.uiModule == this._module) && !this._module.trusted) + { + throw new ArgumentError("Cannot get access to an UI owned by another module."); + } + else + { + return SecureCenter.secure(_loc2_,this._module.trusted); + } + } + + public function getUiInstances() : Vector. + { + var _loc3_:UiRootContainer = null; + var _loc1_:Dictionary = Berilia.getInstance().uiList; + var _loc2_:Vector. = new Vector.(); + for each(_loc3_ in _loc1_) + { + if(_loc3_.uiModule == this._module) + { + _loc2_.push(_loc3_); + } + } + return _loc2_; + } + + public function getModuleList() : Array + { + var _loc3_:UiModule = null; + var _loc4_:Array = null; + var _loc1_:Array = []; + var _loc2_:Array = UiModuleManager.getInstance().getModules(); + for each(_loc3_ in _loc2_) + { + _loc1_.push(_loc3_); + } + _loc4_ = UiModuleManager.getInstance().disabledModules; + for each(_loc3_ in _loc4_) + { + _loc1_.push(_loc3_); + } + _loc1_.sortOn(["trusted","name"],[Array.NUMERIC | Array.DESCENDING,0]); + return _loc1_; + } + + public function getModule(param1:String, param2:Boolean = false) : UiModule + { + return UiModuleManager.getInstance().getModule(param1,param2); + } + + public function setModuleEnable(param1:String, param2:Boolean) : void + { + var _loc3_:Array = null; + var _loc5_:UiModule = null; + if(param2) + { + _loc3_ = UiModuleManager.getInstance().disabledModules; + } + else + { + _loc3_ = UiModuleManager.getInstance().getModules(); + } + var _loc4_:* = false; + for each(_loc5_ in _loc3_) + { + if(_loc5_.id == param1 && _loc5_.enable == !param2) + { + _loc5_.enable = param2; + _loc4_ = true; + break; + } + } + if(!_loc4_) + { + StoreDataManager.getInstance().setData(BeriliaConstants.DATASTORE_MOD,param1,param2); + } + } + + public function addChild(param1:Object, param2:Object) : void + { + SecureCenter.unsecure(param1).addChild(SecureCenter.unsecure(param2)); + } + + public function addChildAt(param1:Object, param2:Object, param3:int) : void + { + SecureCenter.unsecure(param1).addChildAt(SecureCenter.unsecure(param2),param3); + } + + public function me() : * + { + return SecureCenter.secure(this._currentUi,this._module.trusted); + } + + public function initDefaultBinds() : void + { + BindsManager.getInstance(); + } + + public function addShortcutHook(param1:String, param2:Function, param3:Boolean = false) : void + { + var _loc4_:Shortcut = Shortcut.getShortcutByName(param1); + if(!_loc4_ && !(param1 == "ALL")) + { + throw new ApiError("Shortcut [" + param1 + "] does not exist"); + } + else + { + var _loc5_:int = this._currentUi?this._currentUi.depth:0; + if(param3) + { + _loc5_ = 1; + } + var _loc6_:GenericListener = new GenericListener(param1,this._currentUi?this._currentUi.name:"__module_" + this._module.id,param2,_loc5_,this._currentUi?GenericListener.LISTENER_TYPE_UI:GenericListener.LISTENER_TYPE_MODULE,this._currentUi?new WeakReference(this._currentUi):null); + BindsManager.getInstance().registerEvent(_loc6_); + return; + } + } + + public function addComponentHook(param1:GraphicContainer, param2:String) : void + { + var _loc4_:InstanceEvent = null; + var _loc3_:String = this.getEventClassName(param2); + if(!_loc3_) + { + throw new ApiError("Hook [" + param2 + "] does not exist"); + } + else + { + if(!UIEventManager.getInstance().instances[param1]) + { + _loc4_ = new InstanceEvent(param1,this._currentUi.uiClass); + UIEventManager.getInstance().registerInstance(_loc4_); } else { - LinkedCursorSpriteManager.getInstance().removeItem("customUserCursor"); - }; - } - - [Untrusted] - public function getFollowCursorUri():Object - { - return (LinkedCursorSpriteManager.getInstance().getItem("customUserCursor")); - } - - [Untrusted] - public function endDrag():void - { - var linkCursor:LinkedCursorData = LinkedCursorSpriteManager.getInstance().getItem("DragAndDrop"); - if (((linkCursor) && ((linkCursor.data is SlotDragAndDropData)))) - { - LinkedCursorSpriteManager.getInstance().removeItem("DragAndDrop"); - KernelEventsManager.getInstance().processCallback(BeriliaHookList.DropEnd, SecureCenter.secure(SlotDragAndDropData(linkCursor.data).currentHolder)); - }; - } - - [Untrusted] - public function preloadCss(url:String):void - { - CssManager.getInstance().preloadCss(url); - } - - [Untrusted] - public function getMouseX():int - { - return (StageShareManager.mouseX); - } - - [Untrusted] - public function getMouseY():int - { - return (StageShareManager.mouseY); - } - - [Untrusted] - public function getStageWidth():int - { - return (StageShareManager.startWidth); - } - - [Untrusted] - public function getStageHeight():int - { - return (StageShareManager.startHeight); - } - - [Untrusted] - public function getWindowWidth():int - { - return (StageShareManager.stage.stageWidth); - } - - [Untrusted] - public function getWindowHeight():int - { - return (StageShareManager.stage.stageHeight); - } - - [Untrusted] - public function getWindowScale():Number - { - return (StageShareManager.windowScale); - } - - [Trusted] - public function setFullScreen(enabled:Boolean, onlyMaximize:Boolean=false):void - { - StageShareManager.setFullScreen(enabled, onlyMaximize); - } - - [Untrusted] - public function isFullScreen():Boolean - { - return (!((StageShareManager.stage.displayState == StageDisplayState.NORMAL))); - } - - [Trusted] - public function setShortcutUsedToExitFullScreen(value:Boolean):void - { - StageShareManager.shortcutUsedToExitFullScreen = value; - } - - [Untrusted] - public function useIME():Boolean - { - return (Berilia.getInstance().useIME); - } - - private function getInitBounds(pTx:Texture):Rectangle - { - var bg:MovieClip; - if ((((this.oldTextureUri == null)) || (((((pTx) && (pTx.uri))) && (!((this.oldTextureUri == pTx.uri.toString()))))))) - { - if (!((pTx.child is DisplayObjectContainer))) - { - return (null); - }; - bg = ((pTx.child as DisplayObjectContainer).getChildByName("bg") as MovieClip); - if (bg) - { - this.oldTextureBounds.width = bg.width; - this.oldTextureBounds.height = bg.height; - this.oldTextureUri = pTx.uri.toString(); - }; - }; - return (this.oldTextureBounds); - } - - [Trusted] - public function buildOrnamentTooltipFrom(pTexture:Texture, pTarget:Rectangle):void - { - var bgBounds:Rectangle; - var scaleX:Number; - var scaleY:Number; - var tmpPos:Rectangle = this.getInitBounds(pTexture); - if (!(tmpPos)) - { - tmpPos = new Rectangle(); - }; - var source:DisplayObjectContainer = (pTexture.child as DisplayObjectContainer); - var bg:MovieClip = (this.addPart("bg", source, pTarget, tmpPos.x, tmpPos.y) as MovieClip); - if (bg) - { - bgBounds = bg.getBounds(bg); - scaleX = (((pTarget.width - bgBounds.left) + (bgBounds.right - 160)) / bgBounds.width); - scaleY = (((pTarget.height - bgBounds.top) + (bgBounds.bottom - 40)) / bgBounds.height); - bg.x = (bg.x + ((-(bgBounds.left) * scaleX) + bgBounds.left)); - bg.y = (bg.y + ((-(bgBounds.top) * scaleY) + bgBounds.top)); - bg.scale9Grid = new Rectangle(80, 20, 1, 1); - bg.width = (tmpPos.width * scaleX); - bg.height = (tmpPos.height * scaleY); - }; - this.addPart("top", source, pTarget, (pTarget.width / 2), 0); - this.addPart("picto", source, pTarget, (pTarget.width / 2), 0); - this.addPart("right", source, pTarget, pTarget.width, (pTarget.height / 2)); - this.addPart("bottom", source, pTarget, (pTarget.width / 2), (pTarget.height - 1)); - this.addPart("left", source, pTarget, 0, (pTarget.height / 2)); - } - - private function addPart(name:String, source:DisplayObjectContainer, target:Rectangle, x:int, y:int):DisplayObject - { - if (!(source)) - { - return (null); - }; - var part:DisplayObject = source.getChildByName(name); - if (part != null) - { - part.x = (target.x + x); - part.y = (target.y + y); - }; - return (part); - } - - [Untrusted] - public function getTextSize(pText:String, pCss:Uri, pCssClass:String):Rectangle - { - if (!(_label)) - { - _label = (this.createComponent("Label") as Label); - }; - _label.css = pCss; - _label.cssClass = pCssClass; - _label.fixedWidth = false; - _label.text = pText; - return (new Rectangle(0, 0, _label.textWidth, _label.textHeight)); - } - - [Trusted] - public function setComponentMinMaxSize(component:GraphicContainer, minSize:Point, maxSize:Point):void - { - if (!(component.minSize)) - { - component.minSize = new GraphicSize(); - }; - component.minSize.x = minSize.x; - component.minSize.y = minSize.y; - if (!(component.maxSize)) + _loc4_ = UIEventManager.getInstance().instances[param1]; + } + _loc4_.events[_loc3_] = _loc3_; + return; + } + } + + public function removeComponentHook(param1:GraphicContainer, param2:String) : void + { + var _loc3_:String = this.getEventClassName(param2); + if(!_loc3_) + { + throw new ApiError("Hook [" + param2 + "] does not exist"); + } + else + { + var _loc4_:InstanceEvent = UIEventManager.getInstance().instances[param1]; + if((_loc4_) && (_loc4_.events) && (_loc4_.events[_loc3_])) + { + delete _loc4_.events[_loc3_]; + true; + } + return; + } + } + + public function bindApi(param1:Texture, param2:String, param3:*) : Boolean + { + var targetTexture:Texture = param1; + var propertyName:String = param2; + var value:* = param3; + var internalContent:DisplayObject = ComponentInternalAccessor.access(targetTexture,"_child"); + if(!internalContent) + { + return false; + } + try + { + internalContent[propertyName] = value; + } + catch(e:Error) + { + return false; + } + return true; + } + + public function createComponent(param1:String, ... rest) : GraphicContainer + { + return CallWithParameters.callConstructor(getDefinitionByName("com.ankamagames.berilia.components::" + param1) as Class,rest); + } + + public function createContainer(param1:String, ... rest) : * + { + return CallWithParameters.callConstructor(getDefinitionByName("com.ankamagames.berilia.types.graphic::" + param1) as Class,rest); + } + + public function createInstanceEvent(param1:DisplayObject, param2:*) : InstanceEvent + { + return new InstanceEvent(param1,param2); + } + + public function getEventClassName(param1:String) : String + { + switch(param1) + { + case EventEnums.EVENT_ONPRESS: + return EventEnums.EVENT_ONPRESS_MSG; + case EventEnums.EVENT_ONRELEASE: + return EventEnums.EVENT_ONRELEASE_MSG; + case EventEnums.EVENT_ONROLLOUT: + return EventEnums.EVENT_ONROLLOUT_MSG; + case EventEnums.EVENT_ONROLLOVER: + return EventEnums.EVENT_ONROLLOVER_MSG; + case EventEnums.EVENT_ONRELEASEOUTSIDE: + return EventEnums.EVENT_ONRELEASEOUTSIDE_MSG; + case EventEnums.EVENT_ONDOUBLECLICK: + return EventEnums.EVENT_ONDOUBLECLICK_MSG; + case EventEnums.EVENT_ONRIGHTCLICK: + return EventEnums.EVENT_ONRIGHTCLICK_MSG; + case EventEnums.EVENT_ONTEXTCLICK: + return EventEnums.EVENT_ONTEXTCLICK_MSG; + case EventEnums.EVENT_ONCOLORCHANGE: + return EventEnums.EVENT_ONCOLORCHANGE_MSG; + case EventEnums.EVENT_ONENTITYREADY: + return EventEnums.EVENT_ONENTITYREADY_MSG; + case EventEnums.EVENT_ONSELECTITEM: + return EventEnums.EVENT_ONSELECTITEM_MSG; + case EventEnums.EVENT_ONSELECTEMPTYITEM: + return EventEnums.EVENT_ONSELECTEMPTYITEM_MSG; + case EventEnums.EVENT_ONCREATETAB: + return EventEnums.EVENT_ONCREATETAB_MSG; + case EventEnums.EVENT_ONDELETETAB: + return EventEnums.EVENT_ONDELETETAB_MSG; + case EventEnums.EVENT_ONRENAMETAB: + return EventEnums.EVENT_ONRENAMETAB_MSG; + case EventEnums.EVENT_ONITEMROLLOUT: + return EventEnums.EVENT_ONITEMROLLOUT_MSG; + case EventEnums.EVENT_ONITEMROLLOVER: + return EventEnums.EVENT_ONITEMROLLOVER_MSG; + case EventEnums.EVENT_ONITEMRIGHTCLICK: + return EventEnums.EVENT_ONITEMRIGHTCLICK_MSG; + case EventEnums.EVENT_ONDROP: + return EventEnums.EVENT_ONDROP_MSG; + case EventEnums.EVENT_ONTEXTUREREADY: + return EventEnums.EVENT_ONTEXTUREREADY_MSG; + case EventEnums.EVENT_ONTEXTURELOADFAIL: + return EventEnums.EVENT_ONTEXTURELOADFAIL_MSG; + case EventEnums.EVENT_ONMAPELEMENTROLLOUT: + return EventEnums.EVENT_ONMAPELEMENTROLLOUT_MSG; + case EventEnums.EVENT_ONMAPELEMENTROLLOVER: + return EventEnums.EVENT_ONMAPELEMENTROLLOVER_MSG; + case EventEnums.EVENT_ONMAPELEMENTRIGHTCLICK: + return EventEnums.EVENT_ONMAPELEMENTRIGHTCLICK_MSG; + case EventEnums.EVENT_ONMAPMOVE: + return EventEnums.EVENT_ONMAPMOVE_MSG; + case EventEnums.EVENT_ONMAPROLLOVER: + return EventEnums.EVENT_ONMAPROLLOVER_MSG; + case EventEnums.EVENT_ONVIDEOCONNECTFAILED: + return EventEnums.EVENT_ONVIDEOCONNECTFAILED_MSG; + case EventEnums.EVENT_ONVIDEOCONNECTSUCCESS: + return EventEnums.EVENT_ONVIDEOCONNECTSUCCESS_MSG; + case EventEnums.EVENT_ONVIDEOBUFFERCHANGE: + return EventEnums.EVENT_ONVIDEOBUFFERCHANGE_MSG; + case EventEnums.EVENT_ONCOMPONENTREADY: + return EventEnums.EVENT_ONCOMPONENTREADY_MSG; + case EventEnums.EVENT_ONWHEEL: + return EventEnums.EVENT_ONWHEEL_MSG; + case EventEnums.EVENT_ONMOUSEUP: + return EventEnums.EVENT_ONMOUSEUP_MSG; + case EventEnums.EVENT_ONCHANGE: + return EventEnums.EVENT_ONCHANGE_MSG; + case EventEnums.EVENT_ONBROWSER_SESSION_TIMEOUT: + return EventEnums.EVENT_ONBROWSER_SESSION_TIMEOUT_MSG; + case EventEnums.EVENT_ONBROWSER_DOM_READY: + return EventEnums.EVENT_ONBROWSER_DOM_READY_MSG; + case EventEnums.EVENT_MIDDLECLICK: + return EventEnums.EVENT_MIDDLECLICK_MSG; + default: + return null; + } + } + + public function addInstanceEvent(param1:InstanceEvent) : void + { + UIEventManager.getInstance().registerInstance(param1); + } + + public function createUri(param1:String) : Uri + { + if((param1 && param1.indexOf(":") == -1) && (!(param1.indexOf("./") == 0)) && !(param1.indexOf("\\\\") == 0)) + { + var param1:String = "mod://" + this._module.id + "/" + param1; + } + return new Uri(param1); + } + + public function showTooltip(param1:*, param2:*, param3:Boolean = false, param4:String = "standard", param5:uint = 0, param6:uint = 2, param7:int = 3, param8:String = null, param9:Class = null, param10:Object = null, param11:String = null, param12:Boolean = false, param13:int = 4, param14:Number = 1, param15:String = "") : void + { + var _loc16_:Tooltip = null; + if((param15) || (this._currentUi)) + { + _loc16_ = TooltipManager.show(param1,param2,this._module,param3,param4,param5,param6,param7,true,param8,param9,param10,param11,param12,param13,param14); + if(_loc16_) + { + _loc16_.uiModuleName = param15?param15:this._currentUi.name; + } + } + } + + public function hideTooltip(param1:String = null) : void + { + TooltipManager.hide(param1); + } + + public function textTooltipInfo(param1:String, param2:String = null, param3:String = null, param4:int = 400) : Object + { + return new TextTooltipInfo(param1,param2,param3,param4); + } + + public function getRadioGroupSelectedItem(param1:String, param2:UiRootContainer) : IRadioItem + { + var _loc3_:RadioGroup = param2.getRadioGroup(param1); + return _loc3_.selectedItem; + } + + public function setRadioGroupSelectedItem(param1:String, param2:IRadioItem, param3:UiRootContainer) : void + { + var _loc4_:RadioGroup = param3.getRadioGroup(param1); + _loc4_.selectedItem = param2; + } + + public function keyIsDown(param1:uint) : Boolean + { + return KeyPoll.getInstance().isDown(param1); + } + + public function keyIsUp(param1:uint) : Boolean + { + return KeyPoll.getInstance().isUp(param1); + } + + public function convertToTreeData(param1:*) : Vector. + { + return TreeData.fromArray(param1); + } + + public function setFollowCursorUri(param1:*, param2:Boolean = false, param3:Boolean = false, param4:int = 0, param5:int = 0, param6:Number = 1) : void + { + var _loc7_:LinkedCursorData = null; + if(param1) + { + _loc7_ = new LinkedCursorData(); + _loc7_.sprite = new Texture(); + Texture(_loc7_.sprite).uri = param1 is String?new Uri(param1):param1; + _loc7_.sprite.scaleX = param6; + _loc7_.sprite.scaleY = param6; + Texture(_loc7_.sprite).finalize(); + _loc7_.lockX = param2; + _loc7_.lockY = param3; + _loc7_.offset = new Point(param4,param5); + LinkedCursorSpriteManager.getInstance().addItem("customUserCursor",_loc7_); + } + else + { + LinkedCursorSpriteManager.getInstance().removeItem("customUserCursor"); + } + } + + public function getFollowCursorUri() : Object + { + return LinkedCursorSpriteManager.getInstance().getItem("customUserCursor"); + } + + public function endDrag() : void + { + var _loc1_:LinkedCursorData = LinkedCursorSpriteManager.getInstance().getItem("DragAndDrop"); + if((_loc1_) && _loc1_.data is SlotDragAndDropData) + { + LinkedCursorSpriteManager.getInstance().removeItem("DragAndDrop"); + KernelEventsManager.getInstance().processCallback(BeriliaHookList.DropEnd,SecureCenter.secure(SlotDragAndDropData(_loc1_.data).currentHolder)); + } + } + + public function preloadCss(param1:String) : void + { + CssManager.getInstance().preloadCss(param1); + } + + public function getMouseX() : int + { + return StageShareManager.mouseX; + } + + public function getMouseY() : int + { + return StageShareManager.mouseY; + } + + public function getStageWidth() : int + { + return StageShareManager.startWidth; + } + + public function getStageHeight() : int + { + return StageShareManager.startHeight; + } + + public function getWindowWidth() : int + { + return StageShareManager.stage.stageWidth; + } + + public function getWindowHeight() : int + { + return StageShareManager.stage.stageHeight; + } + + public function getWindowScale() : Number + { + return StageShareManager.windowScale; + } + + public function setFullScreen(param1:Boolean, param2:Boolean = false) : void + { + StageShareManager.setFullScreen(param1,param2); + } + + public function isFullScreen() : Boolean + { + return !(StageShareManager.stage.displayState == StageDisplayState.NORMAL); + } + + public function setShortcutUsedToExitFullScreen(param1:Boolean) : void + { + StageShareManager.shortcutUsedToExitFullScreen = param1; + } + + public function useIME() : Boolean + { + return Berilia.getInstance().useIME; + } + + private var oldTextureUri:String; + + private var oldTextureBounds:Rectangle; + + private function getInitBounds(param1:Texture) : Rectangle + { + var _loc2_:MovieClip = null; + if(this.oldTextureUri == null || (param1 && param1.uri) && (!(this.oldTextureUri == param1.uri.toString()))) + { + if(!(param1.child is DisplayObjectContainer)) + { + return null; + } + _loc2_ = (param1.child as DisplayObjectContainer).getChildByName("bg") as MovieClip; + if(_loc2_) { - component.maxSize = new GraphicSize(); - }; - component.maxSize.x = maxSize.x; - component.maxSize.y = maxSize.y; - } - - [Untrusted] - public function replaceParams(text:String, params:Array, replace:String="%"):String - { - return (I18n.replaceParams(text, params, replace)); - } - - [Untrusted] - public function replaceKey(text:String):String - { - return (LangManager.getInstance().replaceKey(text, true)); - } - - [Untrusted] - public function getText(key:String, ... params):String - { - return (I18n.getUiText(key, params)); - } - - [Untrusted] - public function getTextFromKey(key:uint, replace:String="%", ... params):String - { - return (I18n.getText(key, params, replace)); - } - - [Untrusted] - public function processText(str:String, gender:String, singular:Boolean=true):String - { - return (PatternDecoder.combine(str, gender, singular)); - } - - [Untrusted] - public function decodeText(str:String, params:Array):String - { - return (PatternDecoder.decode(str, params)); - } - - - } -}//package com.ankamagames.berilia.api - + this.oldTextureBounds.width = _loc2_.width; + this.oldTextureBounds.height = _loc2_.height; + this.oldTextureUri = param1.uri.toString(); + } + } + return this.oldTextureBounds; + } + + public function buildOrnamentTooltipFrom(param1:Texture, param2:Rectangle) : void + { + var _loc6_:Rectangle = null; + var _loc7_:* = NaN; + var _loc8_:* = NaN; + var _loc3_:Rectangle = this.getInitBounds(param1); + if(!_loc3_) + { + _loc3_ = new Rectangle(); + } + var _loc4_:DisplayObjectContainer = param1.child as DisplayObjectContainer; + var _loc5_:MovieClip = this.addPart("bg",_loc4_,param2,_loc3_.x,_loc3_.y) as MovieClip; + if(_loc5_) + { + _loc6_ = _loc5_.getBounds(_loc5_); + _loc7_ = (param2.width - _loc6_.left + (_loc6_.right - 160)) / _loc6_.width; + _loc8_ = (param2.height - _loc6_.top + (_loc6_.bottom - 40)) / _loc6_.height; + _loc5_.x = _loc5_.x + (-_loc6_.left * _loc7_ + _loc6_.left); + _loc5_.y = _loc5_.y + (-_loc6_.top * _loc8_ + _loc6_.top); + _loc5_.scale9Grid = new Rectangle(80,20,1,1); + _loc5_.width = _loc3_.width * _loc7_; + _loc5_.height = _loc3_.height * _loc8_; + } + this.addPart("top",_loc4_,param2,param2.width / 2,0); + this.addPart("picto",_loc4_,param2,param2.width / 2,0); + this.addPart("right",_loc4_,param2,param2.width,param2.height / 2); + this.addPart("bottom",_loc4_,param2,param2.width / 2,param2.height - 1); + this.addPart("left",_loc4_,param2,0,param2.height / 2); + } + + private function addPart(param1:String, param2:DisplayObjectContainer, param3:Rectangle, param4:int, param5:int) : DisplayObject + { + if(!param2) + { + return null; + } + var _loc6_:DisplayObject = param2.getChildByName(param1); + if(_loc6_ != null) + { + _loc6_.x = param3.x + param4; + _loc6_.y = param3.y + param5; + } + return _loc6_; + } + + public function getTextSize(param1:String, param2:Uri, param3:String) : Rectangle + { + if(!_label) + { + _label = this.createComponent("Label") as Label; + } + _label.css = param2; + _label.cssClass = param3; + _label.fixedWidth = false; + _label.text = param1; + return new Rectangle(0,0,_label.textWidth,_label.textHeight); + } + + public function setComponentMinMaxSize(param1:GraphicContainer, param2:Point, param3:Point) : void + { + if(!param1.minSize) + { + param1.minSize = new GraphicSize(); + } + param1.minSize.x = param2.x; + param1.minSize.y = param2.y; + if(!param1.maxSize) + { + param1.maxSize = new GraphicSize(); + } + param1.maxSize.x = param3.x; + param1.maxSize.y = param3.y; + } + + public function replaceParams(param1:String, param2:Array, param3:String = "%") : String + { + return I18n.replaceParams(param1,param2,param3); + } + + public function replaceKey(param1:String) : String + { + return LangManager.getInstance().replaceKey(param1,true); + } + + public function getText(param1:String, ... rest) : String + { + return I18n.getUiText(param1,rest); + } + + public function getTextFromKey(param1:uint, param2:String = "%", ... rest) : String + { + return I18n.getText(param1,rest,param2); + } + + public function processText(param1:String, param2:String, param3:Boolean = true) : String + { + return PatternDecoder.combine(param1,param2,param3); + } + + public function decodeText(param1:String, param2:Array) : String + { + return PatternDecoder.decode(param1,param2); + } + } +} diff --git a/com/ankamagames/berilia/components/CharacterWheel.as b/com/ankamagames/berilia/components/CharacterWheel.as index 868db0a12..da33f6440 100644 --- a/com/ankamagames/berilia/components/CharacterWheel.as +++ b/com/ankamagames/berilia/components/CharacterWheel.as @@ -1,791 +1,817 @@ -package com.ankamagames.berilia.components +package com.ankamagames.berilia.components { - import com.ankamagames.berilia.types.graphic.GraphicContainer; - import com.ankamagames.berilia.FinalizableUIComponent; - import com.ankamagames.jerakine.logger.Logger; - import com.ankamagames.jerakine.logger.Log; - import flash.utils.getQualifiedClassName; - import flash.utils.Dictionary; - import com.ankamagames.berilia.types.graphic.UiRootContainer; - import com.ankamagames.tiphon.types.ISubEntityBehavior; - import com.ankamagames.tiphon.types.IAnimationModifier; - import com.ankamagames.tiphon.types.ISkinModifier; - import com.ankamagames.berilia.managers.SecureCenter; - import com.ankamagames.jerakine.entities.interfaces.IAnimated; - import com.ankamagames.jerakine.sequencer.SerialSequencer; - import com.ankamagames.tiphon.display.TiphonSprite; - import com.ankamagames.tiphon.sequence.SetDirectionStep; - import com.ankamagames.tiphon.sequence.PlayAnimationStep; - import com.ankamagames.tiphon.sequence.SetAnimationStep; - import com.ankamagames.tiphon.types.look.TiphonEntityLook; - import com.ankamagames.berilia.types.event.InstanceEvent; - import com.ankamagames.tiphon.events.TiphonEvent; - import flash.events.Event; - import com.ankamagames.jerakine.types.Uri; - import com.ankamagames.berilia.enums.EventEnums; - import com.ankamagames.berilia.managers.UIEventManager; - import flash.geom.ColorTransform; - import flash.display.Bitmap; - import flash.geom.Rectangle; - import flash.display.BitmapData; - import flash.geom.Matrix; - import com.ankamagames.jerakine.utils.display.EnterFrameDispatcher; - import com.ankamagames.jerakine.interfaces.IInterfaceListener; - import com.ankamagames.berilia.Berilia; - import com.ankamagames.jerakine.utils.display.StageShareManager; - import com.ankamagames.jerakine.messages.Message; - import flash.display.DisplayObject; - - public class CharacterWheel extends GraphicContainer implements FinalizableUIComponent - { - - protected static const _log:Logger = Log.getLogger(getQualifiedClassName(CharacterWheel)); - private static const _animationModifier:Dictionary = new Dictionary(); - private static const _skinModifier:Dictionary = new Dictionary(); - private static const _subEntitiesBehaviors:Dictionary = new Dictionary(); - - private var _nSelectedChara:int; - private var _nNbCharacters:uint = 1; - private var _aCharactersList:Object; - private var _aEntitiesLook:Array; - private var _ctrDepth:Array; - private var _uiClass:UiRootContainer; - private var _aMountainsCtr:Array; - private var _aSprites:Array; - private var _charaSelCtr:Object; - private var _midZCtr:Object; - private var _frontZCtr:Object; - private var _sMountainUri:String; - private var _nWidthEllipsis:int = 390; - private var _nHeightEllipsis:int = 200; - private var _nXCenterEllipsis:int = 540; - private var _nYCenterEllipsis:int = 360; - private var _nRotationStep:Number = 0; - private var _nRotation:Number = 0; - private var _nRotationPieceTrg:Number; - private var _sens:int; - private var _bMovingMountains:Boolean = false; - private var _finalized:Boolean = false; - private var _aRenderePartNames:Array; - - public function CharacterWheel() - { - this._aEntitiesLook = new Array(); - this._aMountainsCtr = new Array(); - this._aSprites = new Array(); - this._ctrDepth = new Array(); - } - - public static function setSubEntityDefaultBehavior(category:uint, behavior:ISubEntityBehavior):void - { - _subEntitiesBehaviors[category] = behavior; - } - - public static function setAnimationModifier(boneId:uint, am:IAnimationModifier):void - { - _animationModifier[boneId] = am; - } - - public static function setSkinModifier(boneId:uint, sm:ISkinModifier):void - { - _skinModifier[boneId] = sm; - } - - - public function get widthEllipsis():int - { - return (this._nWidthEllipsis); - } - - public function set widthEllipsis(i:int):void - { - this._nWidthEllipsis = i; - } - - public function get heightEllipsis():int - { - return (this._nHeightEllipsis); - } - - public function set heightEllipsis(i:int):void - { - this._nHeightEllipsis = i; - } - - public function get xEllipsis():int - { - return (this._nXCenterEllipsis); - } - - public function set xEllipsis(i:int):void - { - this._nXCenterEllipsis = i; - } - - public function get yEllipsis():int - { - return (this._nYCenterEllipsis); - } - - public function set yEllipsis(i:int):void - { - this._nYCenterEllipsis = i; - } - - public function get charaCtr():Object - { - return (this._charaSelCtr); - } - - public function set charaCtr(ctr:Object):void - { - this._charaSelCtr = ctr; - } - - public function get frontCtr():Object - { - return (this._frontZCtr); - } - - public function set frontCtr(ctr:Object):void - { - this._frontZCtr = ctr; - } - - public function get midCtr():Object - { - return (this._midZCtr); - } - - public function set midCtr(ctr:Object):void - { - this._midZCtr = ctr; - } - - public function get mountainUri():String - { - return (this._sMountainUri); - } - - public function set mountainUri(s:String):void - { - this._sMountainUri = s; - } - - public function get selectedChara():int - { - return (this._nSelectedChara); - } - - public function set selectedChara(i:int):void - { - this._nSelectedChara = i; - } - - public function get isWheeling():Boolean - { - return (this._bMovingMountains); - } - - public function set entities(data:*):void - { - if (!(this.isIterable(data))) - { - throw (new ArgumentError("entities must be either Array or Vector.")); - }; - this._aEntitiesLook = SecureCenter.unsecure(data); - } - - public function get entities() - { - return (SecureCenter.secure(this._aEntitiesLook)); - } - - public function set dataProvider(data:*):void - { - if (!(this.isIterable(data))) - { - throw (new ArgumentError("dataProvider must be either Array or Vector.")); - }; - this._aCharactersList = data; + import com.ankamagames.berilia.types.graphic.GraphicContainer; + import com.ankamagames.berilia.FinalizableUIComponent; + import com.ankamagames.jerakine.logger.Logger; + import flash.utils.Dictionary; + import com.ankamagames.tiphon.types.ISubEntityBehavior; + import com.ankamagames.tiphon.types.IAnimationModifier; + import com.ankamagames.tiphon.types.ISkinModifier; + import com.ankamagames.jerakine.logger.Log; + import flash.utils.getQualifiedClassName; + import com.ankamagames.berilia.types.graphic.UiRootContainer; + import com.ankamagames.berilia.managers.SecureCenter; + import com.ankamagames.jerakine.entities.interfaces.IAnimated; + import com.ankamagames.jerakine.sequencer.SerialSequencer; + import com.ankamagames.tiphon.display.TiphonSprite; + import com.ankamagames.tiphon.sequence.SetDirectionStep; + import com.ankamagames.tiphon.sequence.PlayAnimationStep; + import com.ankamagames.tiphon.sequence.SetAnimationStep; + import com.ankamagames.tiphon.types.look.TiphonEntityLook; + import com.ankamagames.berilia.types.event.InstanceEvent; + import com.ankamagames.tiphon.events.TiphonEvent; + import flash.events.Event; + import com.ankamagames.jerakine.types.Uri; + import com.ankamagames.berilia.enums.EventEnums; + import com.ankamagames.berilia.managers.UIEventManager; + import flash.geom.ColorTransform; + import flash.display.Bitmap; + import flash.geom.Rectangle; + import flash.display.BitmapData; + import flash.geom.Matrix; + import com.ankamagames.jerakine.utils.display.EnterFrameDispatcher; + import com.ankamagames.jerakine.interfaces.IInterfaceListener; + import com.ankamagames.berilia.Berilia; + import com.ankamagames.jerakine.utils.display.StageShareManager; + import com.ankamagames.jerakine.messages.Message; + import flash.display.DisplayObject; + + public class CharacterWheel extends GraphicContainer implements FinalizableUIComponent + { + + public function CharacterWheel() + { + super(); + this._aEntitiesLook = new Array(); + this._aMountainsCtr = new Array(); + this._aSprites = new Array(); + this._ctrDepth = new Array(); + } + + protected static const _log:Logger = Log.getLogger(getQualifiedClassName(CharacterWheel)); + + private static const _animationModifier:Dictionary = new Dictionary(); + + private static const _skinModifier:Dictionary = new Dictionary(); + + private static const _subEntitiesBehaviors:Dictionary = new Dictionary(); + + public static function setSubEntityDefaultBehavior(param1:uint, param2:ISubEntityBehavior) : void + { + _subEntitiesBehaviors[param1] = param2; + } + + public static function setAnimationModifier(param1:uint, param2:IAnimationModifier) : void + { + _animationModifier[param1] = param2; + } + + public static function setSkinModifier(param1:uint, param2:ISkinModifier) : void + { + _skinModifier[param1] = param2; + } + + private var _nSelectedChara:int; + + private var _nNbCharacters:uint = 1; + + private var _aCharactersList:Object; + + private var _aEntitiesLook:Array; + + private var _ctrDepth:Array; + + private var _uiClass:UiRootContainer; + + private var _aMountainsCtr:Array; + + private var _aSprites:Array; + + private var _charaSelCtr:Object; + + private var _midZCtr:Object; + + private var _frontZCtr:Object; + + private var _sMountainUri:String; + + private var _nWidthEllipsis:int = 390; + + private var _nHeightEllipsis:int = 200; + + private var _nXCenterEllipsis:int = 540; + + private var _nYCenterEllipsis:int = 360; + + private var _nRotationStep:Number = 0; + + private var _nRotation:Number = 0; + + private var _nRotationPieceTrg:Number; + + private var _sens:int; + + private var _bMovingMountains:Boolean = false; + + private var _finalized:Boolean = false; + + private var _aRenderePartNames:Array; + + public function get widthEllipsis() : int + { + return this._nWidthEllipsis; + } + + public function set widthEllipsis(param1:int) : void + { + this._nWidthEllipsis = param1; + } + + public function get heightEllipsis() : int + { + return this._nHeightEllipsis; + } + + public function set heightEllipsis(param1:int) : void + { + this._nHeightEllipsis = param1; + } + + public function get xEllipsis() : int + { + return this._nXCenterEllipsis; + } + + public function set xEllipsis(param1:int) : void + { + this._nXCenterEllipsis = param1; + } + + public function get yEllipsis() : int + { + return this._nYCenterEllipsis; + } + + public function set yEllipsis(param1:int) : void + { + this._nYCenterEllipsis = param1; + } + + public function get charaCtr() : Object + { + return this._charaSelCtr; + } + + public function set charaCtr(param1:Object) : void + { + this._charaSelCtr = param1; + } + + public function get frontCtr() : Object + { + return this._frontZCtr; + } + + public function set frontCtr(param1:Object) : void + { + this._frontZCtr = param1; + } + + public function get midCtr() : Object + { + return this._midZCtr; + } + + public function set midCtr(param1:Object) : void + { + this._midZCtr = param1; + } + + public function get mountainUri() : String + { + return this._sMountainUri; + } + + public function set mountainUri(param1:String) : void + { + this._sMountainUri = param1; + } + + public function get selectedChara() : int + { + return this._nSelectedChara; + } + + public function set selectedChara(param1:int) : void + { + this._nSelectedChara = param1; + } + + public function get isWheeling() : Boolean + { + return this._bMovingMountains; + } + + public function set entities(param1:*) : void + { + if(!this.isIterable(param1)) + { + throw new ArgumentError("entities must be either Array or Vector."); + } + else + { + this._aEntitiesLook = SecureCenter.unsecure(param1); + return; + } + } + + public function get entities() : * + { + return SecureCenter.secure(this._aEntitiesLook); + } + + public function set dataProvider(param1:*) : void + { + if(!this.isIterable(param1)) + { + throw new ArgumentError("dataProvider must be either Array or Vector."); + } + else + { + this._aCharactersList = param1; this.finalize(); - } - - public function get dataProvider() - { - return (this._aCharactersList); - } - - public function get finalized():Boolean - { - return (this._finalized); - } - - public function set finalized(b:Boolean):void - { - this._finalized = b; - } - - public function finalize():void - { - this._uiClass = getUi(); - if (this._aCharactersList) - { - this._nNbCharacters = this._aCharactersList.length; - this._nSelectedChara = 0; - if (this._nNbCharacters > 0) - { - this.charactersDisplay(); - }; - }; - this._finalized = true; - if (getUi()) - { - getUi().iAmFinalized(this); - }; - } - - override public function remove():void - { - var g:GraphicContainer; - var num:int; - var i:int; - var behavior:ISubEntityBehavior; - var tiphonEntity:TiphonEntity; - var numChildrenCtr:uint; - if (!(__removed)) - { - for each (g in this._aMountainsCtr) - { - g.remove(); - }; - num = this._aSprites.length; - i = 0; - while (i < num) - { - tiphonEntity = this._aSprites[i]; - tiphonEntity.destroy(); - i++; - }; - if (this._charaSelCtr) - { - numChildrenCtr = this._charaSelCtr.numChildren; - while (numChildrenCtr > 0) - { - this._charaSelCtr.removeChildAt(0); - numChildrenCtr--; - }; - }; - this._aCharactersList = null; - this._aEntitiesLook = null; - this._ctrDepth = null; - this._uiClass = null; - this._aMountainsCtr = null; - this._aSprites = null; - this._charaSelCtr = null; - this._midZCtr = null; - this._frontZCtr = null; - for each (behavior in _subEntitiesBehaviors) - { - if (behavior) - { - behavior.remove(); - }; - }; - }; - super.remove(); - } - - public function wheel(sens:int):void - { - this.rotateMountains(sens); - } - - public function wheelChara(sens:int):void - { - var dir:int = (IAnimated(this._aSprites[this._nSelectedChara]).getDirection() + sens); - dir = (((dir == 8)) ? 0 : dir); - dir = (((dir < 0)) ? 7 : dir); - IAnimated(this._aSprites[this._nSelectedChara]).setDirection(dir); - this.createMountainsCtrBitmap(this._aSprites[this._nSelectedChara].parent, this._nSelectedChara); - } - - public function setAnimation(animationName:String, direction:int=0):void - { - var seq:SerialSequencer = new SerialSequencer(); - var sprite:TiphonSprite = this._aSprites[this._nSelectedChara]; - if (animationName == "AnimStatique") - { - sprite.setAnimationAndDirection("AnimStatique", direction); + return; + } + } + + public function get dataProvider() : * + { + return this._aCharactersList; + } + + public function get finalized() : Boolean + { + return this._finalized; + } + + public function set finalized(param1:Boolean) : void + { + this._finalized = param1; + } + + public function finalize() : void + { + this._uiClass = getUi(); + if(this._aCharactersList) + { + this._nNbCharacters = this._aCharactersList.length; + this._nSelectedChara = 0; + if(this._nNbCharacters > 0) + { + this.charactersDisplay(); } - else - { - seq.addStep(new SetDirectionStep(sprite, direction)); - seq.addStep(new PlayAnimationStep(sprite, animationName, false)); - seq.addStep(new SetAnimationStep(sprite, "AnimStatique")); - seq.start(); - }; - } - - public function equipCharacter(list:Array, numDelete:int=0):void - { - var _local_6:Array; - var _local_7:int; - var sprite:TiphonSprite = this._aSprites[this._nSelectedChara]; - var base:Array = sprite.look.toString().split("|"); - if (list.length) - { - list.unshift(base[1].split(",")); - base[1] = list.join(","); + } + this._finalized = true; + if(getUi()) + { + getUi().iAmFinalized(this); + } + } + + override public function remove() : void + { + var _loc1_:GraphicContainer = null; + var _loc2_:* = 0; + var _loc3_:* = 0; + var _loc4_:ISubEntityBehavior = null; + var _loc5_:TiphonEntity = null; + var _loc6_:uint = 0; + if(!__removed) + { + for each(_loc1_ in this._aMountainsCtr) + { + _loc1_.remove(); } - else - { - _local_6 = base[1].split(","); - _local_7 = 0; - while (_local_7 < numDelete) - { - _local_6.pop(); - _local_7++; - }; - base[1] = _local_6.join(","); - }; - var tel:TiphonEntityLook = TiphonEntityLook.fromString(base.join("|")); - sprite.look.updateFrom(tel); - } - - public function getMountainCtr(i:int):Object - { - return (this._aMountainsCtr[i]); - } - - private function charactersDisplay():void - { - var g:GraphicContainer; - var te:TiphonEntity; - var children:uint; - var j:int; - var _local_7:Number; - var _local_8:int; - var angle:Number; - var coef:Number; - var ctr:GraphicContainer; - var characterInfo:CBI; - var oPerso:TiphonEntity; - var cat:*; - var mountain:Texture; - var ie:InstanceEvent; - var num:int = this._aSprites.length; - var k:int; - while (k < num) - { - te = this._aSprites.shift(); - te.destroy(); - k++; - }; - for each (g in this._aMountainsCtr) - { - g.remove(); - }; - if (this._aMountainsCtr.length > 0) + _loc2_ = this._aSprites.length; + _loc3_ = 0; + while(_loc3_ < _loc2_) { - children = this._aMountainsCtr.numChildren; - j = (children - 1); - while (j >= 0) - { - this._aMountainsCtr.removeChild(this._aMountainsCtr.getChildAt(j)); - j--; - }; - this._aMountainsCtr = new Array(); - this._ctrDepth = new Array(); - }; - if (this._nNbCharacters == 0) - { - _log.error("Error : The character list is empty."); + _loc5_ = this._aSprites[_loc3_]; + _loc5_.destroy(); + _loc3_++; } - else - { - _local_7 = ((2 * Math.PI) / this._nNbCharacters); - this._nRotation = 0; - this._nRotationPieceTrg = 0; - this._aRenderePartNames = new Array(); - _local_8 = 0; - while (_local_8 < this._nNbCharacters) - { - if (this._aCharactersList[_local_8]) - { - angle = ((_local_7 * _local_8) % (2 * Math.PI)); - coef = (Math.abs((angle - Math.PI)) / Math.PI); - ctr = new GraphicContainer(); - ctr.x = ((this._nWidthEllipsis * Math.cos((angle + (Math.PI / 2)))) + this._nXCenterEllipsis); - ctr.y = ((this._nHeightEllipsis * Math.sin((angle + (Math.PI / 2)))) + this._nYCenterEllipsis); - characterInfo = new CBI(this._aCharactersList[_local_8].id, this._aCharactersList[_local_8].breedId, new Array()); - this._aEntitiesLook[_local_8].look = SecureCenter.unsecure(this._aEntitiesLook[_local_8].look); - oPerso = new TiphonEntity(this._aEntitiesLook[_local_8].id, this._aEntitiesLook[_local_8].look); - ctr.addChild(oPerso); - oPerso.name = ("char" + _local_8); - oPerso.addEventListener(TiphonEvent.RENDER_SUCCEED, this.onMoutainPartRendered); - if (_animationModifier[oPerso.look.getBone()]) - { - oPerso.addAnimationModifier(_animationModifier[oPerso.look.getBone()]); - }; - if (_skinModifier[oPerso.look.getBone()]) - { - oPerso.skinModifier = _skinModifier[oPerso.look.getBone()]; - }; - for (cat in _subEntitiesBehaviors) - { - if (_subEntitiesBehaviors[cat]) - { - oPerso.setSubEntityBehaviour(cat, _subEntitiesBehaviors[cat]); - }; - }; - if (oPerso.look.getBone() == 1) - { - oPerso.setAnimationAndDirection("AnimStatique", 2); - } - else - { - oPerso.setAnimationAndDirection("AnimStatique", 3); - }; - oPerso.x = -5; - oPerso.y = -64; - oPerso.scaleX = 2.2; - oPerso.scaleY = 2.2; - oPerso.cacheAsBitmap = true; - this._aSprites[_local_8] = oPerso; - ctr.scaleX = (ctr.scaleY = Math.max(0.3, coef)); - ctr.alpha = Math.max(0.3, coef); - ctr.useHandCursor = true; - ctr.buttonMode = true; - if (this._nNbCharacters == 2) - { - if (_local_8 == 1) - { - ctr.x = ((this._nWidthEllipsis * Math.cos(((angle + (Math.PI / 6)) + (Math.PI / 2)))) + this._nXCenterEllipsis); - ctr.y = ((this._nHeightEllipsis * Math.sin(((angle + (Math.PI / 6)) + (Math.PI / 2)))) + this._nYCenterEllipsis); - }; - }; - if (this._nNbCharacters == 4) - { - if (_local_8 == 2) - { - ctr.x = ((this._nWidthEllipsis * Math.cos(((angle + (Math.PI / 6)) + (Math.PI / 2)))) + this._nXCenterEllipsis); - ctr.y = ((this._nHeightEllipsis * Math.sin(((angle + (Math.PI / 6)) + (Math.PI / 2)))) + this._nYCenterEllipsis); - }; - }; - mountain = new Texture(); - ctr.addChildAt(mountain, 0); - mountain.name = ("char" + _local_8); - mountain.dispatchMessages = true; - mountain.addEventListener(Event.COMPLETE, this.onMoutainPartRendered); - mountain.scale = 1.2; - mountain.y = -62; - mountain.uri = new Uri(((this._sMountainUri + "assets.swf|base_") + characterInfo.breed)); - mountain.finalize(); - ie = new InstanceEvent(ctr, this._uiClass.uiClass); - ie.push(EventEnums.EVENT_ONRELEASE_MSG); - ie.push(EventEnums.EVENT_ONDOUBLECLICK_MSG); - UIEventManager.getInstance().registerInstance(ie); - if (_local_8 == 0) - { - this._charaSelCtr.addChild(this._midZCtr); - }; - if (this._aEntitiesLook[_local_8].disabled) - { - ctr.transform.colorTransform = new ColorTransform(0.6, 0.6, 0.6, 1); - }; - this._charaSelCtr.addChild(ctr); - this._ctrDepth.push(this._charaSelCtr.getChildIndex(ctr)); - this._aMountainsCtr[_local_8] = ctr; - }; - _local_8++; - }; - this._charaSelCtr.addChild(this._frontZCtr); - }; - } - - private function onMoutainPartRendered(event:Event):void - { - if (event.type == TiphonEvent.RENDER_SUCCEED) - { - event.target.removeEventListener(TiphonEvent.RENDER_SUCCEED, this.onMoutainPartRendered); + if(this._charaSelCtr) + { + _loc6_ = this._charaSelCtr.numChildren; + while(_loc6_ > 0) + { + this._charaSelCtr.removeChildAt(0); + _loc6_--; + } } - else - { - if (event.type == Event.COMPLETE) - { - event.target.removeEventListener(Event.COMPLETE, this.onMoutainPartRendered); - }; - }; - if (((this._aRenderePartNames[event.target.name]) && (event.target.stage))) - { - this.createMountainsCtrBitmap(this._aRenderePartNames[event.target.name], int(event.target.name.replace("char", ""))); + this._aCharactersList = null; + this._aEntitiesLook = null; + this._ctrDepth = null; + this._uiClass = null; + this._aMountainsCtr = null; + this._aSprites = null; + this._charaSelCtr = null; + this._midZCtr = null; + this._frontZCtr = null; + for each(_loc4_ in _subEntitiesBehaviors) + { + if(_loc4_) + { + _loc4_.remove(); + } } - else - { - this._aRenderePartNames[event.target.name] = event.target.parent; - }; - } - - private function createMountainsCtrBitmap(ctr:GraphicContainer, charWheelID:int):void - { - var bmp:Bitmap; - var previousAlpha:Number = ctr.alpha; - ctr.alpha = 1; - var previousScale:Number = ctr.scaleX; - ctr.scaleX = (ctr.scaleY = 1); - if (ctr.numChildren > 2) - { - bmp = (ctr.getChildAt(2) as Bitmap); - if (((bmp) && (bmp.bitmapData))) - { - bmp.bitmapData.dispose(); - }; - }; - var bounds:Rectangle = ctr.getBounds(ctr); - var bmpData:BitmapData = new BitmapData(bounds.width, bounds.height, true, 5596808); - bmpData.draw(ctr, new Matrix(1, 0, 0, 1, -(bounds.x), -(bounds.y))); - if (!(bmp)) - { - bmp = new Bitmap(bmpData, "auto", true); + } + super.remove(); + } + + public function wheel(param1:int) : void + { + this.rotateMountains(param1); + } + + public function wheelChara(param1:int) : void + { + var _loc2_:int = IAnimated(this._aSprites[this._nSelectedChara]).getDirection() + param1; + _loc2_ = _loc2_ == 8?0:_loc2_; + _loc2_ = _loc2_ < 0?7:_loc2_; + IAnimated(this._aSprites[this._nSelectedChara]).setDirection(_loc2_); + this.createMountainsCtrBitmap(this._aSprites[this._nSelectedChara].parent,this._nSelectedChara); + } + + public function setAnimation(param1:String, param2:int = 0) : void + { + var _loc3_:SerialSequencer = new SerialSequencer(); + var _loc4_:TiphonSprite = this._aSprites[this._nSelectedChara]; + if(param1 == "AnimStatique") + { + _loc4_.setAnimationAndDirection("AnimStatique",param2); + } + else + { + _loc3_.addStep(new SetDirectionStep(_loc4_,param2)); + _loc3_.addStep(new PlayAnimationStep(_loc4_,param1,false)); + _loc3_.addStep(new SetAnimationStep(_loc4_,"AnimStatique")); + _loc3_.start(); + } + } + + public function equipCharacter(param1:Array, param2:int = 0) : void + { + var _loc6_:Array = null; + var _loc7_:* = 0; + var _loc3_:TiphonSprite = this._aSprites[this._nSelectedChara]; + var _loc4_:Array = _loc3_.look.toString().split("|"); + if(param1.length) + { + param1.unshift(_loc4_[1].split(",")); + _loc4_[1] = param1.join(","); + } + else + { + _loc6_ = _loc4_[1].split(","); + _loc7_ = 0; + while(_loc7_ < param2) + { + _loc6_.pop(); + _loc7_++; } - else - { - bmp.bitmapData = bmpData; - }; - bmp.x = bounds.x; - bmp.y = bounds.y; - ctr.alpha = previousAlpha; - ctr.scaleX = (ctr.scaleY = previousScale); - ctr.addChild(bmp); - if (ctr.numChildren == 3) - { - ctr.getChildAt(0).visible = (ctr.getChildAt(1).visible = (charWheelID == this._nSelectedChara)); - ctr.getChildAt(2).visible = !((charWheelID == this._nSelectedChara)); - }; - } - - private function endRotationMountains():void - { - EnterFrameDispatcher.removeEventListener(this.onRotateMountains); - this._bMovingMountains = false; - } - - private function rotateMountains(sens:int):void - { - var listener:IInterfaceListener; - var _local_4:IInterfaceListener; - this._nSelectedChara = (this._nSelectedChara - sens); - if (this._nSelectedChara >= this._aCharactersList.length) - { - this._nSelectedChara = (this._nSelectedChara - this._aCharactersList.length); - }; - if (this._nSelectedChara < 0) - { - this._nSelectedChara = (this._aCharactersList.length + this._nSelectedChara); - }; - var t:Number = ((2 * Math.PI) / this._nNbCharacters); - this._sens = sens; - this._nRotationStep = t; - if (isNaN(this._nRotationPieceTrg)) - { - this._nRotationPieceTrg = (this._nRotation + (this._nRotationStep * this._sens)); + _loc4_[1] = _loc6_.join(","); + } + var _loc5_:TiphonEntityLook = TiphonEntityLook.fromString(_loc4_.join("|")); + _loc3_.look.updateFrom(_loc5_); + } + + public function getMountainCtr(param1:int) : Object + { + return this._aMountainsCtr[param1]; + } + + private function charactersDisplay() : void + { + var _loc3_:GraphicContainer = null; + var _loc4_:TiphonEntity = null; + var _loc5_:uint = 0; + var _loc6_:* = 0; + var _loc7_:* = NaN; + var _loc8_:* = 0; + var _loc9_:* = NaN; + var _loc10_:* = NaN; + var _loc11_:GraphicContainer = null; + var _loc12_:CBI = null; + var _loc13_:TiphonEntity = null; + var _loc14_:* = undefined; + var _loc15_:Texture = null; + var _loc16_:InstanceEvent = null; + var _loc1_:int = this._aSprites.length; + var _loc2_:* = 0; + while(_loc2_ < _loc1_) + { + _loc4_ = this._aSprites.shift(); + _loc4_.destroy(); + _loc2_++; + } + for each(_loc3_ in this._aMountainsCtr) + { + _loc3_.remove(); + } + if(this._aMountainsCtr.length > 0) + { + _loc5_ = this._aMountainsCtr.numChildren; + _loc6_ = _loc5_ - 1; + while(_loc6_ >= 0) + { + this._aMountainsCtr.removeChild(this._aMountainsCtr.getChildAt(_loc6_)); + _loc6_--; } - else - { - this._nRotationPieceTrg = (this._nRotationPieceTrg + (this._nRotationStep * this._sens)); - }; - if (sens == 1) - { - for each (listener in Berilia.getInstance().UISoundListeners) - { - listener.playUISound("16079"); - }; + this._aMountainsCtr = new Array(); + this._ctrDepth = new Array(); + } + if(this._nNbCharacters == 0) + { + _log.error("Error : The character list is empty."); + } + else + { + _loc7_ = 2 * Math.PI / this._nNbCharacters; + this._nRotation = 0; + this._nRotationPieceTrg = 0; + this._aRenderePartNames = new Array(); + _loc8_ = 0; + while(_loc8_ < this._nNbCharacters) + { + if(this._aCharactersList[_loc8_]) + { + _loc9_ = _loc7_ * _loc8_ % (2 * Math.PI); + _loc10_ = Math.abs(_loc9_ - Math.PI) / Math.PI; + _loc11_ = new GraphicContainer(); + _loc11_.x = this._nWidthEllipsis * Math.cos(_loc9_ + Math.PI / 2) + this._nXCenterEllipsis; + _loc11_.y = this._nHeightEllipsis * Math.sin(_loc9_ + Math.PI / 2) + this._nYCenterEllipsis; + _loc12_ = new CBI(this._aCharactersList[_loc8_].id,this._aCharactersList[_loc8_].breedId,new Array()); + this._aEntitiesLook[_loc8_].look = SecureCenter.unsecure(this._aEntitiesLook[_loc8_].look); + _loc13_ = new TiphonEntity(this._aEntitiesLook[_loc8_].id,this._aEntitiesLook[_loc8_].look); + _loc11_.addChild(_loc13_); + _loc13_.name = "char" + _loc8_; + _loc13_.addEventListener(TiphonEvent.RENDER_SUCCEED,this.onMoutainPartRendered); + if(_animationModifier[_loc13_.look.getBone()]) + { + _loc13_.addAnimationModifier(_animationModifier[_loc13_.look.getBone()]); + } + if(_skinModifier[_loc13_.look.getBone()]) + { + _loc13_.skinModifier = _skinModifier[_loc13_.look.getBone()]; + } + for(_loc14_ in _subEntitiesBehaviors) + { + if(_subEntitiesBehaviors[_loc14_]) + { + _loc13_.setSubEntityBehaviour(_loc14_,_subEntitiesBehaviors[_loc14_]); + } + } + if(_loc13_.look.getBone() == 1) + { + _loc13_.setAnimationAndDirection("AnimStatique",2); + } + else + { + _loc13_.setAnimationAndDirection("AnimStatique",3); + } + _loc13_.x = -5; + _loc13_.y = -64; + _loc13_.scaleX = 2.2; + _loc13_.scaleY = 2.2; + _loc13_.cacheAsBitmap = true; + this._aSprites[_loc8_] = _loc13_; + _loc11_.scaleX = _loc11_.scaleY = Math.max(0.3,_loc10_); + _loc11_.alpha = Math.max(0.3,_loc10_); + _loc11_.useHandCursor = true; + _loc11_.buttonMode = true; + if(this._nNbCharacters == 2) + { + if(_loc8_ == 1) + { + _loc11_.x = this._nWidthEllipsis * Math.cos(_loc9_ + Math.PI / 6 + Math.PI / 2) + this._nXCenterEllipsis; + _loc11_.y = this._nHeightEllipsis * Math.sin(_loc9_ + Math.PI / 6 + Math.PI / 2) + this._nYCenterEllipsis; + } + } + if(this._nNbCharacters == 4) + { + if(_loc8_ == 2) + { + _loc11_.x = this._nWidthEllipsis * Math.cos(_loc9_ + Math.PI / 6 + Math.PI / 2) + this._nXCenterEllipsis; + _loc11_.y = this._nHeightEllipsis * Math.sin(_loc9_ + Math.PI / 6 + Math.PI / 2) + this._nYCenterEllipsis; + } + } + _loc15_ = new Texture(); + _loc11_.addChildAt(_loc15_,0); + _loc15_.name = "char" + _loc8_; + _loc15_.dispatchMessages = true; + _loc15_.addEventListener(Event.COMPLETE,this.onMoutainPartRendered); + _loc15_.scale = 1.2; + _loc15_.y = -62; + _loc15_.uri = new Uri(this._sMountainUri + "assets.swf|base_" + _loc12_.breed); + _loc15_.finalize(); + _loc16_ = new InstanceEvent(_loc11_,this._uiClass.uiClass); + _loc16_.push(EventEnums.EVENT_ONRELEASE_MSG); + _loc16_.push(EventEnums.EVENT_ONDOUBLECLICK_MSG); + UIEventManager.getInstance().registerInstance(_loc16_); + if(_loc8_ == 0) + { + this._charaSelCtr.addChild(this._midZCtr); + } + if(this._aEntitiesLook[_loc8_].disabled) + { + _loc11_.transform.colorTransform = new ColorTransform(0.6,0.6,0.6,1); + } + this._charaSelCtr.addChild(_loc11_); + this._ctrDepth.push(this._charaSelCtr.getChildIndex(_loc11_)); + this._aMountainsCtr[_loc8_] = _loc11_; + } + _loc8_++; } - else - { - for each (_local_4 in Berilia.getInstance().UISoundListeners) - { - _local_4.playUISound("16080"); - }; - }; - EnterFrameDispatcher.addEventListener(this.onRotateMountains, "mountainsRotation", StageShareManager.stage.frameRate); - } - - private function isIterable(obj:*):Boolean - { - if ((obj is Array)) - { - return (true); - }; - if (((((((((!((obj["length"] == null))) && (!((obj["length"] == 0))))) && (!(isNaN(obj["length"]))))) && (!((obj[0] == null))))) && (!((obj is String))))) - { - return (true); - }; - return (false); - } - - [HideInFakeClass] - override public function process(msg:Message):Boolean - { - return (false); - } - - public function eventOnRelease(target:DisplayObject):void - { - } - - public function eventOnDoubleClick(target:DisplayObject):void - { - if (!(this._bMovingMountains)) - { - }; - } - - public function eventOnRollOver(target:DisplayObject):void - { - } - - public function eventOnRollOut(target:DisplayObject):void - { - } - - public function eventOnShortcut(s:String):Boolean - { - return (false); - } - - private function onRotateMountains(e:Event):void - { - var ctr:GraphicContainer; - var angle:Number; - var coef:Number; - this._bMovingMountains = true; - if (this._nRotationStep == 0) - { - this.endRotationMountains(); - }; - if (Math.abs((this._nRotationPieceTrg - this._nRotation)) < 0.01) - { - this._nRotation = this._nRotationPieceTrg; + this._charaSelCtr.addChild(this._frontZCtr); + } + } + + private function onMoutainPartRendered(param1:Event) : void + { + if(param1.type == TiphonEvent.RENDER_SUCCEED) + { + param1.target.removeEventListener(TiphonEvent.RENDER_SUCCEED,this.onMoutainPartRendered); + } + else if(param1.type == Event.COMPLETE) + { + param1.target.removeEventListener(Event.COMPLETE,this.onMoutainPartRendered); + } + + if((this._aRenderePartNames[param1.target.name]) && (param1.target.stage)) + { + this.createMountainsCtrBitmap(this._aRenderePartNames[param1.target.name],int(param1.target.name.replace("char",""))); + } + else + { + this._aRenderePartNames[param1.target.name] = param1.target.parent; + } + } + + private function createMountainsCtrBitmap(param1:GraphicContainer, param2:int) : void + { + var _loc5_:Bitmap = null; + var _loc3_:Number = param1.alpha; + param1.alpha = 1; + var _loc4_:Number = param1.scaleX; + param1.scaleX = param1.scaleY = 1; + if(param1.numChildren > 2) + { + _loc5_ = param1.getChildAt(2) as Bitmap; + if((_loc5_) && (_loc5_.bitmapData)) + { + _loc5_.bitmapData.dispose(); } - else - { - this._nRotation = (this._nRotation + ((this._nRotationPieceTrg - this._nRotation) / 3)); - }; - var zOrder:Array = new Array(); - var i:int; - for each (ctr in this._aMountainsCtr) - { - angle = ((this._nRotation + (this._nRotationStep * i)) % (2 * Math.PI)); - coef = (Math.abs((Math.PI - ((((angle < 0)) ? (angle + (2 * Math.PI)) : angle) % (2 * Math.PI)))) / Math.PI); - zOrder.push({ - "ctr":ctr, - "z":coef - }); - ctr.x = ((this._nWidthEllipsis * Math.cos((angle + (Math.PI / 2)))) + this._nXCenterEllipsis); - ctr.y = ((this._nHeightEllipsis * Math.sin((angle + (Math.PI / 2)))) + this._nYCenterEllipsis); - if (this._nNbCharacters == 2) - { - if (ctr.y < 300) - { - ctr.x = ((this._nWidthEllipsis * Math.cos(((angle + (Math.PI / 6)) + (Math.PI / 2)))) + this._nXCenterEllipsis); - ctr.y = ((this._nHeightEllipsis * Math.sin(((angle + (Math.PI / 6)) + (Math.PI / 2)))) + this._nYCenterEllipsis); - }; - }; - if (this._nNbCharacters == 4) - { - if (ctr.y < 300) - { - ctr.x = ((this._nWidthEllipsis * Math.cos(((angle + (Math.PI / 6)) + (Math.PI / 2)))) + this._nXCenterEllipsis); - ctr.y = ((this._nHeightEllipsis * Math.sin(((angle + (Math.PI / 6)) + (Math.PI / 2)))) + this._nYCenterEllipsis); - }; - }; - ctr.scaleX = (ctr.scaleY = Math.max(0.3, coef)); - ctr.alpha = Math.max(0.3, coef); - if (ctr.numChildren == 3) - { - ctr.getChildAt(0).visible = (ctr.getChildAt(1).visible = (i == this._nSelectedChara)); - ctr.getChildAt(2).visible = !((i == this._nSelectedChara)); - }; - i++; - }; - zOrder.sortOn("z", Array.NUMERIC); - i = 0; - while (i < zOrder.length) + } + var _loc6_:Rectangle = param1.getBounds(param1); + var _loc7_:BitmapData = new BitmapData(_loc6_.width,_loc6_.height,true,5596808); + _loc7_.draw(param1,new Matrix(1,0,0,1,-_loc6_.x,-_loc6_.y)); + if(!_loc5_) + { + _loc5_ = new Bitmap(_loc7_,"auto",true); + } + else + { + _loc5_.bitmapData = _loc7_; + } + _loc5_.x = _loc6_.x; + _loc5_.y = _loc6_.y; + param1.alpha = _loc3_; + param1.scaleX = param1.scaleY = _loc4_; + param1.addChild(_loc5_); + if(param1.numChildren == 3) + { + param1.getChildAt(0).visible = param1.getChildAt(1).visible = param2 == this._nSelectedChara; + param1.getChildAt(2).visible = !(param2 == this._nSelectedChara); + } + } + + private function endRotationMountains() : void + { + EnterFrameDispatcher.removeEventListener(this.onRotateMountains); + this._bMovingMountains = false; + } + + private function rotateMountains(param1:int) : void + { + var _loc3_:IInterfaceListener = null; + var _loc4_:IInterfaceListener = null; + this._nSelectedChara = this._nSelectedChara - param1; + if(this._nSelectedChara >= this._aCharactersList.length) + { + this._nSelectedChara = this._nSelectedChara - this._aCharactersList.length; + } + if(this._nSelectedChara < 0) + { + this._nSelectedChara = this._aCharactersList.length + this._nSelectedChara; + } + var _loc2_:Number = 2 * Math.PI / this._nNbCharacters; + this._sens = param1; + this._nRotationStep = _loc2_; + if(isNaN(this._nRotationPieceTrg)) + { + this._nRotationPieceTrg = this._nRotation + this._nRotationStep * this._sens; + } + else + { + this._nRotationPieceTrg = this._nRotationPieceTrg + this._nRotationStep * this._sens; + } + if(param1 == 1) + { + for each(_loc3_ in Berilia.getInstance().UISoundListeners) + { + _loc3_.playUISound("16079"); + } + } + else + { + for each(_loc4_ in Berilia.getInstance().UISoundListeners) { - zOrder[i].ctr.parent.addChildAt(zOrder[i].ctr, this._ctrDepth[i]); - i++; - }; - if (this._charaSelCtr) + _loc4_.playUISound("16080"); + } + } + EnterFrameDispatcher.addEventListener(this.onRotateMountains,"mountainsRotation",StageShareManager.stage.frameRate); + } + + private function isIterable(param1:*) : Boolean + { + if(param1 is Array) + { + return true; + } + if(!(param1["length"] == null) && !(param1["length"] == 0) && !isNaN(param1["length"]) && !(param1[0] == null) && !(param1 is String)) + { + return true; + } + return false; + } + + override public function process(param1:Message) : Boolean + { + return false; + } + + public function eventOnRelease(param1:DisplayObject) : void + { + } + + public function eventOnDoubleClick(param1:DisplayObject) : void + { + if(this._bMovingMountains) + { + } + } + + public function eventOnRollOver(param1:DisplayObject) : void + { + } + + public function eventOnRollOut(param1:DisplayObject) : void + { + } + + public function eventOnShortcut(param1:String) : Boolean + { + return false; + } + + private function onRotateMountains(param1:Event) : void + { + var _loc4_:GraphicContainer = null; + var _loc5_:* = NaN; + var _loc6_:* = NaN; + this._bMovingMountains = true; + if(this._nRotationStep == 0) + { + this.endRotationMountains(); + } + if(Math.abs(this._nRotationPieceTrg - this._nRotation) < 0.01) + { + this._nRotation = this._nRotationPieceTrg; + } + else + { + this._nRotation = this._nRotation + (this._nRotationPieceTrg - this._nRotation) / 3; + } + var _loc2_:Array = new Array(); + var _loc3_:* = 0; + for each(_loc4_ in this._aMountainsCtr) + { + _loc5_ = (this._nRotation + this._nRotationStep * _loc3_) % (2 * Math.PI); + _loc6_ = Math.abs(Math.PI - (_loc5_ < 0?_loc5_ + 2 * Math.PI:_loc5_) % (2 * Math.PI)) / Math.PI; + _loc2_.push({ + "ctr":_loc4_, + "z":_loc6_ + }); + _loc4_.x = this._nWidthEllipsis * Math.cos(_loc5_ + Math.PI / 2) + this._nXCenterEllipsis; + _loc4_.y = this._nHeightEllipsis * Math.sin(_loc5_ + Math.PI / 2) + this._nYCenterEllipsis; + if(this._nNbCharacters == 2) + { + if(_loc4_.y < 300) + { + _loc4_.x = this._nWidthEllipsis * Math.cos(_loc5_ + Math.PI / 6 + Math.PI / 2) + this._nXCenterEllipsis; + _loc4_.y = this._nHeightEllipsis * Math.sin(_loc5_ + Math.PI / 6 + Math.PI / 2) + this._nYCenterEllipsis; + } + } + if(this._nNbCharacters == 4) { - this._charaSelCtr.setChildIndex(this._frontZCtr, (this._charaSelCtr.numChildren - 1)); - }; - if (this._nRotationPieceTrg == this._nRotation) + if(_loc4_.y < 300) + { + _loc4_.x = this._nWidthEllipsis * Math.cos(_loc5_ + Math.PI / 6 + Math.PI / 2) + this._nXCenterEllipsis; + _loc4_.y = this._nHeightEllipsis * Math.sin(_loc5_ + Math.PI / 6 + Math.PI / 2) + this._nYCenterEllipsis; + } + } + _loc4_.scaleX = _loc4_.scaleY = Math.max(0.3,_loc6_); + _loc4_.alpha = Math.max(0.3,_loc6_); + if(_loc4_.numChildren == 3) { - this.endRotationMountains(); - }; - } - - - } -}//package com.ankamagames.berilia.components - + _loc4_.getChildAt(0).visible = _loc4_.getChildAt(1).visible = _loc3_ == this._nSelectedChara; + _loc4_.getChildAt(2).visible = !(_loc3_ == this._nSelectedChara); + } + _loc3_++; + } + _loc2_.sortOn("z",Array.NUMERIC); + _loc3_ = 0; + while(_loc3_ < _loc2_.length) + { + _loc2_[_loc3_].ctr.parent.addChildAt(_loc2_[_loc3_].ctr,this._ctrDepth[_loc3_]); + _loc3_++; + } + if(this._charaSelCtr) + { + this._charaSelCtr.setChildIndex(this._frontZCtr,this._charaSelCtr.numChildren - 1); + } + if(this._nRotationPieceTrg == this._nRotation) + { + this.endRotationMountains(); + } + } + } +} import com.ankamagames.tiphon.display.TiphonSprite; import com.ankamagames.jerakine.entities.interfaces.IEntity; -import com.ankamagames.tiphon.types.look.TiphonEntityLook; import com.ankamagames.jerakine.types.positions.MapPoint; +import com.ankamagames.tiphon.types.look.TiphonEntityLook; -class TiphonEntity extends TiphonSprite implements IEntity +class TiphonEntity extends TiphonSprite implements IEntity { - - /*private*/ var _id:uint; - - public function TiphonEntity(id:uint, look:TiphonEntityLook) - { - super(look); - this._id = id; - mouseEnabled = false; - mouseChildren = false; - } - - public function get id():int - { - return (this._id); - } - - public function set id(nValue:int):void - { - this._id = nValue; - } - - public function get position():MapPoint - { - return (null); - } - - public function set position(oValue:MapPoint):void - { - } - - + + function TiphonEntity(param1:uint, param2:TiphonEntityLook) + { + super(param2); + this._id = param1; + mouseEnabled = false; + mouseChildren = false; + } + + private var _id:uint; + + public function get id() : int + { + return this._id; + } + + public function set id(param1:int) : void + { + this._id = param1; + } + + public function get position() : MapPoint + { + return null; + } + + public function set position(param1:MapPoint) : void + { + } } -class CBI +class CBI extends Object { - - public var id:int; - public var gfxId:int; - public var breed:int; - public var colors:Array; - - public function CBI(id:uint, breed:int, colors:Array) - { - this.colors = new Array(); - super(); - this.id = id; - this.breed = breed; - this.colors = colors; - } - + + function CBI(param1:uint, param2:int, param3:Array) + { + this.colors = new Array(); + super(); + this.id = param1; + this.breed = param2; + this.colors = param3; + } + + public var id:int; + + public var gfxId:int; + + public var breed:int; + + public var colors:Array; } - diff --git a/com/ankamagames/berilia/components/ChatComponent.as b/com/ankamagames/berilia/components/ChatComponent.as index 8720a917e..2fdacfe39 100644 --- a/com/ankamagames/berilia/components/ChatComponent.as +++ b/com/ankamagames/berilia/components/ChatComponent.as @@ -1,944 +1,965 @@ -package com.ankamagames.berilia.components +package com.ankamagames.berilia.components { - import com.ankamagames.berilia.types.graphic.GraphicContainer; - import com.ankamagames.berilia.UIComponent; - import com.ankamagames.jerakine.interfaces.IRectangle; - import com.ankamagames.berilia.FinalizableUIComponent; - import com.ankamagames.jerakine.logger.Logger; - import com.ankamagames.jerakine.logger.Log; - import flash.utils.getQualifiedClassName; - import flashx.textLayout.container.ContainerController; - import flashx.textLayout.elements.TextFlow; - import flash.display.Sprite; - import flashx.textLayout.formats.TextLayoutFormat; - import com.ankamagames.berilia.types.data.ExtendedStyleSheet; - import com.ankamagames.jerakine.types.Uri; - import __AS3__.vec.Vector; - import flash.utils.Dictionary; - import flash.events.Event; - import com.adobe.utils.StringUtil; - import flashx.textLayout.elements.ParagraphElement; - import com.ankamagames.jerakine.utils.benchmark.monitoring.FpsManager; - import com.ankamagames.berilia.factories.HyperlinkFactory; - import com.ankamagames.berilia.managers.CssManager; - import com.ankamagames.jerakine.types.Callback; - import flashx.textLayout.compose.TextFlowLine; - import flash.text.engine.FontWeight; - import flashx.textLayout.formats.TextDecoration; - import flashx.textLayout.elements.Configuration; - import com.ankamagames.berilia.types.graphic.ChatTextContainer; - import flashx.textLayout.compose.StandardFlowComposer; - import flashx.textLayout.container.ScrollPolicy; - import flashx.textLayout.formats.BlockProgression; - import flashx.textLayout.edit.SelectionManager; - import flashx.textLayout.events.FlowElementMouseEvent; - import flashx.textLayout.events.SelectionEvent; - import flash.events.MouseEvent; - import flashx.textLayout.events.TextLayoutEvent; - import com.ankamagames.jerakine.utils.display.EnterFrameDispatcher; - import com.ankamagames.berilia.managers.TooltipManager; - import flashx.textLayout.edit.ElementRange; - import flashx.textLayout.elements.FlowLeafElement; - import flashx.textLayout.elements.LinkElement; - import com.ankamagames.berilia.events.LinkInteractionEvent; - import flash.events.TextEvent; - import flashx.textLayout.events.ScrollEvent; - import com.ankamagames.berilia.types.graphic.UiRootContainer; - import flashx.textLayout.events.DamageEvent; - import flashx.textLayout.formats.VerticalAlign; - import flashx.textLayout.elements.SpanElement; - import com.ankamagames.berilia.managers.HtmlManager; - import com.ankamagames.jerakine.utils.misc.StringUtils; - import com.ankamagames.jerakine.data.XmlConfig; - import flashx.textLayout.elements.InlineGraphicElement; - import flash.display.BitmapData; - import flash.display.Bitmap; - import flash.display.Loader; - import flashx.textLayout.compose.IFlowComposer; - import flash.utils.ByteArray; - import flash.text.engine.TextBaseline; - import flash.filesystem.FileStream; - import flash.filesystem.File; - import flash.filesystem.FileMode; - import __AS3__.vec.*; - - public class ChatComponent extends GraphicContainer implements UIComponent, IRectangle, FinalizableUIComponent - { - - protected static const _log:Logger = Log.getLogger(getQualifiedClassName(ChatComponent)); - public static var KAMA_PATTERN:RegExp = /(?:\s|^)([0-9.,\s]+\s?)\/k(?=\W|$)/gi; - public static var TAGS_PATTERN:RegExp = /<([a-zA-Z]+)(>|(\s*([^>]*)+)>)(.*?)<\/\1>/gi; - public static var QUOTE_PATTERN:RegExp = /('|")/gi; - public static var BOLD_PATTERN:RegExp = /<\/?b>/gi; - public static var UNDERLINE_PATTERN:RegExp = /<\/?u>/gi; - public static var ITALIC_PATTERN:RegExp = /<\/?i>/gi; - private static var IMAGE_SIZE:int = 20; - public static var LINE_HEIGHT:int = 20; - - private var _finalized:Boolean = false; - private var _controller:ContainerController; - private var _textFlow:TextFlow; - private var _textContainer:Sprite; - private var _sbScrollBar:ScrollBar; - private var _TLFFormat:TextLayoutFormat; - private var _sCssClass:String; - private var _ssSheet:ExtendedStyleSheet; - private var _sCssUrl:Uri; - private var _aStyleObj:Array; - private var _cssApplied:Boolean; - private var _nScrollPos:int = 5; - private var _scrollTopMargin:int = 0; - private var _scrollBottomMargin:int = 0; - private var _smiliesUri:String; - private var _smilies:Vector.; - private var _smiliesActivated:Boolean = false; - private var _isDamaged:Boolean = false; - private var _currentSelection:String = ""; - private var _magicbool:Boolean = true; - private var _bmpdtList:Dictionary; - - public function ChatComponent() - { - this._bmpdtList = new Dictionary(); - super(); - this._sbScrollBar = new ScrollBar(); - this._sbScrollBar.min = 1; - this._sbScrollBar.max = 1; - this._sbScrollBar.step = 1; - this._sbScrollBar.scrollSpeed = (1 / 6); - this._sbScrollBar.addEventListener(Event.CHANGE, this.onScroll); - addChild(this._sbScrollBar); - this._aStyleObj = new Array(); - this._cssApplied = false; - this.createTextField(); - } - - public static function supprSpace(val:String):String - { - var regExp:RegExp = /_/g; - return (val); - } - - public static function isValidSmiley(sTxt:String, indexOfSmiley:int, triggerTxt:String):Boolean - { - if ((((((((((indexOfSmiley == 0)) && ((sTxt.length == triggerTxt.length)))) || ((((((indexOfSmiley > 0)) && ((sTxt.length == (indexOfSmiley + triggerTxt.length))))) && ((sTxt.charAt((indexOfSmiley - 1)) == " ")))))) || ((((((indexOfSmiley == 0)) && ((sTxt.length > triggerTxt.length)))) && ((sTxt.charAt((indexOfSmiley + triggerTxt.length)) == " ")))))) || ((((((((indexOfSmiley > 0)) && (((indexOfSmiley + triggerTxt.length) < sTxt.length)))) && ((sTxt.charAt((indexOfSmiley - 1)) == " ")))) && ((sTxt.charAt((indexOfSmiley + triggerTxt.length)) == " ")))))) - { - return (true); - }; - return (false); - } - - - override public function remove():void - { - super.remove(); - } - - public function initSmileyTab(uri:String, data:Object):void - { - var t:Object; - var smiley:Smiley; - var i:int; - var len:int; - var trigger:String; - this._smiliesUri = uri; - this._smilies = new Vector.(); - for each (t in data) - { - if (((!((t.triggers == null))) && ((t.triggers.length > 0)))) - { - smiley = new Smiley(t.gfxId); - smiley.triggers = new Vector.(t.triggers.length); - len = t.triggers.length; - i = 0; - while (i < len) - { - trigger = t.triggers[i]; - trigger = StringUtil.replace(trigger, "&", "&"); - trigger = StringUtil.replace(trigger, "<", "<"); - trigger = StringUtil.replace(trigger, ">", ">"); - smiley.triggers[i] = trigger; - i++; - }; - this._smilies.push(smiley); - }; - }; - } - - public function clearText():void - { - var p:ParagraphElement; - while (this._textFlow.numChildren > 0) - { - this.removeFirstLine(); - }; + import com.ankamagames.berilia.types.graphic.GraphicContainer; + import com.ankamagames.berilia.UIComponent; + import com.ankamagames.jerakine.interfaces.IRectangle; + import com.ankamagames.berilia.FinalizableUIComponent; + import com.ankamagames.jerakine.logger.Logger; + import com.ankamagames.jerakine.logger.Log; + import flash.utils.getQualifiedClassName; + import flashx.textLayout.container.ContainerController; + import flashx.textLayout.elements.TextFlow; + import flash.display.Sprite; + import flashx.textLayout.formats.TextLayoutFormat; + import com.ankamagames.berilia.types.data.ExtendedStyleSheet; + import com.ankamagames.jerakine.types.Uri; + import com.adobe.utils.StringUtil; + import flashx.textLayout.elements.ParagraphElement; + import com.ankamagames.jerakine.utils.benchmark.monitoring.FpsManager; + import com.ankamagames.berilia.factories.HyperlinkFactory; + import com.ankamagames.berilia.managers.CssManager; + import com.ankamagames.jerakine.types.Callback; + import flashx.textLayout.compose.TextFlowLine; + import flash.text.engine.FontWeight; + import flashx.textLayout.formats.TextDecoration; + import flashx.textLayout.elements.Configuration; + import com.ankamagames.berilia.types.graphic.ChatTextContainer; + import flashx.textLayout.compose.StandardFlowComposer; + import flashx.textLayout.container.ScrollPolicy; + import flashx.textLayout.formats.BlockProgression; + import flashx.textLayout.edit.SelectionManager; + import flashx.textLayout.events.FlowElementMouseEvent; + import flashx.textLayout.events.SelectionEvent; + import flash.events.MouseEvent; + import flashx.textLayout.events.TextLayoutEvent; + import com.ankamagames.jerakine.utils.display.EnterFrameDispatcher; + import flash.events.Event; + import com.ankamagames.berilia.managers.TooltipManager; + import flashx.textLayout.edit.ElementRange; + import flashx.textLayout.elements.FlowLeafElement; + import flashx.textLayout.elements.LinkElement; + import com.ankamagames.berilia.events.LinkInteractionEvent; + import flash.events.TextEvent; + import flashx.textLayout.events.ScrollEvent; + import com.ankamagames.berilia.types.graphic.UiRootContainer; + import flashx.textLayout.events.DamageEvent; + import flashx.textLayout.formats.VerticalAlign; + import flashx.textLayout.elements.SpanElement; + import com.ankamagames.berilia.managers.HtmlManager; + import com.ankamagames.jerakine.utils.misc.StringUtils; + import com.ankamagames.jerakine.data.XmlConfig; + import flash.utils.Dictionary; + import flashx.textLayout.elements.InlineGraphicElement; + import flash.display.BitmapData; + import flash.display.Bitmap; + import flash.display.Loader; + import flashx.textLayout.compose.IFlowComposer; + import flash.utils.ByteArray; + import flash.text.engine.TextBaseline; + import flash.filesystem.FileStream; + import flash.filesystem.File; + import flash.filesystem.FileMode; + + public class ChatComponent extends GraphicContainer implements UIComponent, IRectangle, FinalizableUIComponent + { + + public function ChatComponent() + { + this._bmpdtList = new Dictionary(); + super(); + this._sbScrollBar = new ScrollBar(); + this._sbScrollBar.min = 1; + this._sbScrollBar.max = 1; + this._sbScrollBar.step = 1; + this._sbScrollBar.scrollSpeed = 1 / 6; + this._sbScrollBar.addEventListener(Event.CHANGE,this.onScroll); + addChild(this._sbScrollBar); + this._aStyleObj = new Array(); + this._cssApplied = false; + this.createTextField(); + } + + protected static const _log:Logger = Log.getLogger(getQualifiedClassName(ChatComponent)); + + public static var KAMA_PATTERN:RegExp = new RegExp("(?:\\s|^)([0-9.,\\s]+\\s?)\\/k(?=\\W|$)","gi"); + + public static var TAGS_PATTERN:RegExp = new RegExp("<([a-zA-Z]+)(>|(\\s*([^>]*)+)>)(.*?)<\\/\\1>","gi"); + + public static var QUOTE_PATTERN:RegExp = new RegExp("(\'|\")","gi"); + + public static var BOLD_PATTERN:RegExp = new RegExp("<\\/?b>","gi"); + + public static var UNDERLINE_PATTERN:RegExp = new RegExp("<\\/?u>","gi"); + + public static var ITALIC_PATTERN:RegExp = new RegExp("<\\/?i>","gi"); + + private static var IMAGE_SIZE:int = 20; + + public static var LINE_HEIGHT:int = 20; + + public static function supprSpace(param1:String) : String + { + var _loc2_:RegExp = new RegExp("_","g"); + return param1; + } + + public static function isValidSmiley(param1:String, param2:int, param3:String) : Boolean + { + if(param2 == 0 && param1.length == param3.length || param2 > 0 && param1.length == param2 + param3.length && param1.charAt(param2 - 1) == " " || param2 == 0 && param1.length > param3.length && param1.charAt(param2 + param3.length) == " " || param2 > 0 && param2 + param3.length < param1.length && param1.charAt(param2 - 1) == " " && param1.charAt(param2 + param3.length) == " ") + { + return true; + } + return false; + } + + private var _finalized:Boolean = false; + + private var _controller:ContainerController; + + private var _textFlow:TextFlow; + + private var _textContainer:Sprite; + + private var _sbScrollBar:ScrollBar; + + private var _TLFFormat:TextLayoutFormat; + + private var _sCssClass:String; + + private var _ssSheet:ExtendedStyleSheet; + + private var _sCssUrl:Uri; + + private var _aStyleObj:Array; + + private var _cssApplied:Boolean; + + private var _nScrollPos:int = 5; + + private var _scrollTopMargin:int = 0; + + private var _scrollBottomMargin:int = 0; + + private var _smiliesUri:String; + + private var _smilies:Vector.; + + private var _smiliesActivated:Boolean = false; + + override public function remove() : void + { + super.remove(); + } + + public function initSmileyTab(param1:String, param2:Object) : void + { + var _loc3_:Object = null; + var _loc4_:Smiley = null; + var _loc5_:* = 0; + var _loc6_:* = 0; + var _loc7_:String = null; + this._smiliesUri = param1; + this._smilies = new Vector.(); + for each(_loc3_ in param2) + { + if(!(_loc3_.triggers == null) && _loc3_.triggers.length > 0) + { + _loc4_ = new Smiley(_loc3_.gfxId); + _loc4_.triggers = new Vector.(_loc3_.triggers.length); + _loc6_ = _loc3_.triggers.length; + _loc5_ = 0; + while(_loc5_ < _loc6_) + { + _loc7_ = _loc3_.triggers[_loc5_]; + _loc7_ = StringUtil.replace(_loc7_,"&","&"); + _loc7_ = StringUtil.replace(_loc7_,"<","<"); + _loc7_ = StringUtil.replace(_loc7_,">",">"); + _loc4_.triggers[_loc5_] = _loc7_; + _loc5_++; + } + this._smilies.push(_loc4_); + } + } + } + + public function clearText() : void + { + var _loc1_:ParagraphElement = null; + while(this._textFlow.numChildren > 0) + { + this.removeFirstLine(); + } + this._isDamaged = true; + this.updateScrollBar(true); + } + + public function removeFirstLine() : void + { + if(this._textFlow.numChildren > 0) + { + this._textFlow.removeChildAt(0); + } + } + + public function removeLines(param1:int) : void + { + var _loc2_:* = 0; + _loc2_ = 0; + while(_loc2_ < param1) + { + this.removeFirstLine(); + _loc2_++; + } + this._isDamaged = true; + } + + public function get smiliesActivated() : Boolean + { + return this._smiliesActivated; + } + + public function set smiliesActivated(param1:Boolean) : void + { + this._smiliesActivated = param1; + } + + override public function set width(param1:Number) : void + { + var param1:Number = param1 - this._sbScrollBar.width; + super.width = param1; + this._controller.setCompositionSize(param1,this._controller.compositionHeight); + this._isDamaged = true; + if(this._finalized) + { + this.updateScrollBarPos(); + } + } + + override public function set height(param1:Number) : void + { + if(!(param1 == super.height) || !(param1 == this._sbScrollBar.height - this._scrollTopMargin - this._scrollBottomMargin)) + { + var param1:Number = param1 + 2; + super.height = param1; + this._sbScrollBar.height = param1 - this._scrollTopMargin - this._scrollBottomMargin; + this._controller.setCompositionSize(this._controller.compositionWidth,param1); this._isDamaged = true; - this.updateScrollBar(true); - } - - public function removeFirstLine():void - { - if (this._textFlow.numChildren > 0) - { - this._textFlow.removeChildAt(0); - }; - } - - public function removeLines(value:int):void - { - var i:int; - i = 0; - while (i < value) + if(this._finalized) { - this.removeFirstLine(); - i++; - }; - this._isDamaged = true; - } - - public function get smiliesActivated():Boolean - { - return (this._smiliesActivated); - } - - public function set smiliesActivated(value:Boolean):void - { - this._smiliesActivated = value; - } - - override public function set width(val:Number):void - { - val = (val - this._sbScrollBar.width); - super.width = val; - this._controller.setCompositionSize(val, this._controller.compositionHeight); + this.updateScrollBar(); + } + } + } + + public function set scrollPos(param1:int) : void + { + this._nScrollPos = param1; + } + + public function get scrollBottomMargin() : int + { + return this._scrollBottomMargin; + } + + public function set scrollBottomMargin(param1:int) : void + { + this._scrollBottomMargin = param1; + this._sbScrollBar.height = this._controller.compositionHeight - this._scrollTopMargin - this._scrollBottomMargin; + } + + public function get scrollTopMargin() : int + { + return this._scrollTopMargin; + } + + public function set scrollTopMargin(param1:int) : void + { + this._scrollTopMargin = param1; + this._sbScrollBar.y = this._scrollTopMargin; + this._sbScrollBar.height = this._controller.compositionHeight - this._scrollTopMargin - this._scrollBottomMargin; + } + + public function appendText(param1:String, param2:String = null, param3:Boolean = true) : ParagraphElement + { + FpsManager.getInstance().startTracking("chat",4972530); + if((param2) && (this._aStyleObj[param2])) + { + this._TLFFormat = this._ssSheet.TLFTransform(this._aStyleObj[param2]); + } + var param1:String = HyperlinkFactory.decode(param1); + var _loc4_:ParagraphElement = this.createParagraphe(param1); + if(param3) + { + this._textFlow.addChild(_loc4_); this._isDamaged = true; - if (this._finalized) + if(this._finalized) { - this.updateScrollBarPos(); - }; - } - - override public function set height(val:Number):void - { - if (((!((val == super.height))) || (!((val == ((this._sbScrollBar.height - this._scrollTopMargin) - this._scrollBottomMargin)))))) - { - val = (val + 2); - super.height = val; - this._sbScrollBar.height = ((val - this._scrollTopMargin) - this._scrollBottomMargin); - this._controller.setCompositionSize(this._controller.compositionWidth, val); - this._isDamaged = true; - if (this._finalized) - { - this.updateScrollBar(); - }; - }; - } - - public function set scrollPos(nValue:int):void - { - this._nScrollPos = nValue; - } - - public function get scrollBottomMargin():int - { - return (this._scrollBottomMargin); - } - - public function set scrollBottomMargin(value:int):void - { - this._scrollBottomMargin = value; - this._sbScrollBar.height = ((this._controller.compositionHeight - this._scrollTopMargin) - this._scrollBottomMargin); - } - - public function get scrollTopMargin():int - { - return (this._scrollTopMargin); - } - - public function set scrollTopMargin(value:int):void - { - this._scrollTopMargin = value; - this._sbScrollBar.y = this._scrollTopMargin; - this._sbScrollBar.height = ((this._controller.compositionHeight - this._scrollTopMargin) - this._scrollBottomMargin); - } - - public function appendText(sTxt:String, style:String=null, addToChat:Boolean=true):ParagraphElement - { - FpsManager.getInstance().startTracking("chat", 4972530); - if (((style) && (this._aStyleObj[style]))) - { - this._TLFFormat = this._ssSheet.TLFTransform(this._aStyleObj[style]); - }; - sTxt = HyperlinkFactory.decode(sTxt); - var p:ParagraphElement = this.createParagraphe(sTxt); - if (addToChat) - { - this._textFlow.addChild(p); - this._isDamaged = true; - if (this._finalized) - { - this.updateScrollBar(); - }; - }; - FpsManager.getInstance().stopTracking("chat"); - return (p); - } - - public function set css(sFile:Uri):void - { - this._cssApplied = false; - this.applyCSS(sFile); - } - - public function applyCSS(sFile:Uri):void - { - if (sFile == null) - { - return; - }; - if (sFile != this._sCssUrl) - { - this._sCssUrl = sFile; - CssManager.getInstance().askCss(sFile.uri, new Callback(this.bindCss)); - }; - } - - public function set cssClass(c:String):void - { - this._sCssClass = (((c == "")) ? "p" : c); - this.bindCss(); - } - - private function bindCss():void - { - var styleToDisplay:String; - var sProperty:String; - var oldCss:ExtendedStyleSheet = this._ssSheet; - this._ssSheet = CssManager.getInstance().getCss(this._sCssUrl.uri); - for each (sProperty in this._ssSheet.styleNames) - { - if (((((!(styleToDisplay)) || ((sProperty == this._sCssClass)))) || (((!((this._sCssClass == styleToDisplay))) && ((sProperty == "p")))))) - { - styleToDisplay = sProperty; - }; - if (((!((this._ssSheet == oldCss))) || (!(this._aStyleObj[sProperty])))) - { - this._aStyleObj[sProperty] = this._ssSheet.getStyle(sProperty); - }; - }; - this._TLFFormat = this._ssSheet.TLFTransform(this._aStyleObj[styleToDisplay]); - } - - public function setCssColor(color:String, style:String=null):void - { - this.changeCssClassColor(color, style); - } - - public function setCssSize(size:uint, lineHeight:uint, style:String=null):void - { - this.changeCssClassSize(size, lineHeight, style); - } - - private function changeCssClassSize(size:uint, lineHeight:uint, style:String=null):void - { - var _local_4:*; - if (style) - { - this._aStyleObj[style].fontSize = (size + "px"); + this.updateScrollBar(); } - else - { - for each (_local_4 in this._aStyleObj) - { - _local_4.fontSize = (size + "px"); - }; - }; - this.bindCss(); - this._textFlow.lineHeight = lineHeight; - } - - private function changeCssClassColor(color:String, style:String=null):void - { - var _local_3:*; - if (style) - { - if (this._aStyleObj[style] == null) - { - this._aStyleObj[style] = new Object(); - }; - this._aStyleObj[style].color = color; - this._TLFFormat.concat(this._ssSheet.TLFTransform(this._aStyleObj[style])); + } + FpsManager.getInstance().stopTracking("chat"); + return _loc4_; + } + + public function set css(param1:Uri) : void + { + this._cssApplied = false; + this.applyCSS(param1); + } + + public function applyCSS(param1:Uri) : void + { + if(param1 == null) + { + return; + } + if(param1 != this._sCssUrl) + { + this._sCssUrl = param1; + CssManager.getInstance().askCss(param1.uri,new Callback(this.bindCss)); + } + } + + public function set cssClass(param1:String) : void + { + this._sCssClass = param1 == ""?"p":param1; + this.bindCss(); + } + + private function bindCss() : void + { + var _loc2_:String = null; + var _loc3_:String = null; + var _loc1_:ExtendedStyleSheet = this._ssSheet; + this._ssSheet = CssManager.getInstance().getCss(this._sCssUrl.uri); + for each(_loc3_ in this._ssSheet.styleNames) + { + if(!_loc2_ || _loc3_ == this._sCssClass || !(this._sCssClass == _loc2_) && _loc3_ == "p") + { + _loc2_ = _loc3_; } - else - { - for each (_local_3 in this._aStyleObj) - { - _local_3.color = color; - }; - }; - } - - public function get scrollV():int - { - return (Math.round(((this._controller.verticalScrollPosition + this._controller.compositionHeight) / this._textFlow.lineHeight))); - } - - public function set scrollV(val:int):void - { - this._controller.verticalScrollPosition = ((val * this._textFlow.lineHeight) - this._controller.compositionHeight); - } - - public function get maxScrollV():int - { - this._textFlow.flowComposer.composeToPosition(); - return (this._textFlow.flowComposer.numLines); - } - - public function get textHeight():Number - { - var i:int; - var height:Number = 0; - var len:int = this._textFlow.numChildren; - i = 0; - while (i < len) + if(!(this._ssSheet == _loc1_) || !this._aStyleObj[_loc3_]) { - height = (height + this.getParagraphHeight((this._textFlow.getChildAt(i) as ParagraphElement))); - i++; - }; - return (height); - } - - private function getParagraphHeight(p:ParagraphElement):Number - { - var line:TextFlowLine; - var height:Number = 0; - var pos:int = p.getAbsoluteStart(); - var endPos:int = (pos + p.textLength); - while (pos < endPos) - { - line = p.getTextFlow().flowComposer.findLineAtPosition(pos); - height = (height + line.height); - pos = (pos + line.textLength); - }; - return (height); - } - - public function set scrollCss(sUrl:Uri):void - { - this._sbScrollBar.css = sUrl; - } - - public function get scrollCss():Uri - { - return (this._sbScrollBar.css); - } - - private function createTextField():void - { - var ca:TextLayoutFormat = new TextLayoutFormat(); - ca.fontWeight = FontWeight.BOLD; - ca.color = "#ff0000"; - ca.textDecoration = TextDecoration.NONE; - var conf:Configuration = new Configuration(); - conf.defaultLinkNormalFormat = ca; - TextFlow.defaultConfiguration = conf; - this._textContainer = new ChatTextContainer(); - this._textContainer.x = this._sbScrollBar.width; - addChild(this._textContainer); - this._textFlow = new TextFlow(conf); - this._textFlow.paddingBottom = 2; - this._textFlow.flowComposer = new StandardFlowComposer(); - this._controller = new ContainerController(this._textContainer, width, height); - this._controller.horizontalScrollPolicy = ScrollPolicy.ON; - this._controller.blockProgression = BlockProgression.TB; - this._textFlow.interactionManager = new SelectionManager(); - this._textFlow.addEventListener(FlowElementMouseEvent.ROLL_OVER, this.onMouseOverLink); - this._textFlow.addEventListener(FlowElementMouseEvent.ROLL_OUT, this.onMouseOutLink); - this._textFlow.addEventListener(SelectionEvent.SELECTION_CHANGE, this.selectionChanged); - this._textContainer.addEventListener(MouseEvent.ROLL_OUT, this.onRollOutChat); - this._textFlow.addEventListener(TextLayoutEvent.SCROLL, this.scrollTextFlow); - this._textFlow.flowComposer.addController(this._controller); + this._aStyleObj[_loc3_] = this._ssSheet.getStyle(_loc3_); + } + } + this._TLFFormat = this._ssSheet.TLFTransform(this._aStyleObj[_loc2_]); + } + + public function setCssColor(param1:String, param2:String = null) : void + { + this.changeCssClassColor(param1,param2); + } + + public function setCssSize(param1:uint, param2:uint, param3:String = null) : void + { + this.changeCssClassSize(param1,param2,param3); + } + + private function changeCssClassSize(param1:uint, param2:uint, param3:String = null) : void + { + var _loc4_:* = undefined; + if(param3) + { + this._aStyleObj[param3].fontSize = param1 + "px"; + } + else + { + for each(_loc4_ in this._aStyleObj) + { + _loc4_.fontSize = param1 + "px"; + } + } + this.bindCss(); + this._textFlow.lineHeight = param2; + } + + private function changeCssClassColor(param1:String, param2:String = null) : void + { + var _loc3_:* = undefined; + if(param2) + { + if(this._aStyleObj[param2] == null) + { + this._aStyleObj[param2] = new Object(); + } + this._aStyleObj[param2].color = param1; + this._TLFFormat.concat(this._ssSheet.TLFTransform(this._aStyleObj[param2])); + } + else + { + for each(_loc3_ in this._aStyleObj) + { + _loc3_.color = param1; + } + } + } + + public function get scrollV() : int + { + return Math.round((this._controller.verticalScrollPosition + this._controller.compositionHeight) / this._textFlow.lineHeight); + } + + public function set scrollV(param1:int) : void + { + this._controller.verticalScrollPosition = param1 * this._textFlow.lineHeight - this._controller.compositionHeight; + } + + public function get maxScrollV() : int + { + this._textFlow.flowComposer.composeToPosition(); + return this._textFlow.flowComposer.numLines; + } + + public function get textHeight() : Number + { + var _loc3_:* = 0; + var _loc1_:Number = 0; + var _loc2_:int = this._textFlow.numChildren; + _loc3_ = 0; + while(_loc3_ < _loc2_) + { + _loc1_ = _loc1_ + this.getParagraphHeight(this._textFlow.getChildAt(_loc3_) as ParagraphElement); + _loc3_++; + } + return _loc1_; + } + + private function getParagraphHeight(param1:ParagraphElement) : Number + { + var _loc5_:TextFlowLine = null; + var _loc2_:Number = 0; + var _loc3_:int = param1.getAbsoluteStart(); + var _loc4_:int = _loc3_ + param1.textLength; + while(_loc3_ < _loc4_) + { + _loc5_ = param1.getTextFlow().flowComposer.findLineAtPosition(_loc3_); + _loc2_ = _loc2_ + _loc5_.height; + _loc3_ = _loc3_ + _loc5_.textLength; + } + return _loc2_; + } + + public function set scrollCss(param1:Uri) : void + { + this._sbScrollBar.css = param1; + } + + public function get scrollCss() : Uri + { + return this._sbScrollBar.css; + } + + private function createTextField() : void + { + var _loc1_:TextLayoutFormat = new TextLayoutFormat(); + _loc1_.fontWeight = FontWeight.BOLD; + _loc1_.color = "#ff0000"; + _loc1_.textDecoration = TextDecoration.NONE; + var _loc2_:Configuration = new Configuration(); + _loc2_.defaultLinkNormalFormat = _loc1_; + TextFlow.defaultConfiguration = _loc2_; + this._textContainer = new ChatTextContainer(); + this._textContainer.x = this._sbScrollBar.width; + addChild(this._textContainer); + this._textFlow = new TextFlow(_loc2_); + this._textFlow.paddingBottom = 2; + this._textFlow.flowComposer = new StandardFlowComposer(); + this._controller = new ContainerController(this._textContainer,width,height); + this._controller.horizontalScrollPolicy = ScrollPolicy.ON; + this._controller.blockProgression = BlockProgression.TB; + this._textFlow.interactionManager = new SelectionManager(); + this._textFlow.addEventListener(FlowElementMouseEvent.ROLL_OVER,this.onMouseOverLink); + this._textFlow.addEventListener(FlowElementMouseEvent.ROLL_OUT,this.onMouseOutLink); + this._textFlow.addEventListener(SelectionEvent.SELECTION_CHANGE,this.selectionChanged); + this._textContainer.addEventListener(MouseEvent.ROLL_OUT,this.onRollOutChat); + this._textFlow.addEventListener(TextLayoutEvent.SCROLL,this.scrollTextFlow); + this._textFlow.flowComposer.addController(this._controller); + this._textFlow.flowComposer.updateAllControllers(); + EnterFrameDispatcher.addEventListener(this.onEnterFrame,"updateChatControllers"); + } + + private var _isDamaged:Boolean = false; + + private function onEnterFrame(param1:Event) : void + { + if(this._isDamaged) + { + this._isDamaged = false; this._textFlow.flowComposer.updateAllControllers(); - EnterFrameDispatcher.addEventListener(this.onEnterFrame, "updateChatControllers"); - } - - private function onEnterFrame(pEvt:Event):void - { - if (this._isDamaged) - { - this._isDamaged = false; - this._textFlow.flowComposer.updateAllControllers(); - }; - } - - private function onRollOutChat(pEvt:MouseEvent):void - { - TooltipManager.hideAll(); - } - - private function selectionChanged(pEvt:SelectionEvent):void - { - var prevPara:ParagraphElement; - var range:ElementRange = ((pEvt.selectionState) ? ElementRange.createElementRange(pEvt.selectionState.textFlow, pEvt.selectionState.absoluteStart, pEvt.selectionState.absoluteEnd) : null); - this._currentSelection = ""; - var leaf:FlowLeafElement = range.firstLeaf; - do - { - if (((!((prevPara == null))) && (!((prevPara == leaf.getParagraph()))))) - { - this._currentSelection = (this._currentSelection + "\n"); - prevPara = leaf.getParagraph(); - }; - this._currentSelection = (this._currentSelection + leaf.text); - leaf = leaf.getNextLeaf(); - } while (leaf); - } - - private function onMouseOverLink(pEvt:FlowElementMouseEvent):void - { - var link:LinkElement; - var params:Array; - var type:String; - var data:String; - if ((pEvt.flowElement is LinkElement)) - { - link = (pEvt.flowElement as LinkElement); - params = link.href.replace("event:", "").split(","); - type = params.shift(); - data = ((((((type + ",") + Math.round(pEvt.originalEvent.stageX)) + ",") + Math.round(pEvt.originalEvent.stageY)) + ",") + params.join(",")); - dispatchEvent(new LinkInteractionEvent(LinkInteractionEvent.ROLL_OVER, data)); - }; - } - - private function onMouseOutLink(pEvt:FlowElementMouseEvent):void - { - TooltipManager.hideAll(); - dispatchEvent(new LinkInteractionEvent(LinkInteractionEvent.ROLL_OUT)); - } - - private function onTextClick(pEvt:FlowElementMouseEvent):void - { - TooltipManager.hideAll(); - var text:String = (pEvt.flowElement as LinkElement).href; - if (text != "") - { - dispatchEvent(new TextEvent(TextEvent.LINK, false, false, text.replace("event:", ""))); - }; - } - - private function onScroll(pEvt:Event):void - { - this._magicbool = false; - this._controller.verticalScrollPosition = ((((this._sbScrollBar.value / this._sbScrollBar.max) * this.maxScrollV) * this._textFlow.lineHeight) - this._controller.compositionHeight); - } - - private function scrollTextFlow(pEvt:Event):void - { - var evt:ScrollEvent; - if ((pEvt is ScrollEvent)) - { - evt = (pEvt as ScrollEvent); - if (this._magicbool) - { - evt.delta = ((evt.delta / 3) * -1); - this._sbScrollBar.onWheel(pEvt, false); - } - else - { - this._magicbool = true; - }; - }; - } - - private function updateScrollBar(reset:Boolean=false):void - { - this._sbScrollBar.visible = true; - this._sbScrollBar.disabled = false; - this._sbScrollBar.total = this.maxScrollV; - this._sbScrollBar.max = (this.maxScrollV - Math.floor((this._controller.compositionHeight / this._textFlow.lineHeight))); - if (reset) - { - this._controller.verticalScrollPosition = 0; - this._sbScrollBar.value = 0; + } + } + + private function onRollOutChat(param1:MouseEvent) : void + { + TooltipManager.hideAll(); + } + + private var _currentSelection:String = ""; + + private function selectionChanged(param1:SelectionEvent) : void + { + var _loc3_:ParagraphElement = null; + var _loc2_:ElementRange = param1.selectionState?ElementRange.createElementRange(param1.selectionState.textFlow,param1.selectionState.absoluteStart,param1.selectionState.absoluteEnd):null; + this._currentSelection = ""; + var _loc4_:FlowLeafElement = _loc2_.firstLeaf; + do + { + if(!(_loc3_ == null) && !(_loc3_ == _loc4_.getParagraph())) + { + this._currentSelection = this._currentSelection + "\n"; + _loc3_ = _loc4_.getParagraph(); } - else - { - this._sbScrollBar.value = this.scrollV; - }; - } - - private function updateScrollBarPos():void - { - if (this._nScrollPos >= 0) - { - this._sbScrollBar.x = (this._controller.compositionWidth - this._sbScrollBar.width); + this._currentSelection = this._currentSelection + _loc4_.text; + } + while(_loc4_ = _loc4_.getNextLeaf()); + + } + + private function onMouseOverLink(param1:FlowElementMouseEvent) : void + { + var _loc2_:LinkElement = null; + var _loc3_:Array = null; + var _loc4_:String = null; + var _loc5_:String = null; + if(param1.flowElement is LinkElement) + { + _loc2_ = param1.flowElement as LinkElement; + _loc3_ = _loc2_.href.replace("event:","").split(","); + _loc4_ = _loc3_.shift(); + _loc5_ = _loc4_ + "," + Math.round(param1.originalEvent.stageX) + "," + Math.round(param1.originalEvent.stageY) + "," + _loc3_.join(","); + dispatchEvent(new LinkInteractionEvent(LinkInteractionEvent.ROLL_OVER,_loc5_)); + } + } + + private function onMouseOutLink(param1:FlowElementMouseEvent) : void + { + TooltipManager.hideAll(); + dispatchEvent(new LinkInteractionEvent(LinkInteractionEvent.ROLL_OUT)); + } + + private function onTextClick(param1:FlowElementMouseEvent) : void + { + TooltipManager.hideAll(); + var _loc2_:String = (param1.flowElement as LinkElement).href; + if(_loc2_ != "") + { + dispatchEvent(new TextEvent(TextEvent.LINK,false,false,_loc2_.replace("event:",""))); + } + } + + private var _magicbool:Boolean = true; + + private function onScroll(param1:Event) : void + { + this._magicbool = false; + this._controller.verticalScrollPosition = this._sbScrollBar.value / this._sbScrollBar.max * this.maxScrollV * this._textFlow.lineHeight - this._controller.compositionHeight; + } + + private function scrollTextFlow(param1:Event) : void + { + var _loc2_:ScrollEvent = null; + if(param1 is ScrollEvent) + { + _loc2_ = param1 as ScrollEvent; + if(this._magicbool) + { + _loc2_.delta = _loc2_.delta / 3 * -1; + this._sbScrollBar.onWheel(param1,false); } else { - this._sbScrollBar.x = 0; - }; - } - - public function get finalized():Boolean - { - return (this._finalized); - } - - public function set finalized(b:Boolean):void - { - this._finalized = b; - } - - public function finalize():void - { - this._sbScrollBar.finalize(); - this.updateScrollBarPos(); - this.updateScrollBar(); - HyperlinkFactory.createTextClickHandler(this); - HyperlinkFactory.createRollOverHandler(this); - this._finalized = true; - var uiRoot:UiRootContainer = getUi(); - if (uiRoot != null) - { - uiRoot.iAmFinalized(this); - }; - } - - private function createParagraphe(text:String):ParagraphElement - { - this._textFlow.addEventListener(DamageEvent.DAMAGE, this.onDamage); - var p:ParagraphElement = new ParagraphElement(); - p.format = this._TLFFormat; - p.verticalAlign = VerticalAlign.MIDDLE; - var result:Object = new RegExp(TAGS_PATTERN).exec(text); - while (result != null) - { - if (result.index > 0) - { - this.createSpan(p, text.substring(0, result.index), false); - }; - this.createSpan(p, result[0], true); - text = text.substring((result.index + result[0].length)); - result = new RegExp(TAGS_PATTERN).exec(text); - }; - if (text.length > 0) - { - this.createSpan(p, text, false); - }; - return (p); - } - - private function onDamage(pEvt:DamageEvent):void - { - this._textFlow.removeEventListener(DamageEvent.DAMAGE, this.onDamage); - this._isDamaged = true; - } - - private function createLinkElement(p:ParagraphElement, oText:Object):void - { - var att:String; - var link:LinkElement = new LinkElement(); - link.addEventListener(FlowElementMouseEvent.CLICK, this.onTextClick); - var span:SpanElement = new SpanElement(); - var style:String = ""; - var attributes:Array = oText[3].split(" "); - for each (att in attributes) - { - if (att.search("href") != -1) - { - link.href = this.getAttributeValue(att); - } - else - { - if (att.search("style") != -1) - { - style = this.getAttributeValue(att); - }; - }; - }; - span.fontWeight = FontWeight.BOLD; - span.color = this._TLFFormat.color; - span = HtmlManager.formateSpan(span, style); - span.text = oText[5].replace(BOLD_PATTERN, "").replace(UNDERLINE_PATTERN, ""); - link.addChild(span); - p.addChild(link); - } - - private function getAttributeValue(inText:String):String - { - var realvalue:String; - var tmp:Array = inText.split("="); - tmp.shift(); - if (tmp.length > 1) - { - realvalue = tmp.join("="); + this._magicbool = true; } - else - { - realvalue = tmp[0]; - }; - return (realvalue.replace(QUOTE_PATTERN, "")); - } - - private function createSpan(p:ParagraphElement, sText:String, handleHtmlTags:Boolean, pStyle:String=""):void - { - var smiley:Smiley; - var textToShow:String; - var kamaIndex:int; - var reg:RegExp; - var data:Object; - var sub:String; - var intValue:String; - var cursor:int; - while (sText.length > 0) - { - smiley = ((this._smiliesActivated) ? this.getSmileyFromText(sText) : null); - textToShow = sText.substring(0, ((!((smiley == null))) ? smiley.position : sText.length)); - if ((((textToShow.length > 0)) || ((smiley == null)))) - { - if (this._smiliesActivated) - { - kamaIndex = textToShow.search(KAMA_PATTERN); - while (kamaIndex != -1) - { - reg = new RegExp(KAMA_PATTERN); - data = reg.exec(textToShow); - sub = textToShow.substring(0, kamaIndex); - if (sub != "") - { - intValue = StringUtil.trim(data[1]); - if ((((((intValue.indexOf(".") == -1)) && ((intValue.indexOf(",") == -1)))) && ((intValue.indexOf(" ") == -1)))) - { - intValue = StringUtils.formateIntToString(parseInt(intValue)); - }; - p.addChild(this.createSpanElement((textToShow.substring(0, (kamaIndex + 1)) + intValue), pStyle)); - }; - p.addChild(this.createImage(new Uri((XmlConfig.getInstance().getEntry("config.ui.skin") + "assets.swf|tx_kama")), "/k")); - textToShow = textToShow.substr((kamaIndex + data[0].length)); - kamaIndex = textToShow.search(KAMA_PATTERN); - }; - }; - if (!(handleHtmlTags)) - { - p.addChild(this.createSpanElement(textToShow, pStyle)); - } - else - { - this.createSpanElementsFromHtmlTags(p, textToShow, pStyle); - }; - if (smiley == null) - { - return; - }; - }; - if (smiley.position != -1) - { - p.addChild(this.createImage(((this._smiliesUri + smiley.pictoId) + ".png"), smiley.currentTrigger)); - sText = sText.substring((smiley.position + smiley.currentTrigger.length)); - }; - }; - } - - private function createSpanElement(pText:String, pStyle:String):SpanElement - { - var span:SpanElement = new SpanElement(); - var txt:String = pText; - txt = StringUtil.replace(txt, "&", "&"); - txt = StringUtil.replace(txt, "<", "<"); - txt = StringUtil.replace(txt, ">", ">"); - span.text = txt; - span = HtmlManager.formateSpan(span, pStyle); - return (span); - } - - private function createSpanElementsFromHtmlTags(p:ParagraphElement, pText:String, pStyle:String):void - { - var result:Object; - var _local_5:String; - var _local_6:Array; - var att:String; - result = new RegExp(TAGS_PATTERN).exec(pText); - while (result != null) + } + } + + private function updateScrollBar(param1:Boolean = false) : void + { + this._sbScrollBar.visible = true; + this._sbScrollBar.disabled = false; + this._sbScrollBar.total = this.maxScrollV; + this._sbScrollBar.max = this.maxScrollV - Math.floor(this._controller.compositionHeight / this._textFlow.lineHeight); + if(param1) + { + this._controller.verticalScrollPosition = 0; + this._sbScrollBar.value = 0; + } + else + { + this._sbScrollBar.value = this.scrollV; + } + } + + private function updateScrollBarPos() : void + { + if(this._nScrollPos >= 0) + { + this._sbScrollBar.x = this._controller.compositionWidth - this._sbScrollBar.width; + } + else + { + this._sbScrollBar.x = 0; + } + } + + public function get finalized() : Boolean + { + return this._finalized; + } + + public function set finalized(param1:Boolean) : void + { + this._finalized = param1; + } + + public function finalize() : void + { + this._sbScrollBar.finalize(); + this.updateScrollBarPos(); + this.updateScrollBar(); + HyperlinkFactory.createTextClickHandler(this); + HyperlinkFactory.createRollOverHandler(this); + this._finalized = true; + var _loc1_:UiRootContainer = getUi(); + if(_loc1_ != null) + { + _loc1_.iAmFinalized(this); + } + } + + private function createParagraphe(param1:String) : ParagraphElement + { + this._textFlow.addEventListener(DamageEvent.DAMAGE,this.onDamage); + var _loc2_:ParagraphElement = new ParagraphElement(); + _loc2_.format = this._TLFFormat; + _loc2_.verticalAlign = VerticalAlign.MIDDLE; + var _loc3_:Object = new RegExp(TAGS_PATTERN).exec(param1); + while(_loc3_ != null) + { + if(_loc3_.index > 0) + { + this.createSpan(_loc2_,param1.substring(0,_loc3_.index),false); + } + this.createSpan(_loc2_,_loc3_[0],true); + var param1:String = param1.substring(_loc3_.index + _loc3_[0].length); + _loc3_ = new RegExp(TAGS_PATTERN).exec(param1); + } + if(param1.length > 0) + { + this.createSpan(_loc2_,param1,false); + } + return _loc2_; + } + + private function onDamage(param1:DamageEvent) : void + { + this._textFlow.removeEventListener(DamageEvent.DAMAGE,this.onDamage); + this._isDamaged = true; + } + + private function createLinkElement(param1:ParagraphElement, param2:Object) : void + { + var _loc7_:String = null; + var _loc3_:LinkElement = new LinkElement(); + _loc3_.addEventListener(FlowElementMouseEvent.CLICK,this.onTextClick); + var _loc4_:SpanElement = new SpanElement(); + var _loc5_:* = ""; + var _loc6_:Array = param2[3].split(" "); + for each(_loc7_ in _loc6_) + { + if(_loc7_.search("href") != -1) + { + _loc3_.href = this.getAttributeValue(_loc7_); + } + else if(_loc7_.search("style") != -1) { - if (result.index > 0) - { - p.addChild(this.createSpanElement(pText.substring(0, result.index), pStyle)); - }; - switch (result[1]) - { - case "p": - case "span": - _local_6 = result[3].split(" "); - for each (att in _local_6) + _loc5_ = this.getAttributeValue(_loc7_); + } + + } + _loc4_.fontWeight = FontWeight.BOLD; + _loc4_.color = this._TLFFormat.color; + _loc4_ = HtmlManager.formateSpan(_loc4_,_loc5_); + _loc4_.text = param2[5].replace(BOLD_PATTERN,"").replace(UNDERLINE_PATTERN,""); + _loc3_.addChild(_loc4_); + param1.addChild(_loc3_); + } + + private function getAttributeValue(param1:String) : String + { + var _loc3_:String = null; + var _loc2_:Array = param1.split("="); + _loc2_.shift(); + if(_loc2_.length > 1) + { + _loc3_ = _loc2_.join("="); + } + else + { + _loc3_ = _loc2_[0]; + } + return _loc3_.replace(QUOTE_PATTERN,""); + } + + private function createSpan(param1:ParagraphElement, param2:String, param3:Boolean, param4:String = "") : void + { + var _loc6_:Smiley = null; + var _loc7_:String = null; + var _loc8_:* = 0; + var _loc9_:RegExp = null; + var _loc10_:Object = null; + var _loc11_:String = null; + var _loc12_:String = null; + var _loc5_:* = 0; + while(param2.length > 0) + { + _loc6_ = this._smiliesActivated?this.getSmileyFromText(param2):null; + _loc7_ = param2.substring(0,_loc6_ != null?_loc6_.position:param2.length); + if(_loc7_.length > 0 || _loc6_ == null) + { + if(this._smiliesActivated) + { + _loc8_ = _loc7_.search(KAMA_PATTERN); + while(_loc8_ != -1) + { + _loc9_ = new RegExp(KAMA_PATTERN); + _loc10_ = _loc9_.exec(_loc7_); + _loc11_ = _loc7_.substring(0,_loc8_); + if(_loc11_ != "") + { + _loc12_ = StringUtil.trim(_loc10_[1]); + if(_loc12_.indexOf(".") == -1 && _loc12_.indexOf(",") == -1 && _loc12_.indexOf(" ") == -1) { - if (att.search("style") != -1) - { - _local_5 = this.getAttributeValue(att); - }; - }; - this.createSpan(p, result[5], true, (((_local_5 == "")) ? pStyle : _local_5)); - break; - case "a": - this.createLinkElement(p, result); - break; - case "i": - this.createSpanElementsFromHtmlTags(p, result[0].replace(ITALIC_PATTERN, ""), HtmlManager.addValueToInlineStyle(pStyle, "font-style", "italic")); - break; - case "b": - this.createSpanElementsFromHtmlTags(p, result[0].replace(BOLD_PATTERN, ""), HtmlManager.addValueToInlineStyle(pStyle, "font-weight", "bold")); - break; - case "u": - this.createSpanElementsFromHtmlTags(p, result[0].replace(UNDERLINE_PATTERN, ""), HtmlManager.addValueToInlineStyle(pStyle, "text-decoration", "underline")); - break; - default: - trace(((("On fait rien: " + result[1]) + " ") + result[0])); - }; - pText = pText.substring((result.index + result[0].length)); - result = new RegExp(TAGS_PATTERN).exec(pText); - }; - if (pText.length > 0) - { - p.addChild(this.createSpanElement(pText, pStyle)); - }; - } - - private function createImage(pUri:*, pTrigger:String):InlineGraphicElement - { - var inlineGraphic:InlineGraphicElement; - var imgTx:Texture; - var bmpdt:BitmapData; - var bmp:Bitmap; - var loader:Loader; - var flcomposer:IFlowComposer; - var list:Dictionary; - var ba:ByteArray; - inlineGraphic = new InlineGraphicElement(pTrigger); - inlineGraphic.alignmentBaseline = TextBaseline.DESCENT; - if ((pUri is Uri)) + _loc12_ = StringUtils.formateIntToString(parseInt(_loc12_)); + } + param1.addChild(this.createSpanElement(_loc7_.substring(0,_loc8_ + 1) + _loc12_,param4)); + } + param1.addChild(this.createImage(new Uri(XmlConfig.getInstance().getEntry("config.ui.skin") + "assets.swf|tx_kama"),"/k")); + _loc7_ = _loc7_.substr(_loc8_ + _loc10_[0].length); + _loc8_ = _loc7_.search(KAMA_PATTERN); + } + } + if(!param3) + { + param1.addChild(this.createSpanElement(_loc7_,param4)); + } + else + { + this.createSpanElementsFromHtmlTags(param1,_loc7_,param4); + } + if(_loc6_ == null) + { + break; + } + } + if(_loc6_.position != -1) { - imgTx = new Texture(); - imgTx.uri = pUri; - imgTx.finalize(); - inlineGraphic.source = imgTx; + param1.addChild(this.createImage(this._smiliesUri + _loc6_.pictoId + ".png",_loc6_.currentTrigger)); + var param2:String = param2.substring(_loc6_.position + _loc6_.currentTrigger.length); + } + } + } + + private function createSpanElement(param1:String, param2:String) : SpanElement + { + var _loc3_:SpanElement = new SpanElement(); + var _loc4_:String = param1; + _loc4_ = StringUtil.replace(_loc4_,"&","&"); + _loc4_ = StringUtil.replace(_loc4_,"<","<"); + _loc4_ = StringUtil.replace(_loc4_,">",">"); + _loc3_.text = _loc4_; + _loc3_ = HtmlManager.formateSpan(_loc3_,param2); + return _loc3_; + } + + private function createSpanElementsFromHtmlTags(param1:ParagraphElement, param2:String, param3:String) : void + { + var _loc4_:Object = null; + var _loc5_:String = null; + var _loc6_:Array = null; + var _loc7_:String = null; + _loc4_ = new RegExp(TAGS_PATTERN).exec(param2); + while(_loc4_ != null) + { + if(_loc4_.index > 0) + { + param1.addChild(this.createSpanElement(param2.substring(0,_loc4_.index),param3)); + } + switch(_loc4_[1]) + { + case "p": + case "span": + _loc6_ = _loc4_[3].split(" "); + for each(_loc7_ in _loc6_) + { + if(_loc7_.search("style") != -1) + { + _loc5_ = this.getAttributeValue(_loc7_); + } + } + this.createSpan(param1,_loc4_[5],true,_loc5_ == ""?param3:_loc5_); + break; + case "a": + this.createLinkElement(param1,_loc4_); + break; + case "i": + this.createSpanElementsFromHtmlTags(param1,_loc4_[0].replace(ITALIC_PATTERN,""),HtmlManager.addValueToInlineStyle(param3,"font-style","italic")); + break; + case "b": + this.createSpanElementsFromHtmlTags(param1,_loc4_[0].replace(BOLD_PATTERN,""),HtmlManager.addValueToInlineStyle(param3,"font-weight","bold")); + break; + case "u": + this.createSpanElementsFromHtmlTags(param1,_loc4_[0].replace(UNDERLINE_PATTERN,""),HtmlManager.addValueToInlineStyle(param3,"text-decoration","underline")); + break; + default: + trace("On fait rien: " + _loc4_[1] + " " + _loc4_[0]); + } + var param2:String = param2.substring(_loc4_.index + _loc4_[0].length); + _loc4_ = new RegExp(TAGS_PATTERN).exec(param2); + } + if(param2.length > 0) + { + param1.addChild(this.createSpanElement(param2,param3)); + } + } + + private var _bmpdtList:Dictionary; + + private function createImage(param1:*, param2:String) : InlineGraphicElement + { + var inlineGraphic:InlineGraphicElement = null; + var imgTx:Texture = null; + var bmpdt:BitmapData = null; + var bmp:Bitmap = null; + var loader:Loader = null; + var flcomposer:IFlowComposer = null; + var list:Dictionary = null; + var ba:ByteArray = null; + var pUri:* = param1; + var pTrigger:String = param2; + inlineGraphic = new InlineGraphicElement(pTrigger); + inlineGraphic.alignmentBaseline = TextBaseline.DESCENT; + if(pUri is Uri) + { + imgTx = new Texture(); + imgTx.uri = pUri; + imgTx.finalize(); + inlineGraphic.source = imgTx; + } + else if(pUri is String) + { + if(this._bmpdtList[pUri] != null) + { + bmpdt = this._bmpdtList[pUri]; + bmp = new Bitmap(bmpdt.clone(),"auto",true); + inlineGraphic.source = bmp; } else { - if ((pUri is String)) - { - if (this._bmpdtList[pUri] != null) - { - bmpdt = this._bmpdtList[pUri]; - bmp = new Bitmap(bmpdt.clone(), "auto", true); - inlineGraphic.source = bmp; - } - else - { - loader = new Loader(); - flcomposer = this._textFlow.flowComposer; - list = this._bmpdtList; - loader.contentLoaderInfo.addEventListener(Event.COMPLETE, function (pEvt:Event):void - { - var bmp:Bitmap = (loader.content as Bitmap); - inlineGraphic.source = bmp; - list[pUri] = bmp.bitmapData; - _isDamaged = true; - }); - ba = this.getFile(pUri); - if (ba) - { - loader.loadBytes(ba); - }; - }; - }; - }; - return (inlineGraphic); - } - - private function getFile(uri:String):ByteArray - { - var fs:FileStream; - var ba:ByteArray; - var f:File = new File(uri); - if (f.exists) - { - fs = new FileStream(); - fs.open(f, FileMode.READ); - ba = new ByteArray(); - fs.readBytes(ba); - fs.close(); - return (ba); - }; - return (null); - } - - public function getLastParagrapheElement():ParagraphElement - { - return ((this._textFlow.getChildAt((this._textFlow.numChildren - 1)) as ParagraphElement)); - } - - public function insertParagraphes(data:Array):void - { - var p:ParagraphElement; - for each (p in data) - { - p.fontSize = this._TLFFormat.fontSize; - this._textFlow.addChild(p); - }; - this._isDamaged = true; - this.scrollV = this.maxScrollV; - this.updateScrollBar(); - } - - private function getSmileyFromText(sTxt:String):Smiley - { - var indexOfSmiley:int; - var currentSmiley:Smiley; - var smiley:Smiley; - var trigger:String; - for each (smiley in this._smilies) - { - for each (trigger in smiley.triggers) - { - if (trigger != null) - { - indexOfSmiley = sTxt.toLowerCase().indexOf(trigger.toLowerCase()); - if (indexOfSmiley != -1) + loader = new Loader(); + flcomposer = this._textFlow.flowComposer; + list = this._bmpdtList; + loader.contentLoaderInfo.addEventListener(Event.COMPLETE,function(param1:Event):void + { + var _loc2_:Bitmap = loader.content as Bitmap; + inlineGraphic.source = _loc2_; + list[pUri] = _loc2_.bitmapData; + _isDamaged = true; + }); + ba = this.getFile(pUri); + if(ba) + { + loader.loadBytes(ba); + } + } + } + + return inlineGraphic; + } + + private function getFile(param1:String) : ByteArray + { + var _loc3_:FileStream = null; + var _loc4_:ByteArray = null; + var _loc2_:File = new File(param1); + if(_loc2_.exists) + { + _loc3_ = new FileStream(); + _loc3_.open(_loc2_,FileMode.READ); + _loc4_ = new ByteArray(); + _loc3_.readBytes(_loc4_); + _loc3_.close(); + return _loc4_; + } + return null; + } + + public function getLastParagrapheElement() : ParagraphElement + { + return this._textFlow.getChildAt(this._textFlow.numChildren - 1) as ParagraphElement; + } + + public function insertParagraphes(param1:Array) : void + { + var _loc2_:ParagraphElement = null; + for each(_loc2_ in param1) + { + _loc2_.fontSize = this._TLFFormat.fontSize; + this._textFlow.addChild(_loc2_); + } + this._isDamaged = true; + this.scrollV = this.maxScrollV; + this.updateScrollBar(); + } + + private function getSmileyFromText(param1:String) : Smiley + { + var _loc2_:* = 0; + var _loc3_:Smiley = null; + var _loc4_:Smiley = null; + var _loc5_:String = null; + for each(_loc4_ in this._smilies) + { + for each(_loc5_ in _loc4_.triggers) + { + if(_loc5_ != null) + { + _loc2_ = param1.toLowerCase().indexOf(_loc5_.toLowerCase()); + if(_loc2_ != -1) + { + if(isValidSmiley(param1,_loc2_,_loc5_)) + { + if(_loc3_ == null || !(_loc3_ == null) && _loc3_.position > _loc2_) { - if (isValidSmiley(sTxt, indexOfSmiley, trigger)) - { - if ((((currentSmiley == null)) || (((!((currentSmiley == null))) && ((currentSmiley.position > indexOfSmiley)))))) - { - smiley.position = indexOfSmiley; - smiley.currentTrigger = trigger; - currentSmiley = smiley; - }; - }; - }; - }; - }; - }; - return (currentSmiley); - } - - - } -}//package com.ankamagames.berilia.components - -import __AS3__.vec.Vector; - -class Smiley + _loc4_.position = _loc2_; + _loc4_.currentTrigger = _loc5_; + _loc3_ = _loc4_; + } + } + } + } + } + } + return _loc3_; + } + } +} +class Smiley extends Object { - - public var pictoId:String; - public var triggers:Vector.; - public var position:int; - public var currentTrigger:String; - - public function Smiley(pId:String):void - { - this.pictoId = pId; - this.position = -1; - } - + + function Smiley(param1:String) + { + super(); + this.pictoId = param1; + this.position = -1; + } + + public var pictoId:String; + + public var triggers:Vector.; + + public var position:int; + + public var currentTrigger:String; } - diff --git a/com/ankamagames/berilia/components/ColorPicker.as b/com/ankamagames/berilia/components/ColorPicker.as index c5cea2ce1..b260cb599 100644 --- a/com/ankamagames/berilia/components/ColorPicker.as +++ b/com/ankamagames/berilia/components/ColorPicker.as @@ -1,483 +1,514 @@ -package com.ankamagames.berilia.components +package com.ankamagames.berilia.components { - import com.ankamagames.berilia.types.graphic.GraphicContainer; - import com.ankamagames.berilia.FinalizableUIComponent; - import com.ankamagames.jerakine.logger.Logger; - import com.ankamagames.jerakine.logger.Log; - import flash.utils.getQualifiedClassName; - import flash.display.Sprite; - import flash.geom.Matrix; - import com.ankamagames.jerakine.types.Uri; - import flash.display.GradientType; - import flash.events.Event; - import com.ankamagames.jerakine.utils.display.ColorUtils; - import com.ankamagames.berilia.Berilia; - import com.ankamagames.berilia.components.messages.ColorChangeMessage; - import flash.display.InteractiveObject; - import com.ankamagames.jerakine.utils.display.KeyPoll; - import com.ankamagames.jerakine.handlers.messages.mouse.MouseDownMessage; - import flash.geom.Rectangle; - import com.ankamagames.jerakine.utils.display.EnterFrameDispatcher; - import com.ankamagames.jerakine.handlers.messages.mouse.MouseUpMessage; - import com.ankamagames.jerakine.handlers.messages.mouse.MouseReleaseOutsideMessage; - import com.ankamagames.jerakine.messages.Message; - - public class ColorPicker extends GraphicContainer implements FinalizableUIComponent - { - - protected static const _log:Logger = Log.getLogger(getQualifiedClassName(ColorPicker)); - - private var _nWidth:uint; - private var _nHeight:uint; - private var _nColor:Number = 0xFF0000; - private var _nGradientColor:Number = 0xFF0000; - private var _texCursorSlider:Texture; - private var _texCursorGradient:Texture; - private var _nSliderWidth:uint = 20; - private var _nSeparationWidth:uint = 10; - private var _nGradientWidth:uint; - private var _sprGradient:Sprite; - private var _sprSliderInf:Sprite; - private var _sprSliderSup:Sprite; - private var _nLoadedSum:uint = 0; - private var _bMouseDown:Boolean = false; - private var _bFixedColor:Boolean = false; - private var _nSliderY:int; - private var _nGradientX:int; - private var _nGradientY:int; - private var _mMatrixGradient:Matrix; - private var _mMatrixSaturation:Matrix; - private var _mMatrixSlider:Matrix; - private var _aColorsHue:Array; - private var _aAlphasHue:Array; - private var _aRatiosHue:Array; - private var _aColorsSat:Array; - private var _aAlphasSat:Array; - private var _aRatiosSat:Array; - private var _aColorsBri:Array; - private var _aAlphasBri:Array; - private var _aRatiosBri:Array; - private var _bFinalized:Boolean = false; - - - override public function set width(nW:Number):void - { - this._nWidth = nW; - if (this.finalized) + import com.ankamagames.berilia.types.graphic.GraphicContainer; + import com.ankamagames.berilia.FinalizableUIComponent; + import com.ankamagames.jerakine.logger.Logger; + import com.ankamagames.jerakine.logger.Log; + import flash.utils.getQualifiedClassName; + import flash.display.Sprite; + import flash.geom.Matrix; + import com.ankamagames.jerakine.types.Uri; + import flash.display.GradientType; + import flash.events.Event; + import com.ankamagames.jerakine.utils.display.ColorUtils; + import com.ankamagames.berilia.Berilia; + import com.ankamagames.berilia.components.messages.ColorChangeMessage; + import flash.display.InteractiveObject; + import com.ankamagames.jerakine.messages.Message; + import com.ankamagames.jerakine.utils.display.KeyPoll; + import flash.geom.Rectangle; + import com.ankamagames.jerakine.utils.display.EnterFrameDispatcher; + import com.ankamagames.jerakine.handlers.messages.mouse.MouseDownMessage; + import com.ankamagames.jerakine.handlers.messages.mouse.MouseUpMessage; + import com.ankamagames.jerakine.handlers.messages.mouse.MouseReleaseOutsideMessage; + + public class ColorPicker extends GraphicContainer implements FinalizableUIComponent + { + + public function ColorPicker() + { + super(); + } + + protected static const _log:Logger = Log.getLogger(getQualifiedClassName(ColorPicker)); + + private var _nWidth:uint; + + private var _nHeight:uint; + + private var _nColor:Number = 16711680; + + private var _nGradientColor:Number = 16711680; + + private var _texCursorSlider:Texture; + + private var _texCursorGradient:Texture; + + private var _nSliderWidth:uint = 20; + + private var _nSeparationWidth:uint = 10; + + private var _nGradientWidth:uint; + + private var _sprGradient:Sprite; + + private var _sprSliderInf:Sprite; + + private var _sprSliderSup:Sprite; + + private var _nLoadedSum:uint = 0; + + private var _bMouseDown:Boolean = false; + + private var _bFixedColor:Boolean = false; + + private var _nSliderY:int; + + private var _nGradientX:int; + + private var _nGradientY:int; + + private var _mMatrixGradient:Matrix; + + private var _mMatrixSaturation:Matrix; + + private var _mMatrixSlider:Matrix; + + private var _aColorsHue:Array; + + private var _aAlphasHue:Array; + + private var _aRatiosHue:Array; + + private var _aColorsSat:Array; + + private var _aAlphasSat:Array; + + private var _aRatiosSat:Array; + + private var _aColorsBri:Array; + + private var _aAlphasBri:Array; + + private var _aRatiosBri:Array; + + private var _bFinalized:Boolean = false; + + override public function set width(param1:Number) : void + { + this._nWidth = param1; + if(this.finalized) + { + this.updatePicker(); + } + } + + override public function set height(param1:Number) : void + { + this._nHeight = param1; + this._nSliderY = int(this._nHeight / 2); + if(this.finalized) + { + this.updatePicker(); + } + } + + public function set sliderTexture(param1:Uri) : void + { + this._texCursorSlider = new Texture(); + this._texCursorSlider.x = 0; + this._texCursorSlider.y = 0; + this._texCursorSlider.width = 20; + this._texCursorSlider.height = 16; + this._texCursorSlider.uri = param1; + } + + public function get sliderTexture() : Uri + { + return this._texCursorSlider.uri; + } + + public function set gradientTexture(param1:Uri) : void + { + this._texCursorGradient = new Texture(); + this._texCursorGradient.x = 0; + this._texCursorGradient.y = 0; + this._texCursorGradient.width = 16; + this._texCursorGradient.height = 16; + this._texCursorGradient.uri = param1; + } + + public function get gradientTexture() : Uri + { + return this._texCursorGradient.uri; + } + + public function get color() : uint + { + return this._nColor; + } + + public function set color(param1:uint) : void + { + this._nColor = param1; + this._bFixedColor = true; + this.getCurrentPos(); + } + + public function get finalized() : Boolean + { + return this._bFinalized; + } + + public function set finalized(param1:Boolean) : void + { + this._bFinalized = param1; + } + + public function finalize() : void + { + this._sprGradient = new Sprite(); + this._sprSliderInf = new Sprite(); + this._sprSliderSup = new Sprite(); + this._nGradientWidth = this._nWidth - this._nSeparationWidth - this._nSliderWidth; + this._mMatrixGradient = new Matrix(); + this._mMatrixGradient.createGradientBox(this._nGradientWidth,this._nHeight,0,0,0); + this._aColorsHue = new Array(16711680,16776960,65280,65535,255,16711935,16711680); + this._aAlphasHue = new Array(100,100,100,100,100,100,100); + this._aRatiosHue = new Array(0,1 * 255 / 6,2 * 255 / 6,3 * 255 / 6,4 * 255 / 6,5 * 255 / 6,255); + this._mMatrixSaturation = new Matrix(); + this._mMatrixSaturation.createGradientBox(this._nGradientWidth,this._nHeight,90 / 180 * Math.PI,0,0); + this._aColorsSat = new Array(8421504,8421504); + this._aAlphasSat = new Array(0,100); + this._aRatiosSat = new Array(0,255); + this._sprGradient.graphics.lineStyle(); + this._sprGradient.graphics.beginGradientFill(GradientType.LINEAR,this._aColorsHue,this._aAlphasHue,this._aRatiosHue,this._mMatrixGradient); + this._sprGradient.graphics.drawRect(0,0,this._nGradientWidth,this._nHeight); + this._sprGradient.graphics.endFill(); + this._sprGradient.graphics.beginGradientFill(GradientType.LINEAR,this._aColorsSat,this._aAlphasSat,this._aRatiosSat,this._mMatrixSaturation); + this._sprGradient.graphics.drawRect(0,0,this._nGradientWidth,this._nHeight); + this._sprGradient.graphics.endFill(); + addChild(this._sprGradient); + this._sprSliderInf.x = this._nGradientWidth + this._nSeparationWidth; + addChild(this._sprSliderInf); + this._mMatrixSlider = new Matrix(); + this._mMatrixSlider.createGradientBox(this._nSliderWidth,this._nHeight,90 / 180 * Math.PI,0,0); + this._aAlphasBri = new Array(1,0,0,1); + this._aRatiosBri = new Array(0,127.5,127.5,255); + this._aColorsBri = new Array(16777215,16777215,0,0); + this._sprSliderSup.graphics.beginGradientFill(GradientType.LINEAR,this._aColorsBri,this._aAlphasBri,this._aRatiosBri,this._mMatrixSlider); + this._sprSliderSup.graphics.drawRect(0,0,this._nSliderWidth,this._nHeight); + this._sprSliderSup.graphics.endFill(); + this._sprSliderSup.x = this._nGradientWidth + this._nSeparationWidth; + addChild(this._sprSliderSup); + this._texCursorGradient.dispatchMessages = true; + this._texCursorSlider.dispatchMessages = true; + this._texCursorSlider.addEventListener(Event.COMPLETE,this.onTextureSliderLoaded); + this._texCursorSlider.finalize(); + this._texCursorGradient.addEventListener(Event.COMPLETE,this.onTextureGradientLoaded); + this._texCursorGradient.finalize(); + this._bFinalized = true; + getUi().iAmFinalized(this); + } + + public function updatePicker() : void + { + var _loc1_:Object = ColorUtils.rgb2hsl(this._nColor); + this._texCursorGradient.x = _loc1_.h * this._nGradientWidth - this._texCursorGradient.width / 2; + this._texCursorGradient.y = _loc1_.s * this._nHeight - this._texCursorGradient.height / 2; + this._texCursorSlider.x = this._sprSliderSup.x; + this._texCursorSlider.y = _loc1_.l * this._nHeight - this._texCursorSlider.height / 2; + addChild(this._texCursorGradient); + addChild(this._texCursorSlider); + this.updateSlider(); + this._texCursorGradient.addEventListener(Event.CHANGE,this.onMoveGradientCursor); + this._texCursorSlider.addEventListener(Event.CHANGE,this.onMoveSliderCursor); + } + + override public function remove() : void + { + if(!__removed) + { + this._texCursorSlider.remove(); + this._texCursorGradient.remove(); + this._texCursorSlider = null; + this._texCursorGradient = null; + } + super.remove(); + } + + public function getGradientColor() : uint + { + var _loc1_:* = NaN; + var _loc2_:* = NaN; + var _loc3_:* = NaN; + var _loc4_:* = NaN; + var _loc5_:* = NaN; + var _loc6_:* = NaN; + var _loc7_:* = NaN; + var _loc8_:* = NaN; + var _loc9_:* = NaN; + var _loc10_:* = NaN; + var _loc11_:* = NaN; + var _loc12_:* = NaN; + var _loc13_:* = NaN; + if(this._nGradientX >= this._nGradientWidth) + { + this._nGradientX = this._nGradientWidth - 1; + } + _loc1_ = this._nGradientX / this._nGradientWidth; + var _loc14_:Number = Math.floor(_loc1_ * (this._aRatiosHue.length - 1)); + _loc1_ = _loc1_ * 255; + _loc2_ = 255 - (this._aRatiosHue[_loc14_ + 1] - _loc1_) / (this._aRatiosHue[_loc14_ + 1] - this._aRatiosHue[_loc14_]) * 255; + _loc9_ = this._aColorsHue[_loc14_]; + _loc10_ = this._aColorsHue[_loc14_ + 1]; + _loc3_ = _loc9_ & 16711680; + _loc4_ = _loc9_ & 65280; + _loc5_ = _loc9_ & 255; + _loc6_ = _loc10_ & 16711680; + _loc7_ = _loc10_ & 65280; + _loc8_ = _loc10_ & 255; + if(_loc3_ != _loc6_) + { + _loc11_ = Math.round(_loc3_ > _loc6_?255 - _loc2_:_loc2_); + } + else + { + _loc11_ = _loc3_ >> 16; + } + if(_loc4_ != _loc7_) + { + _loc12_ = Math.round(_loc4_ > _loc7_?255 - _loc2_:_loc2_); + } + else + { + _loc12_ = _loc4_ >> 8; + } + if(_loc5_ != _loc8_) + { + _loc13_ = Math.round(_loc5_ > _loc8_?255 - _loc2_:_loc2_); + } + else + { + _loc13_ = _loc5_; + } + _loc1_ = this._nGradientY / this._nHeight * 255; + _loc11_ = _loc11_ + (127 - _loc11_) * _loc1_ / 255; + _loc12_ = _loc12_ + (127 - _loc12_) * _loc1_ / 255; + _loc13_ = _loc13_ + (127 - _loc13_) * _loc1_ / 255; + this._nGradientColor = Math.round((_loc11_ << 16) + (_loc12_ << 8) + _loc13_); + return this._nGradientColor; + } + + public function updateSlider() : void + { + var _loc1_:uint = this.getGradientColor(); + this._sprSliderInf.graphics.beginFill(_loc1_); + this._sprSliderInf.graphics.drawRect(0,0,this._nSliderWidth,this._nHeight); + this._sprSliderInf.graphics.endFill(); + } + + private function getCurrentPos() : void + { + var _loc1_:Object = ColorUtils.rgb2hsl(this._nColor); + this._texCursorGradient.x = _loc1_.h * this._nGradientWidth - this._texCursorGradient.width / 2; + this._texCursorGradient.y = _loc1_.s * this._nHeight - this._texCursorGradient.height / 2; + this._texCursorSlider.y = _loc1_.l * this._nHeight - this._texCursorSlider.height / 2; + this._nGradientX = this._texCursorGradient.x + this._texCursorGradient.width / 2; + this._nGradientY = this._texCursorGradient.y + this._texCursorGradient.height / 2; + this._nSliderY = this._texCursorSlider.y + this._texCursorSlider.height / 2; + this.updateSlider(); + this.getCurrentColor(); + } + + private function getCurrentColor() : uint + { + var _loc2_:* = NaN; + var _loc3_:* = NaN; + var _loc4_:* = NaN; + var _loc5_:* = NaN; + var _loc6_:* = NaN; + var _loc7_:* = NaN; + var _loc8_:* = NaN; + var _loc1_:Number = 0; + if(!this._bFixedColor) + { + this.getGradientColor(); + _loc2_ = 255 - this._nSliderY / this._nHeight * 510; + _loc3_ = (this._nGradientColor & 16711680) >> 16; + _loc4_ = (this._nGradientColor & 65280) >> 8; + _loc5_ = this._nGradientColor & 255; + if(_loc2_ >= 0) { - this.updatePicker(); - }; - } - - override public function set height(nH:Number):void - { - this._nHeight = nH; - this._nSliderY = int((this._nHeight / 2)); - if (this.finalized) - { - this.updatePicker(); - }; - } - - public function set sliderTexture(uri:Uri):void - { - this._texCursorSlider = new Texture(); - this._texCursorSlider.x = 0; - this._texCursorSlider.y = 0; - this._texCursorSlider.width = 20; - this._texCursorSlider.height = 16; - this._texCursorSlider.uri = uri; - } - - public function get sliderTexture():Uri - { - return (this._texCursorSlider.uri); - } - - public function set gradientTexture(uri:Uri):void - { - this._texCursorGradient = new Texture(); - this._texCursorGradient.x = 0; - this._texCursorGradient.y = 0; - this._texCursorGradient.width = 16; - this._texCursorGradient.height = 16; - this._texCursorGradient.uri = uri; - } - - public function get gradientTexture():Uri - { - return (this._texCursorGradient.uri); - } - - public function get color():uint - { - return (this._nColor); - } - - public function set color(nValue:uint):void - { - this._nColor = nValue; - this._bFixedColor = true; - this.getCurrentPos(); - } - - public function get finalized():Boolean - { - return (this._bFinalized); - } - - public function set finalized(b:Boolean):void - { - this._bFinalized = b; - } - - public function finalize():void - { - this._sprGradient = new Sprite(); - this._sprSliderInf = new Sprite(); - this._sprSliderSup = new Sprite(); - this._nGradientWidth = ((this._nWidth - this._nSeparationWidth) - this._nSliderWidth); - this._mMatrixGradient = new Matrix(); - this._mMatrixGradient.createGradientBox(this._nGradientWidth, this._nHeight, 0, 0, 0); - this._aColorsHue = new Array(0xFF0000, 0xFFFF00, 0xFF00, 0xFFFF, 0xFF, 0xFF00FF, 0xFF0000); - this._aAlphasHue = new Array(100, 100, 100, 100, 100, 100, 100); - this._aRatiosHue = new Array(0, ((1 * 0xFF) / 6), ((2 * 0xFF) / 6), ((3 * 0xFF) / 6), ((4 * 0xFF) / 6), ((5 * 0xFF) / 6), 0xFF); - this._mMatrixSaturation = new Matrix(); - this._mMatrixSaturation.createGradientBox(this._nGradientWidth, this._nHeight, ((90 / 180) * Math.PI), 0, 0); - this._aColorsSat = new Array(0x808080, 0x808080); - this._aAlphasSat = new Array(0, 100); - this._aRatiosSat = new Array(0, 0xFF); - this._sprGradient.graphics.lineStyle(); - this._sprGradient.graphics.beginGradientFill(GradientType.LINEAR, this._aColorsHue, this._aAlphasHue, this._aRatiosHue, this._mMatrixGradient); - this._sprGradient.graphics.drawRect(0, 0, this._nGradientWidth, this._nHeight); - this._sprGradient.graphics.endFill(); - this._sprGradient.graphics.beginGradientFill(GradientType.LINEAR, this._aColorsSat, this._aAlphasSat, this._aRatiosSat, this._mMatrixSaturation); - this._sprGradient.graphics.drawRect(0, 0, this._nGradientWidth, this._nHeight); - this._sprGradient.graphics.endFill(); - addChild(this._sprGradient); - this._sprSliderInf.x = (this._nGradientWidth + this._nSeparationWidth); - addChild(this._sprSliderInf); - this._mMatrixSlider = new Matrix(); - this._mMatrixSlider.createGradientBox(this._nSliderWidth, this._nHeight, ((90 / 180) * Math.PI), 0, 0); - this._aAlphasBri = new Array(1, 0, 0, 1); - this._aRatiosBri = new Array(0, 127.5, 127.5, 0xFF); - this._aColorsBri = new Array(0xFFFFFF, 0xFFFFFF, 0, 0); - this._sprSliderSup.graphics.beginGradientFill(GradientType.LINEAR, this._aColorsBri, this._aAlphasBri, this._aRatiosBri, this._mMatrixSlider); - this._sprSliderSup.graphics.drawRect(0, 0, this._nSliderWidth, this._nHeight); - this._sprSliderSup.graphics.endFill(); - this._sprSliderSup.x = (this._nGradientWidth + this._nSeparationWidth); - addChild(this._sprSliderSup); - this._texCursorGradient.dispatchMessages = true; - this._texCursorSlider.dispatchMessages = true; - this._texCursorSlider.addEventListener(Event.COMPLETE, this.onTextureSliderLoaded); - this._texCursorSlider.finalize(); - this._texCursorGradient.addEventListener(Event.COMPLETE, this.onTextureGradientLoaded); - this._texCursorGradient.finalize(); - this._bFinalized = true; - getUi().iAmFinalized(this); - } - - public function updatePicker():void - { - var hsl:Object = ColorUtils.rgb2hsl(this._nColor); - this._texCursorGradient.x = ((hsl.h * this._nGradientWidth) - (this._texCursorGradient.width / 2)); - this._texCursorGradient.y = ((hsl.s * this._nHeight) - (this._texCursorGradient.height / 2)); - this._texCursorSlider.x = this._sprSliderSup.x; - this._texCursorSlider.y = ((hsl.l * this._nHeight) - (this._texCursorSlider.height / 2)); - addChild(this._texCursorGradient); - addChild(this._texCursorSlider); - this.updateSlider(); - this._texCursorGradient.addEventListener(Event.CHANGE, this.onMoveGradientCursor); - this._texCursorSlider.addEventListener(Event.CHANGE, this.onMoveSliderCursor); - } - - override public function remove():void - { - if (!(__removed)) - { - this._texCursorSlider.remove(); - this._texCursorGradient.remove(); - this._texCursorSlider = null; - this._texCursorGradient = null; - }; - super.remove(); - } - - public function getGradientColor():uint - { - var colorPoint1:Number; - var colorPoint2:Number; - var r1:Number; - var g1:Number; - var b1:Number; - var r2:Number; - var g2:Number; - var b2:Number; - var c1:Number; - var c2:Number; - var r:Number; - var g:Number; - var b:Number; - if (this._nGradientX >= this._nGradientWidth) - { - this._nGradientX = (this._nGradientWidth - 1); - }; - colorPoint1 = (this._nGradientX / this._nGradientWidth); - var i:Number = Math.floor((colorPoint1 * (this._aRatiosHue.length - 1))); - colorPoint1 = (colorPoint1 * 0xFF); - colorPoint2 = (0xFF - (((this._aRatiosHue[(i + 1)] - colorPoint1) / (this._aRatiosHue[(i + 1)] - this._aRatiosHue[i])) * 0xFF)); - c1 = this._aColorsHue[i]; - c2 = this._aColorsHue[(i + 1)]; - r1 = (c1 & 0xFF0000); - g1 = (c1 & 0xFF00); - b1 = (c1 & 0xFF); - r2 = (c2 & 0xFF0000); - g2 = (c2 & 0xFF00); - b2 = (c2 & 0xFF); - if (r1 != r2) - { - r = Math.round((((r1)>r2) ? (0xFF - colorPoint2) : colorPoint2)); + _loc6_ = _loc2_ * (255 - _loc3_) / 255 + _loc3_; + _loc7_ = _loc2_ * (255 - _loc4_) / 255 + _loc4_; + _loc8_ = _loc2_ * (255 - _loc5_) / 255 + _loc5_; } else { - r = (r1 >> 16); - }; - if (g1 != g2) + _loc2_ = _loc2_ * -1; + _loc6_ = Math.round(_loc3_ - _loc3_ * _loc2_ / 255); + _loc7_ = Math.round(_loc4_ - _loc4_ * _loc2_ / 255); + _loc8_ = Math.round(_loc5_ - _loc5_ * _loc2_ / 255); + } + _loc1_ = Math.round((_loc6_ << 16) + (_loc7_ << 8) + _loc8_); + } + else + { + _loc1_ = this._nColor; + } + if(_loc1_ != this._nColor) + { + this._nColor = _loc1_; + Berilia.getInstance().handler.process(new ColorChangeMessage(InteractiveObject(this))); + } + return this._nColor; + } + + override public function process(param1:Message) : Boolean + { + switch(true) + { + case param1 is MouseDownMessage: + if(KeyPoll.getInstance().isDown(16)) + { + return false; + } + this._bFixedColor = false; + switch(MouseDownMessage(param1).target) + { + case this._sprGradient: + case this._texCursorGradient: + this._bMouseDown = true; + this._texCursorGradient.x = mouseX - this._texCursorGradient.width / 2; + this._texCursorGradient.y = mouseY - this._texCursorGradient.height / 2; + this._nGradientX = mouseX; + this._nGradientY = mouseY; + this._texCursorGradient.startDrag(false,new Rectangle(this._sprGradient.x - this._texCursorGradient.width / 2,this._sprGradient.y - this._texCursorGradient.height / 2,this._sprGradient.width,this._sprGradient.height)); + EnterFrameDispatcher.addEventListener(this.onMoveGradientCursor,"ColorPickerGradient"); + break; + case this._sprSliderSup: + case this._texCursorSlider: + this._bMouseDown = true; + this._texCursorSlider.x = mouseX; + this._texCursorSlider.y = mouseY - this._texCursorSlider.height / 2; + this._texCursorSlider.startDrag(false,new Rectangle(this._sprSliderSup.x,this._sprSliderSup.y - this._texCursorSlider.height / 2,0,this._sprSliderSup.height)); + this._nSliderY = mouseY; + EnterFrameDispatcher.addEventListener(this.onMoveSliderCursor,"ColorPickerSlider"); + break; + } + return true; + case param1 is MouseUpMessage: + if(KeyPoll.getInstance().isDown(16)) + { + return false; + } + switch(MouseUpMessage(param1).target) + { + case this._sprGradient: + case this._texCursorGradient: + this._bMouseDown = false; + this._texCursorGradient.stopDrag(); + EnterFrameDispatcher.removeEventListener(this.onMoveGradientCursor); + this.updateSlider(); + this.getCurrentColor(); + break; + case this._sprSliderSup: + case this._texCursorSlider: + this._bMouseDown = false; + this._texCursorSlider.stopDrag(); + EnterFrameDispatcher.removeEventListener(this.onMoveSliderCursor); + this.getCurrentColor(); + break; + } + return true; + case param1 is MouseReleaseOutsideMessage: + switch(MouseReleaseOutsideMessage(param1).target) + { + case this._sprGradient: + case this._texCursorGradient: + this._bMouseDown = false; + this._texCursorGradient.stopDrag(); + EnterFrameDispatcher.removeEventListener(this.onMoveGradientCursor); + this.updateSlider(); + this.getCurrentColor(); + break; + case this._sprSliderSup: + case this._texCursorSlider: + this._bMouseDown = false; + this._texCursorSlider.stopDrag(); + EnterFrameDispatcher.removeEventListener(this.onMoveSliderCursor); + this.getCurrentColor(); + break; + } + return true; + default: + return false; + } + } + + private function onMoveGradientCursor(param1:Event) : void + { + if(!(this._nGradientX == mouseX) || !(this._nGradientY == mouseY)) + { + this._nGradientX = mouseX; + if(this._nGradientX < 0) { - g = Math.round((((g1)>g2) ? (0xFF - colorPoint2) : colorPoint2)); + this._nGradientX = 0; } - else + if(this._nGradientX > this._nGradientWidth) { - g = (g1 >> 8); - }; - if (b1 != b2) + this._nGradientX = this._nGradientWidth; + } + this._nGradientY = mouseY; + if(this._nGradientY < 0) { - b = Math.round((((b1)>b2) ? (0xFF - colorPoint2) : colorPoint2)); + this._nGradientY = 0; } - else + if(this._nGradientY > this._nHeight) { - b = b1; - }; - colorPoint1 = ((this._nGradientY / this._nHeight) * 0xFF); - r = (r + (((127 - r) * colorPoint1) / 0xFF)); - g = (g + (((127 - g) * colorPoint1) / 0xFF)); - b = (b + (((127 - b) * colorPoint1) / 0xFF)); - this._nGradientColor = Math.round((((r << 16) + (g << 8)) + b)); - return (this._nGradientColor); - } - - public function updateSlider():void - { - var gColor:uint = this.getGradientColor(); - this._sprSliderInf.graphics.beginFill(gColor); - this._sprSliderInf.graphics.drawRect(0, 0, this._nSliderWidth, this._nHeight); - this._sprSliderInf.graphics.endFill(); - } - - private function getCurrentPos():void - { - var hsl:Object = ColorUtils.rgb2hsl(this._nColor); - this._texCursorGradient.x = ((hsl.h * this._nGradientWidth) - (this._texCursorGradient.width / 2)); - this._texCursorGradient.y = ((hsl.s * this._nHeight) - (this._texCursorGradient.height / 2)); - this._texCursorSlider.y = ((hsl.l * this._nHeight) - (this._texCursorSlider.height / 2)); - this._nGradientX = (this._texCursorGradient.x + (this._texCursorGradient.width / 2)); - this._nGradientY = (this._texCursorGradient.y + (this._texCursorGradient.height / 2)); - this._nSliderY = (this._texCursorSlider.y + (this._texCursorSlider.height / 2)); + this._nGradientY = this._nHeight; + } this.updateSlider(); this.getCurrentColor(); - } - - private function getCurrentColor():uint - { - var colorPoint:Number; - var r1:Number; - var g1:Number; - var b1:Number; - var r2:Number; - var g2:Number; - var b2:Number; - var tempColor:Number = 0; - if (!(this._bFixedColor)) + } + } + + private function onMoveSliderCursor(param1:Event) : void + { + if(this._nSliderY != mouseY) + { + this._nSliderY = mouseY; + if(this._nSliderY < 0) { - this.getGradientColor(); - colorPoint = (0xFF - ((this._nSliderY / this._nHeight) * 510)); - r1 = ((this._nGradientColor & 0xFF0000) >> 16); - g1 = ((this._nGradientColor & 0xFF00) >> 8); - b1 = (this._nGradientColor & 0xFF); - if (colorPoint >= 0) - { - r2 = (((colorPoint * (0xFF - r1)) / 0xFF) + r1); - g2 = (((colorPoint * (0xFF - g1)) / 0xFF) + g1); - b2 = (((colorPoint * (0xFF - b1)) / 0xFF) + b1); - } - else - { - colorPoint = (colorPoint * -1); - r2 = Math.round((r1 - ((r1 * colorPoint) / 0xFF))); - g2 = Math.round((g1 - ((g1 * colorPoint) / 0xFF))); - b2 = Math.round((b1 - ((b1 * colorPoint) / 0xFF))); - }; - tempColor = Math.round((((r2 << 16) + (g2 << 8)) + b2)); + this._nSliderY = 0; } - else - { - tempColor = this._nColor; - }; - if (tempColor != this._nColor) - { - this._nColor = tempColor; - Berilia.getInstance().handler.process(new ColorChangeMessage(InteractiveObject(this))); - }; - return (this._nColor); - } - - [HideInFakeClass] - override public function process(msg:Message):Boolean - { - switch (true) - { - case (msg is MouseDownMessage): - if (KeyPoll.getInstance().isDown(16)) - { - return (false); - }; - this._bFixedColor = false; - switch (MouseDownMessage(msg).target) - { - case this._sprGradient: - case this._texCursorGradient: - this._bMouseDown = true; - this._texCursorGradient.x = (mouseX - (this._texCursorGradient.width / 2)); - this._texCursorGradient.y = (mouseY - (this._texCursorGradient.height / 2)); - this._nGradientX = mouseX; - this._nGradientY = mouseY; - this._texCursorGradient.startDrag(false, new Rectangle((this._sprGradient.x - (this._texCursorGradient.width / 2)), (this._sprGradient.y - (this._texCursorGradient.height / 2)), this._sprGradient.width, this._sprGradient.height)); - EnterFrameDispatcher.addEventListener(this.onMoveGradientCursor, "ColorPickerGradient"); - break; - case this._sprSliderSup: - case this._texCursorSlider: - this._bMouseDown = true; - this._texCursorSlider.x = mouseX; - this._texCursorSlider.y = (mouseY - (this._texCursorSlider.height / 2)); - this._texCursorSlider.startDrag(false, new Rectangle(this._sprSliderSup.x, (this._sprSliderSup.y - (this._texCursorSlider.height / 2)), 0, this._sprSliderSup.height)); - this._nSliderY = mouseY; - EnterFrameDispatcher.addEventListener(this.onMoveSliderCursor, "ColorPickerSlider"); - break; - }; - return (true); - case (msg is MouseUpMessage): - if (KeyPoll.getInstance().isDown(16)) - { - return (false); - }; - switch (MouseUpMessage(msg).target) - { - case this._sprGradient: - case this._texCursorGradient: - this._bMouseDown = false; - this._texCursorGradient.stopDrag(); - EnterFrameDispatcher.removeEventListener(this.onMoveGradientCursor); - this.updateSlider(); - this.getCurrentColor(); - break; - case this._sprSliderSup: - case this._texCursorSlider: - this._bMouseDown = false; - this._texCursorSlider.stopDrag(); - EnterFrameDispatcher.removeEventListener(this.onMoveSliderCursor); - this.getCurrentColor(); - break; - }; - return (true); - case (msg is MouseReleaseOutsideMessage): - switch (MouseReleaseOutsideMessage(msg).target) - { - case this._sprGradient: - case this._texCursorGradient: - this._bMouseDown = false; - this._texCursorGradient.stopDrag(); - EnterFrameDispatcher.removeEventListener(this.onMoveGradientCursor); - this.updateSlider(); - this.getCurrentColor(); - break; - case this._sprSliderSup: - case this._texCursorSlider: - this._bMouseDown = false; - this._texCursorSlider.stopDrag(); - EnterFrameDispatcher.removeEventListener(this.onMoveSliderCursor); - this.getCurrentColor(); - break; - }; - return (true); - }; - return (false); - } - - private function onMoveGradientCursor(e:Event):void - { - if (((!((this._nGradientX == mouseX))) || (!((this._nGradientY == mouseY))))) + if(this._nSliderY > this._nHeight) { - this._nGradientX = mouseX; - if (this._nGradientX < 0) - { - this._nGradientX = 0; - }; - if (this._nGradientX > this._nGradientWidth) - { - this._nGradientX = this._nGradientWidth; - }; - this._nGradientY = mouseY; - if (this._nGradientY < 0) - { - this._nGradientY = 0; - }; - if (this._nGradientY > this._nHeight) - { - this._nGradientY = this._nHeight; - }; - this.updateSlider(); - this.getCurrentColor(); - }; - } - - private function onMoveSliderCursor(e:Event):void - { - if (this._nSliderY != mouseY) - { - this._nSliderY = mouseY; - if (this._nSliderY < 0) - { - this._nSliderY = 0; - }; - if (this._nSliderY > this._nHeight) - { - this._nSliderY = this._nHeight; - }; - this._nColor = this.getCurrentColor(); - }; - } - - private function onTextureSliderLoaded(e:Event):void - { - this._nLoadedSum++; - this._texCursorSlider.removeEventListener(Event.COMPLETE, this.onTextureSliderLoaded); - if (this._nLoadedSum >= 2) - { - this.updatePicker(); - }; - } - - private function onTextureGradientLoaded(e:Event):void - { - this._nLoadedSum++; - this._texCursorGradient.removeEventListener(Event.COMPLETE, this.onTextureGradientLoaded); - if (this._nLoadedSum >= 2) - { - this.updatePicker(); - }; - } - - - } -}//package com.ankamagames.berilia.components - + this._nSliderY = this._nHeight; + } + this._nColor = this.getCurrentColor(); + } + } + + private function onTextureSliderLoaded(param1:Event) : void + { + this._nLoadedSum++; + this._texCursorSlider.removeEventListener(Event.COMPLETE,this.onTextureSliderLoaded); + if(this._nLoadedSum >= 2) + { + this.updatePicker(); + } + } + + private function onTextureGradientLoaded(param1:Event) : void + { + this._nLoadedSum++; + this._texCursorGradient.removeEventListener(Event.COMPLETE,this.onTextureGradientLoaded); + if(this._nLoadedSum >= 2) + { + this.updatePicker(); + } + } + } +} diff --git a/com/ankamagames/berilia/components/ComboBox.as b/com/ankamagames/berilia/components/ComboBox.as index 7d47839b2..e5de60ab2 100644 --- a/com/ankamagames/berilia/components/ComboBox.as +++ b/com/ankamagames/berilia/components/ComboBox.as @@ -1,573 +1,589 @@ -package com.ankamagames.berilia.components +package com.ankamagames.berilia.components { - import com.ankamagames.berilia.types.graphic.GraphicContainer; - import com.ankamagames.berilia.FinalizableUIComponent; - import flash.utils.Dictionary; - import com.ankamagames.berilia.types.graphic.ButtonContainer; - import flash.display.DisplayObject; - import flash.utils.Timer; - import flash.events.Event; - import flash.events.TimerEvent; - import com.ankamagames.jerakine.types.Uri; - import com.ankamagames.berilia.types.graphic.UiRootContainer; - import com.ankamagames.berilia.managers.SecureCenter; - import flash.errors.IllegalOperationError; - import com.ankamagames.berilia.types.graphic.InternalComponentAccess; - import com.ankamagames.berilia.types.graphic.GraphicElement; - import com.ankamagames.berilia.enums.StatesEnum; - import flash.display.InteractiveObject; - import com.ankamagames.jerakine.handlers.messages.mouse.MouseReleaseOutsideMessage; - import com.ankamagames.berilia.components.messages.SelectItemMessage; - import com.ankamagames.berilia.enums.SelectMethodEnum; - import com.ankamagames.jerakine.handlers.messages.mouse.MouseDownMessage; - import com.ankamagames.jerakine.handlers.messages.mouse.MouseWheelMessage; - import com.ankamagames.jerakine.handlers.FocusHandler; - import com.ankamagames.jerakine.handlers.messages.keyboard.KeyboardMessage; - import flash.ui.Keyboard; - import com.ankamagames.jerakine.handlers.messages.keyboard.KeyboardKeyUpMessage; - import com.ankamagames.jerakine.messages.Message; - import com.ankamagames.jerakine.utils.display.StageShareManager; - import flash.events.MouseEvent; - import com.ankamagames.jerakine.interfaces.IInterfaceListener; - import com.ankamagames.berilia.Berilia; - import com.ankamagames.jerakine.utils.misc.StringUtils; - - public class ComboBox extends GraphicContainer implements FinalizableUIComponent - { - - public static var MEMORY_LOG:Dictionary = new Dictionary(true); - protected static const SEARCH_DELAY:int = 1000; - - protected var _list:ComboBoxGrid; - protected var _button:ButtonContainer; - protected var _mainContainer:DisplayObject; - protected var _bgTexture:Texture; - protected var _listTexture:Texture; - protected var _finalized:Boolean; - protected var _useKeyboard:Boolean = true; - protected var _closeOnClick:Boolean = true; - protected var _maxListSize:uint = 300; - protected var _slotWidth:uint; - protected var _slotHeight:uint; - private var _previousState:Boolean = false; - protected var _dataNameField:String = "label"; - protected var _searchString:String; - private var _lastSearchIndex:int = 0; - private var _searchStopped:Boolean = false; - private var _searchTimer:Timer; - public var listSizeOffset:uint; - public var autoCenter:Boolean = true; - - public function ComboBox() - { - this._searchTimer = new Timer(SEARCH_DELAY, 1); - super(); - this._button = new ButtonContainer(); - this._button.soundId = "0"; - this._bgTexture = new Texture(); - this._listTexture = new Texture(); - this._list = new ComboBoxGrid(); - this.showList(false); - addEventListener(Event.ADDED_TO_STAGE, this.onAddedToStage); - this._searchTimer.addEventListener(TimerEvent.TIMER_COMPLETE, this.onSearchTimerComplete); - MEMORY_LOG[this] = 1; - } - - public function set buttonTexture(uri:Uri):void - { - this._bgTexture.uri = uri; - } - - public function get buttonTexture():Uri - { - return (this._bgTexture.uri); - } - - public function set listTexture(uri:Uri):void - { - this._listTexture.uri = uri; - } - - public function get listTexture():Uri - { - return (this._listTexture.uri); - } - - public function get maxHeight():uint - { - return (this._maxListSize); - } - - public function set maxHeight(v:uint):void - { - this._maxListSize = v; - } - - public function get slotWidth():uint - { - return (this._slotWidth); - } - - public function set slotWidth(value:uint):void - { - this._slotWidth = value; - if (this.finalized) + import com.ankamagames.berilia.types.graphic.GraphicContainer; + import com.ankamagames.berilia.FinalizableUIComponent; + import flash.utils.Dictionary; + import com.ankamagames.berilia.types.graphic.ButtonContainer; + import flash.display.DisplayObject; + import flash.utils.Timer; + import com.ankamagames.jerakine.types.Uri; + import com.ankamagames.berilia.types.graphic.UiRootContainer; + import com.ankamagames.berilia.managers.SecureCenter; + import flash.errors.IllegalOperationError; + import com.ankamagames.berilia.types.graphic.InternalComponentAccess; + import com.ankamagames.berilia.types.graphic.GraphicElement; + import com.ankamagames.berilia.enums.StatesEnum; + import com.ankamagames.jerakine.messages.Message; + import flash.display.InteractiveObject; + import com.ankamagames.berilia.components.messages.SelectItemMessage; + import com.ankamagames.berilia.enums.SelectMethodEnum; + import com.ankamagames.jerakine.handlers.messages.mouse.MouseDownMessage; + import com.ankamagames.jerakine.handlers.messages.mouse.MouseWheelMessage; + import com.ankamagames.jerakine.handlers.FocusHandler; + import com.ankamagames.jerakine.handlers.messages.keyboard.KeyboardMessage; + import flash.ui.Keyboard; + import com.ankamagames.jerakine.handlers.messages.mouse.MouseReleaseOutsideMessage; + import com.ankamagames.jerakine.handlers.messages.keyboard.KeyboardKeyUpMessage; + import flash.events.Event; + import com.ankamagames.jerakine.utils.display.StageShareManager; + import flash.events.MouseEvent; + import com.ankamagames.jerakine.interfaces.IInterfaceListener; + import com.ankamagames.berilia.Berilia; + import com.ankamagames.jerakine.utils.misc.StringUtils; + import flash.events.TimerEvent; + + public class ComboBox extends GraphicContainer implements FinalizableUIComponent + { + + public function ComboBox() + { + this._searchTimer = new Timer(SEARCH_DELAY,1); + super(); + this._button = new ButtonContainer(); + this._button.soundId = "0"; + this._bgTexture = new Texture(); + this._listTexture = new Texture(); + this._list = new ComboBoxGrid(); + this.showList(false); + addEventListener(Event.ADDED_TO_STAGE,this.onAddedToStage); + this._searchTimer.addEventListener(TimerEvent.TIMER_COMPLETE,this.onSearchTimerComplete); + MEMORY_LOG[this] = 1; + } + + public static var MEMORY_LOG:Dictionary = new Dictionary(true); + + protected static const SEARCH_DELAY:int = 1000; + + protected var _list:ComboBoxGrid; + + protected var _button:ButtonContainer; + + protected var _mainContainer:DisplayObject; + + protected var _bgTexture:Texture; + + protected var _listTexture:Texture; + + protected var _finalized:Boolean; + + protected var _useKeyboard:Boolean = true; + + protected var _closeOnClick:Boolean = true; + + protected var _maxListSize:uint = 300; + + protected var _slotWidth:uint; + + protected var _slotHeight:uint; + + private var _previousState:Boolean = false; + + protected var _dataNameField:String = "label"; + + protected var _searchString:String; + + private var _lastSearchIndex:int = 0; + + private var _searchStopped:Boolean = false; + + private var _searchTimer:Timer; + + public var listSizeOffset:uint; + + public var autoCenter:Boolean = true; + + public function set buttonTexture(param1:Uri) : void + { + this._bgTexture.uri = param1; + } + + public function get buttonTexture() : Uri + { + return this._bgTexture.uri; + } + + public function set listTexture(param1:Uri) : void + { + this._listTexture.uri = param1; + } + + public function get listTexture() : Uri + { + return this._listTexture.uri; + } + + public function get maxHeight() : uint + { + return this._maxListSize; + } + + public function set maxHeight(param1:uint) : void + { + this._maxListSize = param1; + } + + public function get slotWidth() : uint + { + return this._slotWidth; + } + + public function set slotWidth(param1:uint) : void + { + this._slotWidth = param1; + if(this.finalized) + { + this.finalize(); + } + } + + public function get slotHeight() : uint + { + return this._slotHeight; + } + + public function set slotHeight(param1:uint) : void + { + this._slotHeight = param1; + if(this.finalized) + { + this.finalize(); + } + } + + public function set dataProvider(param1:*) : void + { + var _loc2_:uint = this._maxListSize / this._list.slotHeight; + if(param1) + { + if(param1.length > _loc2_) { - this.finalize(); - }; - } - - public function get slotHeight():uint - { - return (this._slotHeight); - } - - public function set slotHeight(value:uint):void - { - this._slotHeight = value; - if (this.finalized) - { - this.finalize(); - }; - } - - public function set dataProvider(data:*):void - { - var nbSlot:uint = (this._maxListSize / this._list.slotHeight); - if (data) - { - if (data.length > nbSlot) - { - this._list.width = (width - 6); - this._list.height = this._maxListSize; - this._list.slotWidth = ((this.slotWidth) ? this.slotWidth : (this._list.width - 16)); - } - else - { - this._list.width = (width - this.listSizeOffset); - this._list.height = (this._list.slotHeight * data.length); - this._list.slotWidth = ((this.slotWidth) ? this.slotWidth : this._list.width); - }; + this._list.width = width - 6; + this._list.height = this._maxListSize; + this._list.slotWidth = this.slotWidth?this.slotWidth:this._list.width - 16; } else { - this._list.width = (width - this.listSizeOffset); - this._list.height = this._list.slotHeight; - this._list.slotWidth = ((this.slotWidth) ? this.slotWidth : this._list.width); - }; - this._listTexture.height = (this._list.height + 8); - this._listTexture.width = (this._list.width + 3); - this._list.dataProvider = data; - } - - public function get dataProvider() - { - return (this._list.dataProvider); - } - - public function get finalized():Boolean - { - return (this._finalized); - } - - public function set finalized(b:Boolean):void - { - this._finalized = b; - } - - public function set scrollBarCss(uri:Uri):void - { - this._list.verticalScrollbarCss = uri; - } - - public function get scrollBarCss():Uri - { - return (this._list.verticalScrollbarCss); - } - - public function set rendererName(name:String):void - { - this._list.rendererName = name; - } - - public function get rendererName():String - { - return (this._list.rendererName); - } - - public function set rendererArgs(args:String):void - { - this._list.rendererArgs = args; - } - - public function get rendererArgs():String - { - return (this._list.rendererArgs); - } - - public function get value() - { - return (this._list.selectedItem); - } - - public function set value(o:*):void - { - this._list.selectedItem = o; - } - - public function set autoSelect(b:Boolean):void - { - this._list.autoSelect = b; - } - - public function get autoSelect():Boolean - { - return (this._list.autoSelect); - } - - public function set autoSelectMode(n:int):void - { - this._list.autoSelectMode = n; - } - - public function get autoSelectMode():int - { - return (this._list.autoSelectMode); - } - - public function set useKeyboard(b:Boolean):void - { - this._useKeyboard = b; - } - - public function get useKeyboard():Boolean - { - return (this._useKeyboard); - } - - public function set closeOnClick(b:Boolean):void - { - this._closeOnClick = b; - } - - public function get closeOnClick():Boolean - { - return (this._closeOnClick); - } - - public function set selectedItem(v:Object):void - { - this._list.selectedItem = v; - } - - public function get selectedItem():Object - { - return (this._list.selectedItem); - } - - public function get selectedIndex():uint - { - return (this._list.selectedIndex); - } - - public function set selectedIndex(v:uint):void - { - this._list.selectedIndex = v; - } - - public function get container() - { - if (!(this._mainContainer)) - { - return (null); - }; - if ((this._mainContainer is UiRootContainer)) - { - return (SecureCenter.secure((this._mainContainer as UiRootContainer), getUi().uiModule.trusted)); - }; - return (SecureCenter.secure(this._mainContainer, getUi().uiModule.trusted)); - } - - public function set dataNameField(value:String):void - { - this._dataNameField = value; - } - - public function renderModificator(childs:Array, accessKey:Object):Array - { - if (accessKey != SecureCenter.ACCESS_KEY) - { - throw (new IllegalOperationError()); - }; + this._list.width = width - this.listSizeOffset; + this._list.height = this._list.slotHeight * param1.length; + this._list.slotWidth = this.slotWidth?this.slotWidth:this._list.width; + } + } + else + { + this._list.width = width - this.listSizeOffset; + this._list.height = this._list.slotHeight; + this._list.slotWidth = this.slotWidth?this.slotWidth:this._list.width; + } + this._listTexture.height = this._list.height + 8; + this._listTexture.width = this._list.width + 3; + this._list.dataProvider = param1; + } + + public function get dataProvider() : * + { + return this._list.dataProvider; + } + + public function get finalized() : Boolean + { + return this._finalized; + } + + public function set finalized(param1:Boolean) : void + { + this._finalized = param1; + } + + public function set scrollBarCss(param1:Uri) : void + { + this._list.verticalScrollbarCss = param1; + } + + public function get scrollBarCss() : Uri + { + return this._list.verticalScrollbarCss; + } + + public function set rendererName(param1:String) : void + { + this._list.rendererName = param1; + } + + public function get rendererName() : String + { + return this._list.rendererName; + } + + public function set rendererArgs(param1:String) : void + { + this._list.rendererArgs = param1; + } + + public function get rendererArgs() : String + { + return this._list.rendererArgs; + } + + public function get value() : * + { + return this._list.selectedItem; + } + + public function set value(param1:*) : void + { + this._list.selectedItem = param1; + } + + public function set autoSelect(param1:Boolean) : void + { + this._list.autoSelect = param1; + } + + public function get autoSelect() : Boolean + { + return this._list.autoSelect; + } + + public function set autoSelectMode(param1:int) : void + { + this._list.autoSelectMode = param1; + } + + public function get autoSelectMode() : int + { + return this._list.autoSelectMode; + } + + public function set useKeyboard(param1:Boolean) : void + { + this._useKeyboard = param1; + } + + public function get useKeyboard() : Boolean + { + return this._useKeyboard; + } + + public function set closeOnClick(param1:Boolean) : void + { + this._closeOnClick = param1; + } + + public function get closeOnClick() : Boolean + { + return this._closeOnClick; + } + + public function set selectedItem(param1:Object) : void + { + this._list.selectedItem = param1; + } + + public function get selectedItem() : Object + { + return this._list.selectedItem; + } + + public function get selectedIndex() : uint + { + return this._list.selectedIndex; + } + + public function set selectedIndex(param1:uint) : void + { + this._list.selectedIndex = param1; + } + + public function get container() : * + { + if(!this._mainContainer) + { + return null; + } + if(this._mainContainer is UiRootContainer) + { + return SecureCenter.secure(this._mainContainer as UiRootContainer,getUi().uiModule.trusted); + } + return SecureCenter.secure(this._mainContainer,getUi().uiModule.trusted); + } + + public function set dataNameField(param1:String) : void + { + this._dataNameField = param1; + } + + public function renderModificator(param1:Array, param2:Object) : Array + { + if(param2 != SecureCenter.ACCESS_KEY) + { + throw new IllegalOperationError(); + } + else + { this.listSizeOffset = height; - this._list.rendererName = ((this._list.rendererName) ? this._list.rendererName : "LabelGridRenderer"); - this._list.rendererArgs = ((this._list.rendererArgs) ? this._list.rendererArgs : ",0xFFFFFF,0xEEEEFF,0xC0E272,0x99D321"); - this._list.width = (width - this.listSizeOffset); - this._list.slotWidth = ((this.slotWidth) ? this.slotWidth : this._list.width); - this._list.slotHeight = ((this.slotHeight) ? this.slotHeight : (height - 4)); - InternalComponentAccess.setProperty(this._list, "_uiRootContainer", InternalComponentAccess.getProperty(this, "_uiRootContainer")); - return (this._list.renderModificator(childs, accessKey)); - } - - public function finalize():void - { - this._button.width = width; - this._button.height = height; - this._bgTexture.width = width; - this._bgTexture.height = height; - this._bgTexture.autoGrid = true; - this._bgTexture.finalize(); - this._button.addChild(this._bgTexture); - getUi().registerId(this._bgTexture.name, new GraphicElement(this._bgTexture, new Array(), this._bgTexture.name)); - var stateChangingProperties:Array = new Array(); - stateChangingProperties[StatesEnum.STATE_OVER] = new Array(); - stateChangingProperties[StatesEnum.STATE_OVER][this._bgTexture.name] = new Array(); - stateChangingProperties[StatesEnum.STATE_OVER][this._bgTexture.name]["gotoAndStop"] = StatesEnum.STATE_OVER_STRING.toLocaleLowerCase(); - stateChangingProperties[StatesEnum.STATE_CLICKED] = new Array(); - stateChangingProperties[StatesEnum.STATE_CLICKED][this._bgTexture.name] = new Array(); - stateChangingProperties[StatesEnum.STATE_CLICKED][this._bgTexture.name]["gotoAndStop"] = StatesEnum.STATE_CLICKED_STRING.toLocaleLowerCase(); - this._button.changingStateData = stateChangingProperties; - this._button.finalize(); - this._list.name = ("grid_" + name); - this._list.width = (width - this.listSizeOffset); - this._list.slotWidth = ((this.slotWidth) ? this.slotWidth : this._list.width); - this._list.slotHeight = ((this.slotHeight) ? this.slotHeight : (height - 4)); - this._list.x = 2; - this._list.y = (height + 2); - this._list.finalize(); - this._listTexture.width = (this._list.width + 4); - this._listTexture.autoGrid = true; - this._listTexture.y = (height - 1); - this._listTexture.x = 2; - this._listTexture.finalize(); - addChild(this._button); - addChild(this._listTexture); - addChild(this._list); - this._listTexture.mouseEnabled = false; - this._list.mouseEnabled = false; - this._mainContainer = this._list.renderer.render(null, 0, false); - this._mainContainer.height = this._list.slotHeight; - this._mainContainer.x = this._list.x; - if (this.autoCenter) + this._list.rendererName = this._list.rendererName?this._list.rendererName:"LabelGridRenderer"; + this._list.rendererArgs = this._list.rendererArgs?this._list.rendererArgs:",0xFFFFFF,0xEEEEFF,0xC0E272,0x99D321"; + this._list.width = width - this.listSizeOffset; + this._list.slotWidth = this.slotWidth?this.slotWidth:this._list.width; + this._list.slotHeight = this.slotHeight?this.slotHeight:height - 4; + InternalComponentAccess.setProperty(this._list,"_uiRootContainer",InternalComponentAccess.getProperty(this,"_uiRootContainer")); + return this._list.renderModificator(param1,param2); + } + } + + public function finalize() : void + { + this._button.width = width; + this._button.height = height; + this._bgTexture.width = width; + this._bgTexture.height = height; + this._bgTexture.autoGrid = true; + this._bgTexture.finalize(); + this._button.addChild(this._bgTexture); + getUi().registerId(this._bgTexture.name,new GraphicElement(this._bgTexture,new Array(),this._bgTexture.name)); + var _loc1_:Array = new Array(); + _loc1_[StatesEnum.STATE_OVER] = new Array(); + _loc1_[StatesEnum.STATE_OVER][this._bgTexture.name] = new Array(); + _loc1_[StatesEnum.STATE_OVER][this._bgTexture.name]["gotoAndStop"] = StatesEnum.STATE_OVER_STRING.toLocaleLowerCase(); + _loc1_[StatesEnum.STATE_CLICKED] = new Array(); + _loc1_[StatesEnum.STATE_CLICKED][this._bgTexture.name] = new Array(); + _loc1_[StatesEnum.STATE_CLICKED][this._bgTexture.name]["gotoAndStop"] = StatesEnum.STATE_CLICKED_STRING.toLocaleLowerCase(); + this._button.changingStateData = _loc1_; + this._button.finalize(); + this._list.name = "grid_" + name; + this._list.width = width - this.listSizeOffset; + this._list.slotWidth = this.slotWidth?this.slotWidth:this._list.width; + this._list.slotHeight = this.slotHeight?this.slotHeight:height - 4; + this._list.x = 2; + this._list.y = height + 2; + this._list.finalize(); + this._listTexture.width = this._list.width + 4; + this._listTexture.autoGrid = true; + this._listTexture.y = height - 1; + this._listTexture.x = 2; + this._listTexture.finalize(); + addChild(this._button); + addChild(this._listTexture); + addChild(this._list); + this._listTexture.mouseEnabled = false; + this._list.mouseEnabled = false; + this._mainContainer = this._list.renderer.render(null,0,false); + this._mainContainer.height = this._list.slotHeight; + this._mainContainer.x = this._list.x; + if(this.autoCenter) + { + this._mainContainer.y = (height - this._mainContainer.height) / 2; + } + this._button.addChild(this._mainContainer); + this._finalized = true; + this._searchString = ""; + getUi().iAmFinalized(this); + } + + override public function process(param1:Message) : Boolean + { + var _loc2_:InteractiveObject = null; + var _loc3_:uint = 0; + switch(true) + { + case param1 is MouseReleaseOutsideMessage: + this.showList(false); + this._searchString = ""; + break; + case param1 is SelectItemMessage: + this._list.renderer.update(this._list.selectedItem,0,this._mainContainer,false); + switch(SelectItemMessage(param1).selectMethod) + { + case SelectMethodEnum.UP_ARROW: + case SelectMethodEnum.DOWN_ARROW: + case SelectMethodEnum.RIGHT_ARROW: + case SelectMethodEnum.LEFT_ARROW: + case SelectMethodEnum.SEARCH: + case SelectMethodEnum.AUTO: + case SelectMethodEnum.MANUAL: + break; + default: + this.showList(false); + } + break; + case param1 is MouseDownMessage: + if(!this._list.visible) + { + if((this._list.dataProvider) && (this._list.dataProvider.length > 0) || MouseDownMessage(param1).target == this._button) + { + this.showList(true); + this._list.moveTo(this._list.selectedIndex); + } + } + else if(MouseDownMessage(param1).target == this._button) + { + this.showList(false); + } + + this._searchString = ""; + break; + case param1 is MouseWheelMessage: + if(this._list.visible) + { + this._list.process(param1); + } + else + { + this._list.setSelectedIndex(this._list.selectedIndex + MouseWheelMessage(param1).mouseEvent.delta / Math.abs(MouseWheelMessage(param1).mouseEvent.delta) * -1,SelectMethodEnum.WHEEL); + } + return true; + case param1 is KeyboardKeyUpMessage: + _loc2_ = FocusHandler.getInstance().getFocus(); + if(!(_loc2_ is Input)) + { + _loc3_ = KeyboardMessage(param1).keyboardEvent.keyCode; + if(!(_loc3_ == Keyboard.DOWN) && !(_loc3_ == Keyboard.UP) && !(_loc3_ == Keyboard.LEFT) && !(_loc3_ == Keyboard.RIGHT) && !(_loc3_ == Keyboard.ENTER)) + { + if(this._searchStopped) + { + this._searchStopped = false; + if(this._searchString.length == 1 && String.fromCharCode(KeyboardMessage(param1).keyboardEvent.charCode) == this._searchString) + { + this.searchStringInCB(this._searchString,this._lastSearchIndex + 1); + return true; + } + this._searchString = ""; + } + this._searchString = this._searchString + String.fromCharCode(KeyboardMessage(param1).keyboardEvent.charCode); + this.searchStringInCB(this._searchString); + return true; + } + } + if(KeyboardMessage(param1).keyboardEvent.keyCode == Keyboard.ENTER && (this._list.visible)) + { + if(this._useKeyboard) + { + this.showList(false); + return true; + } + } + break; + case param1 is KeyboardMessage: + if(this._useKeyboard) + { + this._list.process(param1); + } + break; + } + return false; + } + + override public function remove() : void + { + if(!__removed) + { + removeEventListener(Event.ADDED_TO_STAGE,this.onAddedToStage); + StageShareManager.stage.removeEventListener(MouseEvent.CLICK,this.onClick); + this._listTexture.remove(); + this._list.remove(); + this._button.remove(); + this._list.renderer.remove(this._mainContainer); + SecureCenter.destroy(this._mainContainer); + SecureCenter.destroy(this._list); + this._bgTexture.remove(); + this._bgTexture = null; + this._list = null; + this._button = null; + this._mainContainer = null; + this._listTexture = null; + } + super.remove(); + } + + protected function showList(param1:Boolean) : void + { + var _loc2_:IInterfaceListener = null; + var _loc3_:IInterfaceListener = null; + if(this._previousState != param1) + { + if(param1) { - this._mainContainer.y = ((height - this._mainContainer.height) / 2); - }; - this._button.addChild(this._mainContainer); - this._finalized = true; - this._searchString = ""; - getUi().iAmFinalized(this); - } - - [HideInFakeClass] - override public function process(msg:Message):Boolean - { - var _local_2:InteractiveObject; - var keyCode:uint; - switch (true) + for each(_loc2_ in Berilia.getInstance().UISoundListeners) + { + _loc2_.playUISound("16012"); + } + } + else { - case (msg is MouseReleaseOutsideMessage): - this.showList(false); - this._searchString = ""; - break; - case (msg is SelectItemMessage): - this._list.renderer.update(this._list.selectedItem, 0, this._mainContainer, false); - switch (SelectItemMessage(msg).selectMethod) - { - case SelectMethodEnum.UP_ARROW: - case SelectMethodEnum.DOWN_ARROW: - case SelectMethodEnum.RIGHT_ARROW: - case SelectMethodEnum.LEFT_ARROW: - case SelectMethodEnum.SEARCH: - case SelectMethodEnum.AUTO: - case SelectMethodEnum.MANUAL: - break; - default: - this.showList(false); - }; - break; - case (msg is MouseDownMessage): - if (!(this._list.visible)) - { - if (((((this._list.dataProvider) && ((this._list.dataProvider.length > 0)))) || ((MouseDownMessage(msg).target == this._button)))) - { - this.showList(true); - this._list.moveTo(this._list.selectedIndex); - }; - } - else - { - if (MouseDownMessage(msg).target == this._button) - { - this.showList(false); - }; - }; - this._searchString = ""; - break; - case (msg is MouseWheelMessage): - if (this._list.visible) - { - this._list.process(msg); - } - else - { - this._list.setSelectedIndex((this._list.selectedIndex + ((MouseWheelMessage(msg).mouseEvent.delta / Math.abs(MouseWheelMessage(msg).mouseEvent.delta)) * -1)), SelectMethodEnum.WHEEL); - }; - return (true); - case (msg is KeyboardKeyUpMessage): - _local_2 = FocusHandler.getInstance().getFocus(); - if (!((_local_2 is Input))) - { - keyCode = KeyboardMessage(msg).keyboardEvent.keyCode; - if (((((((((!((keyCode == Keyboard.DOWN))) && (!((keyCode == Keyboard.UP))))) && (!((keyCode == Keyboard.LEFT))))) && (!((keyCode == Keyboard.RIGHT))))) && (!((keyCode == Keyboard.ENTER))))) - { - if (this._searchStopped) - { - this._searchStopped = false; - if ((((this._searchString.length == 1)) && ((String.fromCharCode(KeyboardMessage(msg).keyboardEvent.charCode) == this._searchString)))) - { - this.searchStringInCB(this._searchString, (this._lastSearchIndex + 1)); - return (true); - }; - this._searchString = ""; - }; - this._searchString = (this._searchString + String.fromCharCode(KeyboardMessage(msg).keyboardEvent.charCode)); - this.searchStringInCB(this._searchString); - return (true); - }; - }; - if ((((KeyboardMessage(msg).keyboardEvent.keyCode == Keyboard.ENTER)) && (this._list.visible))) - { - if (this._useKeyboard) - { - this.showList(false); - return (true); - }; - }; - break; - case (msg is KeyboardMessage): - if (this._useKeyboard) - { - this._list.process(msg); - }; - break; - }; - return (false); - } - - override public function remove():void - { - if (!(__removed)) + for each(_loc3_ in Berilia.getInstance().UISoundListeners) + { + _loc3_.playUISound("16013"); + } + } + } + this._listTexture.visible = param1; + this._list.visible = param1; + this._previousState = param1; + } + + protected function searchStringInCB(param1:String, param2:int = 0) : void + { + var _loc4_:* = 0; + this._searchTimer.reset(); + this._searchTimer.start(); + var _loc3_:RegExp = new RegExp(param1 + "?","gi"); + var _loc5_:* = -1; + var _loc6_:* = ""; + _loc4_ = param2; + while(_loc4_ < this.dataProvider.length) + { + if(this._dataNameField == "" || this.dataProvider[_loc4_] is String) { - removeEventListener(Event.ADDED_TO_STAGE, this.onAddedToStage); - StageShareManager.stage.removeEventListener(MouseEvent.CLICK, this.onClick); - this._listTexture.remove(); - this._list.remove(); - this._button.remove(); - this._list.renderer.remove(this._mainContainer); - SecureCenter.destroy(this._mainContainer); - SecureCenter.destroy(this._list); - this._bgTexture.remove(); - this._bgTexture = null; - this._list = null; - this._button = null; - this._mainContainer = null; - this._listTexture = null; - }; - super.remove(); - } - - protected function showList(show:Boolean):void - { - var listener:IInterfaceListener; - var _local_3:IInterfaceListener; - if (this._previousState != show) + _loc6_ = this.cleanString(this.dataProvider[_loc4_].toLowerCase()); + } + else { - if (show) - { - for each (listener in Berilia.getInstance().UISoundListeners) - { - listener.playUISound("16012"); - }; - } - else - { - for each (_local_3 in Berilia.getInstance().UISoundListeners) - { - _local_3.playUISound("16013"); - }; - }; - }; - this._listTexture.visible = show; - this._list.visible = show; - this._previousState = show; - } - - protected function searchStringInCB(searchPhrase:String, startIndex:int=0):void - { - var i:int; - this._searchTimer.reset(); - this._searchTimer.start(); - var comparRegexp:RegExp = new RegExp((searchPhrase + "?"), "gi"); - var indexOfString:int = -1; - var compareString:String = ""; - i = startIndex; - while (i < this.dataProvider.length) + _loc6_ = this.cleanString(this.dataProvider[_loc4_][this._dataNameField].toLowerCase()); + } + _loc5_ = _loc6_.indexOf(this.cleanString(param1)); + if(_loc5_ != -1) { - if ((((this._dataNameField == "")) || ((this.dataProvider[i] is String)))) - { - compareString = this.cleanString(this.dataProvider[i].toLowerCase()); - } - else - { - compareString = this.cleanString(this.dataProvider[i][this._dataNameField].toLowerCase()); - }; - indexOfString = compareString.indexOf(this.cleanString(searchPhrase)); - if (indexOfString != -1) - { - this._list.setSelectedIndex(i, SelectMethodEnum.SEARCH); - this._lastSearchIndex = i; - return; - }; - i++; - }; - } - - protected function cleanString(spaced:String):String - { - var regSpace:RegExp = /\s/g; - var numberSeparator:String = " "; - var pattern1:RegExp = new RegExp(regSpace); - var tempString:String = spaced.replace(pattern1, ""); - tempString = tempString.replace(numberSeparator, ""); - return (StringUtils.noAccent(tempString)); - } - - private function onClick(e:MouseEvent):void - { - var p:DisplayObject = DisplayObject(e.target); - while (p.parent) + this._list.setSelectedIndex(_loc4_,SelectMethodEnum.SEARCH); + this._lastSearchIndex = _loc4_; + break; + } + _loc4_++; + } + } + + protected function cleanString(param1:String) : String + { + var _loc2_:RegExp = new RegExp("\\s","g"); + var _loc3_:* = " "; + var _loc4_:RegExp = new RegExp(_loc2_); + var _loc5_:String = param1.replace(_loc4_,""); + _loc5_ = _loc5_.replace(_loc3_,""); + return StringUtils.noAccent(_loc5_); + } + + private function onClick(param1:MouseEvent) : void + { + var _loc2_:DisplayObject = DisplayObject(param1.target); + while(_loc2_.parent) + { + if(_loc2_ == this) { - if (p == this) - { - return; - }; - p = p.parent; - }; - this.showList(false); - } - - private function onAddedToStage(e:Event):void - { - removeEventListener(Event.ADDED_TO_STAGE, this.onAddedToStage); - StageShareManager.stage.addEventListener(MouseEvent.CLICK, this.onClick); - } - - private function onSearchTimerComplete(e:TimerEvent):void - { - this._searchStopped = true; - } - - - } -}//package com.ankamagames.berilia.components - + return; + } + _loc2_ = _loc2_.parent; + } + this.showList(false); + } + + private function onAddedToStage(param1:Event) : void + { + removeEventListener(Event.ADDED_TO_STAGE,this.onAddedToStage); + StageShareManager.stage.addEventListener(MouseEvent.CLICK,this.onClick); + } + + private function onSearchTimerComplete(param1:TimerEvent) : void + { + this._searchStopped = true; + } + } +} diff --git a/com/ankamagames/berilia/components/ComboBoxGrid.as b/com/ankamagames/berilia/components/ComboBoxGrid.as index e8dda6a6e..42bc41a67 100644 --- a/com/ankamagames/berilia/components/ComboBoxGrid.as +++ b/com/ankamagames/berilia/components/ComboBoxGrid.as @@ -1,58 +1,59 @@ -package com.ankamagames.berilia.components +package com.ankamagames.berilia.components { - import com.ankamagames.jerakine.handlers.messages.mouse.MouseMessage; - import com.ankamagames.berilia.types.data.GridItem; - import com.ankamagames.jerakine.utils.display.FrameIdManager; - import com.ankamagames.jerakine.handlers.messages.mouse.MouseDoubleClickMessage; - import com.ankamagames.jerakine.handlers.messages.mouse.MouseClickMessage; - import com.ankamagames.berilia.managers.UIEventManager; - import com.ankamagames.berilia.components.messages.SelectEmptyItemMessage; - import com.ankamagames.berilia.enums.SelectMethodEnum; - import com.ankamagames.jerakine.handlers.messages.mouse.MouseUpMessage; - import com.ankamagames.jerakine.messages.Message; - - public class ComboBoxGrid extends Grid - { - - private var _lastMouseUpFrameId:int = -1; - - - override public function process(msg:Message):Boolean - { - var _local_2:MouseMessage; - var _local_3:GridItem; - switch (true) - { - case (msg is MouseDoubleClickMessage): - case (msg is MouseClickMessage): - if (this._lastMouseUpFrameId == FrameIdManager.frameId) - { - break; - }; - case (msg is MouseUpMessage): - this._lastMouseUpFrameId = FrameIdManager.frameId; - _local_2 = MouseMessage(msg); - _local_3 = super.getGridItem(_local_2.target); - if (_local_3) - { - if (!(_local_3.data)) - { - if (UIEventManager.getInstance().isRegisteredInstance(this, SelectEmptyItemMessage)) - { - super.dispatchMessage(new SelectEmptyItemMessage(this, SelectMethodEnum.CLICK)); - }; - setSelectedIndex(-1, SelectMethodEnum.CLICK); - }; - setSelectedIndex(_local_3.index, SelectMethodEnum.CLICK); - }; - return (true); - default: - super.process(msg); - }; - return (false); - } - - - } -}//package com.ankamagames.berilia.components - + import com.ankamagames.jerakine.messages.Message; + import com.ankamagames.jerakine.handlers.messages.mouse.MouseMessage; + import com.ankamagames.berilia.types.data.GridItem; + import com.ankamagames.jerakine.utils.display.FrameIdManager; + import com.ankamagames.berilia.managers.UIEventManager; + import com.ankamagames.berilia.components.messages.SelectEmptyItemMessage; + import com.ankamagames.berilia.enums.SelectMethodEnum; + import com.ankamagames.jerakine.handlers.messages.mouse.MouseDoubleClickMessage; + import com.ankamagames.jerakine.handlers.messages.mouse.MouseClickMessage; + import com.ankamagames.jerakine.handlers.messages.mouse.MouseUpMessage; + + public class ComboBoxGrid extends Grid + { + + public function ComboBoxGrid() + { + super(); + } + + private var _lastMouseUpFrameId:int = -1; + + override public function process(param1:Message) : Boolean + { + var _loc2_:MouseMessage = null; + var _loc3_:GridItem = null; + switch(true) + { + case param1 is MouseDoubleClickMessage: + case param1 is MouseClickMessage: + if(this._lastMouseUpFrameId == FrameIdManager.frameId) + { + return false; + } + case param1 is MouseUpMessage: + this._lastMouseUpFrameId = FrameIdManager.frameId; + _loc2_ = MouseMessage(param1); + _loc3_ = super.getGridItem(_loc2_.target); + if(_loc3_) + { + if(!_loc3_.data) + { + if(UIEventManager.getInstance().isRegisteredInstance(this,SelectEmptyItemMessage)) + { + super.dispatchMessage(new SelectEmptyItemMessage(this,SelectMethodEnum.CLICK)); + } + setSelectedIndex(-1,SelectMethodEnum.CLICK); + } + setSelectedIndex(_loc3_.index,SelectMethodEnum.CLICK); + } + return true; + default: + super.process(param1); + return false; + } + } + } +} diff --git a/com/ankamagames/berilia/components/ComponentInternalAccessor.as b/com/ankamagames/berilia/components/ComponentInternalAccessor.as index 2248d4f76..abd74fdc5 100644 --- a/com/ankamagames/berilia/components/ComponentInternalAccessor.as +++ b/com/ankamagames/berilia/components/ComponentInternalAccessor.as @@ -1,15 +1,16 @@ -package com.ankamagames.berilia.components +package com.ankamagames.berilia.components { - public class ComponentInternalAccessor - { - - - public static function access(target:*, to:String) - { - return (target[to]); - } - - - } -}//package com.ankamagames.berilia.components - + public class ComponentInternalAccessor extends Object + { + + public function ComponentInternalAccessor() + { + super(); + } + + public static function access(param1:*, param2:String) : * + { + return param1[param2]; + } + } +} diff --git a/com/ankamagames/berilia/components/EntityDisplayer.as b/com/ankamagames/berilia/components/EntityDisplayer.as index 34504e364..355c17fae 100644 --- a/com/ankamagames/berilia/components/EntityDisplayer.as +++ b/com/ankamagames/berilia/components/EntityDisplayer.as @@ -1,735 +1,748 @@ -package com.ankamagames.berilia.components +package com.ankamagames.berilia.components { - import com.ankamagames.berilia.types.graphic.GraphicContainer; - import com.ankamagames.berilia.UIComponent; - import com.ankamagames.jerakine.interfaces.IRectangle; - import flash.utils.Dictionary; - import com.ankamagames.tiphon.display.TiphonSprite; - import flash.display.Shape; - import com.ankamagames.tiphon.types.look.TiphonEntityLook; - import com.ankamagames.jerakine.sequencer.SerialSequencer; - import com.ankamagames.tiphon.types.ISubEntityBehavior; - import com.ankamagames.tiphon.types.IAnimationModifier; - import com.ankamagames.tiphon.types.ISkinModifier; - import com.ankamagames.tiphon.types.TiphonUtility; - import com.ankamagames.jerakine.utils.display.EnterFrameDispatcher; - import flash.events.MouseEvent; - import flash.geom.Rectangle; - import com.ankamagames.tiphon.types.DisplayInfoSprite; - import com.ankamagames.tiphon.sequence.SetDirectionStep; - import com.ankamagames.tiphon.sequence.PlayAnimationStep; - import com.ankamagames.tiphon.sequence.SetAnimationStep; - import flash.geom.Point; - import flash.display.DisplayObject; - import flash.events.EventDispatcher; - import com.ankamagames.tiphon.events.TiphonEvent; - import com.ankamagames.berilia.Berilia; - import com.ankamagames.berilia.components.messages.EntityReadyMessage; - import flash.display.InteractiveObject; - import flash.events.Event; - import com.ankamagames.berilia.managers.SecureCenter; - import flash.geom.ColorTransform; - - public class EntityDisplayer extends GraphicContainer implements UIComponent, IRectangle - { - - public static var MEMORY_LOG:Dictionary = new Dictionary(true); - public static var lookAdaptater:Function; - private static const _subEntitiesBehaviors:Dictionary = new Dictionary(); - private static const _animationModifier:Dictionary = new Dictionary(); - private static const _skinModifier:Dictionary = new Dictionary(); - - private var _entity:TiphonSprite; - private var _oldEntity:TiphonSprite; - private var _direction:uint = 1; - private var _animation:String = "AnimStatique"; - private var _view:String; - private var _mask:Shape; - private var _mask2:Shape; - private var _lookUpdate:TiphonEntityLook; - private var _listenForUpdate:Boolean = false; - private var _waitingForEquipement:Array; - private var _useCache:Boolean = false; - private var _fromCache:Boolean = false; - private var _cache:Object; - private var _gotoAndStop:int = 0; - private var _autoSize:Boolean = false; - private var _sequencer:SerialSequencer; - public var yOffset:int = 0; - public var xOffset:int = 0; - public var entityScale:Number = 1; - public var useFade:Boolean = true; - public var clearSubEntities:Boolean = true; - public var clearAuras:Boolean = true; - public var withoutMount:Boolean = false; - - public function EntityDisplayer() - { - mouseChildren = false; - MEMORY_LOG[this] = 1; - } - - public static function setSubEntityDefaultBehavior(category:uint, behavior:ISubEntityBehavior):void - { - _subEntitiesBehaviors[category] = behavior; - } - - public static function setAnimationModifier(boneId:uint, am:IAnimationModifier):void - { - _animationModifier[boneId] = am; - } - - public static function setSkinModifier(boneId:uint, sm:ISkinModifier):void - { - _skinModifier[boneId] = sm; - } - - - public function set look(rawLook:*):void - { - var look:TiphonEntityLook; - var entity:TiphonSprite; - if (lookAdaptater != null) - { - look = lookAdaptater(rawLook); + import com.ankamagames.berilia.types.graphic.GraphicContainer; + import com.ankamagames.berilia.UIComponent; + import com.ankamagames.jerakine.interfaces.IRectangle; + import flash.utils.Dictionary; + import com.ankamagames.tiphon.types.ISubEntityBehavior; + import com.ankamagames.tiphon.types.IAnimationModifier; + import com.ankamagames.tiphon.types.ISkinModifier; + import com.ankamagames.tiphon.display.TiphonSprite; + import flash.display.Shape; + import com.ankamagames.tiphon.types.look.TiphonEntityLook; + import com.ankamagames.jerakine.sequencer.SerialSequencer; + import com.ankamagames.tiphon.types.TiphonUtility; + import com.ankamagames.jerakine.utils.display.EnterFrameDispatcher; + import flash.events.MouseEvent; + import flash.geom.Rectangle; + import com.ankamagames.tiphon.types.DisplayInfoSprite; + import com.ankamagames.tiphon.sequence.SetDirectionStep; + import com.ankamagames.tiphon.sequence.PlayAnimationStep; + import com.ankamagames.tiphon.sequence.SetAnimationStep; + import flash.geom.Point; + import flash.display.DisplayObject; + import flash.events.EventDispatcher; + import com.ankamagames.tiphon.events.TiphonEvent; + import flash.events.Event; + import com.ankamagames.berilia.Berilia; + import com.ankamagames.berilia.components.messages.EntityReadyMessage; + import flash.display.InteractiveObject; + import com.ankamagames.berilia.managers.SecureCenter; + import flash.geom.ColorTransform; + + public class EntityDisplayer extends GraphicContainer implements UIComponent, IRectangle + { + + public function EntityDisplayer() + { + super(); + mouseChildren = false; + MEMORY_LOG[this] = 1; + } + + public static var MEMORY_LOG:Dictionary = new Dictionary(true); + + public static var lookAdaptater:Function; + + private static const _subEntitiesBehaviors:Dictionary = new Dictionary(); + + private static const _animationModifier:Dictionary = new Dictionary(); + + private static const _skinModifier:Dictionary = new Dictionary(); + + public static function setSubEntityDefaultBehavior(param1:uint, param2:ISubEntityBehavior) : void + { + _subEntitiesBehaviors[param1] = param2; + } + + public static function setAnimationModifier(param1:uint, param2:IAnimationModifier) : void + { + _animationModifier[param1] = param2; + } + + public static function setSkinModifier(param1:uint, param2:ISkinModifier) : void + { + _skinModifier[param1] = param2; + } + + private var _entity:TiphonSprite; + + private var _oldEntity:TiphonSprite; + + private var _direction:uint = 1; + + private var _animation:String = "AnimStatique"; + + private var _view:String; + + private var _mask:Shape; + + private var _mask2:Shape; + + private var _lookUpdate:TiphonEntityLook; + + private var _listenForUpdate:Boolean = false; + + private var _waitingForEquipement:Array; + + private var _useCache:Boolean = false; + + private var _fromCache:Boolean = false; + + private var _cache:Object; + + private var _gotoAndStop:int = 0; + + private var _autoSize:Boolean = false; + + private var _sequencer:SerialSequencer; + + public var yOffset:int = 0; + + public var xOffset:int = 0; + + public var entityScale:Number = 1; + + public var useFade:Boolean = true; + + public var clearSubEntities:Boolean = true; + + public var clearAuras:Boolean = true; + + public var withoutMount:Boolean = false; + + public function set look(param1:*) : void + { + var _loc2_:TiphonEntityLook = null; + var _loc3_:TiphonSprite = null; + if(lookAdaptater != null) + { + _loc2_ = lookAdaptater(param1); + } + else if(param1 is TiphonEntityLook) + { + _loc2_ = param1 as TiphonEntityLook; + } + else + { + throw new ArgumentError(); + } + + if(this._entity) + { + this._entity.stopAnimation(); + if((this._sequencer) && (this._sequencer.running)) + { + this._sequencer.clear(); } - else - { - if ((rawLook is TiphonEntityLook)) - { - look = (rawLook as TiphonEntityLook); - } - else - { - throw (new ArgumentError()); - }; - }; - if (this._entity) - { - this._entity.stopAnimation(); - if (((this._sequencer) && (this._sequencer.running))) - { - this._sequencer.clear(); - }; - this._entity.visible = !((look == null)); - }; - if (this.withoutMount) - { - look = TiphonUtility.getLookWithoutMount(look); - }; - if (look != null) - { - if (this.clearSubEntities) - { - look.resetSubEntities(); - } - else - { - if (this.clearAuras) - { - look.removeSubEntity(6); - }; - }; - }; - if (((look) && (this._lookUpdate))) - { - if (look.toString() == this._lookUpdate.toString()) - { - if (((this._entity) && (!(this._entity.parent)))) - { - addChild(this._entity); - }; - return; - }; - }; - this._lookUpdate = ((look) ? look.clone() : look); - if (this._useCache) - { - entity = this._cache[look.toString()]; - if (entity) - { - if (this._entity) - { - this.destroyEntity(this._entity); - }; - addChild(entity); - this._entity = entity; - this._fromCache = true; - return; - }; - }; - this._fromCache = false; - this._listenForUpdate = true; - EnterFrameDispatcher.addEventListener(this.needUpdate, "EntityDisplayerUpdater"); - } - - public function get look():TiphonEntityLook - { - return (((this._entity) ? this._entity.look : this._lookUpdate)); - } - - public function set direction(n:uint):void - { - this._direction = n; - if (((!(this._listenForUpdate)) && ((this._entity is TiphonSprite)))) - { - TiphonSprite(this._entity).setDirection(n); - }; - } - - public function get direction():uint - { - return (this._direction); - } - - public function set animation(anim:String):void - { - this._animation = anim; - if ((this._entity is TiphonSprite)) - { - TiphonSprite(this._entity).setAnimation(anim); - }; - } - - public function get animation():String - { - return (this._animation); - } - - public function set gotoAndStop(value:int):void - { - if (this._entity) - { - if (value == -1) - { - this._entity.stopAnimationAtEnd(); - } - else - { - this._entity.stopAnimation(value); - }; + this._entity.visible = !(_loc2_ == null); + } + if(this.withoutMount) + { + _loc2_ = TiphonUtility.getLookWithoutMount(_loc2_); + } + if(_loc2_ != null) + { + if(this.clearSubEntities) + { + _loc2_.resetSubEntities(); } - else - { - this._gotoAndStop = value; - }; - } - - public function get autoSize():Boolean - { - return (this._autoSize); - } - - override public function set width(nW:Number):void - { - super.width = nW; - this._autoSize = ((!((nW == 0))) && (!((height == 0)))); - } - - override public function set height(nH:Number):void - { - super.height = nH; - this._autoSize = ((!((nH == 0))) && (!((width == 0)))); - } - - public function set view(value:String):void - { - this._view = value; - if ((this._entity is TiphonSprite)) - { - this._entity.setView(value); - }; - } - - override public function set handCursor(value:Boolean):void - { - super.handCursor = value; - if (value) + else if(this.clearAuras) { - addEventListener(MouseEvent.MOUSE_OVER, this.mouseOver); - addEventListener(MouseEvent.MOUSE_OUT, this.mouseOut); + _loc2_.removeSubEntity(6); } - else - { - removeEventListener(MouseEvent.MOUSE_OVER, this.mouseOver); - removeEventListener(MouseEvent.MOUSE_OUT, this.mouseOut); - }; - } - - public function get useCache():Boolean - { - return (this._useCache); - } - - public function set useCache(value:Boolean):void - { - this._useCache = value; - if (!(this._cache)) - { - this._cache = new Object(); - }; - } - - override public function get cacheAsBitmap():Boolean - { - return (super.cacheAsBitmap); - } - - override public function set cacheAsBitmap(value:Boolean):void - { - _log.fatal("Attention : Il ne faut surtout pas utiliser la propriété cacheAsBitmap sur les EntityDisplayer. TiphonSprite le gère déjà."); - } - - public function update():void - { - this.needUpdate(); - } - - public function updateMask():void - { - if ((((((this.entityScale > 1)) || (!((this.yOffset == 0))))) || (!((this.xOffset == 0))))) - { - if (this._mask) - { - this._mask.graphics.clear(); - } - else - { - this._mask = new Shape(); - }; - this._mask.graphics.beginFill(0); - this._mask.graphics.drawRect(0, 0, width, height); - addChild(this._mask); - TiphonSprite(this._entity).mask = this._mask; - if (this._oldEntity) - { - if (this._mask2) - { - this._mask2.graphics.clear(); - } - else - { - this._mask2 = new Shape(); - }; - this._mask2.graphics.beginFill(0); - this._mask2.graphics.drawRect(0, 0, width, height); - addChild(this._mask2); - TiphonSprite(this._oldEntity).mask = this._mask2; - }; + + } + if((_loc2_) && (this._lookUpdate)) + { + if(_loc2_.toString() == this._lookUpdate.toString()) + { + if((this._entity) && !this._entity.parent) + { + addChild(this._entity); + } + return; + } + } + this._lookUpdate = _loc2_?_loc2_.clone():_loc2_; + if(this._useCache) + { + _loc3_ = this._cache[_loc2_.toString()]; + if(_loc3_) + { + if(this._entity) + { + this.destroyEntity(this._entity); + } + addChild(_loc3_); + this._entity = _loc3_; + this._fromCache = true; + return; + } + } + this._fromCache = false; + this._listenForUpdate = true; + EnterFrameDispatcher.addEventListener(this.needUpdate,"EntityDisplayerUpdater"); + } + + public function get look() : TiphonEntityLook + { + return this._entity?this._entity.look:this._lookUpdate; + } + + public function set direction(param1:uint) : void + { + this._direction = param1; + if(!this._listenForUpdate && this._entity is TiphonSprite) + { + TiphonSprite(this._entity).setDirection(param1); + } + } + + public function get direction() : uint + { + return this._direction; + } + + public function set animation(param1:String) : void + { + this._animation = param1; + if(this._entity is TiphonSprite) + { + TiphonSprite(this._entity).setAnimation(param1); + } + } + + public function get animation() : String + { + return this._animation; + } + + public function set gotoAndStop(param1:int) : void + { + if(this._entity) + { + if(param1 == -1) + { + this._entity.stopAnimationAtEnd(); } else { - if (((((this._mask) && (this._mask.parent))) && ((this._mask.parent == this)))) - { - removeChild(this._mask); - }; - TiphonSprite(this._entity).mask = null; - this._mask = null; - }; - } - - public function updateScaleAndOffsets():void - { - var entRatio:Number; - var b:Rectangle; - var dis:DisplayInfoSprite; - var r:Number; - var m:Number; - this._entity.x = 0; - this._entity.y = 0; - if (this._view != null) - { - dis = TiphonSprite(this._entity).getDisplayInfoSprite(this._view); - if (dis != null) - { - TiphonSprite(this._entity).look.setScales(1, 1); - TiphonSprite(this._entity).setView(this._view); - entRatio = (this._entity.width / this._entity.height); - if (this._entity.width > this._entity.height) - { - this._entity.height = ((width / entRatio) * this.entityScale); - this._entity.width = (width * this.entityScale); - } - else - { - this._entity.width = ((height * entRatio) * this.entityScale); - this._entity.height = (height * this.entityScale); - }; - b = TiphonSprite(this._entity).getBounds(this); - this._entity.x = ((((width - this._entity.width) / 2) - b.left) + this.xOffset); - this._entity.y = ((((height - this._entity.height) / 2) - b.top) + this.yOffset); - r = (dis.width / dis.height); - m = ((((width / height) < (dis.width / dis.height))) ? (width / dis.getRect(this).width) : (height / dis.getRect(this).height)); - this._entity.height = (this._entity.height * m); - this._entity.width = (this._entity.width * m); - this._entity.x = (this._entity.x - dis.getRect(this).x); - this._entity.y = (this._entity.y - dis.getRect(this).y); - }; + this._entity.stopAnimation(param1); + } + } + else + { + this._gotoAndStop = param1; + } + } + + public function get autoSize() : Boolean + { + return this._autoSize; + } + + override public function set width(param1:Number) : void + { + super.width = param1; + this._autoSize = !(param1 == 0) && !(height == 0); + } + + override public function set height(param1:Number) : void + { + super.height = param1; + this._autoSize = !(param1 == 0) && !(width == 0); + } + + public function set view(param1:String) : void + { + this._view = param1; + if(this._entity is TiphonSprite) + { + this._entity.setView(param1); + } + } + + override public function set handCursor(param1:Boolean) : void + { + super.handCursor = param1; + if(param1) + { + addEventListener(MouseEvent.MOUSE_OVER,this.mouseOver); + addEventListener(MouseEvent.MOUSE_OUT,this.mouseOut); + } + else + { + removeEventListener(MouseEvent.MOUSE_OVER,this.mouseOver); + removeEventListener(MouseEvent.MOUSE_OUT,this.mouseOut); + } + } + + public function get useCache() : Boolean + { + return this._useCache; + } + + public function set useCache(param1:Boolean) : void + { + this._useCache = param1; + if(!this._cache) + { + this._cache = new Object(); + } + } + + override public function get cacheAsBitmap() : Boolean + { + return super.cacheAsBitmap; + } + + override public function set cacheAsBitmap(param1:Boolean) : void + { + _log.fatal("Attention : Il ne faut surtout pas utiliser la propriété cacheAsBitmap sur les EntityDisplayer. TiphonSprite le gère déjà."); + } + + public function update() : void + { + this.needUpdate(); + } + + public function updateMask() : void + { + if(this.entityScale > 1 || !(this.yOffset == 0) || !(this.xOffset == 0)) + { + if(this._mask) + { + this._mask.graphics.clear(); } else { - entRatio = (this._entity.width / this._entity.height); - if (this._entity.width > this._entity.height) - { - this._entity.height = ((width / entRatio) * this.entityScale); - this._entity.width = (width * this.entityScale); - } - else - { - this._entity.width = ((height * entRatio) * this.entityScale); - this._entity.height = (height * this.entityScale); - }; - b = TiphonSprite(this._entity).getBounds(this); - this._entity.x = ((((width - this._entity.width) / 2) - b.left) + this.xOffset); - this._entity.y = ((((height - this._entity.height) / 2) - b.top) + this.yOffset); - }; - } - - public function setAnimationAndDirection(anim:String, dir:uint):void - { - if (!(this._fromCache)) - { - this._animation = anim; - this._direction = dir; - if ((((this._entity is TiphonSprite)) && (!(this._listenForUpdate)))) - { - if ((((this._animation == "AnimStatique")) || ((this._animation == "AnimArtwork")))) - { - TiphonSprite(this._entity).setAnimationAndDirection(this._animation, this._direction); - } - else - { - if (!(this._sequencer)) - { - this._sequencer = new SerialSequencer(); - } - else - { - if (this._sequencer.running) - { - this._sequencer.clear(); - }; - }; - this._sequencer.addStep(new SetDirectionStep(TiphonSprite(this._entity), this._direction)); - this._sequencer.addStep(new PlayAnimationStep(TiphonSprite(this._entity), this._animation, false)); - this._sequencer.addStep(new SetAnimationStep(TiphonSprite(this._entity), "AnimStatique")); - this._sequencer.start(); - }; - }; - }; - } - - public function equipCharacter(list:Array, numDelete:int=0):void - { - var base:Array; - var tel:TiphonEntityLook; - var bones:Array; - var k:int; - if ((this._entity is TiphonSprite)) + this._mask = new Shape(); + } + this._mask.graphics.beginFill(0); + this._mask.graphics.drawRect(0,0,width,height); + addChild(this._mask); + TiphonSprite(this._entity).mask = this._mask; + if(this._oldEntity) + { + if(this._mask2) + { + this._mask2.graphics.clear(); + } + else + { + this._mask2 = new Shape(); + } + this._mask2.graphics.beginFill(0); + this._mask2.graphics.drawRect(0,0,width,height); + addChild(this._mask2); + TiphonSprite(this._oldEntity).mask = this._mask2; + } + } + else + { + if((this._mask) && (this._mask.parent) && this._mask.parent == this) { - base = TiphonSprite(this._entity).look.toString().split("|"); - if (list.length) - { - list.unshift(base[1].split(",")); - base[1] = list.join(","); - } - else - { - if (numDelete < base[1].length) - { - bones = base[1].split(","); - k = 0; - while (k < numDelete) - { - bones.pop(); - k++; - }; - base[1] = bones.join(","); - }; - }; - tel = TiphonEntityLook.fromString(base.join("|")); - this._entity.look.updateFrom(tel); + removeChild(this._mask); + } + TiphonSprite(this._entity).mask = null; + this._mask = null; + } + } + + public function updateScaleAndOffsets() : void + { + var _loc1_:* = NaN; + var _loc2_:Rectangle = null; + var _loc3_:DisplayInfoSprite = null; + var _loc4_:* = NaN; + var _loc5_:* = NaN; + this._entity.x = 0; + this._entity.y = 0; + if(this._view != null) + { + _loc3_ = TiphonSprite(this._entity).getDisplayInfoSprite(this._view); + if(_loc3_ != null) + { + TiphonSprite(this._entity).look.setScales(1,1); + TiphonSprite(this._entity).setView(this._view); + _loc1_ = this._entity.width / this._entity.height; + if(this._entity.width > this._entity.height) + { + this._entity.height = width / _loc1_ * this.entityScale; + this._entity.width = width * this.entityScale; + } + else + { + this._entity.width = height * _loc1_ * this.entityScale; + this._entity.height = height * this.entityScale; + } + _loc2_ = TiphonSprite(this._entity).getBounds(this); + this._entity.x = (width - this._entity.width) / 2 - _loc2_.left + this.xOffset; + this._entity.y = (height - this._entity.height) / 2 - _loc2_.top + this.yOffset; + _loc4_ = _loc3_.width / _loc3_.height; + _loc5_ = width / height < _loc3_.width / _loc3_.height?width / _loc3_.getRect(this).width:height / _loc3_.getRect(this).height; + this._entity.height = this._entity.height * _loc5_; + this._entity.width = this._entity.width * _loc5_; + this._entity.x = this._entity.x - _loc3_.getRect(this).x; + this._entity.y = this._entity.y - _loc3_.getRect(this).y; + } + } + else + { + _loc1_ = this._entity.width / this._entity.height; + if(this._entity.width > this._entity.height) + { + this._entity.height = width / _loc1_ * this.entityScale; + this._entity.width = width * this.entityScale; } else { - if (((!(this._entity)) && (list.length))) - { - this._waitingForEquipement = list; - }; - }; - } - - public function getSlotPosition(name:String):Point - { - var s:Object; - var p:Point; - var point:Point; - if (((this._entity) && ((this._entity is TiphonSprite)))) - { - s = TiphonSprite(this._entity).getSlot(name); - if (s) - { - p = s.localToGlobal(new Point(s.x, s.y)); - point = this.globalToLocal(p); - return (point); - }; - _log.error("Null entity, cannot get slot position."); - return (null); - }; + this._entity.width = height * _loc1_ * this.entityScale; + this._entity.height = height * this.entityScale; + } + _loc2_ = TiphonSprite(this._entity).getBounds(this); + this._entity.x = (width - this._entity.width) / 2 - _loc2_.left + this.xOffset; + this._entity.y = (height - this._entity.height) / 2 - _loc2_.top + this.yOffset; + } + } + + public function setAnimationAndDirection(param1:String, param2:uint) : void + { + if(!this._fromCache) + { + this._animation = param1; + this._direction = param2; + if(this._entity is TiphonSprite && !this._listenForUpdate) + { + if(this._animation == "AnimStatique" || this._animation == "AnimArtwork") + { + TiphonSprite(this._entity).setAnimationAndDirection(this._animation,this._direction); + } + else + { + if(!this._sequencer) + { + this._sequencer = new SerialSequencer(); + } + else if(this._sequencer.running) + { + this._sequencer.clear(); + } + + this._sequencer.addStep(new SetDirectionStep(TiphonSprite(this._entity),this._direction)); + this._sequencer.addStep(new PlayAnimationStep(TiphonSprite(this._entity),this._animation,false)); + this._sequencer.addStep(new SetAnimationStep(TiphonSprite(this._entity),"AnimStatique")); + this._sequencer.start(); + } + } + } + } + + public function equipCharacter(param1:Array, param2:int = 0) : void + { + var _loc3_:Array = null; + var _loc4_:TiphonEntityLook = null; + var _loc5_:Array = null; + var _loc6_:* = 0; + if(this._entity is TiphonSprite) + { + _loc3_ = TiphonSprite(this._entity).look.toString().split("|"); + if(param1.length) + { + param1.unshift(_loc3_[1].split(",")); + _loc3_[1] = param1.join(","); + } + else if(param2 < _loc3_[1].length) + { + _loc5_ = _loc3_[1].split(","); + _loc6_ = 0; + while(_loc6_ < param2) + { + _loc5_.pop(); + _loc6_++; + } + _loc3_[1] = _loc5_.join(","); + } + + _loc4_ = TiphonEntityLook.fromString(_loc3_.join("|")); + this._entity.look.updateFrom(_loc4_); + } + else if(!this._entity && (param1.length)) + { + this._waitingForEquipement = param1; + } + + } + + public function getSlotPosition(param1:String) : Point + { + var _loc2_:Object = null; + var _loc3_:Point = null; + var _loc4_:Point = null; + if((this._entity) && this._entity is TiphonSprite) + { + _loc2_ = TiphonSprite(this._entity).getSlot(param1); + if(_loc2_) + { + _loc3_ = _loc2_.localToGlobal(new Point(_loc2_.x,_loc2_.y)); + _loc4_ = this.globalToLocal(_loc3_); + return _loc4_; + } _log.error("Null entity, cannot get slot position."); - return (null); - } - - public function getSlotBounds(pSlotName:String):Rectangle - { - var bounds:Rectangle; - var slot:DisplayObject; - var localPos:Point; - if (this._entity) - { - slot = this._entity.getSlot(pSlotName); - if (slot) - { - localPos = this.getSlotPosition(pSlotName); - bounds = new Rectangle(localPos.x, localPos.y, slot.width, slot.height); - }; - }; - return (bounds); - } - - public function getEntityBounds():Rectangle - { - return (((this._entity) ? this._entity.getBounds(this) : null)); - } - - override public function remove():void - { - var behavior:ISubEntityBehavior; - var ts:TiphonSprite; - if (this._entity) - { - (this._entity as EventDispatcher).removeEventListener(TiphonEvent.RENDER_SUCCEED, this.onCharacterReady); - this._entity.destroy(); - this._entity = null; - }; - if (this._oldEntity) - { - (this._oldEntity as EventDispatcher).removeEventListener(TiphonEvent.RENDER_SUCCEED, this.onCharacterReady); - this._oldEntity.destroy(); - this._oldEntity = null; - }; - if (this._cache) - { - for each (ts in this._cache) - { - ts.destroy(); - }; - this._cache = null; - }; - if (this._sequencer) - { - this._sequencer.clear(); - this._sequencer = null; - }; - this._lookUpdate = null; - this._waitingForEquipement = null; - EnterFrameDispatcher.removeEventListener(this.onFade); - removeEventListener(MouseEvent.MOUSE_OVER, this.mouseOver); - removeEventListener(MouseEvent.MOUSE_OUT, this.mouseOut); - for each (behavior in _subEntitiesBehaviors) - { - if (behavior) - { - behavior.remove(); - }; - }; - super.remove(); - } - - public function setColor(index:uint, color:uint):void - { - if (((TiphonSprite(this._entity)) && (TiphonSprite(this._entity).look))) - { - TiphonSprite(this._entity).look.setColor(index, color); - }; - } - - public function resetColor(index:uint):void - { - if (((TiphonSprite(this._entity)) && (TiphonSprite(this._entity).look))) - { - TiphonSprite(this._entity).look.resetColor(index); - }; - } - - public function destroyCurrentEntity():void - { - if (((this._entity) && (this._entity.parent))) - { - removeChild(this._entity); - }; - } - - private function onCharacterReady(e:Event):void - { - var cat:*; - (this._entity as EventDispatcher).removeEventListener(TiphonEvent.RENDER_SUCCEED, this.onCharacterReady); - if (this._entity.rawAnimation) - { - this._entity.rawAnimation.gotoAndPlay(0); - }; - if (this._gotoAndStop) - { - if (this._gotoAndStop == -1) - { - this._entity.stopAnimationAtEnd(); - } - else - { - this._entity.stopAnimation(this._gotoAndStop); - }; - this._gotoAndStop = 0; - }; - if (_animationModifier[this._entity.look.getBone()]) - { - this._entity.addAnimationModifier(_animationModifier[this._entity.look.getBone()]); - }; - if (_skinModifier[this._entity.look.getBone()]) - { - this._entity.skinModifier = _skinModifier[this._entity.look.getBone()]; - }; - for (cat in _subEntitiesBehaviors) - { - if (_subEntitiesBehaviors[cat]) - { - (this._entity as TiphonSprite).setSubEntityBehaviour(cat, _subEntitiesBehaviors[cat]); - }; - }; - this._entity.visible = true; - this.updateMask(); - if (this._oldEntity) - { - if (this.useFade) - { - this._oldEntity.alpha = 1; - this._entity.alpha = 0; - EnterFrameDispatcher.addEventListener(this.onFade, "entityDisplayerFade"); - } - else - { - this.destroyEntity(this._oldEntity); - this._oldEntity = null; - }; - }; - if (((!(this._entity.height)) || (!(this._autoSize)))) - { - Berilia.getInstance().handler.process(new EntityReadyMessage(InteractiveObject(this))); - return; - }; - this.updateScaleAndOffsets(); - this._entity.visible = true; - if (Berilia.getInstance().handler) - { - Berilia.getInstance().handler.process(new EntityReadyMessage(InteractiveObject(this))); - }; - } - - private function destroyEntity(entity:TiphonSprite):void - { - if (entity.parent) - { - removeChild(entity); - }; - if (!(this._useCache)) - { - entity.destroy(); - }; - } - - private function needUpdate(e:Event=null):void - { - var cat:*; - var key:String; - EnterFrameDispatcher.removeEventListener(this.needUpdate); - this._listenForUpdate = false; - if (this._oldEntity) - { - this.destroyEntity(this._oldEntity); - this._oldEntity = null; - }; - if (!(this._lookUpdate)) - { - if (this._entity) - { - this.destroyEntity(this._entity); - this._entity = null; - }; - return; - }; - this._oldEntity = this._entity; - this._entity = new TiphonSprite(SecureCenter.unsecure(this._lookUpdate.clone())); - this._entity.visible = false; - if (_animationModifier[this._entity.look.getBone()]) - { - this._entity.addAnimationModifier(_animationModifier[this._entity.look.getBone()]); - }; - if (_skinModifier[this._entity.look.getBone()]) - { - this._entity.skinModifier = _skinModifier[this._entity.look.getBone()]; - }; - if (this._useCache) - { - key = this._entity.look.toString(); - this._cache[key] = this._entity; - }; - for (cat in _subEntitiesBehaviors) - { - if (_subEntitiesBehaviors[cat]) - { - (this._entity as TiphonSprite).setSubEntityBehaviour(cat, _subEntitiesBehaviors[cat]); - }; - }; - (this._entity as EventDispatcher).addEventListener(TiphonEvent.RENDER_SUCCEED, this.onCharacterReady); - addChild(this._entity); - this.setAnimationAndDirection(this._animation, this._direction); - if (((this._waitingForEquipement) && (this._waitingForEquipement.length))) - { - this.equipCharacter(this._waitingForEquipement, 0); - }; - } - - private function onFade(e:Event):void - { - if (this._entity) + return null; + } + _log.error("Null entity, cannot get slot position."); + return null; + } + + public function getSlotBounds(param1:String) : Rectangle + { + var _loc2_:Rectangle = null; + var _loc3_:DisplayObject = null; + var _loc4_:Point = null; + if(this._entity) + { + _loc3_ = this._entity.getSlot(param1); + if(_loc3_) + { + _loc4_ = this.getSlotPosition(param1); + _loc2_ = new Rectangle(_loc4_.x,_loc4_.y,_loc3_.width,_loc3_.height); + } + } + return _loc2_; + } + + public function getEntityBounds() : Rectangle + { + return this._entity?this._entity.getBounds(this):null; + } + + override public function remove() : void + { + var _loc1_:ISubEntityBehavior = null; + var _loc2_:TiphonSprite = null; + if(this._entity) + { + (this._entity as EventDispatcher).removeEventListener(TiphonEvent.RENDER_SUCCEED,this.onCharacterReady); + this._entity.destroy(); + this._entity = null; + } + if(this._oldEntity) + { + (this._oldEntity as EventDispatcher).removeEventListener(TiphonEvent.RENDER_SUCCEED,this.onCharacterReady); + this._oldEntity.destroy(); + this._oldEntity = null; + } + if(this._cache) + { + for each(_loc2_ in this._cache) + { + _loc2_.destroy(); + } + this._cache = null; + } + if(this._sequencer) + { + this._sequencer.clear(); + this._sequencer = null; + } + this._lookUpdate = null; + this._waitingForEquipement = null; + EnterFrameDispatcher.removeEventListener(this.onFade); + removeEventListener(MouseEvent.MOUSE_OVER,this.mouseOver); + removeEventListener(MouseEvent.MOUSE_OUT,this.mouseOut); + for each(_loc1_ in _subEntitiesBehaviors) + { + if(_loc1_) + { + _loc1_.remove(); + } + } + super.remove(); + } + + public function setColor(param1:uint, param2:uint) : void + { + if((TiphonSprite(this._entity)) && (TiphonSprite(this._entity).look)) + { + TiphonSprite(this._entity).look.setColor(param1,param2); + } + } + + public function resetColor(param1:uint) : void + { + if((TiphonSprite(this._entity)) && (TiphonSprite(this._entity).look)) + { + TiphonSprite(this._entity).look.resetColor(param1); + } + } + + public function destroyCurrentEntity() : void + { + if((this._entity) && (this._entity.parent)) + { + removeChild(this._entity); + } + } + + private function onCharacterReady(param1:Event) : void + { + var _loc2_:* = undefined; + (this._entity as EventDispatcher).removeEventListener(TiphonEvent.RENDER_SUCCEED,this.onCharacterReady); + if(this._entity.rawAnimation) + { + this._entity.rawAnimation.gotoAndPlay(0); + } + if(this._gotoAndStop) + { + if(this._gotoAndStop == -1) + { + this._entity.stopAnimationAtEnd(); + } + else { - this._entity.alpha = (this._entity.alpha + ((1 - this._entity.alpha) / 3)); - this._oldEntity.alpha = (this._oldEntity.alpha + ((0 - this._oldEntity.alpha) / 3)); - if (this._oldEntity.alpha < 0.05) - { - this._entity.alpha = 1; - this.destroyEntity(this._oldEntity); - this._oldEntity = null; - EnterFrameDispatcher.removeEventListener(this.onFade); - }; + this._entity.stopAnimation(this._gotoAndStop); + } + this._gotoAndStop = 0; + } + if(_animationModifier[this._entity.look.getBone()]) + { + this._entity.addAnimationModifier(_animationModifier[this._entity.look.getBone()]); + } + if(_skinModifier[this._entity.look.getBone()]) + { + this._entity.skinModifier = _skinModifier[this._entity.look.getBone()]; + } + for(_loc2_ in _subEntitiesBehaviors) + { + if(_subEntitiesBehaviors[_loc2_]) + { + (this._entity as TiphonSprite).setSubEntityBehaviour(_loc2_,_subEntitiesBehaviors[_loc2_]); + } + } + this._entity.visible = true; + this.updateMask(); + if(this._oldEntity) + { + if(this.useFade) + { + this._oldEntity.alpha = 1; + this._entity.alpha = 0; + EnterFrameDispatcher.addEventListener(this.onFade,"entityDisplayerFade"); } else { - EnterFrameDispatcher.removeEventListener(this.onFade); - _log.error("entity est null"); - }; - } - - private function mouseOver(e:MouseEvent):void - { - this._entity.transform.colorTransform = new ColorTransform(1.3, 1.3, 1.3, 1); - } - - private function mouseOut(e:MouseEvent):void - { - this._entity.transform.colorTransform = new ColorTransform(1, 1, 1, 1); - } - - - } -}//package com.ankamagames.berilia.components - + this.destroyEntity(this._oldEntity); + this._oldEntity = null; + } + } + if(!this._entity.height || !this._autoSize) + { + Berilia.getInstance().handler.process(new EntityReadyMessage(InteractiveObject(this))); + return; + } + this.updateScaleAndOffsets(); + this._entity.visible = true; + if(Berilia.getInstance().handler) + { + Berilia.getInstance().handler.process(new EntityReadyMessage(InteractiveObject(this))); + } + } + + private function destroyEntity(param1:TiphonSprite) : void + { + if(param1.parent) + { + removeChild(param1); + } + if(!this._useCache) + { + param1.destroy(); + } + } + + private function needUpdate(param1:Event = null) : void + { + var _loc2_:* = undefined; + var _loc3_:String = null; + EnterFrameDispatcher.removeEventListener(this.needUpdate); + this._listenForUpdate = false; + if(this._oldEntity) + { + this.destroyEntity(this._oldEntity); + this._oldEntity = null; + } + if(!this._lookUpdate) + { + if(this._entity) + { + this.destroyEntity(this._entity); + this._entity = null; + } + return; + } + this._oldEntity = this._entity; + this._entity = new TiphonSprite(SecureCenter.unsecure(this._lookUpdate.clone())); + this._entity.visible = false; + if(_animationModifier[this._entity.look.getBone()]) + { + this._entity.addAnimationModifier(_animationModifier[this._entity.look.getBone()]); + } + if(_skinModifier[this._entity.look.getBone()]) + { + this._entity.skinModifier = _skinModifier[this._entity.look.getBone()]; + } + if(this._useCache) + { + _loc3_ = this._entity.look.toString(); + this._cache[_loc3_] = this._entity; + } + for(_loc2_ in _subEntitiesBehaviors) + { + if(_subEntitiesBehaviors[_loc2_]) + { + (this._entity as TiphonSprite).setSubEntityBehaviour(_loc2_,_subEntitiesBehaviors[_loc2_]); + } + } + (this._entity as EventDispatcher).addEventListener(TiphonEvent.RENDER_SUCCEED,this.onCharacterReady); + addChild(this._entity); + this.setAnimationAndDirection(this._animation,this._direction); + if((this._waitingForEquipement) && (this._waitingForEquipement.length)) + { + this.equipCharacter(this._waitingForEquipement,0); + } + } + + private function onFade(param1:Event) : void + { + if(this._entity) + { + this._entity.alpha = this._entity.alpha + (1 - this._entity.alpha) / 3; + this._oldEntity.alpha = this._oldEntity.alpha + (0 - this._oldEntity.alpha) / 3; + if(this._oldEntity.alpha < 0.05) + { + this._entity.alpha = 1; + this.destroyEntity(this._oldEntity); + this._oldEntity = null; + EnterFrameDispatcher.removeEventListener(this.onFade); + } + } + else + { + EnterFrameDispatcher.removeEventListener(this.onFade); + _log.error("entity est null"); + } + } + + private function mouseOver(param1:MouseEvent) : void + { + this._entity.transform.colorTransform = new ColorTransform(1.3,1.3,1.3,1); + } + + private function mouseOut(param1:MouseEvent) : void + { + this._entity.transform.colorTransform = new ColorTransform(1,1,1,1); + } + } +} diff --git a/com/ankamagames/berilia/components/Grid.as b/com/ankamagames/berilia/components/Grid.as index 839495044..8af42aae0 100644 --- a/com/ankamagames/berilia/components/Grid.as +++ b/com/ankamagames/berilia/components/Grid.as @@ -1,1482 +1,1518 @@ -package com.ankamagames.berilia.components +package com.ankamagames.berilia.components { - import com.ankamagames.berilia.types.graphic.GraphicContainer; - import com.ankamagames.berilia.FinalizableUIComponent; - import com.ankamagames.berilia.components.gridRenderer.XmlUiGridRenderer; - import com.ankamagames.berilia.components.gridRenderer.LabelGridRenderer; - import com.ankamagames.berilia.components.gridRenderer.SlotGridRenderer; - import com.ankamagames.berilia.components.gridRenderer.EntityGridRenderer; - import com.ankamagames.berilia.components.gridRenderer.InlineXmlGridRenderer; - import com.ankamagames.berilia.components.gridRenderer.MultiGridRenderer; - import flash.utils.Dictionary; - import com.ankamagames.jerakine.logger.Logger; - import com.ankamagames.jerakine.logger.Log; - import flash.utils.getQualifiedClassName; - import com.ankamagames.berilia.interfaces.IGridRenderer; - import com.ankamagames.jerakine.utils.memory.WeakReference; - import com.ankamagames.jerakine.types.Uri; - import flash.display.Shape; - import com.ankamagames.berilia.enums.SelectMethodEnum; - import com.ankamagames.berilia.managers.SecureCenter; - import flash.errors.IllegalOperationError; - import flash.utils.getDefinitionByName; - import flash.events.Event; - import com.ankamagames.berilia.types.data.GridItem; - import flash.display.DisplayObject; - import com.ankamagames.berilia.components.messages.SelectItemMessage; - import flash.events.MouseEvent; - import com.ankamagames.jerakine.handlers.messages.mouse.MouseRightClickMessage; - import com.ankamagames.jerakine.handlers.messages.mouse.MouseOverMessage; - import com.ankamagames.jerakine.handlers.messages.mouse.MouseOutMessage; - import com.ankamagames.jerakine.handlers.messages.mouse.MouseMessage; - import com.ankamagames.jerakine.handlers.messages.mouse.MouseUpMessage; - import com.ankamagames.jerakine.handlers.messages.keyboard.KeyboardKeyDownMessage; - import com.ankamagames.berilia.managers.UIEventManager; - import com.ankamagames.berilia.components.messages.ItemRightClickMessage; - import com.ankamagames.berilia.components.messages.ItemRollOverMessage; - import com.ankamagames.berilia.components.messages.ItemRollOutMessage; - import com.ankamagames.jerakine.handlers.messages.mouse.MouseWheelMessage; - import com.ankamagames.jerakine.handlers.messages.mouse.MouseClickMessage; - import com.ankamagames.berilia.components.messages.SelectEmptyItemMessage; - import com.ankamagames.jerakine.utils.display.KeyPoll; - import flash.ui.Keyboard; - import com.ankamagames.jerakine.utils.system.AirScanner; - import com.ankamagames.jerakine.handlers.messages.mouse.MouseDoubleClickMessage; - import com.ankamagames.jerakine.messages.Message; - import com.ankamagames.berilia.Berilia; - import com.ankamagames.jerakine.messages.MessageHandler; - import __AS3__.vec.*; - - public class Grid extends GraphicContainer implements FinalizableUIComponent - { - - private static var _include_XmlUiGridRenderer:XmlUiGridRenderer = null; - private static var _include_LabelGridRenderer:LabelGridRenderer = null; - private static var _include_SlotGridRenderer:SlotGridRenderer = null; - private static var _include_EntityGridRenderer:EntityGridRenderer = null; - private static var _include_InlineXmlGridRenderer:InlineXmlGridRenderer = null; - private static var _include_MultiGridRenderer:MultiGridRenderer = null; - public static var MEMORY_LOG:Dictionary = new Dictionary(true); - protected static const _log:Logger = Log.getLogger(getQualifiedClassName(Grid)); - public static const AUTOSELECT_NONE:int = 0; - public static const AUTOSELECT_BY_INDEX:int = 1; - public static const AUTOSELECT_BY_ITEM:int = 2; - - protected var _dataProvider; - protected var _renderer:IGridRenderer; - protected var _items:Array; - protected var _scrollBarV:ScrollBar; - protected var _scrollBarH:ScrollBar; - protected var _horizontalScrollSpeed:Number = 1; - protected var _verticalScrollSpeed:Number = 1; - protected var _slotWidth:uint = 50; - protected var _slotHeight:uint = 50; - protected var _sRendererName:String; - protected var _sRendererArgs:String; - protected var _verticalScroll:Boolean = true; - protected var _pageXOffset:int = 0; - protected var _pageYOffset:int = 0; - protected var _nSelectedIndex:int = 0; - protected var _nSelectedItem:WeakReference; - protected var _sVScrollCss:Uri; - protected var _sHScrollCss:Uri; - protected var _scrollBarSize:uint = 16; - protected var _eventCatcher:Shape; - protected var _finalized:Boolean = false; - protected var _displayScrollbar:String = "auto"; - protected var _autoSelect:int = 1; - protected var _sortProperty:String; - protected var _autoPosition:Boolean = false; - protected var _slotByRow:uint; - protected var _slotByCol:uint; - protected var _totalSlotByRow:uint; - protected var _totalSlotByCol:uint; - protected var _avaibleSpaceX:uint; - protected var _avaibleSpaceY:uint; - protected var _hiddenRow:uint = 0; - protected var _hiddenCol:uint = 0; - protected var _mask:Shape; - public var keyboardIndexHandler:Function; - public var silent:Boolean; - - public function Grid():void - { - this._items = new Array(); - this._dataProvider = new Array(); - this._eventCatcher = new Shape(); - this._eventCatcher.alpha = 0; - this._eventCatcher.graphics.beginFill(0xFF0000); - this._eventCatcher.graphics.drawRect(0, 0, 1, 1); - addChild(this._eventCatcher); - mouseEnabled = true; - MEMORY_LOG[this] = 1; - } - - override public function set width(nW:Number):void - { - super.width = nW; - this._eventCatcher.width = nW; - } - - override public function set height(nH:Number):void - { - super.height = nH; - this._eventCatcher.height = nH; - if (this._scrollBarV) - { - this._scrollBarV.height = nH; - }; - } - - public function set rendererName(value:String):void - { - if (value.indexOf(".") == -1) - { - value = ("com.ankamagames.berilia.components.gridRenderer." + value); - }; - this._sRendererName = value; - } - - public function get rendererName():String - { - return (this._sRendererName); - } - - public function set rendererArgs(value:String):void - { - this._sRendererArgs = value; - if (this.finalized) - { - this.finalize(); - }; - } - - public function get rendererArgs():String - { - return (this._sRendererArgs); - } - - public function get renderer():IGridRenderer - { - return (this._renderer); - } - - public function set dataProvider(data:*):void - { - if (!(data)) - { - return; - }; - if (!(this.isIterable(data))) - { - throw (new ArgumentError("dataProvider must be either Array or Vector.")); - }; - this._dataProvider = data; + import com.ankamagames.berilia.types.graphic.GraphicContainer; + import com.ankamagames.berilia.FinalizableUIComponent; + import com.ankamagames.berilia.components.gridRenderer.XmlUiGridRenderer; + import com.ankamagames.berilia.components.gridRenderer.LabelGridRenderer; + import com.ankamagames.berilia.components.gridRenderer.SlotGridRenderer; + import com.ankamagames.berilia.components.gridRenderer.EntityGridRenderer; + import com.ankamagames.berilia.components.gridRenderer.InlineXmlGridRenderer; + import com.ankamagames.berilia.components.gridRenderer.MultiGridRenderer; + import flash.utils.Dictionary; + import com.ankamagames.jerakine.logger.Logger; + import com.ankamagames.jerakine.logger.Log; + import flash.utils.getQualifiedClassName; + import com.ankamagames.berilia.interfaces.IGridRenderer; + import com.ankamagames.jerakine.utils.memory.WeakReference; + import com.ankamagames.jerakine.types.Uri; + import flash.display.Shape; + import com.ankamagames.berilia.enums.SelectMethodEnum; + import com.ankamagames.berilia.managers.SecureCenter; + import flash.errors.IllegalOperationError; + import flash.utils.getDefinitionByName; + import flash.events.Event; + import com.ankamagames.berilia.types.data.GridItem; + import flash.display.DisplayObject; + import com.ankamagames.berilia.components.messages.SelectItemMessage; + import flash.events.MouseEvent; + import com.ankamagames.jerakine.messages.Message; + import com.ankamagames.jerakine.handlers.messages.mouse.MouseRightClickMessage; + import com.ankamagames.jerakine.handlers.messages.mouse.MouseOverMessage; + import com.ankamagames.jerakine.handlers.messages.mouse.MouseOutMessage; + import com.ankamagames.jerakine.handlers.messages.mouse.MouseMessage; + import com.ankamagames.jerakine.handlers.messages.mouse.MouseUpMessage; + import com.ankamagames.jerakine.handlers.messages.keyboard.KeyboardKeyDownMessage; + import com.ankamagames.berilia.managers.UIEventManager; + import com.ankamagames.berilia.components.messages.ItemRightClickMessage; + import com.ankamagames.berilia.components.messages.ItemRollOverMessage; + import com.ankamagames.berilia.components.messages.ItemRollOutMessage; + import com.ankamagames.jerakine.handlers.messages.mouse.MouseWheelMessage; + import com.ankamagames.jerakine.handlers.messages.mouse.MouseClickMessage; + import com.ankamagames.berilia.components.messages.SelectEmptyItemMessage; + import com.ankamagames.jerakine.utils.display.KeyPoll; + import flash.ui.Keyboard; + import com.ankamagames.jerakine.utils.system.AirScanner; + import com.ankamagames.jerakine.handlers.messages.mouse.MouseDoubleClickMessage; + import com.ankamagames.jerakine.messages.MessageHandler; + import com.ankamagames.berilia.Berilia; + + public class Grid extends GraphicContainer implements FinalizableUIComponent + { + + public function Grid() + { + super(); + this._items = new Array(); + this._dataProvider = new Array(); + this._eventCatcher = new Shape(); + this._eventCatcher.alpha = 0; + this._eventCatcher.graphics.beginFill(16711680); + this._eventCatcher.graphics.drawRect(0,0,1,1); + addChild(this._eventCatcher); + mouseEnabled = true; + MEMORY_LOG[this] = 1; + } + + private static var _include_XmlUiGridRenderer:XmlUiGridRenderer = null; + + private static var _include_LabelGridRenderer:LabelGridRenderer = null; + + private static var _include_SlotGridRenderer:SlotGridRenderer = null; + + private static var _include_EntityGridRenderer:EntityGridRenderer = null; + + private static var _include_InlineXmlGridRenderer:InlineXmlGridRenderer = null; + + private static var _include_MultiGridRenderer:MultiGridRenderer = null; + + public static var MEMORY_LOG:Dictionary = new Dictionary(true); + + protected static const _log:Logger = Log.getLogger(getQualifiedClassName(Grid)); + + public static const AUTOSELECT_NONE:int = 0; + + public static const AUTOSELECT_BY_INDEX:int = 1; + + public static const AUTOSELECT_BY_ITEM:int = 2; + + protected var _dataProvider; + + protected var _renderer:IGridRenderer; + + protected var _items:Array; + + protected var _scrollBarV:ScrollBar; + + protected var _scrollBarH:ScrollBar; + + protected var _horizontalScrollSpeed:Number = 1; + + protected var _verticalScrollSpeed:Number = 1; + + protected var _slotWidth:uint = 50; + + protected var _slotHeight:uint = 50; + + protected var _sRendererName:String; + + protected var _sRendererArgs:String; + + protected var _verticalScroll:Boolean = true; + + protected var _pageXOffset:int = 0; + + protected var _pageYOffset:int = 0; + + protected var _nSelectedIndex:int = 0; + + protected var _nSelectedItem:WeakReference; + + protected var _sVScrollCss:Uri; + + protected var _sHScrollCss:Uri; + + protected var _scrollBarSize:uint = 16; + + protected var _eventCatcher:Shape; + + protected var _finalized:Boolean = false; + + protected var _displayScrollbar:String = "auto"; + + protected var _autoSelect:int = 1; + + protected var _sortProperty:String; + + protected var _autoPosition:Boolean = false; + + protected var _slotByRow:uint; + + protected var _slotByCol:uint; + + protected var _totalSlotByRow:uint; + + protected var _totalSlotByCol:uint; + + protected var _avaibleSpaceX:uint; + + protected var _avaibleSpaceY:uint; + + protected var _hiddenRow:uint = 0; + + protected var _hiddenCol:uint = 0; + + protected var _mask:Shape; + + override public function set width(param1:Number) : void + { + super.width = param1; + this._eventCatcher.width = param1; + } + + override public function set height(param1:Number) : void + { + super.height = param1; + this._eventCatcher.height = param1; + if(this._scrollBarV) + { + this._scrollBarV.height = param1; + } + } + + public function set rendererName(param1:String) : void + { + if(param1.indexOf(".") == -1) + { + var param1:String = "com.ankamagames.berilia.components.gridRenderer." + param1; + } + this._sRendererName = param1; + } + + public function get rendererName() : String + { + return this._sRendererName; + } + + public function set rendererArgs(param1:String) : void + { + this._sRendererArgs = param1; + if(this.finalized) + { + this.finalize(); + } + } + + public function get rendererArgs() : String + { + return this._sRendererArgs; + } + + public function get renderer() : IGridRenderer + { + return this._renderer; + } + + public function set dataProvider(param1:*) : void + { + if(!param1) + { + return; + } + if(!this.isIterable(param1)) + { + throw new ArgumentError("dataProvider must be either Array or Vector."); + } + else + { + this._dataProvider = param1; this.finalize(); this.initSlot(); - } - - public function get dataProvider() - { - return (this._dataProvider); - } - - public function resetScrollBar():void - { - if (((this._scrollBarH) && (this._scrollBarH.visible))) - { - this._scrollBarH.value = this._pageXOffset; - }; - if (((this._scrollBarV) && (this._scrollBarV.visible))) - { - this._scrollBarV.value = this._pageYOffset; - }; - } - - public function set horizontalScrollbarCss(sValue:Uri):void - { - this._sHScrollCss = sValue; - } - - public function get horizontalScrollbarCss():Uri - { - return (this._sHScrollCss); - } - - public function set verticalScrollbarCss(sValue:Uri):void - { - this._sVScrollCss = sValue; - } - - public function get verticalScrollbarCss():Uri - { - return (this._sVScrollCss); - } - - public function get selectedIndex():int - { - return (this._nSelectedIndex); - } - - public function set selectedIndex(i:int):void - { - this.setSelectedIndex(i, SelectMethodEnum.MANUAL); - } - - public function set vertical(b:Boolean):void - { - if (this._verticalScroll != b) - { - this._verticalScroll = b; - if (this._finalized) - { - this.finalize(); - }; - }; - } - - public function get vertical():Boolean - { - return (this._verticalScroll); - } - - public function set autoSelect(b:Boolean):void - { - this._autoSelect = AUTOSELECT_BY_INDEX; - if (((this._dataProvider.length) && ((this._autoSelect == AUTOSELECT_BY_INDEX)))) - { - this.setSelectedIndex(Math.min(this._nSelectedIndex, (this._dataProvider.length - 1)), SelectMethodEnum.AUTO); - }; - } - - public function get autoSelect():Boolean - { - return ((this._autoSelect == AUTOSELECT_BY_INDEX)); - } - - public function set autoSelectMode(mode:int):void - { - this._autoSelect = mode; - if (this._dataProvider.length) - { - if (this._autoSelect == AUTOSELECT_BY_INDEX) - { - this.setSelectedIndex(Math.min(this._nSelectedIndex, (this._dataProvider.length - 1)), SelectMethodEnum.AUTO); - } - else - { - if (this._autoSelect == AUTOSELECT_BY_ITEM) - { - if (this._nSelectedItem) - { - this.selectedItem = this._nSelectedItem.object; - if (this.selectedItem != this._nSelectedItem.object) - { - this._nSelectedItem = null; - }; - }; - }; - }; - }; - } - - public function get autoSelectMode():int - { - return (this._autoSelect); - } - - public function get scrollDisplay():String - { - return (this._displayScrollbar); - } - - public function set scrollDisplay(sValue:String):void - { - this._displayScrollbar = sValue; - } - - public function get pagesCount():uint - { - var count:int; - if (this._verticalScroll) - { - count = (this._totalSlotByCol - this._slotByCol); + return; + } + } + + public function get dataProvider() : * + { + return this._dataProvider; + } + + public function resetScrollBar() : void + { + if((this._scrollBarH) && (this._scrollBarH.visible)) + { + this._scrollBarH.value = this._pageXOffset; + } + if((this._scrollBarV) && (this._scrollBarV.visible)) + { + this._scrollBarV.value = this._pageYOffset; + } + } + + public function set horizontalScrollbarCss(param1:Uri) : void + { + this._sHScrollCss = param1; + } + + public function get horizontalScrollbarCss() : Uri + { + return this._sHScrollCss; + } + + public function set verticalScrollbarCss(param1:Uri) : void + { + this._sVScrollCss = param1; + } + + public function get verticalScrollbarCss() : Uri + { + return this._sVScrollCss; + } + + public function get selectedIndex() : int + { + return this._nSelectedIndex; + } + + public function set selectedIndex(param1:int) : void + { + this.setSelectedIndex(param1,SelectMethodEnum.MANUAL); + } + + public function set vertical(param1:Boolean) : void + { + if(this._verticalScroll != param1) + { + this._verticalScroll = param1; + if(this._finalized) + { + this.finalize(); } - else - { - count = (this._totalSlotByRow - this._slotByRow); - }; - if (count < 0) - { - count = 0; - }; - return (count); - } - - public function get selectedItem() - { - if (!(this._dataProvider)) - { - return (null); - }; - if (this._nSelectedIndex < 0) - { - return (null); - }; - if (this._nSelectedIndex >= this._dataProvider.length) - { - return (null); - }; - return (this._dataProvider[this._nSelectedIndex]); - } - - public function set selectedItem(o:*):void - { - var isSet:Boolean; - var i:uint; - var data:*; - if (this._dataProvider) - { - isSet = false; - i = 0; - while (i < this._dataProvider.length) - { - data = SecureCenter.unsecure(this._dataProvider[i]); - if (data === SecureCenter.unsecure(o)) - { - this.setSelectedIndex(i, SelectMethodEnum.MANUAL); - isSet = true; - return; - }; - i++; - }; - }; - } - - public function get slotWidth():uint - { - return (this._slotWidth); - } - - public function set slotWidth(value:uint):void - { - this._slotWidth = value; - if (this.finalized) - { - this.finalize(); - }; - } - - public function get slotHeight():uint - { - return (this._slotHeight); - } - - public function set slotHeight(value:uint):void - { - this._slotHeight = value; - if (this.finalized) - { - this.finalize(); - }; - } - - public function set finalized(b:Boolean):void - { - this._finalized = b; - } - - public function get finalized():Boolean - { - return (this._finalized); - } - - public function get slotByRow():uint - { - return (this._slotByRow); - } - - public function get slotByCol():uint - { - return (this._slotByCol); - } - - public function get verticalScrollValue():int - { - if (this._scrollBarV) - { - return (this._scrollBarV.value); - }; - return (0); - } - - public function set verticalScrollValue(value:int):void - { - if (this._scrollBarV) - { - this._scrollBarV.value = value; - if (this._scrollBarV.value < 0) - { - this.updateFromIndex(0); - } - else - { - this.updateFromIndex(value); - }; - }; - } - - public function get verticalScrollSpeed():Number - { - return (this._verticalScrollSpeed); - } - - public function get horizontalScrollSpeed():Number - { - return (this._horizontalScrollSpeed); - } - - public function set verticalScrollSpeed(speed:Number):void - { - this._verticalScrollSpeed = speed; - if (this._scrollBarV) - { - this._scrollBarV.scrollSpeed = speed; - }; - } - - public function set horizontalScrollSpeed(speed:Number):void - { - this._horizontalScrollSpeed = speed; - if (this._scrollBarH) - { - this._scrollBarH.scrollSpeed = speed; - }; - } - - public function get hiddenRow():uint - { - return (this._hiddenRow); - } - - public function get hiddenCol():uint - { - return (this._hiddenCol); - } - - public function set hiddenRow(v:uint):void - { - this._hiddenRow = v; - if (this.finalized) - { - this.finalize(); - }; - } - - public function set hiddenCol(v:uint):void - { - this._hiddenCol = v; - if (this.finalized) - { - this.finalize(); - }; - } - - public function renderModificator(childs:Array, accessKey:Object):Array - { - var cRenderer:Class; - if (accessKey != SecureCenter.ACCESS_KEY) - { - throw (new IllegalOperationError()); - }; - if (this._sRendererName) - { - if (!(this._renderer)) - { - cRenderer = (getDefinitionByName(this._sRendererName) as Class); - if (cRenderer) - { - this._renderer = new (cRenderer)(this._sRendererArgs); - this._renderer.grid = this; - } - else - { - _log.error("Invalid renderer specified for this grid."); - return (childs); - }; - }; + } + } + + public function get vertical() : Boolean + { + return this._verticalScroll; + } + + public function set autoSelect(param1:Boolean) : void + { + this._autoSelect = AUTOSELECT_BY_INDEX; + if((this._dataProvider.length) && this._autoSelect == AUTOSELECT_BY_INDEX) + { + this.setSelectedIndex(Math.min(this._nSelectedIndex,this._dataProvider.length - 1),SelectMethodEnum.AUTO); + } + } + + public function get autoSelect() : Boolean + { + return this._autoSelect == AUTOSELECT_BY_INDEX; + } + + public function set autoSelectMode(param1:int) : void + { + this._autoSelect = param1; + if(this._dataProvider.length) + { + if(this._autoSelect == AUTOSELECT_BY_INDEX) + { + this.setSelectedIndex(Math.min(this._nSelectedIndex,this._dataProvider.length - 1),SelectMethodEnum.AUTO); } - else - { - _log.error((((("No renderer specified for grid " + name) + " ") + parent) + " son.")); - return (childs); - }; - this.configVar(); - return (this._renderer.renderModificator(childs)); - } - - public function finalize():void - { - var maxValue:int; - this.configVar(); - if ((((this._slotByRow < this._totalSlotByRow)) && (!((this._displayScrollbar == "never"))))) - { - if (!(this._scrollBarH)) - { - this._scrollBarH = new ScrollBar(); - addChild(this._scrollBarH); - this._scrollBarH.addEventListener(Event.CHANGE, this.onScroll, false, 0, true); - this._scrollBarH.css = this._sVScrollCss; - this._scrollBarH.min = 0; - this._scrollBarH.max = (this._totalSlotByRow - this._slotByRow); - this._scrollBarH.total = this._totalSlotByRow; - this._scrollBarH.width = width; - this._scrollBarH.height = this._scrollBarSize; - this._scrollBarH.y = (height - this._scrollBarH.height); - this._scrollBarH.step = 1; - this._scrollBarH.scrollSpeed = this._horizontalScrollSpeed; - this._scrollBarH.finalize(); - } - else - { - this._scrollBarH.max = (this._totalSlotByRow - this._slotByRow); - addChild(this._scrollBarH); - }; + else if(this._autoSelect == AUTOSELECT_BY_ITEM) + { + if(this._nSelectedItem) + { + this.selectedItem = this._nSelectedItem.object; + if(this.selectedItem != this._nSelectedItem.object) + { + this._nSelectedItem = null; + } + } } - else - { - if ((((((this._slotByCol < this._totalSlotByCol)) && (!((this._displayScrollbar == "never"))))) || ((this._displayScrollbar == "always")))) - { - if (!(this._scrollBarV)) - { - this._scrollBarV = new ScrollBar(); - addChild(this._scrollBarV); - this._scrollBarV.addEventListener(Event.CHANGE, this.onScroll, false, 0, true); - this._scrollBarV.css = this._sVScrollCss; - this._scrollBarV.min = 0; - maxValue = (this._totalSlotByCol - this._slotByCol); - if (maxValue < 0) - { - this._scrollBarV.max = 0; - } - else - { - this._scrollBarV.max = maxValue; - }; - this._scrollBarV.total = this._totalSlotByCol; - this._scrollBarV.width = this._scrollBarSize; - this._scrollBarV.height = height; - this._scrollBarV.x = (width - this._scrollBarV.width); - this._scrollBarV.step = 1; - this._scrollBarV.scrollSpeed = this._verticalScrollSpeed; - this._scrollBarV.finalize(); - } - else - { - maxValue = (this._totalSlotByCol - this._slotByCol); - if (maxValue < 0) - { - this._scrollBarV.max = 0; - } - else - { - this._scrollBarV.max = maxValue; - }; - this._scrollBarV.total = this._totalSlotByCol; - addChild(this._scrollBarV); - this._scrollBarV.finalize(); - }; - } - else - { - if (((this._scrollBarV) && (this._scrollBarV.parent))) - { - removeChild(this._scrollBarV); - this._scrollBarV.max = 0; - this._scrollBarV.finalize(); - }; - if (((this._scrollBarH) && (this._scrollBarH.parent))) - { - removeChild(this._scrollBarH); - this._scrollBarH.max = 0; - this._scrollBarH.finalize(); - }; - }; - }; - if (((this._hiddenCol) || (this._hiddenRow))) - { - if (!(this._mask)) - { - this._mask = new Shape(); - }; - if (((!((this._mask.width == width))) || (!((this._mask.height == height))))) - { - this._mask.graphics.clear(); - this._mask.graphics.beginFill(0xFFFF00); - this._mask.graphics.drawRect(0, 0, width, height); - addChild(this._mask); - mask = this._mask; - }; - }; - this._finalized = true; - if (getUi()) - { - getUi().iAmFinalized(this); - }; - } - - public function moveToPage(page:uint):void - { - if (page > this.pagesCount) - { - page = this.pagesCount; - }; - this.updateFromIndex(page); - } - - public function updateItem(index:uint):void - { - var currenItem:GridItem; - currenItem = this._items[index]; - if (!(currenItem)) - { - return; - }; - if (currenItem.index == this._nSelectedIndex) - { - this._renderer.update(this._dataProvider[currenItem.index], index, currenItem.container, true); + + } + } + + public function get autoSelectMode() : int + { + return this._autoSelect; + } + + public function get scrollDisplay() : String + { + return this._displayScrollbar; + } + + public function set scrollDisplay(param1:String) : void + { + this._displayScrollbar = param1; + } + + public function get pagesCount() : uint + { + var _loc1_:* = 0; + if(this._verticalScroll) + { + _loc1_ = this._totalSlotByCol - this._slotByCol; + } + else + { + _loc1_ = this._totalSlotByRow - this._slotByRow; + } + if(_loc1_ < 0) + { + _loc1_ = 0; + } + return _loc1_; + } + + public function get selectedItem() : * + { + if(!this._dataProvider) + { + return null; + } + if(this._nSelectedIndex < 0) + { + return null; + } + if(this._nSelectedIndex >= this._dataProvider.length) + { + return null; + } + return this._dataProvider[this._nSelectedIndex]; + } + + public function set selectedItem(param1:*) : void + { + var _loc2_:* = false; + var _loc3_:uint = 0; + var _loc4_:* = undefined; + if(this._dataProvider) + { + _loc2_ = false; + _loc3_ = 0; + while(_loc3_ < this._dataProvider.length) + { + _loc4_ = SecureCenter.unsecure(this._dataProvider[_loc3_]); + if(_loc4_ === SecureCenter.unsecure(param1)) + { + this.setSelectedIndex(_loc3_,SelectMethodEnum.MANUAL); + _loc2_ = true; + break; + } + _loc3_++; + } + } + } + + public function get slotWidth() : uint + { + return this._slotWidth; + } + + public function set slotWidth(param1:uint) : void + { + this._slotWidth = param1; + if(this.finalized) + { + this.finalize(); + } + } + + public function get slotHeight() : uint + { + return this._slotHeight; + } + + public function set slotHeight(param1:uint) : void + { + this._slotHeight = param1; + if(this.finalized) + { + this.finalize(); + } + } + + public function set finalized(param1:Boolean) : void + { + this._finalized = param1; + } + + public function get finalized() : Boolean + { + return this._finalized; + } + + public function get slotByRow() : uint + { + return this._slotByRow; + } + + public function get slotByCol() : uint + { + return this._slotByCol; + } + + public function get verticalScrollValue() : int + { + if(this._scrollBarV) + { + return this._scrollBarV.value; + } + return 0; + } + + public function set verticalScrollValue(param1:int) : void + { + if(this._scrollBarV) + { + this._scrollBarV.value = param1; + if(this._scrollBarV.value < 0) + { + this.updateFromIndex(0); } else { - this._renderer.update(this._dataProvider[currenItem.index], index, currenItem.container, false); - }; - currenItem.data = this._dataProvider[currenItem.index]; + this.updateFromIndex(param1); + } + } + } + + public function get verticalScrollSpeed() : Number + { + return this._verticalScrollSpeed; + } + + public function get horizontalScrollSpeed() : Number + { + return this._horizontalScrollSpeed; + } + + public function set verticalScrollSpeed(param1:Number) : void + { + this._verticalScrollSpeed = param1; + if(this._scrollBarV) + { + this._scrollBarV.scrollSpeed = param1; + } + } + + public function set horizontalScrollSpeed(param1:Number) : void + { + this._horizontalScrollSpeed = param1; + if(this._scrollBarH) + { + this._scrollBarH.scrollSpeed = param1; + } + } + + public function get hiddenRow() : uint + { + return this._hiddenRow; + } + + public function get hiddenCol() : uint + { + return this._hiddenCol; + } + + public function set hiddenRow(param1:uint) : void + { + this._hiddenRow = param1; + if(this.finalized) + { this.finalize(); - } - - public function updateItems():void - { - var currenItem:GridItem; - var index:uint; - while (index < this._items.length) - { - currenItem = this._items[index]; - if (!((!(currenItem)) || ((this._nSelectedIndex < 0)))) - { - if (currenItem.index == this._nSelectedIndex) - { - this._renderer.update(this._dataProvider[currenItem.index], index, currenItem.container, true); - } - else - { - this._renderer.update(this._dataProvider[currenItem.index], index, currenItem.container, false); - }; - currenItem.data = this._dataProvider[currenItem.index]; - }; - index++; - }; + } + } + + public function set hiddenCol(param1:uint) : void + { + this._hiddenCol = param1; + if(this.finalized) + { this.finalize(); - } - - public function get selectedSlot():DisplayObject - { - var currentItem:GridItem; - if ((((((this._items == null)) || ((this._nSelectedIndex < 0)))) || ((this._nSelectedIndex >= this.dataProvider.length)))) - { - return (null); - }; - var i:uint; - while (i < this._items.length) - { - currentItem = this._items[i]; - if (currentItem.data == this.selectedItem) - { - return (currentItem.container); - }; - i++; - }; - return (null); - } - - public function get slots():Array - { - if ((((this._items == null)) || ((this.dataProvider.length == 0)))) - { - return (new Array()); - }; - var slots:Array = new Array(); - var i:uint; - while (i < this._items.length) - { - if (this._items[i]) - { - slots.push(this._items[i].container); - }; - i++; - }; - return (slots); - } - - override public function remove():void - { - var currentItem:GridItem; - var i:uint; - if (!(__removed)) - { - if (this._renderer) - { - i = 0; - while (i < this._items.length) - { - currentItem = this._items[i]; - this._renderer.remove(currentItem.container); - i++; - }; - this._renderer.destroy(); - }; - this._items = null; - if (this._scrollBarH) - { - this._scrollBarH.removeEventListener(Event.CHANGE, this.onScroll); - }; - if (this._scrollBarV) - { - this._scrollBarV.removeEventListener(Event.CHANGE, this.onScroll); - }; - }; - super.remove(); - } - - public function indexIsInvisibleSlot(index:uint):Boolean - { - if (this._verticalScroll) + } + } + + public var keyboardIndexHandler:Function; + + public var silent:Boolean; + + public function renderModificator(param1:Array, param2:Object) : Array + { + var _loc3_:Class = null; + if(param2 != SecureCenter.ACCESS_KEY) + { + throw new IllegalOperationError(); + } + else + { + if(this._sRendererName) + { + if(!this._renderer) + { + _loc3_ = getDefinitionByName(this._sRendererName) as Class; + if(_loc3_) + { + this._renderer = new _loc3_(this._sRendererArgs); + this._renderer.grid = this; + } + else + { + _log.error("Invalid renderer specified for this grid."); + return param1; + } + } + this.configVar(); + return this._renderer.renderModificator(param1); + } + _log.error("No renderer specified for grid " + name + " " + parent + " son."); + return param1; + } + } + + public function finalize() : void + { + var _loc1_:* = 0; + this.configVar(); + if(this._slotByRow < this._totalSlotByRow && !(this._displayScrollbar == "never")) + { + if(!this._scrollBarH) + { + this._scrollBarH = new ScrollBar(); + addChild(this._scrollBarH); + this._scrollBarH.addEventListener(Event.CHANGE,this.onScroll,false,0,true); + this._scrollBarH.css = this._sVScrollCss; + this._scrollBarH.min = 0; + this._scrollBarH.max = this._totalSlotByRow - this._slotByRow; + this._scrollBarH.total = this._totalSlotByRow; + this._scrollBarH.width = width; + this._scrollBarH.height = this._scrollBarSize; + this._scrollBarH.y = height - this._scrollBarH.height; + this._scrollBarH.step = 1; + this._scrollBarH.scrollSpeed = this._horizontalScrollSpeed; + this._scrollBarH.finalize(); + } + else { - return ((((((index / this._totalSlotByRow) - this._pageYOffset) >= this._slotByCol)) || ((((index / this._totalSlotByRow) - this._pageYOffset) < 0)))); - }; - return ((((((index % this._totalSlotByRow) - this._pageXOffset) >= this._slotByRow)) || ((((index % this._totalSlotByRow) - this._pageXOffset) < 0)))); - } - - public function moveTo(index:uint, force:Boolean=false):void - { - if (((this.indexIsInvisibleSlot(index)) || (force))) + this._scrollBarH.max = this._totalSlotByRow - this._slotByRow; + addChild(this._scrollBarH); + } + } + else if(this._slotByCol < this._totalSlotByCol && !(this._displayScrollbar == "never") || this._displayScrollbar == "always") + { + if(!this._scrollBarV) + { + this._scrollBarV = new ScrollBar(); + addChild(this._scrollBarV); + this._scrollBarV.addEventListener(Event.CHANGE,this.onScroll,false,0,true); + this._scrollBarV.css = this._sVScrollCss; + this._scrollBarV.min = 0; + _loc1_ = this._totalSlotByCol - this._slotByCol; + if(_loc1_ < 0) + { + this._scrollBarV.max = 0; + } + else + { + this._scrollBarV.max = _loc1_; + } + this._scrollBarV.total = this._totalSlotByCol; + this._scrollBarV.width = this._scrollBarSize; + this._scrollBarV.height = height; + this._scrollBarV.x = width - this._scrollBarV.width; + this._scrollBarV.step = 1; + this._scrollBarV.scrollSpeed = this._verticalScrollSpeed; + this._scrollBarV.finalize(); + } + else { - if (this._scrollBarV) - { - this._scrollBarV.value = Math.floor((index / this._totalSlotByRow)); - if (this._scrollBarV.value < 0) - { - this.updateFromIndex(0); - } - else - { - this.updateFromIndex(this._scrollBarV.value); - }; - } - else - { - if (this._scrollBarH) - { - this._scrollBarH.value = (index % this._totalSlotByRow); - if (this._scrollBarH.value < 0) - { - this.updateFromIndex(0); - } - else - { - this.updateFromIndex(this._scrollBarH.value); - }; - }; - }; - }; - } - - public function getIndex():uint - { - if (this._scrollBarV) + _loc1_ = this._totalSlotByCol - this._slotByCol; + if(_loc1_ < 0) + { + this._scrollBarV.max = 0; + } + else + { + this._scrollBarV.max = _loc1_; + } + this._scrollBarV.total = this._totalSlotByCol; + addChild(this._scrollBarV); + this._scrollBarV.finalize(); + } + } + else + { + if((this._scrollBarV) && (this._scrollBarV.parent)) + { + removeChild(this._scrollBarV); + this._scrollBarV.max = 0; + this._scrollBarV.finalize(); + } + if((this._scrollBarH) && (this._scrollBarH.parent)) { - return (Math.floor((this._scrollBarV.value * this._totalSlotByRow))); - }; - return (0); - } - - public function sortOn(col:String, options:int=0):void - { - this._sortProperty = col; - this._dataProvider.sortOn(col, options); - this.finalize(); - this.initSlot(); - } - - public function getItemIndex(item:*):int - { - var realItem:DisplayObject; - realItem = SecureCenter.unsecure(item); - var res:GridItem = this.getGridItem(realItem); - if (res) + removeChild(this._scrollBarH); + this._scrollBarH.max = 0; + this._scrollBarH.finalize(); + } + } + + if((this._hiddenCol) || (this._hiddenRow)) + { + if(!this._mask) { - return (res.index); - }; - return (-1); - } - - private function sortFunction(a:*, b:*):Number - { - if (a[this._sortProperty] < b[this._sortProperty]) + this._mask = new Shape(); + } + if(!(this._mask.width == width) || !(this._mask.height == height)) { - return (-1); - }; - if (a[this._sortProperty] == b[this._sortProperty]) + this._mask.graphics.clear(); + this._mask.graphics.beginFill(16776960); + this._mask.graphics.drawRect(0,0,width,height); + addChild(this._mask); + mask = this._mask; + } + } + this._finalized = true; + if(getUi()) + { + getUi().iAmFinalized(this); + } + } + + public function moveToPage(param1:uint) : void + { + if(param1 > this.pagesCount) + { + var param1:uint = this.pagesCount; + } + this.updateFromIndex(param1); + } + + public function updateItem(param1:uint) : void + { + var _loc2_:GridItem = null; + _loc2_ = this._items[param1]; + if(!_loc2_) + { + return; + } + if(_loc2_.index == this._nSelectedIndex) + { + this._renderer.update(this._dataProvider[_loc2_.index],param1,_loc2_.container,true); + } + else + { + this._renderer.update(this._dataProvider[_loc2_.index],param1,_loc2_.container,false); + } + _loc2_.data = this._dataProvider[_loc2_.index]; + this.finalize(); + } + + public function updateItems() : void + { + var _loc1_:GridItem = null; + var _loc2_:uint = 0; + while(_loc2_ < this._items.length) + { + _loc1_ = this._items[_loc2_]; + if(!(!_loc1_ || this._nSelectedIndex < 0)) + { + if(_loc1_.index == this._nSelectedIndex) + { + this._renderer.update(this._dataProvider[_loc1_.index],_loc2_,_loc1_.container,true); + } + else + { + this._renderer.update(this._dataProvider[_loc1_.index],_loc2_,_loc1_.container,false); + } + _loc1_.data = this._dataProvider[_loc1_.index]; + } + _loc2_++; + } + this.finalize(); + } + + public function get selectedSlot() : DisplayObject + { + var _loc1_:GridItem = null; + if(this._items == null || this._nSelectedIndex < 0 || this._nSelectedIndex >= this.dataProvider.length) + { + return null; + } + var _loc2_:uint = 0; + while(_loc2_ < this._items.length) + { + _loc1_ = this._items[_loc2_]; + if(_loc1_.data == this.selectedItem) + { + return _loc1_.container; + } + _loc2_++; + } + return null; + } + + public function get slots() : Array + { + if(this._items == null || this.dataProvider.length == 0) + { + return new Array(); + } + var _loc1_:Array = new Array(); + var _loc2_:uint = 0; + while(_loc2_ < this._items.length) + { + if(this._items[_loc2_]) + { + _loc1_.push(this._items[_loc2_].container); + } + _loc2_++; + } + return _loc1_; + } + + override public function remove() : void + { + var _loc1_:GridItem = null; + var _loc2_:uint = 0; + if(!__removed) + { + if(this._renderer) + { + _loc2_ = 0; + while(_loc2_ < this._items.length) + { + _loc1_ = this._items[_loc2_]; + this._renderer.remove(_loc1_.container); + _loc2_++; + } + this._renderer.destroy(); + } + this._items = null; + if(this._scrollBarH) { - return (0); - }; - return (1); - } - - private function itemExists(o:*):Boolean - { - var i:int; - var len:int; - var data:*; - if (this._dataProvider) + this._scrollBarH.removeEventListener(Event.CHANGE,this.onScroll); + } + if(this._scrollBarV) { - len = this._dataProvider.length; - i = 0; - while (i < len) - { - data = SecureCenter.unsecure(this._dataProvider[i]); - if (data === SecureCenter.unsecure(o)) - { - return (true); - }; - i++; - }; - }; - return (false); - } - - private function initSlot():void - { - var slot:DisplayObject; - var item:GridItem; - var totalSlot:uint; - var i:int; - var isSelected:Boolean; - var dataPos:int; - if (((this._dataProvider.length) && (!(this._autoPosition)))) + this._scrollBarV.removeEventListener(Event.CHANGE,this.onScroll); + } + } + super.remove(); + } + + public function indexIsInvisibleSlot(param1:uint) : Boolean + { + if(this._verticalScroll) + { + return param1 / this._totalSlotByRow - this._pageYOffset >= this._slotByCol || param1 / this._totalSlotByRow - this._pageYOffset < 0; + } + return param1 % this._totalSlotByRow - this._pageXOffset >= this._slotByRow || param1 % this._totalSlotByRow - this._pageXOffset < 0; + } + + public function moveTo(param1:uint, param2:Boolean = false) : void + { + if((this.indexIsInvisibleSlot(param1)) || (param2)) + { + if(this._scrollBarV) + { + this._scrollBarV.value = Math.floor(param1 / this._totalSlotByRow); + if(this._scrollBarV.value < 0) + { + this.updateFromIndex(0); + } + else + { + this.updateFromIndex(this._scrollBarV.value); + } + } + else if(this._scrollBarH) + { + this._scrollBarH.value = param1 % this._totalSlotByRow; + if(this._scrollBarH.value < 0) + { + this.updateFromIndex(0); + } + else + { + this.updateFromIndex(this._scrollBarH.value); + } + } + + } + } + + public function getIndex() : uint + { + if(this._scrollBarV) + { + return Math.floor(this._scrollBarV.value * this._totalSlotByRow); + } + return 0; + } + + public function sortOn(param1:String, param2:int = 0) : void + { + this._sortProperty = param1; + this._dataProvider.sortOn(param1,param2); + this.finalize(); + this.initSlot(); + } + + public function getItemIndex(param1:*) : int + { + var _loc2_:DisplayObject = null; + _loc2_ = SecureCenter.unsecure(param1); + var _loc3_:GridItem = this.getGridItem(_loc2_); + if(_loc3_) + { + return _loc3_.index; + } + return -1; + } + + private function sortFunction(param1:*, param2:*) : Number + { + if(param1[this._sortProperty] < param2[this._sortProperty]) + { + return -1; + } + if(param1[this._sortProperty] == param2[this._sortProperty]) + { + return 0; + } + return 1; + } + + private function itemExists(param1:*) : Boolean + { + var _loc2_:* = 0; + var _loc3_:* = 0; + var _loc4_:* = undefined; + if(this._dataProvider) + { + _loc3_ = this._dataProvider.length; + _loc2_ = 0; + while(_loc2_ < _loc3_) + { + _loc4_ = SecureCenter.unsecure(this._dataProvider[_loc2_]); + if(_loc4_ === SecureCenter.unsecure(param1)) + { + return true; + } + _loc2_++; + } + } + return false; + } + + private function initSlot() : void + { + var _loc1_:DisplayObject = null; + var _loc4_:GridItem = null; + var _loc6_:uint = 0; + var _loc7_:* = 0; + var _loc8_:* = false; + var _loc2_:* = 0; + if((this._dataProvider.length) && !this._autoPosition) + { + _loc6_ = this._slotByCol * this._slotByRow; + while(this._pageYOffset >= 0) + { + while(this._pageXOffset >= 0) + { + _loc2_ = this._pageXOffset * this._slotByCol + this._pageYOffset * this._slotByRow; + if(_loc2_ <= this._dataProvider.length - _loc6_) + { + break; + } + this._pageXOffset--; + } + if(_loc2_ <= this._dataProvider.length - _loc6_) + { + break; + } + this._pageXOffset = 0; + this._pageYOffset--; + } + if(this._pageYOffset < 0) { - totalSlot = (this._slotByCol * this._slotByRow); - while (this._pageYOffset >= 0) - { - while (this._pageXOffset >= 0) - { - dataPos = ((this._pageXOffset * this._slotByCol) + (this._pageYOffset * this._slotByRow)); - if (dataPos <= (this._dataProvider.length - totalSlot)) break; - this._pageXOffset--; - }; - if (dataPos <= (this._dataProvider.length - totalSlot)) break; - this._pageXOffset = 0; - this._pageYOffset--; - }; - if (this._pageYOffset < 0) - { - this._pageYOffset = 0; - }; - if (this._pageXOffset < 0) - { - this._pageXOffset = 0; - }; - if (((this._scrollBarH) && (this._scrollBarH.visible))) - { - this._scrollBarH.value = this._pageXOffset; - }; - if (((this._scrollBarV) && (this._scrollBarV.visible))) - { - this._scrollBarV.value = this._pageYOffset; - }; - }; - var slotIndex:uint; - var j:int = -(this._hiddenRow); - while (j < (this._slotByCol + this._hiddenRow)) + this._pageYOffset = 0; + } + if(this._pageXOffset < 0) { - i = -(this._hiddenCol); - while (i < (this._slotByRow + this._hiddenCol)) - { - dataPos = (((i + (this._pageXOffset * this._slotByCol)) + (j * this._totalSlotByRow)) + (this._pageYOffset * this._slotByRow)); - item = this._items[slotIndex]; - isSelected = (((((((((this._nSelectedIndex == dataPos)) && ((this._autoSelect > 0)))) && ((this._dataProvider.length > 0)))) && ((dataPos < this._dataProvider.length)))) && (!((this._dataProvider[dataPos] == null)))); - if (item) - { - item.index = dataPos; - slot = item.container; - if (this._dataProvider.length > dataPos) - { - item.data = this._dataProvider[dataPos]; - this._renderer.update(this._dataProvider[dataPos], dataPos, item.container, isSelected); - } - else - { - item.data = null; - this._renderer.update(null, dataPos, item.container, isSelected); - }; - } - else - { - if (this._dataProvider.length > dataPos) - { - slot = this._renderer.render(this._dataProvider[dataPos], dataPos, isSelected); - } - else - { - slot = this._renderer.render(null, dataPos, isSelected); - }; - if (dataPos < this._dataProvider.length) - { - this._items.push(new GridItem(dataPos, slot, this._dataProvider[dataPos])); - } - else - { - this._items.push(new GridItem(dataPos, slot, null)); - }; - }; - slot.x = ((i * this._slotWidth) + ((i * (this._avaibleSpaceX - (this._slotByRow * this._slotWidth))) / this._slotByRow)); - slot.y = ((j * this._slotHeight) + ((j * (this._avaibleSpaceY - (this._slotByCol * this._slotHeight))) / this._slotByCol)); - addChild(slot); - slotIndex++; - i++; - }; - j++; - }; - while (this._items[slotIndex]) + this._pageXOffset = 0; + } + if((this._scrollBarH) && (this._scrollBarH.visible)) { - this._renderer.remove(GridItem(this._items.pop()).container); - }; - if (this._autoSelect == AUTOSELECT_BY_INDEX) + this._scrollBarH.value = this._pageXOffset; + } + if((this._scrollBarV) && (this._scrollBarV.visible)) { - if (((((((((this._nSelectedItem) && (this.itemExists(this._nSelectedItem.object)))) && (this._verticalScroll))) && (this._scrollBarV))) && ((this._scrollBarV.value >= 0)))) - { - this.updateFromIndex(this._scrollBarV.value); - } - else - { - this.setSelectedIndex(Math.min(this._nSelectedIndex, (this._dataProvider.length - 1)), SelectMethodEnum.AUTO); - }; + this._scrollBarV.value = this._pageYOffset; + } + } + var _loc3_:uint = 0; + var _loc5_:int = -this._hiddenRow; + while(_loc5_ < this._slotByCol + this._hiddenRow) + { + _loc7_ = -this._hiddenCol; + while(_loc7_ < this._slotByRow + this._hiddenCol) + { + _loc2_ = _loc7_ + this._pageXOffset * this._slotByCol + _loc5_ * this._totalSlotByRow + this._pageYOffset * this._slotByRow; + _loc4_ = this._items[_loc3_]; + _loc8_ = this._nSelectedIndex == _loc2_ && this._autoSelect > 0 && this._dataProvider.length > 0 && _loc2_ < this._dataProvider.length && !(this._dataProvider[_loc2_] == null); + if(_loc4_) + { + _loc4_.index = _loc2_; + _loc1_ = _loc4_.container; + if(this._dataProvider.length > _loc2_) + { + _loc4_.data = this._dataProvider[_loc2_]; + this._renderer.update(this._dataProvider[_loc2_],_loc2_,_loc4_.container,_loc8_); + } + else + { + _loc4_.data = null; + this._renderer.update(null,_loc2_,_loc4_.container,_loc8_); + } + } + else + { + if(this._dataProvider.length > _loc2_) + { + _loc1_ = this._renderer.render(this._dataProvider[_loc2_],_loc2_,_loc8_); + } + else + { + _loc1_ = this._renderer.render(null,_loc2_,_loc8_); + } + if(_loc2_ < this._dataProvider.length) + { + this._items.push(new GridItem(_loc2_,_loc1_,this._dataProvider[_loc2_])); + } + else + { + this._items.push(new GridItem(_loc2_,_loc1_,null)); + } + } + _loc1_.x = _loc7_ * this._slotWidth + _loc7_ * (this._avaibleSpaceX - this._slotByRow * this._slotWidth) / this._slotByRow; + _loc1_.y = _loc5_ * this._slotHeight + _loc5_ * (this._avaibleSpaceY - this._slotByCol * this._slotHeight) / this._slotByCol; + addChild(_loc1_); + _loc3_++; + _loc7_++; + } + _loc5_++; + } + while(this._items[_loc3_]) + { + this._renderer.remove(GridItem(this._items.pop()).container); + } + if(this._autoSelect == AUTOSELECT_BY_INDEX) + { + if((this._nSelectedItem && this.itemExists(this._nSelectedItem.object) && this._verticalScroll) && (this._scrollBarV) && this._scrollBarV.value >= 0) + { + this.updateFromIndex(this._scrollBarV.value); } else { - if (this._autoSelect == AUTOSELECT_BY_ITEM) - { - if (this._nSelectedItem) - { - this.selectedItem = this._nSelectedItem.object; - if (this.selectedItem != this._nSelectedItem.object) - { - this._nSelectedItem = null; - }; - }; - }; - }; - } - - private function updateFromIndex(newIndex:uint):void - { - var i:int; - var j:int; - var currentItem:GridItem; - var currIndex:uint; - var pos:int; - var diff:int = (newIndex - ((this._verticalScroll) ? this._pageYOffset : this._pageXOffset)); - if (!(diff)) - { - return; - }; - if (this._verticalScroll) - { - this._pageYOffset = newIndex; + this.setSelectedIndex(Math.min(this._nSelectedIndex,this._dataProvider.length - 1),SelectMethodEnum.AUTO); + } + } + else if(this._autoSelect == AUTOSELECT_BY_ITEM) + { + if(this._nSelectedItem) + { + this.selectedItem = this._nSelectedItem.object; + if(this.selectedItem != this._nSelectedItem.object) + { + this._nSelectedItem = null; + } + } + } + + } + + private function updateFromIndex(param1:uint) : void + { + var _loc3_:* = 0; + var _loc4_:* = 0; + var _loc5_:GridItem = null; + var _loc9_:uint = 0; + var _loc10_:* = 0; + var _loc2_:int = param1 - (this._verticalScroll?this._pageYOffset:this._pageXOffset); + if(!_loc2_) + { + return; + } + if(this._verticalScroll) + { + this._pageYOffset = param1; + } + else + { + this._pageXOffset = param1; + } + var _loc6_:Array = new Array(); + var _loc7_:Array = new Array(); + var _loc8_:uint = 0; + _loc3_ = 0; + while(_loc3_ < this._items.length) + { + _loc5_ = this._items[_loc3_]; + if(this.indexIsInvisibleSlot(_loc5_.index)) + { + _loc6_.push(_loc5_); + _loc8_++; } else { - this._pageXOffset = newIndex; - }; - var aAvaibleSlot:Array = new Array(); - var aOkSlot:Array = new Array(); - var nAvaible:uint; - i = 0; - while (i < this._items.length) + _loc7_[_loc5_.index] = _loc5_; + } + _loc3_++; + } + _loc4_ = -this._hiddenRow; + while(_loc4_ < this._slotByCol + this._hiddenRow) + { + _loc3_ = -this._hiddenCol; + while(_loc3_ < this._slotByRow + this._hiddenCol) + { + _loc10_ = this._totalSlotByRow * _loc4_ + _loc3_ + this._pageXOffset; + _loc9_ = _loc10_ + this._pageYOffset * this._totalSlotByRow; + _loc5_ = _loc7_[_loc9_]; + if(!_loc5_) + { + _loc5_ = _loc6_.shift(); + _loc5_.index = _loc9_; + if(_loc9_ < this._dataProvider.length) + { + _loc5_.data = this._dataProvider[_loc9_]; + } + else + { + _loc5_.data = null; + } + if(this._dataProvider.length > _loc9_) + { + this._renderer.update(this._dataProvider[_loc9_],_loc9_,_loc5_.container,_loc9_ == this._nSelectedIndex); + } + else + { + this._renderer.update(null,_loc9_,_loc5_.container,_loc9_ == this._nSelectedIndex); + } + } + if(this._verticalScroll) + { + _loc5_.container.y = Math.floor(_loc5_.index / this._totalSlotByRow - param1) * (this._slotHeight + (this._avaibleSpaceY - this._slotByCol * this._slotHeight) / this._slotByCol); + } + else + { + _loc5_.container.x = Math.floor(_loc5_.index % this._totalSlotByRow - param1) * (this._slotWidth + (this._avaibleSpaceX - this._slotByRow * this._slotWidth) / this._slotByRow); + } + _loc3_++; + } + _loc4_++; + } + } + + function setSelectedIndex(param1:int, param2:uint) : void + { + var _loc3_:* = 0; + var _loc4_:GridItem = null; + var _loc5_:* = undefined; + if(!(param2 == SelectMethodEnum.MANUAL) && param1 < 0 || param1 >= this._dataProvider.length) + { + return; + } + if(param1 < 0) + { + _loc3_ = this._nSelectedIndex; + this._nSelectedIndex = param1; + if(param1 >= 0) + { + this._nSelectedItem = new WeakReference(this._dataProvider[param1]); + } + for each(_loc5_ in this._items) { - currentItem = this._items[i]; - if (this.indexIsInvisibleSlot(currentItem.index)) - { - aAvaibleSlot.push(currentItem); - nAvaible++; - } - else - { - aOkSlot[currentItem.index] = currentItem; - }; - i++; - }; - j = -(this._hiddenRow); - while (j < (this._slotByCol + this._hiddenRow)) + if(_loc5_.index == _loc3_ && _loc3_ < this._dataProvider.length) + { + this._renderer.update(this._dataProvider[_loc3_],_loc3_,_loc5_.container,false); + } + } + this.dispatchMessage(new SelectItemMessage(this,param2,!(_loc3_ == this._nSelectedIndex))); + } + else + { + if(this._nSelectedIndex > 0) { - i = -(this._hiddenCol); - while (i < (this._slotByRow + this._hiddenCol)) - { - pos = (((this._totalSlotByRow * j) + i) + this._pageXOffset); - currIndex = (pos + (this._pageYOffset * this._totalSlotByRow)); - currentItem = aOkSlot[currIndex]; - if (!(currentItem)) - { - currentItem = aAvaibleSlot.shift(); - currentItem.index = currIndex; - if (currIndex < this._dataProvider.length) - { - currentItem.data = this._dataProvider[currIndex]; - } - else - { - currentItem.data = null; - }; - if (this._dataProvider.length > currIndex) - { - this._renderer.update(this._dataProvider[currIndex], currIndex, currentItem.container, (currIndex == this._nSelectedIndex)); - } - else - { - this._renderer.update(null, currIndex, currentItem.container, (currIndex == this._nSelectedIndex)); - }; - }; - if (this._verticalScroll) - { - currentItem.container.y = (Math.floor(((currentItem.index / this._totalSlotByRow) - newIndex)) * (this._slotHeight + ((this._avaibleSpaceY - (this._slotByCol * this._slotHeight)) / this._slotByCol))); - } - else - { - currentItem.container.x = (Math.floor(((currentItem.index % this._totalSlotByRow) - newIndex)) * (this._slotWidth + ((this._avaibleSpaceX - (this._slotByRow * this._slotWidth)) / this._slotByRow))); - }; - i++; - }; - j++; - }; - } - - function setSelectedIndex(index:int, method:uint):void - { - var lastIndex:int; - var currenItem:GridItem; - var iDes:*; - if (((((!((method == SelectMethodEnum.MANUAL))) && ((index < 0)))) || ((index >= this._dataProvider.length)))) + _loc3_ = this._nSelectedIndex; + } + this._nSelectedIndex = param1; + if(param1 >= 0) { - return; - }; - if (index < 0) + this._nSelectedItem = new WeakReference(this._dataProvider[param1]); + } + var param1:* = 0; + while(param1 < this._items.length) + { + _loc4_ = this._items[param1]; + if(_loc4_.index == this._nSelectedIndex) + { + this._renderer.update(this._dataProvider[this._nSelectedIndex],this._nSelectedIndex,_loc4_.container,true); + } + else if(_loc4_.index == _loc3_) + { + if(_loc3_ < this._dataProvider.length) + { + this._renderer.update(this._dataProvider[_loc3_],_loc3_,_loc4_.container,false); + } + else + { + this._renderer.update(null,_loc3_,_loc4_.container,false); + } + } + + param1++; + } + this.moveTo(this._nSelectedIndex); + this.dispatchMessage(new SelectItemMessage(this,param2,!(_loc3_ == this._nSelectedIndex))); + } + } + + private function configVar() : void + { + var _loc2_:* = false; + if(this._autoPosition) + { + this._pageXOffset = 0; + this._pageYOffset = 0; + } + var _loc1_:uint = 0; + while(_loc1_ < 2) + { + _loc2_ = (_loc1_ && this._displayScrollbar == "auto") && (this._totalSlotByCol * this._slotHeight > height || this._totalSlotByRow * this._slotWidth > width) || this._displayScrollbar == "always"; + this._avaibleSpaceX = width - ((this._verticalScroll) && (_loc2_)?this._scrollBarSize:0); + this._avaibleSpaceY = height - (!this._verticalScroll && (_loc2_)?this._scrollBarSize:0); + this._slotByRow = Math.floor(this._avaibleSpaceX / this._slotWidth); + if(this._slotByRow == 0) + { + this._slotByRow = 1; + } + this._slotByCol = Math.floor(this._avaibleSpaceY / this._slotHeight); + if(this._verticalScroll) { - lastIndex = this._nSelectedIndex; - this._nSelectedIndex = index; - if (index >= 0) - { - this._nSelectedItem = new WeakReference(this._dataProvider[index]); - }; - for each (iDes in this._items) - { - if ((((iDes.index == lastIndex)) && ((lastIndex < this._dataProvider.length)))) - { - this._renderer.update(this._dataProvider[lastIndex], lastIndex, iDes.container, false); - }; - }; - this.dispatchMessage(new SelectItemMessage(this, method, !((lastIndex == this._nSelectedIndex)))); + this._totalSlotByRow = this._slotByRow; + this._totalSlotByCol = Math.ceil(this._dataProvider.length / this._slotByRow); } else { - if (this._nSelectedIndex > 0) - { - lastIndex = this._nSelectedIndex; - }; - this._nSelectedIndex = index; - if (index >= 0) - { - this._nSelectedItem = new WeakReference(this._dataProvider[index]); - }; - index = 0; - while (index < this._items.length) - { - currenItem = this._items[index]; - if (currenItem.index == this._nSelectedIndex) - { - this._renderer.update(this._dataProvider[this._nSelectedIndex], this._nSelectedIndex, currenItem.container, true); - } - else - { - if (currenItem.index == lastIndex) - { - if (lastIndex < this._dataProvider.length) - { - this._renderer.update(this._dataProvider[lastIndex], lastIndex, currenItem.container, false); - } - else - { - this._renderer.update(null, lastIndex, currenItem.container, false); - }; - }; - }; - index++; - }; - this.moveTo(this._nSelectedIndex); - this.dispatchMessage(new SelectItemMessage(this, method, !((lastIndex == this._nSelectedIndex)))); - }; - } - - private function configVar():void - { - var useScrollBar:Boolean; - if (this._autoPosition) - { - this._pageXOffset = 0; - this._pageYOffset = 0; - }; - var i:uint; - while (i < 2) - { - useScrollBar = ((((((i) && ((this._displayScrollbar == "auto")))) && (((((this._totalSlotByCol * this._slotHeight) > height)) || (((this._totalSlotByRow * this._slotWidth) > width)))))) || ((this._displayScrollbar == "always"))); - this._avaibleSpaceX = (width - ((((this._verticalScroll) && (useScrollBar))) ? this._scrollBarSize : 0)); - this._avaibleSpaceY = (height - ((((!(this._verticalScroll)) && (useScrollBar))) ? this._scrollBarSize : 0)); - this._slotByRow = Math.floor((this._avaibleSpaceX / this._slotWidth)); - if (this._slotByRow == 0) - { - this._slotByRow = 1; - }; - this._slotByCol = Math.floor((this._avaibleSpaceY / this._slotHeight)); - if (this._verticalScroll) - { - this._totalSlotByRow = this._slotByRow; - this._totalSlotByCol = Math.ceil((this._dataProvider.length / this._slotByRow)); - } - else - { - this._totalSlotByCol = this._slotByCol; - this._totalSlotByRow = Math.ceil((this._dataProvider.length / this._slotByCol)); - }; - i++; - }; - } - - private function isIterable(obj:*):Boolean - { - if ((obj is Array)) - { - return (true); - }; - if ((obj is Vector.<*>)) - { - return (true); - }; - if (!(obj)) - { - return (false); - }; - if (((((((((!((obj["length"] == null))) && (!((obj["length"] == 0))))) && (!(isNaN(obj["length"]))))) && (!((obj[0] == null))))) && (!((obj is String))))) - { - return (true); - }; - return (false); - } - - protected function getGridItem(item:DisplayObject):GridItem - { - var currentItem:GridItem; - if (!(this._items)) - { - return (null); - }; - var currentDo:DisplayObject = item; - while (((currentDo) && (!((currentDo.parent == this))))) - { - currentDo = currentDo.parent; - }; - var i:uint; - while (i < this._items.length) - { - currentItem = this._items[i]; - if (currentItem.container === currentDo) - { - return (currentItem); - }; - i++; - }; - return (null); - } - - private function getNearestSlot(mouseEvent:MouseEvent):Slot - { - var nextSlotIndexX:int; - var nextSlot:Slot; - var nextDiffX:Number; - var nextDiffY:Number; - var index:int; - var mouseEventX:Number = mouseEvent.localX; - var mouseEventY:Number = mouseEvent.localY; - var currentSlotIndexX:int; - var currentSlot:Slot = Slot(GridItem(this._items[0]).container); - var currentDiffX:Number = Math.abs((mouseEventX - (currentSlot.x + this.slotWidth))); - var currentDiffY:Number = Math.abs((mouseEventY - (currentSlot.y + this.slotHeight))); - var xLimit:int = Math.max(1, (this.slotByRow - 1)); - var yLimit:int = Math.max(1, (this.slotByCol - 1)); - var x:int = 1; - while (x <= xLimit) - { - nextSlotIndexX = GridItem(this._items[x]).index; - nextSlot = Slot(GridItem(this._items[x]).container); - nextDiffX = Math.abs((mouseEventX - nextSlot.x)); - if (nextDiffX < currentDiffX) - { - currentSlotIndexX = nextSlotIndexX; - currentSlot = nextSlot; - currentDiffX = Math.abs((mouseEventX - (currentSlot.x + this.slotWidth))); - } - else - { - break; - }; - x = (x + 1); - }; - var y:int = 1; - while (y <= yLimit) - { - index = (currentSlotIndexX + (y * this.slotByRow)); - if (index >= this._items.length) break; - nextSlot = Slot(GridItem(this._items[index]).container); - nextDiffY = Math.abs((mouseEventY - nextSlot.y)); - if (nextDiffY < currentDiffY) - { - currentSlot = nextSlot; - currentDiffY = Math.abs((mouseEventY - (currentSlot.y + this.slotHeight))); - } - else - { - break; - }; - y = (y + 1); - }; - return (currentSlot); - } - - private function onScroll(e:Event):void - { - var i:int; - if (((this._scrollBarV) && (this._scrollBarV.visible))) - { - i = this._scrollBarV.value; - }; - if (((this._scrollBarH) && (this._scrollBarH.visible))) - { - i = this._scrollBarH.value; - }; - if (!(isNaN(i))) - { - this.updateFromIndex(i); - }; - } - - private function onListWheel(e:MouseEvent):void - { - if (this._verticalScroll) - { - if (((this._scrollBarV) && (this._scrollBarV.visible))) - { - this._scrollBarV.onWheel(e); - } - else - { - this.moveTo((this._pageYOffset + e.delta)); - }; + this._totalSlotByCol = this._slotByCol; + this._totalSlotByRow = Math.ceil(this._dataProvider.length / this._slotByCol); + } + _loc1_++; + } + } + + private function isIterable(param1:*) : Boolean + { + if(param1 is Array) + { + return true; + } + if(param1 is Vector.<*>) + { + return true; + } + if(!param1) + { + return false; + } + if(!(param1["length"] == null) && !(param1["length"] == 0) && !isNaN(param1["length"]) && !(param1[0] == null) && !(param1 is String)) + { + return true; + } + return false; + } + + protected function getGridItem(param1:DisplayObject) : GridItem + { + var _loc2_:GridItem = null; + if(!this._items) + { + return null; + } + var _loc3_:DisplayObject = param1; + while((_loc3_) && !(_loc3_.parent == this)) + { + _loc3_ = _loc3_.parent; + } + var _loc4_:uint = 0; + while(_loc4_ < this._items.length) + { + _loc2_ = this._items[_loc4_]; + if(_loc2_.container === _loc3_) + { + return _loc2_; + } + _loc4_++; + } + return null; + } + + private function getNearestSlot(param1:MouseEvent) : Slot + { + var _loc5_:* = 0; + var _loc7_:Slot = null; + var _loc9_:* = NaN; + var _loc11_:* = NaN; + var _loc15_:* = 0; + var _loc2_:Number = param1.localX; + var _loc3_:Number = param1.localY; + var _loc4_:* = 0; + var _loc6_:Slot = Slot(GridItem(this._items[0]).container); + var _loc8_:Number = Math.abs(_loc2_ - (_loc6_.x + this.slotWidth)); + var _loc10_:Number = Math.abs(_loc3_ - (_loc6_.y + this.slotHeight)); + var _loc12_:int = Math.max(1,this.slotByRow - 1); + var _loc13_:int = Math.max(1,this.slotByCol - 1); + var _loc14_:* = 1; + while(_loc14_ <= _loc12_) + { + _loc5_ = GridItem(this._items[_loc14_]).index; + _loc7_ = Slot(GridItem(this._items[_loc14_]).container); + _loc9_ = Math.abs(_loc2_ - _loc7_.x); + if(_loc9_ < _loc8_) + { + _loc4_ = _loc5_; + _loc6_ = _loc7_; + _loc8_ = Math.abs(_loc2_ - (_loc6_.x + this.slotWidth)); + _loc14_ = _loc14_ + 1; + continue; + } + break; + } + var _loc16_:* = 1; + while(_loc16_ <= _loc13_) + { + _loc15_ = _loc4_ + _loc16_ * this.slotByRow; + if(_loc15_ >= this._items.length) + { + break; + } + _loc7_ = Slot(GridItem(this._items[_loc15_]).container); + _loc11_ = Math.abs(_loc3_ - _loc7_.y); + if(_loc11_ < _loc10_) + { + _loc6_ = _loc7_; + _loc10_ = Math.abs(_loc3_ - (_loc6_.y + this.slotHeight)); + _loc16_ = _loc16_ + 1; + continue; + } + break; + } + return _loc6_; + } + + private function onScroll(param1:Event) : void + { + var _loc2_:* = 0; + if((this._scrollBarV) && (this._scrollBarV.visible)) + { + _loc2_ = this._scrollBarV.value; + } + if((this._scrollBarH) && (this._scrollBarH.visible)) + { + _loc2_ = this._scrollBarH.value; + } + if(!isNaN(_loc2_)) + { + this.updateFromIndex(_loc2_); + } + } + + private function onListWheel(param1:MouseEvent) : void + { + if(this._verticalScroll) + { + if((this._scrollBarV) && (this._scrollBarV.visible)) + { + this._scrollBarV.onWheel(param1); } else { - if (((this._scrollBarH) && (this._scrollBarH.visible))) - { - this._scrollBarH.onWheel(e); - } - else - { - this.moveTo((this._pageXOffset + e.delta)); - }; - }; - } - - [HideInFakeClass] - override public function process(msg:Message):Boolean - { - var currentItem:GridItem; - var _local_3:MouseRightClickMessage; - var _local_4:MouseOverMessage; - var _local_5:MouseOutMessage; - var _local_6:int; - var _local_7:MouseMessage; - var _local_8:MouseUpMessage; - var _local_9:KeyboardKeyDownMessage; - var _local_10:int; - var _local_11:int; - switch (true) - { - case (msg is MouseRightClickMessage): - _local_3 = (msg as MouseRightClickMessage); - currentItem = this.getGridItem(_local_3.target); - if (currentItem) - { - if (UIEventManager.getInstance().isRegisteredInstance(this, ItemRightClickMessage)) - { - this.dispatchMessage(new ItemRightClickMessage(this, currentItem)); - }; - }; - break; - case (msg is MouseOverMessage): - _local_4 = (msg as MouseOverMessage); - currentItem = this.getGridItem(_local_4.target); - if (currentItem) - { - if (((UIEventManager.getInstance().isRegisteredInstance(this, ItemRollOverMessage)) || (((parent) && ((parent is ComboBox)))))) - { - if (((parent) && ((parent is ComboBox)))) - { - this.dispatchMessage(new ItemRollOverMessage((parent as ComboBox), currentItem)); - } - else - { - this.dispatchMessage(new ItemRollOverMessage(this, currentItem)); - }; - }; - }; - break; - case (msg is MouseOutMessage): - _local_5 = (msg as MouseOutMessage); - currentItem = this.getGridItem(_local_5.target); - if (currentItem) - { - if (((UIEventManager.getInstance().isRegisteredInstance(this, ItemRollOverMessage)) || (((parent) && ((parent is ComboBox)))))) - { - if (((parent) && ((parent is ComboBox)))) - { - this.dispatchMessage(new ItemRollOutMessage((parent as ComboBox), currentItem)); - } - else - { - this.dispatchMessage(new ItemRollOutMessage(this, currentItem)); - }; - }; - }; - break; - case (msg is MouseWheelMessage): - if (this._scrollBarH) - { - _local_6 = this._scrollBarH.value; - }; - if (this._scrollBarV) - { - _local_6 = this._scrollBarV.value; - }; - this.onListWheel(MouseWheelMessage(msg).mouseEvent); - if (((((this._scrollBarH) && (!((this._scrollBarH.value == _local_6))))) || (((this._scrollBarV) && (!((this._scrollBarV.value == _local_6))))))) - { - MouseWheelMessage(msg).canceled = true; - return (true); - }; - break; - case (msg is MouseDoubleClickMessage): - case (msg is MouseClickMessage): - _local_7 = MouseMessage(msg); - currentItem = this.getGridItem(_local_7.target); - if (currentItem) - { - if ((msg is MouseClickMessage)) + this.moveTo(this._pageYOffset + param1.delta); + } + } + else if((this._scrollBarH) && (this._scrollBarH.visible)) + { + this._scrollBarH.onWheel(param1); + } + else + { + this.moveTo(this._pageXOffset + param1.delta); + } + + } + + override public function process(param1:Message) : Boolean + { + var _loc2_:GridItem = null; + var _loc3_:MouseRightClickMessage = null; + var _loc4_:MouseOverMessage = null; + var _loc5_:MouseOutMessage = null; + var _loc6_:* = 0; + var _loc7_:MouseMessage = null; + var _loc8_:MouseUpMessage = null; + var _loc9_:KeyboardKeyDownMessage = null; + var _loc10_:* = 0; + var _loc11_:* = 0; + switch(true) + { + case param1 is MouseRightClickMessage: + _loc3_ = param1 as MouseRightClickMessage; + _loc2_ = this.getGridItem(_loc3_.target); + if(_loc2_) + { + if(UIEventManager.getInstance().isRegisteredInstance(this,ItemRightClickMessage)) + { + this.dispatchMessage(new ItemRightClickMessage(this,_loc2_)); + } + } + break; + case param1 is MouseOverMessage: + _loc4_ = param1 as MouseOverMessage; + _loc2_ = this.getGridItem(_loc4_.target); + if(_loc2_) + { + if((UIEventManager.getInstance().isRegisteredInstance(this,ItemRollOverMessage)) || (parent) && (parent is ComboBox)) + { + if((parent) && parent is ComboBox) + { + this.dispatchMessage(new ItemRollOverMessage(parent as ComboBox,_loc2_)); + } + else + { + this.dispatchMessage(new ItemRollOverMessage(this,_loc2_)); + } + } + } + break; + case param1 is MouseOutMessage: + _loc5_ = param1 as MouseOutMessage; + _loc2_ = this.getGridItem(_loc5_.target); + if(_loc2_) + { + if((UIEventManager.getInstance().isRegisteredInstance(this,ItemRollOverMessage)) || (parent) && (parent is ComboBox)) + { + if((parent) && parent is ComboBox) + { + this.dispatchMessage(new ItemRollOutMessage(parent as ComboBox,_loc2_)); + } + else + { + this.dispatchMessage(new ItemRollOutMessage(this,_loc2_)); + } + } + } + break; + case param1 is MouseWheelMessage: + if(this._scrollBarH) + { + _loc6_ = this._scrollBarH.value; + } + if(this._scrollBarV) + { + _loc6_ = this._scrollBarV.value; + } + this.onListWheel(MouseWheelMessage(param1).mouseEvent); + if((this._scrollBarH) && (!(this._scrollBarH.value == _loc6_)) || (this._scrollBarV) && (!(this._scrollBarV.value == _loc6_))) + { + MouseWheelMessage(param1).canceled = true; + return true; + } + break; + case param1 is MouseDoubleClickMessage: + case param1 is MouseClickMessage: + _loc7_ = MouseMessage(param1); + _loc2_ = this.getGridItem(_loc7_.target); + if(_loc2_) + { + if(param1 is MouseClickMessage) + { + if(!_loc2_.data) + { + if(UIEventManager.getInstance().isRegisteredInstance(this,SelectEmptyItemMessage)) { - if (!(currentItem.data)) - { - if (UIEventManager.getInstance().isRegisteredInstance(this, SelectEmptyItemMessage)) - { - this.dispatchMessage(new SelectEmptyItemMessage(this, SelectMethodEnum.CLICK)); - }; - this.setSelectedIndex(-1, SelectMethodEnum.CLICK); - }; - this.setSelectedIndex(currentItem.index, SelectMethodEnum.CLICK); + this.dispatchMessage(new SelectEmptyItemMessage(this,SelectMethodEnum.CLICK)); } - else - { - if ((((KeyPoll.getInstance().isDown(Keyboard.CONTROL) == true)) || ((KeyPoll.getInstance().isDown(15) == true)))) - { - this.setSelectedIndex(currentItem.index, SelectMethodEnum.CTRL_DOUBLE_CLICK); - } - else - { - if (((AirScanner.hasAir()) && ((KeyPoll.getInstance().isDown(Keyboard["ALTERNATE"]) == true)))) - { - this.setSelectedIndex(currentItem.index, SelectMethodEnum.ALT_DOUBLE_CLICK); - } - else - { - this.setSelectedIndex(currentItem.index, SelectMethodEnum.DOUBLE_CLICK); - }; - }; - return (true); - }; - }; - break; - case (msg is MouseUpMessage): - _local_8 = MouseUpMessage(msg); - currentItem = this.getGridItem(_local_8.target); - if (((((((this._items) && ((this._items[0] is GridItem)))) && ((GridItem(this._items[0]).container is Slot)))) && (!(currentItem)))) - { - this.dispatchMessage(_local_8, this.getNearestSlot(_local_8.mouseEvent)); - }; - break; - case (msg is KeyboardKeyDownMessage): - _local_9 = (msg as KeyboardKeyDownMessage); - _local_11 = -1; - switch (_local_9.keyboardEvent.keyCode) - { - case Keyboard.UP: - _local_10 = (this.selectedIndex - this._totalSlotByRow); - _local_11 = SelectMethodEnum.UP_ARROW; - break; - case Keyboard.DOWN: - _local_10 = (this.selectedIndex + this._totalSlotByRow); - _local_11 = SelectMethodEnum.DOWN_ARROW; - break; - case Keyboard.RIGHT: - _local_10 = (this.selectedIndex + 1); - _local_11 = SelectMethodEnum.RIGHT_ARROW; - break; - case Keyboard.LEFT: - _local_10 = (this.selectedIndex - 1); - _local_11 = SelectMethodEnum.LEFT_ARROW; - break; - }; - if (_local_11 != -1) - { - if (this.keyboardIndexHandler != null) - { - _local_10 = this.keyboardIndexHandler(this.selectedIndex, _local_10); - }; - this.setSelectedIndex(_local_10, _local_11); - this.moveTo(this.selectedIndex); - return (true); - }; - break; - }; - return (false); - } - - protected function dispatchMessage(msg:Message, handler:MessageHandler=null):void - { - if (!(this.silent)) - { - if (!(handler)) - { - handler = Berilia.getInstance().handler; - }; - handler.process(msg); - }; - } - - - } -}//package com.ankamagames.berilia.components - + this.setSelectedIndex(-1,SelectMethodEnum.CLICK); + } + this.setSelectedIndex(_loc2_.index,SelectMethodEnum.CLICK); + } + else + { + if(KeyPoll.getInstance().isDown(Keyboard.CONTROL) == true || KeyPoll.getInstance().isDown(15) == true) + { + this.setSelectedIndex(_loc2_.index,SelectMethodEnum.CTRL_DOUBLE_CLICK); + } + else if((AirScanner.hasAir()) && KeyPoll.getInstance().isDown(Keyboard["ALTERNATE"]) == true) + { + this.setSelectedIndex(_loc2_.index,SelectMethodEnum.ALT_DOUBLE_CLICK); + } + else + { + this.setSelectedIndex(_loc2_.index,SelectMethodEnum.DOUBLE_CLICK); + } + + return true; + } + } + break; + case param1 is MouseUpMessage: + _loc8_ = MouseUpMessage(param1); + _loc2_ = this.getGridItem(_loc8_.target); + if((this._items && this._items[0] is GridItem) && (GridItem(this._items[0]).container is Slot) && !_loc2_) + { + this.dispatchMessage(_loc8_,this.getNearestSlot(_loc8_.mouseEvent)); + } + break; + case param1 is KeyboardKeyDownMessage: + _loc9_ = param1 as KeyboardKeyDownMessage; + _loc11_ = -1; + switch(_loc9_.keyboardEvent.keyCode) + { + case Keyboard.UP: + _loc10_ = this.selectedIndex - this._totalSlotByRow; + _loc11_ = SelectMethodEnum.UP_ARROW; + break; + case Keyboard.DOWN: + _loc10_ = this.selectedIndex + this._totalSlotByRow; + _loc11_ = SelectMethodEnum.DOWN_ARROW; + break; + case Keyboard.RIGHT: + _loc10_ = this.selectedIndex + 1; + _loc11_ = SelectMethodEnum.RIGHT_ARROW; + break; + case Keyboard.LEFT: + _loc10_ = this.selectedIndex - 1; + _loc11_ = SelectMethodEnum.LEFT_ARROW; + break; + } + if(_loc11_ != -1) + { + if(this.keyboardIndexHandler != null) + { + _loc10_ = this.keyboardIndexHandler(this.selectedIndex,_loc10_); + } + this.setSelectedIndex(_loc10_,_loc11_); + this.moveTo(this.selectedIndex); + return true; + } + break; + } + return false; + } + + protected function dispatchMessage(param1:Message, param2:MessageHandler = null) : void + { + if(!this.silent) + { + if(!param2) + { + var param2:MessageHandler = Berilia.getInstance().handler; + } + param2.process(param1); + } + } + } +} diff --git a/com/ankamagames/berilia/components/Input.as b/com/ankamagames/berilia/components/Input.as index 1b37908dd..75adc7fdf 100644 --- a/com/ankamagames/berilia/components/Input.as +++ b/com/ankamagames/berilia/components/Input.as @@ -1,663 +1,671 @@ -package com.ankamagames.berilia.components +package com.ankamagames.berilia.components { - import com.ankamagames.berilia.UIComponent; - import flash.utils.Timer; - import __AS3__.vec.Vector; - import flash.text.TextFieldType; - import flash.events.Event; - import flash.events.TextEvent; - import flash.events.KeyboardEvent; - import flash.events.TimerEvent; - import com.ankamagames.berilia.Berilia; - import com.ankamagames.jerakine.handlers.FocusHandler; - import com.ankamagames.jerakine.handlers.messages.keyboard.KeyboardKeyDownMessage; - import com.ankamagames.jerakine.handlers.messages.mouse.MouseClickMessage; - import com.ankamagames.jerakine.handlers.messages.mouse.MouseWheelMessage; - import com.ankamagames.berilia.frames.ShortcutsFrame; - import flash.ui.Keyboard; - import com.ankamagames.jerakine.messages.Message; - import com.ankamagames.jerakine.utils.misc.StringUtils; - import com.ankamagames.jerakine.replay.LogFrame; - import com.ankamagames.jerakine.replay.LogTypeEnum; - import com.ankamagames.jerakine.replay.KeyboardInput; - import com.ankamagames.berilia.components.messages.ChangeMessage; - import flash.display.InteractiveObject; - import com.ankamagames.jerakine.data.XmlConfig; - import __AS3__.vec.*; - - public class Input extends Label implements UIComponent - { - - private static const UNDO_MAX_SIZE:uint = 10; - private static const _strReplace:String = "NoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLog"; - private static var regSpace:RegExp = /\s/g; - public static var numberStrSeparator:String; - - private var _nMaxChars:int; - private var _nNumberMax:uint; - private var _bPassword:Boolean = false; - private var _sRestrictChars:String; - private var _bNumberAutoFormat:Boolean = false; - private var _numberSeparator:String = " "; - private var _nSelectionStart:int; - private var _nSelectionEnd:int; - private var _isNumericInput:Boolean; - private var _lastTextOnInput:String; - public var imeActive:Boolean; - private var _timerFormatDelay:Timer; - private var _sendingText:Boolean; - private var _chatHistoryText:Boolean; - private var _inputHistory:Vector.; - private var _historyEntryHyperlinkCodes:Vector.; - private var _currentHyperlinkCodes:Vector.; - private var _historyCurrentIndex:int; - private var _undoing:Boolean; - private var _redoing:Boolean; - private var _deleting:Boolean; - public var focusEventHandlerPriority:Boolean = true; - - public function Input() - { - _bHtmlAllowed = false; - _tText.selectable = true; - _tText.type = TextFieldType.INPUT; - _tText.restrict = this._sRestrictChars; - _tText.maxChars = this._nMaxChars; - _tText.mouseEnabled = true; - _autoResize = false; - this.numberSeparator = numberStrSeparator; - _tText.addEventListener(Event.CHANGE, this.onTextChange); - _tText.addEventListener(TextEvent.TEXT_INPUT, this.onTextInput); - _tText.addEventListener(KeyboardEvent.KEY_UP, this.onKeyUp); - _tText.addEventListener(KeyboardEvent.KEY_DOWN, this.onKeyDown, false, 1, true); - this._inputHistory = new Vector.(0); - this._currentHyperlinkCodes = new Vector.(0); - } - - public function get lastTextOnInput():String - { - return (this._lastTextOnInput); - } - - public function get maxChars():uint - { - return (this._nMaxChars); - } - - public function set maxChars(nValue:uint):void - { - this._nMaxChars = nValue; - _tText.maxChars = this._nMaxChars; - } - - public function set numberMax(nValue:uint):void - { - this._nNumberMax = nValue; - } - - public function get password():Boolean - { - return (this._bPassword); - } - - public function set password(bValue:Boolean):void - { - this._bPassword = bValue; - if (this._bPassword) - { - _tText.displayAsPassword = true; - }; - } - - public function get numberAutoFormat():Boolean - { - return (this._bNumberAutoFormat); - } - - public function set numberAutoFormat(bValue:Boolean):void - { - this._bNumberAutoFormat = bValue; - if (!(bValue)) - { - if (this._timerFormatDelay) - { - this._timerFormatDelay.stop(); - this._timerFormatDelay.removeEventListener(TimerEvent.TIMER_COMPLETE, this.onTimerFormatDelay); - }; + import com.ankamagames.berilia.UIComponent; + import flash.utils.Timer; + import flash.events.TimerEvent; + import com.ankamagames.berilia.Berilia; + import flash.events.Event; + import flash.events.TextEvent; + import flash.events.KeyboardEvent; + import com.ankamagames.jerakine.handlers.FocusHandler; + import com.ankamagames.jerakine.messages.Message; + import com.ankamagames.jerakine.handlers.messages.keyboard.KeyboardKeyDownMessage; + import com.ankamagames.jerakine.handlers.messages.mouse.MouseClickMessage; + import com.ankamagames.jerakine.handlers.messages.mouse.MouseWheelMessage; + import com.ankamagames.berilia.frames.ShortcutsFrame; + import flash.ui.Keyboard; + import com.ankamagames.jerakine.utils.misc.StringUtils; + import com.ankamagames.jerakine.replay.LogFrame; + import com.ankamagames.jerakine.replay.LogTypeEnum; + import com.ankamagames.jerakine.replay.KeyboardInput; + import com.ankamagames.berilia.components.messages.ChangeMessage; + import flash.display.InteractiveObject; + import com.ankamagames.jerakine.data.XmlConfig; + import flash.text.TextFieldType; + + public class Input extends Label implements UIComponent + { + + public function Input() + { + super(); + _bHtmlAllowed = false; + _tText.selectable = true; + _tText.type = TextFieldType.INPUT; + _tText.restrict = this._sRestrictChars; + _tText.maxChars = this._nMaxChars; + _tText.mouseEnabled = true; + _autoResize = false; + this.numberSeparator = numberStrSeparator; + _tText.addEventListener(Event.CHANGE,this.onTextChange); + _tText.addEventListener(TextEvent.TEXT_INPUT,this.onTextInput); + _tText.addEventListener(KeyboardEvent.KEY_UP,this.onKeyUp); + _tText.addEventListener(KeyboardEvent.KEY_DOWN,this.onKeyDown,false,1,true); + this._inputHistory = new Vector.(0); + this._currentHyperlinkCodes = new Vector.(0); + } + + private static const UNDO_MAX_SIZE:uint = 10; + + private static const _strReplace:String = "NoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLogNoLog"; + + private static var regSpace:RegExp = new RegExp("\\s","g"); + + public static var numberStrSeparator:String; + + private var _nMaxChars:int; + + private var _nNumberMax:uint; + + private var _bPassword:Boolean = false; + + private var _sRestrictChars:String; + + private var _bNumberAutoFormat:Boolean = false; + + private var _numberSeparator:String = " "; + + private var _nSelectionStart:int; + + private var _nSelectionEnd:int; + + private var _isNumericInput:Boolean; + + private var _lastTextOnInput:String; + + public var imeActive:Boolean; + + private var _timerFormatDelay:Timer; + + private var _sendingText:Boolean; + + private var _chatHistoryText:Boolean; + + private var _inputHistory:Vector.; + + private var _historyEntryHyperlinkCodes:Vector.; + + private var _currentHyperlinkCodes:Vector.; + + private var _historyCurrentIndex:int; + + private var _undoing:Boolean; + + private var _redoing:Boolean; + + private var _deleting:Boolean; + + public var focusEventHandlerPriority:Boolean = true; + + public function get lastTextOnInput() : String + { + return this._lastTextOnInput; + } + + public function get maxChars() : uint + { + return this._nMaxChars; + } + + public function set maxChars(param1:uint) : void + { + this._nMaxChars = param1; + _tText.maxChars = this._nMaxChars; + } + + public function set numberMax(param1:uint) : void + { + this._nNumberMax = param1; + } + + public function get password() : Boolean + { + return this._bPassword; + } + + public function set password(param1:Boolean) : void + { + this._bPassword = param1; + if(this._bPassword) + { + _tText.displayAsPassword = true; + } + } + + public function get numberAutoFormat() : Boolean + { + return this._bNumberAutoFormat; + } + + public function set numberAutoFormat(param1:Boolean) : void + { + this._bNumberAutoFormat = param1; + if(!param1) + { + if(this._timerFormatDelay) + { + this._timerFormatDelay.stop(); + this._timerFormatDelay.removeEventListener(TimerEvent.TIMER_COMPLETE,this.onTimerFormatDelay); } - else - { - this._timerFormatDelay = new Timer(1000, 1); - this._timerFormatDelay.addEventListener(TimerEvent.TIMER_COMPLETE, this.onTimerFormatDelay); - }; - } - - public function get numberSeparator():String - { - return (this._numberSeparator); - } - - public function set numberSeparator(bValue:String):void - { - this._numberSeparator = bValue; - } - - public function get restrictChars():String - { - return (this._sRestrictChars); - } - - public function set restrictChars(sValue:String):void - { - this._sRestrictChars = sValue; - _tText.restrict = this._sRestrictChars; - this._isNumericInput = (((this._sRestrictChars == "0-9")) || ((this._sRestrictChars == "0-9  "))); - } - - public function get haveFocus():Boolean - { - return ((Berilia.getInstance().docMain.stage.focus == _tText)); - } - - override public function set text(sValue:String):void - { - super.text = sValue; - this.onTextChange(null); - } - - override public function appendText(sTxt:String, style:String=null):void - { - super.appendText(sTxt, style); - this.checkClearHistory(); - this._undoing = (this._redoing = (this._deleting = (this._chatHistoryText = false))); - this.onTextChange(null); - } - - override public function remove():void - { - _tText.removeEventListener(Event.CHANGE, this.onTextChange); - _tText.removeEventListener(TextEvent.TEXT_INPUT, this.onTextInput); - _tText.removeEventListener(KeyboardEvent.KEY_UP, this.onKeyUp); - _tText.removeEventListener(KeyboardEvent.KEY_DOWN, this.onKeyDown); - this._inputHistory.length = 0; - this._currentHyperlinkCodes.length = 0; - if (this._timerFormatDelay) - { - this._timerFormatDelay.removeEventListener(TimerEvent.TIMER_COMPLETE, this.onTimerFormatDelay); - }; - super.remove(); - } - - override public function free():void - { - if (this._timerFormatDelay) - { - this._timerFormatDelay.removeEventListener(TimerEvent.TIMER_COMPLETE, this.onTimerFormatDelay); - }; - super.free(); - } - - private function undo():void - { - if (((this._deleting) && ((_tText.text.length == 0)))) - { - this._inputHistory.pop(); - }; - if (this._chatHistoryText) - { - return; - }; - if (this._inputHistory.length > 0) + } + else + { + this._timerFormatDelay = new Timer(1000,1); + this._timerFormatDelay.addEventListener(TimerEvent.TIMER_COMPLETE,this.onTimerFormatDelay); + } + } + + public function get numberSeparator() : String + { + return this._numberSeparator; + } + + public function set numberSeparator(param1:String) : void + { + this._numberSeparator = param1; + } + + public function get restrictChars() : String + { + return this._sRestrictChars; + } + + public function set restrictChars(param1:String) : void + { + this._sRestrictChars = param1; + _tText.restrict = this._sRestrictChars; + this._isNumericInput = this._sRestrictChars == "0-9" || this._sRestrictChars == "0-9  "; + } + + public function get haveFocus() : Boolean + { + return Berilia.getInstance().docMain.stage.focus == _tText; + } + + override public function set text(param1:String) : void + { + super.text = param1; + this.onTextChange(null); + } + + override public function appendText(param1:String, param2:String = null) : void + { + super.appendText(param1,param2); + this.checkClearHistory(); + this._undoing = this._redoing = this._deleting = this._chatHistoryText = false; + this.onTextChange(null); + } + + override public function remove() : void + { + _tText.removeEventListener(Event.CHANGE,this.onTextChange); + _tText.removeEventListener(TextEvent.TEXT_INPUT,this.onTextInput); + _tText.removeEventListener(KeyboardEvent.KEY_UP,this.onKeyUp); + _tText.removeEventListener(KeyboardEvent.KEY_DOWN,this.onKeyDown); + this._inputHistory.length = 0; + this._currentHyperlinkCodes.length = 0; + if(this._timerFormatDelay) + { + this._timerFormatDelay.removeEventListener(TimerEvent.TIMER_COMPLETE,this.onTimerFormatDelay); + } + super.remove(); + } + + override public function free() : void + { + if(this._timerFormatDelay) + { + this._timerFormatDelay.removeEventListener(TimerEvent.TIMER_COMPLETE,this.onTimerFormatDelay); + } + super.free(); + } + + private function undo() : void + { + if((this._deleting) && _tText.text.length == 0) + { + this._inputHistory.pop(); + } + if(this._chatHistoryText) + { + return; + } + if(this._inputHistory.length > 0) + { + if(!this._undoing && !this._redoing) + { + this._historyCurrentIndex = this._inputHistory.length - 1; + } + else if(this._historyCurrentIndex > 0) { - if (((!(this._undoing)) && (!(this._redoing)))) - { - this._historyCurrentIndex = (this._inputHistory.length - 1); - } - else - { - if (this._historyCurrentIndex > 0) - { - this._historyCurrentIndex--; - } - else - { - this._historyCurrentIndex = -1; - _tText.text = ((this._isNumericInput) ? "0" : ""); - this._historyEntryHyperlinkCodes = null; - this._undoing = true; - this._redoing = false; - this._deleting = false; - this.onTextChange(null); - return; - }; - }; - if (((((this._historyCurrentIndex + 1) > (this._inputHistory.length - 1))) && (!(this.wasHistoryText())))) - { - this.addHistory(_tText.text); - }; - _tText.text = this._inputHistory[this._historyCurrentIndex].text; - this._historyEntryHyperlinkCodes = this._inputHistory[this._historyCurrentIndex].hyperlinkCodes; - this._currentHyperlinkCodes.length = 0; + this._historyCurrentIndex--; } else { - if (_tText.text.length > 0) - { - this.addHistory(_tText.text); - }; - this._historyCurrentIndex = -1; - _tText.text = ((this._isNumericInput) ? "0" : ""); - this._historyEntryHyperlinkCodes = null; - }; - caretIndex = -1; - this._undoing = true; - this._redoing = false; - this._deleting = false; - this.onTextChange(null); - } - - private function redo():void - { - if (this._chatHistoryText) - { - return; - }; - if ((((this._inputHistory.length > 0)) && ((this._historyCurrentIndex < (this._inputHistory.length - 1))))) - { - _tText.text = this._inputHistory[++this._historyCurrentIndex].text; - this._historyEntryHyperlinkCodes = this._inputHistory[this._historyCurrentIndex].hyperlinkCodes; - this._currentHyperlinkCodes.length = 0; - caretIndex = -1; - this._redoing = true; - this._undoing = false; - this._deleting = false; - this.onTextChange(null); - }; - } - - private function addHistory(pText:String):void - { - var hyperlinkCodes:Vector. = this.getHyperLinkCodes(); - var entry:InputEntry = new InputEntry(pText, hyperlinkCodes); - if (this._inputHistory.length < UNDO_MAX_SIZE) + this._historyCurrentIndex = -1; + _tText.text = this._isNumericInput?"0":""; + this._historyEntryHyperlinkCodes = null; + this._undoing = true; + this._redoing = false; + this._deleting = false; + this.onTextChange(null); + return; + } + + if(this._historyCurrentIndex + 1 > this._inputHistory.length - 1 && !this.wasHistoryText()) { - this._inputHistory.push(entry); + this.addHistory(_tText.text); } - else + _tText.text = this._inputHistory[this._historyCurrentIndex].text; + this._historyEntryHyperlinkCodes = this._inputHistory[this._historyCurrentIndex].hyperlinkCodes; + this._currentHyperlinkCodes.length = 0; + } + else + { + if(_tText.text.length > 0) { - this._inputHistory.shift(); - this._inputHistory.push(entry); - if (this._historyCurrentIndex > 0) - { - this._historyCurrentIndex--; - }; - }; + this.addHistory(_tText.text); + } + this._historyCurrentIndex = -1; + _tText.text = this._isNumericInput?"0":""; this._historyEntryHyperlinkCodes = null; + } + caretIndex = -1; + this._undoing = true; + this._redoing = false; + this._deleting = false; + this.onTextChange(null); + } + + private function redo() : void + { + if(this._chatHistoryText) + { + return; + } + if(this._inputHistory.length > 0 && this._historyCurrentIndex < this._inputHistory.length - 1) + { + _tText.text = this._inputHistory[++this._historyCurrentIndex].text; + this._historyEntryHyperlinkCodes = this._inputHistory[this._historyCurrentIndex].hyperlinkCodes; this._currentHyperlinkCodes.length = 0; - } - - private function checkClearHistory():Boolean - { - var nextIndex:int; - if (((((this._undoing) || (this._redoing))) && (this.wasHistoryText()))) - { - nextIndex = (this._historyCurrentIndex + 1); - this._inputHistory.splice(nextIndex, (this._inputHistory.length - nextIndex)); - this._historyCurrentIndex = (this._inputHistory.length - 1); - return (true); - }; - return (false); - } - - private function wasHistoryText():Boolean - { - return ((((this._inputHistory.length > 0)) && (((((((!((this._historyCurrentIndex == -1))) && ((this._historyCurrentIndex <= (this._inputHistory.length - 1))))) && ((this._lastTextOnInput == this._inputHistory[this._historyCurrentIndex].text)))) || ((((this._historyCurrentIndex == -1)) && ((((this._lastTextOnInput == "")) || ((this._lastTextOnInput == "0")))))))))); - } - - private function deletePreviousWord():void - { - var s:Array = _tText.text.split(" "); - s.pop(); - _tText.text = s.join(" "); - if (this.checkClearHistory()) - { - this._inputHistory.pop(); - }; - this._undoing = (this._deleting = (this._redoing = (this._chatHistoryText = false))); + caretIndex = -1; + this._redoing = true; + this._undoing = false; + this._deleting = false; this.onTextChange(null); - } - - override public function focus():void - { - Berilia.getInstance().docMain.stage.focus = _tText; - FocusHandler.getInstance().setFocus(_tText); - } - - public function blur():void - { - Berilia.getInstance().docMain.stage.focus = null; - FocusHandler.getInstance().setFocus(null); - } - - [HideInFakeClass] - override public function process(msg:Message):Boolean - { - var delta:int; - var inc:int; - var newValue:int; - var kdmsg:KeyboardKeyDownMessage; - if ((((msg is MouseClickMessage)) && ((MouseClickMessage(msg).target == this)))) - { - this.focus(); - }; - var tfIntValue:int = parseInt(text.split(" ").join("").split(" ").join("").split(this._numberSeparator).join("")); - if ((((((msg is MouseWheelMessage)) && (!(disabled)))) && ((tfIntValue.toString(10) == text.split(" ").join("").split(" ").join("").split(this._numberSeparator).join(""))))) - { - delta = ((((msg as MouseWheelMessage).mouseEvent.delta > 0)) ? 1 : -1); - inc = (((Math.abs(tfIntValue) > 99)) ? Math.pow(10, ((tfIntValue + delta).toString(10).length - 2)) : 1); - if (ShortcutsFrame.ctrlKey) - { - inc = 1; - }; - newValue = (tfIntValue + (delta * inc)); - newValue = (((newValue < 0)) ? 0 : newValue); - if ((((this._nNumberMax > 0)) && ((newValue > this._nNumberMax)))) - { - newValue = this._nNumberMax; - }; - this.text = newValue.toString(); - }; - if (((!(this.password)) && (this.haveFocus))) - { - if ((msg is KeyboardKeyDownMessage)) - { - kdmsg = (msg as KeyboardKeyDownMessage); - if (((((kdmsg.keyboardEvent.ctrlKey) && ((kdmsg.keyboardEvent.keyCode == Keyboard.Z)))) && (!(kdmsg.keyboardEvent.shiftKey)))) - { - this.undo(); - } - else - { - if (((((kdmsg.keyboardEvent.shiftKey) && (kdmsg.keyboardEvent.ctrlKey))) && ((kdmsg.keyboardEvent.keyCode == Keyboard.Z)))) - { - this.redo(); - } - else - { - if (((((((((((!((kdmsg.keyboardEvent.keyCode == Keyboard.ENTER))) && (!((kdmsg.keyboardEvent.keyCode == Keyboard.BACKSPACE))))) && (!(kdmsg.keyboardEvent.ctrlKey)))) && (!(((kdmsg.keyboardEvent.shiftKey) && ((kdmsg.keyboardEvent.keyCode == Keyboard.SHIFT))))))) && (!((kdmsg.keyboardEvent.keyCode == Keyboard.UP))))) && (!((kdmsg.keyboardEvent.keyCode == Keyboard.DOWN))))) - { - this._undoing = (this._deleting = (this._redoing = (this._chatHistoryText = false))); - }; - }; - }; - }; - }; - return (super.process(msg)); - } - - public function setSelection(start:int, end:int):void - { - this._nSelectionStart = start; - this._nSelectionEnd = end; - _tText.setSelection(this._nSelectionStart, this._nSelectionEnd); - } - - public function addHyperLinkCode(pHyperlinkCode:String):void - { - this._currentHyperlinkCodes.push(pHyperlinkCode); - } - - public function getHyperLinkCodes():Vector. - { - var hyperlinkCodes:Vector.; - if (!(this._historyEntryHyperlinkCodes)) - { - hyperlinkCodes = this._currentHyperlinkCodes.concat(); + } + } + + private function addHistory(param1:String) : void + { + var _loc2_:Vector. = this.getHyperLinkCodes(); + var _loc3_:InputEntry = new InputEntry(param1,_loc2_); + if(this._inputHistory.length < UNDO_MAX_SIZE) + { + this._inputHistory.push(_loc3_); + } + else + { + this._inputHistory.shift(); + this._inputHistory.push(_loc3_); + if(this._historyCurrentIndex > 0) + { + this._historyCurrentIndex--; } - else - { - hyperlinkCodes = this._historyEntryHyperlinkCodes.concat(this._currentHyperlinkCodes); - }; - return (hyperlinkCodes); - } - - private function onTextChange(e:Event):void - { - var pattern0:RegExp; - var tempString:String; - var toInt:Number; - if (this._nNumberMax > 0) - { - pattern0 = /[0-9 ]+/g; - tempString = this.removeSpace(_tText.text); - toInt = parseFloat(tempString); - if (((!(isNaN(toInt))) && (pattern0.test(_tText.text)))) - { - if (toInt > this._nNumberMax) - { - _tText.text = (this._nNumberMax + ""); - }; - }; - }; - var sameText:Boolean; - if (this._lastTextOnInput != null) - { - if (this._isNumericInput) - { - sameText = (StringUtils.kamasToString(StringUtils.stringToKamas(this._lastTextOnInput, ""), "") == StringUtils.kamasToString(StringUtils.stringToKamas(_tText.text, ""), "")); - } - else - { - sameText = (this._lastTextOnInput == _tText.text); - }; - }; - if (!(sameText)) - { - LogFrame.log(LogTypeEnum.KEYBOARD_INPUT, new KeyboardInput(customUnicName, _strReplace.substr(0, _tText.text.length))); - if (((!(this._sendingText)) && (!(this._chatHistoryText)))) - { - this.checkClearHistory(); - if (((((((((this._lastTextOnInput) && (!(this._deleting)))) && (!(this._redoing)))) && (!(this._undoing)))) && ((this._lastTextOnInput.length > _tText.text.length)))) - { - this.addHistory(this._lastTextOnInput); - }; - if (((this._deleting) && ((_tText.text.length == 0)))) - { - this.addHistory(((this._isNumericInput) ? "0" : "")); - this._historyCurrentIndex = (this._inputHistory.length - 1); - this._historyEntryHyperlinkCodes = null; - }; - }; - }; - this._lastTextOnInput = _tText.text; - this._sendingText = false; - if (this._timerFormatDelay) - { - this._timerFormatDelay.reset(); - this._timerFormatDelay.start(); - }; - this._nSelectionStart = 0; - this._nSelectionEnd = 0; - Berilia.getInstance().handler.process(new ChangeMessage(InteractiveObject(this))); - } - - private function onTextInput(pEvent:TextEvent):void - { - if (pEvent.text.length > 1) - { - this.checkClearHistory(); - if (((((((((!(this._undoing)) && (!(this._redoing)))) && (!(this._deleting)))) && (!((this._lastTextOnInput == null))))) && (((_tText.text.length + pEvent.text.length) > this._lastTextOnInput.length)))) - { - this.addHistory(this._lastTextOnInput); - }; - this._undoing = (this._deleting = (this._redoing = (this._chatHistoryText = false))); - }; - } - - private function onKeyUp(pEvent:KeyboardEvent):void - { - if ((((((pEvent.keyCode == Keyboard.ENTER)) && (!((XmlConfig.getInstance().getEntry("config.lang.current") == "ja"))))) && (!(((((((((pEvent.altKey) || (pEvent.shiftKey))) || (pEvent.ctrlKey))) || (((pEvent.hasOwnProperty("controlKey")) && (pEvent.controlKey))))) || (((pEvent.hasOwnProperty("commandKey")) && (pEvent.commandKey)))))))) + } + this._historyEntryHyperlinkCodes = null; + this._currentHyperlinkCodes.length = 0; + } + + private function checkClearHistory() : Boolean + { + var _loc1_:* = 0; + if(((this._undoing) || (this._redoing)) && (this.wasHistoryText())) + { + _loc1_ = this._historyCurrentIndex + 1; + this._inputHistory.splice(_loc1_,this._inputHistory.length - _loc1_); + this._historyCurrentIndex = this._inputHistory.length - 1; + return true; + } + return false; + } + + private function wasHistoryText() : Boolean + { + return this._inputHistory.length > 0 && (!(this._historyCurrentIndex == -1) && this._historyCurrentIndex <= this._inputHistory.length - 1 && this._lastTextOnInput == this._inputHistory[this._historyCurrentIndex].text || this._historyCurrentIndex == -1 && (this._lastTextOnInput == "" || this._lastTextOnInput == "0")); + } + + private function deletePreviousWord() : void + { + var _loc1_:Array = _tText.text.split(" "); + _loc1_.pop(); + _tText.text = _loc1_.join(" "); + if(this.checkClearHistory()) + { + this._inputHistory.pop(); + } + this._undoing = this._deleting = this._redoing = this._chatHistoryText = false; + this.onTextChange(null); + } + + override public function focus() : void + { + Berilia.getInstance().docMain.stage.focus = _tText; + FocusHandler.getInstance().setFocus(_tText); + } + + public function blur() : void + { + Berilia.getInstance().docMain.stage.focus = null; + FocusHandler.getInstance().setFocus(null); + } + + override public function process(param1:Message) : Boolean + { + var _loc3_:* = 0; + var _loc4_:* = 0; + var _loc5_:* = 0; + var _loc6_:KeyboardKeyDownMessage = null; + if(param1 is MouseClickMessage && MouseClickMessage(param1).target == this) + { + this.focus(); + } + var _loc2_:int = parseInt(text.split(" ").join("").split(" ").join("").split(this._numberSeparator).join("")); + if(param1 is MouseWheelMessage && !disabled && _loc2_.toString(10) == text.split(" ").join("").split(" ").join("").split(this._numberSeparator).join("")) + { + _loc3_ = (param1 as MouseWheelMessage).mouseEvent.delta > 0?1:-1; + _loc4_ = Math.abs(_loc2_) > 99?Math.pow(10,(_loc2_ + _loc3_).toString(10).length - 2):1; + if(ShortcutsFrame.ctrlKey) + { + _loc4_ = 1; + } + _loc5_ = _loc2_ + _loc3_ * _loc4_; + _loc5_ = _loc5_ < 0?0:_loc5_; + if(this._nNumberMax > 0 && _loc5_ > this._nNumberMax) { - this._sendingText = true; - this._inputHistory.length = 0; - this._historyCurrentIndex = 0; - }; - } - - private function onKeyDown(pEvent:KeyboardEvent):void - { - if (((((((!(pEvent.altKey)) && (!(pEvent.shiftKey)))) && (pEvent.ctrlKey))) && ((pEvent.keyCode == Keyboard.Y)))) + _loc5_ = this._nNumberMax; + } + this.text = _loc5_.toString(); + } + if(!this.password && (this.haveFocus)) + { + if(param1 is KeyboardKeyDownMessage) + { + _loc6_ = param1 as KeyboardKeyDownMessage; + if((_loc6_.keyboardEvent.ctrlKey) && _loc6_.keyboardEvent.keyCode == Keyboard.Z && !_loc6_.keyboardEvent.shiftKey) + { + this.undo(); + } + else if((_loc6_.keyboardEvent.shiftKey) && (_loc6_.keyboardEvent.ctrlKey) && _loc6_.keyboardEvent.keyCode == Keyboard.Z) + { + this.redo(); + } + else if(!(_loc6_.keyboardEvent.keyCode == Keyboard.ENTER) && !(_loc6_.keyboardEvent.keyCode == Keyboard.BACKSPACE) && !_loc6_.keyboardEvent.ctrlKey && !((_loc6_.keyboardEvent.shiftKey) && _loc6_.keyboardEvent.keyCode == Keyboard.SHIFT) && !(_loc6_.keyboardEvent.keyCode == Keyboard.UP) && !(_loc6_.keyboardEvent.keyCode == Keyboard.DOWN)) + { + this._undoing = this._deleting = this._redoing = this._chatHistoryText = false; + } + + + } + } + return super.process(param1); + } + + public function setSelection(param1:int, param2:int) : void + { + this._nSelectionStart = param1; + this._nSelectionEnd = param2; + _tText.setSelection(this._nSelectionStart,this._nSelectionEnd); + } + + public function addHyperLinkCode(param1:String) : void + { + this._currentHyperlinkCodes.push(param1); + } + + public function getHyperLinkCodes() : Vector. + { + var _loc1_:Vector. = null; + if(!this._historyEntryHyperlinkCodes) + { + _loc1_ = this._currentHyperlinkCodes.concat(); + } + else + { + _loc1_ = this._historyEntryHyperlinkCodes.concat(this._currentHyperlinkCodes); + } + return _loc1_; + } + + private function onTextChange(param1:Event) : void + { + var _loc3_:RegExp = null; + var _loc4_:String = null; + var _loc5_:* = NaN; + if(this._nNumberMax > 0) + { + _loc3_ = new RegExp("[0-9 ]+","g"); + _loc4_ = this.removeSpace(_tText.text); + _loc5_ = parseFloat(_loc4_); + if(!isNaN(_loc5_) && (_loc3_.test(_tText.text))) + { + if(_loc5_ > this._nNumberMax) + { + _tText.text = this._nNumberMax + ""; + } + } + } + var _loc2_:* = false; + if(this._lastTextOnInput != null) + { + if(this._isNumericInput) { - pEvent.preventDefault(); - pEvent.stopImmediatePropagation(); - this.redo(); + _loc2_ = StringUtils.kamasToString(StringUtils.stringToKamas(this._lastTextOnInput,""),"") == StringUtils.kamasToString(StringUtils.stringToKamas(_tText.text,""),""); } else { - if (((((((!(pEvent.altKey)) && (!(pEvent.shiftKey)))) && (pEvent.ctrlKey))) && ((pEvent.keyCode == Keyboard.BACKSPACE)))) - { - pEvent.preventDefault(); - pEvent.stopImmediatePropagation(); - this.deletePreviousWord(); - } - else - { - if ((((pEvent.keyCode == Keyboard.UP)) || ((pEvent.keyCode == Keyboard.DOWN)))) - { - this._chatHistoryText = true; - this._undoing = (this._redoing = (this._deleting = false)); - this._inputHistory.length = 0; - this._historyCurrentIndex = 0; - } - else - { - if (pEvent.keyCode == Keyboard.BACKSPACE) - { - this._chatHistoryText = false; - if (!(this._deleting)) - { - this._deleting = true; - this._undoing = (this._redoing = false); - if (this._lastTextOnInput) - { - this.addHistory(this._lastTextOnInput); - }; - }; - }; - }; - }; - }; - } - - public function removeSpace(spaced:String):String - { - var str2:String; - var tmp:String = spaced; - var pattern1:RegExp = new RegExp(regSpace); - do - { - str2 = tmp; - tmp = str2.replace(pattern1, ""); - } while (str2 != tmp); - do - { - str2 = tmp; - tmp = str2.replace(this._numberSeparator, ""); - } while (str2 != tmp); - return (str2); - } - - private function onTimerFormatDelay(e:TimerEvent):void - { - var newStringWithSpaces:String; - this._timerFormatDelay.removeEventListener(TimerEvent.TIMER, this.onTimerFormatDelay); - var caret:int = caretIndex; - var startText:String = _tText.text; - var i:int; - this._nSelectionStart = _tText.selectionBeginIndex; - this._nSelectionEnd = _tText.selectionEndIndex; - i = 0; - while (i < (_tText.length - 1)) - { - if ((((startText.charAt(i) == this._numberSeparator)) || ((startText.charAt(i) == " ")))) - { - if (i < caret) - { - caret--; - }; - if (i < this._nSelectionStart) - { - this._nSelectionStart--; - }; - if (i < this._nSelectionEnd) - { - this._nSelectionEnd--; - }; - }; - i++; - }; - var tempString:String = this.removeSpace(startText); - var toInt:Number = parseFloat(tempString); - if (((toInt) && (!(isNaN(toInt))))) - { - newStringWithSpaces = StringUtils.formateIntToString(toInt); - i = 0; - while (i < (newStringWithSpaces.length - 1)) - { - if (newStringWithSpaces.charAt(i) == this._numberSeparator) - { - if (i < caret) - { - caret++; - }; - if (i < this._nSelectionStart) - { - this._nSelectionStart++; - }; - if (i < this._nSelectionEnd) - { - this._nSelectionEnd++; - }; - }; - i++; - }; - super.text = newStringWithSpaces; - caretIndex = caret; - }; - if (this._nSelectionStart != this._nSelectionEnd) + _loc2_ = this._lastTextOnInput == _tText.text; + } + } + if(!_loc2_) + { + LogFrame.log(LogTypeEnum.KEYBOARD_INPUT,new KeyboardInput(customUnicName,_strReplace.substr(0,_tText.text.length))); + if(!this._sendingText && !this._chatHistoryText) + { + this.checkClearHistory(); + if((this._lastTextOnInput && !this._deleting && !this._redoing) && (!this._undoing) && this._lastTextOnInput.length > _tText.text.length) + { + this.addHistory(this._lastTextOnInput); + } + if((this._deleting) && _tText.text.length == 0) + { + this.addHistory(this._isNumericInput?"0":""); + this._historyCurrentIndex = this._inputHistory.length - 1; + this._historyEntryHyperlinkCodes = null; + } + } + } + this._lastTextOnInput = _tText.text; + this._sendingText = false; + if(this._timerFormatDelay) + { + this._timerFormatDelay.reset(); + this._timerFormatDelay.start(); + } + this._nSelectionStart = 0; + this._nSelectionEnd = 0; + Berilia.getInstance().handler.process(new ChangeMessage(InteractiveObject(this))); + } + + private function onTextInput(param1:TextEvent) : void + { + if(param1.text.length > 1) + { + this.checkClearHistory(); + if(!this._undoing && !this._redoing && !this._deleting && !(this._lastTextOnInput == null) && _tText.text.length + param1.text.length > this._lastTextOnInput.length) { - _tText.setSelection(this._nSelectionStart, this._nSelectionEnd); - }; - } - - - } -}//package com.ankamagames.berilia.components - -import __AS3__.vec.Vector; - -class InputEntry + this.addHistory(this._lastTextOnInput); + } + this._undoing = this._deleting = this._redoing = this._chatHistoryText = false; + } + } + + private function onKeyUp(param1:KeyboardEvent) : void + { + if(param1.keyCode == Keyboard.ENTER && !(XmlConfig.getInstance().getEntry("config.lang.current") == "ja") && !((param1.altKey) || (param1.shiftKey) || (param1.ctrlKey) || (param1.hasOwnProperty("controlKey")) && (param1.controlKey) || (param1.hasOwnProperty("commandKey")) && (param1.commandKey))) + { + this._sendingText = true; + this._inputHistory.length = 0; + this._historyCurrentIndex = 0; + } + } + + private function onKeyDown(param1:KeyboardEvent) : void + { + if(!param1.altKey && !param1.shiftKey && (param1.ctrlKey) && param1.keyCode == Keyboard.Y) + { + param1.preventDefault(); + param1.stopImmediatePropagation(); + this.redo(); + } + else if(!param1.altKey && !param1.shiftKey && (param1.ctrlKey) && param1.keyCode == Keyboard.BACKSPACE) + { + param1.preventDefault(); + param1.stopImmediatePropagation(); + this.deletePreviousWord(); + } + else if(param1.keyCode == Keyboard.UP || param1.keyCode == Keyboard.DOWN) + { + this._chatHistoryText = true; + this._undoing = this._redoing = this._deleting = false; + this._inputHistory.length = 0; + this._historyCurrentIndex = 0; + } + else if(param1.keyCode == Keyboard.BACKSPACE) + { + this._chatHistoryText = false; + if(!this._deleting) + { + this._deleting = true; + this._undoing = this._redoing = false; + if(this._lastTextOnInput) + { + this.addHistory(this._lastTextOnInput); + } + } + } + + + + } + + public function removeSpace(param1:String) : String + { + var _loc2_:String = null; + var _loc3_:String = param1; + var _loc4_:RegExp = new RegExp(regSpace); + do + { + _loc2_ = _loc3_; + _loc3_ = _loc2_.replace(_loc4_,""); + } + while(_loc2_ != _loc3_); + + do + { + _loc2_ = _loc3_; + _loc3_ = _loc2_.replace(this._numberSeparator,""); + } + while(_loc2_ != _loc3_); + + return _loc2_; + } + + private function onTimerFormatDelay(param1:TimerEvent) : void + { + var _loc7_:String = null; + this._timerFormatDelay.removeEventListener(TimerEvent.TIMER,this.onTimerFormatDelay); + var _loc2_:int = caretIndex; + var _loc3_:String = _tText.text; + var _loc4_:* = 0; + this._nSelectionStart = _tText.selectionBeginIndex; + this._nSelectionEnd = _tText.selectionEndIndex; + _loc4_ = 0; + while(_loc4_ < _tText.length - 1) + { + if(_loc3_.charAt(_loc4_) == this._numberSeparator || _loc3_.charAt(_loc4_) == " ") + { + if(_loc4_ < _loc2_) + { + _loc2_--; + } + if(_loc4_ < this._nSelectionStart) + { + this._nSelectionStart--; + } + if(_loc4_ < this._nSelectionEnd) + { + this._nSelectionEnd--; + } + } + _loc4_++; + } + var _loc5_:String = this.removeSpace(_loc3_); + var _loc6_:Number = parseFloat(_loc5_); + if((_loc6_) && !isNaN(_loc6_)) + { + _loc7_ = StringUtils.formateIntToString(_loc6_); + _loc4_ = 0; + while(_loc4_ < _loc7_.length - 1) + { + if(_loc7_.charAt(_loc4_) == this._numberSeparator) + { + if(_loc4_ < _loc2_) + { + _loc2_++; + } + if(_loc4_ < this._nSelectionStart) + { + this._nSelectionStart++; + } + if(_loc4_ < this._nSelectionEnd) + { + this._nSelectionEnd++; + } + } + _loc4_++; + } + super.text = _loc7_; + caretIndex = _loc2_; + } + if(this._nSelectionStart != this._nSelectionEnd) + { + _tText.setSelection(this._nSelectionStart,this._nSelectionEnd); + } + } + } +} +class InputEntry extends Object { - - /*private*/ var _text:String; - /*private*/ var _hyperlinkCodes:Vector.; - - public function InputEntry(pText:String, pHyperlinkCodes:Vector.) - { - this._text = pText; - this._hyperlinkCodes = pHyperlinkCodes; - } - - public function get text():String - { - return (this._text); - } - - public function get hyperlinkCodes():Vector. - { - return (this._hyperlinkCodes); - } - - + + function InputEntry(param1:String, param2:Vector.) + { + super(); + this._text = param1; + this._hyperlinkCodes = param2; + } + + private var _text:String; + + private var _hyperlinkCodes:Vector.; + + public function get text() : String + { + return this._text; + } + + public function get hyperlinkCodes() : Vector. + { + return this._hyperlinkCodes; + } } - diff --git a/com/ankamagames/berilia/components/InputComboBox.as b/com/ankamagames/berilia/components/InputComboBox.as index 221a409cf..9e46e9467 100644 --- a/com/ankamagames/berilia/components/InputComboBox.as +++ b/com/ankamagames/berilia/components/InputComboBox.as @@ -1,268 +1,258 @@ -package com.ankamagames.berilia.components +package com.ankamagames.berilia.components { - import com.ankamagames.berilia.FinalizableUIComponent; - import com.ankamagames.jerakine.types.Uri; - import com.ankamagames.berilia.types.graphic.GraphicElement; - import com.ankamagames.berilia.enums.StatesEnum; - import com.ankamagames.jerakine.handlers.messages.keyboard.KeyboardMessage; - import flash.ui.Keyboard; - import com.ankamagames.berilia.enums.SelectMethodEnum; - import com.ankamagames.jerakine.handlers.messages.keyboard.KeyboardKeyUpMessage; - import com.ankamagames.berilia.components.messages.SelectItemMessage; - import com.ankamagames.jerakine.messages.Message; - import __AS3__.vec.Vector; - import com.ankamagames.jerakine.handlers.FocusHandler; - import __AS3__.vec.*; - - public class InputComboBox extends ComboBox implements FinalizableUIComponent - { - - private var _origDataProvider; - - public function InputComboBox() - { - _mainContainer = new Input(); - _dataNameField = ""; - } - - public function get input():Input - { - if (!(_mainContainer)) - { - return (null); - }; - return ((_mainContainer as Input)); - } - - public function set maxChars(nValue:uint):void - { - (_mainContainer as Input).maxChars = nValue; - } - - public function set restrictChars(sValue:String):void - { - (_mainContainer as Input).restrictChars = sValue; - } - - public function get restrictChars():String - { - return ((_mainContainer as Input).restrictChars); - } - - public function set cssClass(c:String):void - { - (_mainContainer as Input).cssClass = c; - } - - public function get cssClass():String - { - return ((_mainContainer as Input).cssClass); - } - - public function get css():Uri - { - return ((_mainContainer as Input).css); - } - - public function set css(sFile:Uri):void - { - (_mainContainer as Input).css = sFile; - } - - override public function get dataProvider() - { - return (_list.dataProvider); - } - - override public function set dataProvider(data:*):void - { - this._origDataProvider = data; - super.dataProvider = data; - if (((!(this._origDataProvider)) || ((this._origDataProvider.length == 0)))) - { - this.showList(false); - _button.visible = false; - } - else - { - _button.visible = true; - }; - } - - override public function finalize():void - { - _button.width = width; - _button.height = height; + import com.ankamagames.berilia.FinalizableUIComponent; + import com.ankamagames.jerakine.types.Uri; + import com.ankamagames.berilia.types.graphic.GraphicElement; + import com.ankamagames.berilia.enums.StatesEnum; + import com.ankamagames.jerakine.messages.Message; + import com.ankamagames.jerakine.handlers.messages.keyboard.KeyboardMessage; + import flash.ui.Keyboard; + import com.ankamagames.berilia.enums.SelectMethodEnum; + import com.ankamagames.berilia.components.messages.SelectItemMessage; + import com.ankamagames.jerakine.handlers.messages.keyboard.KeyboardKeyUpMessage; + import com.ankamagames.jerakine.handlers.FocusHandler; + + public class InputComboBox extends ComboBox implements FinalizableUIComponent + { + + public function InputComboBox() + { + super(); + _mainContainer = new Input(); + _dataNameField = ""; + } + + private var _origDataProvider; + + public function get input() : Input + { + if(!_mainContainer) + { + return null; + } + return _mainContainer as Input; + } + + public function set maxChars(param1:uint) : void + { + (_mainContainer as Input).maxChars = param1; + } + + public function set restrictChars(param1:String) : void + { + (_mainContainer as Input).restrictChars = param1; + } + + public function get restrictChars() : String + { + return (_mainContainer as Input).restrictChars; + } + + public function set cssClass(param1:String) : void + { + (_mainContainer as Input).cssClass = param1; + } + + public function get cssClass() : String + { + return (_mainContainer as Input).cssClass; + } + + public function get css() : Uri + { + return (_mainContainer as Input).css; + } + + public function set css(param1:Uri) : void + { + (_mainContainer as Input).css = param1; + } + + override public function get dataProvider() : * + { + return _list.dataProvider; + } + + override public function set dataProvider(param1:*) : void + { + this._origDataProvider = param1; + super.dataProvider = param1; + if(!this._origDataProvider || this._origDataProvider.length == 0) + { + this.showList(false); _button.visible = false; - _bgTexture.width = width; - _bgTexture.height = height; - _bgTexture.autoGrid = true; - _bgTexture.finalize(); - _button.addChild(_bgTexture); - getUi().registerId(_bgTexture.name, new GraphicElement(_bgTexture, new Array(), _bgTexture.name)); - var stateChangingProperties:Array = new Array(); - stateChangingProperties[StatesEnum.STATE_OVER] = new Array(); - stateChangingProperties[StatesEnum.STATE_OVER][_mainContainer.name] = new Array(); - stateChangingProperties[StatesEnum.STATE_OVER][_mainContainer.name]["gotoAndStop"] = StatesEnum.STATE_OVER_STRING.toLocaleLowerCase(); - stateChangingProperties[StatesEnum.STATE_CLICKED] = new Array(); - stateChangingProperties[StatesEnum.STATE_CLICKED][_mainContainer.name] = new Array(); - stateChangingProperties[StatesEnum.STATE_CLICKED][_mainContainer.name]["gotoAndStop"] = StatesEnum.STATE_CLICKED_STRING.toLocaleLowerCase(); - _button.changingStateData = stateChangingProperties; - _button.finalize(); - _list.width = (width - listSizeOffset); - _list.width = (width - listSizeOffset); - _list.slotWidth = _list.width; - _list.slotHeight = (height - 4); - _list.x = 2; - _list.y = (height + 2); - _list.finalize(); - _listTexture.width = (_list.width + 4); - _listTexture.autoGrid = true; - _listTexture.y = (height - 2); - _listTexture.finalize(); - addChild(_button); - addChild(_listTexture); - addChild(_list); - _listTexture.mouseEnabled = false; - _list.mouseEnabled = false; - _mainContainer.x = _list.x; - _mainContainer.width = _list.width; - _mainContainer.height = height; - if (autoCenter) - { - _mainContainer.y = ((height - _mainContainer.height) / 2); - }; - addChild(_mainContainer); - _finalized = true; - getUi().iAmFinalized(this); - } - - override public function process(msg:Message):Boolean - { - var _local_2:uint; - var index:int; - var input:Input; - var _local_5:*; - switch (true) - { - case (msg is KeyboardKeyUpMessage): - _local_2 = KeyboardMessage(msg).keyboardEvent.keyCode; - if (_local_2 == Keyboard.ENTER) - { - if (_list.visible) - { - index = _list.selectedIndex; - _list.setSelectedIndex(index, SelectMethodEnum.AUTO); - input = Input(_mainContainer); - input.text = _list.selectedItem; - input.setSelection(input.text.length, input.text.length); - this.showList(false); - return (true); - }; - } - else - { - if (_local_2 == Keyboard.TAB) - { - this.showList(false); - } - else - { - if (((((((!((_local_2 == Keyboard.DOWN))) && (!((_local_2 == Keyboard.UP))))) && (!((_local_2 == Keyboard.RIGHT))))) && (!((_local_2 == Keyboard.LEFT))))) - { - this.searchStringInCB(Input(_mainContainer).text); - }; - }; - }; - break; - case (msg is SelectItemMessage): - switch (SelectItemMessage(msg).selectMethod) - { - case SelectMethodEnum.CLICK: - _local_5 = _list.selectedItem; - if (((!((_local_5 is String))) && (!((_local_5 == null))))) - { - _local_5 = _local_5[_dataNameField]; - }; - (_mainContainer as Input).text = _local_5; - if (closeOnClick) - { - this.showList(false); - }; - break; - case SelectMethodEnum.UP_ARROW: - case SelectMethodEnum.DOWN_ARROW: - case SelectMethodEnum.RIGHT_ARROW: - case SelectMethodEnum.LEFT_ARROW: - case SelectMethodEnum.SEARCH: - case SelectMethodEnum.AUTO: - case SelectMethodEnum.MANUAL: - break; - default: - this.showList(false); - }; - break; - default: - super.process(msg); - }; - return (false); - } - - override protected function showList(show:Boolean):void - { - super.dataProvider = this._origDataProvider; - super.showList(show); - } - - override protected function searchStringInCB(searchPhrase:String, startIndex:int=0):void - { - var cleanphrase:String; - var newDtp:Vector.; - var label:String; - if (FocusHandler.getInstance().getFocus() == Input(_mainContainer).textfield) - { - cleanphrase = this.cleanString(searchPhrase); - if (cleanphrase != "") - { - newDtp = new Vector.(); - for each (label in this._origDataProvider) - { - if (label.indexOf(cleanphrase) == 0) - { - newDtp.push(label); - }; - }; - super.dataProvider = newDtp; - if (newDtp.length == 0) - { + } + else + { + _button.visible = true; + } + } + + override public function finalize() : void + { + _button.width = width; + _button.height = height; + _button.visible = false; + _bgTexture.width = width; + _bgTexture.height = height; + _bgTexture.autoGrid = true; + _bgTexture.finalize(); + _button.addChild(_bgTexture); + getUi().registerId(_bgTexture.name,new GraphicElement(_bgTexture,new Array(),_bgTexture.name)); + var _loc1_:Array = new Array(); + _loc1_[StatesEnum.STATE_OVER] = new Array(); + _loc1_[StatesEnum.STATE_OVER][_mainContainer.name] = new Array(); + _loc1_[StatesEnum.STATE_OVER][_mainContainer.name]["gotoAndStop"] = StatesEnum.STATE_OVER_STRING.toLocaleLowerCase(); + _loc1_[StatesEnum.STATE_CLICKED] = new Array(); + _loc1_[StatesEnum.STATE_CLICKED][_mainContainer.name] = new Array(); + _loc1_[StatesEnum.STATE_CLICKED][_mainContainer.name]["gotoAndStop"] = StatesEnum.STATE_CLICKED_STRING.toLocaleLowerCase(); + _button.changingStateData = _loc1_; + _button.finalize(); + _list.width = width - listSizeOffset; + _list.width = width - listSizeOffset; + _list.slotWidth = _list.width; + _list.slotHeight = height - 4; + _list.x = 2; + _list.y = height + 2; + _list.finalize(); + _listTexture.width = _list.width + 4; + _listTexture.autoGrid = true; + _listTexture.y = height - 2; + _listTexture.finalize(); + addChild(_button); + addChild(_listTexture); + addChild(_list); + _listTexture.mouseEnabled = false; + _list.mouseEnabled = false; + _mainContainer.x = _list.x; + _mainContainer.width = _list.width; + _mainContainer.height = height; + if(autoCenter) + { + _mainContainer.y = (height - _mainContainer.height) / 2; + } + addChild(_mainContainer); + _finalized = true; + getUi().iAmFinalized(this); + } + + override public function process(param1:Message) : Boolean + { + var _loc2_:uint = 0; + var _loc3_:* = 0; + var _loc4_:Input = null; + var _loc5_:* = undefined; + switch(true) + { + case param1 is KeyboardKeyUpMessage: + _loc2_ = KeyboardMessage(param1).keyboardEvent.keyCode; + if(_loc2_ == Keyboard.ENTER) + { + if(_list.visible) + { + _loc3_ = _list.selectedIndex; + _list.setSelectedIndex(_loc3_,SelectMethodEnum.AUTO); + _loc4_ = Input(_mainContainer); + _loc4_.text = _list.selectedItem; + _loc4_.setSelection(_loc4_.text.length,_loc4_.text.length); + this.showList(false); + return true; + } + } + else if(_loc2_ == Keyboard.TAB) + { + this.showList(false); + } + else if(!(_loc2_ == Keyboard.DOWN) && !(_loc2_ == Keyboard.UP) && !(_loc2_ == Keyboard.RIGHT) && !(_loc2_ == Keyboard.LEFT)) + { + this.searchStringInCB(Input(_mainContainer).text); + } + + + break; + case param1 is SelectItemMessage: + switch(SelectItemMessage(param1).selectMethod) + { + case SelectMethodEnum.CLICK: + _loc5_ = _list.selectedItem; + if(!(_loc5_ is String) && !(_loc5_ == null)) + { + _loc5_ = _loc5_[_dataNameField]; + } + (_mainContainer as Input).text = _loc5_; + if(closeOnClick) + { this.showList(false); - }; - } - else - { - if (((!((searchPhrase == "\b"))) && (this._origDataProvider))) - { - super.dataProvider = this._origDataProvider; - if (this._origDataProvider.length > 0) - { - this.showList(true); - }; - }; - }; - }; - } - - override protected function cleanString(spaced:String):String - { - var unwantedChar:RegExp = new RegExp("\b", "g"); - if (spaced.search(unwantedChar) != -1) + } + break; + case SelectMethodEnum.UP_ARROW: + case SelectMethodEnum.DOWN_ARROW: + case SelectMethodEnum.RIGHT_ARROW: + case SelectMethodEnum.LEFT_ARROW: + case SelectMethodEnum.SEARCH: + case SelectMethodEnum.AUTO: + case SelectMethodEnum.MANUAL: + break; + default: + this.showList(false); + } + break; + default: + super.process(param1); + } + return false; + } + + override protected function showList(param1:Boolean) : void + { + super.dataProvider = this._origDataProvider; + super.showList(param1); + } + + override protected function searchStringInCB(param1:String, param2:int = 0) : void + { + var _loc3_:String = null; + var _loc4_:Vector. = null; + var _loc5_:String = null; + if(FocusHandler.getInstance().getFocus() == Input(_mainContainer).textfield) + { + _loc3_ = this.cleanString(param1); + if(_loc3_ != "") { - return (""); - }; - return (spaced); - } - - - } -}//package com.ankamagames.berilia.components - + _loc4_ = new Vector.(); + for each(_loc5_ in this._origDataProvider) + { + if(_loc5_.indexOf(_loc3_) == 0) + { + _loc4_.push(_loc5_); + } + } + super.dataProvider = _loc4_; + if(_loc4_.length == 0) + { + this.showList(false); + } + } + else if(!(param1 == "\b") && (this._origDataProvider)) + { + super.dataProvider = this._origDataProvider; + if(this._origDataProvider.length > 0) + { + this.showList(true); + } + } + + } + } + + override protected function cleanString(param1:String) : String + { + var _loc2_:RegExp = new RegExp("\b","g"); + if(param1.search(_loc2_) != -1) + { + return ""; + } + return param1; + } + } +} diff --git a/com/ankamagames/berilia/components/Label.as b/com/ankamagames/berilia/components/Label.as index 72474e446..73f69e920 100644 --- a/com/ankamagames/berilia/components/Label.as +++ b/com/ankamagames/berilia/components/Label.as @@ -1,1521 +1,1543 @@ -package com.ankamagames.berilia.components +package com.ankamagames.berilia.components { - import com.ankamagames.berilia.types.graphic.GraphicContainer; - import com.ankamagames.berilia.UIComponent; - import com.ankamagames.jerakine.interfaces.IRectangle; - import com.ankamagames.berilia.FinalizableUIComponent; - import flash.utils.Dictionary; - import com.ankamagames.jerakine.logger.Logger; - import com.ankamagames.jerakine.logger.Log; - import flash.utils.getQualifiedClassName; - import flash.text.TextField; - import com.ankamagames.jerakine.types.Uri; - import com.ankamagames.berilia.types.data.ExtendedStyleSheet; - import flash.text.TextFormat; - import flash.text.StyleSheet; - import flash.text.TextFieldType; - import com.ankamagames.berilia.factories.HyperlinkFactory; - import flash.events.MouseEvent; - import flash.text.TextFieldAutoSize; - import com.ankamagames.berilia.managers.CssManager; - import com.ankamagames.jerakine.types.Callback; - import com.ankamagames.berilia.managers.TooltipManager; - import flash.events.TextEvent; - import flash.filters.DropShadowFilter; - import flash.text.GridFitType; - import com.ankamagames.jerakine.managers.FontManager; - import flash.text.AntiAliasType; - import flash.display.DisplayObjectContainer; - import com.ankamagames.berilia.types.graphic.ButtonContainer; - import com.ankamagames.berilia.Berilia; - import com.ankamagames.berilia.components.messages.TextClickMessage; - import flash.text.TextLineMetrics; - import flash.display.Sprite; - import com.ankamagames.berilia.types.data.TextTooltipInfo; - import com.ankamagames.berilia.managers.UiModuleManager; - import com.ankamagames.berilia.types.LocationEnum; - import com.ankamagames.berilia.types.graphic.UiRootContainer; - import flash.geom.Matrix; - import flash.display.BitmapData; - import com.ankamagames.jerakine.utils.misc.StringUtils; - import flash.geom.Point; - import com.ankamagames.berilia.events.LinkInteractionEvent; - import flash.text.*; - - public class Label extends GraphicContainer implements UIComponent, IRectangle, FinalizableUIComponent - { - - public static var HEIGHT_OFFSET:int = 0; - public static var MEMORY_LOG:Dictionary = new Dictionary(true); - protected static const _log:Logger = Log.getLogger(getQualifiedClassName(Label)); - private static const VALIGN_NONE:String = "NONE"; - private static const VALIGN_TOP:String = "TOP"; - private static const VALIGN_CENTER:String = "CENTER"; - private static const VALIGN_BOTTOM:String = "BOTTOM"; - private static const VALIGN_FIXEDHEIGHT:String = "FIXEDHEIGHT"; - - private var _finalized:Boolean; - protected var _tText:TextField; - private var _cssApplied:Boolean = false; - protected var _sText:String = ""; - protected var _sType:String = "default"; - private var _binded:Boolean = false; - private var _needToFinalize:Boolean = false; - private var _lastWidth:Number = -1; - protected var _sCssUrl:Uri; - protected var _nWidth:uint = 100; - protected var _nHeight:uint = 20; - protected var _bHtmlAllowed:Boolean = true; - protected var _sAntialiasType:String = "normal"; - protected var _bFixedWidth:Boolean = true; - protected var _hyperlinkEnabled:Boolean = false; - protected var _bFixedHeight:Boolean = true; - protected var _bFixedHeightForMultiline:Boolean = false; - protected var _aStyleObj:Array; - protected var _ssSheet:ExtendedStyleSheet; - protected var _tfFormatter:TextFormat; - protected var _useEmbedFonts:Boolean = true; - protected var _nPaddingLeft:int = 0; - protected var _nTextIndent:int = 0; - protected var _bDisabled:Boolean; - protected var _nTextHeight:int; - protected var _sVerticalAlign:String = "none"; - protected var _useExtendWidth:Boolean = false; - protected var _autoResize:Boolean = true; - protected var _useStyleSheet:Boolean = false; - protected var _currentStyleSheet:StyleSheet; - protected var _useCustomFormat:Boolean = false; - protected var _neverIndent:Boolean = false; - protected var _hasHandCursor:Boolean = false; - private var _useTooltipExtension:Boolean = true; - private var _textFieldTooltipExtension:TextField; - private var _textTooltipExtensionColor:uint; - private var _mouseOverHyperLink:Boolean; - private var _lastHyperLinkId:int; - private var _hyperLinks:Array; - protected var _sCssClass:String; - - public function Label() - { - this.aStyleObj = new Array(); - this.createTextField(); - this._tText.type = TextFieldType.DYNAMIC; - this._tText.selectable = false; - this._tText.mouseEnabled = false; - MEMORY_LOG[this] = 1; - } - - public function get text():String - { - return (this._tText.text); - } - - public function set text(sValue:String):void - { - if (sValue == null) - { - sValue = ""; - }; - this._sText = sValue; - if (this._bHtmlAllowed) - { - if (this._useStyleSheet) - { - this._tText.styleSheet = null; - }; - this._tText.htmlText = sValue; - if (!(this._useCustomFormat)) - { - if (((!((this._sCssUrl == null))) && (!(this._cssApplied)))) - { - this.applyCSS(this._sCssUrl); - this._cssApplied = true; - } - else - { - this.updateCss(); - if (_bgColor != -1) - { - this.bgColor = _bgColor; - }; - }; - }; + import com.ankamagames.berilia.types.graphic.GraphicContainer; + import com.ankamagames.berilia.UIComponent; + import com.ankamagames.jerakine.interfaces.IRectangle; + import com.ankamagames.berilia.FinalizableUIComponent; + import flash.utils.Dictionary; + import com.ankamagames.jerakine.logger.Logger; + import com.ankamagames.jerakine.logger.Log; + import flash.utils.getQualifiedClassName; + import com.ankamagames.jerakine.types.Uri; + import com.ankamagames.berilia.types.data.ExtendedStyleSheet; + import com.ankamagames.berilia.factories.HyperlinkFactory; + import flash.events.MouseEvent; + import com.ankamagames.berilia.managers.CssManager; + import com.ankamagames.jerakine.types.Callback; + import com.ankamagames.berilia.managers.TooltipManager; + import flash.events.TextEvent; + import flash.text.*; + import flash.filters.DropShadowFilter; + import com.ankamagames.jerakine.managers.FontManager; + import flash.display.DisplayObjectContainer; + import com.ankamagames.berilia.types.graphic.ButtonContainer; + import com.ankamagames.berilia.Berilia; + import com.ankamagames.berilia.components.messages.TextClickMessage; + import flash.display.Sprite; + import com.ankamagames.berilia.types.data.TextTooltipInfo; + import com.ankamagames.berilia.managers.UiModuleManager; + import com.ankamagames.berilia.types.LocationEnum; + import com.ankamagames.berilia.types.graphic.UiRootContainer; + import flash.display.BitmapData; + import flash.geom.Matrix; + import com.ankamagames.jerakine.utils.misc.StringUtils; + import flash.geom.Point; + import com.ankamagames.berilia.events.LinkInteractionEvent; + + public class Label extends GraphicContainer implements UIComponent, IRectangle, FinalizableUIComponent + { + + public function Label() + { + super(); + this.aStyleObj = new Array(); + this.createTextField(); + this._tText.type = TextFieldType.DYNAMIC; + this._tText.selectable = false; + this._tText.mouseEnabled = false; + MEMORY_LOG[this] = 1; + } + + public static var HEIGHT_OFFSET:int = 0; + + public static var MEMORY_LOG:Dictionary = new Dictionary(true); + + protected static const _log:Logger = Log.getLogger(getQualifiedClassName(Label)); + + private static const VALIGN_NONE:String = "NONE"; + + private static const VALIGN_TOP:String = "TOP"; + + private static const VALIGN_CENTER:String = "CENTER"; + + private static const VALIGN_BOTTOM:String = "BOTTOM"; + + private static const VALIGN_FIXEDHEIGHT:String = "FIXEDHEIGHT"; + + private var _finalized:Boolean; + + protected var _tText:TextField; + + private var _cssApplied:Boolean = false; + + protected var _sText:String = ""; + + protected var _sType:String = "default"; + + private var _binded:Boolean = false; + + private var _needToFinalize:Boolean = false; + + private var _lastWidth:Number = -1; + + protected var _sCssUrl:Uri; + + protected var _nWidth:uint = 100; + + protected var _nHeight:uint = 20; + + protected var _bHtmlAllowed:Boolean = true; + + protected var _sAntialiasType:String = "normal"; + + protected var _bFixedWidth:Boolean = true; + + protected var _hyperlinkEnabled:Boolean = false; + + protected var _bFixedHeight:Boolean = true; + + protected var _bFixedHeightForMultiline:Boolean = false; + + protected var _aStyleObj:Array; + + protected var _ssSheet:ExtendedStyleSheet; + + protected var _tfFormatter:TextFormat; + + protected var _useEmbedFonts:Boolean = true; + + protected var _nPaddingLeft:int = 0; + + protected var _nTextIndent:int = 0; + + protected var _bDisabled:Boolean; + + protected var _nTextHeight:int; + + protected var _sVerticalAlign:String = "none"; + + protected var _useExtendWidth:Boolean = false; + + protected var _autoResize:Boolean = true; + + protected var _useStyleSheet:Boolean = false; + + protected var _currentStyleSheet:StyleSheet; + + protected var _useCustomFormat:Boolean = false; + + protected var _neverIndent:Boolean = false; + + protected var _hasHandCursor:Boolean = false; + + private var _useTooltipExtension:Boolean = true; + + private var _textFieldTooltipExtension:TextField; + + private var _textTooltipExtensionColor:uint; + + private var _mouseOverHyperLink:Boolean; + + private var _lastHyperLinkId:int; + + private var _hyperLinks:Array; + + protected var _sCssClass:String; + + public function get text() : String + { + return this._tText.text; + } + + public function set text(param1:String) : void + { + if(param1 == null) + { + var param1:* = ""; + } + this._sText = param1; + if(this._bHtmlAllowed) + { + if(this._useStyleSheet) + { + this._tText.styleSheet = null; } - else - { - this._tText.text = sValue; - }; - if (!(this._useCustomFormat)) - { - if (!(this._sCssClass)) - { - this.cssClass = "p"; - }; - }; - if (this._hyperlinkEnabled) - { - HyperlinkFactory.createTextClickHandler(this._tText, this._useStyleSheet); - HyperlinkFactory.createRollOverHandler(this._tText); - this.parseLinks(); - }; - if (this._currentStyleSheet) - { - this._tText.styleSheet = this._currentStyleSheet; - this._tText.htmlText = sValue; - }; - if (((this._finalized) && (this._autoResize))) - { - this.resizeText(); - }; - } - - public function get htmlText():String - { - return (this._tText.htmlText); - } - - public function set htmlText(val:String):void - { - this._tText.htmlText = val; - if (this._hyperlinkEnabled) - { - this.parseLinks(); - }; - } - - public function get hyperlinkEnabled():Boolean - { - return (this._hyperlinkEnabled); - } - - public function set hyperlinkEnabled(bValue:Boolean):void - { - this._hyperlinkEnabled = bValue; - mouseEnabled = bValue; - mouseChildren = bValue; - this._tText.mouseEnabled = bValue; - if (bValue) - { - this._hyperLinks = new Array(); - this._tText.addEventListener(MouseEvent.MOUSE_MOVE, this.onMouseMove); - this._tText.addEventListener(MouseEvent.ROLL_OUT, this.hyperlinkRollOut); + this._tText.htmlText = param1; + if(!this._useCustomFormat) + { + if(!(this._sCssUrl == null) && !this._cssApplied) + { + this.applyCSS(this._sCssUrl); + this._cssApplied = true; + } + else + { + this.updateCss(); + if(_bgColor != -1) + { + this.bgColor = _bgColor; + } + } } - else - { - this._tText.removeEventListener(MouseEvent.MOUSE_MOVE, this.onMouseMove); - this._tText.removeEventListener(MouseEvent.ROLL_OUT, this.hyperlinkRollOut); - }; - } - - public function get useStyleSheet():Boolean - { - return (this._useStyleSheet); - } - - public function set useStyleSheet(bValue:Boolean):void - { - this._useStyleSheet = bValue; - } - - public function get useCustomFormat():Boolean - { - return (this._useCustomFormat); - } - - public function set useCustomFormat(bValue:Boolean):void - { - this._useCustomFormat = bValue; - } - - public function get neverIndent():Boolean - { - return (this._neverIndent); - } - - public function set neverIndent(bValue:Boolean):void - { - this._neverIndent = bValue; - } - - public function get autoResize():Boolean - { - return (this._autoResize); - } - - public function set autoResize(bValue:Boolean):void - { - this._autoResize = bValue; - } - - public function get caretIndex():int - { - return (this._tText.caretIndex); - } - - public function set caretIndex(pos:int):void - { - var lastPos:int; - if (pos == -1) - { - lastPos = this._tText.text.length; - this._tText.setSelection(lastPos, lastPos); + } + else + { + this._tText.text = param1; + } + if(!this._useCustomFormat) + { + if(!this._sCssClass) + { + this.cssClass = "p"; } - else - { - this._tText.setSelection(pos, pos); - }; - } - - public function selectAll():void - { - this._tText.setSelection(0, this._tText.length); - } - - public function get type():String - { - return (this._sType); - } - - public function set type(sValue:String):void - { - this._sType = sValue; - } - - public function get css():Uri - { - return (this._sCssUrl); - } - - public function set css(sFile:Uri):void - { - this._cssApplied = false; - this.applyCSS(sFile); - } - - public function set cssClass(c:String):void - { - this._sCssClass = (((c == "")) ? "p" : c); + } + if(this._hyperlinkEnabled) + { + HyperlinkFactory.createTextClickHandler(this._tText,this._useStyleSheet); + HyperlinkFactory.createRollOverHandler(this._tText); + this.parseLinks(); + } + if(this._currentStyleSheet) + { + this._tText.styleSheet = this._currentStyleSheet; + this._tText.htmlText = param1; + } + if((this._finalized) && (this._autoResize)) + { + this.resizeText(); + } + } + + public function get htmlText() : String + { + return this._tText.htmlText; + } + + public function set htmlText(param1:String) : void + { + this._tText.htmlText = param1; + if(this._hyperlinkEnabled) + { + this.parseLinks(); + } + } + + public function get hyperlinkEnabled() : Boolean + { + return this._hyperlinkEnabled; + } + + public function set hyperlinkEnabled(param1:Boolean) : void + { + this._hyperlinkEnabled = param1; + mouseEnabled = param1; + mouseChildren = param1; + this._tText.mouseEnabled = param1; + if(param1) + { + this._hyperLinks = new Array(); + this._tText.addEventListener(MouseEvent.MOUSE_MOVE,this.onMouseMove); + this._tText.addEventListener(MouseEvent.ROLL_OUT,this.hyperlinkRollOut); + } + else + { + this._tText.removeEventListener(MouseEvent.MOUSE_MOVE,this.onMouseMove); + this._tText.removeEventListener(MouseEvent.ROLL_OUT,this.hyperlinkRollOut); + } + } + + public function get useStyleSheet() : Boolean + { + return this._useStyleSheet; + } + + public function set useStyleSheet(param1:Boolean) : void + { + this._useStyleSheet = param1; + } + + public function get useCustomFormat() : Boolean + { + return this._useCustomFormat; + } + + public function set useCustomFormat(param1:Boolean) : void + { + this._useCustomFormat = param1; + } + + public function get neverIndent() : Boolean + { + return this._neverIndent; + } + + public function set neverIndent(param1:Boolean) : void + { + this._neverIndent = param1; + } + + public function get autoResize() : Boolean + { + return this._autoResize; + } + + public function set autoResize(param1:Boolean) : void + { + this._autoResize = param1; + } + + public function get caretIndex() : int + { + return this._tText.caretIndex; + } + + public function set caretIndex(param1:int) : void + { + var _loc2_:* = 0; + if(param1 == -1) + { + _loc2_ = this._tText.text.length; + this._tText.setSelection(_loc2_,_loc2_); + } + else + { + this._tText.setSelection(param1,param1); + } + } + + public function selectAll() : void + { + this._tText.setSelection(0,this._tText.length); + } + + public function get type() : String + { + return this._sType; + } + + public function set type(param1:String) : void + { + this._sType = param1; + } + + public function get css() : Uri + { + return this._sCssUrl; + } + + public function set css(param1:Uri) : void + { + this._cssApplied = false; + this.applyCSS(param1); + } + + public function set cssClass(param1:String) : void + { + this._sCssClass = param1 == ""?"p":param1; + this.bindCss(); + } + + public function get cssClass() : String + { + return this._sCssClass; + } + + public function get antialias() : String + { + return this._sAntialiasType; + } + + public function set antialias(param1:String) : void + { + this._sAntialiasType = param1; + this._tText.antiAliasType = this._sAntialiasType; + } + + public function get thickness() : int + { + return this._tText.thickness; + } + + public function set thickness(param1:int) : void + { + this._tText.thickness = param1; + } + + public function set aStyleObj(param1:Object) : void + { + this._aStyleObj = param1 as Array; + } + + public function get aStyleObj() : Object + { + return this._aStyleObj; + } + + override public function get width() : Number + { + return (this._useExtendWidth) && this._tText.numLines < 2?this._tText.textWidth + 7:this._nWidth; + } + + override public function set width(param1:Number) : void + { + this._nWidth = param1; + this._tText.width = this._nWidth; + if(_bgColor != -1) + { + this.bgColor = _bgColor; + } + if(!this._bFixedHeight) + { this.bindCss(); - } - - public function get cssClass():String - { - return (this._sCssClass); - } - - public function get antialias():String - { - return (this._sAntialiasType); - } - - public function set antialias(s:String):void - { - this._sAntialiasType = s; - this._tText.antiAliasType = this._sAntialiasType; - } - - public function get thickness():int - { - return (this._tText.thickness); - } - - public function set thickness(value:int):void - { - this._tText.thickness = value; - } - - public function set aStyleObj(value:Object):void - { - this._aStyleObj = (value as Array); - } - - public function get aStyleObj():Object - { - return (this._aStyleObj); - } - - override public function get width():Number - { - return (((((this._useExtendWidth) && ((this._tText.numLines < 2)))) ? (this._tText.textWidth + 7) : this._nWidth)); - } - - override public function set width(nValue:Number):void - { - this._nWidth = nValue; - this._tText.width = this._nWidth; - if (_bgColor != -1) - { - this.bgColor = _bgColor; - }; - if (!(this._bFixedHeight)) - { - this.bindCss(); - }; - } - - override public function get height():Number - { - return (this._nHeight); - } - - override public function set height(nValue:Number):void - { - var valMin:Number; - if (!(this._tText.multiline)) - { - valMin = this._tText.textHeight; - if (nValue < valMin) - { - nValue = valMin; - }; - }; - this._nHeight = nValue; - this._tText.height = this._nHeight; - __height = this._nHeight; - if (_bgColor != -1) - { - this.bgColor = _bgColor; - }; - this.updateAlign(); - } - - public function get textWidth():Number - { - return (this._tText.textWidth); - } - - public function get textHeight():Number - { - return (this._tText.textHeight); - } - - public function get finalized():Boolean - { - return (this._finalized); - } - - public function set finalized(value:Boolean):void - { - this._finalized = value; - } - - public function get html():Boolean - { - return (this._bHtmlAllowed); - } - - public function set html(bValue:Boolean):void - { - this._bHtmlAllowed = bValue; - } - - public function set wordWrap(bWordWrap:Boolean):void - { - this._tText.wordWrap = bWordWrap; - } - - public function get wordWrap():Boolean - { - return (this._tText.wordWrap); - } - - public function set multiline(bMultiline:Boolean):void - { - this._tText.multiline = bMultiline; - } - - public function get multiline():Boolean - { - return (this._tText.multiline); - } - - public function get border():Boolean - { - return (this._tText.border); - } - - public function set border(bValue:Boolean):void - { - this._tText.border = bValue; - } - - public function get fixedWidth():Boolean - { - return (this._bFixedWidth); - } - - public function set fixedWidth(bValue:Boolean):void - { - this._bFixedWidth = bValue; - if (this._bFixedWidth) - { - this._tText.autoSize = TextFieldAutoSize.NONE; + } + } + + override public function get height() : Number + { + return this._nHeight; + } + + override public function set height(param1:Number) : void + { + var _loc2_:* = NaN; + if(!this._tText.multiline) + { + _loc2_ = this._tText.textHeight; + if(param1 < _loc2_) + { + var param1:Number = _loc2_; } - else - { - this._tText.autoSize = TextFieldAutoSize.LEFT; - }; - } - - public function get useExtendWidth():Boolean - { - return (this._useExtendWidth); - } - - public function set useExtendWidth(v:Boolean):void - { - this._useExtendWidth = v; - } - - public function get fixedHeight():Boolean - { - return (this._bFixedHeight); - } - - public function set fixedHeight(bValue:Boolean):void - { - this._bFixedHeight = bValue; - this._tText.wordWrap = !(this._bFixedHeight); - } - - public function get fixedHeightForMultiline():Boolean - { - return (this._bFixedHeightForMultiline); - } - - public function set fixedHeightForMultiline(bValue:Boolean):void - { - this._bFixedHeightForMultiline = bValue; - } - - override public function set bgColor(nColor:int):void - { - _bgColor = nColor; - graphics.clear(); - if ((((((bgColor == -1)) || (!(this.width)))) || (!(this.height)))) - { - return; - }; - if (_borderColor != -1) - { - graphics.lineStyle(1, _borderColor); - }; - graphics.beginFill(nColor, _bgAlpha); - if (!(_bgCornerRadius)) - { - graphics.drawRect(x, y, this.width, (this.height + 2)); - } - else - { - graphics.drawRoundRect(this._tText.x, this._tText.y, this._tText.width, (this._tText.height + 2), _bgCornerRadius, _bgCornerRadius); - }; - graphics.endFill(); - } - - override public function set borderColor(nColor:int):void - { - if (nColor == -1) - { - this._tText.border = false; - } - else - { - this._tText.border = true; - this._tText.borderColor = nColor; - }; - } - - public function set selectable(bValue:Boolean):void - { - this._tText.selectable = bValue; - } - - public function get length():uint - { - return (this._tText.length); - } - - public function set scrollV(nVal:int):void - { - this._tText.scrollV = nVal; - } - - public function get scrollV():int - { - this._tText.getCharBoundaries(0); - return (this._tText.scrollV); - } - - public function get maxScrollV():int - { - this._tText.getCharBoundaries(0); - return (this._tText.maxScrollV); - } - - public function get textfield():TextField - { - return (this._tText); - } - - public function get useEmbedFonts():Boolean - { - return (this._useEmbedFonts); - } - - public function set useEmbedFonts(b:Boolean):void - { - this._useEmbedFonts = b; - this._tText.embedFonts = b; - } - - override public function set disabled(bool:Boolean):void - { - if (bool) + } + this._nHeight = param1; + this._tText.height = this._nHeight; + __height = this._nHeight; + if(_bgColor != -1) + { + this.bgColor = _bgColor; + } + this.updateAlign(); + } + + public function get textWidth() : Number + { + return this._tText.textWidth; + } + + public function get textHeight() : Number + { + return this._tText.textHeight; + } + + public function get finalized() : Boolean + { + return this._finalized; + } + + public function set finalized(param1:Boolean) : void + { + this._finalized = param1; + } + + public function get html() : Boolean + { + return this._bHtmlAllowed; + } + + public function set html(param1:Boolean) : void + { + this._bHtmlAllowed = param1; + } + + public function set wordWrap(param1:Boolean) : void + { + this._tText.wordWrap = param1; + } + + public function get wordWrap() : Boolean + { + return this._tText.wordWrap; + } + + public function set multiline(param1:Boolean) : void + { + this._tText.multiline = param1; + } + + public function get multiline() : Boolean + { + return this._tText.multiline; + } + + public function get border() : Boolean + { + return this._tText.border; + } + + public function set border(param1:Boolean) : void + { + this._tText.border = param1; + } + + public function get fixedWidth() : Boolean + { + return this._bFixedWidth; + } + + public function set fixedWidth(param1:Boolean) : void + { + this._bFixedWidth = param1; + if(this._bFixedWidth) + { + this._tText.autoSize = TextFieldAutoSize.NONE; + } + else + { + this._tText.autoSize = TextFieldAutoSize.LEFT; + } + } + + public function get useExtendWidth() : Boolean + { + return this._useExtendWidth; + } + + public function set useExtendWidth(param1:Boolean) : void + { + this._useExtendWidth = param1; + } + + public function get fixedHeight() : Boolean + { + return this._bFixedHeight; + } + + public function set fixedHeight(param1:Boolean) : void + { + this._bFixedHeight = param1; + this._tText.wordWrap = !this._bFixedHeight; + } + + public function get fixedHeightForMultiline() : Boolean + { + return this._bFixedHeightForMultiline; + } + + public function set fixedHeightForMultiline(param1:Boolean) : void + { + this._bFixedHeightForMultiline = param1; + } + + override public function set bgColor(param1:int) : void + { + _bgColor = param1; + graphics.clear(); + if(bgColor == -1 || !this.width || !this.height) + { + return; + } + if(_borderColor != -1) + { + graphics.lineStyle(1,_borderColor); + } + graphics.beginFill(param1,_bgAlpha); + if(!_bgCornerRadius) + { + graphics.drawRect(x,y,this.width,this.height + 2); + } + else + { + graphics.drawRoundRect(this._tText.x,this._tText.y,this._tText.width,this._tText.height + 2,_bgCornerRadius,_bgCornerRadius); + } + graphics.endFill(); + } + + override public function set borderColor(param1:int) : void + { + if(param1 == -1) + { + this._tText.border = false; + } + else + { + this._tText.border = true; + this._tText.borderColor = param1; + } + } + + public function set selectable(param1:Boolean) : void + { + this._tText.selectable = param1; + } + + public function get length() : uint + { + return this._tText.length; + } + + public function set scrollV(param1:int) : void + { + this._tText.scrollV = param1; + } + + public function get scrollV() : int + { + this._tText.getCharBoundaries(0); + return this._tText.scrollV; + } + + public function get maxScrollV() : int + { + this._tText.getCharBoundaries(0); + return this._tText.maxScrollV; + } + + public function get textfield() : TextField + { + return this._tText; + } + + public function get useEmbedFonts() : Boolean + { + return this._useEmbedFonts; + } + + public function set useEmbedFonts(param1:Boolean) : void + { + this._useEmbedFonts = param1; + this._tText.embedFonts = param1; + } + + override public function set disabled(param1:Boolean) : void + { + if(param1) + { + this._hasHandCursor = handCursor; + handCursor = false; + mouseEnabled = false; + this._tText.mouseEnabled = false; + } + else + { + if(!handCursor) { - this._hasHandCursor = handCursor; - handCursor = false; - mouseEnabled = false; - this._tText.mouseEnabled = false; + handCursor = this._hasHandCursor; } - else - { - if (!(handCursor)) - { - handCursor = this._hasHandCursor; - }; - mouseEnabled = true; - this._tText.mouseEnabled = true; - }; - this._bDisabled = bool; - } - - public function get verticalAlign():String - { - return (this._sVerticalAlign); - } - - public function set verticalAlign(s:String):void - { - this._sVerticalAlign = s; - this.updateAlign(); - } - - public function get textFormat():TextFormat - { - return (this._tfFormatter); - } - - public function set textFormat(tf:TextFormat):void - { - this._tfFormatter = tf; - this._tText.setTextFormat(this._tfFormatter); - } - - public function set restrict(restrictTo:String):void - { - this._tText.restrict = restrictTo; - } - - public function get restrict():String - { - return (this._tText.restrict); - } - - public function set colorText(color:uint):void - { - if (!(this._tfFormatter)) - { - _log.error("Error. Try to change the size before formatter was initialized."); - return; - }; - this._tfFormatter.color = color; + mouseEnabled = true; + this._tText.mouseEnabled = true; + } + this._bDisabled = param1; + } + + public function get verticalAlign() : String + { + return this._sVerticalAlign; + } + + public function set verticalAlign(param1:String) : void + { + this._sVerticalAlign = param1; + this.updateAlign(); + } + + public function get textFormat() : TextFormat + { + return this._tfFormatter; + } + + public function set textFormat(param1:TextFormat) : void + { + this._tfFormatter = param1; + this._tText.setTextFormat(this._tfFormatter); + } + + public function set restrict(param1:String) : void + { + this._tText.restrict = param1; + } + + public function get restrict() : String + { + return this._tText.restrict; + } + + public function set colorText(param1:uint) : void + { + if(!this._tfFormatter) + { + _log.error("Error. Try to change the size before formatter was initialized."); + return; + } + this._tfFormatter.color = param1; + this._tText.setTextFormat(this._tfFormatter); + this._tText.defaultTextFormat = this._tfFormatter; + } + + public function setCssColor(param1:String, param2:String = null) : void + { + this.changeCssClassColor(param1,param2); + } + + public function setCssSize(param1:uint, param2:String = null) : void + { + this.changeCssClassSize(param1,param2); + } + + public function setCssFont(param1:String, param2:String = null) : void + { + this.changeCssClassFont(param1,param2); + } + + public function setStyleSheet(param1:StyleSheet) : void + { + this._useStyleSheet = true; + this._currentStyleSheet = param1; + } + + public function applyCSS(param1:Uri) : void + { + if(param1 == null) + { + return; + } + if(param1 == this._sCssUrl && (this._tfFormatter)) + { + this.updateCss(); + } + else + { + this._sCssUrl = param1; + CssManager.getInstance().askCss(param1.uri,new Callback(this.bindCss)); + } + } + + public function setBorderColor(param1:int) : void + { + this._tText.borderColor = param1; + } + + public function allowTextMouse(param1:Boolean) : void + { + this.mouseChildren = param1; + this._tText.mouseEnabled = param1; + } + + override public function remove() : void + { + super.remove(); + if((this._tText) && (this._tText.parent)) + { + removeChild(this._tText); + } + TooltipManager.hide("TextExtension"); + this._tText.removeEventListener(MouseEvent.MOUSE_MOVE,this.onMouseMove); + this._tText.removeEventListener(MouseEvent.ROLL_OUT,this.hyperlinkRollOut); + } + + override public function free() : void + { + super.free(); + this._sType = "default"; + this._nWidth = 100; + this._nHeight = 20; + this._bHtmlAllowed = true; + this._sAntialiasType = "normal"; + this._bFixedWidth = true; + this._bFixedHeight = true; + this._bFixedHeightForMultiline = false; + this._ssSheet = null; + this._useEmbedFonts = true; + this._nPaddingLeft = 0; + this._nTextIndent = 0; + this._bDisabled = false; + this._nTextHeight = 0; + this._sVerticalAlign = "none"; + this._useExtendWidth = false; + this._sCssClass = null; + this._tText.type = TextFieldType.DYNAMIC; + this._tText.selectable = false; + } + + private function createTextField() : void + { + this._tText = new TextField(); + this._tText.addEventListener(TextEvent.LINK,this.onTextClick); + addChild(this._tText); + } + + private function changeCssClassColor(param1:String, param2:String = null) : void + { + var _loc3_:* = undefined; + if(param2) + { + this.aStyleObj[param2].color = param1; + this._tfFormatter = this._ssSheet.transform(this.aStyleObj[param2]); this._tText.setTextFormat(this._tfFormatter); this._tText.defaultTextFormat = this._tfFormatter; - } - - public function setCssColor(color:String, style:String=null):void - { - this.changeCssClassColor(color, style); - } - - public function setCssSize(size:uint, style:String=null):void - { - this.changeCssClassSize(size, style); - } - - public function setCssFont(font:String, style:String=null):void - { - this.changeCssClassFont(font, style); - } - - public function setStyleSheet(styles:StyleSheet):void - { - this._useStyleSheet = true; - this._currentStyleSheet = styles; - } - - public function applyCSS(sFile:Uri):void - { - if (sFile == null) + } + else + { + for each(_loc3_ in this.aStyleObj) { - return; - }; - if ((((sFile == this._sCssUrl)) && (this._tfFormatter))) - { - this.updateCss(); + _loc3_.color = param1; } - else - { - this._sCssUrl = sFile; - CssManager.getInstance().askCss(sFile.uri, new Callback(this.bindCss)); - }; - } - - public function setBorderColor(nColor:int):void - { - this._tText.borderColor = nColor; - } - - public function allowTextMouse(bValue:Boolean):void - { - this.mouseChildren = bValue; - this._tText.mouseEnabled = bValue; - } - - override public function remove():void - { - super.remove(); - if (((this._tText) && (this._tText.parent))) - { - removeChild(this._tText); - }; - TooltipManager.hide("TextExtension"); - this._tText.removeEventListener(MouseEvent.MOUSE_MOVE, this.onMouseMove); - this._tText.removeEventListener(MouseEvent.ROLL_OUT, this.hyperlinkRollOut); - } - - override public function free():void - { - super.free(); - this._sType = "default"; - this._nWidth = 100; - this._nHeight = 20; - this._bHtmlAllowed = true; - this._sAntialiasType = "normal"; - this._bFixedWidth = true; - this._bFixedHeight = true; - this._bFixedHeightForMultiline = false; - this._ssSheet = null; - this._useEmbedFonts = true; - this._nPaddingLeft = 0; - this._nTextIndent = 0; - this._bDisabled = false; - this._nTextHeight = 0; - this._sVerticalAlign = "none"; - this._useExtendWidth = false; - this._sCssClass = null; - this._tText.type = TextFieldType.DYNAMIC; - this._tText.selectable = false; - } - - private function createTextField():void - { - this._tText = new TextField(); - this._tText.addEventListener(TextEvent.LINK, this.onTextClick); - addChild(this._tText); - } - - private function changeCssClassColor(color:String, style:String=null):void - { - var _local_3:*; - if (style) - { - this.aStyleObj[style].color = color; - this._tfFormatter = this._ssSheet.transform(this.aStyleObj[style]); - this._tText.setTextFormat(this._tfFormatter); - this._tText.defaultTextFormat = this._tfFormatter; + } + } + + private function changeCssClassSize(param1:uint, param2:String = null) : void + { + var _loc3_:* = undefined; + if(param2) + { + if(this.aStyleObj[param2] == null) + { + this.aStyleObj[param2] = new Object(); } - else - { - for each (_local_3 in this.aStyleObj) - { - _local_3.color = color; - }; - }; - } - - private function changeCssClassSize(size:uint, style:String=null):void - { - var _local_3:*; - if (style) + this.aStyleObj[param2].fontSize = param1 + "px"; + } + else + { + for each(_loc3_ in this.aStyleObj) { - if (this.aStyleObj[style] == null) - { - this.aStyleObj[style] = new Object(); - }; - this.aStyleObj[style].fontSize = (size + "px"); + _loc3_.fontSize = param1 + "px"; } - else - { - for each (_local_3 in this.aStyleObj) - { - _local_3.fontSize = (size + "px"); - }; - }; - } - - private function changeCssClassFont(font:String, style:String=null):void - { - var _local_3:*; - if (style) - { - if (this.aStyleObj[style] == null) - { - this.aStyleObj[style] = new Object(); - }; - this.aStyleObj[style].fontFamily = font; + } + } + + private function changeCssClassFont(param1:String, param2:String = null) : void + { + var _loc3_:* = undefined; + if(param2) + { + if(this.aStyleObj[param2] == null) + { + this.aStyleObj[param2] = new Object(); } - else - { - for each (_local_3 in this.aStyleObj) - { - _local_3.fontFamily = font; - }; - }; - } - - public function appendText(sTxt:String, style:String=null):void - { - var textFormat:TextFormat; - if (((style) && (this.aStyleObj[style]))) - { - if (this._tText.filters.length) - { - this._tText.filters = new Array(); - }; - textFormat = this._ssSheet.transform(this.aStyleObj[style]); - textFormat.bold = false; - this._tText.defaultTextFormat = textFormat; - }; - if (this._hyperlinkEnabled) - { - sTxt = HyperlinkFactory.decode(sTxt); - }; - this._tText.htmlText = (this._tText.htmlText + sTxt); - if (this._hyperlinkEnabled) - { - this.parseLinks(); - }; - } - - public function activeSmallHyperlink():void - { - HyperlinkFactory.activeSmallHyperlink(this._tText); - } - - private function bindCss():void - { - var styleToDisplay:String; - var s:String; - var sc:uint; - var ss:uint; - var fontClass:String; - var _local_8:String; - if (!(this._sCssUrl)) + this.aStyleObj[param2].fontFamily = param1; + } + else + { + for each(_loc3_ in this.aStyleObj) { - if (this._needToFinalize) - { - this.finalize(); - }; - return; - }; - var oldCss:ExtendedStyleSheet = this._ssSheet; - this._ssSheet = CssManager.getInstance().getCss(this._sCssUrl.uri); - if (!(this._ssSheet)) - { - if (this._needToFinalize) - { - this.finalize(); - }; - return; - }; - var currentStyleSheet:StyleSheet = this._tText.styleSheet; - this._tText.styleSheet = null; - this.aStyleObj = new Array(); - for each (s in this._ssSheet.styleNames) - { - if (((((!(styleToDisplay)) || ((s == this._sCssClass)))) || (((!((this._sCssClass == styleToDisplay))) && ((s == "p")))))) - { - styleToDisplay = s; - }; - if (((!((this._ssSheet == oldCss))) || (!(this.aStyleObj[s])))) - { - this.aStyleObj[s] = this._ssSheet.getStyle(s); - }; - }; - if (((this.aStyleObj[styleToDisplay]["shadowSize"]) || (this.aStyleObj[styleToDisplay]["shadowColor"]))) - { - sc = ((this.aStyleObj[styleToDisplay]["shadowColor"]) ? parseInt(this.aStyleObj[styleToDisplay]["shadowColor"].substr(1)) : 0); - ss = ((this.aStyleObj[styleToDisplay]["shadowSize"]) ? parseInt(this.aStyleObj[styleToDisplay]["shadowSize"]) : 5); - this._tText.filters = [new DropShadowFilter(0, 0, sc, 0.5, ss, ss, 3)]; + _loc3_.fontFamily = param1; } - else - { - this._tText.filters = []; - }; - if (this.aStyleObj[styleToDisplay]["useEmbedFonts"]) - { - this._useEmbedFonts = (this.aStyleObj[styleToDisplay]["useEmbedFonts"] == "true"); - }; - if (this.aStyleObj[styleToDisplay]["paddingLeft"]) - { - this._nPaddingLeft = parseInt(this.aStyleObj[styleToDisplay]["paddingLeft"]); - }; - if (this.aStyleObj[styleToDisplay]["verticalHeight"]) - { - this._nTextHeight = parseInt(this.aStyleObj[styleToDisplay]["verticalHeight"]); - }; - if (this.aStyleObj[styleToDisplay]["verticalAlign"]) - { - this.verticalAlign = this.aStyleObj[styleToDisplay]["verticalAlign"]; - }; - if (this.aStyleObj[styleToDisplay]["thickness"]) - { - this._tText.thickness = this.aStyleObj[styleToDisplay]["thickness"]; - }; - this._tText.gridFitType = GridFitType.PIXEL; - this._tText.htmlText = ((this._sText) ? this._sText : this.text); - this._tfFormatter = this._ssSheet.transform(this.aStyleObj[styleToDisplay]); - if (this.aStyleObj[styleToDisplay]["leading"]) - { - this._tfFormatter.leading = this.aStyleObj[styleToDisplay]["leading"]; - }; - if (this.aStyleObj[styleToDisplay]["letterSpacing"]) - { - this._tfFormatter.letterSpacing = parseFloat(this.aStyleObj[styleToDisplay]["letterSpacing"]); - }; - if (this.aStyleObj[styleToDisplay]["kerning"]) - { - this._tfFormatter.kerning = (this.aStyleObj[styleToDisplay]["kerning"] == "true"); - }; - if (!(this._neverIndent)) + } + } + + public function appendText(param1:String, param2:String = null) : void + { + var _loc3_:TextFormat = null; + if((param2) && (this.aStyleObj[param2])) + { + if(this._tText.filters.length) + { + this._tText.filters = new Array(); + } + _loc3_ = this._ssSheet.transform(this.aStyleObj[param2]); + _loc3_.bold = false; + this._tText.defaultTextFormat = _loc3_; + } + if(this._hyperlinkEnabled) + { + var param1:String = HyperlinkFactory.decode(param1); + } + this._tText.htmlText = this._tText.htmlText + param1; + if(this._hyperlinkEnabled) + { + this.parseLinks(); + } + } + + public function activeSmallHyperlink() : void + { + HyperlinkFactory.activeSmallHyperlink(this._tText); + } + + private function bindCss() : void + { + var _loc3_:String = null; + var _loc4_:String = null; + var _loc5_:uint = 0; + var _loc6_:uint = 0; + var _loc7_:String = null; + var _loc8_:String = null; + if(!this._sCssUrl) + { + if(this._needToFinalize) + { + this.finalize(); + } + return; + } + var _loc1_:ExtendedStyleSheet = this._ssSheet; + this._ssSheet = CssManager.getInstance().getCss(this._sCssUrl.uri); + if(!this._ssSheet) + { + if(this._needToFinalize) + { + this.finalize(); + } + return; + } + var _loc2_:StyleSheet = this._tText.styleSheet; + this._tText.styleSheet = null; + this.aStyleObj = new Array(); + for each(_loc4_ in this._ssSheet.styleNames) + { + if(!_loc3_ || _loc4_ == this._sCssClass || !(this._sCssClass == _loc3_) && _loc4_ == "p") + { + _loc3_ = _loc4_; + } + if(!(this._ssSheet == _loc1_) || !this.aStyleObj[_loc4_]) { - this._tfFormatter.indent = this._nTextIndent; - }; - this._tfFormatter.leftMargin = this._nPaddingLeft; - if (this._useEmbedFonts) + this.aStyleObj[_loc4_] = this._ssSheet.getStyle(_loc4_); + } + } + if((this.aStyleObj[_loc3_]["shadowSize"]) || (this.aStyleObj[_loc3_]["shadowColor"])) + { + _loc5_ = this.aStyleObj[_loc3_]["shadowColor"]?parseInt(this.aStyleObj[_loc3_]["shadowColor"].substr(1)):0; + _loc6_ = this.aStyleObj[_loc3_]["shadowSize"]?parseInt(this.aStyleObj[_loc3_]["shadowSize"]):5; + this._tText.filters = [new DropShadowFilter(0,0,_loc5_,0.5,_loc6_,_loc6_,3)]; + } + else + { + this._tText.filters = []; + } + if(this.aStyleObj[_loc3_]["useEmbedFonts"]) + { + this._useEmbedFonts = this.aStyleObj[_loc3_]["useEmbedFonts"] == "true"; + } + if(this.aStyleObj[_loc3_]["paddingLeft"]) + { + this._nPaddingLeft = parseInt(this.aStyleObj[_loc3_]["paddingLeft"]); + } + if(this.aStyleObj[_loc3_]["verticalHeight"]) + { + this._nTextHeight = parseInt(this.aStyleObj[_loc3_]["verticalHeight"]); + } + if(this.aStyleObj[_loc3_]["verticalAlign"]) + { + this.verticalAlign = this.aStyleObj[_loc3_]["verticalAlign"]; + } + if(this.aStyleObj[_loc3_]["thickness"]) + { + this._tText.thickness = this.aStyleObj[_loc3_]["thickness"]; + } + this._tText.gridFitType = GridFitType.PIXEL; + this._tText.htmlText = this._sText?this._sText:this.text; + this._tfFormatter = this._ssSheet.transform(this.aStyleObj[_loc3_]); + if(this.aStyleObj[_loc3_]["leading"]) + { + this._tfFormatter.leading = this.aStyleObj[_loc3_]["leading"]; + } + if(this.aStyleObj[_loc3_]["letterSpacing"]) + { + this._tfFormatter.letterSpacing = parseFloat(this.aStyleObj[_loc3_]["letterSpacing"]); + } + if(this.aStyleObj[_loc3_]["kerning"]) + { + this._tfFormatter.kerning = this.aStyleObj[_loc3_]["kerning"] == "true"; + } + if(!this._neverIndent) + { + this._tfFormatter.indent = this._nTextIndent; + } + this._tfFormatter.leftMargin = this._nPaddingLeft; + if(this._useEmbedFonts) + { + _loc7_ = FontManager.getInstance().getFontClassName(this._tfFormatter.font); + if(_loc7_) + { + this._tfFormatter.size = Math.round(int(this._tfFormatter.size) * FontManager.getInstance().getSizeMultipicator(this._tfFormatter.font)); + this._tfFormatter.font = _loc7_; + this._tText.defaultTextFormat.font = _loc7_; + this._tText.embedFonts = true; + this._tText.antiAliasType = AntiAliasType.ADVANCED; + } + else if(this._tfFormatter) { - fontClass = FontManager.getInstance().getFontClassName(this._tfFormatter.font); - if (fontClass) - { - this._tfFormatter.size = Math.round((int(this._tfFormatter.size) * FontManager.getInstance().getSizeMultipicator(this._tfFormatter.font))); - this._tfFormatter.font = fontClass; - this._tText.defaultTextFormat.font = fontClass; - this._tText.embedFonts = true; - this._tText.antiAliasType = AntiAliasType.ADVANCED; - } - else - { - if (this._tfFormatter) - { - _log.warn((((((("System font [" + this._tfFormatter.font) + "] used (in ") + ((getUi()) ? getUi().name : "unknow")) + ", from ") + this._sCssUrl.uri) + ")")); - } - else - { - _log.fatal("Erreur de formattage."); - }; - }; + _log.warn("System font [" + this._tfFormatter.font + "] used (in " + (getUi()?getUi().name:"unknow") + ", from " + this._sCssUrl.uri + ")"); } else { - _local_8 = FontManager.getInstance().getRealFontName(this._tfFormatter.font); - this._tfFormatter.font = ((!((_local_8 == ""))) ? _local_8 : this._tfFormatter.font); - this._tText.embedFonts = false; - }; - this._tText.setTextFormat(this._tfFormatter); - this._tText.defaultTextFormat = this._tfFormatter; - if (this._hyperlinkEnabled) - { - HyperlinkFactory.createTextClickHandler(this._tText, true); - HyperlinkFactory.createRollOverHandler(this._tText); - this.parseLinks(); - }; - if (this._nTextHeight) - { - this._tText.height = this._nTextHeight; - this._tText.y = (this._tText.y + ((this._nHeight / 2) - (this._tText.height / 2))); + _log.fatal("Erreur de formattage."); + } + + } + else + { + _loc8_ = FontManager.getInstance().getRealFontName(this._tfFormatter.font); + this._tfFormatter.font = _loc8_ != ""?_loc8_:this._tfFormatter.font; + this._tText.embedFonts = false; + } + this._tText.setTextFormat(this._tfFormatter); + this._tText.defaultTextFormat = this._tfFormatter; + if(this._hyperlinkEnabled) + { + HyperlinkFactory.createTextClickHandler(this._tText,true); + HyperlinkFactory.createRollOverHandler(this._tText); + this.parseLinks(); + } + if(this._nTextHeight) + { + this._tText.height = this._nTextHeight; + this._tText.y = this._tText.y + (this._nHeight / 2 - this._tText.height / 2); + } + else if(!this._bFixedHeight) + { + this._tText.height = this._tText.textHeight + 5; + this._nHeight = this._tText.height; + } + else + { + this._tText.height = this._nHeight; + } + + if(this._useExtendWidth) + { + this._tText.width = this._tText.textWidth + 7; + this._nWidth = this._tText.width; + } + if(_bgColor != -1) + { + this.bgColor = _bgColor; + } + this.updateAlign(); + if((this._useExtendWidth) && (getUi())) + { + getUi().render(); + } + this._binded = true; + this.updateTooltipExtensionStyle(); + if(this._needToFinalize) + { + this.finalize(); + } + } + + public function updateCss() : void + { + if(!this._tfFormatter) + { + return; + } + this._tText.setTextFormat(this._tfFormatter); + this._tText.defaultTextFormat = this._tfFormatter; + this.updateTooltipExtensionStyle(); + if(!this._bFixedHeight) + { + this._tText.height = this._tText.textHeight + 5; + this._nHeight = this._tText.height; + } + else + { + this._tText.height = this._nHeight; + } + if(this._useExtendWidth) + { + this._tText.width = this._tText.textWidth + 7; + this._nWidth = this._tText.width; + } + if(_bgColor != -1) + { + this.bgColor = _bgColor; + } + this.updateAlign(); + if((this._useExtendWidth) && (getUi())) + { + getUi().render(); + } + } + + public function fullSize(param1:int) : void + { + this.removeTooltipExtension(); + this._nWidth = param1; + this._tText.width = param1; + var _loc2_:uint = this._tText.textHeight + 8; + this._tText.height = _loc2_; + this._nHeight = _loc2_; + } + + public function fullWidth(param1:uint = 0) : void + { + this._nWidth = int(this._tText.textWidth + 5); + this._tText.width = this._nWidth; + if(param1 > 0) + { + this._nWidth = param1; + this._tText.width = param1; + if(this._tText.textWidth < param1) + { + this._tText.width = this._tText.textWidth + 10; + } + } + this._nHeight = this._tText.textHeight + 8; + this._tText.height = this._nHeight; + } + + public function resizeText(param1:Boolean = true) : void + { + var _loc2_:* = 0; + var _loc3_:* = 0; + var _loc4_:* = false; + var _loc5_:* = 0; + var _loc6_:* = NaN; + this.removeTooltipExtension(); + if(((this._bFixedHeight) && !this._tText.multiline || (this._bFixedHeightForMultiline)) && this._tText.autoSize == "none" && (this._tfFormatter)) + { + _loc2_ = int(this._tfFormatter.size); + _loc3_ = _loc2_; + if(param1) + { + if(_loc3_ < 12) + { + _loc3_ = 12; + } } else { - if (!(this._bFixedHeight)) - { - this._tText.height = (this._tText.textHeight + 5); - this._nHeight = this._tText.height; - } - else - { - this._tText.height = this._nHeight; - }; - }; - if (this._useExtendWidth) - { - this._tText.width = (this._tText.textWidth + 7); - this._nWidth = this._tText.width; - }; - if (_bgColor != -1) - { - this.bgColor = _bgColor; - }; - this.updateAlign(); - if (((this._useExtendWidth) && (getUi()))) - { - getUi().render(); - }; - this._binded = true; - this.updateTooltipExtensionStyle(); - if (this._needToFinalize) - { - this.finalize(); - }; - } - - public function updateCss():void - { - if (!(this._tfFormatter)) + _loc3_ = 0; + } + _loc4_ = false; + _loc5_ = this._tText.width; + while(true) + { + _loc6_ = this._tText.textWidth; + if(_loc6_ > _loc5_ + 1 || this._tText.textHeight > this._tText.height || (this._bFixedHeightForMultiline) && this._tText.textHeight > this.height) + { + _loc2_--; + if(_loc2_ < _loc3_) + { + if(this._useTooltipExtension) + { + _loc4_ = true; + } + else + { + _log.warn("Attention : Ce texte est beaucoup trop long pour entrer dans ce TextField (Texte : " + this._tText.text + ")"); + } + break; + } + this._tfFormatter.size = _loc2_; + this._tText.setTextFormat(this._tfFormatter); + continue; + } + break; + } + if((_loc4_) && (!this.multiline && (this._bFixedHeight) || (this._bFixedHeightForMultiline))) { - return; - }; - this._tText.setTextFormat(this._tfFormatter); - this._tText.defaultTextFormat = this._tfFormatter; - this.updateTooltipExtensionStyle(); - if (!(this._bFixedHeight)) + this.addTooltipExtension(); + } + else if(this._lastWidth != this._tText.width) { - this._tText.height = (this._tText.textHeight + 5); - this._nHeight = this._tText.height; + this._lastWidth = this._tText.width + 4; + this._tText.width = this._lastWidth; + } + + } + } + + public function truncateText(param1:Number, param2:Boolean = true) : void + { + var _loc3_:* = 0; + var _loc4_:* = 0; + var _loc5_:* = 0; + var _loc6_:* = 0; + var _loc7_:* = NaN; + var _loc8_:* = NaN; + var _loc9_:* = 0; + var _loc10_:* = 0; + this._nHeight = __height = this._tText.height = param1; + if((this._tText.wordWrap) && this._tText.numLines > 0) + { + _loc3_ = this._tText.numLines; + _loc7_ = 4; + _loc8_ = this._tText.getLineMetrics(0).height; + _loc6_ = 0; + while(_loc6_ < _loc3_) + { + _loc7_ = _loc7_ + _loc8_; + if(_loc7_ < this._tText.height) + { + _loc4_++; + _loc5_ = _loc5_ + this._tText.getLineLength(_loc6_); + _loc6_++; + continue; + } + break; + } + this._tText.text = this._tText.text.substr(0,_loc5_); + if(param2) + { + _loc9_ = this._tText.text.lastIndexOf(String.fromCharCode(10)); + _loc10_ = this._tText.text.lastIndexOf("."); + if(!(_loc9_ == -1) || !(_loc10_ == -1)) + { + this._tText.text = this._tText.text.substring(0,Math.max(_loc9_,_loc10_)); + this._tText.appendText(" (" + String.fromCharCode(8230) + ")"); + this._nHeight = __height = this._tText.height = this._tText.height - (_loc4_ - this._tText.numLines) * _loc8_; + } + else + { + this.addEllipsis(); + } } else { - this._tText.height = this._nHeight; - }; - if (this._useExtendWidth) - { - this._tText.width = (this._tText.textWidth + 7); - this._nWidth = this._tText.width; - }; - if (_bgColor != -1) - { - this.bgColor = _bgColor; - }; - this.updateAlign(); - if (((this._useExtendWidth) && (getUi()))) - { - getUi().render(); - }; - } - - public function fullSize(width:int):void - { - this.removeTooltipExtension(); - this._nWidth = width; - this._tText.width = width; - var tHeight:uint = (this._tText.textHeight + 8); - this._tText.height = tHeight; - this._nHeight = tHeight; - } - - public function fullWidth(maxWidth:uint=0):void - { - this._nWidth = int((this._tText.textWidth + 5)); - this._tText.width = this._nWidth; - if (maxWidth > 0) - { - this._nWidth = maxWidth; - this._tText.width = maxWidth; - if (this._tText.textWidth < maxWidth) - { - this._tText.width = (this._tText.textWidth + 10); - }; - }; - this._nHeight = (this._tText.textHeight + 8); - this._tText.height = this._nHeight; - } - - public function resizeText(useSizeMin:Boolean=true):void - { - var currentSize:int; - var sizeMin:int; - var needTooltipExtension:Boolean; - var currentTextFieldWidth:int; - var textWidth:Number; - this.removeTooltipExtension(); - if (((((((((this._bFixedHeight) && (!(this._tText.multiline)))) || (this._bFixedHeightForMultiline))) && ((this._tText.autoSize == "none")))) && (this._tfFormatter))) - { - currentSize = int(this._tfFormatter.size); - sizeMin = currentSize; - if (useSizeMin) - { - if (sizeMin < 12) - { - sizeMin = 12; - }; - } - else - { - sizeMin = 0; - }; - needTooltipExtension = false; - currentTextFieldWidth = this._tText.width; - while (true) - { - textWidth = this._tText.textWidth; - if ((((((textWidth > (currentTextFieldWidth + 1))) || ((this._tText.textHeight > this._tText.height)))) || (((this._bFixedHeightForMultiline) && ((this._tText.textHeight > this.height)))))) - { - currentSize--; - if (currentSize < sizeMin) - { - if (this._useTooltipExtension) - { - needTooltipExtension = true; - } - else - { - _log.warn((("Attention : Ce texte est beaucoup trop long pour entrer dans ce TextField (Texte : " + this._tText.text) + ")")); - }; - break; - }; - this._tfFormatter.size = currentSize; - this._tText.setTextFormat(this._tfFormatter); - } - else - { - break; - }; - }; - if (((needTooltipExtension) && (((((!(this.multiline)) && (this._bFixedHeight))) || (this._bFixedHeightForMultiline))))) - { - this.addTooltipExtension(); - } - else - { - if (this._lastWidth != this._tText.width) - { - this._lastWidth = (this._tText.width + 4); - this._tText.width = this._lastWidth; - }; - }; - }; - } - - public function truncateText(pMaxHeight:Number, pCleanTruncature:Boolean=true):void - { - var numLines:int; - var nbVisibleLines:int; - var nbVisibleChars:int; - var i:int; - var h:Number; - var lineHeight:Number; - var lineBreakIndex:int; - var periodIndex:int; - this._nHeight = (__height = (this._tText.height = pMaxHeight)); - if (((this._tText.wordWrap) && ((this._tText.numLines > 0)))) - { - numLines = this._tText.numLines; - h = 4; - lineHeight = this._tText.getLineMetrics(0).height; - i = 0; - while (i < numLines) - { - h = (h + lineHeight); - if (h < this._tText.height) - { - nbVisibleLines++; - nbVisibleChars = (nbVisibleChars + this._tText.getLineLength(i)); - } - else - { - break; - }; - i++; - }; - this._tText.text = this._tText.text.substr(0, nbVisibleChars); - if (pCleanTruncature) - { - lineBreakIndex = this._tText.text.lastIndexOf(String.fromCharCode(10)); - periodIndex = this._tText.text.lastIndexOf("."); - if (((!((lineBreakIndex == -1))) || (!((periodIndex == -1))))) - { - this._tText.text = this._tText.text.substring(0, Math.max(lineBreakIndex, periodIndex)); - this._tText.appendText("..."); - this._nHeight = (__height = (this._tText.height = (this._tText.height - ((nbVisibleLines - this._tText.numLines) * lineHeight)))); - } - else - { - this.addEllipsis(); - }; - } - else - { - this.addEllipsis(); - }; - }; - } - - public function removeTooltipExtension():void - { - if (this._textFieldTooltipExtension) - { - removeChild(this._textFieldTooltipExtension); - this._tText.width = (__width + int((this._textFieldTooltipExtension.width + 2))); - __width = this._tText.width; - this._textFieldTooltipExtension.removeEventListener(MouseEvent.ROLL_OVER, this.onTooltipExtensionOver); - this._textFieldTooltipExtension.removeEventListener(MouseEvent.ROLL_OUT, this.onTooltipExtensionOut); - this._textFieldTooltipExtension = null; - }; - } - - private function addEllipsis():void - { - var i:int; - var nbSpaces:int; - if ((this._tText.text.length - 3) > 0) - { - this._tText.text = this._tText.text.substr(0, (this._tText.text.length - 3)); - i = (this._tText.text.length - 1); - while ((((i >= 0)) && ((this._tText.text.charAt(i) == " ")))) - { - nbSpaces++; - i--; - }; - if (nbSpaces > 0) - { - this._tText.text = this._tText.text.substr(0, (this._tText.text.length - nbSpaces)); - }; - this._tText.appendText("..."); - }; - } - - private function addTooltipExtension():void - { - this._textFieldTooltipExtension = new TextField(); - this._textFieldTooltipExtension.selectable = false; - this._textFieldTooltipExtension.height = 1; - this._textFieldTooltipExtension.width = 1; - this._textFieldTooltipExtension.autoSize = TextFieldAutoSize.LEFT; - this.updateTooltipExtensionStyle(); - this._textFieldTooltipExtension.text = "..."; - this._textFieldTooltipExtension.name = ("extension_" + name); - addChild(this._textFieldTooltipExtension); - var w:int = (this._textFieldTooltipExtension.width + 2); - this._tText.width = (this._tText.width - w); + this.addEllipsis(); + } + } + } + + public function removeTooltipExtension() : void + { + if(this._textFieldTooltipExtension) + { + removeChild(this._textFieldTooltipExtension); + this._tText.width = __width + int(this._textFieldTooltipExtension.width + 2); __width = this._tText.width; - this._textFieldTooltipExtension.x = this._tText.width; - this._textFieldTooltipExtension.y = (((this._tText.y + this._tText.height) - this._textFieldTooltipExtension.textHeight) - 10); - if (!(this._tText.wordWrap)) - { - this._textFieldTooltipExtension.y = this._tText.y; - this._tText.height = (this._tText.textHeight + 3); - __height = this._tText.height; + this._textFieldTooltipExtension.removeEventListener(MouseEvent.ROLL_OVER,this.onTooltipExtensionOver); + this._textFieldTooltipExtension.removeEventListener(MouseEvent.ROLL_OUT,this.onTooltipExtensionOut); + this._textFieldTooltipExtension = null; + } + } + + private function addEllipsis() : void + { + var _loc1_:* = 0; + var _loc2_:* = 0; + if(this._tText.text.length - 3 > 0) + { + this._tText.text = this._tText.text.substr(0,this._tText.text.length - 3); + _loc1_ = this._tText.text.length - 1; + while(_loc1_ >= 0 && this._tText.text.charAt(_loc1_) == " ") + { + _loc2_++; + _loc1_--; } - else - { - if (this._bFixedHeightForMultiline) - { - this._tText.height = (this.height + 3); - __height = this._tText.height; - switch (this._sVerticalAlign.toUpperCase()) - { - case VALIGN_CENTER: - this._tText.y = ((this.height - this._tText.height) / 2); - break; - case VALIGN_BOTTOM: - this._tText.y = (this.height - this._tText.height); - break; - default: - this._tText.y = 0; - }; - this._textFieldTooltipExtension.y = (((this._tText.y + this._tText.height) - this._textFieldTooltipExtension.textHeight) - 5); - }; - }; - var target:DisplayObjectContainer = this; - var i:int; - while (i < 4) - { - if ((target is ButtonContainer)) - { - (target as ButtonContainer).mouseChildren = true; - break; - }; - target = target.parent; - if (!(target)) - { - break; - }; - i++; - }; - this._textFieldTooltipExtension.addEventListener(MouseEvent.ROLL_OVER, this.onTooltipExtensionOver, false, 0, true); - this._textFieldTooltipExtension.addEventListener(MouseEvent.ROLL_OUT, this.onTooltipExtensionOut, false, 0, true); - this._textFieldTooltipExtension.addEventListener(MouseEvent.MOUSE_WHEEL, this.onTooltipExtensionOut, false, 0, true); - } - - private function updateTooltipExtensionStyle():void - { - if (!(this._textFieldTooltipExtension)) - { - return; - }; - this._textFieldTooltipExtension.embedFonts = this._tText.embedFonts; - this._textFieldTooltipExtension.defaultTextFormat = this._tfFormatter; - this._textFieldTooltipExtension.setTextFormat(this._tfFormatter); - this._textTooltipExtensionColor = uint(this._tfFormatter.color); - this._textFieldTooltipExtension.textColor = this._textTooltipExtensionColor; - } - - private function onTextClick(e:TextEvent):void - { - e.stopPropagation(); - Berilia.getInstance().handler.process(new TextClickMessage(this, e.text)); - } - - protected function updateAlign():void - { - if (!(this._tText.textHeight)) + if(_loc2_ > 0) { - return; - }; - var h:int; - var i:int; - while (i < this._tText.numLines) + this._tText.text = this._tText.text.substr(0,this._tText.text.length - _loc2_); + } + this._tText.appendText(String.fromCharCode(8230)); + } + } + + private function addTooltipExtension() : void + { + this._textFieldTooltipExtension = new TextField(); + this._textFieldTooltipExtension.selectable = false; + this._textFieldTooltipExtension.height = 1; + this._textFieldTooltipExtension.width = 1; + this._textFieldTooltipExtension.autoSize = TextFieldAutoSize.LEFT; + this.updateTooltipExtensionStyle(); + this._textFieldTooltipExtension.text = "..."; + this._textFieldTooltipExtension.name = "extension_" + name; + addChild(this._textFieldTooltipExtension); + var _loc1_:int = this._textFieldTooltipExtension.width + 2; + this._tText.width = this._tText.width - _loc1_; + __width = this._tText.width; + this._textFieldTooltipExtension.x = this._tText.width; + this._textFieldTooltipExtension.y = this._tText.y + this._tText.height - this._textFieldTooltipExtension.textHeight - 10; + if(!this._tText.wordWrap) + { + this._textFieldTooltipExtension.y = this._tText.y; + this._tText.height = this._tText.textHeight + 3; + __height = this._tText.height; + } + else if(this._bFixedHeightForMultiline) + { + this._tText.height = this.height + 3; + __height = this._tText.height; + switch(this._sVerticalAlign.toUpperCase()) + { + case VALIGN_CENTER: + this._tText.y = (this.height - this._tText.height) / 2; + break; + case VALIGN_BOTTOM: + this._tText.y = this.height - this._tText.height; + break; + default: + this._tText.y = 0; + } + this._textFieldTooltipExtension.y = this._tText.y + this._tText.height - this._textFieldTooltipExtension.textHeight - 5; + } + + var _loc2_:DisplayObjectContainer = this; + var _loc3_:* = 0; + while(_loc3_ < 4) + { + if(_loc2_ is ButtonContainer) + { + (_loc2_ as ButtonContainer).mouseChildren = true; + break; + } + _loc2_ = _loc2_.parent; + if(!_loc2_) { - h = (h + ((TextLineMetrics(this._tText.getLineMetrics(i)).height + TextLineMetrics(this._tText.getLineMetrics(i)).leading) + TextLineMetrics(this._tText.getLineMetrics(i)).descent)); - i++; - }; - switch (this._sVerticalAlign.toUpperCase()) + break; + } + _loc3_++; + } + this._textFieldTooltipExtension.addEventListener(MouseEvent.ROLL_OVER,this.onTooltipExtensionOver,false,0,true); + this._textFieldTooltipExtension.addEventListener(MouseEvent.ROLL_OUT,this.onTooltipExtensionOut,false,0,true); + this._textFieldTooltipExtension.addEventListener(MouseEvent.MOUSE_WHEEL,this.onTooltipExtensionOut,false,0,true); + } + + private function updateTooltipExtensionStyle() : void + { + if(!this._textFieldTooltipExtension) + { + return; + } + this._textFieldTooltipExtension.embedFonts = this._tText.embedFonts; + this._textFieldTooltipExtension.defaultTextFormat = this._tfFormatter; + this._textFieldTooltipExtension.setTextFormat(this._tfFormatter); + this._textTooltipExtensionColor = uint(this._tfFormatter.color); + this._textFieldTooltipExtension.textColor = this._textTooltipExtensionColor; + } + + private function onTextClick(param1:TextEvent) : void + { + param1.stopPropagation(); + Berilia.getInstance().handler.process(new TextClickMessage(this,param1.text)); + } + + protected function updateAlign() : void + { + if(!this._tText.textHeight) + { + return; + } + var _loc1_:* = 0; + var _loc2_:* = 0; + while(_loc2_ < this._tText.numLines) + { + _loc1_ = _loc1_ + (TextLineMetrics(this._tText.getLineMetrics(_loc2_)).height + TextLineMetrics(this._tText.getLineMetrics(_loc2_)).leading + TextLineMetrics(this._tText.getLineMetrics(_loc2_)).descent); + _loc2_++; + } + switch(this._sVerticalAlign.toUpperCase()) + { + case VALIGN_CENTER: + this._tText.height = _loc1_; + this._tText.y = (this.height - this._tText.height) / 2; + break; + case VALIGN_BOTTOM: + this._tText.height = this.height; + this._tText.y = this.height - _loc1_; + break; + case VALIGN_TOP: + this._tText.height = _loc1_; + this._tText.y = 0; + break; + case VALIGN_FIXEDHEIGHT: + if(!this._tText.wordWrap || (this._tText.multiline)) + { + this._tText.height = this._tText.textHeight + HEIGHT_OFFSET; + } + this._tText.y = 0; + break; + case VALIGN_NONE: + if(!this._tText.wordWrap || (this._tText.multiline)) + { + this._tText.height = this._tText.textHeight + 4 + HEIGHT_OFFSET; + } + this._tText.y = 0; + break; + } + } + + private function onTooltipExtensionOver(param1:MouseEvent) : void + { + var _loc2_:Sprite = Berilia.getInstance().docMain; + TooltipManager.show(new TextTooltipInfo(this._tText.text),this,UiModuleManager.getInstance().getModule("Ankama_Tooltips"),false,"TextExtension",LocationEnum.POINT_TOP,LocationEnum.POINT_BOTTOM,20,true,null,TooltipManager.defaultTooltipUiScript,null,"TextInfo"); + this._textFieldTooltipExtension.textColor = 16765814; + } + + private function onTooltipExtensionOut(param1:MouseEvent = null) : void + { + TooltipManager.hide("TextExtension"); + this._textFieldTooltipExtension.textColor = this._textTooltipExtensionColor; + } + + public function finalize() : void + { + var _loc1_:UiRootContainer = null; + if(this._binded) + { + if(this._autoResize) + { + this.resizeText(); + } + if(this._hyperlinkEnabled) { - case VALIGN_CENTER: - this._tText.height = h; - this._tText.y = ((this.height - this._tText.height) / 2); - return; - case VALIGN_BOTTOM: - this._tText.height = this.height; - this._tText.y = (this.height - h); - return; - case VALIGN_TOP: - this._tText.height = h; - this._tText.y = 0; - return; - case VALIGN_FIXEDHEIGHT: - if (((!(this._tText.wordWrap)) || (this._tText.multiline))) - { - this._tText.height = (this._tText.textHeight + HEIGHT_OFFSET); - }; - this._tText.y = 0; - return; - case VALIGN_NONE: - if (((!(this._tText.wordWrap)) || (this._tText.multiline))) - { - this._tText.height = ((this._tText.textHeight + 4) + HEIGHT_OFFSET); - }; - this._tText.y = 0; - return; - }; - } - - private function onTooltipExtensionOver(e:MouseEvent):void - { - var docMain:Sprite = Berilia.getInstance().docMain; - TooltipManager.show(new TextTooltipInfo(this._tText.text), this, UiModuleManager.getInstance().getModule("Ankama_Tooltips"), false, "TextExtension", LocationEnum.POINT_TOP, LocationEnum.POINT_BOTTOM, 20, true, null, TooltipManager.defaultTooltipUiScript, null, "TextInfo"); - this._textFieldTooltipExtension.textColor = 16765814; - } - - private function onTooltipExtensionOut(e:MouseEvent=null):void - { - TooltipManager.hide("TextExtension"); - this._textFieldTooltipExtension.textColor = this._textTooltipExtensionColor; - } - - public function finalize():void - { - var ui:UiRootContainer; - if (this._binded) + HyperlinkFactory.createTextClickHandler(this._tText); + HyperlinkFactory.createRollOverHandler(this._tText); + this.parseLinks(); + } + this._finalized = true; + _loc1_ = getUi(); + if(_loc1_) { - if (this._autoResize) - { - this.resizeText(); - }; - if (this._hyperlinkEnabled) - { - HyperlinkFactory.createTextClickHandler(this._tText); - HyperlinkFactory.createRollOverHandler(this._tText); - this.parseLinks(); - }; - this._finalized = true; - ui = getUi(); - if (ui) - { - ui.iAmFinalized(this); - }; + _loc1_.iAmFinalized(this); + } + } + else + { + this._needToFinalize = true; + } + } + + public function get bmpText() : BitmapData + { + var _loc1_:Matrix = new Matrix(); + var _loc2_:BitmapData = new BitmapData(this.width,this.height,true,16711680); + _loc2_.draw(this._tText,_loc1_,null,null,null,true); + return _loc2_; + } + + private function parseLinks() : void + { + var _loc2_:Object = null; + var _loc3_:String = null; + var _loc5_:Array = null; + var _loc6_:Array = null; + var _loc7_:* = 0; + var _loc8_:* = 0; + var _loc9_:* = 0; + var _loc1_:Array = this._tText.getTextRuns(); + var _loc4_:int = _loc1_.length; + this._lastHyperLinkId = -1; + this._hyperLinks.length = 0; + _loc8_ = 0; + while(_loc8_ < _loc4_) + { + _loc2_ = _loc1_[_loc8_]; + if((_loc2_.textFormat) && _loc2_.textFormat.url.length > 0) + { + _loc3_ = this._tText.text.substring(_loc2_.beginIndex,_loc2_.endIndex); + _loc5_ = StringUtils.getAllIndexOf("[",_loc3_); + _loc6_ = StringUtils.getAllIndexOf("]",_loc3_); + if(_loc5_.length > 1 && _loc5_.length == _loc6_.length) + { + _loc7_ = _loc5_.length; + _loc9_ = 0; + while(_loc9_ < _loc7_) + { + this._hyperLinks.push({ + "beginIndex":_loc2_.beginIndex + _loc5_[_loc9_], + "endIndex":_loc2_.beginIndex + _loc6_[_loc9_], + "textFormat":_loc2_.textFormat + }); + _loc9_++; + } + } + else + { + this._hyperLinks.push(_loc2_); + } + } + _loc8_++; + } + } + + private function getHyperLinkId(param1:int) : int + { + var _loc2_:* = 0; + var _loc4_:* = 0; + var _loc3_:int = this._hyperLinks.length; + _loc4_ = 0; + while(_loc4_ < _loc3_) + { + if(param1 >= this._hyperLinks[_loc4_].beginIndex && param1 <= this._hyperLinks[_loc4_].endIndex) + { + return _loc4_; + } + _loc4_++; + } + return -1; + } + + private function onMouseMove(param1:MouseEvent) : void + { + var _loc2_:* = 0; + var _loc3_:* = NaN; + var _loc4_:* = 0; + var _loc5_:* = NaN; + var _loc6_:* = 0; + var _loc7_:* = 0; + var _loc8_:* = NaN; + var _loc9_:Point = null; + var _loc10_:* = false; + var _loc11_:* = 0; + var _loc12_:String = null; + var _loc13_:Array = null; + var _loc14_:String = null; + var _loc15_:Point = null; + var _loc16_:String = null; + if(this._tText.length > 0) + { + _loc2_ = this._tText.getCharIndexAtPoint(param1.localX,param1.localY); + _loc3_ = 4; + _loc5_ = this._tText.getLineMetrics(0).height; + _loc7_ = this._tText.numLines; + _loc6_ = 0; + while(_loc6_ < _loc7_) + { + _loc3_ = _loc3_ + _loc5_; + if(_loc3_ <= this._tText.height) + { + _loc4_++; + _loc6_++; + continue; + } + break; + } + _loc8_ = this._tText.height - _loc4_ * _loc5_; + _loc9_ = parent.localToGlobal(new Point(x,y)); + _loc10_ = param1.stageY > _loc9_.y + this._tText.height - _loc8_?false:true; + if((_loc10_) && !(_loc2_ == -1)) + { + _loc11_ = this.getHyperLinkId(_loc2_); + _loc12_ = _loc11_ >= 0?this._hyperLinks[_loc11_].textFormat.url:null; + if(_loc12_) + { + if((this._mouseOverHyperLink) && this._lastHyperLinkId >= 0 && !(_loc11_ == this._lastHyperLinkId)) + { + this._mouseOverHyperLink = true; + this.hyperlinkRollOut(); + } + if(!this._mouseOverHyperLink) + { + _loc13_ = _loc12_.replace("event:","").split(","); + _loc14_ = _loc13_.shift(); + _loc15_ = new Point(param1.stageX,_loc9_.y + this._tText.getCharBoundaries(_loc2_).y); + _loc16_ = _loc14_ + "," + Math.round(_loc15_.x) + "," + Math.round(_loc15_.y) + "," + _loc13_.join(","); + this._tText.dispatchEvent(new LinkInteractionEvent(LinkInteractionEvent.ROLL_OVER,_loc16_)); + this._mouseOverHyperLink = true; + this._lastHyperLinkId = _loc11_; + } + } + else + { + this.hyperlinkRollOut(); + } } else { - this._needToFinalize = true; - }; - } - - public function get bmpText():BitmapData - { - var m:Matrix = new Matrix(); - var bmpdt:BitmapData = new BitmapData(this.width, this.height, true, 0xFF0000); - bmpdt.draw(this._tText, m, null, null, null, true); - return (bmpdt); - } - - private function parseLinks():void - { - var textrun:Object; - var textrunText:String; - var openSquareBrackets:Array; - var closeSquareBrackets:Array; - var nbBrackets:int; - var i:int; - var j:int; - var textruns:Array = this._tText.getTextRuns(); - var nbRuns:int = textruns.length; - this._lastHyperLinkId = -1; - this._hyperLinks.length = 0; - i = 0; - while (i < nbRuns) - { - textrun = textruns[i]; - if (((textrun.textFormat) && ((textrun.textFormat.url.length > 0)))) - { - textrunText = this._tText.text.substring(textrun.beginIndex, textrun.endIndex); - openSquareBrackets = StringUtils.getAllIndexOf("[", textrunText); - closeSquareBrackets = StringUtils.getAllIndexOf("]", textrunText); - if ((((openSquareBrackets.length > 1)) && ((openSquareBrackets.length == closeSquareBrackets.length)))) - { - nbBrackets = openSquareBrackets.length; - j = 0; - while (j < nbBrackets) - { - this._hyperLinks.push({ - "beginIndex":(textrun.beginIndex + openSquareBrackets[j]), - "endIndex":(textrun.beginIndex + closeSquareBrackets[j]), - "textFormat":textrun.textFormat - }); - j++; - }; - } - else - { - this._hyperLinks.push(textrun); - }; - }; - i++; - }; - } - - private function getHyperLinkId(pCharIndex:int):int - { - var hyperLinkId:int; - var i:int; - var nbLinks:int = this._hyperLinks.length; - i = 0; - while (i < nbLinks) - { - if ((((pCharIndex >= this._hyperLinks[i].beginIndex)) && ((pCharIndex <= this._hyperLinks[i].endIndex)))) - { - return (i); - }; - i++; - }; - return (-1); - } - - private function onMouseMove(pEvent:MouseEvent):void - { - var charIndex:int; - var textHeight:Number; - var nbVisibleLines:int; - var lineHeight:Number; - var i:int; - var numLines:int; - var bottomMargin:Number; - var labelGlobalPos:Point; - var mouseOverText:Boolean; - var hyperLinkId:int; - var url:String; - var params:Array; - var type:String; - var pos:Point; - var data:String; - if (this._tText.length > 0) - { - charIndex = this._tText.getCharIndexAtPoint(pEvent.localX, pEvent.localY); - textHeight = 4; - lineHeight = this._tText.getLineMetrics(0).height; - numLines = this._tText.numLines; - i = 0; - while (i < numLines) - { - textHeight = (textHeight + lineHeight); - if (textHeight <= this._tText.height) - { - nbVisibleLines++; - } - else - { - break; - }; - i++; - }; - bottomMargin = (this._tText.height - (nbVisibleLines * lineHeight)); - labelGlobalPos = parent.localToGlobal(new Point(x, y)); - mouseOverText = (((pEvent.stageY > ((labelGlobalPos.y + this._tText.height) - bottomMargin))) ? false : true); - if (((mouseOverText) && (!((charIndex == -1))))) - { - hyperLinkId = this.getHyperLinkId(charIndex); - url = (((hyperLinkId >= 0)) ? this._hyperLinks[hyperLinkId].textFormat.url : null); - if (url) - { - if (((this._mouseOverHyperLink) && ((((this._lastHyperLinkId >= 0)) && (!((hyperLinkId == this._lastHyperLinkId))))))) - { - this._mouseOverHyperLink = true; - this.hyperlinkRollOut(); - }; - if (!(this._mouseOverHyperLink)) - { - params = url.replace("event:", "").split(","); - type = params.shift(); - pos = new Point(pEvent.stageX, (labelGlobalPos.y + this._tText.getCharBoundaries(charIndex).y)); - data = ((((((type + ",") + Math.round(pos.x)) + ",") + Math.round(pos.y)) + ",") + params.join(",")); - this._tText.dispatchEvent(new LinkInteractionEvent(LinkInteractionEvent.ROLL_OVER, data)); - this._mouseOverHyperLink = true; - this._lastHyperLinkId = hyperLinkId; - }; - } - else - { - this.hyperlinkRollOut(); - }; - } - else - { - this.hyperlinkRollOut(); - }; - }; - } - - private function hyperlinkRollOut(pEvent:MouseEvent=null):void - { - if (((pEvent) || (this._mouseOverHyperLink))) - { - TooltipManager.hideAll(); - this._tText.dispatchEvent(new LinkInteractionEvent(LinkInteractionEvent.ROLL_OUT)); - }; - this._mouseOverHyperLink = false; - } - - - } -}//package com.ankamagames.berilia.components - + this.hyperlinkRollOut(); + } + } + } + + private function hyperlinkRollOut(param1:MouseEvent = null) : void + { + if((param1) || (this._mouseOverHyperLink)) + { + TooltipManager.hideAll(); + this._tText.dispatchEvent(new LinkInteractionEvent(LinkInteractionEvent.ROLL_OUT)); + } + this._mouseOverHyperLink = false; + } + } +} diff --git a/com/ankamagames/berilia/components/LinkedLabel.as b/com/ankamagames/berilia/components/LinkedLabel.as index f92d6886b..ff452b231 100644 --- a/com/ankamagames/berilia/components/LinkedLabel.as +++ b/com/ankamagames/berilia/components/LinkedLabel.as @@ -1,58 +1,57 @@ -package com.ankamagames.berilia.components +package com.ankamagames.berilia.components { - import com.ankamagames.jerakine.handlers.messages.mouse.MouseClickMessage; - import flash.net.navigateToURL; - import flash.net.URLRequest; - import com.ankamagames.jerakine.messages.Message; - - public class LinkedLabel extends Label - { - - private var _sUrl:String; - private var _sTarget:String = "_blank"; - - public function LinkedLabel() - { - buttonMode = true; - mouseChildren = false; - } - - public function get url():String - { - return (this._sUrl); - } - - public function set url(value:String):void - { - this._sUrl = value; - } - - public function get target():String - { - return (this._sTarget); - } - - public function set target(value:String):void - { - this._sTarget = value; - } - - [HideInFakeClass] - override public function process(msg:Message):Boolean - { - switch (true) - { - case (msg is MouseClickMessage): - if (((((((msg as MouseClickMessage).target == this)) && (getUi()))) && (getUi().uiModule.trusted))) - { - navigateToURL(new URLRequest(this.url), this.target); - return (true); - }; - }; - return (false); - } - - - } -}//package com.ankamagames.berilia.components - + import com.ankamagames.jerakine.messages.Message; + import com.ankamagames.jerakine.handlers.messages.mouse.MouseClickMessage; + import flash.net.navigateToURL; + import flash.net.URLRequest; + + public class LinkedLabel extends Label + { + + public function LinkedLabel() + { + super(); + buttonMode = true; + mouseChildren = false; + } + + private var _sUrl:String; + + private var _sTarget:String = "_blank"; + + public function get url() : String + { + return this._sUrl; + } + + public function set url(param1:String) : void + { + this._sUrl = param1; + } + + public function get target() : String + { + return this._sTarget; + } + + public function set target(param1:String) : void + { + this._sTarget = param1; + } + + override public function process(param1:Message) : Boolean + { + switch(true) + { + case param1 is MouseClickMessage: + if(((param1 as MouseClickMessage).target == this) && (getUi()) && (getUi().uiModule.trusted)) + { + navigateToURL(new URLRequest(this.url),this.target); + return true; + } + break; + } + return false; + } + } +} diff --git a/com/ankamagames/berilia/components/MapIconElement.as b/com/ankamagames/berilia/components/MapIconElement.as index a56b908b6..dc29b08b0 100644 --- a/com/ankamagames/berilia/components/MapIconElement.as +++ b/com/ankamagames/berilia/components/MapIconElement.as @@ -1,58 +1,62 @@ -package com.ankamagames.berilia.components +package com.ankamagames.berilia.components { - import com.ankamagames.berilia.types.data.MapElement; - import com.ankamagames.berilia.managers.SecureCenter; - import flash.geom.Rectangle; - - public class MapIconElement extends MapElement - { - - public var texture:Object; - public var legend:String; - public var follow:Boolean; - public var canBeGrouped:Boolean = true; - public var canBeAutoSize:Boolean = true; - public var canBeManuallyRemoved:Boolean = true; - private var _boundsRef:Texture; - var _texture:Texture; - - public function MapIconElement(id:String, x:int, y:int, layer:String, texture:Texture, legend:String, owner:*, canBeManuallyRemoved:Boolean=true) - { - super(id, x, y, layer, owner); - this.texture = SecureCenter.secure(texture, false); - this.legend = legend; - this.canBeManuallyRemoved = canBeManuallyRemoved; - this._texture = texture; - texture.mouseEnabled = true; - } - - public function get bounds():Rectangle - { - return (((this._boundsRef) ? this._boundsRef.getStageRect() : ((this._texture) ? this._texture.getStageRect() : null))); - } - - public function set boundsRef(v:Texture):void - { - this._boundsRef = v; - } - - override public function remove():void - { - if (this._texture) + import com.ankamagames.berilia.types.data.MapElement; + import flash.geom.Rectangle; + import com.ankamagames.berilia.managers.SecureCenter; + + public class MapIconElement extends MapElement + { + + public function MapIconElement(param1:String, param2:int, param3:int, param4:String, param5:Texture, param6:String, param7:*, param8:Boolean = true) + { + super(param1,param2,param3,param4,param7); + this.texture = SecureCenter.secure(param5,false); + this.legend = param6; + this.canBeManuallyRemoved = param8; + this._texture = param5; + param5.mouseEnabled = true; + } + + public var texture:Object; + + public var legend:String; + + public var follow:Boolean; + + public var canBeGrouped:Boolean = true; + + public var canBeAutoSize:Boolean = true; + + public var canBeManuallyRemoved:Boolean = true; + + private var _boundsRef:Texture; + + public function get bounds() : Rectangle + { + return this._boundsRef?this._boundsRef.getStageRect():this._texture?this._texture.getStageRect():null; + } + + public function set boundsRef(param1:Texture) : void + { + this._boundsRef = param1; + } + + var _texture:Texture; + + override public function remove() : void + { + if(this._texture) + { + this._texture.remove(); + if(this._texture.parent) { - this._texture.remove(); - if (this._texture.parent) - { - this._texture.parent.removeChild(this._texture); - }; - }; - this._texture = null; - SecureCenter.destroy(this.texture); - this.texture = null; - super.remove(); - } - - - } -}//package com.ankamagames.berilia.components - + this._texture.parent.removeChild(this._texture); + } + } + this._texture = null; + SecureCenter.destroy(this.texture); + this.texture = null; + super.remove(); + } + } +} diff --git a/com/ankamagames/berilia/components/MapViewer.as b/com/ankamagames/berilia/components/MapViewer.as index 56df849fc..39a7f47a1 100644 --- a/com/ankamagames/berilia/components/MapViewer.as +++ b/com/ankamagames/berilia/components/MapViewer.as @@ -1,1630 +1,1647 @@ -package com.ankamagames.berilia.components +package com.ankamagames.berilia.components { - import com.ankamagames.berilia.types.graphic.GraphicContainer; - import com.ankamagames.berilia.FinalizableUIComponent; - import flash.utils.Dictionary; - import com.ankamagames.jerakine.logger.Logger; - import com.ankamagames.jerakine.logger.Log; - import flash.utils.getQualifiedClassName; - import flash.display.Sprite; - import flash.display.Shape; - import com.ankamagames.berilia.types.graphic.MapGroupElement; - import flash.geom.Rectangle; - import com.ankamagames.berilia.types.data.Map; - import __AS3__.vec.Vector; - import com.ankamagames.berilia.types.data.MapArea; - import com.ankamagames.jerakine.utils.system.AirScanner; - import com.ankamagames.jerakine.utils.display.StageShareManager; - import flash.events.Event; - import flash.geom.Point; - import flash.display.InteractiveObject; - import com.ankamagames.berilia.types.data.MapElement; - import com.ankamagames.berilia.Berilia; - import com.ankamagames.berilia.components.messages.MapMoveMessage; - import flash.geom.ColorTransform; - import com.ankamagames.jerakine.types.Uri; - import com.ankamagames.berilia.types.graphic.MapAreaShape; - import flash.display.Graphics; - import com.ankamagames.berilia.types.data.LinkedCursorData; - import flash.ui.Mouse; - import com.ankamagames.berilia.managers.LinkedCursorSpriteManager; - import com.ankamagames.jerakine.utils.display.EnterFrameDispatcher; - import com.ankamagames.jerakine.data.XmlConfig; - import flash.display.DisplayObject; - import flash.display.DisplayObjectContainer; - import com.ankamagames.berilia.components.messages.MapRollOverMessage; - import com.ankamagames.jerakine.handlers.messages.mouse.MouseOverMessage; - import com.ankamagames.jerakine.handlers.messages.mouse.MouseOutMessage; - import com.ankamagames.jerakine.handlers.messages.mouse.MouseClickMessage; - import com.ankamagames.jerakine.handlers.messages.mouse.MouseWheelMessage; - import com.ankamagames.jerakine.handlers.messages.mouse.MouseRightClickMessage; - import com.ankamagames.berilia.components.messages.MapElementRollOverMessage; - import com.ankamagames.berilia.components.messages.MapElementRollOutMessage; - import com.ankamagames.jerakine.handlers.messages.mouse.MouseDownMessage; - import com.ankamagames.berilia.managers.TooltipManager; - import com.ankamagames.jerakine.handlers.messages.mouse.MouseReleaseOutsideMessage; - import com.ankamagames.jerakine.handlers.messages.mouse.MouseUpMessage; - import com.ankamagames.berilia.components.messages.MapElementRightClickMessage; - import com.ankamagames.jerakine.messages.Message; - import __AS3__.vec.*; - - public class MapViewer extends GraphicContainer implements FinalizableUIComponent - { - - public static var MEMORY_LOG:Dictionary = new Dictionary(true); - protected static const _log:Logger = Log.getLogger(getQualifiedClassName(MapViewer)); - public static var FLAG_CURSOR:Class; - - private var _finalized:Boolean; - private var _showGrid:Boolean = false; - private var _mapBitmapContainer:Sprite; - private var _mapContainer:Sprite; - private var _arrowContainer:Sprite; - private var _grid:Shape; - private var _areaShapesContainer:Sprite; - private var _groupsContainer:Sprite; - private var _layersContainer:Sprite; - private var _openedMapGroupElement:MapGroupElement; - private var _elementsGraphicRef:Dictionary; - private var _lastMx:int; - private var _lastMy:int; - private var _viewRect:Rectangle; - private var _layers:Array; - private var _mapElements:Array; - private var _dragging:Boolean; - private var _currentMap:Map; - private var _availableMaps:Array; - private var _arrowPool:Array; - private var _arrowAllocation:Dictionary; - private var _reverseArrowAllocation:Dictionary; - private var _mapGroupElements:Dictionary; - private var _lastScaleIconUpdate:Number = -1; - private var _enable3DMode:Boolean = false; - private var _flagCursor:Sprite; - private var _flagCursorVisible:Boolean; - private var _mouseOnArrow:Boolean = false; - private var _zoomLevels:Array; - private var _zoomLevelsPercent:Array; - private var _visibleMapAreas:Vector.; - private var _mapToClear:Map; - public var mapWidth:Number; - public var mapHeight:Number; - public var origineX:int; - public var origineY:int; - public var maxScale:Number = 2; - public var minScale:Number = 0.5; - public var startScale:Number = 0.8; - public var roundCornerRadius:uint = 0; - public var enabledDrag:Boolean = true; - public var autoSizeIcon:Boolean = false; - public var gridLineThickness:Number = 0.5; - private var zz:Number = 1; - private var _lastMouseX:int = 0; - private var _lastMouseY:int = 0; - - public function MapViewer() - { - this._availableMaps = []; - this._arrowPool = new Array(); + import com.ankamagames.berilia.types.graphic.GraphicContainer; + import com.ankamagames.berilia.FinalizableUIComponent; + import flash.utils.Dictionary; + import com.ankamagames.jerakine.logger.Logger; + import com.ankamagames.jerakine.logger.Log; + import flash.utils.getQualifiedClassName; + import flash.display.Sprite; + import flash.display.Shape; + import com.ankamagames.berilia.types.graphic.MapGroupElement; + import flash.geom.Rectangle; + import com.ankamagames.berilia.types.data.Map; + import com.ankamagames.berilia.types.data.MapArea; + import flash.geom.Point; + import flash.display.InteractiveObject; + import com.ankamagames.berilia.types.data.MapElement; + import com.ankamagames.berilia.Berilia; + import com.ankamagames.berilia.components.messages.MapMoveMessage; + import flash.geom.ColorTransform; + import com.ankamagames.jerakine.types.Uri; + import com.ankamagames.berilia.types.graphic.MapAreaShape; + import flash.display.Graphics; + import com.ankamagames.berilia.types.data.LinkedCursorData; + import flash.ui.Mouse; + import com.ankamagames.berilia.managers.LinkedCursorSpriteManager; + import com.ankamagames.jerakine.utils.display.EnterFrameDispatcher; + import com.ankamagames.jerakine.utils.system.AirScanner; + import com.ankamagames.jerakine.utils.display.StageShareManager; + import flash.events.Event; + import com.ankamagames.jerakine.data.XmlConfig; + import flash.display.DisplayObjectContainer; + import flash.display.DisplayObject; + import com.ankamagames.berilia.components.messages.MapRollOverMessage; + import com.ankamagames.jerakine.messages.Message; + import com.ankamagames.jerakine.handlers.messages.mouse.MouseOverMessage; + import com.ankamagames.jerakine.handlers.messages.mouse.MouseOutMessage; + import com.ankamagames.jerakine.handlers.messages.mouse.MouseClickMessage; + import com.ankamagames.jerakine.handlers.messages.mouse.MouseWheelMessage; + import com.ankamagames.jerakine.handlers.messages.mouse.MouseRightClickMessage; + import com.ankamagames.berilia.components.messages.MapElementRollOverMessage; + import com.ankamagames.berilia.components.messages.MapElementRollOutMessage; + import com.ankamagames.berilia.managers.TooltipManager; + import com.ankamagames.berilia.components.messages.MapElementRightClickMessage; + import com.ankamagames.jerakine.handlers.messages.mouse.MouseDownMessage; + import com.ankamagames.jerakine.handlers.messages.mouse.MouseReleaseOutsideMessage; + import com.ankamagames.jerakine.handlers.messages.mouse.MouseUpMessage; + + public class MapViewer extends GraphicContainer implements FinalizableUIComponent + { + + public function MapViewer() + { + this._availableMaps = []; + this._arrowPool = new Array(); + this._arrowAllocation = new Dictionary(); + this._reverseArrowAllocation = new Dictionary(); + this._mapGroupElements = new Dictionary(); + this._zoomLevels = []; + super(); + MEMORY_LOG[this] = 1; + if(AirScanner.hasAir()) + { + StageShareManager.stage.nativeWindow.addEventListener(Event.DEACTIVATE,this.onWindowDeactivate); + } + } + + public static var MEMORY_LOG:Dictionary = new Dictionary(true); + + protected static const _log:Logger = Log.getLogger(getQualifiedClassName(MapViewer)); + + public static var FLAG_CURSOR:Class; + + private var _finalized:Boolean; + + private var _showGrid:Boolean = false; + + private var _mapBitmapContainer:Sprite; + + private var _mapContainer:Sprite; + + private var _arrowContainer:Sprite; + + private var _grid:Shape; + + private var _areaShapesContainer:Sprite; + + private var _groupsContainer:Sprite; + + private var _layersContainer:Sprite; + + private var _openedMapGroupElement:MapGroupElement; + + private var _elementsGraphicRef:Dictionary; + + private var _lastMx:int; + + private var _lastMy:int; + + private var _viewRect:Rectangle; + + private var _layers:Array; + + private var _mapElements:Array; + + private var _dragging:Boolean; + + private var _currentMap:Map; + + private var _availableMaps:Array; + + private var _arrowPool:Array; + + private var _arrowAllocation:Dictionary; + + private var _reverseArrowAllocation:Dictionary; + + private var _mapGroupElements:Dictionary; + + private var _lastScaleIconUpdate:Number = -1; + + private var _enable3DMode:Boolean = false; + + private var _flagCursor:Sprite; + + private var _flagCursorVisible:Boolean; + + private var _mouseOnArrow:Boolean = false; + + private var _zoomLevels:Array; + + private var _zoomLevelsPercent:Array; + + private var _visibleMapAreas:Vector.; + + private var _mapToClear:Map; + + public var mapWidth:Number; + + public var mapHeight:Number; + + public var origineX:int; + + public var origineY:int; + + public var maxScale:Number = 2; + + public var minScale:Number = 0.5; + + public var startScale:Number = 0.8; + + public var roundCornerRadius:uint = 0; + + public var enabledDrag:Boolean = true; + + public var autoSizeIcon:Boolean = false; + + public var gridLineThickness:Number = 0.5; + + public function get mapContainerBounds() : Rectangle + { + return new Rectangle(this._mapContainer.x,this._mapContainer.y,this._mapContainer.width,this._mapContainer.height); + } + + public function get finalized() : Boolean + { + return this._finalized; + } + + public function set finalized(param1:Boolean) : void + { + this._finalized = param1; + } + + public function get showGrid() : Boolean + { + return this._showGrid; + } + + public function set showGrid(param1:Boolean) : void + { + this._showGrid = param1; + this.drawGrid(); + } + + public function get isDragging() : Boolean + { + return this._dragging; + } + + public function get visibleMaps() : Rectangle + { + var _loc1_:Number = -(this._mapContainer.x / this._mapContainer.scaleX + this.origineX) / this.mapWidth; + var _loc2_:Number = -(this._mapContainer.y / this._mapContainer.scaleY + this.origineY) / this.mapHeight; + var _loc3_:Number = width / (this.mapWidth * this._mapContainer.scaleX) - 1; + var _loc4_:Number = height / (this.mapHeight * this._mapContainer.scaleY) - 1; + var _loc5_:Number = Math.ceil(_loc3_); + var _loc6_:Number = Math.ceil(_loc4_); + return new Rectangle(_loc1_,_loc2_,_loc5_ < 1?1:_loc5_,_loc6_ < 1?1:_loc6_); + } + + public function get currentMouseMapX() : int + { + return this._lastMx; + } + + public function get currentMouseMapY() : int + { + return this._lastMy; + } + + public function get mapBounds() : Rectangle + { + var _loc1_:Rectangle = new Rectangle(); + _loc1_.x = Math.floor(-this.origineX / this.mapWidth); + _loc1_.y = Math.floor(-this.origineY / this.mapHeight); + if(this._currentMap) + { + _loc1_.width = Math.round(this._currentMap.initialWidth / this.mapWidth); + _loc1_.height = Math.round(this._currentMap.initialHeight / this.mapHeight); + } + else + { + _loc1_.width = Math.round(this._mapBitmapContainer.width / this.mapWidth); + _loc1_.height = Math.round(this._mapBitmapContainer.height / this.mapHeight); + } + return _loc1_; + } + + public function set mapAlpha(param1:Number) : void + { + this._mapBitmapContainer.alpha = param1; + } + + public function get mapPixelPosition() : Point + { + return new Point(this._mapContainer.x,this._mapContainer.y); + } + + public function get zoomFactor() : Number + { + return Number(this._mapContainer.scaleX.toFixed(2)); + } + + override public function set width(param1:Number) : void + { + super.width = param1; + if(this.finalized) + { + this.initMask(); + this.updateVisibleChunck(false); + this.updateMapElements(); + } + } + + override public function set height(param1:Number) : void + { + super.height = param1; + if(this.finalized) + { + this.initMask(); + this.updateVisibleChunck(false); + this.updateMapElements(); + } + } + + public function setSize(param1:Number, param2:Number) : void + { + super.width = param1; + super.height = param2; + if(this.finalized) + { + this.initMask(); + this.updateVisibleChunck(false); + this.updateMapElements(); + } + } + + public function get zoomStep() : Number + { + return this._availableMaps.length > 0?this.maxScale / this._availableMaps.length:NaN; + } + + public function get zoomLevels() : Array + { + return this._zoomLevels; + } + + public function get allLayersVisible() : Boolean + { + var _loc1_:Sprite = null; + for each(_loc1_ in this._layers) + { + if(!_loc1_.visible) + { + return false; + } + } + return true; + } + + public function finalize() : void + { + var _loc2_:Texture = null; + var _loc3_:InteractiveObject = null; + destroy(this._mapBitmapContainer); + destroy(this._mapContainer); + destroy(this._areaShapesContainer); + destroy(this._groupsContainer); + destroy(this._layersContainer); + if((this._arrowPool) && (this._arrowAllocation)) + { + for each(_loc2_ in this._arrowAllocation) + { + this._arrowPool.push(_loc2_); + } this._arrowAllocation = new Dictionary(); - this._reverseArrowAllocation = new Dictionary(); - this._mapGroupElements = new Dictionary(); - this._zoomLevels = []; - super(); - MEMORY_LOG[this] = 1; - if (AirScanner.hasAir()) - { - StageShareManager.stage.nativeWindow.addEventListener(Event.DEACTIVATE, this.onWindowDeactivate); - }; - } - - public function get mapContainerBounds():Rectangle - { - return (new Rectangle(this._mapContainer.x, this._mapContainer.y, this._mapContainer.width, this._mapContainer.height)); - } - - public function get finalized():Boolean - { - return (this._finalized); - } - - public function set finalized(b:Boolean):void - { - this._finalized = b; - } - - public function get showGrid():Boolean - { - return (this._showGrid); - } - - public function set showGrid(b:Boolean):void - { - this._showGrid = b; - this.drawGrid(); - } - - public function get isDragging():Boolean - { - return (this._dragging); - } - - public function get visibleMaps():Rectangle - { - var vX:Number = (-(((this._mapContainer.x / this._mapContainer.scaleX) + this.origineX)) / this.mapWidth); - var vY:Number = (-(((this._mapContainer.y / this._mapContainer.scaleY) + this.origineY)) / this.mapHeight); - var vWidth:Number = ((width / (this.mapWidth * this._mapContainer.scaleX)) - 1); - var vHeight:Number = ((height / (this.mapHeight * this._mapContainer.scaleY)) - 1); - var w:Number = Math.ceil(vWidth); - var h:Number = Math.ceil(vHeight); - return (new Rectangle(vX, vY, (((w < 1)) ? 1 : w), (((h < 1)) ? 1 : h))); - } - - public function get currentMouseMapX():int - { - return (this._lastMx); - } - - public function get currentMouseMapY():int - { - return (this._lastMy); - } - - public function get mapBounds():Rectangle - { - var rect:Rectangle = new Rectangle(); - rect.x = Math.floor((-(this.origineX) / this.mapWidth)); - rect.y = Math.floor((-(this.origineY) / this.mapHeight)); - if (this._currentMap) - { - rect.width = Math.round((this._currentMap.initialWidth / this.mapWidth)); - rect.height = Math.round((this._currentMap.initialHeight / this.mapHeight)); + } + MapElement.removeAllElements(this); + this._viewRect = new Rectangle(); + this._mapBitmapContainer = new Sprite(); + this._mapBitmapContainer.doubleClickEnabled = true; + this._mapBitmapContainer.mouseChildren = false; + this._mapBitmapContainer.mouseEnabled = false; + this._mapContainer = new Sprite(); + this._mapContainer.doubleClickEnabled = true; + this._arrowContainer = new Sprite(); + this._arrowContainer.mouseEnabled = false; + this._grid = new Shape(); + this._areaShapesContainer = new Sprite(); + this._areaShapesContainer.mouseEnabled = false; + this._groupsContainer = new Sprite(); + this._groupsContainer.mouseEnabled = false; + this._layersContainer = new Sprite(); + this._layersContainer.doubleClickEnabled = true; + this._elementsGraphicRef = new Dictionary(); + this._layers = []; + this._mapElements = []; + this.initMap(); + this._finalized = true; + var _loc1_:* = 0; + while(_loc1_ < numChildren) + { + _loc3_ = getChildAt(_loc1_) as InteractiveObject; + if(_loc3_) + { + _loc3_.doubleClickEnabled = true; } - else - { - rect.width = Math.round((this._mapBitmapContainer.width / this.mapWidth)); - rect.height = Math.round((this._mapBitmapContainer.height / this.mapHeight)); - }; - return (rect); - } - - public function set mapAlpha(value:Number):void - { - this._mapBitmapContainer.alpha = value; - } - - public function get mapPixelPosition():Point - { - return (new Point(this._mapContainer.x, this._mapContainer.y)); - } - - public function get zoomFactor():Number - { - return (Number(this._mapContainer.scaleX.toFixed(2))); - } - - override public function set width(nW:Number):void - { - super.width = nW; - if (this.finalized) - { - this.initMask(); - this.updateVisibleChunck(false); - this.updateMapElements(); - }; - } - - override public function set height(nH:Number):void - { - super.height = nH; - if (this.finalized) - { - this.initMask(); - this.updateVisibleChunck(false); - this.updateMapElements(); - }; - } - - public function setSize(w:Number, h:Number):void - { - super.width = w; - super.height = h; - if (this.finalized) - { - this.initMask(); - this.updateVisibleChunck(false); - this.updateMapElements(); - }; - } - - public function get zoomStep():Number - { - return ((((this._availableMaps.length > 0)) ? (this.maxScale / this._availableMaps.length) : NaN)); - } - - public function get zoomLevels():Array - { - return (this._zoomLevels); - } - - public function get allLayersVisible():Boolean - { - var layer:Sprite; - for each (layer in this._layers) - { - if (!(layer.visible)) - { - return (false); - }; - }; - return (true); - } - - public function finalize():void - { - var arrow:Texture; - var child:InteractiveObject; - destroy(this._mapBitmapContainer); - destroy(this._mapContainer); - destroy(this._areaShapesContainer); - destroy(this._groupsContainer); - destroy(this._layersContainer); - if (((this._arrowPool) && (this._arrowAllocation))) - { - for each (arrow in this._arrowAllocation) - { - this._arrowPool.push(arrow); - }; - this._arrowAllocation = new Dictionary(); - }; - MapElement.removeAllElements(this); - this._viewRect = new Rectangle(); - this._mapBitmapContainer = new Sprite(); - this._mapBitmapContainer.doubleClickEnabled = true; - this._mapBitmapContainer.mouseChildren = false; - this._mapBitmapContainer.mouseEnabled = false; - this._mapContainer = new Sprite(); - this._mapContainer.doubleClickEnabled = true; - this._arrowContainer = new Sprite(); - this._arrowContainer.mouseEnabled = false; - this._grid = new Shape(); - this._areaShapesContainer = new Sprite(); - this._areaShapesContainer.mouseEnabled = false; - this._groupsContainer = new Sprite(); - this._groupsContainer.mouseEnabled = false; - this._layersContainer = new Sprite(); - this._layersContainer.doubleClickEnabled = true; - this._elementsGraphicRef = new Dictionary(); - this._layers = []; - this._mapElements = []; - this.initMap(); - this._finalized = true; - var i:int; - while (i < numChildren) - { - child = (getChildAt(i) as InteractiveObject); - if (child) - { - child.doubleClickEnabled = true; - }; - i++; - }; - this.setupZoomLevels(width, height); - getUi().iAmFinalized(this); - } - - public function setupZoomLevels(width:Number, height:Number):void - { - var zoom:Number; - var zoomsToRemove:Vector.; - for each (zoom in this._zoomLevels) - { - if (((this._currentMap) && (((((this._currentMap.initialWidth * zoom) < width)) || (((this._currentMap.initialHeight * zoom) < height)))))) - { - if (!(zoomsToRemove)) - { - zoomsToRemove = new Vector.(0); - }; - zoomsToRemove.push(zoom); - }; - }; - if (zoomsToRemove) - { - for each (zoom in zoomsToRemove) - { - this._zoomLevels.splice(this._zoomLevels.indexOf(zoom), 1); - }; - Berilia.getInstance().handler.process(new MapMoveMessage(this)); - }; - this._zoomLevelsPercent = []; - for each (zoom in this._zoomLevels) - { - this._zoomLevelsPercent.push(int((zoom * 100))); - }; - } - - public function addLayer(name:String):void - { - var s:Sprite; - if (!(this._layers[name])) - { - s = new Sprite(); - s.name = ("layer_" + name); - s.mouseEnabled = false; - s.doubleClickEnabled = true; - this._layers[name] = s; - }; - this._layersContainer.addChild(this._layers[name]); - } - - public function addIcon(layer:String, id:String, uri:*, x:int, y:int, scale:Number=1, legend:String=null, follow:Boolean=false, color:int=-1, canBeGrouped:Boolean=true, canBeManuallyRemoved:Boolean=true):MapIconElement - { - var t:Texture; - var s:Number; - var mie:MapIconElement; - var R:int; - var V:int; - var B:int; - var ct:ColorTransform; - if (((this._layers[layer]) && (this.mapBounds.contains(x, y)))) - { - if ((uri is String)) - { - uri = new Uri(uri); - }; - t = new Texture(); - t.uri = uri; - t.mouseChildren = false; - if (((this.autoSizeIcon) && ((this._lastScaleIconUpdate == this._mapContainer.scaleX)))) - { - s = (0.75 + (1 / this._mapContainer.scaleX)); - } - else - { - s = Math.min(2, scale); - }; - t.scaleX = (t.scaleY = s); - if (color != -1) - { - R = ((color >> 16) & 0xFF); - V = ((color >> 8) & 0xFF); - B = ((color >> 0) & 0xFF); - ct = new ColorTransform(0.6, 0.6, 0.6, 1, (R - 80), (V - 80), (B - 80)); - t.transform.colorTransform = ct; - }; - mie = new MapIconElement(id, x, y, layer, t, legend, this, canBeManuallyRemoved); - mie.canBeGrouped = canBeGrouped; - mie.follow = follow; - this._mapElements.push(mie); - this._elementsGraphicRef[t] = mie; - return (mie); - }; - return (null); - } - - public function addAreaShape(layer:String, id:String, coordList:Vector., lineColor:uint=0, lineAlpha:Number=1, fillColor:uint=0, fillAlpha:Number=0.4, thickness:int=4):MapAreaShape - { - var oldAreaShape:MapAreaShape; - var shapeZone:Texture; - var graphic:Graphics; - var nCoords:int; - var i:int; - var mapAreaShape:MapAreaShape; - var posX:int; - var posY:int; - if (((this._layers[layer]) && (coordList))) - { - oldAreaShape = MapAreaShape(MapElement.getElementById(id, this)); - if (oldAreaShape) - { - if ((((oldAreaShape.lineColor == lineColor)) && ((oldAreaShape.fillColor == fillColor)))) - { - return (oldAreaShape); - }; - oldAreaShape.remove(); - this._mapElements.splice(this._mapElements.indexOf(oldAreaShape), 1); - }; - shapeZone = new Texture(); - shapeZone.mouseEnabled = false; - shapeZone.mouseChildren = false; - graphic = shapeZone.graphics; - graphic.lineStyle(thickness, lineColor, lineAlpha, true); - graphic.beginFill(fillColor, fillAlpha); - nCoords = coordList.length; - i = 0; - while (i < nCoords) - { - posX = coordList[i]; - posY = coordList[(i + 1)]; - if (posX > 10000) - { - graphic.moveTo(((posX - 11000) * this.mapWidth), ((posY - 11000) * this.mapHeight)); - } - else - { - graphic.lineTo((posX * this.mapWidth), (posY * this.mapHeight)); - }; - i = (i + 2); - }; - mapAreaShape = new MapAreaShape(id, layer, shapeZone, this.origineX, this.origineY, lineColor, fillColor, this); - this._mapElements.push(mapAreaShape); - return (mapAreaShape); - }; - return (null); - } - - public function areaShapeColorTransform(me:MapAreaShape, duration:int, rM:Number=1, gM:Number=1, bM:Number=1, aM:Number=1, rO:Number=0, gO:Number=0, bO:Number=0, aO:Number=0):void - { - me.colorTransform(duration, rM, gM, bM, aM, rO, gO, bO, aO); - } - - public function getMapElement(id:String):MapElement - { - var elem:MapElement; - var mapElem:MapElement = MapElement.getElementById(id, this); - if (!(mapElem)) - { - for each (elem in this._mapElements) - { - if (elem.id == id) - { - mapElem = elem; - break; - }; - }; - }; - return (mapElem); - } - - public function getMapElementsByLayer(layerId:String):Array - { - var mapElement:MapElement; - var nbElements:int = this._mapElements.length; - var elements:Array = new Array(); - var i:int; - while (i < nbElements) - { - mapElement = this._mapElements[i]; - if (mapElement.layer == layerId) - { - elements.push(mapElement); - }; - i++; - }; - return (elements); - } - - public function removeMapElement(me:MapElement):void - { - var element:MapElement; - var iconTexture:Object; - if (!(me)) - { - return; - }; - var index:int = this._mapElements.indexOf(me); - if (index != -1) - { - element = this._mapElements[index]; - if ((me is MapIconElement)) - { - iconTexture = MapIconElement(me)._texture; - if (this._mapGroupElements[me]) - { - this._mapGroupElements[me].icons.splice(this._mapGroupElements[me].icons.indexOf(iconTexture), 1); - delete this._mapGroupElements[me]; - }; - if (((this._arrowAllocation[iconTexture]) && (this._arrowAllocation[iconTexture].parent))) - { - this._arrowAllocation[iconTexture].parent.removeChild(this._arrowAllocation[iconTexture]); - this._arrowPool.push(this._arrowAllocation[iconTexture]); - delete this._reverseArrowAllocation[this._arrowAllocation[iconTexture]]; - delete this._arrowAllocation[iconTexture]; - }; - }; - element.remove(); - this._mapElements.splice(index, 1); - }; - } - - public function updateMapElements():void - { - var ico:Object; - var elem:MapElement; - var sortedMapElements:Array; - var elems:Array; - var iconNum:uint; - var group:MapGroupElement; - var _local_7:MapIconElement; - var _local_8:MapAreaShape; - var _local_9:Sprite; - var visibleIconCount:uint; - var iconIndex:uint; - this.updateIconSize(); - for (ico in this._mapGroupElements) - { - delete this._mapGroupElements[ico]; - }; - this.clearLayer(); - this.clearElementsGroups(); - this.clearMapAreaShapes(); - sortedMapElements = new Array(); - for each (elem in this._mapElements) - { - if (!(sortedMapElements[((elem.x + "_") + elem.y)])) - { - sortedMapElements[((elem.x + "_") + elem.y)] = new Array(); - }; - sortedMapElements[((elem.x + "_") + elem.y)].push(elem); - }; - for each (elems in sortedMapElements) - { - iconNum = 0; - group = null; - for each (elem in elems) - { - if (!!(this._layers[elem.layer].visible)) - { - switch (true) - { - case (elem is MapIconElement): - _local_7 = (elem as MapIconElement); - _local_7._texture.x = (((_local_7.x * this.mapWidth) + this.origineX) + (this.mapWidth / 2)); - _local_7._texture.y = (((_local_7.y * this.mapHeight) + this.origineY) + (this.mapHeight / 2)); - if (((!((elems.length == 1))) && (_local_7.canBeGrouped))) - { - if (!(group)) - { - group = new MapGroupElement((this.mapWidth * 0.5), (this.mapHeight * 0.5)); - group.x = (((_local_7.x * this.mapWidth) + this.origineX) + (this.mapWidth / 2)); - group.y = (((_local_7.y * this.mapHeight) + this.origineY) + (this.mapHeight / 2)); - this._groupsContainer.addChild(group); - }; - this._mapGroupElements[_local_7] = group; - if (elem.layer != "layer_8") - { - visibleIconCount = elems.length; - if (visibleIconCount > 2) - { - visibleIconCount = 2; - }; - iconIndex = Math.min(visibleIconCount, iconNum); - _local_7._texture.x = ((4 * iconIndex) - ((visibleIconCount * 4) / 2)); - _local_7._texture.y = ((4 * iconIndex) - ((visibleIconCount * 4) / 2)); - group.addChild(_local_7._texture); - } - else - { - group.icons.push(_local_7._texture); - this._layers[elem.layer].addChild(_local_7._texture); - }; - } - else - { - this._layers[elem.layer].addChild(_local_7._texture); - }; - break; - case (elem is MapAreaShape): - _local_8 = (elem as MapAreaShape); - _local_9 = this._layers[elem.layer]; - if (_local_9.parent != this._areaShapesContainer) - { - this._areaShapesContainer.addChild(_local_9); - }; - _local_9.addChild(_local_8.shape); - _local_8.shape.x = _local_8.x; - _local_8.shape.y = _local_8.y; - break; - }; - iconNum++; - }; - }; - }; - this.updateIcons(); - } - - public function showLayer(name:String, display:Boolean=true):void - { - if (this._layers[name]) - { - this._layers[name].visible = display; - }; - } - - public function showAllLayers(visible:Boolean=true):void - { - var layer:Sprite; - for each (layer in this._layers) - { - layer.visible = visible; - }; - this.updateMapElements(); - } - - public function moveToPixel(x:int, y:int, zoomFactor:Number):void - { - this._mapContainer.x = x; - this._mapContainer.y = y; - this._mapContainer.scaleX = zoomFactor; - this._mapContainer.scaleY = zoomFactor; - this.updateVisibleChunck(); - } - - public function moveTo(x:Number, y:Number, width:uint=1, height:uint=1, center:Boolean=true, autoZoom:Boolean=true):void - { - var zoneWidth:int; - var zoneHeight:int; - var newX:int; - var newY:int; - var offsetX:Number; - var offsetY:Number; - var diffX:Number; - var diffY:Number; - var viewRect:Rectangle = this.mapBounds; - if (viewRect.left > x) - { - x = viewRect.left; - }; - if (viewRect.top > y) - { - y = viewRect.top; - }; - if (center) - { - zoneWidth = ((width * this.mapWidth) * this._mapContainer.scaleX); - if ((((zoneWidth > this.width)) && (autoZoom))) - { - this._mapContainer.scaleX = (this.width / (this.mapWidth * width)); - this._mapContainer.scaleY = this._mapContainer.scaleX; - }; - zoneHeight = ((height * this.mapHeight) * this._mapContainer.scaleY); - if ((((zoneHeight > this.height)) && (autoZoom))) - { - this._mapContainer.scaleY = (this.height / (this.mapHeight * height)); - this._mapContainer.scaleX = this._mapContainer.scaleY; - }; - newX = ((-(((x * this.mapWidth) + this.origineX)) * this._mapContainer.scaleX) - ((this.mapWidth / 2) * this._mapContainer.scaleX)); - newY = ((-(((y * this.mapHeight) + this.origineY)) * this._mapContainer.scaleY) - ((this.mapHeight / 2) * this._mapContainer.scaleY)); - offsetX = (this.width / 2); - offsetY = (this.height / 2); - diffX = Math.abs((-(this._mapContainer.width) - newX)); - if (diffX < offsetX) - { - offsetX = (offsetX + (offsetX - diffX)); - }; - diffY = Math.abs((-(this._mapContainer.height) - newY)); - if (diffY < offsetY) - { - offsetY = (offsetY + (offsetY - diffY)); - }; - this._mapContainer.x = (newX + offsetX); - this._mapContainer.y = (newY + offsetY); + _loc1_++; + } + this.setupZoomLevels(width,height); + getUi().iAmFinalized(this); + } + + public function setupZoomLevels(param1:Number, param2:Number) : void + { + var _loc3_:* = NaN; + var _loc4_:Vector. = null; + for each(_loc3_ in this._zoomLevels) + { + if((this._currentMap) && (this._currentMap.initialWidth * _loc3_ < param1 || this._currentMap.initialHeight * _loc3_ < param2)) + { + if(!_loc4_) + { + _loc4_ = new Vector.(0); + } + _loc4_.push(_loc3_); } - else - { - this._mapContainer.x = (-(((x * this.mapWidth) + this.origineX)) * this._mapContainer.scaleX); - this._mapContainer.y = (-(((y * this.mapHeight) + this.origineY)) * this._mapContainer.scaleY); - }; - var w:Number = ((this._currentMap) ? this._currentMap.initialWidth : this._mapBitmapContainer.width); - var h:Number = ((this._currentMap) ? this._currentMap.initialHeight : this._mapBitmapContainer.height); - if (this._mapContainer.x < (width - w)) + } + if(_loc4_) + { + for each(_loc3_ in _loc4_) { - if (!(center)) - { - this._mapContainer.x = (width - w); - } - else - { - this._mapContainer.x = 0; - }; - }; - if (this._mapContainer.y < (height - h)) - { - if (!(center)) - { - this._mapContainer.y = (height - h); - } - else - { - this._mapContainer.y = 0; - }; - }; - if (this._mapContainer.x > 0) - { - this._mapContainer.x = 0; - }; - if (this._mapContainer.y > 0) - { - this._mapContainer.y = 0; - }; - this.updateVisibleChunck(); + this._zoomLevels.splice(this._zoomLevels.indexOf(_loc3_),1); + } Berilia.getInstance().handler.process(new MapMoveMessage(this)); - } - - private function zoomWithScalePercent(scalePercent:int, coord:Point=null):void - { - if (this._zoomLevelsPercent.indexOf(scalePercent) != -1) - { - this.zoom((scalePercent / 100), coord); + } + this._zoomLevelsPercent = []; + for each(_loc3_ in this._zoomLevels) + { + this._zoomLevelsPercent.push(int(_loc3_ * 100)); + } + } + + public function addLayer(param1:String) : void + { + var _loc2_:Sprite = null; + if(!this._layers[param1]) + { + _loc2_ = new Sprite(); + _loc2_.name = "layer_" + param1; + _loc2_.mouseEnabled = false; + _loc2_.doubleClickEnabled = true; + this._layers[param1] = _loc2_; + } + this._layersContainer.addChild(this._layers[param1]); + } + + public function addIcon(param1:String, param2:String, param3:*, param4:int, param5:int, param6:Number = 1, param7:String = null, param8:Boolean = false, param9:int = -1, param10:Boolean = true, param11:Boolean = true) : MapIconElement + { + var _loc12_:Texture = null; + var _loc13_:* = NaN; + var _loc14_:MapIconElement = null; + var _loc15_:* = 0; + var _loc16_:* = 0; + var _loc17_:* = 0; + var _loc18_:ColorTransform = null; + if((this._layers[param1]) && (this.mapBounds.contains(param4,param5))) + { + if(param3 is String) + { + var param3:* = new Uri(param3); } - else - { - _log.warn((((("Can't zoom, a scale of " + String((scalePercent / 100))) + " (") + scalePercent) + ") is not defined")); - }; - } - - public function zoom(scale:Number, coord:Point=null):void - { - var w:Number; - var h:Number; - var _local_5:Rectangle; - var _local_6:Point; - if (scale > this.maxScale) - { - scale = this.maxScale; - }; - if (scale < this.minScale) - { - scale = this.minScale; - }; - if (((this._currentMap) && (((((this._currentMap.initialWidth * scale) < width)) || (((this._currentMap.initialHeight * scale) < height)))))) + _loc12_ = new Texture(); + _loc12_.uri = param3; + _loc12_.mouseChildren = false; + if((this.autoSizeIcon) && this._lastScaleIconUpdate == this._mapContainer.scaleX) { - return; - }; - if (coord) - { - if (this._currentMap) - { - this._currentMap.currentScale = NaN; - }; - this._mapContainer.x = (this._mapContainer.x - ((coord.x * scale) - (coord.x * this._mapContainer.scaleX))); - this._mapContainer.y = (this._mapContainer.y - ((coord.y * scale) - (coord.y * this._mapContainer.scaleY))); - this._mapContainer.scaleX = (this._mapContainer.scaleY = scale); - w = ((this._currentMap) ? this._currentMap.initialWidth : this._mapBitmapContainer.width); - h = ((this._currentMap) ? this._currentMap.initialHeight : this._mapBitmapContainer.height); - if (this._mapContainer.x < (width - (w * scale))) - { - this._mapContainer.x = (width - (w * scale)); - }; - if (this._mapContainer.y < (height - (h * scale))) - { - this._mapContainer.y = (height - (h * scale)); - }; - if (this._mapContainer.x > 0) - { - this._mapContainer.x = 0; - }; - if (this._mapContainer.y > 0) - { - this._mapContainer.y = 0; - }; - this.updateIconSize(); + _loc13_ = 0.75 + 1 / this._mapContainer.scaleX; } else { - _local_5 = this.visibleMaps; - _local_6 = new Point((((_local_5.x + (_local_5.width / 2)) * this.mapWidth) + this.origineX), (((_local_5.y + (_local_5.height / 2)) * this.mapHeight) + this.origineY)); - this.zoom(scale, _local_6); - return; - }; - this.processMapInfo(); - } - - public function addMap(zoom:Number, src:String, unscaleWitdh:uint, unscaleHeight:uint, chunckWidth:uint, chunckHeight:uint):void - { - this._availableMaps.push(new Map(zoom, src, new Sprite(), unscaleWitdh, unscaleHeight, chunckWidth, chunckHeight)); - if (this._zoomLevels.indexOf(zoom) == -1) - { - this._zoomLevels.push(zoom); - this._zoomLevels.sort(Array.NUMERIC); - }; - } - - public function removeAllMap():void - { - var map:Map; - var area:MapArea; - for each (map in this._availableMaps) - { - for each (area in map.areas) - { - area.free(true); - }; - }; - this._availableMaps = []; - this._zoomLevels.length = 0; - } - - public function getOrigineFromPos(x:int, y:int):Point - { - return (new Point(((-(this._mapContainer.x) / this._mapContainer.scaleX) - (x * this.mapWidth)), ((-(this._mapContainer.y) / this._mapContainer.scaleY) - (y * this.mapHeight)))); - } - - public function set useFlagCursor(pValue:Boolean):void - { - var lcd:LinkedCursorData; - if (!(FLAG_CURSOR)) - { - return; - }; - if (pValue) - { - if (!(this._flagCursor)) - { - this._flagCursor = new Sprite(); - this._flagCursor.addChild(new FLAG_CURSOR()); - }; - lcd = new LinkedCursorData(); - lcd.sprite = this._flagCursor; - lcd.offset = new Point(); - Mouse.hide(); - LinkedCursorSpriteManager.getInstance().addItem("mapViewerCursor", lcd); + _loc13_ = Math.min(2,param6); } - else - { - this.removeCustomCursor(); - }; - this._flagCursorVisible = pValue; - } - - public function get useFlagCursor():Boolean - { - return (this._flagCursorVisible); - } - - public function get allChunksLoaded():Boolean - { - var mapArea:MapArea; - if (((!(this._visibleMapAreas)) || (!(this._visibleMapAreas.length)))) - { - return (false); - }; - for each (mapArea in this._visibleMapAreas) - { - if (!(mapArea.isLoaded)) - { - return (false); - }; - }; - return (true); - } - - private function removeCustomCursor():void - { - Mouse.show(); - LinkedCursorSpriteManager.getInstance().removeItem("mapViewerCursor"); - } - - override public function remove():void - { - var me:MapElement; - var k:Object; - if (!(__removed)) - { - if (this._grid) - { - this._grid.cacheAsBitmap = false; - if (this._mapContainer.contains(this._grid)) - { - this._mapContainer.removeChild(this._grid); - }; - }; - if (this._mapToClear) - { - this.clearMap(this._mapToClear); - this._mapToClear = null; - }; - this.removeAllMap(); - for each (me in MapElement.getOwnerElements(this)) - { - if (this._mapGroupElements[me]) - { - delete this._mapGroupElements[me]; - }; - me.remove(); - }; - for (k in this._elementsGraphicRef) - { - delete this._elementsGraphicRef[k]; - }; - this._mapElements = null; - this._elementsGraphicRef = null; - this._mapGroupElements = null; - this._visibleMapAreas = null; - MapElement._elementRef = new Dictionary(true); - EnterFrameDispatcher.removeEventListener(this.onMapEnterFrame); - this.removeCustomCursor(); - if (AirScanner.hasAir()) - { - StageShareManager.stage.nativeWindow.removeEventListener(Event.DEACTIVATE, this.onWindowDeactivate); - }; - }; - super.remove(); - } - - private function getIconTextureGlobalCoords(pMapIconElement:MapIconElement):Point - { - var txX:Number = (((pMapIconElement.x * this.mapWidth) + this.origineX) + (this.mapWidth / 2)); - var txY:Number = (((pMapIconElement.y * this.mapHeight) + this.origineY) + (this.mapHeight / 2)); - var layer:Sprite = (this._layers[pMapIconElement.layer] as Sprite); - return (layer.localToGlobal(new Point(txX, txY))); - } - - private function updateIcons():void - { - var iconTexture:Texture; - var mie:MapIconElement; - var p:Point; - var p2:Point; - var dist:Number; - var iconVisible:Boolean; - var me:MapElement; - var arrow:Texture; - var angle:Number; - var a:Number; - var res:Number; - var icon:*; - var tempArrow:Texture; - var vr:Number; - var iconRect:Rectangle = new Rectangle(0, 0, 1, 1); - var visibleMaps:Rectangle = this.visibleMaps; - var currentPosition:Point = new Point(Math.floor((visibleMaps.x + (visibleMaps.width / 2))), Math.floor((visibleMaps.y + (visibleMaps.height / 2)))); - var minimalArrowDist:Number = (visibleMaps.width / 2); - var isCircleView:Boolean = (this.roundCornerRadius > (width / 3)); - var radius:Number = (width / 2); - for each (me in this._mapElements) - { - mie = (me as MapIconElement); - if (!(mie)) - { - } - else - { - iconRect.x = mie.x; - iconRect.y = mie.y; - iconTexture = mie._texture; - if (!!(iconTexture)) - { - if (mie.follow) + _loc12_.scaleX = _loc12_.scaleY = _loc13_; + if(param9 != -1) + { + _loc15_ = param9 >> 16 & 255; + _loc16_ = param9 >> 8 & 255; + _loc17_ = param9 >> 0 & 255; + _loc18_ = new ColorTransform(0.6,0.6,0.6,1,_loc15_ - 80,_loc16_ - 80,_loc17_ - 80); + _loc12_.transform.colorTransform = _loc18_; + } + _loc14_ = new MapIconElement(param2,param4,param5,param1,_loc12_,param7,this,param11); + _loc14_.canBeGrouped = param10; + _loc14_.follow = param8; + this._mapElements.push(_loc14_); + this._elementsGraphicRef[_loc12_] = _loc14_; + return _loc14_; + } + return null; + } + + public function addAreaShape(param1:String, param2:String, param3:Vector., param4:uint = 0, param5:Number = 1, param6:uint = 0, param7:Number = 0.4, param8:int = 4) : MapAreaShape + { + var _loc9_:MapAreaShape = null; + var _loc10_:Texture = null; + var _loc11_:Graphics = null; + var _loc12_:* = 0; + var _loc13_:* = 0; + var _loc14_:MapAreaShape = null; + var _loc15_:* = 0; + var _loc16_:* = 0; + if((this._layers[param1]) && (param3)) + { + _loc9_ = MapAreaShape(MapElement.getElementById(param2,this)); + if(_loc9_) + { + if(_loc9_.lineColor == param4 && _loc9_.fillColor == param6) + { + return _loc9_; + } + _loc9_.remove(); + this._mapElements.splice(this._mapElements.indexOf(_loc9_),1); + } + _loc10_ = new Texture(); + _loc10_.mouseEnabled = false; + _loc10_.mouseChildren = false; + _loc11_ = _loc10_.graphics; + _loc11_.lineStyle(param8,param4,param5,true); + _loc11_.beginFill(param6,param7); + _loc12_ = param3.length; + _loc13_ = 0; + while(_loc13_ < _loc12_) + { + _loc15_ = param3[_loc13_]; + _loc16_ = param3[_loc13_ + 1]; + if(_loc15_ > 10000) + { + _loc11_.moveTo((_loc15_ - 11000) * this.mapWidth,(_loc16_ - 11000) * this.mapHeight); + } + else + { + _loc11_.lineTo(_loc15_ * this.mapWidth,_loc16_ * this.mapHeight); + } + _loc13_ = _loc13_ + 2; + } + _loc14_ = new MapAreaShape(param2,param1,_loc10_,this.origineX,this.origineY,param4,param6,this); + this._mapElements.push(_loc14_); + return _loc14_; + } + return null; + } + + public function areaShapeColorTransform(param1:MapAreaShape, param2:int, param3:Number = 1, param4:Number = 1, param5:Number = 1, param6:Number = 1, param7:Number = 0, param8:Number = 0, param9:Number = 0, param10:Number = 0) : void + { + param1.colorTransform(param2,param3,param4,param5,param6,param7,param8,param9,param10); + } + + public function getMapElement(param1:String) : MapElement + { + var _loc3_:MapElement = null; + var _loc2_:MapElement = MapElement.getElementById(param1,this); + if(!_loc2_) + { + for each(_loc3_ in this._mapElements) + { + if(_loc3_.id == param1) + { + _loc2_ = _loc3_; + break; + } + } + } + return _loc2_; + } + + public function getMapElementsByLayer(param1:String) : Array + { + var _loc5_:MapElement = null; + var _loc2_:int = this._mapElements.length; + var _loc3_:Array = new Array(); + var _loc4_:* = 0; + while(_loc4_ < _loc2_) + { + _loc5_ = this._mapElements[_loc4_]; + if(_loc5_.layer == param1) + { + _loc3_.push(_loc5_); + } + _loc4_++; + } + return _loc3_; + } + + public function removeMapElement(param1:MapElement) : void + { + var _loc3_:MapElement = null; + var _loc4_:Object = null; + if(!param1) + { + return; + } + var _loc2_:int = this._mapElements.indexOf(param1); + if(_loc2_ != -1) + { + _loc3_ = this._mapElements[_loc2_]; + if(param1 is MapIconElement) + { + _loc4_ = MapIconElement(param1)._texture; + if(this._mapGroupElements[param1]) + { + this._mapGroupElements[param1].icons.splice(this._mapGroupElements[param1].icons.indexOf(_loc4_),1); + delete this._mapGroupElements[param1]; + true; + } + if((this._arrowAllocation[_loc4_]) && (this._arrowAllocation[_loc4_].parent)) + { + this._arrowAllocation[_loc4_].parent.removeChild(this._arrowAllocation[_loc4_]); + this._arrowPool.push(this._arrowAllocation[_loc4_]); + delete this._reverseArrowAllocation[this._arrowAllocation[_loc4_]]; + true; + delete this._arrowAllocation[_loc4_]; + true; + } + } + _loc3_.remove(); + this._mapElements.splice(_loc2_,1); + } + } + + public function updateMapElements() : void + { + var _loc1_:Object = null; + var _loc2_:MapElement = null; + var _loc3_:Array = null; + var _loc4_:Array = null; + var _loc5_:uint = 0; + var _loc6_:MapGroupElement = null; + var _loc7_:MapIconElement = null; + var _loc8_:MapAreaShape = null; + var _loc9_:Sprite = null; + var _loc10_:uint = 0; + var _loc11_:uint = 0; + this.updateIconSize(); + for(_loc1_ in this._mapGroupElements) + { + delete this._mapGroupElements[_loc1_]; + true; + } + this.clearLayer(); + this.clearElementsGroups(); + this.clearMapAreaShapes(); + _loc3_ = new Array(); + for each(_loc2_ in this._mapElements) + { + if(!_loc3_[_loc2_.x + "_" + _loc2_.y]) + { + _loc3_[_loc2_.x + "_" + _loc2_.y] = new Array(); + } + _loc3_[_loc2_.x + "_" + _loc2_.y].push(_loc2_); + } + for each(_loc4_ in _loc3_) + { + _loc5_ = 0; + _loc6_ = null; + for each(_loc2_ in _loc4_) + { + if(this._layers[_loc2_.layer].visible) + { + switch(true) + { + case _loc2_ is MapIconElement: + _loc7_ = _loc2_ as MapIconElement; + _loc7_._texture.x = _loc7_.x * this.mapWidth + this.origineX + this.mapWidth / 2; + _loc7_._texture.y = _loc7_.y * this.mapHeight + this.origineY + this.mapHeight / 2; + if(!(_loc4_.length == 1) && (_loc7_.canBeGrouped)) { - p = this.getIconTextureGlobalCoords(mie); - if (isCircleView) - { - p2 = globalToLocal(p); - dist = Math.floor(Math.sqrt((Math.pow((p2.x - radius), 2) + Math.pow((p2.y - radius), 2)))); - iconVisible = (dist < radius); - } - else - { - iconVisible = this._mapContainer.mask.getBounds(StageShareManager.stage).containsPoint(p); - }; + if(!_loc6_) + { + _loc6_ = new MapGroupElement(this.mapWidth * 0.5,this.mapHeight * 0.5); + _loc6_.x = _loc7_.x * this.mapWidth + this.origineX + this.mapWidth / 2; + _loc6_.y = _loc7_.y * this.mapHeight + this.origineY + this.mapHeight / 2; + this._groupsContainer.addChild(_loc6_); + } + this._mapGroupElements[_loc7_] = _loc6_; + if(_loc2_.layer != "layer_8") + { + _loc10_ = _loc4_.length; + if(_loc10_ > 2) + { + _loc10_ = 2; + } + _loc11_ = Math.min(_loc10_,_loc5_); + _loc7_._texture.x = 4 * _loc11_ - _loc10_ * 4 / 2; + _loc7_._texture.y = 4 * _loc11_ - _loc10_ * 4 / 2; + _loc6_.addChild(_loc7_._texture); + } + else + { + _loc6_.icons.push(_loc7_._texture); + this._layers[_loc2_.layer].addChild(_loc7_._texture); + } } else { - iconVisible = visibleMaps.intersects(iconRect); - }; - iconTexture.visible = ((!((this._layers[mie.layer].visible == false))) && (iconVisible)); - if (((iconTexture.visible) && (!(iconTexture.finalized)))) - { - iconTexture.finalize(); - }; - if (!(mie.follow)) - { + this._layers[_loc2_.layer].addChild(_loc7_._texture); } - else - { - if (((iconTexture.visible) && (this._arrowAllocation[iconTexture]))) - { - this._arrowContainer.removeChild(this._arrowAllocation[iconTexture]); - this._arrowPool.push(this._arrowAllocation[iconTexture]); - mie.boundsRef = null; - delete this._reverseArrowAllocation[this._arrowAllocation[iconTexture]]; - delete this._arrowAllocation[iconTexture]; - } - else - { - if (((mie.follow) && (!(iconTexture.visible)))) - { - tempArrow = this.getIconArrow(iconTexture); - tempArrow.visible = this._layers[mie.layer].visible; - this._arrowContainer.addChild(tempArrow); - this._elementsGraphicRef[tempArrow] = mie; - mie.boundsRef = tempArrow; - }; - }; - }; - }; - }; - }; - angle = Math.atan2(0, (-(width) / 2)); - a = (Math.atan2((width / 2), 0) + angle); - for (icon in this._arrowAllocation) - { - arrow = this._arrowAllocation[icon]; - mie = this._elementsGraphicRef[icon]; - if (isCircleView) - { - p = globalToLocal(this.getIconTextureGlobalCoords(mie)); - vr = Math.atan2((-(p.y) + (height / 2)), (-(p.x) + (width / 2))); - } - else - { - vr = Math.atan2((-(mie.y) + currentPosition.y), (-(mie.x) + currentPosition.x)); - }; - arrow.x = ((Math.cos((angle + vr)) * width) / 2); - arrow.y = ((Math.sin((angle + vr)) * height) / 2); - arrow.rotation = (vr * (180 / Math.PI)); - if (isCircleView) - { - arrow.x = (arrow.x + (width / 2)); - arrow.y = (arrow.y + (height / 2)); - } - else - { - a = (arrow.y / arrow.x); - vr = (vr + Math.PI); - if ((((vr < (Math.PI / 4))) || ((vr > ((Math.PI * 7) / 4))))) - { - res = (((width / 2) * a) + (height / 2)); - if ((((res > 0)) && ((res < height)))) - { - arrow.x = width; - arrow.y = res; - continue; - }; - } - else - { - if (vr < ((Math.PI * 3) / 4)) + break; + case _loc2_ is MapAreaShape: + _loc8_ = _loc2_ as MapAreaShape; + _loc9_ = this._layers[_loc2_.layer]; + if(_loc9_.parent != this._areaShapesContainer) { - res = (((height / 2) / a) + (width / 2)); - res = (((res > width)) ? width : res); - if (res > 0) - { - arrow.x = res; - arrow.y = height; - continue; - }; + this._areaShapesContainer.addChild(_loc9_); } - else - { - if (vr < ((Math.PI * 5) / 4)) - { - res = (((-(width) / 2) * a) + (height / 2)); - if ((((res > 0)) && ((res < height)))) - { - arrow.x = 0; - arrow.y = res; - continue; - }; - } - else - { - res = (((-(height) / 2) / a) + (width / 2)); - res = (((res > width)) ? width : (((res < 0)) ? 0 : res)); - if (res >= 0) - { - arrow.x = res; - arrow.y = 0; - continue; - }; - }; - }; - }; - if (arrow.rotation == -45) - { - arrow.x = 0; - arrow.y = res; - }; - }; - }; - } - - private function getIconArrow(icon:Texture):Texture - { - var _local_2:Texture; - if (this._arrowAllocation[icon]) + _loc9_.addChild(_loc8_.shape); + _loc8_.shape.x = _loc8_.x; + _loc8_.shape.y = _loc8_.y; + break; + } + _loc5_++; + } + } + } + this.updateIcons(); + } + + public function showLayer(param1:String, param2:Boolean = true) : void + { + if(this._layers[param1]) + { + this._layers[param1].visible = param2; + } + } + + public function showAllLayers(param1:Boolean = true) : void + { + var _loc2_:Sprite = null; + for each(_loc2_ in this._layers) + { + _loc2_.visible = param1; + } + this.updateMapElements(); + } + + public function moveToPixel(param1:int, param2:int, param3:Number) : void + { + this._mapContainer.x = param1; + this._mapContainer.y = param2; + this._mapContainer.scaleX = param3; + this._mapContainer.scaleY = param3; + this.updateVisibleChunck(); + } + + public function moveTo(param1:Number, param2:Number, param3:uint = 1, param4:uint = 1, param5:Boolean = true, param6:Boolean = true) : void + { + var _loc10_:* = 0; + var _loc11_:* = 0; + var _loc12_:* = 0; + var _loc13_:* = 0; + var _loc14_:* = NaN; + var _loc15_:* = NaN; + var _loc16_:* = NaN; + var _loc17_:* = NaN; + var _loc7_:Rectangle = this.mapBounds; + if(_loc7_.left > param1) + { + var param1:Number = _loc7_.left; + } + if(_loc7_.top > param2) + { + var param2:Number = _loc7_.top; + } + if(param5) + { + _loc10_ = param3 * this.mapWidth * this._mapContainer.scaleX; + if(_loc10_ > this.width && (param6)) + { + this._mapContainer.scaleX = this.width / (this.mapWidth * param3); + this._mapContainer.scaleY = this._mapContainer.scaleX; + } + _loc11_ = param4 * this.mapHeight * this._mapContainer.scaleY; + if(_loc11_ > this.height && (param6)) { - return (this._arrowAllocation[icon]); - }; - if (this._arrowPool.length) + this._mapContainer.scaleY = this.height / (this.mapHeight * param4); + this._mapContainer.scaleX = this._mapContainer.scaleY; + } + _loc12_ = -(param1 * this.mapWidth + this.origineX) * this._mapContainer.scaleX - this.mapWidth / 2 * this._mapContainer.scaleX; + _loc13_ = -(param2 * this.mapHeight + this.origineY) * this._mapContainer.scaleY - this.mapHeight / 2 * this._mapContainer.scaleY; + _loc14_ = this.width / 2; + _loc15_ = this.height / 2; + _loc16_ = Math.abs(-this._mapContainer.width - _loc12_); + if(_loc16_ < _loc14_) + { + _loc14_ = _loc14_ + (_loc14_ - _loc16_); + } + _loc17_ = Math.abs(-this._mapContainer.height - _loc13_); + if(_loc17_ < _loc15_) { - this._arrowAllocation[icon] = this._arrowPool.pop(); + _loc15_ = _loc15_ + (_loc15_ - _loc17_); + } + this._mapContainer.x = _loc12_ + _loc14_; + this._mapContainer.y = _loc13_ + _loc15_; + } + else + { + this._mapContainer.x = -(param1 * this.mapWidth + this.origineX) * this._mapContainer.scaleX; + this._mapContainer.y = -(param2 * this.mapHeight + this.origineY) * this._mapContainer.scaleY; + } + var _loc8_:Number = this._currentMap?this._currentMap.initialWidth:this._mapBitmapContainer.width; + var _loc9_:Number = this._currentMap?this._currentMap.initialHeight:this._mapBitmapContainer.height; + if(this._mapContainer.x < param3 - _loc8_) + { + if(!param5) + { + this._mapContainer.x = param3 - _loc8_; } else { - _local_2 = new Texture(); - _local_2.uri = new Uri((XmlConfig.getInstance().getEntry("config.gfx.path") + "icons/assets.swf|arrow0")); - _local_2.mouseEnabled = true; - _local_2.buttonMode = (_local_2.useHandCursor = true); - _local_2.finalize(); - this._arrowAllocation[icon] = _local_2; - }; - this._reverseArrowAllocation[this._arrowAllocation[icon]] = icon; - Texture(this._arrowAllocation[icon]).transform.colorTransform = icon.transform.colorTransform; - return (this._arrowAllocation[icon]); - } - - private function processMapInfo():void - { - var choosenMap:Map; - var tmpZoomDist:Number; - var map:Map; - if (!(this._availableMaps.length)) - { - return; - }; - this._lastScaleIconUpdate = -1; - var zoomDist:Number = 10000; - for each (map in this._availableMaps) - { - tmpZoomDist = Math.abs((map.zoom - this._mapContainer.scaleX)); - if (tmpZoomDist < zoomDist) - { - choosenMap = map; - zoomDist = tmpZoomDist; - }; - }; - if (((!(this._currentMap)) || (!((choosenMap == this._currentMap))))) - { - if (this._currentMap) - { - if (this._mapToClear) - { - this.clearMap(this._mapToClear); - }; - this._mapToClear = this._currentMap; - }; - this._currentMap = choosenMap; - this._mapBitmapContainer.graphics.beginFill(0, 0); - this._mapBitmapContainer.graphics.drawRect(0, 0, this._currentMap.initialWidth, this._currentMap.initialHeight); - this._mapBitmapContainer.graphics.endFill(); - this._mapBitmapContainer.addChild(this._currentMap.container); - this._viewRect.width = width; - this._viewRect.height = height; - }; - this.updateVisibleChunck(); - } - - private function updateVisibleChunck(refreshIcons:Boolean=true):void - { - var rect:MapArea; - if (((!(this._currentMap)) || (!(this._currentMap.areas)))) + this._mapContainer.x = 0; + } + } + if(this._mapContainer.y < param4 - _loc9_) + { + if(!param5) { - return; - }; - if (refreshIcons) + this._mapContainer.y = param4 - _loc9_; + } + else { - this.updateIcons(); - }; - var marge:uint = 100; - this._visibleMapAreas = new Vector.(); - this._viewRect.x = ((-(this._mapContainer.x) / this._mapContainer.scaleX) - marge); - this._viewRect.y = ((-(this._mapContainer.y) / this._mapContainer.scaleY) - marge); - this._viewRect.width = ((width / this._mapContainer.scaleX) + (marge * 2)); - this._viewRect.height = ((height / this._mapContainer.scaleY) + (marge * 2)); - for each (rect in this._currentMap.areas) + this._mapContainer.y = 0; + } + } + if(this._mapContainer.x > 0) + { + this._mapContainer.x = 0; + } + if(this._mapContainer.y > 0) + { + this._mapContainer.y = 0; + } + this.updateVisibleChunck(); + Berilia.getInstance().handler.process(new MapMoveMessage(this)); + } + + private function zoomWithScalePercent(param1:int, param2:Point = null) : void + { + if(this._zoomLevelsPercent.indexOf(param1) != -1) + { + this.zoom(param1 / 100,param2); + } + else + { + _log.warn("Can\'t zoom, a scale of " + String(param1 / 100) + " (" + param1 + ") is not defined"); + } + } + + public function zoom(param1:Number, param2:Point = null) : void + { + var _loc3_:* = NaN; + var _loc4_:* = NaN; + var _loc5_:Rectangle = null; + var _loc6_:Point = null; + if(param1 > this.maxScale) + { + var param1:Number = this.maxScale; + } + if(param1 < this.minScale) + { + param1 = this.minScale; + } + if((this._currentMap) && (this._currentMap.initialWidth * param1 < width || this._currentMap.initialHeight * param1 < height)) + { + return; + } + if(param2) + { + if(this._currentMap) + { + this._currentMap.currentScale = NaN; + } + this._mapContainer.x = this._mapContainer.x - (param2.x * param1 - param2.x * this._mapContainer.scaleX); + this._mapContainer.y = this._mapContainer.y - (param2.y * param1 - param2.y * this._mapContainer.scaleY); + this._mapContainer.scaleX = this._mapContainer.scaleY = param1; + _loc3_ = this._currentMap?this._currentMap.initialWidth:this._mapBitmapContainer.width; + _loc4_ = this._currentMap?this._currentMap.initialHeight:this._mapBitmapContainer.height; + if(this._mapContainer.x < width - _loc3_ * param1) + { + this._mapContainer.x = width - _loc3_ * param1; + } + if(this._mapContainer.y < height - _loc4_ * param1) { - if (this._viewRect.intersects(rect)) - { - if (!(rect.isUsed)) - { - rect.parent.container.addChild(rect.getBitmap()); - }; - this._visibleMapAreas.push(rect); - } - else - { - if (rect.isUsed) - { - rect.free(); - }; - }; - }; - this._visibleMapAreas.fixed = true; - } - - private function initMask():void - { - if (this._mapContainer.mask) + this._mapContainer.y = height - _loc4_ * param1; + } + if(this._mapContainer.x > 0) { - this._mapContainer.mask.parent.removeChild(this._mapContainer.mask); - }; - var maskCtr:Sprite = new Sprite(); - maskCtr.doubleClickEnabled = true; - maskCtr.graphics.beginFill(0x770000, 0.3); - if (!(this.roundCornerRadius)) + this._mapContainer.x = 0; + } + if(this._mapContainer.y > 0) { - maskCtr.graphics.drawRect(0, 0, width, height); + this._mapContainer.y = 0; } - else + this.updateIconSize(); + this.processMapInfo(); + return; + } + _loc5_ = this.visibleMaps; + _loc6_ = new Point((_loc5_.x + _loc5_.width / 2) * this.mapWidth + this.origineX,(_loc5_.y + _loc5_.height / 2) * this.mapHeight + this.origineY); + this.zoom(param1,_loc6_); + } + + public function addMap(param1:Number, param2:String, param3:uint, param4:uint, param5:uint, param6:uint) : void + { + this._availableMaps.push(new Map(param1,param2,new Sprite(),param3,param4,param5,param6)); + if(this._zoomLevels.indexOf(param1) == -1) + { + this._zoomLevels.push(param1); + this._zoomLevels.sort(Array.NUMERIC); + } + } + + public function removeAllMap() : void + { + var _loc1_:Map = null; + var _loc2_:MapArea = null; + for each(_loc1_ in this._availableMaps) + { + for each(_loc2_ in _loc1_.areas) + { + _loc2_.free(true); + } + } + this._availableMaps = []; + this._zoomLevels.length = 0; + } + + public function getOrigineFromPos(param1:int, param2:int) : Point + { + return new Point(-this._mapContainer.x / this._mapContainer.scaleX - param1 * this.mapWidth,-this._mapContainer.y / this._mapContainer.scaleY - param2 * this.mapHeight); + } + + public function set useFlagCursor(param1:Boolean) : void + { + var _loc2_:LinkedCursorData = null; + if(!FLAG_CURSOR) + { + return; + } + if(param1) + { + if(!this._flagCursor) + { + this._flagCursor = new Sprite(); + this._flagCursor.addChild(new FLAG_CURSOR()); + } + _loc2_ = new LinkedCursorData(); + _loc2_.sprite = this._flagCursor; + _loc2_.offset = new Point(); + Mouse.hide(); + LinkedCursorSpriteManager.getInstance().addItem("mapViewerCursor",_loc2_); + } + else + { + this.removeCustomCursor(); + } + this._flagCursorVisible = param1; + } + + public function get useFlagCursor() : Boolean + { + return this._flagCursorVisible; + } + + public function get allChunksLoaded() : Boolean + { + var _loc1_:MapArea = null; + if(!this._visibleMapAreas || !this._visibleMapAreas.length) + { + return false; + } + for each(_loc1_ in this._visibleMapAreas) + { + if(!_loc1_.isLoaded) + { + return false; + } + } + return true; + } + + private function removeCustomCursor() : void + { + Mouse.show(); + LinkedCursorSpriteManager.getInstance().removeItem("mapViewerCursor"); + } + + override public function remove() : void + { + var _loc1_:MapElement = null; + var _loc2_:Object = null; + if(!__removed) + { + if(this._grid) + { + this._grid.cacheAsBitmap = false; + if(this._mapContainer.contains(this._grid)) + { + this._mapContainer.removeChild(this._grid); + } + } + if(this._mapToClear) { - maskCtr.graphics.drawRoundRectComplex(0, 0, width, height, this.roundCornerRadius, this.roundCornerRadius, this.roundCornerRadius, this.roundCornerRadius); - }; - addChild(maskCtr); - this._mapContainer.mask = maskCtr; - } - - private function initMap():void - { - var t3d:Sprite; - this._mapContainer = new Sprite(); - this.initMask(); - this._mapContainer.addChild(this._mapBitmapContainer); - this._grid = new Shape(); - this.drawGrid(); - this._mapContainer.addChild(this._grid); - this._areaShapesContainer = new Sprite(); - this._areaShapesContainer.mouseEnabled = false; - this._mapContainer.addChild(this._areaShapesContainer); - this._groupsContainer = new Sprite(); - this._groupsContainer.mouseEnabled = false; - this._mapContainer.addChild(this._groupsContainer); - this._layersContainer = new Sprite(); - this._mapContainer.addChild(this._layersContainer); - this._layersContainer.mouseEnabled = false; - if (this._enable3DMode) + this.clearMap(this._mapToClear); + this._mapToClear = null; + } + this.removeAllMap(); + for each(_loc1_ in MapElement.getOwnerElements(this)) + { + if(this._mapGroupElements[_loc1_]) + { + delete this._mapGroupElements[_loc1_]; + true; + } + _loc1_.remove(); + } + for(_loc2_ in this._elementsGraphicRef) { - t3d = new Sprite(); - t3d.addChild(this._mapContainer); - t3d.rotationX = -30; - t3d.doubleClickEnabled = true; - addChild(t3d); + delete this._elementsGraphicRef[_loc2_]; + true; + } + this._mapElements = null; + this._elementsGraphicRef = null; + this._mapGroupElements = null; + this._visibleMapAreas = null; + MapElement._elementRef = new Dictionary(true); + EnterFrameDispatcher.removeEventListener(this.onMapEnterFrame); + this.removeCustomCursor(); + if(AirScanner.hasAir()) + { + StageShareManager.stage.nativeWindow.removeEventListener(Event.DEACTIVATE,this.onWindowDeactivate); + } + } + super.remove(); + } + + private function getIconTextureGlobalCoords(param1:MapIconElement) : Point + { + var _loc2_:Number = param1.x * this.mapWidth + this.origineX + this.mapWidth / 2; + var _loc3_:Number = param1.y * this.mapHeight + this.origineY + this.mapHeight / 2; + var _loc4_:Sprite = this._layers[param1.layer] as Sprite; + return _loc4_.localToGlobal(new Point(_loc2_,_loc3_)); + } + + private function updateIcons() : void + { + var _loc2_:Texture = null; + var _loc3_:MapIconElement = null; + var _loc8_:Point = null; + var _loc9_:Point = null; + var _loc11_:* = NaN; + var _loc12_:* = false; + var _loc13_:MapElement = null; + var _loc14_:Texture = null; + var _loc15_:* = NaN; + var _loc16_:* = NaN; + var _loc17_:* = NaN; + var _loc18_:* = undefined; + var _loc19_:Texture = null; + var _loc20_:* = NaN; + var _loc1_:Rectangle = new Rectangle(0,0,1,1); + var _loc4_:Rectangle = this.visibleMaps; + var _loc5_:Point = new Point(Math.floor(_loc4_.x + _loc4_.width / 2),Math.floor(_loc4_.y + _loc4_.height / 2)); + var _loc6_:Number = _loc4_.width / 2; + var _loc7_:* = this.roundCornerRadius > width / 3; + var _loc10_:Number = width / 2; + for each(_loc13_ in this._mapElements) + { + _loc3_ = _loc13_ as MapIconElement; + if(_loc3_) + { + _loc1_.x = _loc3_.x; + _loc1_.y = _loc3_.y; + _loc2_ = _loc3_._texture; + if(_loc2_) + { + if(_loc3_.follow) + { + _loc8_ = this.getIconTextureGlobalCoords(_loc3_); + if(_loc7_) + { + _loc9_ = globalToLocal(_loc8_); + _loc11_ = Math.floor(Math.sqrt(Math.pow(_loc9_.x - _loc10_,2) + Math.pow(_loc9_.y - _loc10_,2))); + _loc12_ = _loc11_ < _loc10_; + } + else + { + _loc12_ = this._mapContainer.mask.getBounds(StageShareManager.stage).containsPoint(_loc8_); + } + } + else + { + _loc12_ = _loc4_.intersects(_loc1_); + } + _loc2_.visible = !(this._layers[_loc3_.layer].visible == false) && (_loc12_); + if((_loc2_.visible) && !_loc2_.finalized) + { + _loc2_.finalize(); + } + if(_loc3_.follow) + { + if((_loc2_.visible) && (this._arrowAllocation[_loc2_])) + { + this._arrowContainer.removeChild(this._arrowAllocation[_loc2_]); + this._arrowPool.push(this._arrowAllocation[_loc2_]); + _loc3_.boundsRef = null; + delete this._reverseArrowAllocation[this._arrowAllocation[_loc2_]]; + true; + delete this._arrowAllocation[_loc2_]; + true; + } + else if((_loc3_.follow) && !_loc2_.visible) + { + _loc19_ = this.getIconArrow(_loc2_); + _loc19_.visible = this._layers[_loc3_.layer].visible; + this._arrowContainer.addChild(_loc19_); + this._elementsGraphicRef[_loc19_] = _loc3_; + _loc3_.boundsRef = _loc19_; + } + + } + } + } + } + _loc15_ = Math.atan2(0,-width / 2); + _loc16_ = Math.atan2(width / 2,0) + _loc15_; + for(_loc18_ in this._arrowAllocation) + { + _loc14_ = this._arrowAllocation[_loc18_]; + _loc3_ = this._elementsGraphicRef[_loc18_]; + if(_loc7_) + { + _loc8_ = globalToLocal(this.getIconTextureGlobalCoords(_loc3_)); + _loc20_ = Math.atan2(-_loc8_.y + height / 2,-_loc8_.x + width / 2); } else { - addChild(this._mapContainer); - }; - addChild(this._arrowContainer); - this._mapElements = new Array(); - this._layers = new Array(); - this._elementsGraphicRef = new Dictionary(true); - this.zoom(this.startScale); - } - - private function drawGrid():void - { - var _local_3:uint; - var _local_4:Number; - var _local_5:uint; - var _local_6:uint; - var offsetX:int = (this.origineX % this.mapWidth); - var offsetY:int = (this.origineY % this.mapHeight); - if (!(this._showGrid)) + _loc20_ = Math.atan2(-_loc3_.y + _loc5_.y,-_loc3_.x + _loc5_.x); + } + _loc14_.x = Math.cos(_loc15_ + _loc20_) * width / 2; + _loc14_.y = Math.sin(_loc15_ + _loc20_) * height / 2; + _loc14_.rotation = _loc20_ * 180 / Math.PI; + if(_loc7_) { - this._grid.graphics.clear(); + _loc14_.x = _loc14_.x + width / 2; + _loc14_.y = _loc14_.y + height / 2; } else { - this._grid.cacheAsBitmap = false; - this._grid.graphics.lineStyle(1, 0x777777, this.gridLineThickness); - _local_5 = (this._mapBitmapContainer.width / this.mapWidth); - _local_3 = 0; - while (_local_3 < _local_5) - { - _local_4 = ((_local_3 * this.mapWidth) + offsetX); - this._grid.graphics.moveTo(_local_4, 0); - this._grid.graphics.lineTo(_local_4, this._mapBitmapContainer.height); - _local_3++; - }; - _local_6 = (this._mapBitmapContainer.height / this.mapHeight); - _local_3 = 0; - while (_local_3 < _local_6) - { - _local_4 = ((_local_3 * this.mapHeight) + offsetY); - this._grid.graphics.moveTo(0, _local_4); - this._grid.graphics.lineTo(this._mapBitmapContainer.width, _local_4); - _local_3++; - }; - this._grid.cacheAsBitmap = true; - }; - } - - private function clearLayer(target:DisplayObjectContainer=null):void - { - var child:DisplayObject; - var l:DisplayObjectContainer; - for each (l in this._layers) - { - if (((!(target)) || ((target == l)))) - { - while (l.numChildren) - { - child = l.removeChildAt(0); - }; - }; - }; - } - - private function clearElementsGroups():void - { - var mapGroupElement:MapGroupElement; - while (this._groupsContainer.numChildren > 0) - { - mapGroupElement = (this._groupsContainer.getChildAt(0) as MapGroupElement); - mapGroupElement.remove(); - this._groupsContainer.removeChildAt(0); - }; - } - - private function clearMapAreaShapes():void - { - var mapAreaShape:MapAreaShape; - var layer:Sprite; - var i:int; - var numLayers:int = this._areaShapesContainer.numChildren; - i = 0; - while (i < numLayers) - { - layer = (this._areaShapesContainer.getChildAt(i) as Sprite); - while (layer.numChildren) - { - mapAreaShape = (layer.getChildAt(0) as MapAreaShape); - mapAreaShape.remove(); - layer.removeChildAt(0); - }; - i++; - }; - } - - private function updateIconSize():void - { - var mie:MapIconElement; - var me:MapElement; - if (((!(this.autoSizeIcon)) || ((this._lastScaleIconUpdate == this._mapContainer.scaleX)))) - { - return; - }; - this._lastScaleIconUpdate = this._mapContainer.scaleX; - for each (me in this._mapElements) - { - mie = (me as MapIconElement); - if (((!(mie)) || (!(mie.canBeAutoSize)))) - { - } - else - { - mie._texture.scaleX = (mie._texture.scaleY = (0.75 + (1 / this._mapContainer.scaleX))); - }; - }; - } - - private function forceMapRollOver():void - { - this._mouseOnArrow = false; - Berilia.getInstance().handler.process(new MapRollOverMessage(this, Math.floor(((this._mapBitmapContainer.mouseX - this.origineX) / this.mapWidth)), Math.floor(((this._mapBitmapContainer.mouseY - this.origineY) / this.mapHeight)))); - } - - private function clearMap(map:Map):void - { - var i:uint; - var l:uint = map.areas.length; - i = 0; - while (i < l) - { - map.areas[i].free(); - i++; - }; - if (map.container.parent == this._mapBitmapContainer) - { - this._mapBitmapContainer.removeChild(map.container); - }; - map = null; - } - - [HideInFakeClass] - override public function process(msg:Message):Boolean - { - var _local_2:MouseOverMessage; - var _local_3:MouseOutMessage; - var _local_4:MouseClickMessage; - var _local_5:MouseWheelMessage; - var _local_6:int; - var _local_7:Point; - var _local_8:MouseRightClickMessage; - var me:MapElement; - switch (true) - { - case (msg is MouseOverMessage): - _local_2 = (msg as MouseOverMessage); - if ((((((_local_2.target == this)) || ((_local_2.target.parent == this)))) || (((!((_local_2.target.parent == this._arrowContainer))) && ((_local_2.target.parent.parent == this)))))) - { - if (!(EnterFrameDispatcher.hasEventListener(this.onMapEnterFrame))) - { - EnterFrameDispatcher.addEventListener(this.onMapEnterFrame, "mapMouse"); - }; - return (false); - }; - this._mouseOnArrow = (((_local_2.target.parent == this._arrowContainer)) ? true : false); - if ((((((_local_2.target is MapGroupElement)) || ((((_local_2.target.parent is MapGroupElement)) && (!((this._openedMapGroupElement == _local_2.target.parent))))))) || ((((this._mapGroupElements[this._elementsGraphicRef[_local_2.target]] is MapGroupElement)) && (!((this._openedMapGroupElement == this._mapGroupElements[this._elementsGraphicRef[_local_2.target]]))))))) - { - if ((_local_2.target is MapGroupElement)) - { - this._openedMapGroupElement = MapGroupElement(_local_2.target); - } - else - { - if ((_local_2.target.parent is MapGroupElement)) - { - this._openedMapGroupElement = MapGroupElement(_local_2.target.parent); - } - else - { - if (!(this._mouseOnArrow)) - { - this._openedMapGroupElement = this._mapGroupElements[this._elementsGraphicRef[_local_2.target]]; - } - else - { - this._openedMapGroupElement = null; - }; - }; - }; - if (((((this._openedMapGroupElement) && (!(this._openedMapGroupElement.opened)))) && ((this._openedMapGroupElement.icons.length > 1)))) - { - this._openedMapGroupElement.open(); - }; - if (((!((_local_2.target is MapGroupElement))) && (((!(this._openedMapGroupElement)) || ((this._openedMapGroupElement.icons.length > 1)))))) - { - Berilia.getInstance().handler.process(new MapElementRollOverMessage(this, this._elementsGraphicRef[_local_2.target])); - }; - } - else - { - if (this._elementsGraphicRef[_local_2.target]) - { - Berilia.getInstance().handler.process(new MapElementRollOverMessage(this, this._elementsGraphicRef[_local_2.target])); - } - else - { - if (((this._reverseArrowAllocation[_local_2.target]) && (this._elementsGraphicRef[this._reverseArrowAllocation[_local_2.target]]))) - { - Berilia.getInstance().handler.process(new MapElementRollOverMessage(this, this._elementsGraphicRef[this._reverseArrowAllocation[_local_2.target]])); - }; - }; - }; - break; - case (msg is MouseOutMessage): - _local_3 = (msg as MouseOutMessage); - if ((((((_local_3.target == this)) || ((_local_3.target.parent == this)))) || (((!((_local_3.target.parent == this._arrowContainer))) && ((_local_3.target.parent.parent == this)))))) - { - if (((!(this._dragging)) && (EnterFrameDispatcher.hasEventListener(this.onMapEnterFrame)))) - { - EnterFrameDispatcher.removeEventListener(this.onMapEnterFrame); - }; - return (false); - }; - this._mouseOnArrow = false; - if (((((((((((_local_3.mouseEvent.relatedObject) && (!((_local_3.mouseEvent.relatedObject.parent == this._openedMapGroupElement))))) && (!((_local_3.mouseEvent.relatedObject == this._openedMapGroupElement))))) && (!((this._mapGroupElements[this._elementsGraphicRef[_local_3.mouseEvent.relatedObject]] == this._openedMapGroupElement))))) && (this._openedMapGroupElement))) && (this._openedMapGroupElement.opened))) - { - this._openedMapGroupElement.close(); - this._openedMapGroupElement = null; - this.forceMapRollOver(); - }; - if (this._elementsGraphicRef[_local_3.target]) - { - Berilia.getInstance().handler.process(new MapElementRollOutMessage(this, this._elementsGraphicRef[_local_3.target])); - } - else - { - if (((this._reverseArrowAllocation[_local_3.target]) && (this._elementsGraphicRef[this._reverseArrowAllocation[_local_3.target]]))) - { - Berilia.getInstance().handler.process(new MapElementRollOutMessage(this, this._elementsGraphicRef[this._reverseArrowAllocation[_local_3.target]])); - }; - }; - break; - case (msg is MouseDownMessage): - if (!(this.enabledDrag)) - { - return (false); - }; - if (!(this._enable3DMode)) - { - this._mapContainer.startDrag(false, new Rectangle((width - (this._currentMap.initialWidth * this._mapContainer.scaleX)), (height - (this._currentMap.initialHeight * this._mapContainer.scaleY)), ((this._currentMap.initialWidth * this._mapContainer.scaleX) - width), ((this._currentMap.initialHeight * this._mapContainer.scaleY) - height))); - }; - this._dragging = true; - return (false); - case (msg is MouseClickMessage): - _local_4 = (msg as MouseClickMessage); - if (this._reverseArrowAllocation[_local_4.target]) - { - TooltipManager.hide(); - me = this._elementsGraphicRef[this._reverseArrowAllocation[_local_4.target]]; - this.moveTo(me.x, me.y); - }; - break; - case (msg is MouseReleaseOutsideMessage): - case (msg is MouseUpMessage): - if (!(this._enable3DMode)) - { - this._mapContainer.stopDrag(); - }; - this._dragging = false; - this._lastMouseX = 0; - this.updateVisibleChunck(); - Berilia.getInstance().handler.process(new MapMoveMessage(this)); - return (false); - case (msg is MouseWheelMessage): - _local_5 = (msg as MouseWheelMessage); - _local_6 = ((this._mapContainer.scaleX * 100) + ((((_local_5.mouseEvent.delta > 0)) ? 100 : -100) * this.zoomStep)); - _local_7 = new Point(_local_5.mouseEvent.localX, _local_5.mouseEvent.localY); - switch (true) - { - case (_local_5.mouseEvent.target.parent is MapGroupElement): - _local_7.x = _local_5.mouseEvent.target.parent.x; - _local_7.y = _local_5.mouseEvent.target.parent.y; - break; - case (_local_5.mouseEvent.target is MapGroupElement): - case (_local_5.mouseEvent.target is Texture): - _local_7.x = _local_5.mouseEvent.target.x; - _local_7.y = _local_5.mouseEvent.target.y; - break; - }; - this.zoomWithScalePercent(_local_6, _local_7); - Berilia.getInstance().handler.process(new MapMoveMessage(this)); - return (true); - case (msg is MouseRightClickMessage): - _local_8 = (msg as MouseRightClickMessage); - if (this._elementsGraphicRef[_local_8.target]) - { - Berilia.getInstance().handler.process(new MapElementRightClickMessage(this, this._elementsGraphicRef[_local_8.target])); - } - else - { - if (((this._reverseArrowAllocation[_local_8.target]) && (this._elementsGraphicRef[this._reverseArrowAllocation[_local_8.target]]))) - { - Berilia.getInstance().handler.process(new MapElementRightClickMessage(this, this._elementsGraphicRef[this._reverseArrowAllocation[_local_8.target]])); - }; - }; - return (false); - }; - return (false); - } - - private function onMapEnterFrame(e:Event):void - { - var mx:int; - var my:int; - if (((this._mapToClear) && (this.allChunksLoaded))) - { - this.clearMap(this._mapToClear); - this._mapToClear = null; - }; - if (((this._dragging) && (((!((this._lastMouseX == StageShareManager.mouseX))) || (!((this._lastMouseY == StageShareManager.mouseY))))))) - { - if (((this._enable3DMode) && (this._lastMouseX))) - { - this._mapContainer.x = (this._mapContainer.x - (StageShareManager.mouseX - this._lastMouseX)); - this._mapContainer.y = (this._mapContainer.y - (StageShareManager.mouseY - this._lastMouseY)); - }; - this.updateVisibleChunck(); - this._lastMouseX = StageShareManager.mouseX; - this._lastMouseY = StageShareManager.mouseY; - }; - var posX:int = this.mouseX; - var posY:int = this.mouseY; - if ((((((((posX > 0)) && ((posX < __width)))) && ((posY > 0)))) && ((posY < __height)))) - { - mx = Math.floor(((this._mapBitmapContainer.mouseX - this.origineX) / this.mapWidth)); - my = Math.floor(((this._mapBitmapContainer.mouseY - this.origineY) / this.mapHeight)); - if (((((((!(this._openedMapGroupElement)) || (!(this._openedMapGroupElement.opened)))) && (!(this._mouseOnArrow)))) && (((!((mx == this._lastMx))) || (!((my == this._lastMy))))))) - { - this._lastMx = mx; - this._lastMy = my; - Berilia.getInstance().handler.process(new MapRollOverMessage(this, mx, my)); - }; - }; - } - - private function onWindowDeactivate(pEvent:Event):void - { - if (this._dragging) + _loc16_ = _loc14_.y / _loc14_.x; + _loc20_ = _loc20_ + Math.PI; + if(_loc20_ < Math.PI / 4 || _loc20_ > Math.PI * 7 / 4) + { + _loc17_ = width / 2 * _loc16_ + height / 2; + if(_loc17_ > 0 && _loc17_ < height) + { + _loc14_.x = width; + _loc14_.y = _loc17_; + continue; + } + } + else if(_loc20_ < Math.PI * 3 / 4) + { + _loc17_ = height / 2 / _loc16_ + width / 2; + _loc17_ = _loc17_ > width?width:_loc17_; + if(_loc17_ > 0) + { + _loc14_.x = _loc17_; + _loc14_.y = height; + continue; + } + } + else if(_loc20_ < Math.PI * 5 / 4) + { + _loc17_ = -width / 2 * _loc16_ + height / 2; + if(_loc17_ > 0 && _loc17_ < height) + { + _loc14_.x = 0; + _loc14_.y = _loc17_; + continue; + } + } + else + { + _loc17_ = -height / 2 / _loc16_ + width / 2; + _loc17_ = _loc17_ > width?width:_loc17_ < 0?0:_loc17_; + if(_loc17_ >= 0) + { + _loc14_.x = _loc17_; + _loc14_.y = 0; + continue; + } + } + + + if(_loc14_.rotation == -45) + { + _loc14_.x = 0; + _loc14_.y = _loc17_; + } + } + } + } + + private function getIconArrow(param1:Texture) : Texture + { + var _loc2_:Texture = null; + if(this._arrowAllocation[param1]) + { + return this._arrowAllocation[param1]; + } + if(this._arrowPool.length) + { + this._arrowAllocation[param1] = this._arrowPool.pop(); + } + else + { + _loc2_ = new Texture(); + _loc2_.uri = new Uri(XmlConfig.getInstance().getEntry("config.gfx.path") + "icons/assets.swf|arrow0"); + _loc2_.mouseEnabled = true; + _loc2_.buttonMode = _loc2_.useHandCursor = true; + _loc2_.finalize(); + this._arrowAllocation[param1] = _loc2_; + } + this._reverseArrowAllocation[this._arrowAllocation[param1]] = param1; + Texture(this._arrowAllocation[param1]).transform.colorTransform = param1.transform.colorTransform; + return this._arrowAllocation[param1]; + } + + private var zz:Number = 1; + + private function processMapInfo() : void + { + var _loc1_:Map = null; + var _loc3_:* = NaN; + var _loc4_:Map = null; + if(!this._availableMaps.length) + { + return; + } + this._lastScaleIconUpdate = -1; + var _loc2_:Number = 10000; + for each(_loc4_ in this._availableMaps) + { + _loc3_ = Math.abs(_loc4_.zoom - this._mapContainer.scaleX); + if(_loc3_ < _loc2_) + { + _loc1_ = _loc4_; + _loc2_ = _loc3_; + } + } + if(!this._currentMap || !(_loc1_ == this._currentMap)) + { + if(this._currentMap) + { + if(this._mapToClear) + { + this.clearMap(this._mapToClear); + } + this._mapToClear = this._currentMap; + } + this._currentMap = _loc1_; + this._mapBitmapContainer.graphics.beginFill(0,0); + this._mapBitmapContainer.graphics.drawRect(0,0,this._currentMap.initialWidth,this._currentMap.initialHeight); + this._mapBitmapContainer.graphics.endFill(); + this._mapBitmapContainer.addChild(this._currentMap.container); + this._viewRect.width = width; + this._viewRect.height = height; + } + this.updateVisibleChunck(); + } + + private function updateVisibleChunck(param1:Boolean = true) : void + { + var _loc3_:MapArea = null; + if(!this._currentMap || !this._currentMap.areas) + { + return; + } + if(param1) + { + this.updateIcons(); + } + var _loc2_:uint = 100; + this._visibleMapAreas = new Vector.(); + this._viewRect.x = -this._mapContainer.x / this._mapContainer.scaleX - _loc2_; + this._viewRect.y = -this._mapContainer.y / this._mapContainer.scaleY - _loc2_; + this._viewRect.width = width / this._mapContainer.scaleX + _loc2_ * 2; + this._viewRect.height = height / this._mapContainer.scaleY + _loc2_ * 2; + for each(_loc3_ in this._currentMap.areas) + { + if(this._viewRect.intersects(_loc3_)) + { + if(!_loc3_.isUsed) + { + _loc3_.parent.container.addChild(_loc3_.getBitmap()); + } + this._visibleMapAreas.push(_loc3_); + } + else if(_loc3_.isUsed) { - this.process(new MouseUpMessage()); - }; - } - - - } -}//package com.ankamagames.berilia.components - + _loc3_.free(); + } + + } + this._visibleMapAreas.fixed = true; + } + + private function initMask() : void + { + if(this._mapContainer.mask) + { + this._mapContainer.mask.parent.removeChild(this._mapContainer.mask); + } + var _loc1_:Sprite = new Sprite(); + _loc1_.doubleClickEnabled = true; + _loc1_.graphics.beginFill(7798784,0.3); + if(!this.roundCornerRadius) + { + _loc1_.graphics.drawRect(0,0,width,height); + } + else + { + _loc1_.graphics.drawRoundRectComplex(0,0,width,height,this.roundCornerRadius,this.roundCornerRadius,this.roundCornerRadius,this.roundCornerRadius); + } + addChild(_loc1_); + this._mapContainer.mask = _loc1_; + } + + private function initMap() : void + { + var _loc1_:Sprite = null; + this._mapContainer = new Sprite(); + this.initMask(); + this._mapContainer.addChild(this._mapBitmapContainer); + this._grid = new Shape(); + this.drawGrid(); + this._mapContainer.addChild(this._grid); + this._areaShapesContainer = new Sprite(); + this._areaShapesContainer.mouseEnabled = false; + this._mapContainer.addChild(this._areaShapesContainer); + this._groupsContainer = new Sprite(); + this._groupsContainer.mouseEnabled = false; + this._mapContainer.addChild(this._groupsContainer); + this._layersContainer = new Sprite(); + this._mapContainer.addChild(this._layersContainer); + this._layersContainer.mouseEnabled = false; + if(this._enable3DMode) + { + _loc1_ = new Sprite(); + _loc1_.addChild(this._mapContainer); + _loc1_.rotationX = -30; + _loc1_.doubleClickEnabled = true; + addChild(_loc1_); + } + else + { + addChild(this._mapContainer); + } + addChild(this._arrowContainer); + this._mapElements = new Array(); + this._layers = new Array(); + this._elementsGraphicRef = new Dictionary(true); + this.zoom(this.startScale); + } + + private function drawGrid() : void + { + var _loc3_:uint = 0; + var _loc4_:* = NaN; + var _loc5_:uint = 0; + var _loc6_:uint = 0; + var _loc1_:int = this.origineX % this.mapWidth; + var _loc2_:int = this.origineY % this.mapHeight; + if(!this._showGrid) + { + this._grid.graphics.clear(); + } + else + { + this._grid.cacheAsBitmap = false; + this._grid.graphics.lineStyle(1,7829367,this.gridLineThickness); + _loc5_ = this._mapBitmapContainer.width / this.mapWidth; + _loc3_ = 0; + while(_loc3_ < _loc5_) + { + _loc4_ = _loc3_ * this.mapWidth + _loc1_; + this._grid.graphics.moveTo(_loc4_,0); + this._grid.graphics.lineTo(_loc4_,this._mapBitmapContainer.height); + _loc3_++; + } + _loc6_ = this._mapBitmapContainer.height / this.mapHeight; + _loc3_ = 0; + while(_loc3_ < _loc6_) + { + _loc4_ = _loc3_ * this.mapHeight + _loc2_; + this._grid.graphics.moveTo(0,_loc4_); + this._grid.graphics.lineTo(this._mapBitmapContainer.width,_loc4_); + _loc3_++; + } + this._grid.cacheAsBitmap = true; + } + } + + private function clearLayer(param1:DisplayObjectContainer = null) : void + { + var _loc2_:DisplayObject = null; + var _loc3_:DisplayObjectContainer = null; + for each(_loc3_ in this._layers) + { + if(!param1 || param1 == _loc3_) + { + while(_loc3_.numChildren) + { + _loc2_ = _loc3_.removeChildAt(0); + } + } + } + } + + private function clearElementsGroups() : void + { + var _loc1_:MapGroupElement = null; + while(this._groupsContainer.numChildren > 0) + { + _loc1_ = this._groupsContainer.getChildAt(0) as MapGroupElement; + _loc1_.remove(); + this._groupsContainer.removeChildAt(0); + } + } + + private function clearMapAreaShapes() : void + { + var _loc1_:MapAreaShape = null; + var _loc2_:Sprite = null; + var _loc4_:* = 0; + var _loc3_:int = this._areaShapesContainer.numChildren; + _loc4_ = 0; + while(_loc4_ < _loc3_) + { + _loc2_ = this._areaShapesContainer.getChildAt(_loc4_) as Sprite; + while(_loc2_.numChildren) + { + _loc1_ = _loc2_.getChildAt(0) as MapAreaShape; + _loc1_.remove(); + _loc2_.removeChildAt(0); + } + _loc4_++; + } + } + + private function updateIconSize() : void + { + var _loc1_:MapIconElement = null; + var _loc2_:MapElement = null; + if(!this.autoSizeIcon || this._lastScaleIconUpdate == this._mapContainer.scaleX) + { + return; + } + this._lastScaleIconUpdate = this._mapContainer.scaleX; + for each(_loc2_ in this._mapElements) + { + _loc1_ = _loc2_ as MapIconElement; + if(!(!_loc1_ || !_loc1_.canBeAutoSize)) + { + _loc1_._texture.scaleX = _loc1_._texture.scaleY = 0.75 + 1 / this._mapContainer.scaleX; + } + } + } + + private function forceMapRollOver() : void + { + this._mouseOnArrow = false; + Berilia.getInstance().handler.process(new MapRollOverMessage(this,Math.floor((this._mapBitmapContainer.mouseX - this.origineX) / this.mapWidth),Math.floor((this._mapBitmapContainer.mouseY - this.origineY) / this.mapHeight))); + } + + private function clearMap(param1:Map) : void + { + var _loc2_:uint = 0; + var _loc3_:uint = param1.areas.length; + _loc2_ = 0; + while(_loc2_ < _loc3_) + { + param1.areas[_loc2_].free(); + _loc2_++; + } + if(param1.container.parent == this._mapBitmapContainer) + { + this._mapBitmapContainer.removeChild(param1.container); + } + var param1:Map = null; + } + + override public function process(param1:Message) : Boolean + { + var _loc2_:MouseOverMessage = null; + var _loc3_:MouseOutMessage = null; + var _loc4_:MouseClickMessage = null; + var _loc5_:MouseWheelMessage = null; + var _loc6_:* = 0; + var _loc7_:Point = null; + var _loc8_:MouseRightClickMessage = null; + var _loc9_:MapElement = null; + switch(true) + { + case param1 is MouseOverMessage: + _loc2_ = param1 as MouseOverMessage; + if(_loc2_.target == this || _loc2_.target.parent == this || !(_loc2_.target.parent == this._arrowContainer) && _loc2_.target.parent.parent == this) + { + if(!EnterFrameDispatcher.hasEventListener(this.onMapEnterFrame)) + { + EnterFrameDispatcher.addEventListener(this.onMapEnterFrame,"mapMouse"); + } + return false; + } + this._mouseOnArrow = _loc2_.target.parent == this._arrowContainer?true:false; + if(_loc2_.target is MapGroupElement || _loc2_.target.parent is MapGroupElement && !(this._openedMapGroupElement == _loc2_.target.parent) || this._mapGroupElements[this._elementsGraphicRef[_loc2_.target]] is MapGroupElement && !(this._openedMapGroupElement == this._mapGroupElements[this._elementsGraphicRef[_loc2_.target]])) + { + if(_loc2_.target is MapGroupElement) + { + this._openedMapGroupElement = MapGroupElement(_loc2_.target); + } + else if(_loc2_.target.parent is MapGroupElement) + { + this._openedMapGroupElement = MapGroupElement(_loc2_.target.parent); + } + else if(!this._mouseOnArrow) + { + this._openedMapGroupElement = this._mapGroupElements[this._elementsGraphicRef[_loc2_.target]]; + } + else + { + this._openedMapGroupElement = null; + } + + + if((this._openedMapGroupElement) && (!this._openedMapGroupElement.opened) && this._openedMapGroupElement.icons.length > 1) + { + this._openedMapGroupElement.open(); + } + if(!(_loc2_.target is MapGroupElement) && (!this._openedMapGroupElement || this._openedMapGroupElement.icons.length > 1)) + { + Berilia.getInstance().handler.process(new MapElementRollOverMessage(this,this._elementsGraphicRef[_loc2_.target])); + } + } + else if(this._elementsGraphicRef[_loc2_.target]) + { + Berilia.getInstance().handler.process(new MapElementRollOverMessage(this,this._elementsGraphicRef[_loc2_.target])); + } + else if((this._reverseArrowAllocation[_loc2_.target]) && (this._elementsGraphicRef[this._reverseArrowAllocation[_loc2_.target]])) + { + Berilia.getInstance().handler.process(new MapElementRollOverMessage(this,this._elementsGraphicRef[this._reverseArrowAllocation[_loc2_.target]])); + } + + + break; + case param1 is MouseOutMessage: + _loc3_ = param1 as MouseOutMessage; + if(_loc3_.target == this || _loc3_.target.parent == this || !(_loc3_.target.parent == this._arrowContainer) && _loc3_.target.parent.parent == this) + { + if(!this._dragging && (EnterFrameDispatcher.hasEventListener(this.onMapEnterFrame))) + { + EnterFrameDispatcher.removeEventListener(this.onMapEnterFrame); + } + return false; + } + this._mouseOnArrow = false; + if((_loc3_.mouseEvent.relatedObject && !(_loc3_.mouseEvent.relatedObject.parent == this._openedMapGroupElement) && !(_loc3_.mouseEvent.relatedObject == this._openedMapGroupElement) && !(this._mapGroupElements[this._elementsGraphicRef[_loc3_.mouseEvent.relatedObject]] == this._openedMapGroupElement)) && (this._openedMapGroupElement) && (this._openedMapGroupElement.opened)) + { + this._openedMapGroupElement.close(); + this._openedMapGroupElement = null; + this.forceMapRollOver(); + } + if(this._elementsGraphicRef[_loc3_.target]) + { + Berilia.getInstance().handler.process(new MapElementRollOutMessage(this,this._elementsGraphicRef[_loc3_.target])); + } + else if((this._reverseArrowAllocation[_loc3_.target]) && (this._elementsGraphicRef[this._reverseArrowAllocation[_loc3_.target]])) + { + Berilia.getInstance().handler.process(new MapElementRollOutMessage(this,this._elementsGraphicRef[this._reverseArrowAllocation[_loc3_.target]])); + } + + break; + case param1 is MouseDownMessage: + if(!this.enabledDrag) + { + return false; + } + if(!this._enable3DMode) + { + this._mapContainer.startDrag(false,new Rectangle(width - this._currentMap.initialWidth * this._mapContainer.scaleX,height - this._currentMap.initialHeight * this._mapContainer.scaleY,this._currentMap.initialWidth * this._mapContainer.scaleX - width,this._currentMap.initialHeight * this._mapContainer.scaleY - height)); + } + this._dragging = true; + return false; + case param1 is MouseClickMessage: + _loc4_ = param1 as MouseClickMessage; + if(this._reverseArrowAllocation[_loc4_.target]) + { + TooltipManager.hide(); + _loc9_ = this._elementsGraphicRef[this._reverseArrowAllocation[_loc4_.target]]; + this.moveTo(_loc9_.x,_loc9_.y); + } + break; + case param1 is MouseReleaseOutsideMessage: + case param1 is MouseUpMessage: + if(!this._enable3DMode) + { + this._mapContainer.stopDrag(); + } + this._dragging = false; + this._lastMouseX = 0; + this.updateVisibleChunck(); + Berilia.getInstance().handler.process(new MapMoveMessage(this)); + return false; + case param1 is MouseWheelMessage: + _loc5_ = param1 as MouseWheelMessage; + _loc6_ = this._mapContainer.scaleX * 100 + (_loc5_.mouseEvent.delta > 0?100:-100) * this.zoomStep; + _loc7_ = new Point(_loc5_.mouseEvent.localX,_loc5_.mouseEvent.localY); + switch(true) + { + case _loc5_.mouseEvent.target.parent is MapGroupElement: + _loc7_.x = _loc5_.mouseEvent.target.parent.x; + _loc7_.y = _loc5_.mouseEvent.target.parent.y; + break; + case _loc5_.mouseEvent.target is MapGroupElement: + case _loc5_.mouseEvent.target is Texture: + _loc7_.x = _loc5_.mouseEvent.target.x; + _loc7_.y = _loc5_.mouseEvent.target.y; + break; + } + this.zoomWithScalePercent(_loc6_,_loc7_); + Berilia.getInstance().handler.process(new MapMoveMessage(this)); + return true; + case param1 is MouseRightClickMessage: + _loc8_ = param1 as MouseRightClickMessage; + if(this._elementsGraphicRef[_loc8_.target]) + { + Berilia.getInstance().handler.process(new MapElementRightClickMessage(this,this._elementsGraphicRef[_loc8_.target])); + } + else if((this._reverseArrowAllocation[_loc8_.target]) && (this._elementsGraphicRef[this._reverseArrowAllocation[_loc8_.target]])) + { + Berilia.getInstance().handler.process(new MapElementRightClickMessage(this,this._elementsGraphicRef[this._reverseArrowAllocation[_loc8_.target]])); + } + + return false; + } + return false; + } + + private var _lastMouseX:int = 0; + + private var _lastMouseY:int = 0; + + private function onMapEnterFrame(param1:Event) : void + { + var _loc4_:* = 0; + var _loc5_:* = 0; + if((this._mapToClear) && (this.allChunksLoaded)) + { + this.clearMap(this._mapToClear); + this._mapToClear = null; + } + if((this._dragging) && (!(this._lastMouseX == StageShareManager.mouseX) || !(this._lastMouseY == StageShareManager.mouseY))) + { + if((this._enable3DMode) && (this._lastMouseX)) + { + this._mapContainer.x = this._mapContainer.x - (StageShareManager.mouseX - this._lastMouseX); + this._mapContainer.y = this._mapContainer.y - (StageShareManager.mouseY - this._lastMouseY); + } + this.updateVisibleChunck(); + this._lastMouseX = StageShareManager.mouseX; + this._lastMouseY = StageShareManager.mouseY; + } + var _loc2_:int = this.mouseX; + var _loc3_:int = this.mouseY; + if(_loc2_ > 0 && _loc2_ < __width && _loc3_ > 0 && _loc3_ < __height) + { + _loc4_ = Math.floor((this._mapBitmapContainer.mouseX - this.origineX) / this.mapWidth); + _loc5_ = Math.floor((this._mapBitmapContainer.mouseY - this.origineY) / this.mapHeight); + if((!this._openedMapGroupElement || !this._openedMapGroupElement.opened) && !this._mouseOnArrow && (!(_loc4_ == this._lastMx) || !(_loc5_ == this._lastMy))) + { + this._lastMx = _loc4_; + this._lastMy = _loc5_; + Berilia.getInstance().handler.process(new MapRollOverMessage(this,_loc4_,_loc5_)); + } + } + } + + private function onWindowDeactivate(param1:Event) : void + { + if(this._dragging) + { + this.process(new MouseUpMessage()); + } + } + } +} diff --git a/com/ankamagames/berilia/components/ScrollBar.as b/com/ankamagames/berilia/components/ScrollBar.as index 4fac4ce2d..4a1d4eb6c 100644 --- a/com/ankamagames/berilia/components/ScrollBar.as +++ b/com/ankamagames/berilia/components/ScrollBar.as @@ -1,859 +1,887 @@ -package com.ankamagames.berilia.components +package com.ankamagames.berilia.components { - import com.ankamagames.berilia.types.graphic.GraphicContainer; - import com.ankamagames.berilia.FinalizableUIComponent; - import flash.utils.Dictionary; - import com.ankamagames.jerakine.logger.Logger; - import com.ankamagames.jerakine.logger.Log; - import flash.utils.getQualifiedClassName; - import com.ankamagames.jerakine.data.XmlConfig; - import com.ankamagames.jerakine.types.Uri; - import com.ankamagames.berilia.managers.CssManager; - import com.ankamagames.jerakine.types.Callback; - import com.ankamagames.berilia.enums.StatesEnum; - import com.ankamagames.berilia.types.graphic.ButtonContainer; - import com.ankamagames.berilia.types.graphic.GraphicElement; - import flash.events.Event; - import com.ankamagames.jerakine.utils.display.EnterFrameDispatcher; - import flash.events.MouseEvent; - import com.ankamagames.jerakine.interfaces.IInterfaceListener; - import com.ankamagames.jerakine.pools.PoolsManager; - import com.ankamagames.jerakine.pools.PoolableRectangle; - import com.ankamagames.jerakine.handlers.messages.mouse.MouseDownMessage; - import com.ankamagames.berilia.Berilia; - import com.ankamagames.jerakine.handlers.messages.mouse.MouseUpMessage; - import com.ankamagames.jerakine.handlers.messages.mouse.MouseReleaseOutsideMessage; - import com.ankamagames.jerakine.handlers.messages.mouse.MouseWheelMessage; - import com.ankamagames.jerakine.messages.Message; - import com.ankamagames.berilia.types.data.ExtendedStyleSheet; - - public class ScrollBar extends GraphicContainer implements FinalizableUIComponent - { - - public static var MEMORY_LOG:Dictionary = new Dictionary(true); - protected static const _log:Logger = Log.getLogger(getQualifiedClassName(ScrollBar)); - - private const _common:String = XmlConfig.getInstance().getEntry("config.ui.skin"); - - private var _nWidth:uint = 16; - private var _nHeight:uint = 200; - private var _sCss:Uri; - private var _uriTexBack:Uri; - private var _uriTexMin:Uri; - private var _uriTexMax:Uri; - private var _uriTexBox:Uri; - private var _nMin:int; - private var _nMax:int; - private var _nTotal:int = 1; - private var _nStep:uint = 1; - private var _nCurrentValue:int = 0; - private var _bDisabled:Boolean = false; - private var _texBack:Texture; - private var _texBox:Texture; - private var _texMin:Texture; - private var _texMax:Texture; - private var _gcMin:GraphicContainer; - private var _gcMax:GraphicContainer; - private var _gcBox:GraphicContainer; - private var _nBoxSize:Number; - private var _nBoxPosMin:Number; - private var _nBoxPosMax:Number; - private var _nCurrentPos:Number = 0; - private var _nLastPos:Number = 0; - private var _nScrollStep:Number; - private var _nScrollSpeed:Number = 0.333333333333333; - private var _squareEdge:uint; - private var _bVertical:Boolean; - private var _bFinalized:Boolean = false; - private var _nDecelerateScroll:uint = 1; - private var _nAcelerateScroll:uint = 0; - private var _nMaxDecelerateFactor:uint = 4; - private var _bOnDrag:Boolean = false; - - public function ScrollBar() - { - MEMORY_LOG[this] = 1; - } - - override public function get width():Number - { - return (this._nWidth); - } - - override public function set width(nValue:Number):void - { - this._nWidth = nValue; - if (this.finalized) - { - this.scrollBarProcess(); - }; - } - - override public function get height():Number - { - return (this._nHeight); - } - - override public function set height(nValue:Number):void - { - this._nHeight = nValue; - if (this.finalized) - { - this.scrollBarProcess(); - }; - } - - public function get css():Uri - { - return (this._sCss); - } - - public function set css(sValue:Uri):void - { - if (sValue == null) - { - return; - }; - if (sValue != this._sCss) - { - this._sCss = sValue; - CssManager.getInstance().askCss(sValue.uri, new Callback(this.fakeCssLoaded)); - }; - } - - public function get min():int - { - return (this._nMin); - } - - public function set min(nValue:int):void - { - this._nMin = nValue; - if (this.finalized) - { - this.scrollBarProcess(); - }; - } - - public function get max():int - { - return (this._nMax); - } - - public function set max(nValue:int):void - { - this._nMax = nValue; - if (this.finalized) - { - this.scrollBarProcess(); - }; - } - - public function get total():int - { - return (this._nTotal); - } - - public function set total(nValue:int):void - { - this._nTotal = nValue; - if (this.finalized) - { - this.scrollBarProcess(); - }; - } - - public function get step():uint - { - return (this._nStep); - } - - public function set step(nValue:uint):void - { - this._nStep = nValue; - if (this.finalized) - { - this.scrollBarProcess(); - }; - } - - public function get value():int - { - return (Math.min(((Math.round(((this._nCurrentPos - this._nBoxPosMin) / this._nScrollStep)) * this._nStep) + this._nMin), this._nMax)); - } - - public function set value(nValue:int):void - { - if (nValue > this._nMax) - { - nValue = this._nMax; - }; - if (nValue < this._nMin) - { - nValue = this._nMin; - }; - this._nCurrentValue = nValue; - if (this.finalized) - { - this._nCurrentPos = (((this._nCurrentValue - this._nMin) * (this._nStep * this._nScrollStep)) + this._nBoxPosMin); - this.updateDisplayFromCurrentPos(); - }; - } - - public function set scrollSpeed(nValue:Number):void - { - this._nScrollSpeed = nValue; - } - - public function get scrollSpeed():Number - { - return (this._nScrollSpeed); - } - - public function get finalized():Boolean - { - return (this._bFinalized); - } - - public function set finalized(bValue:Boolean):void - { - this._bFinalized = bValue; - } - - public function get boxSize():Number - { - return (this._nBoxSize); - } - - public function set vertical(b:Boolean):void - { - this._bVertical = b; - if (this.finalized) - { - this.scrollBarProcess(); - }; - } - - public function get vertical():Boolean - { - return (this._bVertical); - } - - override public function set disabled(bool:Boolean):void - { - if (bool == this._bDisabled) - { - return; - }; - if (bool) - { - if (((((this._texBox) && (this._texMin))) && (this._texMax))) - { - this._texBox.visible = false; - this._texMax.gotoAndStop = StatesEnum.STATE_DISABLED_STRING; - this._texMin.gotoAndStop = StatesEnum.STATE_DISABLED_STRING; - }; - mouseEnabled = false; - mouseChildren = false; - } - else - { - if (((((this._texBox) && (this._texMin))) && (this._texMax))) - { - this._texBox.visible = true; - this._texMax.gotoAndStop = StatesEnum.STATE_NORMAL_STRING; - this._texMin.gotoAndStop = StatesEnum.STATE_NORMAL_STRING; - }; - mouseEnabled = true; - mouseChildren = true; - }; - this._bDisabled = bool; - } - - public function finalize():void - { - if (this._sCss) - { - if (this._nHeight > this._nWidth) - { - this._bVertical = true; - } - else - { - this._bVertical = false; - }; - CssManager.getInstance().askCss(this._sCss.uri, new Callback(this.onCssLoaded)); - }; - } - - private function scrollBarInit():void - { - var stateChangingProperties1:Array; - var stateChangingProperties2:Array; - var stateChangingProperties3:Array; - if (!(this._gcMin)) - { - this._gcMin = new ButtonContainer(); - this._gcMax = new ButtonContainer(); - this._gcBox = new ButtonContainer(); - (this._gcMin as ButtonContainer).soundId = "-1"; - (this._gcMax as ButtonContainer).soundId = "-1"; - this._texMin.name = (name + "_scrollBar_buttonMin"); - this._texMin.keepRatio = true; - getUi().registerId(this._texMin.name, new GraphicElement(this._texMin, new Array(), "buttonMin")); - this._texMax.name = (name + "_scrollBar_buttonMax"); - this._texMax.keepRatio = true; - getUi().registerId(this._texMax.name, new GraphicElement(this._texMax, new Array(), "buttonMax")); - this._texBox.name = (name + "_scrollBar_buttonBox"); - getUi().registerId(this._texBox.name, new GraphicElement(this._texBox, new Array(), "buttonBox")); - this._gcMin.addChild(this._texMin); - this._gcMax.addChild(this._texMax); - this._gcBox.addChild(this._texBox); - stateChangingProperties1 = new Array(); - stateChangingProperties1[StatesEnum.STATE_OVER] = new Array(); - stateChangingProperties1[StatesEnum.STATE_OVER][this._texBox.name] = new Array(); - stateChangingProperties1[StatesEnum.STATE_OVER][this._texBox.name]["gotoAndStop"] = StatesEnum.STATE_OVER_STRING.toLocaleLowerCase(); - stateChangingProperties1[StatesEnum.STATE_CLICKED] = new Array(); - stateChangingProperties1[StatesEnum.STATE_CLICKED][this._texBox.name] = new Array(); - stateChangingProperties1[StatesEnum.STATE_CLICKED][this._texBox.name]["gotoAndStop"] = StatesEnum.STATE_CLICKED_STRING.toLocaleLowerCase(); - stateChangingProperties2 = new Array(); - stateChangingProperties2[StatesEnum.STATE_OVER] = new Array(); - stateChangingProperties2[StatesEnum.STATE_OVER][this._texMin.name] = new Array(); - stateChangingProperties2[StatesEnum.STATE_OVER][this._texMin.name]["gotoAndStop"] = StatesEnum.STATE_OVER_STRING.toLocaleLowerCase(); - stateChangingProperties2[StatesEnum.STATE_CLICKED] = new Array(); - stateChangingProperties2[StatesEnum.STATE_CLICKED][this._texMin.name] = new Array(); - stateChangingProperties2[StatesEnum.STATE_CLICKED][this._texMin.name]["gotoAndStop"] = StatesEnum.STATE_CLICKED_STRING.toLocaleLowerCase(); - stateChangingProperties3 = new Array(); - stateChangingProperties3[StatesEnum.STATE_OVER] = new Array(); - stateChangingProperties3[StatesEnum.STATE_OVER][this._texMax.name] = new Array(); - stateChangingProperties3[StatesEnum.STATE_OVER][this._texMax.name]["gotoAndStop"] = StatesEnum.STATE_OVER_STRING.toLocaleLowerCase(); - stateChangingProperties3[StatesEnum.STATE_CLICKED] = new Array(); - stateChangingProperties3[StatesEnum.STATE_CLICKED][this._texMax.name] = new Array(); - stateChangingProperties3[StatesEnum.STATE_CLICKED][this._texMax.name]["gotoAndStop"] = StatesEnum.STATE_CLICKED_STRING.toLocaleLowerCase(); - ButtonContainer(this._gcBox).changingStateData = stateChangingProperties1; - ButtonContainer(this._gcMin).changingStateData = stateChangingProperties2; - ButtonContainer(this._gcMax).changingStateData = stateChangingProperties3; - }; - this.finalized = true; + import com.ankamagames.berilia.types.graphic.GraphicContainer; + import com.ankamagames.berilia.FinalizableUIComponent; + import flash.utils.Dictionary; + import com.ankamagames.jerakine.logger.Logger; + import com.ankamagames.jerakine.logger.Log; + import flash.utils.getQualifiedClassName; + import com.ankamagames.jerakine.types.Uri; + import com.ankamagames.berilia.managers.CssManager; + import com.ankamagames.jerakine.types.Callback; + import com.ankamagames.berilia.enums.StatesEnum; + import com.ankamagames.berilia.types.graphic.ButtonContainer; + import com.ankamagames.berilia.types.graphic.GraphicElement; + import flash.events.Event; + import com.ankamagames.jerakine.utils.display.EnterFrameDispatcher; + import flash.events.MouseEvent; + import com.ankamagames.jerakine.messages.Message; + import com.ankamagames.jerakine.interfaces.IInterfaceListener; + import com.ankamagames.jerakine.pools.PoolsManager; + import com.ankamagames.jerakine.pools.PoolableRectangle; + import com.ankamagames.berilia.Berilia; + import com.ankamagames.jerakine.handlers.messages.mouse.MouseDownMessage; + import com.ankamagames.jerakine.handlers.messages.mouse.MouseUpMessage; + import com.ankamagames.jerakine.handlers.messages.mouse.MouseReleaseOutsideMessage; + import com.ankamagames.jerakine.handlers.messages.mouse.MouseWheelMessage; + import com.ankamagames.berilia.types.data.ExtendedStyleSheet; + import com.ankamagames.jerakine.data.XmlConfig; + + public class ScrollBar extends GraphicContainer implements FinalizableUIComponent + { + + public function ScrollBar() + { + super(); + MEMORY_LOG[this] = 1; + } + + public static var MEMORY_LOG:Dictionary = new Dictionary(true); + + protected static const _log:Logger = Log.getLogger(getQualifiedClassName(ScrollBar)); + + private const _common:String = XmlConfig.getInstance().getEntry("config.ui.skin"); + + private var _nWidth:uint = 16; + + private var _nHeight:uint = 200; + + private var _sCss:Uri; + + private var _uriTexBack:Uri; + + private var _uriTexMin:Uri; + + private var _uriTexMax:Uri; + + private var _uriTexBox:Uri; + + private var _nMin:int; + + private var _nMax:int; + + private var _nTotal:int = 1; + + private var _nStep:uint = 1; + + private var _nCurrentValue:int = 0; + + private var _bDisabled:Boolean = false; + + private var _texBack:Texture; + + private var _texBox:Texture; + + private var _texMin:Texture; + + private var _texMax:Texture; + + private var _gcMin:GraphicContainer; + + private var _gcMax:GraphicContainer; + + private var _gcBox:GraphicContainer; + + private var _nBoxSize:Number; + + private var _nBoxPosMin:Number; + + private var _nBoxPosMax:Number; + + private var _nCurrentPos:Number = 0; + + private var _nLastPos:Number = 0; + + private var _nScrollStep:Number; + + private var _nScrollSpeed:Number = 0.3333333333333333; + + private var _squareEdge:uint; + + private var _bVertical:Boolean; + + private var _bFinalized:Boolean = false; + + private var _nDecelerateScroll:uint = 1; + + private var _nAcelerateScroll:uint = 0; + + private var _nMaxDecelerateFactor:uint = 4; + + private var _bOnDrag:Boolean = false; + + override public function get width() : Number + { + return this._nWidth; + } + + override public function set width(param1:Number) : void + { + this._nWidth = param1; + if(this.finalized) + { this.scrollBarProcess(); - getUi().iAmFinalized(this); - } - - private function scrollBarProcess():void - { - var maxWL:int = Math.max(this._nWidth, this._nHeight); - this._squareEdge = Math.min(this._nWidth, this._nHeight); - this._nBoxSize = ((maxWL - (2 * this._squareEdge)) * ((this._nTotal - this._nMax) / this._nTotal)); - if (this._nBoxSize < 10) - { - this._nBoxSize = (((maxWL - (2 * this._squareEdge)) - ((this._nMax - this._nMin) + 1)) * this._nStep); - }; - if (this._nBoxSize < this._squareEdge) - { - this._nBoxSize = this._squareEdge; - }; - this._nBoxPosMin = (this._squareEdge - 6); - this._nBoxPosMax = int(((maxWL - this._squareEdge) - this._nBoxSize)); - this._nScrollStep = ((((maxWL - (2 * this._squareEdge)) + 6) - this._nBoxSize) / (this._nMax - this._nMin)); - this._nLastPos = this._nCurrentPos; - if (this._nCurrentValue > this._nMax) - { - this._nCurrentValue = this._nMax; - }; - if (this._nCurrentValue < this._nMin) - { - this._nCurrentValue = this._nMin; - }; - this._nCurrentPos = ((((this._nCurrentValue - this._nMin) / this._nStep) * this._nScrollStep) + this._nBoxPosMin); - if (this._nCurrentValue != 0) - { - this.updateDisplayFromCurrentPos(); - }; - if (!(this._texBack.finalized)) - { - this._texBack.autoGrid = true; - this._texBack.width = this._nWidth; - this._texBack.height = (this._nHeight - (this._squareEdge * 0.4)); - this._texBack.x = 0; - this._texBack.y = 0; - this._texBack.finalize(); - addChild(this._texBack); + } + } + + override public function get height() : Number + { + return this._nHeight; + } + + override public function set height(param1:Number) : void + { + this._nHeight = param1; + if(this.finalized) + { + this.scrollBarProcess(); + } + } + + public function get css() : Uri + { + return this._sCss; + } + + public function set css(param1:Uri) : void + { + if(param1 == null) + { + return; + } + if(param1 != this._sCss) + { + this._sCss = param1; + CssManager.getInstance().askCss(param1.uri,new Callback(this.fakeCssLoaded)); + } + } + + public function get min() : int + { + return this._nMin; + } + + public function set min(param1:int) : void + { + this._nMin = param1; + if(this.finalized) + { + this.scrollBarProcess(); + } + } + + public function get max() : int + { + return this._nMax; + } + + public function set max(param1:int) : void + { + this._nMax = param1; + if(this.finalized) + { + this.scrollBarProcess(); + } + } + + public function get total() : int + { + return this._nTotal; + } + + public function set total(param1:int) : void + { + this._nTotal = param1; + if(this.finalized) + { + this.scrollBarProcess(); + } + } + + public function get step() : uint + { + return this._nStep; + } + + public function set step(param1:uint) : void + { + this._nStep = param1; + if(this.finalized) + { + this.scrollBarProcess(); + } + } + + public function get value() : int + { + return Math.min(Math.round((this._nCurrentPos - this._nBoxPosMin) / this._nScrollStep) * this._nStep + this._nMin,this._nMax); + } + + public function set value(param1:int) : void + { + if(param1 > this._nMax) + { + var param1:int = this._nMax; + } + if(param1 < this._nMin) + { + param1 = this._nMin; + } + this._nCurrentValue = param1; + if(this.finalized) + { + this._nCurrentPos = (this._nCurrentValue - this._nMin) * this._nStep * this._nScrollStep + this._nBoxPosMin; + this.updateDisplayFromCurrentPos(); + } + } + + public function set scrollSpeed(param1:Number) : void + { + this._nScrollSpeed = param1; + } + + public function get scrollSpeed() : Number + { + return this._nScrollSpeed; + } + + public function get finalized() : Boolean + { + return this._bFinalized; + } + + public function set finalized(param1:Boolean) : void + { + this._bFinalized = param1; + } + + public function get boxSize() : Number + { + return this._nBoxSize; + } + + public function set vertical(param1:Boolean) : void + { + this._bVertical = param1; + if(this.finalized) + { + this.scrollBarProcess(); + } + } + + public function get vertical() : Boolean + { + return this._bVertical; + } + + override public function set disabled(param1:Boolean) : void + { + if(param1 == this._bDisabled) + { + return; + } + if(param1) + { + if((this._texBox) && (this._texMin) && (this._texMax)) + { + this._texBox.visible = false; + this._texMax.gotoAndStop = StatesEnum.STATE_DISABLED_STRING; + this._texMin.gotoAndStop = StatesEnum.STATE_DISABLED_STRING; + } + mouseEnabled = false; + mouseChildren = false; + } + else + { + if((this._texBox) && (this._texMin) && (this._texMax)) + { + this._texBox.visible = true; + this._texMax.gotoAndStop = StatesEnum.STATE_NORMAL_STRING; + this._texMin.gotoAndStop = StatesEnum.STATE_NORMAL_STRING; + } + mouseEnabled = true; + mouseChildren = true; + } + this._bDisabled = param1; + } + + public function finalize() : void + { + if(this._sCss) + { + if(this._nHeight > this._nWidth) + { + this._bVertical = true; } else { - this._texBack.width = this._nWidth; - this._texBack.height = (this._nHeight - (this._squareEdge * 0.4)); - }; - if (!(this._texMin.finalized)) - { - if (this._bVertical) - { - this._texMin.width = this._squareEdge; - } - else - { - this._texMin.height = this._squareEdge; - }; - this._texMin.dispatchMessages = true; - this._texMin.finalize(); - addChild(this._gcMin); + this._bVertical = false; + } + CssManager.getInstance().askCss(this._sCss.uri,new Callback(this.onCssLoaded)); + } + } + + private function scrollBarInit() : void + { + var _loc1_:Array = null; + var _loc2_:Array = null; + var _loc3_:Array = null; + if(!this._gcMin) + { + this._gcMin = new ButtonContainer(); + this._gcMax = new ButtonContainer(); + this._gcBox = new ButtonContainer(); + (this._gcMin as ButtonContainer).soundId = "-1"; + (this._gcMax as ButtonContainer).soundId = "-1"; + this._texMin.name = name + "_scrollBar_buttonMin"; + this._texMin.keepRatio = true; + getUi().registerId(this._texMin.name,new GraphicElement(this._texMin,new Array(),"buttonMin")); + this._texMax.name = name + "_scrollBar_buttonMax"; + this._texMax.keepRatio = true; + getUi().registerId(this._texMax.name,new GraphicElement(this._texMax,new Array(),"buttonMax")); + this._texBox.name = name + "_scrollBar_buttonBox"; + getUi().registerId(this._texBox.name,new GraphicElement(this._texBox,new Array(),"buttonBox")); + this._gcMin.addChild(this._texMin); + this._gcMax.addChild(this._texMax); + this._gcBox.addChild(this._texBox); + _loc1_ = new Array(); + _loc1_[StatesEnum.STATE_OVER] = new Array(); + _loc1_[StatesEnum.STATE_OVER][this._texBox.name] = new Array(); + _loc1_[StatesEnum.STATE_OVER][this._texBox.name]["gotoAndStop"] = StatesEnum.STATE_OVER_STRING.toLocaleLowerCase(); + _loc1_[StatesEnum.STATE_CLICKED] = new Array(); + _loc1_[StatesEnum.STATE_CLICKED][this._texBox.name] = new Array(); + _loc1_[StatesEnum.STATE_CLICKED][this._texBox.name]["gotoAndStop"] = StatesEnum.STATE_CLICKED_STRING.toLocaleLowerCase(); + _loc2_ = new Array(); + _loc2_[StatesEnum.STATE_OVER] = new Array(); + _loc2_[StatesEnum.STATE_OVER][this._texMin.name] = new Array(); + _loc2_[StatesEnum.STATE_OVER][this._texMin.name]["gotoAndStop"] = StatesEnum.STATE_OVER_STRING.toLocaleLowerCase(); + _loc2_[StatesEnum.STATE_CLICKED] = new Array(); + _loc2_[StatesEnum.STATE_CLICKED][this._texMin.name] = new Array(); + _loc2_[StatesEnum.STATE_CLICKED][this._texMin.name]["gotoAndStop"] = StatesEnum.STATE_CLICKED_STRING.toLocaleLowerCase(); + _loc3_ = new Array(); + _loc3_[StatesEnum.STATE_OVER] = new Array(); + _loc3_[StatesEnum.STATE_OVER][this._texMax.name] = new Array(); + _loc3_[StatesEnum.STATE_OVER][this._texMax.name]["gotoAndStop"] = StatesEnum.STATE_OVER_STRING.toLocaleLowerCase(); + _loc3_[StatesEnum.STATE_CLICKED] = new Array(); + _loc3_[StatesEnum.STATE_CLICKED][this._texMax.name] = new Array(); + _loc3_[StatesEnum.STATE_CLICKED][this._texMax.name]["gotoAndStop"] = StatesEnum.STATE_CLICKED_STRING.toLocaleLowerCase(); + ButtonContainer(this._gcBox).changingStateData = _loc1_; + ButtonContainer(this._gcMin).changingStateData = _loc2_; + ButtonContainer(this._gcMax).changingStateData = _loc3_; + } + this.finalized = true; + this.scrollBarProcess(); + getUi().iAmFinalized(this); + } + + private function scrollBarProcess() : void + { + var _loc1_:int = Math.max(this._nWidth,this._nHeight); + this._squareEdge = Math.min(this._nWidth,this._nHeight); + this._nBoxSize = (_loc1_ - 2 * this._squareEdge) * (this._nTotal - this._nMax) / this._nTotal; + if(this._nBoxSize < 10) + { + this._nBoxSize = (_loc1_ - 2 * this._squareEdge - (this._nMax - this._nMin + 1)) * this._nStep; + } + if(this._nBoxSize < this._squareEdge) + { + this._nBoxSize = this._squareEdge; + } + this._nBoxPosMin = this._squareEdge - 6; + this._nBoxPosMax = Math.ceil(_loc1_ - this._squareEdge - this._nBoxSize); + this._nScrollStep = (_loc1_ - 2 * this._squareEdge + 6 - this._nBoxSize) / (this._nMax - this._nMin); + this._nLastPos = this._nCurrentPos; + if(this._nCurrentValue > this._nMax) + { + this._nCurrentValue = this._nMax; + } + if(this._nCurrentValue < this._nMin) + { + this._nCurrentValue = this._nMin; + } + this._nCurrentPos = (this._nCurrentValue - this._nMin) / this._nStep * this._nScrollStep + this._nBoxPosMin; + if(this._nCurrentValue != 0) + { + this.updateDisplayFromCurrentPos(); + } + if(!this._texBack.finalized) + { + this._texBack.autoGrid = true; + this._texBack.width = this._nWidth; + this._texBack.height = this._nHeight - this._squareEdge * 0.4; + this._texBack.x = 0; + this._texBack.y = 0; + this._texBack.finalize(); + addChild(this._texBack); + } + else + { + this._texBack.width = this._nWidth; + this._texBack.height = this._nHeight - this._squareEdge * 0.4; + } + if(!this._texMin.finalized) + { + if(this._bVertical) + { + this._texMin.width = this._squareEdge; } else { - if (this._bVertical) - { - this._texMin.width = this._squareEdge; - } - else - { - this._texMin.height = this._squareEdge; - }; - }; - if (!(this._texMax.finalized)) - { - if (this._bVertical) - { - this._texMax.width = this._squareEdge; - } - else - { - this._texMax.height = this._squareEdge; - }; - this._texMax.dispatchMessages = true; - this._texMax.finalize(); - this._gcMax.x = ((this._bVertical) ? 0 : (this._nWidth - this._squareEdge)); - this._gcMax.y = ((this._bVertical) ? (this._nHeight - this._squareEdge) : 0); - addChild(this._gcMax); + this._texMin.height = this._squareEdge; + } + this._texMin.dispatchMessages = true; + this._texMin.finalize(); + addChild(this._gcMin); + } + else if(this._bVertical) + { + this._texMin.width = this._squareEdge; + } + else + { + this._texMin.height = this._squareEdge; + } + + if(!this._texMax.finalized) + { + if(this._bVertical) + { + this._texMax.width = this._squareEdge; } else { - if (this._bVertical) - { - this._texMax.width = this._squareEdge; - } - else - { - this._texMax.height = this._squareEdge; - }; - this._gcMax.x = ((this._bVertical) ? 0 : (this._nWidth - this._squareEdge)); - this._gcMax.y = ((this._bVertical) ? (this._nHeight - this._squareEdge) : 0); - }; - if (!(this._texBox.finalized)) - { - this._texBox.width = ((this._bVertical) ? this._squareEdge : this._nBoxSize); - this._texBox.height = ((this._bVertical) ? this._nBoxSize : this._squareEdge); - this._texBox.autoGrid = true; - this._texBox.finalize(); - this._gcBox.x = ((this._bVertical) ? 0 : this._nCurrentPos); - this._gcBox.y = ((this._bVertical) ? this._nCurrentPos : 0); - addChild(this._gcBox); + this._texMax.height = this._squareEdge; + } + this._texMax.dispatchMessages = true; + this._texMax.finalize(); + this._gcMax.x = this._bVertical?0:this._nWidth - this._squareEdge; + this._gcMax.y = this._bVertical?this._nHeight - this._squareEdge:0; + addChild(this._gcMax); + } + else + { + if(this._bVertical) + { + this._texMax.width = this._squareEdge; } else { - this._texBox.width = ((this._bVertical) ? this._squareEdge : this._nBoxSize); - this._texBox.height = ((this._bVertical) ? this._nBoxSize : this._squareEdge); - this._texBox.autoGrid = true; - this._gcBox.x = ((this._bVertical) ? 0 : this._nCurrentPos); - this._gcBox.y = ((this._bVertical) ? this._nCurrentPos : 0); - }; - if (this._nMax <= this._nMin) - { - this._texBox.visible = false; + this._texMax.height = this._squareEdge; + } + this._gcMax.x = this._bVertical?0:this._nWidth - this._squareEdge; + this._gcMax.y = this._bVertical?this._nHeight - this._squareEdge:0; + } + if(!this._texBox.finalized) + { + this._texBox.width = this._bVertical?this._squareEdge:this._nBoxSize; + this._texBox.height = this._bVertical?this._nBoxSize:this._squareEdge; + this._texBox.autoGrid = true; + this._texBox.finalize(); + this._gcBox.x = this._bVertical?0:this._nCurrentPos; + this._gcBox.y = this._bVertical?this._nCurrentPos:0; + addChild(this._gcBox); + } + else + { + this._texBox.width = this._bVertical?this._squareEdge:this._nBoxSize; + this._texBox.height = this._bVertical?this._nBoxSize:this._squareEdge; + this._texBox.autoGrid = true; + this._gcBox.x = this._bVertical?0:this._nCurrentPos; + this._gcBox.y = this._bVertical?this._nCurrentPos:0; + } + if(this._nMax <= this._nMin) + { + this._texBox.visible = false; + } + else + { + this._texBox.visible = true; + } + if(this._texMin.loading) + { + this._texMin.addEventListener(Event.COMPLETE,this.eventOnTextureReady); + } + else + { + this._texMin.gotoAndStop = this._bDisabled?StatesEnum.STATE_DISABLED_STRING:StatesEnum.STATE_NORMAL_STRING; + } + if(this._texMax.loading) + { + this._texMax.addEventListener(Event.COMPLETE,this.eventOnTextureReady); + } + else + { + this._texMax.gotoAndStop = this._bDisabled?StatesEnum.STATE_DISABLED_STRING:StatesEnum.STATE_NORMAL_STRING; + } + this._texBack.mouseEnabled = true; + } + + private function updateDisplayFromCurrentPos() : void + { + if((this._texMin) && (this._texMax)) + { + if(this._bVertical) + { + this._texMin.width = this._squareEdge; } else { - this._texBox.visible = true; - }; - if (this._texMin.loading) + this._texMin.height = this._squareEdge; + } + if(this._bVertical) { - this._texMin.addEventListener(Event.COMPLETE, this.eventOnTextureReady); + this._texMax.width = this._squareEdge; } else { - this._texMin.gotoAndStop = ((this._bDisabled) ? StatesEnum.STATE_DISABLED_STRING : StatesEnum.STATE_NORMAL_STRING); - }; - if (this._texMax.loading) + this._texMax.height = this._squareEdge; + } + } + if(this._gcBox) + { + if(this._bVertical) { - this._texMax.addEventListener(Event.COMPLETE, this.eventOnTextureReady); + this._gcBox.y = this._nCurrentPos; } else { - this._texMax.gotoAndStop = ((this._bDisabled) ? StatesEnum.STATE_DISABLED_STRING : StatesEnum.STATE_NORMAL_STRING); - }; - this._texBack.mouseEnabled = true; - } - - private function updateDisplayFromCurrentPos():void - { - if (((this._texMin) && (this._texMax))) - { - if (this._bVertical) - { - this._texMin.width = this._squareEdge; - } - else - { - this._texMin.height = this._squareEdge; - }; - if (this._bVertical) - { - this._texMax.width = this._squareEdge; - } - else - { - this._texMax.height = this._squareEdge; - }; - }; - if (this._gcBox) - { - if (this._bVertical) - { - this._gcBox.y = this._nCurrentPos; - } - else - { - this._gcBox.x = this._nCurrentPos; - }; - }; - } - - private function approximate(nValue:Number):Number - { - return ((nValue + this._nMin)); - } - - private function valueOfPos(nPos:Number):int - { - return (Math.min(((Math.ceil(((nPos - this._nBoxPosMin) / this._nScrollStep)) * this._nStep) + this._nMin), this._nBoxPosMax)); - } - - override public function remove():void - { - if (!(__removed)) - { - EnterFrameDispatcher.removeEventListener(this.onDragRunning); - EnterFrameDispatcher.removeEventListener(this.onBottomArrowDown); - EnterFrameDispatcher.removeEventListener(this.onTopArrowDown); - removeEventListener(MouseEvent.MOUSE_WHEEL, this.onWheel); - if (this._texMax) - { - this._texMax.removeEventListener(Event.COMPLETE, this.eventOnTextureReady); - }; - if (this._texMin) - { - this._texMin.addEventListener(Event.COMPLETE, this.eventOnTextureReady); - }; - this.clear(); - }; - super.remove(); - } - - private function clear():void - { - if (((!((this._gcBox == null))) && (contains(this._gcBox)))) - { - this._texBox.remove(); - getUi().removeFromRenderList(this._texBox.name); - this._gcBox.remove(); - }; - if (((!((this._gcMax == null))) && (contains(this._gcMax)))) - { - this._texMax.remove(); - getUi().removeFromRenderList(this._texMax.name); - this._gcMax.remove(); - }; - if (((!((this._gcMin == null))) && (contains(this._gcMin)))) - { - this._texMin.remove(); - getUi().removeFromRenderList(this._texMin.name); - this._gcMin.remove(); - }; - if (this._texBack != null) - { - this._texBack.remove(); - }; - } - - [HideInFakeClass] - override public function process(msg:Message):Boolean - { - var _local_4:Number; - var listener:IInterfaceListener; - var listener2:IInterfaceListener; - var curr:int = this.value; - var pr:PoolableRectangle = (PoolsManager.getInstance().getRectanglePool().checkOut() as PoolableRectangle); - switch (true) + this._gcBox.x = this._nCurrentPos; + } + } + } + + private function approximate(param1:Number) : Number + { + return param1 + this._nMin; + } + + private function valueOfPos(param1:Number) : int + { + return Math.min(Math.ceil((param1 - this._nBoxPosMin) / this._nScrollStep) * this._nStep + this._nMin,this._nBoxPosMax); + } + + override public function remove() : void + { + if(!__removed) + { + EnterFrameDispatcher.removeEventListener(this.onDragRunning); + EnterFrameDispatcher.removeEventListener(this.onBottomArrowDown); + EnterFrameDispatcher.removeEventListener(this.onTopArrowDown); + removeEventListener(MouseEvent.MOUSE_WHEEL,this.onWheel); + if(this._texMax) + { + this._texMax.removeEventListener(Event.COMPLETE,this.eventOnTextureReady); + } + if(this._texMin) { - case (msg is MouseDownMessage): - switch (MouseDownMessage(msg).target) - { - case this._gcMax: - for each (listener in Berilia.getInstance().UISoundListeners) - { - listener.playUISound("16015"); - }; - if ((this._nCurrentPos + this._nScrollStep) <= this._nBoxPosMax) - { - this._nCurrentPos = (this._nCurrentPos + this._nScrollStep); - } - else - { - this._nCurrentPos = this._nBoxPosMax; - }; - if (curr != this.valueOfPos(this._nCurrentPos)) - { - this.updateDisplayFromCurrentPos(); - dispatchEvent(new Event(Event.CHANGE)); - }; - this._nDecelerateScroll = 1; - this._nAcelerateScroll = 0; - EnterFrameDispatcher.addEventListener(this.onBottomArrowDown, "ScrollBarBottomArrow"); - break; - case this._gcMin: - for each (listener2 in Berilia.getInstance().UISoundListeners) - { - listener2.playUISound("16014"); - }; - if ((this._nCurrentPos - this._nScrollStep) >= this._nBoxPosMin) - { - this._nCurrentPos = (this._nCurrentPos - this._nScrollStep); - } - else - { - this._nCurrentPos = this._nBoxPosMin; - }; - this.updateDisplayFromCurrentPos(); - dispatchEvent(new Event(Event.CHANGE)); - this._nDecelerateScroll = 1; - this._nAcelerateScroll = 0; - EnterFrameDispatcher.addEventListener(this.onTopArrowDown, "ScrollBarTopArrow"); - break; - case this._texBack: - if (this._bVertical) - { - this._nCurrentPos = this.approximate(int(this._texBack.mouseY)); - } - else - { - this._nCurrentPos = this.approximate(int(this._texBack.mouseX)); - }; - _local_4 = (this._nCurrentPos - (this._nCurrentPos % this._nScrollStep)); - this._nCurrentPos = (_local_4 - (this._squareEdge / 2)); - if ((((this._nCurrentPos > this._nBoxPosMax)) || ((this._nCurrentPos > (this._nBoxPosMax - this._nScrollStep))))) - { - this._nCurrentPos = this._nBoxPosMax; - }; - if (this._nCurrentPos < this._nBoxPosMin) - { - this._nCurrentPos = this._nBoxPosMin; - }; - this.updateDisplayFromCurrentPos(); - dispatchEvent(new Event(Event.CHANGE)); - break; - case this._gcBox: - if (this._bVertical) - { - this._bOnDrag = true; - this._gcBox.startDrag(false, pr.renew(this._texBack.x, (this._texBack.y + this._nBoxPosMin), 0, Math.ceil((this._nBoxPosMax - this._nBoxPosMin)))); - } - else - { - this._bOnDrag = true; - this._gcBox.startDrag(false, pr.renew((this._texBack.x + this._nBoxPosMin), this._texBack.y, (this._nBoxPosMax - this._nBoxPosMin), 0)); - }; - EnterFrameDispatcher.addEventListener(this.onDragRunning, "ScrollBarDragRunning"); - break; - }; - PoolsManager.getInstance().getRectanglePool().checkIn(pr); - return (true); - case (msg is MouseUpMessage): - switch (MouseUpMessage(msg).target) - { - case this._gcMax: - EnterFrameDispatcher.removeEventListener(this.onBottomArrowDown); - break; - case this._gcMin: - EnterFrameDispatcher.removeEventListener(this.onTopArrowDown); - break; - case this._gcBox: - if (this._bOnDrag) - { - this._gcBox.stopDrag(); - this._bOnDrag = false; - EnterFrameDispatcher.removeEventListener(this.onDragRunning); - dispatchEvent(new Event(Event.CHANGE)); - }; - break; - }; - PoolsManager.getInstance().getRectanglePool().checkIn(pr); - return (true); - case (msg is MouseReleaseOutsideMessage): - if (this._bOnDrag) - { + this._texMin.addEventListener(Event.COMPLETE,this.eventOnTextureReady); + } + this.clear(); + } + super.remove(); + } + + private function clear() : void + { + if(!(this._gcBox == null) && (contains(this._gcBox))) + { + this._texBox.remove(); + getUi().removeFromRenderList(this._texBox.name); + this._gcBox.remove(); + } + if(!(this._gcMax == null) && (contains(this._gcMax))) + { + this._texMax.remove(); + getUi().removeFromRenderList(this._texMax.name); + this._gcMax.remove(); + } + if(!(this._gcMin == null) && (contains(this._gcMin))) + { + this._texMin.remove(); + getUi().removeFromRenderList(this._texMin.name); + this._gcMin.remove(); + } + if(this._texBack != null) + { + this._texBack.remove(); + } + } + + override public function process(param1:Message) : Boolean + { + var _loc4_:* = NaN; + var _loc5_:IInterfaceListener = null; + var _loc6_:IInterfaceListener = null; + var _loc2_:int = this.value; + var _loc3_:PoolableRectangle = PoolsManager.getInstance().getRectanglePool().checkOut() as PoolableRectangle; + switch(true) + { + case param1 is MouseDownMessage: + switch(MouseDownMessage(param1).target) + { + case this._gcMax: + for each(_loc5_ in Berilia.getInstance().UISoundListeners) + { + _loc5_.playUISound("16015"); + } + if(this._nCurrentPos + this._nScrollStep <= this._nBoxPosMax) + { + this._nCurrentPos = this._nCurrentPos + this._nScrollStep; + } + else + { + this._nCurrentPos = this._nBoxPosMax; + } + if(_loc2_ != this.valueOfPos(this._nCurrentPos)) + { + this.updateDisplayFromCurrentPos(); + dispatchEvent(new Event(Event.CHANGE)); + } + this._nDecelerateScroll = 1; + this._nAcelerateScroll = 0; + EnterFrameDispatcher.addEventListener(this.onBottomArrowDown,"ScrollBarBottomArrow"); + break; + case this._gcMin: + for each(_loc6_ in Berilia.getInstance().UISoundListeners) + { + _loc6_.playUISound("16014"); + } + if(this._nCurrentPos - this._nScrollStep >= this._nBoxPosMin) + { + this._nCurrentPos = this._nCurrentPos - this._nScrollStep; + } + else + { + this._nCurrentPos = this._nBoxPosMin; + } + this.updateDisplayFromCurrentPos(); + dispatchEvent(new Event(Event.CHANGE)); + this._nDecelerateScroll = 1; + this._nAcelerateScroll = 0; + EnterFrameDispatcher.addEventListener(this.onTopArrowDown,"ScrollBarTopArrow"); + break; + case this._texBack: + if(this._bVertical) + { + this._nCurrentPos = this.approximate(int(this._texBack.mouseY)); + } + else + { + this._nCurrentPos = this.approximate(int(this._texBack.mouseX)); + } + _loc4_ = this._nCurrentPos - this._nCurrentPos % this._nScrollStep; + this._nCurrentPos = _loc4_ - this._squareEdge / 2; + if(this._nCurrentPos > this._nBoxPosMax || this._nCurrentPos > this._nBoxPosMax - this._nScrollStep) + { + this._nCurrentPos = this._nBoxPosMax; + } + if(this._nCurrentPos < this._nBoxPosMin) + { + this._nCurrentPos = this._nBoxPosMin; + } + this.updateDisplayFromCurrentPos(); + dispatchEvent(new Event(Event.CHANGE)); + break; + case this._gcBox: + if(this._bVertical) + { + this._bOnDrag = true; + this._gcBox.startDrag(false,_loc3_.renew(this._texBack.x,this._texBack.y + this._nBoxPosMin,0,Math.ceil(this._nBoxPosMax - this._nBoxPosMin))); + } + else + { + this._bOnDrag = true; + this._gcBox.startDrag(false,_loc3_.renew(this._texBack.x + this._nBoxPosMin,this._texBack.y,this._nBoxPosMax - this._nBoxPosMin,0)); + } + EnterFrameDispatcher.addEventListener(this.onDragRunning,"ScrollBarDragRunning"); + break; + } + PoolsManager.getInstance().getRectanglePool().checkIn(_loc3_); + return true; + case param1 is MouseUpMessage: + switch(MouseUpMessage(param1).target) + { + case this._gcMax: + EnterFrameDispatcher.removeEventListener(this.onBottomArrowDown); + break; + case this._gcMin: + EnterFrameDispatcher.removeEventListener(this.onTopArrowDown); + break; + case this._gcBox: + if(this._bOnDrag) + { this._gcBox.stopDrag(); this._bOnDrag = false; - this._nCurrentPos = ((this._bVertical) ? this._gcBox.y : this._gcBox.x); - dispatchEvent(new Event(Event.CHANGE)); EnterFrameDispatcher.removeEventListener(this.onDragRunning); - }; - EnterFrameDispatcher.removeEventListener(this.onBottomArrowDown); - EnterFrameDispatcher.removeEventListener(this.onTopArrowDown); - PoolsManager.getInstance().getRectanglePool().checkIn(pr); - return (true); - case (msg is MouseWheelMessage): - addEventListener(MouseEvent.MOUSE_WHEEL, this.onWheel); - return (true); - }; - PoolsManager.getInstance().getRectanglePool().checkIn(pr); - return (false); - } - - private function onDragRunning(e:Event):void - { - var newCoord:int; - var max:int; - var curr:int = this.value; - if (this._bVertical) - { - newCoord = int(this._gcBox.y); - if (curr != this.valueOfPos(newCoord)) - { - this._nCurrentPos = newCoord; - max = (this._nHeight - this._nBoxSize); - if (this._nCurrentPos > max) - { - this._nCurrentPos = max; - }; - dispatchEvent(new Event(Event.CHANGE)); - }; + dispatchEvent(new Event(Event.CHANGE)); + } + break; + } + PoolsManager.getInstance().getRectanglePool().checkIn(_loc3_); + return true; + case param1 is MouseReleaseOutsideMessage: + if(this._bOnDrag) + { + this._gcBox.stopDrag(); + this._bOnDrag = false; + this._nCurrentPos = this._bVertical?this._gcBox.y:this._gcBox.x; + dispatchEvent(new Event(Event.CHANGE)); + EnterFrameDispatcher.removeEventListener(this.onDragRunning); + } + EnterFrameDispatcher.removeEventListener(this.onBottomArrowDown); + EnterFrameDispatcher.removeEventListener(this.onTopArrowDown); + PoolsManager.getInstance().getRectanglePool().checkIn(_loc3_); + return true; + case param1 is MouseWheelMessage: + addEventListener(MouseEvent.MOUSE_WHEEL,this.onWheel); + return true; + default: + PoolsManager.getInstance().getRectanglePool().checkIn(_loc3_); + return false; + } + } + + private function onDragRunning(param1:Event) : void + { + var _loc2_:* = 0; + var _loc4_:* = 0; + var _loc3_:int = this.value; + if(this._bVertical) + { + _loc2_ = int(this._gcBox.y); + if(_loc3_ != this.valueOfPos(_loc2_)) + { + this._nCurrentPos = _loc2_; + _loc4_ = this._nHeight - this._nBoxSize; + if(this._nCurrentPos > _loc4_) + { + this._nCurrentPos = _loc4_; + } + dispatchEvent(new Event(Event.CHANGE)); + } + } + else + { + _loc2_ = this.approximate(int(this._gcBox.x)); + if(_loc3_ != this.valueOfPos(_loc2_)) + { + this._nCurrentPos = _loc2_; + _loc4_ = this._nWidth - this._nBoxSize; + if(this._nCurrentPos > _loc4_) + { + this._nCurrentPos = _loc4_; + } + dispatchEvent(new Event(Event.CHANGE)); + } + } + } + + private function onTopArrowDown(param1:Event) : void + { + var _loc2_:Number = Berilia.getInstance().docMain.stage.frameRate; + var _loc3_:int = this.value; + if(this._nDecelerateScroll >= this._nMaxDecelerateFactor) + { + if(this._nCurrentPos - this._nScrollStep >= this._nBoxPosMin) + { + this._nCurrentPos = this._nCurrentPos - this._nScrollStep; } else { - newCoord = this.approximate(int(this._gcBox.x)); - if (curr != this.valueOfPos(newCoord)) - { - this._nCurrentPos = newCoord; - max = (this._nWidth - this._nBoxSize); - if (this._nCurrentPos > max) - { - this._nCurrentPos = max; - }; - dispatchEvent(new Event(Event.CHANGE)); - }; - }; - } - - private function onTopArrowDown(e:Event):void - { - var framePerSecond:Number = Berilia.getInstance().docMain.stage.frameRate; - var currValue:int = this.value; - if (this._nDecelerateScroll >= this._nMaxDecelerateFactor) - { - if ((this._nCurrentPos - this._nScrollStep) >= this._nBoxPosMin) - { - this._nCurrentPos = (this._nCurrentPos - this._nScrollStep); - } - else - { - this._nCurrentPos = this._nBoxPosMin; - }; - this._nDecelerateScroll = (((this._nAcelerateScroll < this._nMaxDecelerateFactor)) ? this._nAcelerateScroll++ : (this._nMaxDecelerateFactor - 1)); - if (currValue != this.valueOfPos(this._nCurrentPos)) - { - this.updateDisplayFromCurrentPos(); - dispatchEvent(new Event(Event.CHANGE)); - }; - }; - this._nDecelerateScroll++; - } - - private function onBottomArrowDown(e:Event):void - { - var framePerSecond:Number = Berilia.getInstance().docMain.stage.frameRate; - var currValue:int = this.value; - var oldPos:Number = this._nCurrentPos; - if (this._nDecelerateScroll >= this._nMaxDecelerateFactor) - { - if ((this._nCurrentPos + this._nScrollStep) <= this._nBoxPosMax) - { - this._nCurrentPos = (this._nCurrentPos + this._nScrollStep); - } - else - { - this._nCurrentPos = this._nBoxPosMax; - }; - this._nDecelerateScroll = (((this._nAcelerateScroll < this._nMaxDecelerateFactor)) ? this._nAcelerateScroll++ : (this._nMaxDecelerateFactor - 1)); - if (oldPos != this._nCurrentPos) - { - this.updateDisplayFromCurrentPos(); - dispatchEvent(new Event(Event.CHANGE)); - }; - }; - this._nDecelerateScroll++; - } - - public function onWheel(e:Object, dispatchEvt:Boolean=true):void - { - this._nCurrentPos = (this._nCurrentPos - (this._nScrollStep * (e.delta * this._nScrollSpeed))); - if (this._nCurrentPos > this._nBoxPosMax) - { - this._nCurrentPos = Math.floor(this._nBoxPosMax); - }; - if (this._nCurrentPos < this._nBoxPosMin) - { - this._nCurrentPos = this._nBoxPosMin; - }; - this.updateDisplayFromCurrentPos(); - if (dispatchEvt) - { - dispatchEvent(new Event(Event.CHANGE)); - }; - } - - private function fakeCssLoaded():void - { - } - - private function onCssLoaded():void - { - var _ssSheet:ExtendedStyleSheet; - var styleObj:Object; - if (!(this._gcMin)) - { - _ssSheet = CssManager.getInstance().getCss(this._sCss.uri); - styleObj = _ssSheet.getStyle(".skin"); - this._uriTexBack = new Uri((this._common + styleObj["textureBack"])); - this._uriTexBox = new Uri((this._common + styleObj["textureBox"])); - this._uriTexMax = new Uri((this._common + styleObj["textureMax"])); - this._uriTexMin = new Uri((this._common + styleObj["textureMin"])); - this._texBack = new Texture(); - this._texBack.uri = this._uriTexBack; - this._texBox = new Texture(); - this._texBox.uri = this._uriTexBox; - this._texMin = new Texture(); - this._texMin.uri = this._uriTexMin; - this._texMax = new Texture(); - this._texMax.uri = this._uriTexMax; - }; - this.scrollBarInit(); - } - - public function eventOnTextureReady(e:Event):void - { - if (e.target == this._texMin) + this._nCurrentPos = this._nBoxPosMin; + } + this._nDecelerateScroll = this._nAcelerateScroll < this._nMaxDecelerateFactor?this._nAcelerateScroll++:this._nMaxDecelerateFactor - 1; + if(_loc3_ != this.valueOfPos(this._nCurrentPos)) { - this._texMin.gotoAndStop = ((this._bDisabled) ? StatesEnum.STATE_DISABLED_STRING.toLowerCase() : StatesEnum.STATE_NORMAL_STRING.toLowerCase()); + this.updateDisplayFromCurrentPos(); + dispatchEvent(new Event(Event.CHANGE)); + } + } + this._nDecelerateScroll++; + } + + private function onBottomArrowDown(param1:Event) : void + { + var _loc2_:Number = Berilia.getInstance().docMain.stage.frameRate; + var _loc3_:int = this.value; + var _loc4_:Number = this._nCurrentPos; + if(this._nDecelerateScroll >= this._nMaxDecelerateFactor) + { + if(this._nCurrentPos + this._nScrollStep <= this._nBoxPosMax) + { + this._nCurrentPos = this._nCurrentPos + this._nScrollStep; } else { - if (e.target == this._texMax) - { - this._texMax.gotoAndStop = ((this._bDisabled) ? StatesEnum.STATE_DISABLED_STRING.toLowerCase() : StatesEnum.STATE_NORMAL_STRING.toLowerCase()); - }; - }; - } - - - } -}//package com.ankamagames.berilia.components - + this._nCurrentPos = this._nBoxPosMax; + } + this._nDecelerateScroll = this._nAcelerateScroll < this._nMaxDecelerateFactor?this._nAcelerateScroll++:this._nMaxDecelerateFactor - 1; + if(_loc4_ != this._nCurrentPos) + { + this.updateDisplayFromCurrentPos(); + dispatchEvent(new Event(Event.CHANGE)); + } + } + this._nDecelerateScroll++; + } + + public function onWheel(param1:Object, param2:Boolean = true) : void + { + this._nCurrentPos = this._nCurrentPos - this._nScrollStep * param1.delta * this._nScrollSpeed; + if(this._nCurrentPos > this._nBoxPosMax) + { + this._nCurrentPos = Math.floor(this._nBoxPosMax); + } + if(this._nCurrentPos < this._nBoxPosMin) + { + this._nCurrentPos = this._nBoxPosMin; + } + this.updateDisplayFromCurrentPos(); + if(param2) + { + dispatchEvent(new Event(Event.CHANGE)); + } + } + + private function fakeCssLoaded() : void + { + } + + private function onCssLoaded() : void + { + var _loc1_:ExtendedStyleSheet = null; + var _loc2_:Object = null; + if(!this._gcMin) + { + _loc1_ = CssManager.getInstance().getCss(this._sCss.uri); + _loc2_ = _loc1_.getStyle(".skin"); + this._uriTexBack = new Uri(this._common + _loc2_["textureBack"]); + this._uriTexBox = new Uri(this._common + _loc2_["textureBox"]); + this._uriTexMax = new Uri(this._common + _loc2_["textureMax"]); + this._uriTexMin = new Uri(this._common + _loc2_["textureMin"]); + this._texBack = new Texture(); + this._texBack.uri = this._uriTexBack; + this._texBox = new Texture(); + this._texBox.uri = this._uriTexBox; + this._texMin = new Texture(); + this._texMin.uri = this._uriTexMin; + this._texMax = new Texture(); + this._texMax.uri = this._uriTexMax; + } + this.scrollBarInit(); + } + + public function eventOnTextureReady(param1:Event) : void + { + if(param1.target == this._texMin) + { + this._texMin.gotoAndStop = this._bDisabled?StatesEnum.STATE_DISABLED_STRING.toLowerCase():StatesEnum.STATE_NORMAL_STRING.toLowerCase(); + } + else if(param1.target == this._texMax) + { + this._texMax.gotoAndStop = this._bDisabled?StatesEnum.STATE_DISABLED_STRING.toLowerCase():StatesEnum.STATE_NORMAL_STRING.toLowerCase(); + } + + } + } +} diff --git a/com/ankamagames/berilia/components/Slot.as b/com/ankamagames/berilia/components/Slot.as index cde6564a7..8d55eaa37 100644 --- a/com/ankamagames/berilia/components/Slot.as +++ b/com/ankamagames/berilia/components/Slot.as @@ -1,1087 +1,1094 @@ -package com.ankamagames.berilia.components +package com.ankamagames.berilia.components { - import com.ankamagames.berilia.types.graphic.ButtonContainer; - import com.ankamagames.jerakine.interfaces.ISlotDataHolder; - import com.ankamagames.berilia.FinalizableUIComponent; - import com.ankamagames.jerakine.interfaces.IDragAndDropHandler; - import com.ankamagames.jerakine.logger.Logger; - import com.ankamagames.jerakine.logger.Log; - import flash.utils.getQualifiedClassName; - import flash.utils.Dictionary; - import flash.text.TextFormat; - import com.ankamagames.jerakine.interfaces.ISlotData; - import flash.geom.Point; - import com.ankamagames.jerakine.types.Uri; - import flash.display.Sprite; - import flash.text.TextField; - import com.ankamagames.berilia.managers.SecureCenter; - import flash.events.Event; - import com.ankamagames.jerakine.utils.display.StageShareManager; - import flash.events.MouseEvent; - import com.ankamagames.berilia.utils.EmbedIcons; - import com.ankamagames.berilia.types.event.TextureLoadFailedEvent; - import com.ankamagames.berilia.enums.StatesEnum; - import flash.text.TextFieldAutoSize; - import flash.utils.getTimer; - import com.ankamagames.jerakine.utils.display.EnterFrameDispatcher; - import com.ankamagames.berilia.types.data.LinkedCursorData; - import com.ankamagames.jerakine.interfaces.IInterfaceListener; - import com.ankamagames.berilia.types.data.SlotDragAndDropData; - import com.ankamagames.jerakine.handlers.messages.mouse.MouseDownMessage; - import com.ankamagames.berilia.Berilia; - import com.ankamagames.jerakine.handlers.messages.mouse.MouseDoubleClickMessage; - import com.ankamagames.jerakine.handlers.messages.mouse.MouseClickMessage; - import com.ankamagames.berilia.frames.ShortcutsFrame; - import com.ankamagames.berilia.managers.KernelEventsManager; - import com.ankamagames.berilia.utils.BeriliaHookList; - import com.ankamagames.berilia.managers.LinkedCursorSpriteManager; - import com.ankamagames.jerakine.handlers.messages.mouse.MouseOverMessage; - import com.ankamagames.jerakine.handlers.messages.mouse.MouseOutMessage; - import com.ankamagames.jerakine.handlers.messages.mouse.MouseReleaseOutsideMessage; - import flash.display.MovieClip; - import flash.display.Stage; - import com.ankamagames.berilia.components.messages.DropMessage; - import com.ankamagames.jerakine.handlers.messages.mouse.MouseUpMessage; - import com.ankamagames.jerakine.handlers.messages.mouse.MouseRightClickOutsideMessage; - import com.ankamagames.jerakine.messages.Message; - import gs.events.TweenEvent; - import flash.display.BitmapData; - import flash.filters.ColorMatrixFilter; - import com.ankamagames.berilia.types.graphic.GraphicElement; - - public class Slot extends ButtonContainer implements ISlotDataHolder, FinalizableUIComponent, IDragAndDropHandler - { - - protected static const _log:Logger = Log.getLogger(getQualifiedClassName(Slot)); - public static var MEMORY_LOG:Dictionary = new Dictionary(true); - public static const DRAG_AND_DROP_CURSOR_NAME:String = "DragAndDrop"; - public static const NEED_CACHE_AS_BITMAP:String = "needCacheAsBitmap"; - private static var _unicID:uint = 0; - - private const _quantityTextFormat:TextFormat = new TextFormat("Tahoma", 15, 0xFFFFFF); - - private var _data:ISlotData; - private var _dropValidator:Function; - private var _unboxedDropValidator:Function; - private var _topLabel:Label; - private var _middleLabel:Label; - private var _bottomLabel:Label; - private var _backgroundIcon:Texture; - private var _icon:Texture; - private var _effect:Texture; - private var _tx_timerForeground:Texture; - private var _allowDrag:Boolean = true; - private var _dragStartPoint:Point; - private var _displayBackgroundIcon:Boolean = true; - private var _dragging:Boolean = false; - private var _selected:Boolean; - private var _isButton:Boolean = false; - private var _isTimerRunning:Boolean = false; - private var _timerMaxDuration:int; - private var _timerStartTime:int; - private var _css:Uri; - private var _cssClass:String = "quantity"; - private var _removeDropSource:Function; - private var _unboxedRemoveDropSource:Function; - private var _processDrop:Function; - private var _unboxedProcessDrop:Function; - private var _hideTopLabel:Boolean = false; - public var _emptyTexture:Uri; - public var _customTexture:Uri; - public var _forcedBackGroundIconUri:Uri; - private var _widthHeightMax:uint = 52; - private var _targetUri:Uri; - public var highlightTexture:Uri; - public var selectedTexture:Uri; - public var timerTexture:Uri; - public var acceptDragTexture:Uri; - public var refuseDragTexture:Uri; - private var _quantitySprite:Sprite; - private var _quantityText:TextField; - - public function Slot() - { - MEMORY_LOG[this] = 1; - } - - public function set data(o:*):void - { - var nd:* = SecureCenter.unsecure(o); - if ((!(nd) is ISlotData)) - { - throw (new TypeError("data must implement ISlotData interface.")); - }; - this._data = (nd as ISlotData); - if (this.data) + import com.ankamagames.berilia.types.graphic.ButtonContainer; + import com.ankamagames.jerakine.interfaces.ISlotDataHolder; + import com.ankamagames.berilia.FinalizableUIComponent; + import com.ankamagames.jerakine.interfaces.IDragAndDropHandler; + import com.ankamagames.jerakine.logger.Logger; + import flash.utils.Dictionary; + import com.ankamagames.jerakine.logger.Log; + import flash.utils.getQualifiedClassName; + import com.ankamagames.jerakine.interfaces.ISlotData; + import flash.geom.Point; + import com.ankamagames.jerakine.types.Uri; + import com.ankamagames.berilia.managers.SecureCenter; + import flash.events.Event; + import com.ankamagames.jerakine.utils.display.StageShareManager; + import flash.events.MouseEvent; + import com.ankamagames.berilia.utils.EmbedIcons; + import com.ankamagames.berilia.types.event.TextureLoadFailedEvent; + import com.ankamagames.berilia.enums.StatesEnum; + import flash.display.Sprite; + import flash.text.TextField; + import flash.text.TextFormat; + import flash.text.TextFieldAutoSize; + import flash.utils.getTimer; + import com.ankamagames.jerakine.utils.display.EnterFrameDispatcher; + import com.ankamagames.jerakine.messages.Message; + import com.ankamagames.berilia.types.data.LinkedCursorData; + import com.ankamagames.jerakine.interfaces.IInterfaceListener; + import com.ankamagames.berilia.types.data.SlotDragAndDropData; + import com.ankamagames.berilia.Berilia; + import com.ankamagames.jerakine.handlers.messages.mouse.MouseDownMessage; + import com.ankamagames.jerakine.handlers.messages.mouse.MouseDoubleClickMessage; + import com.ankamagames.jerakine.handlers.messages.mouse.MouseClickMessage; + import com.ankamagames.berilia.frames.ShortcutsFrame; + import com.ankamagames.berilia.managers.KernelEventsManager; + import com.ankamagames.berilia.utils.BeriliaHookList; + import com.ankamagames.berilia.managers.LinkedCursorSpriteManager; + import com.ankamagames.jerakine.handlers.messages.mouse.MouseReleaseOutsideMessage; + import flash.display.MovieClip; + import flash.display.Stage; + import com.ankamagames.berilia.components.messages.DropMessage; + import com.ankamagames.jerakine.handlers.messages.mouse.MouseOverMessage; + import com.ankamagames.jerakine.handlers.messages.mouse.MouseOutMessage; + import com.ankamagames.jerakine.handlers.messages.mouse.MouseUpMessage; + import com.ankamagames.jerakine.handlers.messages.mouse.MouseRightClickOutsideMessage; + import gs.events.TweenEvent; + import flash.display.BitmapData; + import flash.filters.ColorMatrixFilter; + import com.ankamagames.berilia.types.graphic.GraphicElement; + + public class Slot extends ButtonContainer implements ISlotDataHolder, FinalizableUIComponent, IDragAndDropHandler + { + + public function Slot() + { + super(); + MEMORY_LOG[this] = 1; + } + + protected static const _log:Logger = Log.getLogger(getQualifiedClassName(Slot)); + + public static var MEMORY_LOG:Dictionary = new Dictionary(true); + + public static const DRAG_AND_DROP_CURSOR_NAME:String = "DragAndDrop"; + + public static const NEED_CACHE_AS_BITMAP:String = "needCacheAsBitmap"; + + private static var _unicID:uint = 0; + + private var _data:ISlotData; + + private var _dropValidator:Function; + + private var _unboxedDropValidator:Function; + + private var _topLabel:Label; + + private var _middleLabel:Label; + + private var _bottomLabel:Label; + + private var _backgroundIcon:Texture; + + private var _icon:Texture; + + private var _effect:Texture; + + private var _tx_timerForeground:Texture; + + private var _allowDrag:Boolean = true; + + private var _dragStartPoint:Point; + + private var _displayBackgroundIcon:Boolean = true; + + private var _dragging:Boolean = false; + + private var _selected:Boolean; + + private var _isButton:Boolean = false; + + private var _isTimerRunning:Boolean = false; + + private var _timerMaxDuration:int; + + private var _timerStartTime:int; + + private var _css:Uri; + + private var _cssClass:String = "quantity"; + + private var _removeDropSource:Function; + + private var _unboxedRemoveDropSource:Function; + + private var _processDrop:Function; + + private var _unboxedProcessDrop:Function; + + private var _hideTopLabel:Boolean = false; + + public var _emptyTexture:Uri; + + public var _customTexture:Uri; + + public var _forcedBackGroundIconUri:Uri; + + private var _widthHeightMax:uint = 52; + + private var _targetUri:Uri; + + public var highlightTexture:Uri; + + public var selectedTexture:Uri; + + public var timerTexture:Uri; + + public var acceptDragTexture:Uri; + + public var refuseDragTexture:Uri; + + public function set data(param1:*) : void + { + var _loc2_:* = SecureCenter.unsecure(param1); + if(!_loc2_ is ISlotData) + { + throw new TypeError("data must implement ISlotData interface."); + } + else + { + this._data = _loc2_ as ISlotData; + if(this.data) { - this._data.addHolder(this); - }; - if (this._isButton) + this._data.addHolder(this); + } + if(this._isButton) { - addEventListener(Event.ADDED_TO_STAGE, this.onAddedToStage); - }; + addEventListener(Event.ADDED_TO_STAGE,this.onAddedToStage); + } this.refresh(); - } - - public function get data() - { - return (SecureCenter.unsecure(this._data)); - } - - override public function get finalized():Boolean - { - return (_finalized); - } - - override public function set finalized(b:Boolean):void - { - _finalized = b; - } - - override public function set selected(b:Boolean):void - { - this._selected = b; - if (!(this._isButton)) + return; + } + } + + public function get data() : * + { + return SecureCenter.unsecure(this._data); + } + + override public function get finalized() : Boolean + { + return _finalized; + } + + override public function set finalized(param1:Boolean) : void + { + _finalized = param1; + } + + override public function set selected(param1:Boolean) : void + { + this._selected = param1; + if(!this._isButton) + { + if(this._effect) { - if (this._effect) - { - if (b) - { - this._effect.uri = this.selectedTexture; - } - else - { - if (this._customTexture) - { - this._effect.uri = this._customTexture; - } - else - { - this._effect.uri = null; - }; - }; - }; + if(param1) + { + this._effect.uri = this.selectedTexture; + } + else if(this._customTexture) + { + this._effect.uri = this._customTexture; + } + else + { + this._effect.uri = null; + } + } - else - { - super.selected = b; - }; - } - - public function get allowDrag():Boolean - { - return (this._allowDrag); - } - - public function set allowDrag(bool:Boolean):void - { - if (this._allowDrag != bool) - { - if (((!(bool)) && (StageShareManager.stage.hasEventListener(MouseEvent.MOUSE_MOVE)))) - { - StageShareManager.stage.removeEventListener(MouseEvent.MOUSE_MOVE, this.onDragAndDropStart); - }; - this._allowDrag = bool; - }; - } - - public function set css(uri:Uri):void - { - this._css = uri; - if (this._topLabel) - { - this._topLabel.css = this._css; - }; - if (this._middleLabel) - { - this._middleLabel.css = this._css; - }; - if (this._bottomLabel) - { - this._bottomLabel.css = this._css; - }; - } - - public function set cssClass(cssclass:String):void - { - this._cssClass = cssclass; - if (this._topLabel) - { - this._topLabel.cssClass = this._cssClass; - }; - if (this._middleLabel) - { - this._middleLabel.cssClass = this._cssClass; - }; - if (this._bottomLabel) - { - this._bottomLabel.cssClass = this._cssClass; - }; - } - - [NoReplaceInFakeClass] - override public function set dropValidator(dv:Function):void - { - this._dropValidator = dv; - this._unboxedDropValidator = null; - } - - [NoReplaceInFakeClass] - override public function get dropValidator():Function - { - if (this._dropValidator == null) - { - return (super.dropValidator); - }; - if (this._unboxedDropValidator == null) - { - this._unboxedDropValidator = SecureCenter.unsecure(this._dropValidator); - }; - return (this._unboxedDropValidator); - } - - [NoReplaceInFakeClass] - override public function set removeDropSource(rds:Function):void - { - this._removeDropSource = rds; - this._unboxedRemoveDropSource = null; - } - - [NoReplaceInFakeClass] - override public function get removeDropSource():Function - { - if (this._removeDropSource == null) - { - return (super.removeDropSource); - }; - if (this._unboxedRemoveDropSource == null) - { - this._unboxedRemoveDropSource = SecureCenter.unsecure(this._removeDropSource); - }; - return (this._unboxedRemoveDropSource); - } - - [NoReplaceInFakeClass] - override public function set processDrop(pd:Function):void - { - this._processDrop = pd; - this._unboxedProcessDrop = null; - } - - [NoReplaceInFakeClass] - override public function get processDrop():Function - { - if (this._processDrop == null) - { - return (super.processDrop); - }; - if (this._unboxedProcessDrop == null) - { - this._unboxedProcessDrop = SecureCenter.unsecure(this._processDrop); - }; - return (this._unboxedProcessDrop); - } - - public function get emptyTexture():Uri - { - return (this._emptyTexture); - } - - public function set emptyTexture(uri:Uri):void - { - this._emptyTexture = uri; - if (this._icon != null) - { - this._icon.uri = this._emptyTexture; - }; - } - - public function get customTexture():Uri - { - return (this._customTexture); - } - - public function set customTexture(uri:Uri):void - { - this._customTexture = uri; - if (this._effect) + } + else + { + super.selected = param1; + } + } + + public function get allowDrag() : Boolean + { + return this._allowDrag; + } + + public function set allowDrag(param1:Boolean) : void + { + if(this._allowDrag != param1) + { + if(!param1 && (StageShareManager.stage.hasEventListener(MouseEvent.MOUSE_MOVE))) { - this._effect.uri = this._customTexture; - }; - } - - public function get forcedBackGroundIconUri():Uri - { - return (this._forcedBackGroundIconUri); - } - - public function set forcedBackGroundIconUri(uri:Uri):void - { - this._forcedBackGroundIconUri = uri; - if (this._backgroundIcon) - { - this._backgroundIcon.uri = this._forcedBackGroundIconUri; - }; - } - - public function get hideTopLabel():Boolean - { - return (this._hideTopLabel); - } - - public function set hideTopLabel(b:Boolean):void - { - this._hideTopLabel = b; - if (this._topLabel != null) - { - this._topLabel.visible = !(b); - }; - } - - public function get displayBackgroundIcon():Boolean - { - return (this._displayBackgroundIcon); - } - - public function set displayBackgroundIcon(visible:Boolean):void - { - this._displayBackgroundIcon = visible; - if (this._backgroundIcon) - { - this._backgroundIcon.visible = visible; - }; - } - - public function set isButton(b:Boolean):void - { - this._isButton = b; - if (!(b)) - { - buttonMode = false; - useHandCursor = false; + StageShareManager.stage.removeEventListener(MouseEvent.MOUSE_MOVE,this.onDragAndDropStart); } - else + this._allowDrag = param1; + } + } + + public function set css(param1:Uri) : void + { + this._css = param1; + if(this._topLabel) + { + this._topLabel.css = this._css; + } + if(this._middleLabel) + { + this._middleLabel.css = this._css; + } + if(this._bottomLabel) + { + this._bottomLabel.css = this._css; + } + } + + public function set cssClass(param1:String) : void + { + this._cssClass = param1; + if(this._topLabel) + { + this._topLabel.cssClass = this._cssClass; + } + if(this._middleLabel) + { + this._middleLabel.cssClass = this._cssClass; + } + if(this._bottomLabel) + { + this._bottomLabel.cssClass = this._cssClass; + } + } + + override public function set dropValidator(param1:Function) : void + { + this._dropValidator = param1; + this._unboxedDropValidator = null; + } + + override public function get dropValidator() : Function + { + if(this._dropValidator == null) + { + return super.dropValidator; + } + if(this._unboxedDropValidator == null) + { + this._unboxedDropValidator = SecureCenter.unsecure(this._dropValidator); + } + return this._unboxedDropValidator; + } + + override public function set removeDropSource(param1:Function) : void + { + this._removeDropSource = param1; + this._unboxedRemoveDropSource = null; + } + + override public function get removeDropSource() : Function + { + if(this._removeDropSource == null) + { + return super.removeDropSource; + } + if(this._unboxedRemoveDropSource == null) + { + this._unboxedRemoveDropSource = SecureCenter.unsecure(this._removeDropSource); + } + return this._unboxedRemoveDropSource; + } + + override public function set processDrop(param1:Function) : void + { + this._processDrop = param1; + this._unboxedProcessDrop = null; + } + + override public function get processDrop() : Function + { + if(this._processDrop == null) + { + return super.processDrop; + } + if(this._unboxedProcessDrop == null) + { + this._unboxedProcessDrop = SecureCenter.unsecure(this._processDrop); + } + return this._unboxedProcessDrop; + } + + public function get emptyTexture() : Uri + { + return this._emptyTexture; + } + + public function set emptyTexture(param1:Uri) : void + { + this._emptyTexture = param1; + if(this._icon != null) + { + this._icon.uri = this._emptyTexture; + } + } + + public function get customTexture() : Uri + { + return this._customTexture; + } + + public function set customTexture(param1:Uri) : void + { + this._customTexture = param1; + if(this._effect) + { + this._effect.uri = this._customTexture; + } + } + + public function get forcedBackGroundIconUri() : Uri + { + return this._forcedBackGroundIconUri; + } + + public function set forcedBackGroundIconUri(param1:Uri) : void + { + this._forcedBackGroundIconUri = param1; + if(this._backgroundIcon) + { + this._backgroundIcon.uri = this._forcedBackGroundIconUri; + } + } + + public function get hideTopLabel() : Boolean + { + return this._hideTopLabel; + } + + public function set hideTopLabel(param1:Boolean) : void + { + this._hideTopLabel = param1; + if(this._topLabel != null) + { + this._topLabel.visible = !param1; + } + } + + public function get displayBackgroundIcon() : Boolean + { + return this._displayBackgroundIcon; + } + + public function set displayBackgroundIcon(param1:Boolean) : void + { + this._displayBackgroundIcon = param1; + if(this._backgroundIcon) + { + this._backgroundIcon.visible = param1; + } + } + + public function set isButton(param1:Boolean) : void + { + this._isButton = param1; + if(!param1) + { + buttonMode = false; + useHandCursor = false; + } + else + { + buttonMode = true; + useHandCursor = true; + } + } + + public function refresh() : void + { + this.finalize(); + if((this._data) && (this._data.info1) && !this._hideTopLabel) + { + this.updateQuantity(int(this._data.info1)); + } + else + { + this.updateQuantity(0); + } + if(this._isTimerRunning) + { + if(!this._data || this._data.timer == 0) { - buttonMode = true; - useHandCursor = true; - }; - } - - public function refresh():void - { - this.finalize(); - if (((((this._data) && (this._data.info1))) && (!(this._hideTopLabel)))) - { - this.updateQuantity(int(this._data.info1)); + this.updateTimer(0); } - else + } + else if((this._data) && (this._data.timer)) + { + this.updateTimer(this._data.timer); + } + + if(width <= this._widthHeightMax && height <= this._widthHeightMax) + { + this._targetUri = this._data?this._data.iconUri:this._emptyTexture; + } + else + { + this._targetUri = this._data?this._data.fullSizeIconUri:this._emptyTexture; + } + this._icon.finalized = true; + StageShareManager.stage.addEventListener(Event.ENTER_FRAME,this.loadTargetUri); + this._icon.greyedOut = this._data?!this._data.active:false; + this._icon.cacheAsBitmap = (this._icon.uri) && this._icon.uri.tag == NEED_CACHE_AS_BITMAP; + if(this._backgroundIcon) + { + if(this._forcedBackGroundIconUri) { - this.updateQuantity(0); - }; - if (this._isTimerRunning) - { - if (((!(this._data)) || ((this._data.timer == 0)))) - { - this.updateTimer(0); - }; + this._backgroundIcon.uri = this._forcedBackGroundIconUri; } - else + else if((this._data) && (Object(this._data).hasOwnProperty("backGroundIconUri")) && (Object(this._data).backGroundIconUri)) { - if (((this._data) && (this._data.timer))) - { - this.updateTimer(this._data.timer); - }; - }; - if ((((width <= this._widthHeightMax)) && ((height <= this._widthHeightMax)))) - { - this._targetUri = ((this._data) ? this._data.iconUri : this._emptyTexture); + this._backgroundIcon.uri = Object(this._data).backGroundIconUri; } else { - this._targetUri = ((this._data) ? this._data.fullSizeIconUri : this._emptyTexture); - }; - this._icon.finalized = true; - StageShareManager.stage.addEventListener(Event.ENTER_FRAME, this.loadTargetUri); - this._icon.greyedOut = ((this._data) ? !(this._data.active) : false); - this._icon.cacheAsBitmap = ((this._icon.uri) && ((this._icon.uri.tag == NEED_CACHE_AS_BITMAP))); - if (this._backgroundIcon) - { - if (this._forcedBackGroundIconUri) - { - this._backgroundIcon.uri = this._forcedBackGroundIconUri; - } - else - { - if (((((this._data) && (Object(this._data).hasOwnProperty("backGroundIconUri")))) && (Object(this._data).backGroundIconUri))) - { - this._backgroundIcon.uri = Object(this._data).backGroundIconUri; - } - else - { - this._backgroundIcon.uri = null; - }; - }; - }; - } - - override public function finalize():void - { - var stateChangingProperties:Array; - if (!(this._icon)) - { - _unicID++; - this._icon = new Texture(); - if (EmbedIcons.SLOT_DEFAULT_ICON != null) - { - this._icon.defaultBitmapData = EmbedIcons.SLOT_DEFAULT_ICON; - }; - this._icon.name = ("tx_slotUnicIcon" + _unicID); - this._icon.addEventListener(TextureLoadFailedEvent.EVENT_TEXTURE_LOAD_FAILED, this.onSlotTextureFailed); - this._icon.forceReload = true; - this._icon.mouseEnabled = false; - this._icon.width = width; - this._icon.height = height; - if ((((width <= this._widthHeightMax)) && ((height <= this._widthHeightMax)))) - { - this._targetUri = ((this._data) ? this._data.iconUri : this._emptyTexture); - } - else - { - this._targetUri = ((this._data) ? this._data.fullSizeIconUri : this._emptyTexture); - }; - this._icon.cacheAsBitmap = ((this._icon.uri) && ((this._icon.uri.tag == NEED_CACHE_AS_BITMAP))); - this._icon.finalized = (this._targetUri == null); - this._icon.finalize(); - addChild(this._icon); - StageShareManager.stage.addEventListener(Event.ENTER_FRAME, this.loadTargetUri); - }; - if (!(this._tx_timerForeground)) - { - this._tx_timerForeground = new Texture(); - this._tx_timerForeground.addEventListener(TextureLoadFailedEvent.EVENT_TEXTURE_LOAD_FAILED, this.onSlotTextureFailed); - this._tx_timerForeground.forceReload = true; - this._tx_timerForeground.uri = this.timerTexture; - this._tx_timerForeground.mouseEnabled = false; - this._tx_timerForeground.width = width; - this._tx_timerForeground.height = height; - this._tx_timerForeground.finalized = true; - this._tx_timerForeground.finalize(); - this._tx_timerForeground.visible = false; - addChild(this._tx_timerForeground); - }; - try - { - if (((!(this._backgroundIcon)) && (((this._forcedBackGroundIconUri) || (((((this._data) && (Object(this._data).hasOwnProperty("backGroundIconUri")))) && (Object(this._data).backGroundIconUri))))))) - { - this._backgroundIcon = new Texture(); - this._backgroundIcon.mouseEnabled = false; - this._backgroundIcon.width = width; - this._backgroundIcon.height = height; - this._backgroundIcon.uri = ((this._forcedBackGroundIconUri) ? this._forcedBackGroundIconUri : Object(this._data).backGroundIconUri); - this._backgroundIcon.finalized = true; - this._backgroundIcon.finalize(); - this._backgroundIcon.visible = this._displayBackgroundIcon; - addChildAt(this._backgroundIcon, 0); - }; + this._backgroundIcon.uri = null; } - catch(e:Error) - { - _log.warn(("C'est mal de pas implémenter les fonction de base sur " + getQualifiedClassName(_data))); - }; - if (((((this._data) && (this._data.info1))) && (!(this._hideTopLabel)))) - { - this.updateQuantity(int(this._data.info1)); - }; - if (((((this._data) && (this._data.info1))) && (!(this._hideTopLabel)))) + + } + } + + override public function finalize() : void + { + var stateChangingProperties:Array = null; + if(!this._icon) + { + _unicID++; + this._icon = new Texture(); + if(EmbedIcons.SLOT_DEFAULT_ICON != null) { - this.updateQuantity(int(this._data.info1)); - }; - if (this._isTimerRunning) + this._icon.defaultBitmapData = EmbedIcons.SLOT_DEFAULT_ICON; + } + this._icon.name = "tx_slotUnicIcon" + _unicID; + this._icon.addEventListener(TextureLoadFailedEvent.EVENT_TEXTURE_LOAD_FAILED,this.onSlotTextureFailed); + this._icon.forceReload = true; + this._icon.mouseEnabled = false; + this._icon.width = width; + this._icon.height = height; + if(width <= this._widthHeightMax && height <= this._widthHeightMax) { - if (((!(this._data)) || ((this._data.timer == 0)))) - { - this.updateTimer(0); - }; + this._targetUri = this._data?this._data.iconUri:this._emptyTexture; } else { - if (((this._data) && (this._data.timer))) - { - this.updateTimer(this._data.timer); - }; - }; - if (!(this._effect)) - { - this._effect = new Texture(); - this._effect.mouseEnabled = false; - this._effect.width = width; - this._effect.height = height; - if (this._selected) - { - this._effect.uri = this.selectedTexture; - } - else - { - if (this._customTexture) - { - this._effect.uri = this._customTexture; - }; - }; - this._effect.finalize(); - this._effect.finalized = true; - addChild(this._effect); - }; - if (((this._isButton) && (((!(changingStateData)) || ((changingStateData.length == 0)))))) - { - stateChangingProperties = new Array(); - stateChangingProperties[StatesEnum.STATE_NORMAL] = new Array(); - stateChangingProperties[StatesEnum.STATE_NORMAL][this._icon.name] = new Array(); - stateChangingProperties[StatesEnum.STATE_NORMAL][this._icon.name]["gotoAndStop"] = "normal"; - stateChangingProperties[StatesEnum.STATE_OVER] = new Array(); - stateChangingProperties[StatesEnum.STATE_OVER][this._icon.name] = new Array(); - stateChangingProperties[StatesEnum.STATE_OVER][this._icon.name]["gotoAndStop"] = "over"; - stateChangingProperties[StatesEnum.STATE_CLICKED] = new Array(); - stateChangingProperties[StatesEnum.STATE_CLICKED][this._icon.name] = new Array(); - stateChangingProperties[StatesEnum.STATE_CLICKED][this._icon.name]["gotoAndStop"] = "pressed"; - stateChangingProperties[StatesEnum.STATE_SELECTED] = new Array(); - stateChangingProperties[StatesEnum.STATE_SELECTED][this._icon.name] = new Array(); - stateChangingProperties[StatesEnum.STATE_SELECTED][this._icon.name]["gotoAndStop"] = "selected"; - stateChangingProperties[StatesEnum.STATE_SELECTED_OVER] = new Array(); - stateChangingProperties[StatesEnum.STATE_SELECTED_OVER][this._icon.name] = new Array(); - stateChangingProperties[StatesEnum.STATE_SELECTED_OVER][this._icon.name]["gotoAndStop"] = "selected_over"; - stateChangingProperties[StatesEnum.STATE_SELECTED_CLICKED] = new Array(); - stateChangingProperties[StatesEnum.STATE_SELECTED_CLICKED][this._icon.name] = new Array(); - stateChangingProperties[StatesEnum.STATE_SELECTED_CLICKED][this._icon.name]["gotoAndStop"] = "selected_pressed"; - changingStateData = stateChangingProperties; - }; - _finalized = true; - if (getUi()) - { - getUi().iAmFinalized(this); - }; - } - - public function updateQuantity(num:int):void - { - if (num == 0) + this._targetUri = this._data?this._data.fullSizeIconUri:this._emptyTexture; + } + this._icon.cacheAsBitmap = (this._icon.uri) && this._icon.uri.tag == NEED_CACHE_AS_BITMAP; + this._icon.finalized = this._targetUri == null; + this._icon.finalize(); + addChild(this._icon); + StageShareManager.stage.addEventListener(Event.ENTER_FRAME,this.loadTargetUri); + } + if(!this._tx_timerForeground) + { + this._tx_timerForeground = new Texture(); + this._tx_timerForeground.addEventListener(TextureLoadFailedEvent.EVENT_TEXTURE_LOAD_FAILED,this.onSlotTextureFailed); + this._tx_timerForeground.forceReload = true; + this._tx_timerForeground.uri = this.timerTexture; + this._tx_timerForeground.mouseEnabled = false; + this._tx_timerForeground.width = width; + this._tx_timerForeground.height = height; + this._tx_timerForeground.finalized = true; + this._tx_timerForeground.finalize(); + this._tx_timerForeground.visible = false; + addChild(this._tx_timerForeground); + } + try + { + if(!this._backgroundIcon && ((this._forcedBackGroundIconUri) || (this._data && Object(this._data).hasOwnProperty("backGroundIconUri") && Object(this._data).backGroundIconUri))) { - if (((this._quantitySprite) && (this._quantitySprite.parent))) - { - removeChild(this._quantitySprite); - }; - return; - }; - if (!(this._quantitySprite)) + this._backgroundIcon = new Texture(); + this._backgroundIcon.mouseEnabled = false; + this._backgroundIcon.width = width; + this._backgroundIcon.height = height; + this._backgroundIcon.uri = this._forcedBackGroundIconUri?this._forcedBackGroundIconUri:Object(this._data).backGroundIconUri; + this._backgroundIcon.finalized = true; + this._backgroundIcon.finalize(); + this._backgroundIcon.visible = this._displayBackgroundIcon; + addChildAt(this._backgroundIcon,0); + } + } + catch(e:Error) + { + _log.warn("C\'est mal de pas implémenter les fonction de base sur " + getQualifiedClassName(_data)); + } + if((this._data) && (this._data.info1) && !this._hideTopLabel) + { + this.updateQuantity(int(this._data.info1)); + } + if((this._data) && (this._data.info1) && !this._hideTopLabel) + { + this.updateQuantity(int(this._data.info1)); + } + if(this._isTimerRunning) + { + if(!this._data || this._data.timer == 0) { - this._quantitySprite = new Sprite(); - this._quantitySprite.mouseChildren = false; - this._quantitySprite.mouseEnabled = false; - this._quantityText = new TextField(); - this._quantityText.defaultTextFormat = this._quantityTextFormat; - this._quantityText.height = 25; - this._quantityText.x = 1; - this._quantityText.y = -3; - this._quantityText.autoSize = TextFieldAutoSize.LEFT; - this._quantitySprite.addChild(this._quantityText); - }; - addChild(this._quantitySprite); - this._quantityText.text = String(num); - this._quantitySprite.graphics.clear(); - this._quantitySprite.graphics.beginFill(0x333333, 0.6); - this._quantitySprite.graphics.drawRoundRectComplex(0, 0, this._quantityText.width, 18, 10, 0, 0, 0); - this._quantitySprite.graphics.endFill(); - } - - private function updateTimer(t:int):void - { - var _local_3:int; - this._timerMaxDuration = t; - if (this._timerMaxDuration == 0) + this.updateTimer(0); + } + } + else if((this._data) && (this._data.timer)) + { + this.updateTimer(this._data.timer); + } + + if(!this._effect) + { + this._effect = new Texture(); + this._effect.mouseEnabled = false; + this._effect.width = width; + this._effect.height = height; + if(this._selected) { - this._tx_timerForeground.visible = false; - this._isTimerRunning = false; - return; - }; - var currentTime:int = getTimer(); - if (!(this._data.endTime)) + this._effect.uri = this.selectedTexture; + } + else if(this._customTexture) { - this._data.endTime = (currentTime + this._timerMaxDuration); - this._timerStartTime = this._data.startTime; - this._tx_timerForeground.gotoAndStop = 100; + this._effect.uri = this._customTexture; } - else + + this._effect.finalize(); + this._effect.finalized = true; + addChild(this._effect); + } + if((this._isButton) && (!changingStateData || changingStateData.length == 0)) + { + stateChangingProperties = new Array(); + stateChangingProperties[StatesEnum.STATE_NORMAL] = new Array(); + stateChangingProperties[StatesEnum.STATE_NORMAL][this._icon.name] = new Array(); + stateChangingProperties[StatesEnum.STATE_NORMAL][this._icon.name]["gotoAndStop"] = "normal"; + stateChangingProperties[StatesEnum.STATE_OVER] = new Array(); + stateChangingProperties[StatesEnum.STATE_OVER][this._icon.name] = new Array(); + stateChangingProperties[StatesEnum.STATE_OVER][this._icon.name]["gotoAndStop"] = "over"; + stateChangingProperties[StatesEnum.STATE_CLICKED] = new Array(); + stateChangingProperties[StatesEnum.STATE_CLICKED][this._icon.name] = new Array(); + stateChangingProperties[StatesEnum.STATE_CLICKED][this._icon.name]["gotoAndStop"] = "pressed"; + stateChangingProperties[StatesEnum.STATE_SELECTED] = new Array(); + stateChangingProperties[StatesEnum.STATE_SELECTED][this._icon.name] = new Array(); + stateChangingProperties[StatesEnum.STATE_SELECTED][this._icon.name]["gotoAndStop"] = "selected"; + stateChangingProperties[StatesEnum.STATE_SELECTED_OVER] = new Array(); + stateChangingProperties[StatesEnum.STATE_SELECTED_OVER][this._icon.name] = new Array(); + stateChangingProperties[StatesEnum.STATE_SELECTED_OVER][this._icon.name]["gotoAndStop"] = "selected_over"; + stateChangingProperties[StatesEnum.STATE_SELECTED_CLICKED] = new Array(); + stateChangingProperties[StatesEnum.STATE_SELECTED_CLICKED][this._icon.name] = new Array(); + stateChangingProperties[StatesEnum.STATE_SELECTED_CLICKED][this._icon.name]["gotoAndStop"] = "selected_pressed"; + changingStateData = stateChangingProperties; + } + _finalized = true; + if(getUi()) + { + getUi().iAmFinalized(this); + } + } + + private var _quantitySprite:Sprite; + + private var _quantityText:TextField; + + private const _quantityTextFormat:TextFormat = new TextFormat("Tahoma",15,16777215); + + public function updateQuantity(param1:int) : void + { + if(param1 == 0) + { + if((this._quantitySprite) && (this._quantitySprite.parent)) { - this._timerMaxDuration = (this._data.endTime - this._data.startTime); - this._timerStartTime = this._data.startTime; - _local_3 = Math.round((((currentTime - this._timerStartTime) / this._timerMaxDuration) * 100)); - _local_3 = (100 - _local_3); - this._tx_timerForeground.gotoAndStop = _local_3; - }; - this._tx_timerForeground.visible = true; - this._isTimerRunning = true; - EnterFrameDispatcher.addEventListener(this.onEnterFrame, "timerEvent"); - } - - [HideInFakeClass] - override public function process(msg:Message):Boolean - { - var linkCursor:LinkedCursorData; - var tmpState:uint; - var listener:IInterfaceListener; - var soundToPLay:String; - var _local_6:*; - var holder:*; - var t1:uint; - var dropTargetHandler:IDragAndDropHandler; - var dragData:SlotDragAndDropData; - var currentHolder:ISlotDataHolder; - var listener2:IInterfaceListener; - var listener3:IInterfaceListener; - if (this._isButton) + removeChild(this._quantitySprite); + } + return; + } + if(!this._quantitySprite) + { + this._quantitySprite = new Sprite(); + this._quantitySprite.mouseChildren = false; + this._quantitySprite.mouseEnabled = false; + this._quantityText = new TextField(); + this._quantityText.defaultTextFormat = this._quantityTextFormat; + this._quantityText.height = 25; + this._quantityText.x = 1; + this._quantityText.y = -3; + this._quantityText.autoSize = TextFieldAutoSize.LEFT; + this._quantitySprite.addChild(this._quantityText); + } + addChild(this._quantitySprite); + this._quantityText.text = String(param1); + this._quantitySprite.graphics.clear(); + this._quantitySprite.graphics.beginFill(3355443,0.6); + this._quantitySprite.graphics.drawRoundRectComplex(0,0,this._quantityText.width,18,10,0,0,0); + this._quantitySprite.graphics.endFill(); + } + + private function updateTimer(param1:int) : void + { + var _loc3_:* = 0; + this._timerMaxDuration = param1; + if(this._timerMaxDuration == 0) + { + this._tx_timerForeground.visible = false; + this._isTimerRunning = false; + return; + } + var _loc2_:int = getTimer(); + if(!this._data.endTime) + { + this._data.endTime = _loc2_ + this._timerMaxDuration; + this._timerStartTime = this._data.startTime; + this._tx_timerForeground.gotoAndStop = 100; + } + else + { + this._timerMaxDuration = this._data.endTime - this._data.startTime; + this._timerStartTime = this._data.startTime; + _loc3_ = Math.round((_loc2_ - this._timerStartTime) / this._timerMaxDuration * 100); + _loc3_ = 100 - _loc3_; + this._tx_timerForeground.gotoAndStop = _loc3_; + } + this._tx_timerForeground.visible = true; + this._isTimerRunning = true; + EnterFrameDispatcher.addEventListener(this.onEnterFrame,"timerEvent"); + } + + override public function process(param1:Message) : Boolean + { + var _loc2_:LinkedCursorData = null; + var _loc3_:uint = 0; + var _loc4_:IInterfaceListener = null; + var _loc5_:String = null; + var _loc6_:* = undefined; + var _loc7_:* = undefined; + var _loc8_:uint = 0; + var _loc9_:IDragAndDropHandler = null; + var _loc10_:SlotDragAndDropData = null; + var _loc11_:ISlotDataHolder = null; + var _loc12_:IInterfaceListener = null; + var _loc13_:IInterfaceListener = null; + if(this._isButton) + { + _loc3_ = 9999; + if(!super.canProcessMessage(param1)) { - tmpState = 9999; - if (!(super.canProcessMessage(msg))) - { - return (true); - }; - if (!(_disabled)) - { - switch (true) - { - case (msg is MouseDownMessage): - _mousePressed = true; - break; - case (msg is MouseDoubleClickMessage): - case (msg is MouseClickMessage): - _mousePressed = false; - if (!(isMute)) - { - for each (listener in Berilia.getInstance().UISoundListeners) - { - soundToPLay = super.selectSound(); - if (int(soundToPLay) != -1) - { - listener.playUISound(soundToPLay); - }; - }; - }; - break; - default: - super.process(msg); - }; - }; - }; - switch (true) + return true; + } + if(!_disabled) { - case (msg is MouseDownMessage): - if (ShortcutsFrame.shiftKey) - { - KernelEventsManager.getInstance().processCallback(BeriliaHookList.MouseShiftClick, SecureCenter.secure(this)); - } - else - { - if (this._allowDrag) - { - if (!(this._data)) - { - return (false); - }; - this._dragging = true; - StageShareManager.stage.addEventListener(MouseEvent.MOUSE_MOVE, this.onDragAndDropStart); - this._dragStartPoint = new Point(-(MouseDownMessage(msg).mouseEvent.localX), -(MouseDownMessage(msg).mouseEvent.localY)); - }; - }; - break; - case (msg is MouseOverMessage): - if (this._allowDrag) - { - linkCursor = LinkedCursorSpriteManager.getInstance().getItem(DRAG_AND_DROP_CURSOR_NAME); - if (((((linkCursor) && ((linkCursor.data is SlotDragAndDropData)))) && (!((SlotDragAndDropData(linkCursor.data).slotData == this._data))))) + switch(true) + { + case param1 is MouseDownMessage: + _mousePressed = true; + break; + case param1 is MouseDoubleClickMessage: + case param1 is MouseClickMessage: + _mousePressed = false; + if(!isMute) + { + for each(_loc4_ in Berilia.getInstance().UISoundListeners) { - holder = SecureCenter.secure(SlotDragAndDropData(linkCursor.data).currentHolder); - t1 = getTimer(); - if (((!((this.dropValidator == null))) && (this.dropValidator(this, SlotDragAndDropData(linkCursor.data).slotData, holder)))) - { - this._effect.uri = this.acceptDragTexture; - } - else - { - this._effect.uri = this.refuseDragTexture; - }; + _loc5_ = super.selectSound(); + if(int(_loc5_) != -1) + { + _loc4_.playUISound(_loc5_); + } } - else - { - if (this._effect != null) - { - this._effect.uri = this.highlightTexture; - }; - }; - } - else - { - if (this._effect != null) - { - this._effect.uri = this.highlightTexture; - }; - }; - break; - case (msg is MouseOutMessage): - if (this._effect) - { - if (this._selected) - { - this._effect.uri = this.selectedTexture; - } - else - { - if (this._customTexture) - { - this._effect.uri = this._customTexture; - } - else - { - this._effect.uri = null; - }; - }; - }; - break; - case (msg is MouseReleaseOutsideMessage): - _local_6 = MouseReleaseOutsideMessage(msg).mouseEvent.target; - linkCursor = LinkedCursorSpriteManager.getInstance().getItem(DRAG_AND_DROP_CURSOR_NAME); - if (((((linkCursor) && (this._dragging))) && (!((_local_6 is ISlotDataHolder))))) - { - holder = SecureCenter.secure(SlotDragAndDropData(linkCursor.data).currentHolder); - switch (true) - { - case (_local_6 is IDragAndDropHandler): - if ((_local_6 as IDragAndDropHandler).dropValidator != null) - { - dropTargetHandler = (_local_6 as IDragAndDropHandler); - dragData = linkCursor.data; - currentHolder = null; - if (dragData) - { - currentHolder = dragData.currentHolder; - }; - if (dropTargetHandler.dropValidator(this, this.data, currentHolder)) - { - dropTargetHandler.processDrop(this, this.data, currentHolder); - }; - for each (listener2 in Berilia.getInstance().UISoundListeners) - { - listener2.playUISound("16053"); - }; - }; - break; - case (_local_6 is MovieClip): - case (_local_6 is TextField): - case (_local_6 is Stage): - KernelEventsManager.getInstance().processCallback(BeriliaHookList.SlotDropedNorBeriliaNorWorld, holder); - break; - case (getQualifiedClassName(_local_6.parent).indexOf("com.ankamagames.berilia") >= 0): - KernelEventsManager.getInstance().processCallback(BeriliaHookList.SlotDropedOnBerilia, holder, _local_6); - break; - case Boolean(((_local_6.parent) && ((_local_6.parent.parent is MapViewer)))): - case Boolean(((_local_6.parent) && ((getQualifiedClassName(_local_6.parent).indexOf("Dofus") >= 0)))): - KernelEventsManager.getInstance().processCallback(BeriliaHookList.SlotDropedNorBeriliaNorWorld, holder, _local_6); - break; - default: - KernelEventsManager.getInstance().processCallback(BeriliaHookList.SlotDropedOnWorld, holder, _local_6); - }; - LinkedCursorSpriteManager.getInstance().removeItem(DRAG_AND_DROP_CURSOR_NAME, true); - if (linkCursor != null) - { - KernelEventsManager.getInstance().processCallback(BeriliaHookList.DropEnd, SecureCenter.secure(SlotDragAndDropData(linkCursor.data).currentHolder)); - }; - } - else - { - if ((_local_6 is Slot)) - { - if ((_local_6 as Slot).allowDrag == false) - { - LinkedCursorSpriteManager.getInstance().removeItem(DRAG_AND_DROP_CURSOR_NAME); - if (linkCursor != null) - { - KernelEventsManager.getInstance().processCallback(BeriliaHookList.DropEnd, SecureCenter.secure(SlotDragAndDropData(linkCursor.data).currentHolder)); - }; - }; - }; - }; - this.removeDrag(); - break; - case (msg is MouseClickMessage): - case (msg is MouseDoubleClickMessage): - linkCursor = LinkedCursorSpriteManager.getInstance().getItem(DRAG_AND_DROP_CURSOR_NAME); - if (((linkCursor) && ((linkCursor.data is SlotDragAndDropData)))) - { - LinkedCursorSpriteManager.getInstance().removeItem(DRAG_AND_DROP_CURSOR_NAME); - KernelEventsManager.getInstance().processCallback(BeriliaHookList.DropEnd, SecureCenter.secure(SlotDragAndDropData(linkCursor.data).currentHolder)); - }; - if (this._dragging) - { - this.removeDrag(); - }; - if (((ShortcutsFrame.ctrlKey) && ((msg is MouseDoubleClickMessage)))) - { - KernelEventsManager.getInstance().processCallback(BeriliaHookList.MouseCtrlDoubleClick, SecureCenter.secure(this)); - } - else - { - if (((ShortcutsFrame.altKey) && ((msg is MouseDoubleClickMessage)))) - { - KernelEventsManager.getInstance().processCallback(BeriliaHookList.MouseAltDoubleClick, SecureCenter.secure(this)); - }; - }; - break; - case (msg is MouseUpMessage): - linkCursor = LinkedCursorSpriteManager.getInstance().getItem(DRAG_AND_DROP_CURSOR_NAME); - if (((linkCursor) && ((linkCursor.data is SlotDragAndDropData)))) - { - dragData = linkCursor.data; - if (((!((dragData.slotData == this._data))) && (this.dropValidator(this, SlotDragAndDropData(linkCursor.data).slotData, dragData.currentHolder)))) + } + break; + default: + super.process(param1); + } + } + } + switch(true) + { + case param1 is MouseDownMessage: + if(ShortcutsFrame.shiftKey) + { + KernelEventsManager.getInstance().processCallback(BeriliaHookList.MouseShiftClick,SecureCenter.secure(this)); + } + else if(this._allowDrag) + { + if(!this._data) + { + return false; + } + this._dragging = true; + StageShareManager.stage.addEventListener(MouseEvent.MOUSE_MOVE,this.onDragAndDropStart); + this._dragStartPoint = new Point(-MouseDownMessage(param1).mouseEvent.localX,-MouseDownMessage(param1).mouseEvent.localY); + } + + break; + case param1 is MouseOverMessage: + if(this._allowDrag) + { + _loc2_ = LinkedCursorSpriteManager.getInstance().getItem(DRAG_AND_DROP_CURSOR_NAME); + if((_loc2_) && (_loc2_.data is SlotDragAndDropData) && !(SlotDragAndDropData(_loc2_.data).slotData == this._data)) + { + _loc7_ = SecureCenter.secure(SlotDragAndDropData(_loc2_.data).currentHolder); + _loc8_ = getTimer(); + if(!(this.dropValidator == null) && (this.dropValidator(this,SlotDragAndDropData(_loc2_.data).slotData,_loc7_))) + { + this._effect.uri = this.acceptDragTexture; + } + else + { + this._effect.uri = this.refuseDragTexture; + } + } + else if(this._effect != null) + { + this._effect.uri = this.highlightTexture; + } + + } + else if(this._effect != null) + { + this._effect.uri = this.highlightTexture; + } + + break; + case param1 is MouseOutMessage: + if(this._effect) + { + if(this._selected) + { + this._effect.uri = this.selectedTexture; + } + else if(this._customTexture) + { + this._effect.uri = this._customTexture; + } + else + { + this._effect.uri = null; + } + + } + break; + case param1 is MouseReleaseOutsideMessage: + _loc6_ = MouseReleaseOutsideMessage(param1).mouseEvent.target; + _loc2_ = LinkedCursorSpriteManager.getInstance().getItem(DRAG_AND_DROP_CURSOR_NAME); + if((_loc2_) && (this._dragging) && !(_loc6_ is ISlotDataHolder)) + { + _loc7_ = SecureCenter.secure(SlotDragAndDropData(_loc2_.data).currentHolder); + switch(true) + { + case _loc6_ is IDragAndDropHandler: + if((_loc6_ as IDragAndDropHandler).dropValidator != null) { - if (dragData.currentHolder) - { - dragData.currentHolder.removeDropSource(dragData.currentHolder); - }; - this.processDrop(this, dragData.slotData, dragData.currentHolder); - for each (listener3 in Berilia.getInstance().UISoundListeners) - { - listener3.playUISound("16053"); - }; - LinkedCursorSpriteManager.getInstance().removeItem(DRAG_AND_DROP_CURSOR_NAME); + _loc9_ = _loc6_ as IDragAndDropHandler; + _loc10_ = _loc2_.data; + _loc11_ = null; + if(_loc10_) + { + _loc11_ = _loc10_.currentHolder; + } + if(_loc9_.dropValidator(this,this.data,_loc11_)) + { + _loc9_.processDrop(this,this.data,_loc11_); + } + for each(_loc12_ in Berilia.getInstance().UISoundListeners) + { + _loc12_.playUISound("16053"); + } } - else - { - LinkedCursorSpriteManager.getInstance().removeItem(DRAG_AND_DROP_CURSOR_NAME); - }; - Berilia.getInstance().handler.process(new DropMessage(this, dragData.currentHolder)); - if (this._allowDrag) - { - KernelEventsManager.getInstance().processCallback(BeriliaHookList.DropEnd, SecureCenter.secure(dragData.currentHolder)); - }; - }; - if (this._dragging) - { - this.removeDrag(); - }; - break; - case (msg is MouseRightClickOutsideMessage): - linkCursor = LinkedCursorSpriteManager.getInstance().getItem(DRAG_AND_DROP_CURSOR_NAME); - if (((linkCursor) && ((linkCursor.data is SlotDragAndDropData)))) - { - LinkedCursorSpriteManager.getInstance().removeItem(DRAG_AND_DROP_CURSOR_NAME); - KernelEventsManager.getInstance().processCallback(BeriliaHookList.DropEnd, SecureCenter.secure(SlotDragAndDropData(linkCursor.data).currentHolder)); - }; - if (this._dragging) - { - this.removeDrag(); - }; - }; - return (false); - } - - override public function remove():void - { - if (!(__removed)) + break; + case _loc6_ is MovieClip: + case _loc6_ is TextField: + case _loc6_ is Stage: + KernelEventsManager.getInstance().processCallback(BeriliaHookList.SlotDropedNorBeriliaNorWorld,_loc7_); + break; + case getQualifiedClassName(_loc6_.parent).indexOf("com.ankamagames.berilia") >= 0: + KernelEventsManager.getInstance().processCallback(BeriliaHookList.SlotDropedOnBerilia,_loc7_,_loc6_); + break; + } + LinkedCursorSpriteManager.getInstance().removeItem(DRAG_AND_DROP_CURSOR_NAME,true); + if(_loc2_ != null) + { + KernelEventsManager.getInstance().processCallback(BeriliaHookList.DropEnd,SecureCenter.secure(SlotDragAndDropData(_loc2_.data).currentHolder)); + } + } + else if(_loc6_ is Slot) + { + if((_loc6_ as Slot).allowDrag == false) + { + LinkedCursorSpriteManager.getInstance().removeItem(DRAG_AND_DROP_CURSOR_NAME); + if(_loc2_ != null) + { + KernelEventsManager.getInstance().processCallback(BeriliaHookList.DropEnd,SecureCenter.secure(SlotDragAndDropData(_loc2_.data).currentHolder)); + } + } + } + + this.removeDrag(); + break; + case param1 is MouseClickMessage: + case param1 is MouseDoubleClickMessage: + _loc2_ = LinkedCursorSpriteManager.getInstance().getItem(DRAG_AND_DROP_CURSOR_NAME); + if((_loc2_) && _loc2_.data is SlotDragAndDropData) + { + LinkedCursorSpriteManager.getInstance().removeItem(DRAG_AND_DROP_CURSOR_NAME); + KernelEventsManager.getInstance().processCallback(BeriliaHookList.DropEnd,SecureCenter.secure(SlotDragAndDropData(_loc2_.data).currentHolder)); + } + if(this._dragging) + { + this.removeDrag(); + } + if((ShortcutsFrame.ctrlKey) && param1 is MouseDoubleClickMessage) + { + KernelEventsManager.getInstance().processCallback(BeriliaHookList.MouseCtrlDoubleClick,SecureCenter.secure(this)); + } + else if((ShortcutsFrame.altKey) && param1 is MouseDoubleClickMessage) + { + KernelEventsManager.getInstance().processCallback(BeriliaHookList.MouseAltDoubleClick,SecureCenter.secure(this)); + } + + break; + case param1 is MouseUpMessage: + _loc2_ = LinkedCursorSpriteManager.getInstance().getItem(DRAG_AND_DROP_CURSOR_NAME); + if((_loc2_) && _loc2_.data is SlotDragAndDropData) + { + _loc10_ = _loc2_.data; + if(!(_loc10_.slotData == this._data) && (this.dropValidator(this,SlotDragAndDropData(_loc2_.data).slotData,_loc10_.currentHolder))) + { + if(_loc10_.currentHolder) + { + _loc10_.currentHolder.removeDropSource(_loc10_.currentHolder); + } + this.processDrop(this,_loc10_.slotData,_loc10_.currentHolder); + for each(_loc13_ in Berilia.getInstance().UISoundListeners) + { + _loc13_.playUISound("16053"); + } + LinkedCursorSpriteManager.getInstance().removeItem(DRAG_AND_DROP_CURSOR_NAME); + } + else + { + LinkedCursorSpriteManager.getInstance().removeItem(DRAG_AND_DROP_CURSOR_NAME); + } + Berilia.getInstance().handler.process(new DropMessage(this,_loc10_.currentHolder)); + if(this._allowDrag) + { + KernelEventsManager.getInstance().processCallback(BeriliaHookList.DropEnd,SecureCenter.secure(_loc10_.currentHolder)); + } + } + if(this._dragging) + { + this.removeDrag(); + } + break; + case param1 is MouseRightClickOutsideMessage: + _loc2_ = LinkedCursorSpriteManager.getInstance().getItem(DRAG_AND_DROP_CURSOR_NAME); + if((_loc2_) && _loc2_.data is SlotDragAndDropData) + { + LinkedCursorSpriteManager.getInstance().removeItem(DRAG_AND_DROP_CURSOR_NAME); + KernelEventsManager.getInstance().processCallback(BeriliaHookList.DropEnd,SecureCenter.secure(SlotDragAndDropData(_loc2_.data).currentHolder)); + } + if(this._dragging) + { + this.removeDrag(); + } + } + return false; + } + + override public function remove() : void + { + if(!__removed) + { + this._dropValidator = null; + this._unboxedDropValidator = null; + this._removeDropSource = null; + this._unboxedRemoveDropSource = null; + this._processDrop = null; + this._unboxedProcessDrop = null; + removeEventListener(Event.ADDED_TO_STAGE,this.onAddedToStage); + if(this._topLabel) { - this._dropValidator = null; - this._unboxedDropValidator = null; - this._removeDropSource = null; - this._unboxedRemoveDropSource = null; - this._processDrop = null; - this._unboxedProcessDrop = null; - removeEventListener(Event.ADDED_TO_STAGE, this.onAddedToStage); - if (this._topLabel) - { - this._topLabel.remove(); - }; - if (this._middleLabel) - { - this._middleLabel.remove(); - }; - if (this._bottomLabel) - { - this._bottomLabel.remove(); - }; - if (this._icon) - { - this._icon.remove(); - }; - if (this._effect) - { - this._effect.remove(); - }; - if (this._backgroundIcon) - { - this._backgroundIcon.remove(); - }; - if (this._tx_timerForeground) - { - this._tx_timerForeground.remove(); - }; - if (this._data) - { - this._data.removeHolder(this); - }; - this._data = null; - this._topLabel = null; - this._middleLabel = null; - this._bottomLabel = null; - this._icon = null; - this._effect = null; - this._backgroundIcon = null; - this._tx_timerForeground = null; - if (parent) - { - parent.removeChild(this); - }; - if (this._quantitySprite) - { - if (this._quantitySprite.parent) - { - removeChild(this._quantitySprite); - }; - this._quantitySprite = null; - }; - }; - EnterFrameDispatcher.removeEventListener(this.onEnterFrame); - super.remove(); - } - - private function removeDrag():void - { - StageShareManager.stage.removeEventListener(MouseEvent.MOUSE_MOVE, this.onDragAndDropStart); - if (this._icon) + this._topLabel.remove(); + } + if(this._middleLabel) { - this._icon.filters = []; - }; - this._dragStartPoint = null; - this._dragging = false; - } - - private function emptyFunction(... args) - { - return (null); - } - - private function onEnterFrame(pEvt:Event):void - { - var _local_3:int; - var currentTime:int = getTimer(); - if (currentTime > (this._timerStartTime + this._timerMaxDuration)) + this._middleLabel.remove(); + } + if(this._bottomLabel) { - EnterFrameDispatcher.removeEventListener(this.onEnterFrame); - this._timerMaxDuration = 0; - this._timerStartTime = 0; - this._tx_timerForeground.visible = false; - this._isTimerRunning = false; - if (this._data) - { - this._data.endTime = 0; - }; + this._bottomLabel.remove(); } - else + if(this._icon) { - _local_3 = Math.round((((currentTime - this._timerStartTime) / this._timerMaxDuration) * 100)); - _local_3 = (100 - _local_3); - this._tx_timerForeground.gotoAndStop = _local_3; - }; - } - - private function loadTargetUri(e:Event):void - { - StageShareManager.stage.removeEventListener(Event.ENTER_FRAME, this.loadTargetUri); - if (this._icon) + this._icon.remove(); + } + if(this._effect) { - this._icon.uri = this._targetUri; - this._icon.finalized = true; + this._effect.remove(); } - else + if(this._backgroundIcon) { - _log.error(("Impossible de donner au slot l'icone : " + this._targetUri)); - }; - } - - private function onTweenEnd(e:TweenEvent):void - { - LinkedCursorSpriteManager.getInstance().removeItem(DRAG_AND_DROP_CURSOR_NAME); - } - - private function onSlotTextureFailed(e:TextureLoadFailedEvent):void - { - if (((this._data) && (this._data.errorIconUri))) + this._backgroundIcon.remove(); + } + if(this._tx_timerForeground) { - e.behavior.cancel = true; - if (this._icon.uri != this._data.errorIconUri) - { - this._icon.uri = this._data.errorIconUri; - }; - }; - } - - private function onDragAndDropStart(e:Event):void - { - var listener:IInterfaceListener; - var d:LinkedCursorData; - var bd:BitmapData; - var dragData:SlotDragAndDropData; - var matrix:Array; - if (!(stage)) + this._tx_timerForeground.remove(); + } + if(this._data) { - return; - }; - for each (listener in Berilia.getInstance().UISoundListeners) + this._data.removeHolder(this); + } + this._data = null; + this._topLabel = null; + this._middleLabel = null; + this._bottomLabel = null; + this._icon = null; + this._effect = null; + this._backgroundIcon = null; + this._tx_timerForeground = null; + if(parent) { - listener.playUISound("16059"); - }; - StageShareManager.stage.removeEventListener(MouseEvent.MOUSE_MOVE, this.onDragAndDropStart); - d = new LinkedCursorData(); - bd = new BitmapData(width, height, true, 0); - this._effect.visible = false; - bd.draw(this); - this._effect.visible = true; - d.sprite = new DragSprite(bd); - d.offset = new Point(0, 0); - dragData = new SlotDragAndDropData(this, this._data); - d.data = dragData; - LinkedCursorSpriteManager.getInstance().addItem(DRAG_AND_DROP_CURSOR_NAME, d); - matrix = new Array(); - matrix = matrix.concat([(1 / 2), 0, 0, 0, 0]); - matrix = matrix.concat([0, (1 / 2), 0, 0, 0]); - matrix = matrix.concat([0, 0, (1 / 2), 0, 0]); - matrix = matrix.concat([0, 0, 0, 1, 0]); - this._icon.filters = [new ColorMatrixFilter(matrix)]; - KernelEventsManager.getInstance().processCallback(BeriliaHookList.DropStart, SecureCenter.secure(this)); - } - - private function onAddedToStage(e:Event):void - { - removeEventListener(Event.ADDED_TO_STAGE, this.onAddedToStage); - var ui:Object = getUi(); - if (((ui) && (this._icon))) + parent.removeChild(this); + } + if(this._quantitySprite) { - ui.registerId(this._icon.name, new GraphicElement(this._icon, new Array(), this._icon.name)); - }; - } - - - } -}//package com.ankamagames.berilia.components - + if(this._quantitySprite.parent) + { + removeChild(this._quantitySprite); + } + this._quantitySprite = null; + } + } + EnterFrameDispatcher.removeEventListener(this.onEnterFrame); + super.remove(); + } + + private function removeDrag() : void + { + StageShareManager.stage.removeEventListener(MouseEvent.MOUSE_MOVE,this.onDragAndDropStart); + if(this._icon) + { + this._icon.filters = []; + } + this._dragStartPoint = null; + this._dragging = false; + } + + private function emptyFunction(... rest) : * + { + return null; + } + + private function onEnterFrame(param1:Event) : void + { + var _loc3_:* = 0; + var _loc2_:int = getTimer(); + if(_loc2_ > this._timerStartTime + this._timerMaxDuration) + { + EnterFrameDispatcher.removeEventListener(this.onEnterFrame); + this._timerMaxDuration = 0; + this._timerStartTime = 0; + this._tx_timerForeground.visible = false; + this._isTimerRunning = false; + if(this._data) + { + this._data.endTime = 0; + } + } + else + { + _loc3_ = Math.round((_loc2_ - this._timerStartTime) / this._timerMaxDuration * 100); + _loc3_ = 100 - _loc3_; + this._tx_timerForeground.gotoAndStop = _loc3_; + } + } + + private function loadTargetUri(param1:Event) : void + { + StageShareManager.stage.removeEventListener(Event.ENTER_FRAME,this.loadTargetUri); + if(this._icon) + { + this._icon.uri = this._targetUri; + this._icon.finalized = true; + } + else + { + _log.error("Impossible de donner au slot l\'icone : " + this._targetUri); + } + } + + private function onTweenEnd(param1:TweenEvent) : void + { + LinkedCursorSpriteManager.getInstance().removeItem(DRAG_AND_DROP_CURSOR_NAME); + } + + private function onSlotTextureFailed(param1:TextureLoadFailedEvent) : void + { + if((this._data) && (this._data.errorIconUri)) + { + param1.behavior.cancel = true; + if(this._icon.uri != this._data.errorIconUri) + { + this._icon.uri = this._data.errorIconUri; + } + } + } + + private function onDragAndDropStart(param1:Event) : void + { + var _loc2_:IInterfaceListener = null; + var _loc3_:LinkedCursorData = null; + var _loc4_:BitmapData = null; + var _loc5_:SlotDragAndDropData = null; + var _loc6_:Array = null; + if(!stage) + { + return; + } + for each(_loc2_ in Berilia.getInstance().UISoundListeners) + { + _loc2_.playUISound("16059"); + } + StageShareManager.stage.removeEventListener(MouseEvent.MOUSE_MOVE,this.onDragAndDropStart); + _loc3_ = new LinkedCursorData(); + _loc4_ = new BitmapData(width,height,true,0); + this._effect.visible = false; + _loc4_.draw(this); + this._effect.visible = true; + _loc3_.sprite = new DragSprite(_loc4_); + _loc3_.offset = new Point(0,0); + _loc5_ = new SlotDragAndDropData(this,this._data); + _loc3_.data = _loc5_; + LinkedCursorSpriteManager.getInstance().addItem(DRAG_AND_DROP_CURSOR_NAME,_loc3_); + _loc6_ = new Array(); + _loc6_ = _loc6_.concat([1 / 2,0,0,0,0]); + _loc6_ = _loc6_.concat([0,1 / 2,0,0,0]); + _loc6_ = _loc6_.concat([0,0,1 / 2,0,0]); + _loc6_ = _loc6_.concat([0,0,0,1,0]); + this._icon.filters = [new ColorMatrixFilter(_loc6_)]; + KernelEventsManager.getInstance().processCallback(BeriliaHookList.DropStart,SecureCenter.secure(this)); + } + + private function onAddedToStage(param1:Event) : void + { + removeEventListener(Event.ADDED_TO_STAGE,this.onAddedToStage); + var _loc2_:Object = getUi(); + if((_loc2_) && (this._icon)) + { + _loc2_.registerId(this._icon.name,new GraphicElement(this._icon,new Array(),this._icon.name)); + } + } + } +} import flash.display.Sprite; -import flash.display.Bitmap; import flash.display.BitmapData; +import flash.display.Bitmap; -class DragSprite extends Sprite +class DragSprite extends Sprite { - - public function DragSprite(bitmapData:BitmapData) - { - alpha = 0.8; - addChild(new Bitmap(bitmapData)); - } - + + function DragSprite(param1:BitmapData) + { + super(); + alpha = 0.8; + addChild(new Bitmap(param1)); + } } - diff --git a/com/ankamagames/berilia/components/SpellZoneComponent.as b/com/ankamagames/berilia/components/SpellZoneComponent.as index 8340091ab..0ebb6100b 100644 --- a/com/ankamagames/berilia/components/SpellZoneComponent.as +++ b/com/ankamagames/berilia/components/SpellZoneComponent.as @@ -1,170 +1,181 @@ -package com.ankamagames.berilia.components +package com.ankamagames.berilia.components { - import com.ankamagames.berilia.types.graphic.GraphicContainer; - import com.ankamagames.berilia.FinalizableUIComponent; - import com.ankamagames.jerakine.utils.display.spellZone.SpellZoneCellManager; - import com.ankamagames.jerakine.utils.display.spellZone.ICellZoneProvider; - import com.ankamagames.jerakine.utils.display.spellZone.IZoneShape; - import com.ankamagames.jerakine.types.Uri; - import com.ankamagames.jerakine.data.I18n; - import com.ankamagames.jerakine.types.positions.MapPoint; - - public class SpellZoneComponent extends GraphicContainer implements FinalizableUIComponent - { - - private var _cellWidth:Number; - private var _cellHeight:Number; - private var _spellRange:uint; - private var _centerCellId:uint; - private var _verticalCells:uint; - private var _horizontalCells:uint; - private var _cellRatio:Number = 2; - private var _spellZoneManager:SpellZoneCellManager; - private var _spellLevel:ICellZoneProvider; - private var _infiniteLabel:Label; - private var _minRange:uint; - private var _maxRange:uint; - private var _infiniteRange:Boolean = false; - private var _finalized:Boolean; - - public function SpellZoneComponent() - { - disabled = false; - this._spellZoneManager = new SpellZoneCellManager(); - addChild(this._spellZoneManager); - } - - public function setSpellLevel(pSpellLevel:ICellZoneProvider):void - { - var zoneEffect:Object; - this._spellLevel = pSpellLevel; - this._spellZoneManager.spellLevel = this._spellLevel; - var infiniteRange:Boolean = (((((this._spellLevel.minimalRange == 0)) && ((this._spellLevel.maximalRange == 0)))) || ((this._spellLevel.maximalRange == 63))); - var infiniteZoneEffect:Boolean; - var affectOneCharacter:Boolean = true; - for each (zoneEffect in this._spellLevel.spellZoneEffects) + import com.ankamagames.berilia.types.graphic.GraphicContainer; + import com.ankamagames.berilia.FinalizableUIComponent; + import com.ankamagames.jerakine.utils.display.spellZone.SpellZoneCellManager; + import com.ankamagames.jerakine.utils.display.spellZone.ICellZoneProvider; + import com.ankamagames.jerakine.utils.display.spellZone.IZoneShape; + import com.ankamagames.jerakine.types.Uri; + import com.ankamagames.jerakine.data.I18n; + import com.ankamagames.jerakine.types.positions.MapPoint; + + public class SpellZoneComponent extends GraphicContainer implements FinalizableUIComponent + { + + public function SpellZoneComponent() + { + super(); + disabled = false; + this._spellZoneManager = new SpellZoneCellManager(); + addChild(this._spellZoneManager); + } + + private var _cellWidth:Number; + + private var _cellHeight:Number; + + private var _spellRange:uint; + + private var _centerCellId:uint; + + private var _verticalCells:uint; + + private var _horizontalCells:uint; + + private var _cellRatio:Number = 2; + + private var _spellZoneManager:SpellZoneCellManager; + + private var _spellLevel:ICellZoneProvider; + + private var _infiniteLabel:Label; + + private var _minRange:uint; + + private var _maxRange:uint; + + private var _infiniteRange:Boolean = false; + + private var _finalized:Boolean; + + public function setSpellLevel(param1:ICellZoneProvider) : void + { + var _loc5_:Object = null; + this._spellLevel = param1; + this._spellZoneManager.spellLevel = this._spellLevel; + var _loc2_:Boolean = this._spellLevel.minimalRange == 0 && this._spellLevel.maximalRange == 0 || this._spellLevel.maximalRange == 63; + var _loc3_:* = false; + var _loc4_:* = true; + for each(_loc5_ in this._spellLevel.spellZoneEffects) + { + if(!(_loc5_.zoneSize == 0 && _loc5_.zoneShape == 80)) { - if (!((((zoneEffect.zoneSize == 0)) && ((zoneEffect.zoneShape == 80))))) - { - affectOneCharacter = false; - }; - }; - if (((((infiniteRange) && (!(affectOneCharacter)))) || (infiniteZoneEffect))) - { - this._infiniteRange = false; - return; - }; + _loc4_ = false; + } + } + if((_loc2_) && !_loc4_ || (_loc3_)) + { this._infiniteRange = false; - this.setRange(this._spellLevel.minimalRange, this._spellLevel.maximalRange); - } - - private function setRange(minRange:uint, maxRange:uint):void - { - var additionalRange:uint; - var shape:IZoneShape; - this._minRange = minRange; - this._maxRange = maxRange; - this._horizontalCells = ((this._maxRange + 2) + 1); - if (this._spellLevel) + return; + } + this._infiniteRange = false; + this.setRange(this._spellLevel.minimalRange,this._spellLevel.maximalRange); + } + + private function setRange(param1:uint, param2:uint) : void + { + var _loc3_:uint = 0; + var _loc4_:IZoneShape = null; + this._minRange = param1; + this._maxRange = param2; + this._horizontalCells = this._maxRange + 2 + 1; + if(this._spellLevel) + { + _loc3_ = 0; + for each(_loc4_ in this._spellLevel.spellZoneEffects) { - additionalRange = 0; - for each (shape in this._spellLevel.spellZoneEffects) - { - if ((((additionalRange < (shape.zoneSize / 2))) && (!((shape.zoneSize == 63))))) - { - additionalRange = shape.zoneSize; - }; - }; - this._horizontalCells = (this._horizontalCells + additionalRange); - }; - if ((this._horizontalCells % 2) == 0) - { - this._horizontalCells++; - }; - if (this._horizontalCells > 14) + if(_loc3_ < _loc4_.zoneSize / 2 && !(_loc4_.zoneSize == 63)) + { + _loc3_ = _loc4_.zoneSize; + } + } + this._horizontalCells = this._horizontalCells + _loc3_; + } + if(this._horizontalCells % 2 == 0) + { + this._horizontalCells++; + } + if(this._horizontalCells > 14) + { + this._horizontalCells = 14; + } + this._verticalCells = this._horizontalCells * 2 - 1; + if(this._verticalCells > 20) + { + this._verticalCells = 20; + } + this._centerCellId = this.getCenterCellId(this._horizontalCells); + } + + public function removeCells() : void + { + this._spellZoneManager.remove(); + } + + public function get finalized() : Boolean + { + return this._finalized; + } + + public function set finalized(param1:Boolean) : void + { + this._finalized = param1; + } + + public function finalize() : void + { + var _loc1_:String = null; + if(this._infiniteRange) + { + if(this.contains(this._spellZoneManager)) { - this._horizontalCells = 14; - }; - this._verticalCells = ((this._horizontalCells * 2) - 1); - if (this._verticalCells > 20) + removeChild(this._spellZoneManager); + } + if((this._infiniteLabel) && (this.contains(this._infiniteLabel))) { - this._verticalCells = 20; - }; - this._centerCellId = this.getCenterCellId(this._horizontalCells); - } - - public function removeCells():void - { - this._spellZoneManager.remove(); - } - - public function get finalized():Boolean - { - return (this._finalized); - } - - public function set finalized(b:Boolean):void - { - this._finalized = b; - } - - public function finalize():void - { - var infiniteText:String; - if (this._infiniteRange) + return; + } + this._infiniteLabel = new Label(); + this._infiniteLabel.width = this.width; + this._infiniteLabel.multiline = true; + this._infiniteLabel.wordWrap = true; + this._infiniteLabel.css = new Uri("[config.ui.skin]css/normal.css"); + this._infiniteLabel.cssClass = "center"; + _loc1_ = I18n.getUiText("ui.common.infiniteRange"); + this._infiniteLabel.text = _loc1_; + addChild(this._infiniteLabel); + this._infiniteLabel.y = (height - this._infiniteLabel.height) / 2; + } + else + { + if((this._infiniteLabel) && (this.contains(this._infiniteLabel))) { - if (this.contains(this._spellZoneManager)) - { - removeChild(this._spellZoneManager); - }; - if (((this._infiniteLabel) && (this.contains(this._infiniteLabel)))) - { - return; - }; - this._infiniteLabel = new Label(); - this._infiniteLabel.width = this.width; - this._infiniteLabel.multiline = true; - this._infiniteLabel.wordWrap = true; - this._infiniteLabel.css = new Uri("[config.ui.skin]css/normal.css"); - this._infiniteLabel.cssClass = "center"; - infiniteText = I18n.getUiText("ui.common.infiniteRange"); - this._infiniteLabel.text = infiniteText; - addChild(this._infiniteLabel); - this._infiniteLabel.y = ((height - this._infiniteLabel.height) / 2); + removeChild(this._infiniteLabel); } - else + if(!this.contains(this._spellZoneManager)) { - if (((this._infiniteLabel) && (this.contains(this._infiniteLabel)))) - { - removeChild(this._infiniteLabel); - }; - if (!(this.contains(this._spellZoneManager))) - { - addChild(this._spellZoneManager); - }; - this._spellZoneManager.setDisplayZone(__width, __height); - this._cellWidth = (__width / this._horizontalCells); - this._cellHeight = (this._cellWidth / this._cellRatio); - this._spellZoneManager.show(); - this._finalized = true; - getUi().iAmFinalized(this); - }; - } - - override public function remove():void - { - this.removeCells(); - } - - private function getCenterCellId(spellRange:uint):uint - { - var posX:uint = spellRange; - var posY:uint; - var centerCellId:uint = MapPoint.fromCoords(posX, posY).cellId; - return (centerCellId); - } - - - } -}//package com.ankamagames.berilia.components - + addChild(this._spellZoneManager); + } + this._spellZoneManager.setDisplayZone(__width,__height); + this._cellWidth = __width / this._horizontalCells; + this._cellHeight = this._cellWidth / this._cellRatio; + this._spellZoneManager.show(); + this._finalized = true; + getUi().iAmFinalized(this); + } + } + + override public function remove() : void + { + this.removeCells(); + } + + private function getCenterCellId(param1:uint) : uint + { + var _loc2_:uint = param1; + var _loc3_:uint = 0; + var _loc4_:uint = MapPoint.fromCoords(_loc2_,_loc3_).cellId; + return _loc4_; + } + } +} diff --git a/com/ankamagames/berilia/components/SwfApplication.as b/com/ankamagames/berilia/components/SwfApplication.as index b2b823752..978cf346d 100644 --- a/com/ankamagames/berilia/components/SwfApplication.as +++ b/com/ankamagames/berilia/components/SwfApplication.as @@ -1,166 +1,171 @@ -package com.ankamagames.berilia.components +package com.ankamagames.berilia.components { - import com.ankamagames.berilia.types.graphic.GraphicContainer; - import com.ankamagames.berilia.UIComponent; - import flash.display.Loader; - import com.ankamagames.jerakine.types.Uri; - import flash.display.DisplayObject; - import flash.net.URLRequest; - import flash.events.Event; - import flash.events.IOErrorEvent; - import flash.events.MouseEvent; - import flash.events.ProgressEvent; - - public class SwfApplication extends GraphicContainer implements UIComponent - { - - private var _ldr:Loader; - private var _uri:Uri; - private var _app:DisplayObject; - public var loadedHandler:Function; - public var loadErrorHandler:Function; - public var loadProgressHandler:Function; - - public function SwfApplication() - { - mouseEnabled = true; - } - - public function set uri(v:Uri):void - { - if (((!(getUi())) || (!(getUi().uiModule.trusted)))) - { - return; - }; - this._uri = v; - this.initLoader(); - this._ldr.load(new URLRequest(v.normalizedUri)); - } - - public function get uri():Uri - { - return (this._uri); - } - - override public function set width(nW:Number):void - { - super.width = nW; - if (this._app) - { - this._app.width = nW; - }; - } - - override public function set height(nH:Number):void - { - super.height = nH; - if (this._app) - { - this._app.height = nH; - }; - } - - override public function remove():void - { + import com.ankamagames.berilia.types.graphic.GraphicContainer; + import com.ankamagames.berilia.UIComponent; + import flash.display.Loader; + import com.ankamagames.jerakine.types.Uri; + import flash.display.DisplayObject; + import flash.net.URLRequest; + import flash.events.Event; + import flash.events.IOErrorEvent; + import flash.events.MouseEvent; + import flash.events.ProgressEvent; + + public class SwfApplication extends GraphicContainer implements UIComponent + { + + public function SwfApplication() + { + super(); + mouseEnabled = true; + } + + private var _ldr:Loader; + + private var _uri:Uri; + + private var _app:DisplayObject; + + public function set uri(param1:Uri) : void + { + if(!getUi() || !getUi().uiModule.trusted) + { + return; + } + this._uri = param1; + this.initLoader(); + this._ldr.load(new URLRequest(param1.normalizedUri)); + } + + public function get uri() : Uri + { + return this._uri; + } + + public var loadedHandler:Function; + + public var loadErrorHandler:Function; + + public var loadProgressHandler:Function; + + override public function set width(param1:Number) : void + { + super.width = param1; + if(this._app) + { + this._app.width = param1; + } + } + + override public function set height(param1:Number) : void + { + super.height = param1; + if(this._app) + { + this._app.height = param1; + } + } + + override public function remove() : void + { + this.clearLoader(); + if((this._ldr) && (this._ldr.contentLoaderInfo)) + { + this._ldr.contentLoaderInfo.removeEventListener(Event.INIT,this.onInit); + this._ldr.contentLoaderInfo.removeEventListener(IOErrorEvent.IO_ERROR,this.onError); + } + if(this._app) + { + this._app.removeEventListener(MouseEvent.MOUSE_MOVE,this.onMouseMouse); + } + this._ldr = null; + this.loadedHandler = null; + this.loadErrorHandler = null; + } + + public function bindApi(param1:String, param2:*) : Boolean + { + var propertyName:String = param1; + var value:* = param2; + if(!getUi() || !getUi().uiModule.trusted) + { + return false; + } + if(!this._app) + { + return false; + } + try + { + this._app[propertyName] = value; + } + catch(e:Error) + { + return false; + } + return true; + } + + private function initLoader() : void + { + if(!this._ldr) + { + this._ldr = new Loader(); + this._ldr.contentLoaderInfo.addEventListener(Event.INIT,this.onInit); + this._ldr.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS,this.onProgress); + this._ldr.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR,this.onError); + } + else + { this.clearLoader(); - if (((this._ldr) && (this._ldr.contentLoaderInfo))) - { - this._ldr.contentLoaderInfo.removeEventListener(Event.INIT, this.onInit); - this._ldr.contentLoaderInfo.removeEventListener(IOErrorEvent.IO_ERROR, this.onError); - }; - if (this._app) - { - this._app.removeEventListener(MouseEvent.MOUSE_MOVE, this.onMouseMouse); - }; - this._ldr = null; - this.loadedHandler = null; - this.loadErrorHandler = null; - } - - public function bindApi(propertyName:String, value:*):Boolean - { - if (((!(getUi())) || (!(getUi().uiModule.trusted)))) - { - return (false); - }; - if (!(this._app)) - { - return (false); - }; - try - { - this._app[propertyName] = value; - } - catch(e:Error) - { - return (false); - }; - return (true); - } - - private function initLoader():void - { - if (!(this._ldr)) - { - this._ldr = new Loader(); - this._ldr.contentLoaderInfo.addEventListener(Event.INIT, this.onInit); - this._ldr.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, this.onProgress); - this._ldr.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, this.onError); - } - else - { - this.clearLoader(); - }; - } - - private function clearLoader():void - { - if (this._ldr) - { - this._ldr.unloadAndStop(); - }; - while (numChildren) - { - removeChildAt(0); - }; - } - - private function onInit(e:Event):void - { - this._app = this._ldr.content; - this._app.width = width; - this._app.height = height; - addChild(this._app); - this._app.addEventListener(MouseEvent.MOUSE_MOVE, this.onMouseMouse); - if (this.loadedHandler != null) - { - this.loadedHandler(this); - }; - } - - private function onMouseMouse(e:MouseEvent):void - { - stage.dispatchEvent(e); - } - - private function onProgress(e:ProgressEvent):void - { - if (this.loadProgressHandler != null) - { - this.loadProgressHandler(this, e); - }; - } - - private function onError(e:Event):void - { - this.clearLoader(); - if (this.loadErrorHandler != null) - { - this.loadErrorHandler(this, e); - }; - } - - - } -}//package com.ankamagames.berilia.components - + } + } + + private function clearLoader() : void + { + if(this._ldr) + { + this._ldr.unloadAndStop(); + } + while(numChildren) + { + removeChildAt(0); + } + } + + private function onInit(param1:Event) : void + { + this._app = this._ldr.content; + this._app.width = width; + this._app.height = height; + addChild(this._app); + this._app.addEventListener(MouseEvent.MOUSE_MOVE,this.onMouseMouse); + if(this.loadedHandler != null) + { + this.loadedHandler(this); + } + } + + private function onMouseMouse(param1:MouseEvent) : void + { + stage.dispatchEvent(param1); + } + + private function onProgress(param1:ProgressEvent) : void + { + if(this.loadProgressHandler != null) + { + this.loadProgressHandler(this,param1); + } + } + + private function onError(param1:Event) : void + { + this.clearLoader(); + if(this.loadErrorHandler != null) + { + this.loadErrorHandler(this,param1); + } + } + } +} diff --git a/com/ankamagames/berilia/components/TabSet.as b/com/ankamagames/berilia/components/TabSet.as index 8ecc491ab..958245a52 100644 --- a/com/ankamagames/berilia/components/TabSet.as +++ b/com/ankamagames/berilia/components/TabSet.as @@ -1,703 +1,729 @@ -package com.ankamagames.berilia.components +package com.ankamagames.berilia.components { - import com.ankamagames.berilia.types.graphic.GraphicContainer; - import com.ankamagames.berilia.FinalizableUIComponent; - import com.ankamagames.jerakine.logger.Logger; - import com.ankamagames.jerakine.logger.Log; - import flash.utils.getQualifiedClassName; - import com.ankamagames.berilia.types.graphic.UiRootContainer; - import com.ankamagames.berilia.types.graphic.ButtonContainer; - import com.ankamagames.jerakine.types.Uri; - import com.ankamagames.berilia.managers.UIEventManager; - import com.ankamagames.berilia.components.messages.SelectItemMessage; - import com.ankamagames.berilia.Berilia; - import com.ankamagames.berilia.types.graphic.GraphicElement; - import com.ankamagames.berilia.enums.StatesEnum; - import com.ankamagames.jerakine.handlers.messages.mouse.MouseClickMessage; - import com.ankamagames.jerakine.handlers.messages.mouse.MouseRightClickMessage; - import com.ankamagames.jerakine.handlers.messages.keyboard.KeyboardKeyUpMessage; - import com.ankamagames.berilia.components.messages.RenameTabMessage; - import com.ankamagames.berilia.components.messages.CreateTabMessage; - import com.ankamagames.berilia.components.messages.DeleteTabMessage; - import flash.ui.Keyboard; - import com.ankamagames.jerakine.messages.Message; - - public class TabSet extends GraphicContainer implements FinalizableUIComponent - { - - protected static const _log:Logger = Log.getLogger(getQualifiedClassName(TabSet)); - - private var _nSelected:int = -1; - private var _nPreviousSelected:int = -1; - private var _nNbTabs:uint = 0; - private var _nTotalWidth:uint = 0; - private var _nNbTabsRequired:uint; - private var _nCurrentMaxIndex:uint = 0; - private var _aTabsList:Array; - private var _aCtrs:Array; - private var _aCloses:Array; - private var _aLbls:Array; - private var _aInputs:Array; - private var _uiClass:UiRootContainer; - private var _tabCtr:GraphicContainer; - private var _btnPlus:ButtonContainer; - private var _sBgTextureUri:Uri; - private var _sCloseTextureUri:Uri; - private var _sPlusTextureUri:Uri; - private var _sTabCss:Uri; - private var _nWidthTab:int; - private var _nWidthLabel:int; - private var _nHeightLabel:int; - private var _nWidthPlusTab:int; - private var _nXCloseTab:int; - private var _nYCloseTab:int; - private var _nXPlusTab:int; - private var _nYPlusTab:int; - private var _nXLabelTab:int; - private var _nYLabelTab:int; - private var _finalized:Boolean = false; - private var _bNameEdition:Boolean = false; - - public function TabSet() - { - this._aTabsList = new Array(); - this._aCtrs = new Array(); - this._aCloses = new Array(); - this._aLbls = new Array(); - this._aInputs = new Array(); - this._tabCtr = new GraphicContainer(); - this._tabCtr.width = __width; - this._tabCtr.height = __height; - addChild(this._tabCtr); - } - - public function get widthTab():int - { - return (this._nWidthTab); - } - - public function set widthTab(i:int):void - { - this._nWidthTab = i; - } - - public function get widthLabel():int - { - return (this._nWidthLabel); - } - - public function set widthLabel(i:int):void - { - this._nWidthLabel = i; - } - - public function get heightLabel():int - { - return (this._nHeightLabel); - } - - public function set heightLabel(i:int):void - { - this._nHeightLabel = i; - } - - public function get widthPlusTab():int - { - return (this._nWidthPlusTab); - } - - public function set widthPlusTab(i:int):void - { - this._nWidthPlusTab = i; - } - - public function get tabUri():Uri - { - return (this._sBgTextureUri); - } - - public function set tabUri(s:Uri):void - { - this._sBgTextureUri = s; - } - - public function get closeUri():Uri - { - return (this._sCloseTextureUri); - } - - public function set closeUri(s:Uri):void - { - this._sCloseTextureUri = s; - } - - public function get plusUri():Uri - { - return (this._sPlusTextureUri); - } - - public function set plusUri(s:Uri):void - { - this._sPlusTextureUri = s; - } - - public function get cssUri():Uri - { - return (this._sTabCss); - } - - public function set cssUri(s:Uri):void - { - this._sTabCss = s; - } - - public function get xClose():int - { - return (this._nXCloseTab); - } - - public function set xClose(i:int):void - { - this._nXCloseTab = i; - } - - public function get yClose():int - { - return (this._nYCloseTab); - } - - public function set yClose(i:int):void - { - this._nYCloseTab = i; - } - - public function get xLabel():int - { - return (this._nXLabelTab); - } - - public function set xLabel(i:int):void - { - this._nXLabelTab = i; - } - - public function get yLabel():int - { - return (this._nYLabelTab); - } - - public function set yLabel(i:int):void - { - this._nYLabelTab = i; - } - - public function get xPlus():int - { - return (this._nXPlusTab); - } - - public function set xPlus(i:int):void - { - this._nXPlusTab = i; - } - - public function get yPlus():int - { - return (this._nYPlusTab); - } - - public function set yPlus(i:int):void - { - this._nYPlusTab = i; - } - - public function get length():int - { - return (this._nNbTabs); - } - - public function set length(i:int):void - { - this._nNbTabsRequired = i; - if (((this._btnPlus) && ((this._nNbTabsRequired >= 1)))) + import com.ankamagames.berilia.types.graphic.GraphicContainer; + import com.ankamagames.berilia.FinalizableUIComponent; + import com.ankamagames.jerakine.logger.Logger; + import com.ankamagames.jerakine.logger.Log; + import flash.utils.getQualifiedClassName; + import com.ankamagames.berilia.types.graphic.UiRootContainer; + import com.ankamagames.berilia.types.graphic.ButtonContainer; + import com.ankamagames.jerakine.types.Uri; + import com.ankamagames.berilia.managers.UIEventManager; + import com.ankamagames.berilia.components.messages.SelectItemMessage; + import com.ankamagames.berilia.Berilia; + import com.ankamagames.berilia.types.graphic.GraphicElement; + import com.ankamagames.berilia.enums.StatesEnum; + import com.ankamagames.jerakine.messages.Message; + import com.ankamagames.jerakine.handlers.messages.mouse.MouseClickMessage; + import com.ankamagames.jerakine.handlers.messages.mouse.MouseRightClickMessage; + import com.ankamagames.jerakine.handlers.messages.keyboard.KeyboardKeyUpMessage; + import com.ankamagames.berilia.components.messages.RenameTabMessage; + import com.ankamagames.berilia.components.messages.CreateTabMessage; + import com.ankamagames.berilia.components.messages.DeleteTabMessage; + import flash.ui.Keyboard; + + public class TabSet extends GraphicContainer implements FinalizableUIComponent + { + + public function TabSet() + { + super(); + this._aTabsList = new Array(); + this._aCtrs = new Array(); + this._aCloses = new Array(); + this._aLbls = new Array(); + this._aInputs = new Array(); + this._tabCtr = new GraphicContainer(); + this._tabCtr.width = __width; + this._tabCtr.height = __height; + addChild(this._tabCtr); + } + + protected static const _log:Logger = Log.getLogger(getQualifiedClassName(TabSet)); + + private var _nSelected:int = -1; + + private var _nPreviousSelected:int = -1; + + private var _nNbTabs:uint = 0; + + private var _nTotalWidth:uint = 0; + + private var _nNbTabsRequired:uint; + + private var _nCurrentMaxIndex:uint = 0; + + private var _aTabsList:Array; + + private var _aCtrs:Array; + + private var _aCloses:Array; + + private var _aLbls:Array; + + private var _aInputs:Array; + + private var _uiClass:UiRootContainer; + + private var _tabCtr:GraphicContainer; + + private var _btnPlus:ButtonContainer; + + private var _sBgTextureUri:Uri; + + private var _sCloseTextureUri:Uri; + + private var _sPlusTextureUri:Uri; + + private var _sTabCss:Uri; + + private var _nWidthTab:int; + + private var _nWidthLabel:int; + + private var _nHeightLabel:int; + + private var _nWidthPlusTab:int; + + private var _nXCloseTab:int; + + private var _nYCloseTab:int; + + private var _nXPlusTab:int; + + private var _nYPlusTab:int; + + private var _nXLabelTab:int; + + private var _nYLabelTab:int; + + private var _finalized:Boolean = false; + + private var _bNameEdition:Boolean = false; + + public function get widthTab() : int + { + return this._nWidthTab; + } + + public function set widthTab(param1:int) : void + { + this._nWidthTab = param1; + } + + public function get widthLabel() : int + { + return this._nWidthLabel; + } + + public function set widthLabel(param1:int) : void + { + this._nWidthLabel = param1; + } + + public function get heightLabel() : int + { + return this._nHeightLabel; + } + + public function set heightLabel(param1:int) : void + { + this._nHeightLabel = param1; + } + + public function get widthPlusTab() : int + { + return this._nWidthPlusTab; + } + + public function set widthPlusTab(param1:int) : void + { + this._nWidthPlusTab = param1; + } + + public function get tabUri() : Uri + { + return this._sBgTextureUri; + } + + public function set tabUri(param1:Uri) : void + { + this._sBgTextureUri = param1; + } + + public function get closeUri() : Uri + { + return this._sCloseTextureUri; + } + + public function set closeUri(param1:Uri) : void + { + this._sCloseTextureUri = param1; + } + + public function get plusUri() : Uri + { + return this._sPlusTextureUri; + } + + public function set plusUri(param1:Uri) : void + { + this._sPlusTextureUri = param1; + } + + public function get cssUri() : Uri + { + return this._sTabCss; + } + + public function set cssUri(param1:Uri) : void + { + this._sTabCss = param1; + } + + public function get xClose() : int + { + return this._nXCloseTab; + } + + public function set xClose(param1:int) : void + { + this._nXCloseTab = param1; + } + + public function get yClose() : int + { + return this._nYCloseTab; + } + + public function set yClose(param1:int) : void + { + this._nYCloseTab = param1; + } + + public function get xLabel() : int + { + return this._nXLabelTab; + } + + public function set xLabel(param1:int) : void + { + this._nXLabelTab = param1; + } + + public function get yLabel() : int + { + return this._nYLabelTab; + } + + public function set yLabel(param1:int) : void + { + this._nYLabelTab = param1; + } + + public function get xPlus() : int + { + return this._nXPlusTab; + } + + public function set xPlus(param1:int) : void + { + this._nXPlusTab = param1; + } + + public function get yPlus() : int + { + return this._nYPlusTab; + } + + public function set yPlus(param1:int) : void + { + this._nYPlusTab = param1; + } + + public function get length() : int + { + return this._nNbTabs; + } + + public function set length(param1:int) : void + { + this._nNbTabsRequired = param1; + if((this._btnPlus) && this._nNbTabsRequired >= 1) + { + if(this._nNbTabsRequired > this._nNbTabs) { - if (this._nNbTabsRequired > this._nNbTabs) - { - while (this._nNbTabsRequired > this._nNbTabs) - { - this.addTab(); - }; - }; - if (this._nNbTabsRequired < this._nNbTabs) - { - while (this._nNbTabsRequired < this._nNbTabs) - { - this.removeTab(); - }; - }; - }; - } - - public function get tabCtr():GraphicContainer - { - return (this._tabCtr); - } - - public function set tabCtr(ctr:GraphicContainer):void - { - this._tabCtr = ctr; - } - - public function get selectedTab():int - { - return (this._nSelected); - } - - public function set selectedTab(i:int):void - { - if (!(this._aCtrs[i])) - { - if (i < 0) - { - this.selectedTab = ++i; - } - else - { - this.selectedTab = --i; - }; - }; - this._nPreviousSelected = this._nSelected; - this._nSelected = i; - if (((!((this._nPreviousSelected == -1))) && (this._aCtrs[this._nPreviousSelected]))) - { - this._aCtrs[this._nPreviousSelected].selected = false; - this._aCloses[this._nPreviousSelected].visible = false; - this._aLbls[this._nPreviousSelected].cssClass = "p"; - }; - if (this._nSelected != -1) - { - this._aCtrs[this._nSelected].selected = false; - this._aCtrs[this._nSelected].selected = true; - this._aCloses[this._nSelected].visible = true; - }; - if (UIEventManager.getInstance().isRegisteredInstance(this, SelectItemMessage)) - { - Berilia.getInstance().handler.process(new SelectItemMessage(this, this._aCtrs[this._nSelected])); - }; - } - - public function get lastTab():int - { - return ((this._nNbTabs - 1)); - } - - public function set dataProvider(data:*):void - { - if (!(this.isIterable(data))) - { - throw (new ArgumentError("dataProvider must be either Array or Vector.")); - }; - this._aTabsList = data; - this.finalize(); - } - - public function get dataProvider() - { - return (this._aTabsList); - } - - public function get finalized():Boolean - { - return (this._finalized); - } - - public function set finalized(b:Boolean):void - { - this._finalized = b; - } - - public function finalize():void - { - this._uiClass = getUi(); - if (((this._aTabsList) && ((this._aTabsList.length > 0)))) - { - this._nNbTabs = this._aTabsList.length; - if (this._nNbTabs > 0) - { - this.tabsDisplay(); - }; + while(this._nNbTabsRequired > this._nNbTabs) + { + this.addTab(); + } } - else - { - this.tabsDisplay(); - }; - this._finalized = true; - if (this._uiClass) - { - this._uiClass.iAmFinalized(this); - }; - } - - override public function remove():void - { - if (!(__removed)) - { - this._uiClass = null; - this._tabCtr.remove(); - this._btnPlus.remove(); - this._tabCtr = null; - this._btnPlus = null; - }; - super.remove(); - } - - public function highlight(tabId:uint, show:Boolean=true):void - { - if (show) + if(this._nNbTabsRequired < this._nNbTabs) { - this._aLbls[tabId].cssClass = "highlighted"; + while(this._nNbTabsRequired < this._nNbTabs) + { + this.removeTab(); + } } - else - { - this._aLbls[tabId].cssClass = "p"; - }; - } - - public function renameTab(tabId:uint, name:String=null):void - { - this._aInputs[this._nSelected].text = ""; - this._aLbls[tabId].caretIndex = 0; - if (tabId >= this._nCurrentMaxIndex) + } + } + + public function get tabCtr() : GraphicContainer + { + return this._tabCtr; + } + + public function set tabCtr(param1:GraphicContainer) : void + { + this._tabCtr = param1; + } + + public function get selectedTab() : int + { + return this._nSelected; + } + + public function set selectedTab(param1:int) : void + { + if(!this._aCtrs[param1]) + { + if(param1 < 0) { - return; - }; - if (this._aCtrs[tabId].selected) - { - this._aCtrs[tabId].selected = false; - this._aLbls[tabId].text = name; - this._aCtrs[tabId].reset(); - this._aCtrs[tabId].selected = true; + this.selectedTab = ++param1; } else { - this._aLbls[tabId].text = name; - this._aCtrs[tabId].reset(); - }; - } - - private function tabsDisplay():void - { - this.addPlusTab(); - this.addTab(); - this.length = this._nNbTabsRequired; - this.selectedTab = 0; - } - - private function addTab():void - { - var btn:ButtonContainer = new ButtonContainer(); - btn.soundId = "16009"; - btn.width = this._nWidthTab; - btn.height = __height; - btn.name = ("btn_tab" + this._nCurrentMaxIndex); - var texBg:Texture = new Texture(); - texBg.width = this._nWidthTab; - texBg.height = __height; - texBg.autoGrid = true; - texBg.uri = this._sBgTextureUri; - texBg.name = ("tx_bgTab" + this._nCurrentMaxIndex); - texBg.finalize(); - var lbl:Label = new Label(); - lbl.width = this._nWidthLabel; - lbl.height = this._nHeightLabel; - lbl.x = this._nXLabelTab; - lbl.y = this._nYLabelTab; - lbl.css = this._sTabCss; - lbl.cssClass = "p"; - lbl.name = ("lbl_tab" + this._nCurrentMaxIndex); - lbl.text = ("tab " + (this._nCurrentMaxIndex + 1)); - var inp:Input = new Input(); - inp.width = this._nWidthLabel; - inp.height = this._nHeightLabel; - inp.x = this._nXLabelTab; - inp.y = this._nYLabelTab; - inp.css = this._sTabCss; - inp.cssClass = "p"; - inp.name = ("inp_tab" + this._nCurrentMaxIndex); - btn.addChild(texBg); - btn.addChild(lbl); - btn.addChild(inp); - getUi().registerId(btn.name, new GraphicElement(btn, new Array(), btn.name)); - getUi().registerId(texBg.name, new GraphicElement(texBg, new Array(), texBg.name)); - getUi().registerId(lbl.name, new GraphicElement(lbl, new Array(), lbl.name)); - getUi().registerId(inp.name, new GraphicElement(inp, new Array(), inp.name)); - var stateChangingProperties:Array = new Array(); - stateChangingProperties[StatesEnum.STATE_OVER] = new Array(); - stateChangingProperties[StatesEnum.STATE_OVER][texBg.name] = new Array(); - stateChangingProperties[StatesEnum.STATE_OVER][texBg.name]["gotoAndStop"] = StatesEnum.STATE_OVER_STRING.toLocaleLowerCase(); - stateChangingProperties[StatesEnum.STATE_CLICKED] = new Array(); - stateChangingProperties[StatesEnum.STATE_CLICKED][texBg.name] = new Array(); - stateChangingProperties[StatesEnum.STATE_CLICKED][texBg.name]["gotoAndStop"] = StatesEnum.STATE_CLICKED_STRING.toLocaleLowerCase(); - stateChangingProperties[StatesEnum.STATE_SELECTED] = new Array(); - stateChangingProperties[StatesEnum.STATE_SELECTED][texBg.name] = new Array(); - stateChangingProperties[StatesEnum.STATE_SELECTED][texBg.name]["gotoAndStop"] = StatesEnum.STATE_SELECTED_STRING.toLocaleLowerCase(); - stateChangingProperties[StatesEnum.STATE_SELECTED][lbl.name] = new Array(); - stateChangingProperties[StatesEnum.STATE_SELECTED][lbl.name]["cssClass"] = "selected"; - btn.changingStateData = stateChangingProperties; - btn.finalize(); - var btnClose:ButtonContainer = new ButtonContainer(); - btnClose.x = this._nXCloseTab; - btnClose.y = this._nYCloseTab; - btnClose.width = this._nWidthPlusTab; - btnClose.height = __height; - btnClose.name = ("btn_closeTab" + this._nCurrentMaxIndex); - var texClose:Texture = new Texture(); - texClose.uri = this._sCloseTextureUri; - texClose.name = ("tx_closeTab" + this._nCurrentMaxIndex); - texClose.finalize(); - btnClose.addChild(texClose); - getUi().registerId(btnClose.name, new GraphicElement(btnClose, new Array(), btnClose.name)); - getUi().registerId(texClose.name, new GraphicElement(texClose, new Array(), texClose.name)); - var stateChangingPropertiesClose:Array = new Array(); - stateChangingPropertiesClose[StatesEnum.STATE_OVER] = new Array(); - stateChangingPropertiesClose[StatesEnum.STATE_OVER][texClose.name] = new Array(); - stateChangingPropertiesClose[StatesEnum.STATE_OVER][texClose.name]["gotoAndStop"] = StatesEnum.STATE_OVER_STRING.toLocaleLowerCase(); - stateChangingPropertiesClose[StatesEnum.STATE_CLICKED] = new Array(); - stateChangingPropertiesClose[StatesEnum.STATE_CLICKED][texClose.name] = new Array(); - stateChangingPropertiesClose[StatesEnum.STATE_CLICKED][texClose.name]["gotoAndStop"] = StatesEnum.STATE_CLICKED_STRING.toLocaleLowerCase(); - btnClose.changingStateData = stateChangingPropertiesClose; - btnClose.finalize(); - btnClose.visible = false; - this._tabCtr.addChild(btn); - this._tabCtr.addChild(btnClose); - this._aCtrs[this._nNbTabs] = btn; - this._aCloses[this._nNbTabs] = btnClose; - this._aLbls[this._nNbTabs] = lbl; - this._aInputs[this._nNbTabs] = inp; - this._nTotalWidth = (this._nTotalWidth + this._nWidthTab); - this._nCurrentMaxIndex++; - this.replaceTab(); - } - - private function addPlusTab():void - { - this._btnPlus = new ButtonContainer(); - this._btnPlus.soundId = "16090"; - this._btnPlus.width = this._nWidthPlusTab; - this._btnPlus.height = __height; - this._btnPlus.name = "btn_plus"; - var texBgPlus:Texture = new Texture(); - texBgPlus.width = this._nWidthPlusTab; - texBgPlus.height = __height; - texBgPlus.autoGrid = true; - texBgPlus.uri = this._sBgTextureUri; - texBgPlus.name = "tx_bgPlus"; - texBgPlus.finalize(); - var texPlus:Texture = new Texture(); - texPlus.x = this._nXPlusTab; - texPlus.y = this._nYPlusTab; - texPlus.uri = this._sPlusTextureUri; - texPlus.name = "tx_plus"; - texPlus.finalize(); - this._btnPlus.addChild(texBgPlus); - this._btnPlus.addChild(texPlus); - getUi().registerId(this._btnPlus.name, new GraphicElement(this._btnPlus, new Array(), this._btnPlus.name)); - getUi().registerId(texBgPlus.name, new GraphicElement(texBgPlus, new Array(), texBgPlus.name)); - getUi().registerId(texPlus.name, new GraphicElement(texPlus, new Array(), texPlus.name)); - addChild(this._btnPlus); - var stateChangingProperties:Array = new Array(); - stateChangingProperties[StatesEnum.STATE_OVER] = new Array(); - stateChangingProperties[StatesEnum.STATE_OVER][texBgPlus.name] = new Array(); - stateChangingProperties[StatesEnum.STATE_OVER][texBgPlus.name]["gotoAndStop"] = StatesEnum.STATE_OVER_STRING.toLocaleLowerCase(); - stateChangingProperties[StatesEnum.STATE_OVER][texPlus.name] = new Array(); - stateChangingProperties[StatesEnum.STATE_OVER][texPlus.name]["gotoAndStop"] = StatesEnum.STATE_OVER_STRING.toLocaleLowerCase(); - stateChangingProperties[StatesEnum.STATE_CLICKED] = new Array(); - stateChangingProperties[StatesEnum.STATE_CLICKED][texBgPlus.name] = new Array(); - stateChangingProperties[StatesEnum.STATE_CLICKED][texBgPlus.name]["gotoAndStop"] = StatesEnum.STATE_CLICKED_STRING.toLocaleLowerCase(); - stateChangingProperties[StatesEnum.STATE_CLICKED][texPlus.name] = new Array(); - stateChangingProperties[StatesEnum.STATE_CLICKED][texPlus.name]["gotoAndStop"] = StatesEnum.STATE_CLICKED_STRING.toLocaleLowerCase(); - this._btnPlus.changingStateData = stateChangingProperties; - this._btnPlus.finalize(); - this._nTotalWidth = (this._nTotalWidth + this._nWidthPlusTab); - } - - private function removeTab():void - { - var indexAlmostRemoved:int; - if (this._nNbTabs > 1) - { - indexAlmostRemoved = this._nSelected; - this._nPreviousSelected = (indexAlmostRemoved - 1); - this.removeContainerContent(this._aCtrs[indexAlmostRemoved]); - this._aCtrs.splice(indexAlmostRemoved, 1); - this.removeContainerContent(this._aCloses[indexAlmostRemoved]); - this._aCloses.splice(indexAlmostRemoved, 1); - this._aLbls.splice(indexAlmostRemoved, 1); - this._nTotalWidth = (this._nTotalWidth - this._nWidthTab); - this.replaceTab(); - this.selectedTab = this._nPreviousSelected; - }; - } - - private function replaceTab():void - { - var index:*; - var currentPos:int; - for (index in this._aCtrs) - { - this._aCtrs[index].state = 0; - this._aCtrs[index].x = currentPos; - this._aCloses[index].x = (currentPos + this._nXCloseTab); - this._aCtrs[index].reset(); - currentPos = (currentPos + this._aCtrs[index].width); - }; - this._btnPlus.x = currentPos; - if (this._nSelected == -1) - { - this.selectedTab = index; - }; - this._nNbTabs = this._aCtrs.length; - if ((this._nTotalWidth + this._nWidthTab) < __width) - { - this._btnPlus.visible = true; + this.selectedTab = --param1; } - else - { - this._btnPlus.visible = false; - }; - } - - private function isIterable(obj:*):Boolean - { - if ((obj is Array)) - { - return (true); - }; - if (((((((((!((obj["length"] == null))) && (!((obj["length"] == 0))))) && (!(isNaN(obj["length"]))))) && (!((obj[0] == null))))) && (!((obj is String))))) - { - return (true); - }; - return (false); - } - - private function removeContainerContent(target:GraphicContainer):void - { - target.remove(); - } - - private function switchToEdition(value:Boolean):void - { - this._bNameEdition = value; - if (value) - { - this._aInputs[this._nSelected].text = this._aLbls[this._nSelected].text; - this._aInputs[this._nSelected].focus(); - this._aInputs[this._nSelected].setSelection(0, this._aInputs[this._nSelected].text.length); - }; - this._aInputs[this._nSelected].disabled = !(value); - this._aInputs[this._nSelected].visible = value; - this._aLbls[this._nSelected].visible = !(value); - } - - [HideInFakeClass] - override public function process(msg:Message):Boolean - { - var _local_2:MouseClickMessage; - var _local_3:MouseRightClickMessage; - var _local_4:KeyboardKeyUpMessage; - var name:String; - var i:*; - var nameEdition:String; - switch (true) + } + this._nPreviousSelected = this._nSelected; + this._nSelected = param1; + if(!(this._nPreviousSelected == -1) && (this._aCtrs[this._nPreviousSelected])) + { + this._aCtrs[this._nPreviousSelected].selected = false; + this._aCloses[this._nPreviousSelected].visible = false; + this._aLbls[this._nPreviousSelected].cssClass = "p"; + } + if(this._nSelected != -1) + { + this._aCtrs[this._nSelected].selected = false; + this._aCtrs[this._nSelected].selected = true; + this._aCloses[this._nSelected].visible = true; + } + if(UIEventManager.getInstance().isRegisteredInstance(this,SelectItemMessage)) + { + Berilia.getInstance().handler.process(new SelectItemMessage(this,this._aCtrs[this._nSelected])); + } + } + + public function get lastTab() : int + { + return this._nNbTabs - 1; + } + + public function set dataProvider(param1:*) : void + { + if(!this.isIterable(param1)) + { + throw new ArgumentError("dataProvider must be either Array or Vector."); + } + else + { + this._aTabsList = param1; + this.finalize(); + return; + } + } + + public function get dataProvider() : * + { + return this._aTabsList; + } + + public function get finalized() : Boolean + { + return this._finalized; + } + + public function set finalized(param1:Boolean) : void + { + this._finalized = param1; + } + + public function finalize() : void + { + this._uiClass = getUi(); + if((this._aTabsList) && this._aTabsList.length > 0) + { + this._nNbTabs = this._aTabsList.length; + if(this._nNbTabs > 0) { - case (msg is MouseClickMessage): - _local_2 = (msg as MouseClickMessage); - if (this._bNameEdition) - { - this._bNameEdition = false; - name = this._aInputs[this._nSelected].text; - this.renameTab(this._nSelected, name); - if (UIEventManager.getInstance().isRegisteredInstance(this, RenameTabMessage)) - { - Berilia.getInstance().handler.process(new RenameTabMessage(this, this._nSelected, name)); - }; - }; - switch (_local_2.target.name) - { - case this._btnPlus.name: - if ((this._nTotalWidth + this._nWidthTab) < __width) - { - this.addTab(); - this.selectedTab = (this._nNbTabs - 1); - if (UIEventManager.getInstance().isRegisteredInstance(this, CreateTabMessage)) - { - Berilia.getInstance().handler.process(new CreateTabMessage(this)); - }; - }; - break; - default: - for (i in this._aCtrs) - { - if (_local_2.target == this._aCtrs[i]) - { - this.selectedTab = i; - }; - }; - if (_local_2.target == this._aCloses[this._nSelected]) - { - if (this._nNbTabs > 1) - { - if (UIEventManager.getInstance().isRegisteredInstance(this, DeleteTabMessage)) - { - Berilia.getInstance().handler.process(new DeleteTabMessage(this, this._nSelected)); - }; - this.removeTab(); - }; - }; - }; - break; - case (msg is MouseRightClickMessage): - _local_3 = (msg as MouseRightClickMessage); - if ((((_local_3.target == this._aCtrs[this._nSelected])) && (!(this._bNameEdition)))) - { - this.switchToEdition(true); - } - else - { - if (this._bNameEdition) + this.tabsDisplay(); + } + } + else + { + this.tabsDisplay(); + } + this._finalized = true; + if(this._uiClass) + { + this._uiClass.iAmFinalized(this); + } + } + + override public function remove() : void + { + if(!__removed) + { + this._uiClass = null; + this._tabCtr.remove(); + this._btnPlus.remove(); + this._tabCtr = null; + this._btnPlus = null; + } + super.remove(); + } + + public function highlight(param1:uint, param2:Boolean = true) : void + { + if(param2) + { + this._aLbls[param1].cssClass = "highlighted"; + } + else + { + this._aLbls[param1].cssClass = "p"; + } + } + + public function renameTab(param1:uint, param2:String = null) : void + { + this._aInputs[this._nSelected].text = ""; + this._aLbls[param1].caretIndex = 0; + if(param1 >= this._nCurrentMaxIndex) + { + return; + } + if(this._aCtrs[param1].selected) + { + this._aCtrs[param1].selected = false; + this._aLbls[param1].text = param2; + this._aCtrs[param1].reset(); + this._aCtrs[param1].selected = true; + } + else + { + this._aLbls[param1].text = param2; + this._aCtrs[param1].reset(); + } + } + + private function tabsDisplay() : void + { + this.addPlusTab(); + this.addTab(); + this.length = this._nNbTabsRequired; + this.selectedTab = 0; + } + + private function addTab() : void + { + var _loc1_:ButtonContainer = new ButtonContainer(); + _loc1_.soundId = "16009"; + _loc1_.width = this._nWidthTab; + _loc1_.height = __height; + _loc1_.name = "btn_tab" + this._nCurrentMaxIndex; + var _loc2_:Texture = new Texture(); + _loc2_.width = this._nWidthTab; + _loc2_.height = __height; + _loc2_.autoGrid = true; + _loc2_.uri = this._sBgTextureUri; + _loc2_.name = "tx_bgTab" + this._nCurrentMaxIndex; + _loc2_.finalize(); + var _loc3_:Label = new Label(); + _loc3_.width = this._nWidthLabel; + _loc3_.height = this._nHeightLabel; + _loc3_.x = this._nXLabelTab; + _loc3_.y = this._nYLabelTab; + _loc3_.css = this._sTabCss; + _loc3_.cssClass = "p"; + _loc3_.name = "lbl_tab" + this._nCurrentMaxIndex; + _loc3_.text = "tab " + (this._nCurrentMaxIndex + 1); + var _loc4_:Input = new Input(); + _loc4_.width = this._nWidthLabel; + _loc4_.height = this._nHeightLabel; + _loc4_.x = this._nXLabelTab; + _loc4_.y = this._nYLabelTab; + _loc4_.css = this._sTabCss; + _loc4_.cssClass = "p"; + _loc4_.name = "inp_tab" + this._nCurrentMaxIndex; + _loc1_.addChild(_loc2_); + _loc1_.addChild(_loc3_); + _loc1_.addChild(_loc4_); + getUi().registerId(_loc1_.name,new GraphicElement(_loc1_,new Array(),_loc1_.name)); + getUi().registerId(_loc2_.name,new GraphicElement(_loc2_,new Array(),_loc2_.name)); + getUi().registerId(_loc3_.name,new GraphicElement(_loc3_,new Array(),_loc3_.name)); + getUi().registerId(_loc4_.name,new GraphicElement(_loc4_,new Array(),_loc4_.name)); + var _loc5_:Array = new Array(); + _loc5_[StatesEnum.STATE_OVER] = new Array(); + _loc5_[StatesEnum.STATE_OVER][_loc2_.name] = new Array(); + _loc5_[StatesEnum.STATE_OVER][_loc2_.name]["gotoAndStop"] = StatesEnum.STATE_OVER_STRING.toLocaleLowerCase(); + _loc5_[StatesEnum.STATE_CLICKED] = new Array(); + _loc5_[StatesEnum.STATE_CLICKED][_loc2_.name] = new Array(); + _loc5_[StatesEnum.STATE_CLICKED][_loc2_.name]["gotoAndStop"] = StatesEnum.STATE_CLICKED_STRING.toLocaleLowerCase(); + _loc5_[StatesEnum.STATE_SELECTED] = new Array(); + _loc5_[StatesEnum.STATE_SELECTED][_loc2_.name] = new Array(); + _loc5_[StatesEnum.STATE_SELECTED][_loc2_.name]["gotoAndStop"] = StatesEnum.STATE_SELECTED_STRING.toLocaleLowerCase(); + _loc5_[StatesEnum.STATE_SELECTED][_loc3_.name] = new Array(); + _loc5_[StatesEnum.STATE_SELECTED][_loc3_.name]["cssClass"] = "selected"; + _loc1_.changingStateData = _loc5_; + _loc1_.finalize(); + var _loc6_:ButtonContainer = new ButtonContainer(); + _loc6_.x = this._nXCloseTab; + _loc6_.y = this._nYCloseTab; + _loc6_.width = this._nWidthPlusTab; + _loc6_.height = __height; + _loc6_.name = "btn_closeTab" + this._nCurrentMaxIndex; + var _loc7_:Texture = new Texture(); + _loc7_.uri = this._sCloseTextureUri; + _loc7_.name = "tx_closeTab" + this._nCurrentMaxIndex; + _loc7_.finalize(); + _loc6_.addChild(_loc7_); + getUi().registerId(_loc6_.name,new GraphicElement(_loc6_,new Array(),_loc6_.name)); + getUi().registerId(_loc7_.name,new GraphicElement(_loc7_,new Array(),_loc7_.name)); + var _loc8_:Array = new Array(); + _loc8_[StatesEnum.STATE_OVER] = new Array(); + _loc8_[StatesEnum.STATE_OVER][_loc7_.name] = new Array(); + _loc8_[StatesEnum.STATE_OVER][_loc7_.name]["gotoAndStop"] = StatesEnum.STATE_OVER_STRING.toLocaleLowerCase(); + _loc8_[StatesEnum.STATE_CLICKED] = new Array(); + _loc8_[StatesEnum.STATE_CLICKED][_loc7_.name] = new Array(); + _loc8_[StatesEnum.STATE_CLICKED][_loc7_.name]["gotoAndStop"] = StatesEnum.STATE_CLICKED_STRING.toLocaleLowerCase(); + _loc6_.changingStateData = _loc8_; + _loc6_.finalize(); + _loc6_.visible = false; + this._tabCtr.addChild(_loc1_); + this._tabCtr.addChild(_loc6_); + this._aCtrs[this._nNbTabs] = _loc1_; + this._aCloses[this._nNbTabs] = _loc6_; + this._aLbls[this._nNbTabs] = _loc3_; + this._aInputs[this._nNbTabs] = _loc4_; + this._nTotalWidth = this._nTotalWidth + this._nWidthTab; + this._nCurrentMaxIndex++; + this.replaceTab(); + } + + private function addPlusTab() : void + { + this._btnPlus = new ButtonContainer(); + this._btnPlus.soundId = "16090"; + this._btnPlus.width = this._nWidthPlusTab; + this._btnPlus.height = __height; + this._btnPlus.name = "btn_plus"; + var _loc1_:Texture = new Texture(); + _loc1_.width = this._nWidthPlusTab; + _loc1_.height = __height; + _loc1_.autoGrid = true; + _loc1_.uri = this._sBgTextureUri; + _loc1_.name = "tx_bgPlus"; + _loc1_.finalize(); + var _loc2_:Texture = new Texture(); + _loc2_.x = this._nXPlusTab; + _loc2_.y = this._nYPlusTab; + _loc2_.uri = this._sPlusTextureUri; + _loc2_.name = "tx_plus"; + _loc2_.finalize(); + this._btnPlus.addChild(_loc1_); + this._btnPlus.addChild(_loc2_); + getUi().registerId(this._btnPlus.name,new GraphicElement(this._btnPlus,new Array(),this._btnPlus.name)); + getUi().registerId(_loc1_.name,new GraphicElement(_loc1_,new Array(),_loc1_.name)); + getUi().registerId(_loc2_.name,new GraphicElement(_loc2_,new Array(),_loc2_.name)); + addChild(this._btnPlus); + var _loc3_:Array = new Array(); + _loc3_[StatesEnum.STATE_OVER] = new Array(); + _loc3_[StatesEnum.STATE_OVER][_loc1_.name] = new Array(); + _loc3_[StatesEnum.STATE_OVER][_loc1_.name]["gotoAndStop"] = StatesEnum.STATE_OVER_STRING.toLocaleLowerCase(); + _loc3_[StatesEnum.STATE_OVER][_loc2_.name] = new Array(); + _loc3_[StatesEnum.STATE_OVER][_loc2_.name]["gotoAndStop"] = StatesEnum.STATE_OVER_STRING.toLocaleLowerCase(); + _loc3_[StatesEnum.STATE_CLICKED] = new Array(); + _loc3_[StatesEnum.STATE_CLICKED][_loc1_.name] = new Array(); + _loc3_[StatesEnum.STATE_CLICKED][_loc1_.name]["gotoAndStop"] = StatesEnum.STATE_CLICKED_STRING.toLocaleLowerCase(); + _loc3_[StatesEnum.STATE_CLICKED][_loc2_.name] = new Array(); + _loc3_[StatesEnum.STATE_CLICKED][_loc2_.name]["gotoAndStop"] = StatesEnum.STATE_CLICKED_STRING.toLocaleLowerCase(); + this._btnPlus.changingStateData = _loc3_; + this._btnPlus.finalize(); + this._nTotalWidth = this._nTotalWidth + this._nWidthPlusTab; + } + + private function removeTab() : void + { + var _loc1_:* = 0; + if(this._nNbTabs > 1) + { + _loc1_ = this._nSelected; + this._nPreviousSelected = _loc1_ - 1; + this.removeContainerContent(this._aCtrs[_loc1_]); + this._aCtrs.splice(_loc1_,1); + this.removeContainerContent(this._aCloses[_loc1_]); + this._aCloses.splice(_loc1_,1); + this._aLbls.splice(_loc1_,1); + this._nTotalWidth = this._nTotalWidth - this._nWidthTab; + this.replaceTab(); + this.selectedTab = this._nPreviousSelected; + } + } + + private function replaceTab() : void + { + var _loc2_:* = undefined; + var _loc1_:* = 0; + for(_loc2_ in this._aCtrs) + { + this._aCtrs[_loc2_].state = 0; + this._aCtrs[_loc2_].x = _loc1_; + this._aCloses[_loc2_].x = _loc1_ + this._nXCloseTab; + this._aCtrs[_loc2_].reset(); + _loc1_ = _loc1_ + this._aCtrs[_loc2_].width; + } + this._btnPlus.x = _loc1_; + if(this._nSelected == -1) + { + this.selectedTab = _loc2_; + } + this._nNbTabs = this._aCtrs.length; + if(this._nTotalWidth + this._nWidthTab < __width) + { + this._btnPlus.visible = true; + } + else + { + this._btnPlus.visible = false; + } + } + + private function isIterable(param1:*) : Boolean + { + if(param1 is Array) + { + return true; + } + if(!(param1["length"] == null) && !(param1["length"] == 0) && !isNaN(param1["length"]) && !(param1[0] == null) && !(param1 is String)) + { + return true; + } + return false; + } + + private function removeContainerContent(param1:GraphicContainer) : void + { + param1.remove(); + } + + private function switchToEdition(param1:Boolean) : void + { + this._bNameEdition = param1; + if(param1) + { + this._aInputs[this._nSelected].text = this._aLbls[this._nSelected].text; + this._aInputs[this._nSelected].focus(); + this._aInputs[this._nSelected].setSelection(0,this._aInputs[this._nSelected].text.length); + } + this._aInputs[this._nSelected].disabled = !param1; + this._aInputs[this._nSelected].visible = param1; + this._aLbls[this._nSelected].visible = !param1; + } + + override public function process(param1:Message) : Boolean + { + var _loc2_:MouseClickMessage = null; + var _loc3_:MouseRightClickMessage = null; + var _loc4_:KeyboardKeyUpMessage = null; + var _loc5_:String = null; + var _loc6_:* = undefined; + var _loc7_:String = null; + switch(true) + { + case param1 is MouseClickMessage: + _loc2_ = param1 as MouseClickMessage; + if(this._bNameEdition) + { + this._bNameEdition = false; + _loc5_ = this._aInputs[this._nSelected].text; + this.renameTab(this._nSelected,_loc5_); + if(UIEventManager.getInstance().isRegisteredInstance(this,RenameTabMessage)) + { + Berilia.getInstance().handler.process(new RenameTabMessage(this,this._nSelected,_loc5_)); + } + } + switch(_loc2_.target.name) + { + case this._btnPlus.name: + if(this._nTotalWidth + this._nWidthTab < __width) + { + this.addTab(); + this.selectedTab = this._nNbTabs - 1; + if(UIEventManager.getInstance().isRegisteredInstance(this,CreateTabMessage)) { - this.switchToEdition(false); - }; - }; - break; - case (msg is KeyboardKeyUpMessage): - _local_4 = (msg as KeyboardKeyUpMessage); - if (this._bNameEdition) - { - if (_local_4.keyboardEvent.keyCode == Keyboard.ENTER) + Berilia.getInstance().handler.process(new CreateTabMessage(this)); + } + } + break; + default: + for(_loc6_ in this._aCtrs) + { + if(_loc2_.target == this._aCtrs[_loc6_]) { - this._bNameEdition = false; - nameEdition = this._aInputs[this._nSelected].text; - this.renameTab(this._nSelected, nameEdition); - if (UIEventManager.getInstance().isRegisteredInstance(this, RenameTabMessage)) - { - Berilia.getInstance().handler.process(new RenameTabMessage(this, this._nSelected, nameEdition)); - }; + this.selectedTab = _loc6_; } - else + } + if(_loc2_.target == this._aCloses[this._nSelected]) + { + if(this._nNbTabs > 1) { - if (_local_4.keyboardEvent.keyCode == Keyboard.ESCAPE) - { - this.switchToEdition(false); - }; - }; - }; - break; - }; - return (false); - } - - - } -}//package com.ankamagames.berilia.components - + if(UIEventManager.getInstance().isRegisteredInstance(this,DeleteTabMessage)) + { + Berilia.getInstance().handler.process(new DeleteTabMessage(this,this._nSelected)); + } + this.removeTab(); + } + } + } + break; + case param1 is MouseRightClickMessage: + _loc3_ = param1 as MouseRightClickMessage; + if(_loc3_.target == this._aCtrs[this._nSelected] && !this._bNameEdition) + { + this.switchToEdition(true); + } + else if(this._bNameEdition) + { + this.switchToEdition(false); + } + + break; + case param1 is KeyboardKeyUpMessage: + _loc4_ = param1 as KeyboardKeyUpMessage; + if(this._bNameEdition) + { + if(_loc4_.keyboardEvent.keyCode == Keyboard.ENTER) + { + this._bNameEdition = false; + _loc7_ = this._aInputs[this._nSelected].text; + this.renameTab(this._nSelected,_loc7_); + if(UIEventManager.getInstance().isRegisteredInstance(this,RenameTabMessage)) + { + Berilia.getInstance().handler.process(new RenameTabMessage(this,this._nSelected,_loc7_)); + } + } + else if(_loc4_.keyboardEvent.keyCode == Keyboard.ESCAPE) + { + this.switchToEdition(false); + } + + } + break; + } + return false; + } + } +} diff --git a/com/ankamagames/berilia/components/TextArea.as b/com/ankamagames/berilia/components/TextArea.as index f23f35424..04c63e74f 100644 --- a/com/ankamagames/berilia/components/TextArea.as +++ b/com/ankamagames/berilia/components/TextArea.as @@ -1,319 +1,322 @@ -package com.ankamagames.berilia.components +package com.ankamagames.berilia.components { - import com.ankamagames.berilia.FinalizableUIComponent; - import com.ankamagames.jerakine.logger.Logger; - import com.ankamagames.jerakine.logger.Log; - import flash.utils.getQualifiedClassName; - import flash.events.Event; - import flash.events.MouseEvent; - import com.ankamagames.jerakine.utils.system.AirScanner; - import com.ankamagames.jerakine.utils.display.StageShareManager; - import flash.events.NativeWindowBoundsEvent; - import com.ankamagames.jerakine.types.Uri; - import com.ankamagames.jerakine.handlers.messages.mouse.MouseWheelMessage; - import com.ankamagames.jerakine.messages.Message; - - public class TextArea extends Label implements FinalizableUIComponent - { - - protected static const _log:Logger = Log.getLogger(getQualifiedClassName(TextArea)); - - private var _sbScrollBar:ScrollBar; - private var _bFinalized:Boolean; - private var _nScrollPos:int = 5; - private var _bHideScroll:Boolean = false; - private var _scrollTopMargin:int = 0; - private var _scrollBottomMargin:int = 0; - protected var ___width:uint; - - public function TextArea() - { - this._sbScrollBar = new ScrollBar(); - this._sbScrollBar.min = 1; - this._sbScrollBar.max = 1; - this._sbScrollBar.step = 1; - this._sbScrollBar.scrollSpeed = (1 / 6); - this._sbScrollBar.addEventListener(Event.CHANGE, this.onScroll); - _tText.addEventListener(MouseEvent.MOUSE_WHEEL, this.onTextWheel); - addChild(this._sbScrollBar); - _tText.wordWrap = true; - _tText.multiline = true; - _tText.mouseEnabled = true; - _tText.mouseWheelEnabled = false; - if (AirScanner.hasAir()) + import com.ankamagames.berilia.FinalizableUIComponent; + import com.ankamagames.jerakine.logger.Logger; + import com.ankamagames.jerakine.logger.Log; + import flash.utils.getQualifiedClassName; + import com.ankamagames.jerakine.types.Uri; + import flash.events.Event; + import flash.events.MouseEvent; + import com.ankamagames.jerakine.utils.system.AirScanner; + import com.ankamagames.jerakine.utils.display.StageShareManager; + import flash.events.NativeWindowBoundsEvent; + import com.ankamagames.jerakine.messages.Message; + import com.ankamagames.jerakine.handlers.messages.mouse.MouseWheelMessage; + + public class TextArea extends Label implements FinalizableUIComponent + { + + public function TextArea() + { + super(); + this._sbScrollBar = new ScrollBar(); + this._sbScrollBar.min = 1; + this._sbScrollBar.max = 1; + this._sbScrollBar.step = 1; + this._sbScrollBar.scrollSpeed = 1 / 6; + this._sbScrollBar.addEventListener(Event.CHANGE,this.onScroll); + _tText.addEventListener(MouseEvent.MOUSE_WHEEL,this.onTextWheel); + addChild(this._sbScrollBar); + _tText.wordWrap = true; + _tText.multiline = true; + _tText.mouseEnabled = true; + _tText.mouseWheelEnabled = false; + if(AirScanner.hasAir()) + { + StageShareManager.stage.nativeWindow.addEventListener(NativeWindowBoundsEvent.RESIZE,this.onWindowResize); + } + } + + protected static const _log:Logger = Log.getLogger(getQualifiedClassName(TextArea)); + + private var _sbScrollBar:ScrollBar; + + private var _bFinalized:Boolean; + + private var _nScrollPos:int = 5; + + private var _bHideScroll:Boolean = false; + + private var _scrollTopMargin:int = 0; + + private var _scrollBottomMargin:int = 0; + + protected var ___width:uint; + + public function get scrollBottomMargin() : int + { + return this._scrollBottomMargin; + } + + public function set scrollBottomMargin(param1:int) : void + { + this._scrollBottomMargin = param1; + this._sbScrollBar.height = height - this._scrollTopMargin - this._scrollBottomMargin; + } + + public function get scrollTopMargin() : int + { + return this._scrollTopMargin; + } + + public function set scrollTopMargin(param1:int) : void + { + this._scrollTopMargin = param1; + this._sbScrollBar.y = this._scrollTopMargin; + this._sbScrollBar.height = height - this._scrollTopMargin - this._scrollBottomMargin; + } + + public function set scrollCss(param1:Uri) : void + { + this._sbScrollBar.css = param1; + } + + public function get scrollCss() : Uri + { + return this._sbScrollBar.css; + } + + override public function set width(param1:Number) : void + { + this.___width = param1; + super.width = param1; + this.updateScrollBarPos(); + _tText.textWidth; + } + + override public function get width() : Number + { + return this.___width; + } + + override public function set height(param1:Number) : void + { + if(!(param1 == super.height) || !(param1 == this._sbScrollBar.height - this._scrollTopMargin - this._scrollBottomMargin)) + { + super.height = param1; + this._sbScrollBar.height = param1 - this._scrollTopMargin - this._scrollBottomMargin; + if(this._bFinalized) { - StageShareManager.stage.nativeWindow.addEventListener(NativeWindowBoundsEvent.RESIZE, this.onWindowResize); - }; - } - - public function get scrollBottomMargin():int - { - return (this._scrollBottomMargin); - } - - public function set scrollBottomMargin(value:int):void - { - this._scrollBottomMargin = value; - this._sbScrollBar.height = ((height - this._scrollTopMargin) - this._scrollBottomMargin); - } - - public function get scrollTopMargin():int - { - return (this._scrollTopMargin); - } - - public function set scrollTopMargin(value:int):void - { - this._scrollTopMargin = value; - this._sbScrollBar.y = this._scrollTopMargin; - this._sbScrollBar.height = ((height - this._scrollTopMargin) - this._scrollBottomMargin); - } - - public function set scrollCss(sUrl:Uri):void - { - this._sbScrollBar.css = sUrl; - } - - public function get scrollCss():Uri - { - return (this._sbScrollBar.css); - } - - override public function set width(nW:Number):void - { - this.___width = nW; - super.width = nW; - this.updateScrollBarPos(); - _tText.textWidth; - } - - override public function get width():Number - { - return (this.___width); - } - - override public function set height(nH:Number):void - { - if (((!((nH == super.height))) || (!((nH == ((this._sbScrollBar.height - this._scrollTopMargin) - this._scrollBottomMargin)))))) - { - super.height = nH; - this._sbScrollBar.height = ((nH - this._scrollTopMargin) - this._scrollBottomMargin); - if (this._bFinalized) - { - this.updateScrollBar(); - }; - }; - } - - override public function set text(sValue:String):void - { - super.text = sValue; - if (this._bFinalized) - { - this.updateScrollBar(true); - }; - } - - public function set scrollPos(nValue:int):void - { - this._nScrollPos = nValue; - } - - [ForceReplaceInFakeClass] - override public function set css(sValue:Uri):void - { - super.css = sValue; - } - - override public function set scrollV(nVal:int):void - { - super.scrollV = nVal; - if (this._bFinalized) - { - this.updateScrollBar(); - }; - } - - override public function get scrollV():int - { - return (super.scrollV); - } - - override public function get finalized():Boolean - { - return (((this._bFinalized) && (super.finalized))); - } - - override public function set finalized(b:Boolean):void - { - this._bFinalized = b; - } - - public function get hideScroll():Boolean - { - return (this._bHideScroll); - } - - public function set hideScroll(hideScroll:Boolean):void - { - this._bHideScroll = hideScroll; - } - - override public function get htmlText():String - { - return (super.htmlText); - } - - override public function set htmlText(pHtmlText:String):void - { - super.htmlText = pHtmlText; - if (this._bFinalized) - { - this.updateScrollBar(); - }; - } - - override public function appendText(sTxt:String, style:String=null):void - { - super.appendText(sTxt, style); - if (this._bFinalized) - { - this.updateScrollBar(); - }; - } - - override public function finalize():void - { - this._sbScrollBar.finalize(); - this.updateScrollBarPos(); + this.updateScrollBar(); + } + } + } + + override public function set text(param1:String) : void + { + super.text = param1; + if(this._bFinalized) + { + this.updateScrollBar(true); + } + } + + public function set scrollPos(param1:int) : void + { + this._nScrollPos = param1; + } + + override public function set css(param1:Uri) : void + { + super.css = param1; + } + + override public function set scrollV(param1:int) : void + { + super.scrollV = param1; + if(this._bFinalized) + { this.updateScrollBar(); - this._bFinalized = true; - super.finalize(); - } - - override public function free():void - { - super.free(); - this._bFinalized = false; - this._nScrollPos = 5; - this.___width = 0; - this._sbScrollBar.min = 1; - this._sbScrollBar.max = 1; - this._sbScrollBar.step = 1; - _tText.wordWrap = true; - _tText.multiline = true; - } - - override public function remove():void - { - if (this._sbScrollBar) - { - this._sbScrollBar.removeEventListener(Event.CHANGE, this.onScroll); - this._sbScrollBar.remove(); - }; - this._sbScrollBar = null; - _tText.removeEventListener(MouseEvent.MOUSE_WHEEL, this.onTextWheel); - if (AirScanner.hasAir()) - { - StageShareManager.stage.removeEventListener(Event.FRAME_CONSTRUCTED, this.onFrameConstructed); - StageShareManager.stage.nativeWindow.removeEventListener(NativeWindowBoundsEvent.RESIZE, this.onWindowResize); - }; - super.remove(); - } - - override public function process(msg:Message):Boolean - { - if ((((msg is MouseWheelMessage)) && (((this._sbScrollBar) && (this._sbScrollBar.visible))))) - { - return (true); - }; - return (super.process(msg)); - } - - public function hideScrollBar():void - { - this._sbScrollBar.visible = false; - } - - private function updateScrollBar(reset:Boolean=false):void - { - if ((((_tText.scrollV == 1)) && ((_tText.bottomScrollV == _tText.numLines)))) + } + } + + override public function get scrollV() : int + { + return super.scrollV; + } + + override public function get finalized() : Boolean + { + return (this._bFinalized) && (super.finalized); + } + + override public function set finalized(param1:Boolean) : void + { + this._bFinalized = param1; + } + + public function get hideScroll() : Boolean + { + return this._bHideScroll; + } + + public function set hideScroll(param1:Boolean) : void + { + this._bHideScroll = param1; + } + + override public function get htmlText() : String + { + return super.htmlText; + } + + override public function set htmlText(param1:String) : void + { + super.htmlText = param1; + if(this._bFinalized) + { + this.updateScrollBar(); + } + } + + override public function appendText(param1:String, param2:String = null) : void + { + super.appendText(param1,param2); + if(this._bFinalized) + { + this.updateScrollBar(); + } + } + + override public function finalize() : void + { + this._sbScrollBar.finalize(); + this.updateScrollBarPos(); + this.updateScrollBar(); + this._bFinalized = true; + super.finalize(); + } + + override public function free() : void + { + super.free(); + this._bFinalized = false; + this._nScrollPos = 5; + this.___width = 0; + this._sbScrollBar.min = 1; + this._sbScrollBar.max = 1; + this._sbScrollBar.step = 1; + _tText.wordWrap = true; + _tText.multiline = true; + } + + override public function remove() : void + { + if(this._sbScrollBar) + { + this._sbScrollBar.removeEventListener(Event.CHANGE,this.onScroll); + this._sbScrollBar.remove(); + } + this._sbScrollBar = null; + _tText.removeEventListener(MouseEvent.MOUSE_WHEEL,this.onTextWheel); + if(AirScanner.hasAir()) + { + StageShareManager.stage.removeEventListener(Event.FRAME_CONSTRUCTED,this.onFrameConstructed); + StageShareManager.stage.nativeWindow.removeEventListener(NativeWindowBoundsEvent.RESIZE,this.onWindowResize); + } + super.remove(); + } + + override public function process(param1:Message) : Boolean + { + if(param1 is MouseWheelMessage && (this._sbScrollBar) && (this._sbScrollBar.visible)) + { + return true; + } + return super.process(param1); + } + + public function hideScrollBar() : void + { + this._sbScrollBar.visible = false; + } + + private function updateScrollBar(param1:Boolean = false) : void + { + if(_tText.scrollV == 1 && _tText.bottomScrollV == _tText.numLines) + { + _tText.scrollV = 0; + this._sbScrollBar.disabled = true; + if(this._bHideScroll) { - _tText.scrollV = 0; - this._sbScrollBar.disabled = true; - if (this._bHideScroll) - { - this._sbScrollBar.visible = false; - }; + this._sbScrollBar.visible = false; } - else - { - this._sbScrollBar.visible = true; - this._sbScrollBar.disabled = false; - this._sbScrollBar.total = _tText.numLines; - this._sbScrollBar.max = _tText.maxScrollV; - if (reset) - { - _tText.scrollV = 0; - this._sbScrollBar.value = 0; - } - else - { - this._sbScrollBar.value = _tText.scrollV; - }; - }; - } - - private function updateScrollBarPos():void - { - if (this._nScrollPos >= 0) + } + else + { + this._sbScrollBar.visible = true; + this._sbScrollBar.disabled = false; + this._sbScrollBar.total = _tText.numLines; + this._sbScrollBar.max = _tText.maxScrollV; + if(param1) { - this._sbScrollBar.x = (this.width - this._sbScrollBar.width); - _tText.width = ((this.width - this._sbScrollBar.width) - this._nScrollPos); - _tText.x = 0; + _tText.scrollV = 0; + this._sbScrollBar.value = 0; } else { - this._sbScrollBar.x = 0; - _tText.width = ((this.width - this._sbScrollBar.width) + this._nScrollPos); - _tText.x = (this._sbScrollBar.width - this._nScrollPos); - }; - } - - override protected function updateAlign():void - { - if (this._sbScrollBar.disabled) - { - super.updateAlign(); - }; - } - - private function onTextWheel(e:MouseEvent):void - { - e.delta = (e.delta * 3); - this._sbScrollBar.onWheel(e); - } - - private function onScroll(e:Event):void - { - _tText.scrollV = ((this._sbScrollBar.value / this._sbScrollBar.max) * _tText.maxScrollV); - } - - private function onWindowResize(pEvent:NativeWindowBoundsEvent):void - { - StageShareManager.stage.addEventListener(Event.FRAME_CONSTRUCTED, this.onFrameConstructed); - } - - private function onFrameConstructed(pEvent:Event):void - { - StageShareManager.stage.removeEventListener(Event.FRAME_CONSTRUCTED, this.onFrameConstructed); - if (((this._bFinalized) && (this._sbScrollBar))) - { - this.updateScrollBar(); - }; - } - - - } -}//package com.ankamagames.berilia.components - + this._sbScrollBar.value = _tText.scrollV; + } + } + } + + private function updateScrollBarPos() : void + { + if(this._nScrollPos >= 0) + { + this._sbScrollBar.x = this.width - this._sbScrollBar.width; + _tText.width = this.width - this._sbScrollBar.width - this._nScrollPos; + _tText.x = 0; + } + else + { + this._sbScrollBar.x = 0; + _tText.width = this.width - this._sbScrollBar.width + this._nScrollPos; + _tText.x = this._sbScrollBar.width - this._nScrollPos; + } + } + + override protected function updateAlign() : void + { + if(this._sbScrollBar.disabled) + { + super.updateAlign(); + } + } + + private function onTextWheel(param1:MouseEvent) : void + { + param1.delta = param1.delta * 3; + this._sbScrollBar.onWheel(param1); + } + + private function onScroll(param1:Event) : void + { + _tText.scrollV = this._sbScrollBar.value / this._sbScrollBar.max * _tText.maxScrollV; + } + + private function onWindowResize(param1:NativeWindowBoundsEvent) : void + { + StageShareManager.stage.addEventListener(Event.FRAME_CONSTRUCTED,this.onFrameConstructed); + } + + private function onFrameConstructed(param1:Event) : void + { + StageShareManager.stage.removeEventListener(Event.FRAME_CONSTRUCTED,this.onFrameConstructed); + if((this._bFinalized) && (this._sbScrollBar)) + { + this.updateScrollBar(); + } + } + } +} diff --git a/com/ankamagames/berilia/components/Texture.as b/com/ankamagames/berilia/components/Texture.as index bdae72e02..bd662e830 100644 --- a/com/ankamagames/berilia/components/Texture.as +++ b/com/ankamagames/berilia/components/Texture.as @@ -1,974 +1,967 @@ -package com.ankamagames.berilia.components +package com.ankamagames.berilia.components { - import com.ankamagames.berilia.types.graphic.GraphicContainer; - import com.ankamagames.berilia.FinalizableUIComponent; - import com.ankamagames.jerakine.interfaces.IRectangle; - import flash.utils.Dictionary; - import com.ankamagames.jerakine.logger.Logger; - import com.ankamagames.jerakine.types.Uri; - import flash.display.DisplayObject; - import com.ankamagames.jerakine.resources.loaders.IResourceLoader; - import flash.geom.Rectangle; - import flash.display.Bitmap; - import flash.display.BitmapData; - import com.ankamagames.jerakine.logger.Log; - import flash.utils.getQualifiedClassName; - import com.ankamagames.jerakine.utils.display.MovieClipUtils; - import flash.display.MovieClip; - import flash.display.FrameLabel; - import flash.display.DisplayObjectContainer; - import flash.geom.ColorTransform; - import com.ankamagames.berilia.Berilia; - import flash.events.Event; - import com.ankamagames.berilia.components.messages.TextureReadyMessage; - import com.ankamagames.jerakine.resources.loaders.ResourceLoaderFactory; - import com.ankamagames.jerakine.resources.loaders.ResourceLoaderType; - import com.ankamagames.jerakine.resources.events.ResourceLoadedEvent; - import com.ankamagames.jerakine.resources.events.ResourceErrorEvent; - import com.ankamagames.jerakine.utils.system.AirScanner; - import com.ankamagames.jerakine.resources.adapters.impl.AdvancedSwfAdapter; - import com.ankamagames.berilia.utils.UriCacheFactory; - import flash.display.Shape; - import com.ankamagames.jerakine.types.ASwf; - import com.ankamagames.jerakine.resources.ResourceType; - import com.ankamagames.jerakine.resources.ResourceErrorCode; - import flash.errors.IllegalOperationError; - import com.ankamagames.jerakine.types.DynamicSecureObject; - import com.ankamagames.berilia.managers.KernelEventsManager; - import com.ankamagames.berilia.utils.BeriliaHookList; - import com.ankamagames.berilia.managers.SecureCenter; - import com.ankamagames.berilia.types.event.TextureLoadFailedEvent; - import com.ankamagames.berilia.components.messages.TextureLoadFailMessage; - - public class Texture extends GraphicContainer implements FinalizableUIComponent, IRectangle - { - - public static var MEMORY_LOG:Dictionary = new Dictionary(true); - - private var _log:Logger; - private var _finalized:Boolean; - private var _uri:Uri; - private var _realUri:Uri; - var _child:DisplayObject; - private var _startedWidth:Number; - private var _startedHeight:Number; - private var _forcedHeight:Number; - private var _forcedWidth:Number; - private var _keepRatio:Boolean; - private var _dispatchMessages:Boolean; - private var _autoGrid:Boolean; - private var _forceReload:Boolean = false; - private var _gotoFrame; - private var _loader:IResourceLoader; - private var _startBounds:Rectangle; - private var _disableAnimation:Boolean = false; - private var _useCache:Boolean = true; - private var _roundCornerRadius:uint = 0; - private var _playOnce:Boolean = false; - private var _bitmap:Bitmap; - private var _showLoadingError:Boolean = true; - public var defaultBitmapData:BitmapData; - private var rle_uri_path; - - public function Texture() - { - this._log = Log.getLogger(getQualifiedClassName(Texture)); - super(); - mouseEnabled = false; - mouseChildren = false; - MEMORY_LOG[this] = 1; - } - - public function get finalized():Boolean - { - return (this._finalized); - } - - public function set finalized(value:Boolean):void - { - this._finalized = value; - } - - public function get uri():Uri - { - return (this._uri); - } - - public function set uri(value:Uri):void - { - if (((!((value == this._uri))) || (this._forceReload))) - { - this._uri = value; + import com.ankamagames.berilia.types.graphic.GraphicContainer; + import com.ankamagames.berilia.FinalizableUIComponent; + import com.ankamagames.jerakine.interfaces.IRectangle; + import flash.utils.Dictionary; + import com.ankamagames.jerakine.logger.Logger; + import com.ankamagames.jerakine.types.Uri; + import flash.display.DisplayObject; + import com.ankamagames.jerakine.resources.loaders.IResourceLoader; + import flash.geom.Rectangle; + import flash.display.Bitmap; + import flash.display.BitmapData; + import com.ankamagames.jerakine.utils.display.MovieClipUtils; + import flash.display.MovieClip; + import flash.display.FrameLabel; + import flash.display.DisplayObjectContainer; + import flash.geom.ColorTransform; + import com.ankamagames.berilia.Berilia; + import flash.events.Event; + import com.ankamagames.berilia.components.messages.TextureReadyMessage; + import com.ankamagames.jerakine.resources.loaders.ResourceLoaderFactory; + import com.ankamagames.jerakine.resources.loaders.ResourceLoaderType; + import com.ankamagames.jerakine.resources.events.ResourceLoadedEvent; + import com.ankamagames.jerakine.resources.events.ResourceErrorEvent; + import com.ankamagames.jerakine.utils.system.AirScanner; + import com.ankamagames.jerakine.resources.adapters.impl.AdvancedSwfAdapter; + import com.ankamagames.berilia.utils.UriCacheFactory; + import com.ankamagames.jerakine.newCache.ICache; + import flash.display.Shape; + import com.ankamagames.jerakine.types.ASwf; + import com.ankamagames.jerakine.resources.ResourceType; + import com.ankamagames.jerakine.resources.ResourceErrorCode; + import flash.errors.IllegalOperationError; + import com.ankamagames.jerakine.types.DynamicSecureObject; + import com.ankamagames.berilia.managers.KernelEventsManager; + import com.ankamagames.berilia.utils.BeriliaHookList; + import com.ankamagames.berilia.managers.SecureCenter; + import com.ankamagames.berilia.types.event.TextureLoadFailedEvent; + import com.ankamagames.berilia.components.messages.TextureLoadFailMessage; + import com.ankamagames.jerakine.logger.Log; + import flash.utils.getQualifiedClassName; + + public class Texture extends GraphicContainer implements FinalizableUIComponent, IRectangle + { + + public function Texture() + { + this._log = Log.getLogger(getQualifiedClassName(Texture)); + super(); + mouseEnabled = false; + mouseChildren = false; + MEMORY_LOG[this] = 1; + } + + public static var MEMORY_LOG:Dictionary = new Dictionary(true); + + private var _log:Logger; + + private var _finalized:Boolean; + + private var _uri:Uri; + + private var _realUri:Uri; + + var _child:DisplayObject; + + private var _startedWidth:Number; + + private var _startedHeight:Number; + + private var _forcedHeight:Number; + + private var _forcedWidth:Number; + + private var _keepRatio:Boolean; + + private var _dispatchMessages:Boolean; + + private var _autoGrid:Boolean; + + private var _forceReload:Boolean = false; + + private var _gotoFrame; + + private var _loader:IResourceLoader; + + private var _startBounds:Rectangle; + + private var _disableAnimation:Boolean = false; + + private var _useCache:Boolean = true; + + private var _roundCornerRadius:uint = 0; + + private var _playOnce:Boolean = false; + + private var _bitmap:Bitmap; + + private var _showLoadingError:Boolean = true; + + public var defaultBitmapData:BitmapData; + + public function get finalized() : Boolean + { + return this._finalized; + } + + public function set finalized(param1:Boolean) : void + { + this._finalized = param1; + } + + public function get uri() : Uri + { + return this._uri; + } + + public function set uri(param1:Uri) : void + { + if(!(param1 == this._uri) || (this._forceReload)) + { + this._uri = param1; + if(this._finalized) + { + this.reload(); } - else + return; + } + } + + public function get useCache() : Boolean + { + return this._useCache; + } + + public function set useCache(param1:Boolean) : void + { + this._useCache = param1; + } + + public function set showLoadingError(param1:Boolean) : void + { + this._showLoadingError = param1; + } + + public function set disableAnimation(param1:Boolean) : void + { + this._disableAnimation = param1; + if(this._finalized) + { + MovieClipUtils.stopMovieClip(this); + } + } + + override public function get height() : Number + { + return !isNaN(this._forcedHeight)?this._forcedHeight:this._child?this._child.height:0; + } + + override public function set height(param1:Number) : void + { + if(this._forcedHeight == param1) + { + return; + } + this._forcedHeight = param1; + if(this._finalized) + { + this.organize(); + } + } + + override public function get width() : Number + { + return !isNaN(this._forcedWidth)?this._forcedWidth:this._child?this._child.width:0; + } + + override public function set width(param1:Number) : void + { + if(this._forcedWidth == param1) + { + return; + } + this._forcedWidth = param1; + if(this._finalized) + { + this.organize(); + } + } + + public function get keepRatio() : Boolean + { + return this._keepRatio; + } + + public function set keepRatio(param1:Boolean) : void + { + this._keepRatio = param1; + if(this._finalized) + { + this.organize(); + } + } + + override public function get scale9Grid() : Rectangle + { + if(this._child) + { + return this._child.scale9Grid; + } + return null; + } + + override public function set scale9Grid(param1:Rectangle) : void + { + if(this._child) + { + this._child.scale9Grid = param1; + } + } + + public function vFlip() : void + { + var _loc1_:Number = x; + var _loc2_:Number = y; + scaleX = -1; + x = _loc1_ + this.width; + } + + public function hFlip() : void + { + var _loc1_:Number = x; + var _loc2_:Number = y; + scaleY = -1; + y = _loc2_ + this.height; + } + + public function get autoGrid() : Boolean + { + return this._autoGrid; + } + + public function set autoGrid(param1:Boolean) : void + { + if(param1) + { + this._autoGrid = true; + } + else + { + this._autoGrid = false; + if(this._child) { - return; - }; - if (this._finalized) - { - this.reload(); - }; - } - - public function get useCache():Boolean - { - return (this._useCache); - } - - public function set useCache(value:Boolean):void - { - this._useCache = value; - } - - public function set showLoadingError(value:Boolean):void - { - this._showLoadingError = value; - } - - public function set disableAnimation(value:Boolean):void - { - this._disableAnimation = value; - if (this._finalized) - { - MovieClipUtils.stopMovieClip(this); - }; - } - - override public function get height():Number - { - return (((!(isNaN(this._forcedHeight))) ? this._forcedHeight : ((this._child) ? this._child.height : 0))); - } - - override public function set height(value:Number):void - { - if (this._forcedHeight == value) - { - return; - }; - this._forcedHeight = value; - if (this._finalized) - { - this.organize(); - }; - } - - override public function get width():Number - { - return (((!(isNaN(this._forcedWidth))) ? this._forcedWidth : ((this._child) ? this._child.width : 0))); - } - - override public function set width(value:Number):void - { - if (this._forcedWidth == value) - { - return; - }; - this._forcedWidth = value; - if (this._finalized) - { - this.organize(); - }; - } - - public function get keepRatio():Boolean - { - return (this._keepRatio); - } - - public function set keepRatio(value:Boolean):void - { - this._keepRatio = value; - if (this._finalized) - { - this.organize(); - }; - } - - override public function get scale9Grid():Rectangle - { - if (this._child) - { - return (this._child.scale9Grid); - }; - return (null); - } - - override public function set scale9Grid(value:Rectangle):void - { - if (this._child) - { - this._child.scale9Grid = value; - }; - } - - public function vFlip():void - { - var tempX:Number = x; - var tempY:Number = y; - scaleX = -1; - x = (tempX + this.width); - } - - public function hFlip():void - { - var tempX:Number = x; - var tempY:Number = y; - scaleY = -1; - y = (tempY + this.height); - } - - public function get autoGrid():Boolean - { - return (this._autoGrid); - } - - public function set autoGrid(value:Boolean):void - { - if (value) - { - this._autoGrid = true; + this._child.scale9Grid = null; } - else + } + if(this._finalized) + { + this.organize(); + } + } + + public function set gotoAndStop(param1:*) : void + { + var mv:MovieClip = null; + var value:* = param1; + mv = this._child as MovieClip; + if(mv != null) + { + try + { + mv.gotoAndStop(value); + } + catch(error:ArgumentError) { - this._autoGrid = false; - if (this._child) - { - this._child.scale9Grid = null; - }; - }; - if (this._finalized) - { - this.organize(); - }; - } - - public function set gotoAndStop(value:*):void - { - var mv:MovieClip; - mv = (this._child as MovieClip); - if (mv != null) - { - try - { - mv.gotoAndStop(value); - } - catch(error:ArgumentError) - { - mv.stop(); - }; - }; - this._gotoFrame = value; - } - - public function get gotoAndStop() - { - if (((this._child) && ((this._child is MovieClip)))) - { - return ((this._child as MovieClip).currentFrame.toString()); - }; - return (this._gotoFrame); - } - - private function hasLabel(mv:MovieClip, lbl:String):Boolean - { - var label:FrameLabel; - var labels:Array = mv.currentLabels; - for each (label in labels) - { - if (lbl == label.name) - { - return (true); - }; - }; - return (false); - } - - public function set gotoAndPlay(value:*):void - { - if (((this._child) && ((this._child is MovieClip)))) - { - if (value) - { - (this._child as MovieClip).gotoAndPlay(value); - } - else - { - (this._child as MovieClip).gotoAndPlay(1); - }; - }; - } - - public function get totalFrames():uint - { - if (((this._child) && ((this._child is MovieClip)))) - { - return ((this._child as MovieClip).totalFrames); - }; - return (1); - } - - public function get currentFrame():uint - { - if (((this._child) && ((this._child is MovieClip)))) - { - return ((this._child as MovieClip).currentFrame); - }; - return (1); - } - - public function get dispatchMessages():Boolean - { - return (this._dispatchMessages); - } - - public function set dispatchMessages(value:Boolean):void - { - this._dispatchMessages = value; - } - - public function get forceReload():Boolean - { - return (this._forceReload); - } - - public function set forceReload(value:Boolean):void - { - this._forceReload = value; - } - - public function get loading():Boolean - { - return (!((this._loader == null))); - } - - public function get child():DisplayObject - { - return (this._child); - } - - public function loadBitmapData(bmpdt:BitmapData):void - { - this._bitmap = new Bitmap(bmpdt, "auto", true); - if (this._finalized) - { - this.reload(); - }; - } - - public function get bitmapData():BitmapData - { - if (this._bitmap != null) - { - return (this._bitmap.bitmapData.clone()); - }; - return (null); - } - - public function stopAllAnimation():void - { - var doc:DisplayObjectContainer = (this._child as DisplayObjectContainer); - if (doc) - { - MovieClipUtils.stopMovieClip(doc); - }; - } - - public function getChildDuration():uint - { - var i:uint; - var o:DisplayObject; - var mc:MovieClip; - var t:uint; - var doc:DisplayObjectContainer = (this._child as DisplayObjectContainer); - if (doc) - { - i = 0; - while (i < doc.numChildren) - { - o = DisplayObjectContainer(this._child).getChildAt(i); - if ((((((o is MovieClip)) && (MovieClip(o).totalFrames))) && ((MovieClip(o).totalFrames > t)))) - { - t = MovieClip(o).totalFrames; - }; - i++; - }; + mv.stop(); + } + } + this._gotoFrame = value; + } + + public function get gotoAndStop() : * + { + if((this._child) && this._child is MovieClip) + { + return (this._child as MovieClip).currentFrame.toString(); + } + return this._gotoFrame; + } + + private function hasLabel(param1:MovieClip, param2:String) : Boolean + { + var _loc4_:FrameLabel = null; + var _loc3_:Array = param1.currentLabels; + for each(_loc4_ in _loc3_) + { + if(param2 == _loc4_.name) + { + return true; + } + } + return false; + } + + public function set gotoAndPlay(param1:*) : void + { + if((this._child) && this._child is MovieClip) + { + if(param1) + { + (this._child as MovieClip).gotoAndPlay(param1); } else { - if ((this._child is MovieClip)) - { - mc = (this._child as MovieClip); - t = mc.totalFrames; - }; - }; - return (t); - } - - public function gotoAndPayChild(frameNumber:uint):void - { - var i:uint; - var o:DisplayObject; - var mc:MovieClip; - var doc:DisplayObjectContainer = (this._child as DisplayObjectContainer); - if (doc) - { - i = 0; - while (i < doc.numChildren) - { - o = DisplayObjectContainer(this._child).getChildAt(i); - if ((o is MovieClip)) - { - (o as MovieClip).gotoAndPlay(frameNumber); - }; - i++; - }; + (this._child as MovieClip).gotoAndPlay(1); + } + } + } + + public function get totalFrames() : uint + { + if((this._child) && this._child is MovieClip) + { + return (this._child as MovieClip).totalFrames; + } + return 1; + } + + public function get currentFrame() : uint + { + if((this._child) && this._child is MovieClip) + { + return (this._child as MovieClip).currentFrame; + } + return 1; + } + + public function get dispatchMessages() : Boolean + { + return this._dispatchMessages; + } + + public function set dispatchMessages(param1:Boolean) : void + { + this._dispatchMessages = param1; + } + + public function get forceReload() : Boolean + { + return this._forceReload; + } + + public function set forceReload(param1:Boolean) : void + { + this._forceReload = param1; + } + + public function get loading() : Boolean + { + return !(this._loader == null); + } + + public function get child() : DisplayObject + { + return this._child; + } + + public function loadBitmapData(param1:BitmapData) : void + { + this._bitmap = new Bitmap(param1,"auto",true); + if(this._finalized) + { + this.reload(); + } + } + + public function get bitmapData() : BitmapData + { + if(this._bitmap != null) + { + return this._bitmap.bitmapData.clone(); + } + return null; + } + + public function stopAllAnimation() : void + { + var _loc1_:DisplayObjectContainer = this._child as DisplayObjectContainer; + if(_loc1_) + { + MovieClipUtils.stopMovieClip(_loc1_); + } + } + + public function getChildDuration() : uint + { + var _loc3_:uint = 0; + var _loc4_:DisplayObject = null; + var _loc5_:MovieClip = null; + var _loc1_:uint = 0; + var _loc2_:DisplayObjectContainer = this._child as DisplayObjectContainer; + if(_loc2_) + { + _loc3_ = 0; + while(_loc3_ < _loc2_.numChildren) + { + _loc4_ = DisplayObjectContainer(this._child).getChildAt(_loc3_); + if((_loc4_ is MovieClip) && (MovieClip(_loc4_).totalFrames) && MovieClip(_loc4_).totalFrames > _loc1_) + { + _loc1_ = MovieClip(_loc4_).totalFrames; + } + _loc3_++; + } + } + else if(this._child is MovieClip) + { + _loc5_ = this._child as MovieClip; + _loc1_ = _loc5_.totalFrames; + } + + return _loc1_; + } + + public function gotoAndPayChild(param1:uint) : void + { + var _loc3_:uint = 0; + var _loc4_:DisplayObject = null; + var _loc5_:MovieClip = null; + var _loc2_:DisplayObjectContainer = this._child as DisplayObjectContainer; + if(_loc2_) + { + _loc3_ = 0; + while(_loc3_ < _loc2_.numChildren) + { + _loc4_ = DisplayObjectContainer(this._child).getChildAt(_loc3_); + if(_loc4_ is MovieClip) + { + (_loc4_ as MovieClip).gotoAndPlay(param1); + } + _loc3_++; + } + } + else if(this._child is MovieClip) + { + _loc5_ = this._child as MovieClip; + _loc5_.gotoAndPlay(param1); + } + + } + + public function colorTransform(param1:ColorTransform, param2:int = 0) : void + { + var _loc3_:DisplayObjectContainer = null; + var _loc4_:* = 0; + var _loc5_:DisplayObject = null; + if(param2 == 0) + { + transform.colorTransform = param1; + } + else if(this._child is DisplayObjectContainer) + { + _loc3_ = this._child as DisplayObjectContainer; + _loc4_ = 0; + while(_loc4_ < param2) + { + if(_loc3_.numChildren > 0) + { + _loc5_ = _loc3_.getChildAt(0); + if(_loc5_ is DisplayObjectContainer) + { + _loc3_ = _loc5_ as DisplayObjectContainer; + _loc4_++; + continue; + } + break; + } + break; + } + _loc3_.transform.colorTransform = param1; + } + else + { + transform.colorTransform = param1; + } + + } + + public function get roundCornerRadius() : uint + { + return this._roundCornerRadius; + } + + public function set roundCornerRadius(param1:uint) : void + { + this._roundCornerRadius = param1; + this.initMask(); + } + + public function get playOnce() : Boolean + { + return this._playOnce; + } + + public function set playOnce(param1:Boolean) : void + { + if((this._child) && this._child is MovieClip) + { + MovieClip(this._child).addFrameScript(MovieClip(this._child).totalFrames - 1,param1?this.stopAllAnimation:null); + } + this._playOnce = param1; + } + + public function finalize() : void + { + this.reload(); + } + + override public function free() : void + { + super.free(); + this._finalized = false; + this._uri = null; + this._child = null; + this._startedWidth = 0; + this._startedHeight = 0; + this._forcedHeight = 0; + this._forcedWidth = 0; + this._keepRatio = false; + this._dispatchMessages = false; + this._autoGrid = false; + this._forceReload = false; + this._gotoFrame = null; + this._loader = null; + this._startBounds = null; + this._playOnce = false; + } + + override public function getChildByName(param1:String) : DisplayObject + { + if((this._child) && this._child is DisplayObjectContainer) + { + return DisplayObjectContainer(this._child).getChildByName(param1); + } + return null; + } + + public function nextFrame() : void + { + var _loc2_:* = 0; + var _loc1_:MovieClip = this._child as MovieClip; + if(_loc1_) + { + if(_loc1_.currentFrame == _loc1_.totalFrames) + { + _loc1_.gotoAndStop(1); } else { - if ((this._child is MovieClip)) - { - mc = (this._child as MovieClip); - mc.gotoAndPlay(frameNumber); - }; - }; - } - - public function colorTransform(colorTransform:ColorTransform, depth:int=0):void - { - var currentChild:DisplayObjectContainer; - var i:int; - var child:DisplayObject; - if (depth == 0) - { - transform.colorTransform = colorTransform; + _loc1_.gotoAndStop(_loc1_.currentFrame + 1); } - else + } + } + + private function reload() : void + { + var _loc1_:Uri = null; + var _loc2_:Class = null; + var _loc3_:* = false; + if(!(this._bitmap == null) && !(this._child == this._bitmap)) + { + if((this._child) && (this._child.parent)) + { + this.stopAllAnimation(); + this._child.parent.removeChild(this._child); + this._child = null; + } + this._child = addChild(this._bitmap); + this._startBounds = this._child.getBounds(this); + this._startedWidth = this._child.width; + this._startedHeight = this._child.height; + this.organize(); + if(this._disableAnimation) { - if ((this._child is DisplayObjectContainer)) - { - currentChild = (this._child as DisplayObjectContainer); - i = 0; - while (i < depth) - { - if (currentChild.numChildren > 0) - { - child = currentChild.getChildAt(0); - if ((child is DisplayObjectContainer)) - { - currentChild = (child as DisplayObjectContainer); - } - else - { - break; - }; - } - else - { - break; - }; - i++; - }; - currentChild.transform.colorTransform = colorTransform; - } - else - { - transform.colorTransform = colorTransform; - }; - }; - } - - public function get roundCornerRadius():uint - { - return (this._roundCornerRadius); - } - - public function set roundCornerRadius(v:uint):void - { - this._roundCornerRadius = v; - this.initMask(); - } - - public function get playOnce():Boolean - { - return (this._playOnce); - } - - public function set playOnce(v:Boolean):void - { - if (((this._child) && ((this._child is MovieClip)))) - { - MovieClip(this._child).addFrameScript((MovieClip(this._child).totalFrames - 1), ((v) ? this.stopAllAnimation : null)); - }; - this._playOnce = v; - } - - public function finalize():void - { - this.reload(); - } - - override public function free():void - { - super.free(); - this._finalized = false; - this._uri = null; - this._child = null; - this._startedWidth = 0; - this._startedHeight = 0; - this._forcedHeight = 0; - this._forcedWidth = 0; - this._keepRatio = false; - this._dispatchMessages = false; - this._autoGrid = false; - this._forceReload = false; - this._gotoFrame = null; - this._loader = null; - this._startBounds = null; - this._playOnce = false; - } - - override public function getChildByName(name:String):DisplayObject - { - if (((this._child) && ((this._child is DisplayObjectContainer)))) - { - return (DisplayObjectContainer(this._child).getChildByName(name)); - }; - return (null); - } - - public function nextFrame():void - { - var frame:int; - var child:MovieClip = (this._child as MovieClip); - if (child) - { - if (child.currentFrame == child.totalFrames) - { - child.gotoAndStop(1); - } - else - { - child.gotoAndStop((child.currentFrame + 1)); - }; - }; - } - - private function reload():void - { - var realUri:Uri; - var forcedAdapter:Class; - var singleFile:Boolean; - if (((!((this._bitmap == null))) && (!((this._child == this._bitmap))))) - { - if (((this._child) && (this._child.parent))) - { - this.stopAllAnimation(); - this._child.parent.removeChild(this._child); - this._child = null; - }; - this._child = addChild(this._bitmap); - this._startBounds = this._child.getBounds(this); - this._startedWidth = this._child.width; - this._startedHeight = this._child.height; - this.organize(); - if (this._disableAnimation) - { - MovieClipUtils.stopMovieClip(this); - }; - if (((((this._dispatchMessages) && (Berilia.getInstance()))) && (Berilia.getInstance().handler))) - { - dispatchEvent(new Event(Event.COMPLETE)); - Berilia.getInstance().handler.process(new TextureReadyMessage(this)); - }; + MovieClipUtils.stopMovieClip(this); + } + if((this._dispatchMessages) && (Berilia.getInstance()) && (Berilia.getInstance().handler)) + { + dispatchEvent(new Event(Event.COMPLETE)); + Berilia.getInstance().handler.process(new TextureReadyMessage(this)); + } + } + else if(this._uri) + { + if(!this._loader) + { + this._loader = ResourceLoaderFactory.getLoader(ResourceLoaderType.SINGLE_LOADER); + this._loader.addEventListener(ResourceLoadedEvent.LOADED,this.onLoaded,false,0,true); + this._loader.addEventListener(ResourceErrorEvent.ERROR,this.onFailed,false,0,true); } else { - if (this._uri) - { - if (!(this._loader)) - { - this._loader = ResourceLoaderFactory.getLoader(ResourceLoaderType.SINGLE_LOADER); - this._loader.addEventListener(ResourceLoadedEvent.LOADED, this.onLoaded, false, 0, true); - this._loader.addEventListener(ResourceErrorEvent.ERROR, this.onFailed, false, 0, true); - } - else - { - this._loader.cancel(); - }; - if (this._uri.subPath) - { - if ((((((((((((this._uri.protocol == "mod")) || ((this._uri.protocol == "theme")))) || ((this._uri.protocol == "pak")))) || ((this._uri.protocol == "d2p")))) || ((this._uri.protocol == "pak2")))) || ((this._uri.protocol == "d2pOld")))) - { - realUri = new Uri(this._uri.normalizedUri); - } - else - { - if (((AirScanner.hasAir()) && (!((this._uri.protocol == "httpc"))))) - { - realUri = new Uri(this._uri.path); - } - else - { - realUri = this._uri; - }; - }; - realUri.loaderContext = this._uri.loaderContext; - this._realUri = realUri; - if (!((((((((this._uri.protocol == "pak")) || ((this._uri.protocol == "d2p")))) || ((this._uri.protocol == "pak2")))) || ((this._uri.protocol == "dp2Old"))))) - { - forcedAdapter = AdvancedSwfAdapter; - }; - } - else - { - realUri = this._uri; - }; - if ((((((this._uri.protocol == "httpc")) && (this.defaultBitmapData))) && (!(this._loader.isInCache(this.uri))))) - { - this.loadBitmapData(this.defaultBitmapData); - }; - if (hasEventListener(Event.INIT)) - { - dispatchEvent(new Event(Event.INIT)); - }; - singleFile = false; - if (((!(this._useCache)) && (!(this._uri.subPath)))) - { - singleFile = true; - }; - this._loader.load(realUri, ((this._useCache) ? UriCacheFactory.getCacheFromUri(realUri) : null), forcedAdapter, singleFile); - } - else - { - if (this._child) - { - while (numChildren) - { - removeChildAt(0); - }; - this._child = null; - }; - this._finalized = true; - if (getUi()) - { - getUi().iAmFinalized(this); - }; - }; - }; - } - - private function organize():void - { - var rec:Rectangle; - var ratio:Number; - if (!(this._child)) - { - return; - }; - var rerender:Boolean; - if (((this._gotoFrame) && ((this._child is MovieClip)))) - { - this.gotoAndStop = this._gotoFrame; + this._loader.cancel(); + } + if(this._uri.subPath) + { + if(this._uri.protocol == "mod" || this._uri.protocol == "theme" || this._uri.protocol == "pak" || this._uri.protocol == "d2p" || this._uri.protocol == "pak2" || this._uri.protocol == "d2pOld") + { + _loc1_ = new Uri(this._uri.normalizedUri); + } + else if((AirScanner.hasAir()) && !(this._uri.protocol == "httpc")) + { + _loc1_ = new Uri(this._uri.path); + } + else + { + _loc1_ = this._uri; + } + + _loc1_.loaderContext = this._uri.loaderContext; + this._realUri = _loc1_; + if(!(this._uri.protocol == "pak" || this._uri.protocol == "d2p" || this._uri.protocol == "pak2" || this._uri.protocol == "dp2Old")) + { + _loc2_ = AdvancedSwfAdapter; + } } else { - this.gotoAndStop = "0"; - }; - this.playOnce = this._playOnce; - if (this._autoGrid) - { - rec = new Rectangle((this._startedWidth / 3), int((this._startedHeight / 3)), (this._startedWidth / 3), int((this._startedHeight / 3))); - try - { - this._child.scale9Grid = rec; - } - catch(e:Error) - { - _log.error(((("Erreur de scale9grid avec " + _uri) + ", rect : ") + rec)); - }; - }; - if (this._keepRatio) - { - ratio = 1; - if (((isNaN(this._forcedWidth)) && (isNaN(this._forcedHeight)))) - { - this._log.warn("Cannot keep the ratio with no forced dimension."); - } - else - { - if (isNaN(this._forcedWidth)) - { - ratio = (this._forcedHeight / this._child.height); - } - else - { - if (isNaN(this._forcedHeight)) - { - ratio = (this._forcedWidth / this._child.width); - } - else - { - if (this._forcedHeight > this._forcedWidth) - { - ratio = (this._child.width / this._forcedWidth); - } - else - { - if (this._forcedHeight < this._forcedWidth) - { - ratio = (this._child.height / this._forcedHeight); - }; - }; - }; - }; - this._child.scaleX = (this._child.scaleY = ratio); - }; + _loc1_ = this._uri; + } + if((this._uri.protocol == "httpc") && (this.defaultBitmapData) && !this._loader.isInCache(this.uri)) + { + this.loadBitmapData(this.defaultBitmapData); + } + if(hasEventListener(Event.INIT)) + { + dispatchEvent(new Event(Event.INIT)); + } + _loc3_ = false; + if(!this._useCache && !this._uri.subPath) + { + _loc3_ = true; + } + this._loader.load(_loc1_,this._useCache?UriCacheFactory.getCacheFromUri(_loc1_):null,_loc2_,_loc3_); + } + else + { + if(this._child) + { + while(numChildren) + { + removeChildAt(0); + } + this._child = null; + } + this._finalized = true; + if(getUi()) + { + getUi().iAmFinalized(this); + } + } + + } + + private function organize() : void + { + var rec:Rectangle = null; + var ratio:Number = NaN; + if(!this._child) + { + return; + } + var rerender:Boolean = false; + if((this._gotoFrame) && this._child is MovieClip) + { + this.gotoAndStop = this._gotoFrame; + } + else + { + this.gotoAndStop = "0"; + } + this.playOnce = this._playOnce; + if(this._autoGrid) + { + rec = new Rectangle(this._startedWidth / 3,int(this._startedHeight / 3),this._startedWidth / 3,int(this._startedHeight / 3)); + try + { + this._child.scale9Grid = rec; + } + catch(e:Error) + { + _log.error("Erreur de scale9grid avec " + _uri + ", rect : " + rec); + } + } + if(this._keepRatio) + { + ratio = 1; + if((isNaN(this._forcedWidth)) && (isNaN(this._forcedHeight))) + { + this._log.warn("Cannot keep the ratio with no forced dimension."); } else { - if (((((!(isNaN(this._forcedHeight))) && (!((this._forcedHeight == 0))))) && (!((this._forcedHeight == this._child.height))))) - { - this._child.height = this._forcedHeight; - } - else - { - rerender = true; - }; - if (!(isNaN(this._forcedWidth))) - { - this._child.width = this._forcedWidth; - } - else - { - rerender = true; - }; - }; - if (!(this._finalized)) - { - this._finalized = true; - if (getUi()) - { - getUi().iAmFinalized(this); - }; + if(isNaN(this._forcedWidth)) + { + ratio = this._forcedHeight / this._child.height; + } + else if(isNaN(this._forcedHeight)) + { + ratio = this._forcedWidth / this._child.width; + } + else if(this._forcedHeight > this._forcedWidth) + { + ratio = this._child.width / this._forcedWidth; + } + else if(this._forcedHeight < this._forcedWidth) + { + ratio = this._child.height / this._forcedHeight; + } + + + + this._child.scaleX = this._child.scaleY = ratio; + } + } + else + { + if(!isNaN(this._forcedHeight) && !(this._forcedHeight == 0) && !(this._forcedHeight == this._child.height)) + { + this._child.height = this._forcedHeight; } else { - if (((rerender) || (true))) - { - if (getUi()) - { - getUi().iAmFinalized(this); - }; - }; - }; - } - - private function initMask():void - { - if (((mask) && ((mask.parent == this)))) - { - removeChild(mask); - }; - if (this._roundCornerRadius == 0) - { - mask = null; - return; - }; - var maskCtr:Shape = new Shape(); - maskCtr.graphics.beginFill(0x770000); - maskCtr.graphics.drawRoundRectComplex(0, 0, this.width, this.height, this._roundCornerRadius, this._roundCornerRadius, this._roundCornerRadius, this._roundCornerRadius); - addChild(maskCtr); - mask = maskCtr; - } - - private function onLoaded(rle:ResourceLoadedEvent):void - { - var aswf:ASwf; - var error:ResourceErrorEvent; - if (__removed) - { - return; - }; - if (this._bitmap != null) - { - if (this._bitmap.parent == this) - { - removeChild(this._bitmap); - }; - this._bitmap = null; - }; - var pattern:RegExp = /\/(_[0-9]*_\/)/i; - if ((((this._uri == null)) || (((!((this._uri.path == rle.uri.path))) && (!((this._uri.normalizedUri == rle.uri.path))))))) - { - this.rle_uri_path = rle.uri.path; - return; - }; - this._loader.removeEventListener(ResourceLoadedEvent.LOADED, this.onLoaded); - this._loader.removeEventListener(ResourceErrorEvent.ERROR, this.onFailed); - this._loader = null; - if (((this._child) && (this._child.parent))) - { - this.stopAllAnimation(); - this._child.parent.removeChild(this._child); - this._child = null; - }; - if (rle.resourceType == ResourceType.RESOURCE_SWF) - { - if (!(rle.resource)) - { - this._log.warn(((("Empty SWF : " + rle.uri) + " in ") + getUi().name)); - return; - }; - this._child = addChild(rle.resource); - if ((this._child is MovieClip)) - { - (this._child as MovieClip).stop(); - }; + rerender = true; + } + if(!isNaN(this._forcedWidth)) + { + this._child.width = this._forcedWidth; } else { - if (rle.resourceType == ResourceType.RESOURCE_BITMAP) - { - this._child = addChild(new Bitmap(rle.resource, "auto", true)); - } - else - { - if (rle.resourceType == ResourceType.RESOURCE_ASWF) - { - aswf = ASwf(rle.resource); - if (this._uri.subPath) - { - try - { - this._child = addChild((new ((aswf.applicationDomain.getDefinition(this._uri.subPath) as Class))() as DisplayObject)); - } - catch(e:Error) - { - error = new ResourceErrorEvent(ResourceErrorEvent.ERROR); - error.errorCode = ResourceErrorCode.SUB_RESOURCE_NOT_FOUND; - error.uri = _uri; - error.errorMsg = (("Sub ressource '" + _uri.subPath) + "' not found"); - onFailed(error); - return; - }; - } - else - { - this._child = addChild(aswf.content); - if ((this._child is MovieClip)) - { - (this._child as MovieClip).stop(); - }; - }; - } - else - { - throw (new IllegalOperationError("A Texture component can't display a non-displayable resource.")); - }; - }; - }; - if (this._child != null) - { - this._startBounds = this._child.getBounds(this); - this._startedWidth = this._child.width; - this._startedHeight = this._child.height; - }; - this.organize(); - if (this._disableAnimation) - { - MovieClipUtils.stopMovieClip(this); - }; - if (hasEventListener(Event.COMPLETE)) - { - dispatchEvent(new Event(Event.COMPLETE)); - }; - if (((((this._dispatchMessages) && (Berilia.getInstance()))) && (Berilia.getInstance().handler))) - { - Berilia.getInstance().handler.process(new TextureReadyMessage(this)); - }; - this.initMask(); - } - - private function onFailed(ree:ResourceErrorEvent):void - { - var shp:Shape; - if (__removed) - { - return; - }; - var behavior:DynamicSecureObject = new DynamicSecureObject(); - behavior.cancel = false; - if (KernelEventsManager.getInstance().isRegisteredEvent(BeriliaHookList.TextureLoadFailed.name)) - { - this._finalized = true; - KernelEventsManager.getInstance().processCallback(BeriliaHookList.TextureLoadFailed, SecureCenter.secure(this, ((getUi()) ? getUi().uiModule.trusted : false)), behavior); + rerender = true; + } + } + if(!this._finalized) + { + this._finalized = true; + if(getUi()) + { + getUi().iAmFinalized(this); + } + } + else if((rerender) || true) + { + if(getUi()) + { + getUi().iAmFinalized(this); + } + } + + } + + private function initMask() : void + { + if((mask) && mask.parent == this) + { + removeChild(mask); + } + if(this._roundCornerRadius == 0) + { + mask = null; + return; + } + var _loc1_:Shape = new Shape(); + _loc1_.graphics.beginFill(7798784); + _loc1_.graphics.drawRoundRectComplex(0,0,this.width,this.height,this._roundCornerRadius,this._roundCornerRadius,this._roundCornerRadius,this._roundCornerRadius); + addChild(_loc1_); + mask = _loc1_; + } + + private var rle_uri_path; + + private function onLoaded(param1:ResourceLoadedEvent) : void + { + var aswf:ASwf = null; + var error:ResourceErrorEvent = null; + var rle:ResourceLoadedEvent = param1; + if(__removed) + { + return; + } + if(this._bitmap != null) + { + if(this._bitmap.parent == this) + { + removeChild(this._bitmap); + } + this._bitmap = null; + } + var pattern:RegExp = new RegExp("\\/(_[0-9]*_\\/)","i"); + if(this._uri == null || !(this._uri.path == rle.uri.path) && !(this._uri.normalizedUri == rle.uri.path)) + { + this.rle_uri_path = rle.uri.path; + return; + } + this._loader.removeEventListener(ResourceLoadedEvent.LOADED,this.onLoaded); + this._loader.removeEventListener(ResourceErrorEvent.ERROR,this.onFailed); + this._loader = null; + if((this._child) && (this._child.parent)) + { + this.stopAllAnimation(); + this._child.parent.removeChild(this._child); + this._child = null; + } + if(rle.resourceType == ResourceType.RESOURCE_SWF) + { + if(!rle.resource) + { + this._log.warn("Empty SWF : " + rle.uri + " in " + getUi().name); + return; + } + this._child = addChild(rle.resource); + if(this._child is MovieClip) + { + (this._child as MovieClip).stop(); + } + } + else if(rle.resourceType == ResourceType.RESOURCE_BITMAP) + { + this._child = addChild(new Bitmap(rle.resource,"auto",true)); + } + else if(rle.resourceType == ResourceType.RESOURCE_ASWF) + { + aswf = ASwf(rle.resource); + if(this._uri.subPath) + { + try + { + this._child = addChild(new (aswf.applicationDomain.getDefinition(this._uri.subPath) as Class)() as DisplayObject); + } + catch(e:Error) + { + error = new ResourceErrorEvent(ResourceErrorEvent.ERROR); + error.errorCode = ResourceErrorCode.SUB_RESOURCE_NOT_FOUND; + error.uri = _uri; + error.errorMsg = "Sub ressource \'" + _uri.subPath + "\' not found"; + onFailed(error); + return; + } } else { - this._log.error(((((("UI " + ((getUi()) ? getUi().name : "unknow")) + ", texture resource not found: ") + ((ree) ? ree.errorMsg : "No ressource specified.")) + ", requested uri : ") + ree.uri)); - }; - dispatchEvent(new TextureLoadFailedEvent(this, behavior)); - Berilia.getInstance().handler.process(new TextureLoadFailMessage(this)); - if (((!(behavior.cancel)) && ((ree.uri == this._uri)))) - { - this._loader = null; - if (ree.uri == this._uri) - { - if (this._child) - { - while (numChildren) - { - removeChildAt(0); - }; - this._child = null; - this._bitmap = null; - }; - if (this._showLoadingError) - { - shp = new Shape(); - shp.graphics.beginFill(0xFF00FF); - shp.graphics.drawRect(0, 0, ((((!(isNaN(this._forcedWidth))) && (!((this._forcedWidth == 0))))) ? this._forcedWidth : (10)), ((((!(isNaN(this._forcedHeight))) && (!((this._forcedHeight == 0))))) ? this._forcedHeight : 10)); - shp.graphics.endFill(); - this._child = addChild(shp); - }; - }; - }; + this._child = addChild(aswf.content); + if(this._child is MovieClip) + { + (this._child as MovieClip).stop(); + } + } + } + else + { + throw new IllegalOperationError("A Texture component can\'t display a non-displayable resource."); + } + + + if(this._child != null) + { + this._startBounds = this._child.getBounds(this); + this._startedWidth = this._child.width; + this._startedHeight = this._child.height; + } + this.organize(); + if(this._disableAnimation) + { + MovieClipUtils.stopMovieClip(this); + } + if(hasEventListener(Event.COMPLETE)) + { + dispatchEvent(new Event(Event.COMPLETE)); + } + if((this._dispatchMessages) && (Berilia.getInstance()) && (Berilia.getInstance().handler)) + { + Berilia.getInstance().handler.process(new TextureReadyMessage(this)); + } + this.initMask(); + } + + private function onFailed(param1:ResourceErrorEvent) : void + { + var _loc3_:Shape = null; + if(__removed) + { + return; + } + var _loc2_:DynamicSecureObject = new DynamicSecureObject(); + _loc2_.cancel = false; + if(KernelEventsManager.getInstance().isRegisteredEvent(BeriliaHookList.TextureLoadFailed.name)) + { this._finalized = true; - if (getUi()) - { - getUi().iAmFinalized(this); - }; - } - - override public function remove():void - { - if (!(__removed)) - { - __removed = true; - if (this._child) - { - this._child.width = this._startedWidth; - this._child.height = this._startedHeight; - this._child.scaleX = 1; - this._child.scaleY = 1; - if ((this._child is MovieClip)) - { - MovieClipUtils.stopMovieClip((this._child as MovieClip)); - }; - if (this._child.parent) - { - this._child.parent.removeChild(this._child); - }; - }; - if (((parent) && (parent.contains(this)))) - { - parent.removeChild(this); - }; - }; - super.remove(); - } - - - } -}//package com.ankamagames.berilia.components - + KernelEventsManager.getInstance().processCallback(BeriliaHookList.TextureLoadFailed,SecureCenter.secure(this,getUi()?getUi().uiModule.trusted:false),_loc2_); + } + else + { + this._log.error("UI " + (getUi()?getUi().name:"unknow") + ", texture resource not found: " + (param1?param1.errorMsg:"No ressource specified.") + ", requested uri : " + param1.uri); + } + dispatchEvent(new TextureLoadFailedEvent(this,_loc2_)); + Berilia.getInstance().handler.process(new TextureLoadFailMessage(this)); + if(!_loc2_.cancel && param1.uri == this._uri) + { + this._loader = null; + if(param1.uri == this._uri) + { + if(this._child) + { + while(numChildren) + { + removeChildAt(0); + } + this._child = null; + this._bitmap = null; + } + if(this._showLoadingError) + { + _loc3_ = new Shape(); + _loc3_.graphics.beginFill(16711935); + _loc3_.graphics.drawRect(0,0,!isNaN(this._forcedWidth) && !(this._forcedWidth == 0)?this._forcedWidth:10,!isNaN(this._forcedHeight) && !(this._forcedHeight == 0)?this._forcedHeight:10); + _loc3_.graphics.endFill(); + this._child = addChild(_loc3_); + } + } + } + this._finalized = true; + if(getUi()) + { + getUi().iAmFinalized(this); + } + } + + override public function remove() : void + { + if(!__removed) + { + __removed = true; + if(this._child) + { + this._child.width = this._startedWidth; + this._child.height = this._startedHeight; + this._child.scaleX = 1; + this._child.scaleY = 1; + if(this._child is MovieClip) + { + MovieClipUtils.stopMovieClip(this._child as MovieClip); + } + if(this._child.parent) + { + this._child.parent.removeChild(this._child); + } + } + if((parent) && (parent.contains(this))) + { + parent.removeChild(this); + } + } + super.remove(); + } + } +} diff --git a/com/ankamagames/berilia/components/Tree.as b/com/ankamagames/berilia/components/Tree.as index 865ce4f22..051bcd0ec 100644 --- a/com/ankamagames/berilia/components/Tree.as +++ b/com/ankamagames/berilia/components/Tree.as @@ -1,95 +1,92 @@ -package com.ankamagames.berilia.components +package com.ankamagames.berilia.components { - import com.ankamagames.berilia.UIComponent; - import __AS3__.vec.Vector; - import com.ankamagames.berilia.types.data.TreeData; - import flash.utils.getQualifiedClassName; - import com.ankamagames.berilia.components.gridRenderer.TreeGridRenderer; - import flash.errors.IllegalOperationError; - import com.ankamagames.berilia.managers.SecureCenter; - import __AS3__.vec.*; - - public class Tree extends Grid implements UIComponent - { - - protected var _realDataProvider; - protected var _treeDataProvider:Vector.; - - public function Tree() - { - _sRendererName = getQualifiedClassName(TreeGridRenderer); - } - - override public function set rendererName(value:String):void - { - throw (new IllegalOperationError("rendererName cannot be set")); - } - - override public function set dataProvider(data:*):void - { - this._realDataProvider = data; - this._treeDataProvider = TreeData.fromArray(data); - super.dataProvider = this.makeDataProvider(this._treeDataProvider); - } - - override public function get dataProvider() - { - return (this._realDataProvider); - } - - public function get treeRoot():TreeData - { - var treeRoot:TreeData; - if (_dataProvider.length > 0) + import com.ankamagames.berilia.UIComponent; + import com.ankamagames.berilia.types.data.TreeData; + import flash.errors.IllegalOperationError; + import com.ankamagames.berilia.managers.SecureCenter; + import flash.utils.getQualifiedClassName; + import com.ankamagames.berilia.components.gridRenderer.TreeGridRenderer; + + public class Tree extends Grid implements UIComponent + { + + public function Tree() + { + super(); + _sRendererName = getQualifiedClassName(TreeGridRenderer); + } + + protected var _realDataProvider; + + protected var _treeDataProvider:Vector.; + + override public function set rendererName(param1:String) : void + { + throw new IllegalOperationError("rendererName cannot be set"); + } + + override public function set dataProvider(param1:*) : void + { + this._realDataProvider = param1; + this._treeDataProvider = TreeData.fromArray(param1); + super.dataProvider = this.makeDataProvider(this._treeDataProvider); + } + + override public function get dataProvider() : * + { + return this._realDataProvider; + } + + public function get treeRoot() : TreeData + { + var _loc1_:TreeData = null; + if(_dataProvider.length > 0) + { + _loc1_ = _dataProvider[0].parent; + } + return _loc1_; + } + + public function rerender() : void + { + super.dataProvider = this.makeDataProvider(this._treeDataProvider); + } + + public function expandItems(param1:Array) : void + { + var _loc2_:Object = null; + var _loc3_:TreeData = null; + if(!param1) + { + return; + } + for each(_loc2_ in param1) + { + _loc3_ = SecureCenter.unsecure(_loc2_) as TreeData; + if(_loc3_.children.length > 0) { - treeRoot = _dataProvider[0].parent; - }; - return (treeRoot); - } - - public function rerender():void - { - super.dataProvider = this.makeDataProvider(this._treeDataProvider); - } - - public function expandItems(pItems:Array):void - { - var item:Object; - var treeData:TreeData; - if (!(pItems)) + _loc3_.expend = true; + } + } + this.rerender(); + } + + private function makeDataProvider(param1:Vector., param2:Vector. = null) : Vector. + { + var _loc3_:TreeData = null; + if(!param2) + { + var param2:Vector. = new Vector.(); + } + for each(_loc3_ in param1) + { + param2.push(_loc3_); + if(_loc3_.expend) { - return; - }; - for each (item in pItems) - { - treeData = (SecureCenter.unsecure(item) as TreeData); - if (treeData.children.length > 0) - { - treeData.expend = true; - }; - }; - this.rerender(); - } - - private function makeDataProvider(v:Vector., result:Vector.=null):Vector. - { - var node:TreeData; - if (!(result)) - { - result = new Vector.(); - }; - for each (node in v) - { - result.push(node); - if (node.expend) - { - this.makeDataProvider(node.children, result); - }; - }; - return (result); - } - - - } -}//package com.ankamagames.berilia.components - + this.makeDataProvider(_loc3_.children,param2); + } + } + return param2; + } + } +} diff --git a/com/ankamagames/berilia/components/VideoPlayer.as b/com/ankamagames/berilia/components/VideoPlayer.as index 3dc3cd137..4da95c991 100644 --- a/com/ankamagames/berilia/components/VideoPlayer.as +++ b/com/ankamagames/berilia/components/VideoPlayer.as @@ -1,310 +1,327 @@ -package com.ankamagames.berilia.components +package com.ankamagames.berilia.components { - import com.ankamagames.berilia.types.graphic.GraphicContainer; - import com.ankamagames.berilia.FinalizableUIComponent; - import com.ankamagames.jerakine.logger.Logger; - import com.ankamagames.jerakine.logger.Log; - import flash.utils.getQualifiedClassName; - import flash.media.Video; - import flash.net.NetConnection; - import flash.net.NetStream; - import com.ankamagames.jerakine.managers.OptionManager; - import flash.media.SoundTransform; - import flash.net.ObjectEncoding; - import flash.events.NetStatusEvent; - import flash.events.SecurityErrorEvent; - import flash.events.AsyncErrorEvent; - import com.ankamagames.jerakine.types.events.PropertyChangeEvent; - import com.ankamagames.berilia.Berilia; - import com.ankamagames.berilia.components.messages.VideoConnectFailedMessage; - import com.ankamagames.berilia.components.messages.VideoConnectSuccessMessage; - import com.ankamagames.berilia.components.messages.VideoBufferChangeMessage; - - public class VideoPlayer extends GraphicContainer implements FinalizableUIComponent - { - - protected static const _log:Logger = Log.getLogger(getQualifiedClassName(VideoPlayer)); - - private var _finalized:Boolean; - private var _video:Video; - private var _netConnection:NetConnection; - private var _netStream:NetStream; - private var _flv:String; - private var _fms:String; - private var _client:Object; - private var _autoPlay:Boolean; - private var _mute:Boolean = false; - private var _optionManager:OptionManager; - private var _soundTransform:SoundTransform; - - - public function finalize():void - { - NetConnection.defaultObjectEncoding = ObjectEncoding.AMF0; - graphics.clear(); - graphics.beginFill(0); - graphics.drawRect(0, 0, width, height); - graphics.endFill(); - this._video = new Video(width, height); - this._client = new Object(); - this._client.onBWDone = this.onBWDone; - this._client.onMetaData = this.onMetaData; - this._netConnection = new NetConnection(); - this._netConnection.addEventListener(NetStatusEvent.NET_STATUS, this.onNetStatus); - this._netConnection.addEventListener(SecurityErrorEvent.SECURITY_ERROR, this.onSecurityError); - this._netConnection.addEventListener(AsyncErrorEvent.ASYNC_ERROR, this.onASyncError); - this._netConnection.client = this._client; - if (this._autoPlay) + import com.ankamagames.berilia.types.graphic.GraphicContainer; + import com.ankamagames.berilia.FinalizableUIComponent; + import com.ankamagames.jerakine.logger.Logger; + import com.ankamagames.jerakine.logger.Log; + import flash.utils.getQualifiedClassName; + import flash.media.Video; + import flash.net.NetConnection; + import flash.net.NetStream; + import com.ankamagames.jerakine.managers.OptionManager; + import flash.media.SoundTransform; + import flash.net.ObjectEncoding; + import flash.events.NetStatusEvent; + import flash.events.SecurityErrorEvent; + import flash.events.AsyncErrorEvent; + import com.ankamagames.jerakine.types.events.PropertyChangeEvent; + import com.ankamagames.berilia.Berilia; + import com.ankamagames.berilia.components.messages.VideoConnectFailedMessage; + import com.ankamagames.berilia.components.messages.VideoConnectSuccessMessage; + import com.ankamagames.berilia.components.messages.VideoBufferChangeMessage; + + public class VideoPlayer extends GraphicContainer implements FinalizableUIComponent + { + + public function VideoPlayer() + { + super(); + } + + protected static const _log:Logger = Log.getLogger(getQualifiedClassName(VideoPlayer)); + + private var _finalized:Boolean; + + private var _video:Video; + + private var _netConnection:NetConnection; + + private var _netStream:NetStream; + + private var _flv:String; + + private var _fms:String; + + private var _client:Object; + + private var _autoPlay:Boolean; + + private var _mute:Boolean = false; + + private var _optionManager:OptionManager; + + private var _soundTransform:SoundTransform; + + public function finalize() : void + { + NetConnection.defaultObjectEncoding = ObjectEncoding.AMF0; + graphics.clear(); + graphics.beginFill(0); + graphics.drawRect(0,0,width,height); + graphics.endFill(); + this._video = new Video(width,height); + this._client = new Object(); + this._client.onBWDone = this.onBWDone; + this._client.onMetaData = this.onMetaData; + this._netConnection = new NetConnection(); + this._netConnection.addEventListener(NetStatusEvent.NET_STATUS,this.onNetStatus); + this._netConnection.addEventListener(SecurityErrorEvent.SECURITY_ERROR,this.onSecurityError); + this._netConnection.addEventListener(AsyncErrorEvent.ASYNC_ERROR,this.onASyncError); + this._netConnection.client = this._client; + if(this._autoPlay) + { + this.connect(); + } + this._finalized = true; + getUi().iAmFinalized(this); + this._optionManager = OptionManager.getOptionManager("tubul"); + if(this._optionManager) + { + this._optionManager.addEventListener(PropertyChangeEvent.PROPERTY_CHANGED,this.onPropertyChange,false,0,true); + this._soundTransform = new SoundTransform(this._optionManager["volumeAmbientSound"]); + } + } + + public function connect() : void + { + this._netConnection.connect(this._fms); + } + + public function play() : void + { + var _loc1_:SoundTransform = null; + if(this._flv) + { + this._netStream = new NetStream(this._netConnection); + this._netStream.client = this._client; + this._netStream.addEventListener(NetStatusEvent.NET_STATUS,this.onNetStatus); + this._netStream.addEventListener(AsyncErrorEvent.ASYNC_ERROR,this.onASyncError); + this._video.attachNetStream(this._netStream); + this._netStream.soundTransform = this._soundTransform; + if(this.mute) { - this.connect(); - }; - this._finalized = true; - getUi().iAmFinalized(this); - this._optionManager = OptionManager.getOptionManager("tubul"); - if (this._optionManager) - { - this._optionManager.addEventListener(PropertyChangeEvent.PROPERTY_CHANGED, this.onPropertyChange, false, 0, true); - this._soundTransform = new SoundTransform(this._optionManager["volumeAmbientSound"]); - }; - } - - public function connect():void - { - this._netConnection.connect(this._fms); - } - - public function play():void - { - var soundTrans:SoundTransform; - if (this._flv) - { - this._netStream = new NetStream(this._netConnection); - this._netStream.client = this._client; - this._netStream.addEventListener(NetStatusEvent.NET_STATUS, this.onNetStatus); - this._netStream.addEventListener(AsyncErrorEvent.ASYNC_ERROR, this.onASyncError); - this._video.attachNetStream(this._netStream); - this._netStream.soundTransform = this._soundTransform; - if (this.mute) - { - soundTrans = new SoundTransform(); - soundTrans.volume = 0; - this._netStream.soundTransform = soundTrans; - }; - this._netStream.play(this._flv); + _loc1_ = new SoundTransform(); + _loc1_.volume = 0; + this._netStream.soundTransform = _loc1_; } - else - { - _log.error("No Video File to play :("); - }; - } - - public function stop():void - { - if (this._netStream) + this._netStream.play(this._flv); + } + else + { + _log.error("No Video File to play :("); + } + } + + public function stop() : void + { + if(this._netStream) + { + this._netStream.close(); + } + this._netConnection.close(); + this._video.clear(); + } + + private function onNetStatus(param1:NetStatusEvent) : void + { + switch(param1.info.code) + { + case "NetConnection.Connect.Failed": + Berilia.getInstance().handler.process(new VideoConnectFailedMessage(this)); + _log.error("Can\'t connect to media server " + this._fms); + break; + case "NetStream.Failed": + Berilia.getInstance().handler.process(new VideoConnectFailedMessage(this)); + _log.error("Can\'t connect to media server " + this._fms); + break; + case "NetStream.Play.StreamNotFound": + Berilia.getInstance().handler.process(new VideoConnectFailedMessage(this)); + _log.error("Video file " + this._flv + " doesn\'t exist"); + break; + case "Netstream.Play.failed": + Berilia.getInstance().handler.process(new VideoConnectFailedMessage(this)); + _log.error("Video streaming failed for an unknown reason"); + break; + case "NetConnection.Connect.Success": + if(this._autoPlay) + { + this.play(); + } + Berilia.getInstance().handler.process(new VideoConnectSuccessMessage(this)); + break; + case "NetStream.Buffer.Full": + this.resizeVideo(); + addChild(this._video); + Berilia.getInstance().handler.process(new VideoBufferChangeMessage(this,0)); + break; + case "NetStream.Buffer.Flush": + Berilia.getInstance().handler.process(new VideoBufferChangeMessage(this,2)); + break; + case "NetStream.Buffer.Empty": + Berilia.getInstance().handler.process(new VideoBufferChangeMessage(this,1)); + break; + } + } + + private function onSecurityError(param1:SecurityErrorEvent) : void + { + Berilia.getInstance().handler.process(new VideoConnectFailedMessage(this)); + _log.error("Security Error: " + param1); + } + + private function onASyncError(param1:AsyncErrorEvent) : void + { + _log.warn("ASyncError: " + param1); + } + + private function onBWDone() : void + { + } + + private function onMetaData(param1:Object) : void + { + } + + private function onPropertyChange(param1:PropertyChangeEvent) : void + { + if((this._optionManager["muteAmbientSound"]) || (this._optionManager["tubulIsDesactivated"])) + { + this._soundTransform = new SoundTransform(0); + } + else + { + this._soundTransform = new SoundTransform(this._optionManager["volumeAmbientSound"]); + } + if(this._netStream) + { + this._netStream.soundTransform = this._soundTransform; + } + } + + public function set flv(param1:String) : void + { + if(!getUi().uiModule.trusted) + { + throw new SecurityError(); + } + else + { + var _loc2_:Array = param1.split("file://"); + if(_loc2_.length > 1) { - this._netStream.close(); - }; - this._netConnection.close(); - this._video.clear(); - } - - private function onNetStatus(event:NetStatusEvent):void - { - switch (event.info.code) - { - case "NetConnection.Connect.Failed": - Berilia.getInstance().handler.process(new VideoConnectFailedMessage(this)); - _log.error(("Can't connect to media server " + this._fms)); - return; - case "NetStream.Failed": - Berilia.getInstance().handler.process(new VideoConnectFailedMessage(this)); - _log.error(("Can't connect to media server " + this._fms)); - return; - case "NetStream.Play.StreamNotFound": - Berilia.getInstance().handler.process(new VideoConnectFailedMessage(this)); - _log.error((("Video file " + this._flv) + " doesn't exist")); - return; - case "Netstream.Play.failed": - Berilia.getInstance().handler.process(new VideoConnectFailedMessage(this)); - _log.error("Video streaming failed for an unknown reason"); - return; - case "NetConnection.Connect.Success": - if (this._autoPlay) - { - this.play(); - }; - Berilia.getInstance().handler.process(new VideoConnectSuccessMessage(this)); - return; - case "NetStream.Buffer.Full": - this.resizeVideo(); - addChild(this._video); - Berilia.getInstance().handler.process(new VideoBufferChangeMessage(this, 0)); - return; - case "NetStream.Buffer.Flush": - Berilia.getInstance().handler.process(new VideoBufferChangeMessage(this, 2)); - return; - case "NetStream.Buffer.Empty": - Berilia.getInstance().handler.process(new VideoBufferChangeMessage(this, 1)); - return; - }; - } - - private function onSecurityError(event:SecurityErrorEvent):void - { - Berilia.getInstance().handler.process(new VideoConnectFailedMessage(this)); - _log.error(("Security Error: " + event)); - } - - private function onASyncError(event:AsyncErrorEvent):void - { - _log.warn(("ASyncError: " + event)); - } - - private function onBWDone():void - { - } - - private function onMetaData(info:Object):void - { - } - - private function onPropertyChange(event:PropertyChangeEvent):void - { - if (((this._optionManager["muteAmbientSound"]) || (this._optionManager["tubulIsDesactivated"]))) - { - this._soundTransform = new SoundTransform(0); + this._flv = _loc2_[_loc2_.length - 1]; } else { - this._soundTransform = new SoundTransform(this._optionManager["volumeAmbientSound"]); - }; - if (this._netStream) - { - this._netStream.soundTransform = this._soundTransform; - }; - } - - public function set flv(value:String):void - { - if (!(getUi().uiModule.trusted)) - { - throw (new SecurityError()); - }; - var split:Array = value.split("file://"); - if (split.length > 1) + this._flv = param1; + } + return; + } + } + + public function get flv() : String + { + return this._flv; + } + + public function set fms(param1:String) : void + { + if(!getUi().uiModule.trusted) + { + throw new SecurityError(); + } + else + { + this._fms = param1; + return; + } + } + + public function get fms() : String + { + return this._fms; + } + + public function get autoPlay() : Boolean + { + return this._autoPlay; + } + + public function set autoPlay(param1:Boolean) : void + { + this._autoPlay = param1; + } + + public function set finalized(param1:Boolean) : void + { + this._finalized = param1; + } + + public function get finalized() : Boolean + { + return this._finalized; + } + + public function set mute(param1:Boolean) : void + { + var _loc2_:SoundTransform = null; + this._mute = param1; + if(this._netStream) + { + _loc2_ = new SoundTransform(); + if(param1) { - this._flv = split[(split.length - 1)]; + _loc2_.volume = 0; } else { - this._flv = value; - }; - } - - public function get flv():String - { - return (this._flv); - } - - public function set fms(value:String):void - { - if (!(getUi().uiModule.trusted)) - { - throw (new SecurityError()); - }; - this._fms = value; - } - - public function get fms():String - { - return (this._fms); - } - - public function get autoPlay():Boolean - { - return (this._autoPlay); - } - - public function set autoPlay(value:Boolean):void - { - this._autoPlay = value; - } - - public function set finalized(value:Boolean):void - { - this._finalized = value; - } - - public function get finalized():Boolean - { - return (this._finalized); - } - - public function set mute(mute:Boolean):void - { - var soundTrans:SoundTransform; - this._mute = mute; - if (this._netStream) + _loc2_.volume = 1; + } + this._netStream.soundTransform = _loc2_; + } + } + + public function get mute() : Boolean + { + return this._mute; + } + + private function resizeVideo() : void + { + var _loc1_:* = NaN; + var _loc2_:* = NaN; + if(!(this._video.videoWidth == 0) && !(this._video.videoHeight == 0) && !(height == 0)) + { + _loc1_ = this._video.videoWidth / this._video.videoHeight; + _loc2_ = width / height; + if(_loc1_ > _loc2_) { - soundTrans = new SoundTransform(); - if (mute) - { - soundTrans.volume = 0; - } - else - { - soundTrans.volume = 1; - }; - this._netStream.soundTransform = soundTrans; - }; - } - - public function get mute():Boolean - { - return (this._mute); - } - - private function resizeVideo():void - { - var videoRatio:Number; - var playerRatio:Number; - if (((((!((this._video.videoWidth == 0))) && (!((this._video.videoHeight == 0))))) && (!((height == 0))))) + this.stop(); + if(this._video.parent) + { + removeChild(this._video); + } + height = width * 1 / _loc1_; + y = (1024 - height) / 2; + this.finalize(); + this.connect(); + this.play(); + } + else if(_loc1_ < _loc2_) { - videoRatio = (this._video.videoWidth / this._video.videoHeight); - playerRatio = (width / height); - if (videoRatio > playerRatio) - { - this.stop(); - if (this._video.parent) - { - removeChild(this._video); - }; - height = (width * (1 / videoRatio)); - y = ((0x0400 - height) / 2); - this.finalize(); - this.connect(); - this.play(); - } - else - { - if (videoRatio < playerRatio) - { - this.stop(); - if (this._video.parent) - { - removeChild(this._video); - }; - width = (height * videoRatio); - x = ((0x0500 - width) / 2); - this.finalize(); - this.connect(); - this.play(); - }; - }; - }; - } - - - } -}//package com.ankamagames.berilia.components - + this.stop(); + if(this._video.parent) + { + removeChild(this._video); + } + width = height * _loc1_; + x = (1280 - width) / 2; + this.finalize(); + this.connect(); + this.play(); + } + + } + } + } +} diff --git a/com/ankamagames/berilia/components/WebBrowser.as b/com/ankamagames/berilia/components/WebBrowser.as index 7d2472211..5cdc7b366 100644 --- a/com/ankamagames/berilia/components/WebBrowser.as +++ b/com/ankamagames/berilia/components/WebBrowser.as @@ -1,570 +1,618 @@ -package com.ankamagames.berilia.components +package com.ankamagames.berilia.components { - import com.ankamagames.berilia.types.graphic.GraphicContainer; - import com.ankamagames.berilia.FinalizableUIComponent; - import com.ankamagames.berilia.types.graphic.TimeoutHTMLLoader; - import flash.utils.Timer; - import flash.utils.Dictionary; - import flash.display.NativeWindow; - import com.ankamagames.jerakine.utils.system.AirScanner; - import flash.events.TimerEvent; - import com.ankamagames.jerakine.utils.display.StageShareManager; - import flash.events.Event; - import com.ankamagames.jerakine.types.Uri; - import flash.display.DisplayObject; - import com.ankamagames.jerakine.handlers.messages.keyboard.KeyboardMessage; - import com.ankamagames.berilia.types.shortcut.Bind; - import com.ankamagames.jerakine.handlers.messages.mouse.MouseWheelMessage; - import com.ankamagames.jerakine.handlers.messages.keyboard.KeyboardKeyUpMessage; - import com.ankamagames.jerakine.handlers.messages.keyboard.KeyboardKeyDownMessage; - import com.ankamagames.berilia.managers.BindsManager; - import com.ankamagames.jerakine.handlers.FocusHandler; - import com.ankamagames.jerakine.messages.Message; - import flash.utils.clearTimeout; - import flash.net.URLRequest; - import com.ankamagames.jerakine.utils.misc.CopyObject; - import flash.utils.setTimeout; - import com.ankamagames.berilia.Berilia; - import com.ankamagames.berilia.components.messages.BrowserDomReady; - import flash.display.InteractiveObject; - import flash.net.navigateToURL; - import com.ankamagames.berilia.components.messages.BrowserSessionTimeout; - - public class WebBrowser extends GraphicContainer implements FinalizableUIComponent - { - - private var _finalized:Boolean; - private var _htmlLoader:TimeoutHTMLLoader; - private var _resizeTimer:Timer; - private var _vScrollBar:ScrollBar; - private var _scrollTopOffset:int = 0; - private var _cacheId:String; - private var _cacheLife:Number = 15; - private var _lifeTimer:Timer; - private var _linkList:Array; - private var _inputList:Array; - private var _inputFocus:Boolean; - private var _displayScrollBar:Boolean = true; - private var _manualExternalLink:Dictionary; - private var _transparentBackground:Boolean; - private var _timeoutId:uint; - private var _domInit:Boolean; - - public function WebBrowser() - { - var _local_1:NativeWindow; + import com.ankamagames.berilia.types.graphic.GraphicContainer; + import com.ankamagames.berilia.FinalizableUIComponent; + import com.ankamagames.jerakine.logger.Logger; + import com.ankamagames.jerakine.logger.Log; + import flash.utils.getQualifiedClassName; + import com.ankamagames.berilia.types.graphic.TimeoutHTMLLoader; + import flash.utils.Timer; + import flash.utils.Dictionary; + import com.ankamagames.jerakine.types.Uri; + import com.ankamagames.jerakine.data.XmlConfig; + import com.ankamagames.jerakine.utils.system.AirScanner; + import flash.events.Event; + import com.ankamagames.jerakine.messages.Message; + import flash.display.DisplayObject; + import com.ankamagames.jerakine.handlers.messages.keyboard.KeyboardMessage; + import com.ankamagames.berilia.types.shortcut.Bind; + import com.ankamagames.jerakine.handlers.messages.mouse.MouseWheelMessage; + import com.ankamagames.jerakine.handlers.messages.keyboard.KeyboardKeyDownMessage; + import com.ankamagames.jerakine.handlers.messages.keyboard.KeyboardKeyUpMessage; + import com.ankamagames.berilia.managers.BindsManager; + import com.ankamagames.jerakine.handlers.FocusHandler; + import flash.display.NativeWindow; + import flash.events.TimerEvent; + import com.ankamagames.jerakine.utils.display.StageShareManager; + import flash.utils.clearTimeout; + import flash.net.URLRequest; + import com.ankamagames.jerakine.utils.misc.CopyObject; + import flash.utils.setTimeout; + import com.ankamagames.berilia.Berilia; + import com.ankamagames.berilia.components.messages.BrowserDomReady; + import flash.display.InteractiveObject; + import flash.net.navigateToURL; + import com.ankamagames.berilia.components.messages.BrowserSessionTimeout; + + public class WebBrowser extends GraphicContainer implements FinalizableUIComponent + { + + public function WebBrowser() + { + var _loc1_:NativeWindow = null; + this._linkList = []; + this._manualExternalLink = new Dictionary(); + super(); + this._vScrollBar = new ScrollBar(); + if(AirScanner.hasAir()) + { this._resizeTimer = new Timer(200); - this._linkList = []; - this._inputList = []; - this._manualExternalLink = new Dictionary(); - super(); - this._vScrollBar = new ScrollBar(); - if (!(AirScanner.hasAir())) - { - _log.error("Can't create a WebBrowser object without AIR support"); - this._vScrollBar.visible = false; - } - else - { - this._resizeTimer.addEventListener(TimerEvent.TIMER, this.onResizeEnd); - _local_1 = StageShareManager.stage.nativeWindow; - _local_1.addEventListener(Event.RESIZE, this.onResize); - this._vScrollBar.min = 1; - this._vScrollBar.max = 1; - this._vScrollBar.width = 16; - this._vScrollBar.addEventListener(Event.CHANGE, this.onScroll); - }; - } - - public function get cacheLife():Number - { - return (this._cacheLife); - } - - public function set cacheLife(value:Number):void - { - this._cacheLife = Math.max(1, value); - if (this._htmlLoader) - { - this._htmlLoader.life = value; - }; - } - - public function get cacheId():String - { - return (this._cacheId); - } - - public function set cacheId(value:String):void - { - this._cacheId = value; - } - - public function set scrollCss(sUrl:Uri):void - { - this._vScrollBar.css = sUrl; - } - - public function get scrollCss():Uri - { - return (this._vScrollBar.css); - } - - public function set displayScrollBar(b:Boolean):void - { - this._vScrollBar.width = ((b) ? 16 : 0); - this.onResizeEnd(null); - } - - public function get displayScrollBar():Boolean - { - return (this._displayScrollBar); - } - - public function set scrollTopOffset(v:int):void - { - this._scrollTopOffset = v; - this._vScrollBar.y = v; - if (height) - { - this._vScrollBar.height = (height - this._scrollTopOffset); - }; - } - - public function get finalized():Boolean - { - return (this._finalized); - } - - public function set finalized(b:Boolean):void - { - this._finalized = b; - } - - override public function set width(nW:Number):void - { - super.width = nW; - if (this._htmlLoader) - { - this._htmlLoader.width = (nW - this._vScrollBar.width); - this._vScrollBar.x = (this._htmlLoader.x + this._htmlLoader.width); - }; - } - - override public function set height(nH:Number):void - { - super.height = nH; - if (this._htmlLoader) - { - this._htmlLoader.height = nH; - }; - this.scrollTopOffset = this._scrollTopOffset; - } - - public function get fromCache():Boolean - { - return (this._htmlLoader.fromCache); - } - - public function get location():String - { - return (this._htmlLoader.location); - } - - public function set transparentBackground(pValue:Boolean):void - { - this._transparentBackground = pValue; - if (this._htmlLoader) - { - this._htmlLoader.paintsDefaultBackground = !(this._transparentBackground); - }; - } - - public function finalize():void - { - if (!(AirScanner.hasAir())) - { - this._finalized = true; - return; - }; - addChild(this._vScrollBar); - this._vScrollBar.finalize(); - if (!(this._htmlLoader)) - { - this._htmlLoader = TimeoutHTMLLoader.getLoader(this.cacheId); - if (this._htmlLoader.fromCache) - { - this.onDomReady(null); - }; - this._htmlLoader.life = this.cacheLife; - this._htmlLoader.addEventListener(Event["HTML_RENDER"], this.onDomReady); - this._htmlLoader.addEventListener(Event["HTML_BOUNDS_CHANGE"], this.onBoundsChange); - this._htmlLoader.addEventListener(TimeoutHTMLLoader.TIMEOUT, this.onSessionTimeout); - this._htmlLoader.addEventListener(Event["LOCATION_CHANGE"], this.onLocationChange); - this._htmlLoader.paintsDefaultBackground = !(this._transparentBackground); - }; - this.width = width; - this.height = height; - this.updateScrollbar(); - if (this._htmlLoader.fromCache) - { - this._vScrollBar.value = this._htmlLoader.scrollV; - }; - addChild(this._htmlLoader); - this.onResizeEnd(null); + this._resizeTimer.addEventListener(TimerEvent.TIMER,this.onResizeEnd); + _loc1_ = StageShareManager.stage.nativeWindow; + _loc1_.addEventListener(Event.RESIZE,this.onResize); + this._vScrollBar.min = 1; + this._vScrollBar.max = 1; + this._vScrollBar.width = 16; + this._vScrollBar.addEventListener(Event.CHANGE,this.onScroll); + } + else + { + this._vScrollBar.width = 0; + _log.error("Can\'t create a WebBrowser object without AIR support"); + } + } + + protected static const _log:Logger = Log.getLogger(getQualifiedClassName(WebBrowser)); + + private var _htmlLoader:TimeoutHTMLLoader; + + private var _vScrollBar:ScrollBar; + + private var _finalized:Boolean; + + private var _resizeTimer:Timer; + + private var _scrollTopOffset:int = 0; + + private var _cacheId:String; + + private var _cacheLife:Number = 15; + + private var _lifeTimer:Timer; + + private var _linkList:Array; + + private var _inputFocus:Boolean; + + private var _manualExternalLink:Dictionary; + + private var _transparentBackground:Boolean; + + private var _htmlRendered:Boolean = false; + + private var _timeoutId:uint; + + private var _domInit:Boolean; + + public function get cacheLife() : Number + { + return this._cacheLife; + } + + public function set cacheLife(param1:Number) : void + { + this._cacheLife = Math.max(1,param1); + if(this._htmlLoader) + { + this._htmlLoader.life = param1; + } + } + + public function get cacheId() : String + { + return this._cacheId; + } + + public function set cacheId(param1:String) : void + { + this._cacheId = param1; + } + + public function set scrollCss(param1:Uri) : void + { + this._vScrollBar.css = param1; + } + + public function get scrollCss() : Uri + { + return this._vScrollBar.css; + } + + public function set displayScrollBar(param1:Boolean) : void + { + this._vScrollBar.width = param1?16:0; + this.onResizeEnd(null); + } + + public function get displayScrollBar() : Boolean + { + return !(this._vScrollBar.width == 0); + } + + public function set scrollTopOffset(param1:int) : void + { + this._scrollTopOffset = param1; + this._vScrollBar.y = param1; + if(height) + { + this._vScrollBar.height = height - this._scrollTopOffset; + } + } + + public function get finalized() : Boolean + { + return this._finalized; + } + + public function set finalized(param1:Boolean) : void + { + this._finalized = param1; + } + + override public function set width(param1:Number) : void + { + super.width = param1; + if(this._htmlLoader) + { + this._htmlLoader.width = param1 - this._vScrollBar.width; + this._vScrollBar.x = this._htmlLoader.x + this._htmlLoader.width; + } + } + + override public function set height(param1:Number) : void + { + super.height = param1; + if(this._htmlLoader) + { + this._htmlLoader.height = param1; + } + this.scrollTopOffset = this._scrollTopOffset; + } + + public function get fromCache() : Boolean + { + return this._htmlLoader.fromCache; + } + + public function get location() : String + { + return this._htmlLoader.location; + } + + public function clearLocation() : void + { + var _loc1_:String = XmlConfig.getInstance().getEntry("colors.grid.bg").replace("0x","#"); + this._htmlLoader.loadString(""); + } + + public function set transparentBackground(param1:Boolean) : void + { + this._transparentBackground = param1; + if(this._htmlLoader) + { + this._htmlLoader.paintsDefaultBackground = !this._transparentBackground; + } + } + + public function finalize() : void + { + if(!AirScanner.hasAir()) + { this._finalized = true; - } - - public function setBlankLink(linkPattern:String, blank:Boolean):void - { - if (blank) - { - this._manualExternalLink[linkPattern] = new RegExp(linkPattern); + return; + } + addChild(this._vScrollBar); + this._vScrollBar.finalize(); + if(!this._htmlLoader) + { + this._htmlLoader = TimeoutHTMLLoader.getLoader(this.cacheId); + if(this._htmlLoader.fromCache) + { + this.onDomReady(null); } else { - delete this._manualExternalLink[linkPattern]; - }; - this.modifyDOM(this._htmlLoader.window.document); - } - - [HideInFakeClass] - override public function process(msg:Message):Boolean - { - var currentDo:DisplayObject; - var kbmsg:KeyboardMessage; - var allowedShorcut:Boolean; - var sShortcut:String; - var bind:Bind; - if ((msg is MouseWheelMessage)) - { - currentDo = MouseWheelMessage(msg).target; - while (((((!((currentDo == this._htmlLoader))) && (currentDo))) && (currentDo.parent))) - { - currentDo = currentDo.parent; - }; - if (currentDo == this._htmlLoader) - { - this._vScrollBar.value = this._htmlLoader.scrollV; - }; - }; - if ((((msg is KeyboardKeyDownMessage)) || ((msg is KeyboardKeyUpMessage)))) - { - kbmsg = (msg as KeyboardMessage); - sShortcut = BindsManager.getInstance().getShortcutString(kbmsg.keyboardEvent.keyCode, this.getCharCode(kbmsg)); - bind = BindsManager.getInstance().getBind(new Bind(sShortcut, "", kbmsg.keyboardEvent.altKey, kbmsg.keyboardEvent.ctrlKey, kbmsg.keyboardEvent.shiftKey)); - if (((bind) && ((((bind.targetedShortcut == "closeUi")) || ((bind.targetedShortcut == "toggleFullscreen")))))) - { - allowedShorcut = true; - }; - if (!(allowedShorcut)) - { - currentDo = FocusHandler.getInstance().getFocus(); - while (((((!((currentDo == this._htmlLoader))) && (currentDo))) && (currentDo.parent))) - { - currentDo = currentDo.parent; - }; - return ((currentDo == this._htmlLoader)); - }; - }; - return (false); - } - - override public function remove():void - { - this.removeHtmlEvent(); - StageShareManager.stage.removeEventListener(Event.RESIZE, this.onResize); - if (this._htmlLoader) - { - this._htmlLoader.removeEventListener(Event["HTML_RENDER"], this.onDomReady); - this._htmlLoader.removeEventListener(Event["HTML_BOUNDS_CHANGE"], this.onBoundsChange); - if (contains(this._htmlLoader)) - { - removeChild(this._htmlLoader); - }; - }; - if (this._timeoutId) - { - clearTimeout(this._timeoutId); - }; - super.remove(); - } - - public function hasContent():Boolean - { - var a:Object = this._htmlLoader.window.document.getElementsByTagName("body"); - if (((!(a[0])) || ((a[0].firstChild == null)))) - { - return (false); - }; - if (((a[0].getElementsByTagName("h1")) && ((a[0].getElementsByTagName("h1").length > 0)))) - { - return (true); - }; - return (false); - } - - public function load(urlRequest:URLRequest):void - { - var clone:URLRequest; - if (getUi().uiModule.trusted) - { - clone = new URLRequest(); - CopyObject.copyObject(urlRequest, null, clone); - this._htmlLoader.load(clone); + this.clearLocation(); } - else - { - throw (new SecurityError("Only trusted module can use WebBroswer")); - }; - } - - public function javascriptSetVar(varName:String, value:*):void - { - var path:Array; - var len:int; - var htmlVar:Object; - var i:int; - try - { - path = varName.split("."); - len = path.length; - htmlVar = this._htmlLoader.window; - i = 0; - while (i < len) - { - if (i < (len - 1)) - { - htmlVar = htmlVar[path[i]]; - } - else - { - htmlVar[path[i]] = value; - }; - i++; - }; + this._htmlLoader.life = this.cacheLife; + this._htmlLoader.addEventListener(Event["HTML_RENDER"],this.onDomReady); + this._htmlLoader.addEventListener(Event["HTML_BOUNDS_CHANGE"],this.onBoundsChange); + this._htmlLoader.addEventListener(TimeoutHTMLLoader.TIMEOUT,this.onSessionTimeout); + this._htmlLoader.addEventListener(Event["LOCATION_CHANGE"],this.onLocationChange); + this._htmlLoader.paintsDefaultBackground = !this._transparentBackground; + } + this.width = width; + this.height = height; + this.updateScrollbar(); + if(this._htmlLoader.fromCache) + { + this._vScrollBar.value = this._htmlLoader.scrollV; + } + addChild(this._htmlLoader); + this.onResizeEnd(null); + this._finalized = true; + } + + public function setBlankLink(param1:String, param2:Boolean) : void + { + if(param2) + { + this._manualExternalLink[param1] = new RegExp(param1); + } + else + { + delete this._manualExternalLink[param1]; + true; + } + this.modifyDOM(this._htmlLoader.window.document); + } + + override public function process(param1:Message) : Boolean + { + var _loc2_:DisplayObject = null; + var _loc3_:KeyboardMessage = null; + var _loc4_:* = false; + var _loc5_:String = null; + var _loc6_:Bind = null; + if(param1 is MouseWheelMessage) + { + _loc2_ = MouseWheelMessage(param1).target; + while((!(_loc2_ == this._htmlLoader)) && (_loc2_) && (_loc2_.parent)) + { + _loc2_ = _loc2_.parent; } - catch(e:Error) + if(_loc2_ == this._htmlLoader) { - }; - } - - public function javascriptCall(fctName:String, ... params):void - { - var path:Array; - var len:int; - var htmlFunction:Object; - var i:int; + this._vScrollBar.value = this._htmlLoader.scrollV; + } + } + if(param1 is KeyboardKeyDownMessage || param1 is KeyboardKeyUpMessage) + { + _loc3_ = param1 as KeyboardMessage; + _loc5_ = BindsManager.getInstance().getShortcutString(_loc3_.keyboardEvent.keyCode,this.getCharCode(_loc3_)); + _loc6_ = BindsManager.getInstance().getBind(new Bind(_loc5_,"",_loc3_.keyboardEvent.altKey,_loc3_.keyboardEvent.ctrlKey,_loc3_.keyboardEvent.shiftKey)); + if((_loc6_) && (_loc6_.targetedShortcut == "closeUi" || _loc6_.targetedShortcut == "toggleFullscreen")) + { + _loc4_ = true; + } + if(!_loc4_) + { + _loc2_ = FocusHandler.getInstance().getFocus(); + while((!(_loc2_ == this._htmlLoader)) && (_loc2_) && (_loc2_.parent)) + { + _loc2_ = _loc2_.parent; + } + return _loc2_ == this._htmlLoader; + } + } + return false; + } + + override public function remove() : void + { + var _loc1_:NativeWindow = null; + if(this._resizeTimer) + { + this._resizeTimer.removeEventListener(TimerEvent.TIMER,this.onResizeEnd); + } + this.removeHtmlEvent(); + StageShareManager.stage.removeEventListener(Event.RESIZE,this.onResize); + if(this._htmlLoader) + { + this._htmlLoader.removeEventListener(Event["HTML_RENDER"],this.onDomReady); + this._htmlLoader.removeEventListener(Event["HTML_BOUNDS_CHANGE"],this.onBoundsChange); + this._htmlLoader.removeEventListener(TimeoutHTMLLoader.TIMEOUT,this.onSessionTimeout); + this._htmlLoader.removeEventListener(Event["LOCATION_CHANGE"],this.onLocationChange); + if(contains(this._htmlLoader)) + { + removeChild(this._htmlLoader); + } + } + if(AirScanner.hasAir()) + { + _loc1_ = StageShareManager.stage.nativeWindow; + _loc1_.removeEventListener(Event.RESIZE,this.onResize); + this._vScrollBar.removeEventListener(Event.CHANGE,this.onScroll); + } + if(this._timeoutId) + { + clearTimeout(this._timeoutId); + } + super.remove(); + } + + public function hasContent() : Boolean + { + var _loc1_:Object = this._htmlLoader.window.document.getElementsByTagName("body"); + if(!_loc1_[0] || _loc1_[0].firstChild == null) + { + return false; + } + if((_loc1_[0].getElementsByTagName("h1")) && _loc1_[0].getElementsByTagName("h1").length > 0) + { + return true; + } + return false; + } + + public function get content() : Object + { + if(!this._domInit) + { + return null; + } + if((this._htmlLoader) && (this._htmlLoader.window) && (this._htmlLoader.window.document)) + { + return this._htmlLoader.window.document; + } + return null; + } + + public function load(param1:URLRequest) : void + { + var _loc2_:URLRequest = null; + if(getUi().uiModule.trusted) + { + _loc2_ = new URLRequest(); + CopyObject.copyObject(param1,null,_loc2_); + this._htmlLoader.load(_loc2_); + return; + } + throw new SecurityError("Only trusted module can use WebBroswer"); + } + + public function javascriptSetVar(param1:String, param2:*) : void + { + var _loc3_:Array = null; + var _loc4_:* = 0; + var _loc5_:Object = null; + var _loc6_:* = 0; + try + { + _loc3_ = param1.split("."); + _loc4_ = _loc3_.length; + _loc5_ = this._htmlLoader.window; + _loc6_ = 0; + while(_loc6_ < _loc4_) + { + if(_loc6_ < _loc4_ - 1) + { + _loc5_ = _loc5_[_loc3_[_loc6_]]; + } + else + { + _loc5_[_loc3_[_loc6_]] = param2; + } + _loc6_++; + } + } + catch(e:Error) + { + } + } + + public function javascriptCall(param1:String, ... rest) : void + { + var _loc3_:Array = null; + var _loc4_:* = 0; + var _loc5_:Object = null; + var _loc6_:* = 0; + try + { + _loc3_ = param1.split("."); + _loc4_ = _loc3_.length; + _loc5_ = this._htmlLoader.window; + _loc6_ = 0; + while(_loc6_ < _loc4_) + { + _loc5_ = _loc5_[_loc3_[_loc6_]]; + _loc6_++; + } + (_loc5_ as Function).apply(null,rest); + } + catch(e:Error) + { + } + } + + private function removeHtmlEvent() : void + { + var _loc1_:Object = null; + while(this._linkList.length) + { + _loc1_ = this._linkList.pop(); try { - path = fctName.split("."); - len = path.length; - htmlFunction = this._htmlLoader.window; - i = 0; - while (i < len) - { - htmlFunction = htmlFunction[path[i]]; - i++; - }; - (htmlFunction as Function).apply(null, params); + if(_loc1_) + { + _loc1_.removeEventListener("click",this.onLinkClick); + } } catch(e:Error) { - }; - } - - private function removeHtmlEvent():void - { - var link:Object; - var input:Object; - for each (link in this._linkList) - { - try - { - link.removeEventListener("click", this.onLinkClick); - } - catch(e:Error) - { - }; - }; - for each (input in this._inputList) - { - try - { - input.removeEventListener("focus", this.onInputFocus); - input.removeEventListener("blur", this.onInputBlur); - } - catch(e:Error) - { - }; - }; - } - - private function getCharCode(pKeyboardMessage:KeyboardMessage):int - { - var charCode:int; - if (((pKeyboardMessage.keyboardEvent.shiftKey) && ((pKeyboardMessage.keyboardEvent.keyCode == 52)))) - { - charCode = 39; + continue; } - else - { - if (((pKeyboardMessage.keyboardEvent.shiftKey) && ((pKeyboardMessage.keyboardEvent.keyCode == 54)))) - { - charCode = 45; - } - else - { - charCode = pKeyboardMessage.keyboardEvent.charCode; - }; - }; - return (charCode); - } - - private function onResize(e:Event):void - { + } + } + + private function getCharCode(param1:KeyboardMessage) : int + { + var _loc2_:* = 0; + if((param1.keyboardEvent.shiftKey) && param1.keyboardEvent.keyCode == 52) + { + _loc2_ = 39; + } + else if((param1.keyboardEvent.shiftKey) && param1.keyboardEvent.keyCode == 54) + { + _loc2_ = 45; + } + else + { + _loc2_ = param1.keyboardEvent.charCode; + } + + return _loc2_; + } + + private function onResize(param1:Event) : void + { + if(this._resizeTimer) + { this._resizeTimer.reset(); this._resizeTimer.start(); - } - - private function onResizeEnd(e:Event):void - { + } + } + + private function onResizeEnd(param1:Event) : void + { + if(this._resizeTimer) + { this._resizeTimer.stop(); - var scale:Number = StageShareManager.windowScale; - if (this._htmlLoader) - { - this._htmlLoader.width = ((width * scale) - this._vScrollBar.width); - this._htmlLoader.height = (height * scale); - this._htmlLoader.scaleX = (1 / scale); - this._htmlLoader.scaleY = (1 / scale); - }; - } - - private function onDomReady(e:Event):void - { - if (!(this._htmlLoader.window.document.body)) - { - this._domInit = false; - if (!(this._timeoutId)) - { - this._timeoutId = setTimeout(this.onDomReady, 100, null); - }; - return; - }; - if (this._timeoutId) - { - clearTimeout(this._timeoutId); - this._timeoutId = 0; - }; - this.modifyDOM(this._htmlLoader.window.document); - if (this._domInit) - { - return; - }; - this._domInit = true; - this.updateScrollbar(); - this.onResizeEnd(null); - Berilia.getInstance().handler.process(new BrowserDomReady(InteractiveObject(this))); - } - - private function isManualExternalLink(link:String):Boolean - { - var pattern:RegExp; - for each (pattern in this._manualExternalLink) - { - if (link.match(pattern).length) - { - return (true); - }; - }; - return (false); - } - - private function modifyDOM(target:Object):void - { - var i:uint; - var a:Object; - try + } + var _loc2_:Number = StageShareManager.windowScale; + if(this._htmlLoader) + { + this._htmlLoader.width = width * _loc2_ - this._vScrollBar.width; + this._htmlLoader.height = height * _loc2_; + this._htmlLoader.scaleX = 1 / _loc2_; + this._htmlLoader.scaleY = 1 / _loc2_; + } + } + + private function onDomReady(param1:Event = null) : void + { + if(!this._htmlLoader.window.document.body) + { + this._domInit = false; + if(!this._timeoutId) { - a = target.getElementsByTagName("a"); - i = 0; - while (i < a.length) - { - if ((((a[i].target == "_blank")) || (this.isManualExternalLink(a[i].href)))) - { - a[i].addEventListener("click", this.onLinkClick, false); - if (this._linkList.indexOf(a[i]) == -1) - { - this._linkList.push(a[i]); - }; - }; - i++; - }; + this._timeoutId = setTimeout(this.onDomReady,100,null); } - catch(e:Error) - { - _log.error("Erreur lors de l'ajout des lien blank"); - }; - } - - private function onLinkClick(e:*):void - { - var target:Object = e.target; - if (target.tagName == "IMG") - { - target = target.parentElement; - }; - if ((((target.target == "_blank")) || (this.isManualExternalLink(target.href)))) - { - e.preventDefault(); - navigateToURL(new URLRequest(target.href)); - }; - } - - private function onInputFocus(e:*):void - { - this._inputFocus = true; - } - - private function onInputBlur(e:*):void - { - this._inputFocus = false; - } - - private function onScroll(e:Event):void - { - this._htmlLoader.scrollV = this._vScrollBar.value; - } - - private function onBoundsChange(e:Event):void - { - this.updateScrollbar(); - } - - private function updateScrollbar():void - { - var heightDiff:int = (this._htmlLoader.contentHeight - this._htmlLoader.height); - if (((!((this._vScrollBar.max == heightDiff))) && ((heightDiff > 0)))) - { - this._vScrollBar.min = 0; - this._vScrollBar.max = heightDiff; - }; - } - - private function onSessionTimeout(e:Event):void - { - Berilia.getInstance().handler.process(new BrowserSessionTimeout(InteractiveObject(this))); - } - - private function onLocationChange(e:Event):void - { - _log.trace(("Load " + this._htmlLoader.location)); - this.removeHtmlEvent(); - this._inputFocus = false; - this._domInit = false; - } - - - } -}//package com.ankamagames.berilia.components - + return; + } + if(this._timeoutId) + { + clearTimeout(this._timeoutId); + this._timeoutId = 0; + } + this.modifyDOM(this._htmlLoader.window.document); + if(this._domInit) + { + return; + } + this._domInit = true; + this.updateScrollbar(); + this.onResizeEnd(null); + Berilia.getInstance().handler.process(new BrowserDomReady(InteractiveObject(this))); + } + + private function isManualExternalLink(param1:String) : Boolean + { + var _loc2_:RegExp = null; + for each(_loc2_ in this._manualExternalLink) + { + if(param1.match(_loc2_).length) + { + return true; + } + } + return false; + } + + private function modifyDOM(param1:Object) : void + { + var i:uint = 0; + var a:Object = null; + var target:Object = param1; + try + { + a = target.getElementsByTagName("a"); + i = 0; + while(i < a.length) + { + if(a[i].target == "_blank" || (this.isManualExternalLink(a[i].href))) + { + a[i].addEventListener("click",this.onLinkClick,false); + if(this._linkList.indexOf(a[i]) == -1) + { + this._linkList.push(a[i]); + } + } + i++; + } + } + catch(e:Error) + { + _log.error("Erreur lors de l\'ajout des lien blank"); + } + } + + private function onLinkClick(param1:*) : void + { + var _loc2_:Object = param1.target; + if(_loc2_.tagName == "IMG") + { + _loc2_ = _loc2_.parentElement; + } + if(_loc2_.target == "_blank" || (this.isManualExternalLink(_loc2_.href))) + { + param1.preventDefault(); + navigateToURL(new URLRequest(_loc2_.href)); + } + } + + private function onInputFocus(param1:*) : void + { + this._inputFocus = true; + } + + private function onInputBlur(param1:*) : void + { + this._inputFocus = false; + } + + private function onScroll(param1:Event) : void + { + this._htmlLoader.scrollV = this._vScrollBar.value; + } + + private function onBoundsChange(param1:Event) : void + { + this.updateScrollbar(); + } + + private function updateScrollbar() : void + { + var _loc1_:int = this._htmlLoader.contentHeight - this._htmlLoader.height; + if(!(this._vScrollBar.max == _loc1_) && _loc1_ > 0) + { + this._vScrollBar.min = 0; + this._vScrollBar.max = _loc1_; + } + } + + private function onSessionTimeout(param1:Event) : void + { + Berilia.getInstance().handler.process(new BrowserSessionTimeout(InteractiveObject(this))); + } + + private function onLocationChange(param1:Event) : void + { + _log.trace("Load " + this._htmlLoader.location); + this.removeHtmlEvent(); + this._inputFocus = false; + this._domInit = false; + this._htmlRendered = false; + } + } +} diff --git a/com/ankamagames/berilia/components/gridRenderer/EntityGridRenderer.as b/com/ankamagames/berilia/components/gridRenderer/EntityGridRenderer.as index 3326ac885..663aa64f1 100644 --- a/com/ankamagames/berilia/components/gridRenderer/EntityGridRenderer.as +++ b/com/ankamagames/berilia/components/gridRenderer/EntityGridRenderer.as @@ -1,174 +1,171 @@ -package com.ankamagames.berilia.components.gridRenderer +package com.ankamagames.berilia.components.gridRenderer { - import com.ankamagames.berilia.interfaces.IGridRenderer; - import com.ankamagames.jerakine.logger.Logger; - import com.ankamagames.berilia.components.Grid; - import com.ankamagames.jerakine.types.Uri; - import flash.display.Sprite; - import com.ankamagames.jerakine.logger.Log; - import flash.utils.getQualifiedClassName; - import com.ankamagames.berilia.components.EntityDisplayer; - import com.ankamagames.berilia.types.graphic.GraphicContainer; - import com.ankamagames.berilia.components.Texture; - import flash.display.DisplayObject; - import com.ankamagames.berilia.managers.SecureCenter; - import com.ankamagames.jerakine.messages.Message; - import com.ankamagames.berilia.UIComponent; - - [RendererArgs(emptySlotBackground="com.ankamagames.jerakine.types::Uri")] - public class EntityGridRenderer implements IGridRenderer - { - - protected var _log:Logger; - private var _grid:Grid; - private var _emptyTexture:Uri; - private var _mask:Sprite; - - public function EntityGridRenderer(strParams:String) - { - this._log = Log.getLogger(getQualifiedClassName(EntityGridRenderer)); - super(); - var params:Array = ((strParams) ? strParams.split(",") : []); - this._emptyTexture = ((((params[0]) && (params[0].length))) ? new Uri(params[0]) : null); + import com.ankamagames.berilia.interfaces.IGridRenderer; + import com.ankamagames.jerakine.logger.Logger; + import com.ankamagames.berilia.components.Grid; + import com.ankamagames.jerakine.types.Uri; + import flash.display.Sprite; + import flash.display.DisplayObject; + import com.ankamagames.berilia.components.EntityDisplayer; + import com.ankamagames.berilia.types.graphic.GraphicContainer; + import com.ankamagames.berilia.components.Texture; + import com.ankamagames.berilia.managers.SecureCenter; + import com.ankamagames.jerakine.messages.Message; + import com.ankamagames.berilia.UIComponent; + import com.ankamagames.jerakine.logger.Log; + import flash.utils.getQualifiedClassName; + + public class EntityGridRenderer extends Object implements IGridRenderer + { + + public function EntityGridRenderer(param1:String) + { + this._log = Log.getLogger(getQualifiedClassName(EntityGridRenderer)); + super(); + var _loc2_:Array = param1?param1.split(","):[]; + this._emptyTexture = (_loc2_[0]) && (_loc2_[0].length)?new Uri(_loc2_[0]):null; + this._mask = new Sprite(); + } + + protected var _log:Logger; + + private var _grid:Grid; + + private var _emptyTexture:Uri; + + private var _mask:Sprite; + + public function set grid(param1:Grid) : void + { + this._grid = param1; + } + + public function render(param1:*, param2:uint, param3:Boolean, param4:uint = 0) : DisplayObject + { + var _loc7_:EntityDisplayer = null; + var _loc5_:GraphicContainer = new GraphicContainer(); + _loc5_.mouseEnabled = true; + var _loc6_:Texture = new Texture(); + _loc6_.width = this._grid.slotWidth; + _loc6_.height = this._grid.slotHeight; + _loc6_.uri = this._emptyTexture; + _loc6_.finalize(); + _loc5_.addChild(_loc6_); + _loc5_.width = this._grid.slotWidth; + _loc5_.height = this._grid.slotHeight; + if(param1) + { + _loc7_ = new EntityDisplayer(); + _loc7_.name = "entity"; + _loc7_.width = this._grid.slotWidth; + _loc7_.height = this._grid.slotHeight; + _loc7_.direction = 3; + _loc7_.entityScale = 2; + _loc7_.yOffset = 20; + _loc7_.look = param1.entityLook; + _loc5_.addChild(_loc7_); this._mask = new Sprite(); - } - - public function set grid(g:Grid):void - { - this._grid = g; - } - - public function render(data:*, index:uint, selected:Boolean, subIndex:uint=0):DisplayObject - { - var entDisp:EntityDisplayer; - var ctr:GraphicContainer = new GraphicContainer(); - ctr.mouseEnabled = true; - var background:Texture = new Texture(); - background.width = this._grid.slotWidth; - background.height = this._grid.slotHeight; - background.uri = this._emptyTexture; - background.finalize(); - ctr.addChild(background); - ctr.width = this._grid.slotWidth; - ctr.height = this._grid.slotHeight; - if (data) + this._mask.graphics.beginFill(16711680); + this._mask.graphics.drawRoundRect(3,3,_loc5_.width - 6,_loc5_.height - 6,6,6); + this._mask.graphics.endFill(); + _loc5_.addChild(this._mask); + _loc7_.mask = this._mask; + } + return _loc5_; + } + + public function update(param1:*, param2:uint, param3:DisplayObject, param4:Boolean, param5:uint = 0) : void + { + var _loc6_:GraphicContainer = null; + var _loc7_:EntityDisplayer = null; + var _loc8_:EntityDisplayer = null; + if(param3 is GraphicContainer) + { + _loc6_ = GraphicContainer(param3); + _loc6_.mouseEnabled = true; + _loc7_ = _loc6_.getChildByName("entity") as EntityDisplayer; + if(param1) { - entDisp = new EntityDisplayer(); - entDisp.name = "entity"; - entDisp.width = this._grid.slotWidth; - entDisp.height = this._grid.slotHeight; - entDisp.look = data.entityLook; - entDisp.direction = 3; - entDisp.scale = 2; - entDisp.yOffset = 20; - ctr.addChild(entDisp); - this._mask = new Sprite(); - this._mask.graphics.beginFill(0xFF0000); - this._mask.graphics.drawRoundRect(3, 3, (ctr.width - 6), (ctr.height - 6), 6, 6); - this._mask.graphics.endFill(); - ctr.addChild(this._mask); - entDisp.mask = this._mask; - }; - return (ctr); - } - - public function update(data:*, index:uint, dispObj:DisplayObject, selected:Boolean, subIndex:uint=0):void - { - var ctr:GraphicContainer; - var ed:EntityDisplayer; - var _local_8:EntityDisplayer; - if ((dispObj is GraphicContainer)) + if(_loc7_) + { + if(_loc7_.look.toString() == param1.entityLook.toString()) + { + return; + } + _loc7_.look = SecureCenter.unsecure(param1.entityLook); + } + else + { + _loc8_ = new EntityDisplayer(); + _loc8_.name = "entity"; + _loc8_.width = this._grid.slotWidth; + _loc8_.height = this._grid.slotHeight; + _loc8_.look = SecureCenter.unsecure(param1.entityLook); + _loc8_.direction = 3; + _loc8_.entityScale = 2; + _loc8_.yOffset = 20; + _loc6_.addChild(_loc8_); + this._mask = new Sprite(); + this._mask.graphics.beginFill(255); + this._mask.graphics.drawRoundRect(3,3,_loc6_.width - 6,_loc6_.height - 6,6,6); + this._mask.graphics.endFill(); + _loc6_.addChild(this._mask); + _loc8_.mask = this._mask; + } + } + else if(_loc7_) { - ctr = GraphicContainer(dispObj); - ctr.mouseEnabled = true; - ed = (ctr.getChildByName("entity") as EntityDisplayer); - if (data) - { - if (ed) - { - if (ed.look.toString() == data.entityLook.toString()) - { - return; - }; - ed.look = SecureCenter.unsecure(data.entityLook); - } - else - { - _local_8 = new EntityDisplayer(); - _local_8.name = "entity"; - _local_8.width = this._grid.slotWidth; - _local_8.height = this._grid.slotHeight; - _local_8.look = SecureCenter.unsecure(data.entityLook); - _local_8.direction = 3; - _local_8.scale = 2; - _local_8.yOffset = 20; - ctr.addChild(_local_8); - this._mask = new Sprite(); - this._mask.graphics.beginFill(0xFF); - this._mask.graphics.drawRoundRect(3, 3, (ctr.width - 6), (ctr.height - 6), 6, 6); - this._mask.graphics.endFill(); - ctr.addChild(this._mask); - _local_8.mask = this._mask; - }; - } - else - { - if (ed) - { - ctr.removeChild(ed); - if (((this._mask) && (ctr.getChildByName(this._mask.name)))) - { - ctr.removeChild(this._mask); - }; - ed.remove(); - }; - }; - }; - } - - public function getDataLength(data:*, selected:Boolean):uint - { - return ((data % 2)); - } - - public function remove(dispObj:DisplayObject):void - { - var ed:EntityDisplayer; - var mask:DisplayObject; - if ((dispObj is GraphicContainer)) + _loc6_.removeChild(_loc7_); + if((this._mask) && (_loc6_.getChildByName(this._mask.name))) + { + _loc6_.removeChild(this._mask); + } + _loc7_.remove(); + } + + } + } + + public function getDataLength(param1:*, param2:Boolean) : uint + { + return param1 % 2; + } + + public function remove(param1:DisplayObject) : void + { + var _loc2_:EntityDisplayer = null; + var _loc3_:DisplayObject = null; + if(param1 is GraphicContainer) + { + _loc2_ = GraphicContainer(param1).getChildByName("entity") as EntityDisplayer; + if(_loc2_) { - ed = (GraphicContainer(dispObj).getChildByName("entity") as EntityDisplayer); - if (ed) - { - ed.remove(); - }; - mask = GraphicContainer(dispObj).getChildByName(this._mask.name); - if (mask) - { - GraphicContainer(dispObj).removeChild(mask); - }; - GraphicContainer(dispObj).remove(); - }; - } - - public function destroy():void - { - this._grid = null; - this._emptyTexture = null; - this._mask = null; - } - - public function renderModificator(childs:Array):Array - { - return (childs); - } - - public function eventModificator(msg:Message, functionName:String, args:Array, target:UIComponent):String - { - return (functionName); - } - - - } -}//package com.ankamagames.berilia.components.gridRenderer - + _loc2_.remove(); + } + _loc3_ = GraphicContainer(param1).getChildByName(this._mask.name); + if(_loc3_) + { + GraphicContainer(param1).removeChild(_loc3_); + } + GraphicContainer(param1).remove(); + } + } + + public function destroy() : void + { + this._grid = null; + this._emptyTexture = null; + this._mask = null; + } + + public function renderModificator(param1:Array) : Array + { + return param1; + } + + public function eventModificator(param1:Message, param2:String, param3:Array, param4:UIComponent) : String + { + return param2; + } + } +} diff --git a/com/ankamagames/berilia/components/gridRenderer/InlineXmlGridRenderer.as b/com/ankamagames/berilia/components/gridRenderer/InlineXmlGridRenderer.as index 8f63da0c1..27a054309 100644 --- a/com/ankamagames/berilia/components/gridRenderer/InlineXmlGridRenderer.as +++ b/com/ankamagames/berilia/components/gridRenderer/InlineXmlGridRenderer.as @@ -1,60 +1,55 @@ -package com.ankamagames.berilia.components.gridRenderer +package com.ankamagames.berilia.components.gridRenderer { - import flash.geom.ColorTransform; - import flash.display.DisplayObject; - import flash.display.DisplayObjectContainer; - import com.ankamagames.berilia.managers.SecureCenter; - import com.ankamagames.berilia.types.graphic.UiRootContainer; - - [RendererArgs(updateLineMethod="Function", evenLineColor="uint", oddLineColor="uint")] - public class InlineXmlGridRenderer extends MultiGridRenderer - { - - public function InlineXmlGridRenderer(args:String) - { - super(null); - var params:Array = args.split(","); - _updateFunctionName = params[0]; - if (params[1]) - { - _bgColor1 = new ColorTransform(); - _color1 = parseInt(params[1], 16); - _bgColor1.color = _color1; - }; - if (params[2]) - { - _bgColor2 = new ColorTransform(); - _color2 = parseInt(params[2], 16); - _bgColor2.color = _color2; - }; - if (params[3]) - { - _bgAlpha = Number(params[3]); - }; - _defaultLineType = "default"; - } - - override public function update(data:*, index:uint, target:DisplayObject, selected:Boolean, subIndex:uint=0):void - { - super.update(data, index, target, selected, subIndex); - } - - override protected function uiUpdate(ui:UiRootContainer, target:DisplayObject, data:*, selected:Boolean, subIndex:uint):void - { - if (DisplayObjectContainer(target).numChildren) - { - var _local_6 = ui.uiClass; - (_local_6[_updateFunctionName](SecureCenter.secure(data), _cptNameReferences[DisplayObjectContainer(target).getChildAt(0)], selected)); - }; - } - - override public function renderModificator(childs:Array):Array - { - _containerDefinition["default"] = childs[0]; - return ([]); - } - - - } -}//package com.ankamagames.berilia.components.gridRenderer - + import flash.display.DisplayObject; + import com.ankamagames.berilia.types.graphic.UiRootContainer; + import flash.display.DisplayObjectContainer; + import com.ankamagames.berilia.managers.SecureCenter; + import flash.geom.ColorTransform; + + public class InlineXmlGridRenderer extends MultiGridRenderer + { + + public function InlineXmlGridRenderer(param1:String) + { + super(null); + var _loc2_:Array = param1.split(","); + _updateFunctionName = _loc2_[0]; + if(_loc2_[1]) + { + _bgColor1 = new ColorTransform(); + _color1 = parseInt(_loc2_[1],16); + _bgColor1.color = _color1; + } + if(_loc2_[2]) + { + _bgColor2 = new ColorTransform(); + _color2 = parseInt(_loc2_[2],16); + _bgColor2.color = _color2; + } + if(_loc2_[3]) + { + _bgAlpha = Number(_loc2_[3]); + } + _defaultLineType = "default"; + } + + override public function update(param1:*, param2:uint, param3:DisplayObject, param4:Boolean, param5:uint = 0) : void + { + super.update(param1,param2,param3,param4,param5); + } + + override protected function uiUpdate(param1:UiRootContainer, param2:DisplayObject, param3:*, param4:Boolean, param5:uint) : void + { + if(DisplayObjectContainer(param2).numChildren) + { + param1.uiClass[_updateFunctionName](SecureCenter.secure(param3),_cptNameReferences[DisplayObjectContainer(param2).getChildAt(0)],param4); + } + } + + override public function renderModificator(param1:Array) : Array + { + _containerDefinition["default"] = param1[0]; + return []; + } + } +} diff --git a/com/ankamagames/berilia/components/gridRenderer/LabelGridRenderer.as b/com/ankamagames/berilia/components/gridRenderer/LabelGridRenderer.as index e9454a286..68b677fed 100644 --- a/com/ankamagames/berilia/components/gridRenderer/LabelGridRenderer.as +++ b/com/ankamagames/berilia/components/gridRenderer/LabelGridRenderer.as @@ -1,223 +1,226 @@ -package com.ankamagames.berilia.components.gridRenderer +package com.ankamagames.berilia.components.gridRenderer { - import com.ankamagames.berilia.interfaces.IGridRenderer; - import com.ankamagames.jerakine.logger.Logger; - import com.ankamagames.berilia.components.Grid; - import flash.geom.ColorTransform; - import com.ankamagames.jerakine.types.Uri; - import flash.utils.Dictionary; - import com.ankamagames.jerakine.logger.Log; - import flash.utils.getQualifiedClassName; - import com.ankamagames.berilia.components.Label; - import flash.events.MouseEvent; - import flash.display.DisplayObject; - import com.ankamagames.jerakine.messages.Message; - import com.ankamagames.berilia.UIComponent; - import flash.display.Shape; - import flash.geom.Transform; - - [RendererArgs(font="String", eventLineColor="uint", oddLineColor="uint", overLineColor="uint", selectedLineColor="uint")] - public class LabelGridRenderer implements IGridRenderer - { - - protected var _log:Logger; - private var _grid:Grid; - private var _bgColor1:ColorTransform; - private var _bgColor2:ColorTransform; - private var _selectedColor:ColorTransform; - private var _overColor:ColorTransform; - private var _cssUri:Uri; - private var _shapeIndex:Dictionary; - - public function LabelGridRenderer(strParams:String) - { - var params:Array; - this._log = Log.getLogger(getQualifiedClassName(LabelGridRenderer)); - this._shapeIndex = new Dictionary(true); - super(); - if (strParams) + import com.ankamagames.berilia.interfaces.IGridRenderer; + import com.ankamagames.jerakine.logger.Logger; + import com.ankamagames.berilia.components.Grid; + import flash.geom.ColorTransform; + import com.ankamagames.jerakine.types.Uri; + import flash.utils.Dictionary; + import flash.display.DisplayObject; + import com.ankamagames.berilia.components.Label; + import flash.events.MouseEvent; + import com.ankamagames.jerakine.messages.Message; + import com.ankamagames.berilia.UIComponent; + import flash.display.Shape; + import flash.geom.Transform; + import com.ankamagames.jerakine.logger.Log; + import flash.utils.getQualifiedClassName; + + public class LabelGridRenderer extends Object implements IGridRenderer + { + + public function LabelGridRenderer(param1:String) + { + var _loc2_:Array = null; + this._log = Log.getLogger(getQualifiedClassName(LabelGridRenderer)); + this._shapeIndex = new Dictionary(true); + super(); + if(param1) + { + _loc2_ = param1.length?param1.split(","):null; + if((_loc2_[0]) && (_loc2_[0].length)) { - params = ((strParams.length) ? strParams.split(",") : null); - if (((params[0]) && (params[0].length))) - { - this._cssUri = new Uri(params[0]); - }; - if (((params[1]) && (params[1].length))) - { - this._bgColor1 = new ColorTransform(); - this._bgColor1.color = parseInt(params[1], 16); - }; - if (((params[2]) && (params[2].length))) - { - this._bgColor2 = new ColorTransform(); - this._bgColor2.color = parseInt(params[2], 16); - }; - if (((params[3]) && (params[3].length))) - { - this._overColor = new ColorTransform(); - this._overColor.color = parseInt(params[3], 16); - }; - if (((params[4]) && (params[4].length))) - { - this._selectedColor = new ColorTransform(); - this._selectedColor.color = parseInt(params[4], 16); - }; - }; - } - - public function set grid(g:Grid):void - { - this._grid = g; - } - - public function render(data:*, index:uint, selected:Boolean, subIndex:uint=0):DisplayObject - { - var label:Label = new Label(); - label.mouseEnabled = true; - label.useHandCursor = true; - label.mouseEnabled = true; - label.width = (this._grid.slotWidth - 6); - label.height = this._grid.slotHeight; - label.verticalAlign = "CENTER"; - label.name = ((((this._grid.getUi().name + "::") + this._grid.name) + "::item") + index); - if ((((data is String)) || ((data == null)))) - { - label.text = data; + this._cssUri = new Uri(_loc2_[0]); } - else + if((_loc2_[1]) && (_loc2_[1].length)) { - label.text = data.label; - }; - if (this._cssUri) - { - label.css = this._cssUri; - }; - this.updateBackground(label, index, selected); - label.finalize(); - label.addEventListener(MouseEvent.MOUSE_OVER, this.onRollOver); - label.addEventListener(MouseEvent.MOUSE_OUT, this.onRollOut); - return (label); - } - - public function update(data:*, index:uint, dispObj:DisplayObject, selected:Boolean, subIndex:uint=0):void - { - var label:Label; - if ((dispObj is Label)) + this._bgColor1 = new ColorTransform(); + this._bgColor1.color = parseInt(_loc2_[1],16); + } + if((_loc2_[2]) && (_loc2_[2].length)) { - label = (dispObj as Label); - if ((((data is String)) || ((data == null)))) - { - label.text = data; - } - else - { - label.text = data.label; - }; - this.updateBackground(label, index, selected); + this._bgColor2 = new ColorTransform(); + this._bgColor2.color = parseInt(_loc2_[2],16); } - else + if((_loc2_[3]) && (_loc2_[3].length)) { - this._log.warn((("Can't update, " + dispObj.name) + " is not a Label component")); - }; - } - - public function getDataLength(data:*, selected:Boolean):uint - { - return (1); - } - - public function remove(dispObj:DisplayObject):void - { - var label:Label; - if ((dispObj is Label)) + this._overColor = new ColorTransform(); + this._overColor.color = parseInt(_loc2_[3],16); + } + if((_loc2_[4]) && (_loc2_[4].length)) { - label = (dispObj as Label); - if (label.parent) - { - label.parent.removeChild(dispObj); - }; - label.removeEventListener(MouseEvent.MOUSE_OUT, this.onRollOut); - label.removeEventListener(MouseEvent.MOUSE_OVER, this.onRollOver); - }; - } - - public function destroy():void - { - this._grid = null; - this._shapeIndex = null; - } - - public function renderModificator(childs:Array):Array - { - return (childs); - } - - public function eventModificator(msg:Message, functionName:String, args:Array, target:UIComponent):String - { - return (functionName); - } - - private function updateBackground(label:Label, index:uint, selected:Boolean):void - { - var shape:Shape; - if (!(this._shapeIndex[label])) + this._selectedColor = new ColorTransform(); + this._selectedColor.color = parseInt(_loc2_[4],16); + } + } + } + + protected var _log:Logger; + + private var _grid:Grid; + + private var _bgColor1:ColorTransform; + + private var _bgColor2:ColorTransform; + + private var _selectedColor:ColorTransform; + + private var _overColor:ColorTransform; + + private var _cssUri:Uri; + + private var _shapeIndex:Dictionary; + + public function set grid(param1:Grid) : void + { + this._grid = param1; + } + + public function render(param1:*, param2:uint, param3:Boolean, param4:uint = 0) : DisplayObject + { + var _loc5_:Label = new Label(); + _loc5_.mouseEnabled = true; + _loc5_.useHandCursor = true; + _loc5_.mouseEnabled = true; + _loc5_.width = this._grid.slotWidth - 6; + _loc5_.height = this._grid.slotHeight; + _loc5_.verticalAlign = "CENTER"; + _loc5_.name = this._grid.getUi().name + "::" + this._grid.name + "::item" + param2; + if(param1 is String || param1 == null) + { + _loc5_.text = param1; + } + else + { + _loc5_.text = param1.label; + } + if(this._cssUri) + { + _loc5_.css = this._cssUri; + } + this.updateBackground(_loc5_,param2,param3); + _loc5_.finalize(); + _loc5_.addEventListener(MouseEvent.MOUSE_OVER,this.onRollOver); + _loc5_.addEventListener(MouseEvent.MOUSE_OUT,this.onRollOut); + return _loc5_; + } + + public function update(param1:*, param2:uint, param3:DisplayObject, param4:Boolean, param5:uint = 0) : void + { + var _loc6_:Label = null; + if(param3 is Label) + { + _loc6_ = param3 as Label; + if(param1 is String || param1 == null) { - shape = new Shape(); - shape.graphics.beginFill(0xFFFFFF); - shape.graphics.drawRect(0, 0, this._grid.slotWidth, (this._grid.slotHeight + 1)); - label.getStrata(0).addChild(shape); - this._shapeIndex[label] = { - "trans":new Transform(shape), - "shape":shape - }; - }; - var t:ColorTransform = (((index % 2)) ? this._bgColor1 : this._bgColor2); - if (((selected) && (this._selectedColor))) + _loc6_.text = param1; + } + else { - t = this._selectedColor; - }; - this._shapeIndex[label].currentColor = t; - DisplayObject(this._shapeIndex[label].shape).visible = !((t == null)); - if (t) + _loc6_.text = param1.label; + } + this.updateBackground(_loc6_,param2,param4); + } + else + { + this._log.warn("Can\'t update, " + param3.name + " is not a Label component"); + } + } + + public function getDataLength(param1:*, param2:Boolean) : uint + { + return 1; + } + + public function remove(param1:DisplayObject) : void + { + var _loc2_:Label = null; + if(param1 is Label) + { + _loc2_ = param1 as Label; + if(_loc2_.parent) { - Transform(this._shapeIndex[label].trans).colorTransform = t; + _loc2_.parent.removeChild(param1); + } + _loc2_.removeEventListener(MouseEvent.MOUSE_OUT,this.onRollOut); + _loc2_.removeEventListener(MouseEvent.MOUSE_OVER,this.onRollOver); + } + } + + public function destroy() : void + { + this._grid = null; + this._shapeIndex = null; + } + + public function renderModificator(param1:Array) : Array + { + return param1; + } + + public function eventModificator(param1:Message, param2:String, param3:Array, param4:UIComponent) : String + { + return param2; + } + + private function updateBackground(param1:Label, param2:uint, param3:Boolean) : void + { + var _loc5_:Shape = null; + if(!this._shapeIndex[param1]) + { + _loc5_ = new Shape(); + _loc5_.graphics.beginFill(16777215); + _loc5_.graphics.drawRect(0,0,this._grid.slotWidth,this._grid.slotHeight + 1); + param1.getStrata(0).addChild(_loc5_); + this._shapeIndex[param1] = { + "trans":new Transform(_loc5_), + "shape":_loc5_ }; - } - - private function onRollOver(e:MouseEvent):void - { - var target:Object; - var label:Label = (e.currentTarget as Label); - if (((this._overColor) && ((label.text.length > 0)))) + } + var _loc4_:ColorTransform = param2 % 2?this._bgColor1:this._bgColor2; + if((param3) && (this._selectedColor)) + { + _loc4_ = this._selectedColor; + } + this._shapeIndex[param1].currentColor = _loc4_; + DisplayObject(this._shapeIndex[param1].shape).visible = !(_loc4_ == null); + if(_loc4_) + { + Transform(this._shapeIndex[param1].trans).colorTransform = _loc4_; + } + } + + private function onRollOver(param1:MouseEvent) : void + { + var _loc3_:Object = null; + var _loc2_:Label = param1.currentTarget as Label; + if((this._overColor) && _loc2_.text.length > 0) + { + _loc3_ = this._shapeIndex[_loc2_]; + if(_loc3_) { - target = this._shapeIndex[label]; - if (target) - { - Transform(target.trans).colorTransform = this._overColor; - DisplayObject(target.shape).visible = true; - }; - }; - } - - private function onRollOut(e:MouseEvent):void - { - var target:Object; - var label:Label = (e.currentTarget as Label); - if (label.text.length > 0) + Transform(_loc3_.trans).colorTransform = this._overColor; + DisplayObject(_loc3_.shape).visible = true; + } + } + } + + private function onRollOut(param1:MouseEvent) : void + { + var _loc3_:Object = null; + var _loc2_:Label = param1.currentTarget as Label; + if(_loc2_.text.length > 0) + { + _loc3_ = this._shapeIndex[_loc2_]; + if(_loc3_) { - target = this._shapeIndex[label]; - if (target) - { - if (target.currentColor) - { - Transform(target.trans).colorTransform = target.currentColor; - }; - DisplayObject(target.shape).visible = !((target.currentColor == null)); - }; - }; - } - - - } -}//package com.ankamagames.berilia.components.gridRenderer - + if(_loc3_.currentColor) + { + Transform(_loc3_.trans).colorTransform = _loc3_.currentColor; + } + DisplayObject(_loc3_.shape).visible = !(_loc3_.currentColor == null); + } + } + } + } +} diff --git a/com/ankamagames/berilia/components/gridRenderer/MultiGridRenderer.as b/com/ankamagames/berilia/components/gridRenderer/MultiGridRenderer.as index 001eaa0f8..3926f805f 100644 --- a/com/ankamagames/berilia/components/gridRenderer/MultiGridRenderer.as +++ b/com/ankamagames/berilia/components/gridRenderer/MultiGridRenderer.as @@ -1,319 +1,334 @@ -package com.ankamagames.berilia.components.gridRenderer +package com.ankamagames.berilia.components.gridRenderer { - import com.ankamagames.berilia.interfaces.IGridRenderer; - import com.ankamagames.berilia.components.Grid; - import flash.utils.Dictionary; - import com.ankamagames.berilia.uiRender.UiRenderer; - import flash.geom.ColorTransform; - import com.ankamagames.berilia.types.graphic.UiRootContainer; - import com.ankamagames.berilia.types.graphic.GraphicContainer; - import com.ankamagames.berilia.managers.SecureCenter; - import flash.display.DisplayObject; - import flash.display.Sprite; - import com.ankamagames.berilia.utils.errors.BeriliaError; - import flash.display.DisplayObjectContainer; - import com.ankamagames.berilia.types.uiDefinition.ContainerElement; - import com.ankamagames.jerakine.messages.Message; - import com.ankamagames.berilia.UIComponent; - import com.ankamagames.berilia.types.uiDefinition.BasicElement; - import com.ankamagames.berilia.types.uiDefinition.StateContainerElement; - import flash.utils.getDefinitionByName; - import flash.utils.getQualifiedClassName; - import com.ankamagames.berilia.types.uiDefinition.ButtonElement; - - public class MultiGridRenderer implements IGridRenderer - { - - protected var _grid:Grid; - protected var _cptNameReferences:Dictionary; - protected var _componentReferences:Dictionary; - protected var _componentReferencesByInstance:Dictionary; - protected var _elemID:uint; - protected var _containerCache:Dictionary; - protected var _uiRenderer:UiRenderer; - protected var _containerDefinition:Dictionary; - protected var _bgColor1:ColorTransform; - protected var _bgColor2:ColorTransform; - protected var _color1:Number = -1; - protected var _color2:Number = -1; - protected var _bgAlpha:Number = 1; - protected var _updateFunctionName:String; - protected var _getLineTypeFunctionName:String; - protected var _defaultLineType:String; - protected var _getDataLengthFunctionName:String; - - public function MultiGridRenderer(args:String) - { - var params:Array; - super(); - if (args) + import com.ankamagames.berilia.interfaces.IGridRenderer; + import com.ankamagames.berilia.components.Grid; + import flash.utils.Dictionary; + import com.ankamagames.berilia.uiRender.UiRenderer; + import flash.geom.ColorTransform; + import com.ankamagames.berilia.types.graphic.UiRootContainer; + import flash.display.DisplayObject; + import com.ankamagames.berilia.types.graphic.GraphicContainer; + import com.ankamagames.berilia.managers.SecureCenter; + import flash.display.Sprite; + import com.ankamagames.berilia.utils.errors.BeriliaError; + import flash.display.DisplayObjectContainer; + import com.ankamagames.berilia.types.uiDefinition.ContainerElement; + import com.ankamagames.jerakine.messages.Message; + import com.ankamagames.berilia.UIComponent; + import com.ankamagames.berilia.types.uiDefinition.BasicElement; + import com.ankamagames.berilia.types.uiDefinition.StateContainerElement; + import flash.utils.getDefinitionByName; + import flash.utils.getQualifiedClassName; + import com.ankamagames.berilia.types.uiDefinition.ButtonElement; + + public class MultiGridRenderer extends Object implements IGridRenderer + { + + public function MultiGridRenderer(param1:String) + { + var _loc2_:Array = null; + super(); + if(param1) + { + _loc2_ = param1.split(","); + this._updateFunctionName = _loc2_[0]; + this._getLineTypeFunctionName = _loc2_[1]; + this._getDataLengthFunctionName = _loc2_[2]; + if(_loc2_[3]) { - params = args.split(","); - this._updateFunctionName = params[0]; - this._getLineTypeFunctionName = params[1]; - this._getDataLengthFunctionName = params[2]; - if (params[3]) - { - this._bgColor1 = new ColorTransform(); - this._color1 = parseInt(params[3], 16); - this._bgColor1.color = this._color1; - }; - if (params[4]) - { - this._bgColor2 = new ColorTransform(); - this._color2 = parseInt(params[4], 16); - this._bgColor2.color = this._color2; - }; - if (params[5]) - { - this._bgAlpha = parseInt(params[5]); - }; - }; - this._cptNameReferences = new Dictionary(); - this._componentReferences = new Dictionary(); - this._containerDefinition = new Dictionary(); - this._componentReferencesByInstance = new Dictionary(true); - this._uiRenderer = new UiRenderer(); - this._containerCache = new Dictionary(); - } - - public function set grid(g:Grid):void - { - if (!(this._grid)) - { - this._grid = g; - }; - g.mouseEnabled = true; - var ui:UiRootContainer = this._grid.getUi(); - this._uiRenderer.postInit(ui); - } - - public function render(data:*, index:uint, selected:Boolean, subIndex:uint=0):DisplayObject - { - var container:GraphicContainer = new GraphicContainer(); - container.setUi(this._grid.getUi(), SecureCenter.ACCESS_KEY); - this.update(data, index, container, selected, subIndex); - return (container); - } - - public function update(data:*, index:uint, target:DisplayObject, selected:Boolean, subIndex:uint=0):void - { - var s:Sprite; - var ui:UiRootContainer = this._grid.getUi(); - if (((((!(ui.uiClass.hasOwnProperty(this._getLineTypeFunctionName))) && (!(this._defaultLineType)))) || (!(ui.uiClass.hasOwnProperty(this._updateFunctionName))))) - { - throw (new BeriliaError("GetLineType function or update function is not define.")); - }; - var containerName:String = ((this._defaultLineType) ? this._defaultLineType : ui.uiClass[this._getLineTypeFunctionName](SecureCenter.secure(data), subIndex)); - if (target.name != containerName) - { - this.buildLine((target as Sprite), containerName); - }; - if ((target is Sprite)) - { - s = (target as Sprite); - if ((index % 2) == 0) - { - s.graphics.clear(); - if (this._color1) - { - s.graphics.beginFill(this._color1, this._bgAlpha); - s.graphics.drawRect(0, 0, this._grid.slotWidth, this._grid.slotHeight); - s.graphics.endFill(); - }; - }; - if ((index % 2) == 1) - { - s.graphics.clear(); - if (this._color2) - { - s.graphics.beginFill(this._color2, this._bgAlpha); - s.graphics.drawRect(0, 0, this._grid.slotWidth, this._grid.slotHeight); - s.graphics.endFill(); - }; - }; - }; - this.uiUpdate(ui, target, data, selected, subIndex); - } - - protected function uiUpdate(ui:UiRootContainer, target:DisplayObject, data:*, selected:Boolean, subIndex:uint):void - { - if (DisplayObjectContainer(target).numChildren) - { - var _local_6 = ui.uiClass; - (_local_6[this._updateFunctionName](SecureCenter.secure(data), this._cptNameReferences[DisplayObjectContainer(target).getChildAt(0)], selected, subIndex)); - }; - } - - public function remove(dispObj:DisplayObject):void - { - dispObj.visible = false; - } - - public function destroy():void - { - var o:Object; - var o2:Object; - var o3:Object; - for each (o in this._componentReferences) - { - o2 = SecureCenter.unsecure(o); - for each (o3 in o2) - { - if ((o3 is GraphicContainer)) - { - o3.remove(); - }; - }; - }; - this._componentReferences = null; - this._componentReferencesByInstance = null; - this._grid = null; - } - - public function getDataLength(data:*, selected:Boolean):uint - { - var ui:UiRootContainer = this._grid.getUi(); - if (ui.uiClass.hasOwnProperty(this._getDataLengthFunctionName)) - { - return (ui.uiClass[this._getDataLengthFunctionName](data, selected)); - }; - return (1); - } - - public function renderModificator(childs:Array):Array - { - var container:ContainerElement; - for each (container in childs) - { - this._containerDefinition[container.name] = container; - }; - return ([]); - } - - public function eventModificator(msg:Message, functionName:String, args:Array, target:UIComponent):String - { - return (functionName); - } - - protected function buildLine(container:Sprite, name:String):void - { - var key:String; - var multiGridMarkerIndex:int; - var realElemName:String; - if (container.name == name) + this._bgColor1 = new ColorTransform(); + this._color1 = parseInt(_loc2_[3],16); + this._bgColor1.color = this._color1; + } + if(_loc2_[4]) { - return; - }; - if (!(this._containerCache[name])) + this._bgColor2 = new ColorTransform(); + this._color2 = parseInt(_loc2_[4],16); + this._bgColor2.color = this._color2; + } + if(_loc2_[5]) { - this._containerCache[name] = []; - }; - if (this._containerDefinition[container.name]) + this._bgAlpha = parseInt(_loc2_[5]); + } + } + this._cptNameReferences = new Dictionary(); + this._componentReferences = new Dictionary(); + this._containerDefinition = new Dictionary(); + this._componentReferencesByInstance = new Dictionary(true); + this._uiRenderer = new UiRenderer(); + this._containerCache = new Dictionary(); + } + + protected var _grid:Grid; + + protected var _cptNameReferences:Dictionary; + + protected var _componentReferences:Dictionary; + + protected var _componentReferencesByInstance:Dictionary; + + protected var _elemID:uint; + + protected var _containerCache:Dictionary; + + protected var _uiRenderer:UiRenderer; + + protected var _containerDefinition:Dictionary; + + protected var _bgColor1:ColorTransform; + + protected var _bgColor2:ColorTransform; + + protected var _color1:Number = -1; + + protected var _color2:Number = -1; + + protected var _bgAlpha:Number = 1; + + protected var _updateFunctionName:String; + + protected var _getLineTypeFunctionName:String; + + protected var _defaultLineType:String; + + protected var _getDataLengthFunctionName:String; + + public function set grid(param1:Grid) : void + { + if(!this._grid) + { + this._grid = param1; + } + param1.mouseEnabled = true; + var _loc2_:UiRootContainer = this._grid.getUi(); + this._uiRenderer.postInit(_loc2_); + } + + public function render(param1:*, param2:uint, param3:Boolean, param4:uint = 0) : DisplayObject + { + var _loc5_:GraphicContainer = new GraphicContainer(); + _loc5_.setUi(this._grid.getUi(),SecureCenter.ACCESS_KEY); + this.update(param1,param2,_loc5_,param3,param4); + return _loc5_; + } + + public function update(param1:*, param2:uint, param3:DisplayObject, param4:Boolean, param5:uint = 0) : void + { + var _loc8_:Sprite = null; + var _loc6_:UiRootContainer = this._grid.getUi(); + if(!_loc6_.uiClass.hasOwnProperty(this._getLineTypeFunctionName) && !this._defaultLineType || !_loc6_.uiClass.hasOwnProperty(this._updateFunctionName)) + { + throw new BeriliaError("GetLineType function or update function is not define."); + } + else + { + var _loc7_:String = this._defaultLineType?this._defaultLineType:_loc6_.uiClass[this._getLineTypeFunctionName](SecureCenter.secure(param1),param5); + if(param3.name != _loc7_) { - if (!(this._containerCache[container.name])) - { - this._containerCache[container.name] = []; - }; - if (container.numChildren) - { - this._containerCache[container.name].push(container.getChildAt(0)); - container.removeChildAt(0); - }; - }; - container.name = ((name) ? name : "#########EMPTY"); - if (!(name)) + this.buildLine(param3 as Sprite,_loc7_); + } + if(param3 is Sprite) { - return; - }; - if (this._containerCache[name].length) + _loc8_ = param3 as Sprite; + if(param2 % 2 == 0) + { + _loc8_.graphics.clear(); + if(this._color1) + { + _loc8_.graphics.beginFill(this._color1,this._bgAlpha); + _loc8_.graphics.drawRect(0,0,this._grid.slotWidth,this._grid.slotHeight); + _loc8_.graphics.endFill(); + } + } + if(param2 % 2 == 1) + { + _loc8_.graphics.clear(); + if(this._color2) + { + _loc8_.graphics.beginFill(this._color2,this._bgAlpha); + _loc8_.graphics.drawRect(0,0,this._grid.slotWidth,this._grid.slotHeight); + _loc8_.graphics.endFill(); + } + } + } + this.uiUpdate(_loc6_,param3,param1,param4,param5); + return; + } + } + + protected function uiUpdate(param1:UiRootContainer, param2:DisplayObject, param3:*, param4:Boolean, param5:uint) : void + { + if(DisplayObjectContainer(param2).numChildren) + { + param1.uiClass[this._updateFunctionName](SecureCenter.secure(param3),this._cptNameReferences[DisplayObjectContainer(param2).getChildAt(0)],param4,param5); + } + } + + public function remove(param1:DisplayObject) : void + { + param1.visible = false; + } + + public function destroy() : void + { + var _loc1_:Object = null; + var _loc2_:Object = null; + var _loc3_:Object = null; + for each(_loc1_ in this._componentReferences) + { + _loc2_ = SecureCenter.unsecure(_loc1_); + for each(_loc3_ in _loc2_) { - container.addChild(this._containerCache[name].pop()); - return; - }; - var elemContainer:GraphicContainer = new GraphicContainer(); - elemContainer.setUi(this._grid.getUi(), SecureCenter.ACCESS_KEY); - elemContainer.mouseEnabled = false; - container.addChild(elemContainer); - var cptNames:Array = []; - this._uiRenderer.makeChilds([this.copyElement(this._containerDefinition[name], cptNames)], elemContainer, true); - this._grid.getUi().render(); - var components:Object = {}; - var ui:UiRootContainer = this._grid.getUi(); - for (key in cptNames) + if(_loc3_ is GraphicContainer) + { + _loc3_.remove(); + } + } + } + this._componentReferences = null; + this._componentReferencesByInstance = null; + this._grid = null; + } + + public function getDataLength(param1:*, param2:Boolean) : uint + { + var _loc3_:UiRootContainer = this._grid.getUi(); + if(_loc3_.uiClass.hasOwnProperty(this._getDataLengthFunctionName)) + { + return _loc3_.uiClass[this._getDataLengthFunctionName](param1,param2); + } + return 1; + } + + public function renderModificator(param1:Array) : Array + { + var _loc2_:ContainerElement = null; + for each(this._containerDefinition[_loc2_.name] in param1) + { + } + return []; + } + + public function eventModificator(param1:Message, param2:String, param3:Array, param4:UIComponent) : String + { + return param2; + } + + protected function buildLine(param1:Sprite, param2:String) : void + { + var _loc7_:String = null; + var _loc8_:* = 0; + var _loc9_:String = null; + if(param1.name == param2) + { + return; + } + if(!this._containerCache[param2]) + { + this._containerCache[param2] = []; + } + if(this._containerDefinition[param1.name]) + { + if(!this._containerCache[param1.name]) { - multiGridMarkerIndex = key.indexOf("_m_"); - realElemName = key; - if (multiGridMarkerIndex != -1) - { - realElemName = realElemName.substr(0, multiGridMarkerIndex); - }; - components[realElemName] = SecureCenter.secure(ui.getElement(cptNames[key]), SecureCenter.ACCESS_KEY); - }; - this._cptNameReferences[elemContainer] = components; - this._elemID++; - } - - protected function copyElement(basicElement:BasicElement, names:Object):BasicElement - { - var childs:Array; - var elem:BasicElement; - var nsce:StateContainerElement; - var sce:StateContainerElement; - var stateChangingProperties:Array; - var state:uint; - var stateStr:String; - var elemName:String; - var newElement:BasicElement = new ((getDefinitionByName(getQualifiedClassName(basicElement)) as Class))(); - basicElement.copy(newElement); - if (newElement.name) + this._containerCache[param1.name] = []; + } + if(param1.numChildren) { - newElement.setName(((((newElement.name + "_m_") + this._grid.name) + "_") + this._elemID)); - names[basicElement.name] = newElement.name; + this._containerCache[param1.name].push(param1.getChildAt(0)); + param1.removeChildAt(0); } - else + } + param1.name = param2?param2:"#########EMPTY"; + if(!param2) + { + return; + } + if(this._containerCache[param2].length) + { + param1.addChild(this._containerCache[param2].pop()); + return; + } + var _loc3_:GraphicContainer = new GraphicContainer(); + _loc3_.setUi(this._grid.getUi(),SecureCenter.ACCESS_KEY); + _loc3_.mouseEnabled = false; + param1.addChild(_loc3_); + var _loc4_:Array = []; + this._uiRenderer.makeChilds([this.copyElement(this._containerDefinition[param2],_loc4_)],_loc3_,true); + this._grid.getUi().render(); + var _loc5_:Object = {}; + var _loc6_:UiRootContainer = this._grid.getUi(); + for(_loc7_ in _loc4_) + { + _loc8_ = _loc7_.indexOf("_m_"); + _loc9_ = _loc7_; + if(_loc8_ != -1) { - newElement.setName(((("elem_m_" + this._grid.name) + "_") + BasicElement.ID++)); - }; - if ((newElement is ContainerElement)) + _loc9_ = _loc9_.substr(0,_loc8_); + } + _loc5_[_loc9_] = SecureCenter.secure(_loc6_.getElement(_loc4_[_loc7_]),SecureCenter.ACCESS_KEY); + } + this._cptNameReferences[_loc3_] = _loc5_; + this._elemID++; + } + + protected function copyElement(param1:BasicElement, param2:Object) : BasicElement + { + var _loc4_:Array = null; + var _loc5_:BasicElement = null; + var _loc6_:StateContainerElement = null; + var _loc7_:StateContainerElement = null; + var _loc8_:Array = null; + var _loc9_:uint = 0; + var _loc10_:String = null; + var _loc11_:String = null; + var _loc3_:BasicElement = new (getDefinitionByName(getQualifiedClassName(param1)) as Class)(); + param1.copy(_loc3_); + if(_loc3_.name) + { + _loc3_.setName(_loc3_.name + "_m_" + this._grid.name + "_" + this._elemID); + param2[param1.name] = _loc3_.name; + } + else + { + _loc3_.setName("elem_m_" + this._grid.name + "_" + BasicElement.ID++); + } + if(_loc3_ is ContainerElement) + { + _loc4_ = new Array(); + for each(_loc5_ in ContainerElement(param1).childs) { - childs = new Array(); - for each (elem in ContainerElement(basicElement).childs) - { - childs.push(this.copyElement(elem, names)); - }; - ContainerElement(newElement).childs = childs; - }; - if ((newElement is StateContainerElement)) + _loc4_.push(this.copyElement(_loc5_,param2)); + } + ContainerElement(_loc3_).childs = _loc4_; + } + if(_loc3_ is StateContainerElement) + { + _loc6_ = _loc3_ as StateContainerElement; + _loc7_ = param1 as StateContainerElement; + _loc8_ = new Array(); + for(_loc10_ in _loc7_.stateChangingProperties) { - nsce = (newElement as StateContainerElement); - sce = (basicElement as StateContainerElement); - stateChangingProperties = new Array(); - for (stateStr in sce.stateChangingProperties) - { - state = parseInt(stateStr); - for (elemName in sce.stateChangingProperties[state]) - { - if (!(stateChangingProperties[state])) - { - stateChangingProperties[state] = []; - }; - stateChangingProperties[state][((((elemName + "_m_") + this._grid.name) + "_") + this._elemID)] = sce.stateChangingProperties[state][elemName]; - }; - }; - nsce.stateChangingProperties = stateChangingProperties; - }; - if ((newElement is ButtonElement)) + _loc9_ = parseInt(_loc10_); + for(_loc11_ in _loc7_.stateChangingProperties[_loc9_]) + { + if(!_loc8_[_loc9_]) + { + _loc8_[_loc9_] = []; + } + _loc8_[_loc9_][_loc11_ + "_m_" + this._grid.name + "_" + this._elemID] = _loc7_.stateChangingProperties[_loc9_][_loc11_]; + } + } + _loc6_.stateChangingProperties = _loc8_; + } + if(_loc3_ is ButtonElement) + { + if(_loc3_.properties["linkedTo"]) { - if (newElement.properties["linkedTo"]) - { - newElement.properties["linkedTo"] = ((((newElement.properties["linkedTo"] + "_m_") + this._grid.name) + "_") + this._elemID); - }; - }; - return (newElement); - } - - - } -}//package com.ankamagames.berilia.components.gridRenderer - + _loc3_.properties["linkedTo"] = _loc3_.properties["linkedTo"] + "_m_" + this._grid.name + "_" + this._elemID; + } + } + return _loc3_; + } + } +} diff --git a/com/ankamagames/berilia/components/gridRenderer/SlotGridRenderer.as b/com/ankamagames/berilia/components/gridRenderer/SlotGridRenderer.as index 3cb2d47d4..2af133b5f 100644 --- a/com/ankamagames/berilia/components/gridRenderer/SlotGridRenderer.as +++ b/com/ankamagames/berilia/components/gridRenderer/SlotGridRenderer.as @@ -1,337 +1,342 @@ -package com.ankamagames.berilia.components.gridRenderer +package com.ankamagames.berilia.components.gridRenderer { - import com.ankamagames.berilia.interfaces.IGridRenderer; - import com.ankamagames.jerakine.interfaces.ICustomSecureObject; - import com.ankamagames.jerakine.logger.Logger; - import com.ankamagames.berilia.components.Grid; - import com.ankamagames.jerakine.types.Uri; - import com.ankamagames.jerakine.logger.Log; - import flash.utils.getQualifiedClassName; - import com.ankamagames.berilia.managers.SecureCenter; - import com.ankamagames.berilia.components.Slot; - import flash.display.DisplayObject; - import com.ankamagames.jerakine.interfaces.ISlotData; - import com.ankamagames.berilia.types.data.LinkedCursorData; - import flash.geom.Point; - import com.ankamagames.berilia.interfaces.IClonable; - import com.ankamagames.berilia.managers.LinkedCursorSpriteManager; - import gs.TweenMax; - import gs.easing.Quart; - import com.ankamagames.jerakine.messages.Message; - import com.ankamagames.berilia.UIComponent; - import gs.events.TweenEvent; - - [RendererArgs(emptySlotTexture="com.ankamagames.jerakine.types::Uri", overTexture="com.ankamagames.jerakine.types::Uri", selectedTexture="com.ankamagames.jerakine.types::Uri", dropAllowedTexture="com.ankamagames.jerakine.types::Uri", dropRefusedTexture="com.ankamagames.jerakine.types::Uri", timerTexture="com.ankamagames.jerakine.types::Uri", quantityFont="String", allowDrop="Boolean", buttonMode="Boolean")] - public class SlotGridRenderer implements IGridRenderer, ICustomSecureObject - { - - protected var _log:Logger; - private var _grid:Grid; - private var _emptyTexture:Uri; - private var _overTexture:Uri; - private var _selectedTexture:Uri; - private var _acceptDragTexture:Uri; - private var _refuseDragTexture:Uri; - private var _customTexture:Uri; - private var _timerTexture:Uri; - private var _cssUri:Uri; - private var _allowDrop:Boolean; - private var _isButton:Boolean; - private var _hideQuantities:Boolean = false; - [Untrusted] - public var dropValidatorFunction:Function; - [Untrusted] - public var processDropFunction:Function; - [Untrusted] - public var removeDropSourceFunction:Function; - - public function SlotGridRenderer(strParams:String) - { - this._log = Log.getLogger(getQualifiedClassName(SlotGridRenderer)); - super(); - var params:Array = ((strParams) ? strParams.split(",") : []); - this._emptyTexture = ((((params[0]) && (params[0].length))) ? new Uri(params[0]) : null); - this._overTexture = ((((params[1]) && (params[1].length))) ? new Uri(params[1]) : null); - this._selectedTexture = ((((params[2]) && (params[2].length))) ? new Uri(params[2]) : null); - this._acceptDragTexture = ((((params[3]) && (params[3].length))) ? new Uri(params[3]) : null); - this._refuseDragTexture = ((((params[4]) && (params[4].length))) ? new Uri(params[4]) : null); - this._timerTexture = ((((params[5]) && (params[5].length))) ? new Uri(params[5]) : null); - this._cssUri = ((((params[6]) && (params[6].length))) ? new Uri(params[6]) : null); - this._allowDrop = ((((params[7]) && (params[7].length))) ? (params[7] == "true") : true); - this._isButton = ((((params[8]) && (params[8].length))) ? (params[8] == "true") : false); - } - - [Untrusted] - public function set allowDrop(pAllow:Boolean):void - { - this._allowDrop = pAllow; - } - - public function get allowDrop():Boolean - { - return (this._allowDrop); - } - - [Untrusted] - public function set isButton(pButton:Boolean):void - { - this._isButton = pButton; - } - - public function get isButton():Boolean - { - return (this._isButton); - } - - [Untrusted] - public function set hideQuantities(value:Boolean):void - { - this._hideQuantities = value; - } - - public function get hideQuantities():Boolean - { - return (this._hideQuantities); - } - - public function get acceptDragTexture():Uri - { - return (this._acceptDragTexture); - } - - [Untrusted] - public function set acceptDragTexture(uri:Uri):void - { - this._acceptDragTexture = uri; - } - - public function get refuseDragTexture():Uri - { - return (this._refuseDragTexture); - } - - [Untrusted] - public function set refuseDragTexture(uri:Uri):void - { - this._refuseDragTexture = uri; - } - - public function get customTexture():Uri - { - return (this._customTexture); - } - - [Untrusted] - public function set customTexture(uri:Uri):void - { - this._customTexture = uri; - } - - [Untrusted] - public function set grid(g:Grid):void - { - this._grid = g; - } - - public function render(data:*, index:uint, selected:Boolean, subIndex:uint=0):DisplayObject - { - var slotData:* = SecureCenter.unsecure(data); - var slot:Slot = new Slot(); - slot.name = ((((this._grid.getUi().name + "::") + this._grid.name) + "::item") + index); - slot.mouseEnabled = true; - slot.emptyTexture = this._emptyTexture; - slot.highlightTexture = this._overTexture; - slot.timerTexture = this._timerTexture; - slot.selectedTexture = this._selectedTexture; - slot.acceptDragTexture = this._acceptDragTexture; - slot.refuseDragTexture = this._refuseDragTexture; - slot.customTexture = this._customTexture; - slot.css = this._cssUri; - slot.isButton = this._isButton; - if (this._hideQuantities) + import com.ankamagames.berilia.interfaces.IGridRenderer; + import com.ankamagames.jerakine.interfaces.ICustomSecureObject; + import com.ankamagames.jerakine.logger.Logger; + import com.ankamagames.berilia.components.Grid; + import com.ankamagames.jerakine.types.Uri; + import flash.display.DisplayObject; + import com.ankamagames.berilia.managers.SecureCenter; + import com.ankamagames.berilia.components.Slot; + import com.ankamagames.jerakine.interfaces.ISlotData; + import com.ankamagames.berilia.types.data.LinkedCursorData; + import flash.geom.Point; + import com.ankamagames.berilia.interfaces.IClonable; + import com.ankamagames.berilia.managers.LinkedCursorSpriteManager; + import gs.TweenMax; + import gs.easing.Quart; + import com.ankamagames.jerakine.messages.Message; + import com.ankamagames.berilia.UIComponent; + import gs.events.TweenEvent; + import com.ankamagames.jerakine.logger.Log; + import flash.utils.getQualifiedClassName; + + public class SlotGridRenderer extends Object implements IGridRenderer, ICustomSecureObject + { + + public function SlotGridRenderer(param1:String) + { + this._log = Log.getLogger(getQualifiedClassName(SlotGridRenderer)); + super(); + var _loc2_:Array = param1?param1.split(","):[]; + this._emptyTexture = (_loc2_[0]) && (_loc2_[0].length)?new Uri(_loc2_[0]):null; + this._overTexture = (_loc2_[1]) && (_loc2_[1].length)?new Uri(_loc2_[1]):null; + this._selectedTexture = (_loc2_[2]) && (_loc2_[2].length)?new Uri(_loc2_[2]):null; + this._acceptDragTexture = (_loc2_[3]) && (_loc2_[3].length)?new Uri(_loc2_[3]):null; + this._refuseDragTexture = (_loc2_[4]) && (_loc2_[4].length)?new Uri(_loc2_[4]):null; + this._timerTexture = (_loc2_[5]) && (_loc2_[5].length)?new Uri(_loc2_[5]):null; + this._cssUri = (_loc2_[6]) && (_loc2_[6].length)?new Uri(_loc2_[6]):null; + this._allowDrop = (_loc2_[7]) && (_loc2_[7].length)?_loc2_[7] == "true":true; + this._isButton = (_loc2_[8]) && (_loc2_[8].length)?_loc2_[8] == "true":false; + } + + protected var _log:Logger; + + private var _grid:Grid; + + private var _emptyTexture:Uri; + + private var _overTexture:Uri; + + private var _selectedTexture:Uri; + + private var _acceptDragTexture:Uri; + + private var _refuseDragTexture:Uri; + + private var _customTexture:Uri; + + private var _timerTexture:Uri; + + private var _cssUri:Uri; + + private var _allowDrop:Boolean; + + private var _isButton:Boolean; + + private var _hideQuantities:Boolean = false; + + public var dropValidatorFunction:Function; + + public var processDropFunction:Function; + + public var removeDropSourceFunction:Function; + + public function set allowDrop(param1:Boolean) : void + { + this._allowDrop = param1; + } + + public function get allowDrop() : Boolean + { + return this._allowDrop; + } + + public function set isButton(param1:Boolean) : void + { + this._isButton = param1; + } + + public function get isButton() : Boolean + { + return this._isButton; + } + + public function set hideQuantities(param1:Boolean) : void + { + this._hideQuantities = param1; + } + + public function get hideQuantities() : Boolean + { + return this._hideQuantities; + } + + public function get acceptDragTexture() : Uri + { + return this._acceptDragTexture; + } + + public function set acceptDragTexture(param1:Uri) : void + { + this._acceptDragTexture = param1; + } + + public function get refuseDragTexture() : Uri + { + return this._refuseDragTexture; + } + + public function set refuseDragTexture(param1:Uri) : void + { + this._refuseDragTexture = param1; + } + + public function get customTexture() : Uri + { + return this._customTexture; + } + + public function set customTexture(param1:Uri) : void + { + this._customTexture = param1; + } + + public function set grid(param1:Grid) : void + { + this._grid = param1; + } + + public function render(param1:*, param2:uint, param3:Boolean, param4:uint = 0) : DisplayObject + { + var _loc5_:* = SecureCenter.unsecure(param1); + var _loc6_:Slot = new Slot(); + _loc6_.name = this._grid.getUi().name + "::" + this._grid.name + "::item" + param2; + _loc6_.mouseEnabled = true; + _loc6_.emptyTexture = this._emptyTexture; + _loc6_.highlightTexture = this._overTexture; + _loc6_.timerTexture = this._timerTexture; + _loc6_.selectedTexture = this._selectedTexture; + _loc6_.acceptDragTexture = this._acceptDragTexture; + _loc6_.refuseDragTexture = this._refuseDragTexture; + _loc6_.customTexture = this._customTexture; + _loc6_.css = this._cssUri; + _loc6_.isButton = this._isButton; + if(this._hideQuantities) + { + _loc6_.hideTopLabel = true; + } + else + { + _loc6_.hideTopLabel = false; + } + _loc6_.width = this._grid.slotWidth; + _loc6_.height = this._grid.slotHeight; + if(this._isButton) + { + _loc6_.selected = param3; + } + else + { + _loc6_.allowDrag = this._allowDrop; + } + _loc6_.data = _loc5_; + _loc6_.processDrop = this._processDrop; + _loc6_.removeDropSource = this._removeDropSourceFunction; + _loc6_.dropValidator = this._dropValidatorFunction; + _loc6_.finalize(); + return _loc6_; + } + + public function _removeDropSourceFunction(param1:*) : void + { + var _loc4_:* = undefined; + if(this.removeDropSourceFunction != null) + { + this.removeDropSourceFunction(param1); + return; + } + var _loc2_:Array = new Array(); + var _loc3_:* = true; + for each(_loc4_ in this._grid.dataProvider) + { + if(_loc4_ != param1.data) { - slot.hideTopLabel = true; + _loc2_.push(_loc4_); } - else - { - slot.hideTopLabel = false; - }; - slot.width = this._grid.slotWidth; - slot.height = this._grid.slotHeight; - if (this._isButton) + } + this._grid.dataProvider = _loc2_; + } + + public function _dropValidatorFunction(param1:Object, param2:*, param3:Object) : Boolean + { + if(this.dropValidatorFunction != null) + { + return this.dropValidatorFunction(param1,param2,param3); + } + return true; + } + + public function update(param1:*, param2:uint, param3:DisplayObject, param4:Boolean, param5:uint = 0) : void + { + var _loc6_:Slot = null; + if(param3 is Slot) + { + _loc6_ = Slot(param3); + _loc6_.data = SecureCenter.unsecure(param1) as ISlotData; + if(!this._isButton) { - slot.selected = selected; + _loc6_.selected = param4; + _loc6_.allowDrag = this._allowDrop; } - else - { - slot.allowDrag = this._allowDrop; - }; - slot.data = slotData; - slot.processDrop = this._processDrop; - slot.removeDropSource = this._removeDropSourceFunction; - slot.dropValidator = this._dropValidatorFunction; - slot.finalize(); - return (slot); - } - - public function _removeDropSourceFunction(target:*):void - { - var data:*; - if (this.removeDropSourceFunction != null) - { - this.removeDropSourceFunction(target); - return; - }; - var dp:Array = new Array(); - var addData:Boolean = true; - for each (data in this._grid.dataProvider) - { - if (data != target.data) - { - dp.push(data); - }; - }; - this._grid.dataProvider = dp; - } - - public function _dropValidatorFunction(target:Object, iSlotData:*, source:Object):Boolean - { - if (this.dropValidatorFunction != null) - { - return (this.dropValidatorFunction(target, iSlotData, source)); - }; - return (true); - } - - public function update(data:*, index:uint, dispObj:DisplayObject, selected:Boolean, subIndex:uint=0):void - { - var slot:Slot; - if ((dispObj is Slot)) + _loc6_.isButton = this._isButton; + if(this._hideQuantities) { - slot = Slot(dispObj); - slot.data = (SecureCenter.unsecure(data) as ISlotData); - if (!(this._isButton)) - { - slot.selected = selected; - slot.allowDrag = this._allowDrop; - }; - slot.isButton = this._isButton; - if (this._hideQuantities) - { - slot.hideTopLabel = true; - } - else - { - slot.hideTopLabel = false; - }; - slot.dropValidator = this._dropValidatorFunction; - slot.removeDropSource = this._removeDropSourceFunction; - slot.processDrop = this._processDrop; + _loc6_.hideTopLabel = true; } else { - this._log.warn((("Can't update, " + dispObj.name) + " is not a Slot component")); - }; - } - - public function getDataLength(data:*, selected:Boolean):uint - { - return (1); - } - - public function remove(dispObj:DisplayObject):void - { - if ((((dispObj is Slot)) && (dispObj.parent))) - { - Slot(dispObj).remove(); - }; - } - - public function destroy():void - { - this._grid = null; - this._emptyTexture = null; - this._overTexture = null; - this._timerTexture = null; - this._selectedTexture = null; - this._acceptDragTexture = null; - this._refuseDragTexture = null; - this._customTexture = null; - this._cssUri = null; - } - - public function _processDrop(target:*, data:*, source:*):void - { - var linkCursor:LinkedCursorData; - var pt:Point; - var tweenTarget:DisplayObject; - if (this.processDropFunction != null) - { - this.processDropFunction(target, data, source); - return; - }; - var sameGrid:Boolean; - if (DisplayObject(data.holder).parent != this._grid) - { - if ((data is IClonable)) - { - this._grid.dataProvider.push((data as IClonable).clone()); - } - else - { - this._grid.dataProvider.push(data); - }; - this._grid.dataProvider = this._grid.dataProvider; + _loc6_.hideTopLabel = false; } - else - { - sameGrid = true; - }; - linkCursor = LinkedCursorSpriteManager.getInstance().getItem(Slot.DRAG_AND_DROP_CURSOR_NAME); - if (((sameGrid) || (!(this._grid.indexIsInvisibleSlot((this._grid.dataProvider.length - 1)))))) + _loc6_.dropValidator = this._dropValidatorFunction; + _loc6_.removeDropSource = this._removeDropSourceFunction; + _loc6_.processDrop = this._processDrop; + } + else + { + this._log.warn("Can\'t update, " + param3.name + " is not a Slot component"); + } + } + + public function getDataLength(param1:*, param2:Boolean) : uint + { + return 1; + } + + public function remove(param1:DisplayObject) : void + { + if(param1 is Slot && (param1.parent)) + { + Slot(param1).remove(); + } + } + + public function destroy() : void + { + this._grid = null; + this._emptyTexture = null; + this._overTexture = null; + this._timerTexture = null; + this._selectedTexture = null; + this._acceptDragTexture = null; + this._refuseDragTexture = null; + this._customTexture = null; + this._cssUri = null; + } + + public function _processDrop(param1:*, param2:*, param3:*) : void + { + var _loc5_:LinkedCursorData = null; + var _loc6_:Point = null; + var _loc7_:DisplayObject = null; + if(!this._allowDrop) + { + return; + } + if(this.processDropFunction != null) + { + this.processDropFunction(param1,param2,param3); + return; + } + var _loc4_:* = false; + if(DisplayObject(param2.holder).parent != this._grid) + { + if(param2 is IClonable) { - tweenTarget = DisplayObject(data.holder); - pt = tweenTarget.localToGlobal(new Point(tweenTarget.x, tweenTarget.y)); - TweenMax.to(linkCursor.sprite, 0.5, { - "x":pt.x, - "y":pt.y, - "alpha":0, - "ease":Quart.easeOut, - "onCompleteListener":this.onTweenEnd - }); + this._grid.dataProvider.push((param2 as IClonable).clone()); } else { - pt = this._grid.localToGlobal(new Point(this._grid.x, this._grid.y)); - linkCursor.sprite.stopDrag(); - TweenMax.to(linkCursor.sprite, 0.5, { - "x":(pt.x + (this._grid.width / 2)), - "y":(pt.y + this._grid.height), - "alpha":0, - "scaleX":0.1, - "scaleY":0.1, - "ease":Quart.easeOut, - "onCompleteListener":this.onTweenEnd - }); - }; - } - - public function renderModificator(childs:Array):Array - { - return (childs); - } - - public function eventModificator(msg:Message, functionName:String, args:Array, target:UIComponent):String - { - return (functionName); - } - - private function onTweenEnd(e:TweenEvent):void - { - LinkedCursorSpriteManager.getInstance().removeItem(Slot.DRAG_AND_DROP_CURSOR_NAME); - } - - - } -}//package com.ankamagames.berilia.components.gridRenderer - + this._grid.dataProvider.push(param2); + } + this._grid.dataProvider = this._grid.dataProvider; + } + else + { + _loc4_ = true; + } + _loc5_ = LinkedCursorSpriteManager.getInstance().getItem(Slot.DRAG_AND_DROP_CURSOR_NAME); + if((_loc4_) || !this._grid.indexIsInvisibleSlot(this._grid.dataProvider.length - 1)) + { + _loc7_ = DisplayObject(param2.holder); + _loc6_ = _loc7_.localToGlobal(new Point(_loc7_.x,_loc7_.y)); + TweenMax.to(_loc5_.sprite,0.5,{ + "x":_loc6_.x, + "y":_loc6_.y, + "alpha":0, + "ease":Quart.easeOut, + "onCompleteListener":this.onTweenEnd + }); + } + else + { + _loc6_ = this._grid.localToGlobal(new Point(this._grid.x,this._grid.y)); + _loc5_.sprite.stopDrag(); + TweenMax.to(_loc5_.sprite,0.5,{ + "x":_loc6_.x + this._grid.width / 2, + "y":_loc6_.y + this._grid.height, + "alpha":0, + "scaleX":0.1, + "scaleY":0.1, + "ease":Quart.easeOut, + "onCompleteListener":this.onTweenEnd + }); + } + } + + public function renderModificator(param1:Array) : Array + { + return param1; + } + + public function eventModificator(param1:Message, param2:String, param3:Array, param4:UIComponent) : String + { + return param2; + } + + private function onTweenEnd(param1:TweenEvent) : void + { + LinkedCursorSpriteManager.getInstance().removeItem(Slot.DRAG_AND_DROP_CURSOR_NAME); + } + } +} diff --git a/com/ankamagames/berilia/components/gridRenderer/TreeGridRenderer.as b/com/ankamagames/berilia/components/gridRenderer/TreeGridRenderer.as index 794337c67..dcf841d3d 100644 --- a/com/ankamagames/berilia/components/gridRenderer/TreeGridRenderer.as +++ b/com/ankamagames/berilia/components/gridRenderer/TreeGridRenderer.as @@ -1,372 +1,376 @@ -package com.ankamagames.berilia.components.gridRenderer +package com.ankamagames.berilia.components.gridRenderer { - import com.ankamagames.berilia.interfaces.IGridRenderer; - import com.ankamagames.jerakine.logger.Logger; - import com.ankamagames.berilia.components.Grid; - import flash.geom.ColorTransform; - import com.ankamagames.jerakine.types.Uri; - import flash.utils.Dictionary; - import com.ankamagames.jerakine.logger.Log; - import flash.utils.getQualifiedClassName; - import com.ankamagames.berilia.types.data.TreeData; - import flash.display.Sprite; - import com.ankamagames.berilia.components.Texture; - import com.ankamagames.berilia.components.Label; - import flash.events.MouseEvent; - import flash.display.DisplayObject; - import com.ankamagames.jerakine.messages.Message; - import com.ankamagames.berilia.UIComponent; - import flash.display.Shape; - import flash.geom.Transform; - import com.ankamagames.jerakine.interfaces.IInterfaceListener; - import com.ankamagames.berilia.components.Tree; - import com.ankamagames.berilia.Berilia; - - [RendererArgs(fontCss="String", eventLineColor="uint", oddLineColor="uint", overLineColor="uint", selectedLineColor="uint", expandableBtnUri="com.ankamagames.jerakine.types::Uri", simpleItemUri="com.ankamagames.jerakine.types::Uri", endItemUri="com.ankamagames.jerakine.types::Uri")] - public class TreeGridRenderer implements IGridRenderer - { - - protected var _log:Logger; - private var _grid:Grid; - private var _bgColor1:ColorTransform; - private var _bgColor2:ColorTransform; - private var _selectedColor:ColorTransform; - private var _overColor:ColorTransform; - private var _cssUri:Uri; - private var _expendBtnUri:Uri; - private var _simpleItemUri:Uri; - private var _endItemUri:Uri; - private var _shapeIndex:Dictionary; - private var _indexRef:Dictionary; - private var _uriRef:Array; - - public function TreeGridRenderer(strParams:String) - { - var params:Array; - this._log = Log.getLogger(getQualifiedClassName(TreeGridRenderer)); - this._shapeIndex = new Dictionary(true); - this._indexRef = new Dictionary(true); - this._uriRef = new Array(); - super(); - if (strParams) + import com.ankamagames.berilia.interfaces.IGridRenderer; + import com.ankamagames.jerakine.logger.Logger; + import com.ankamagames.berilia.components.Grid; + import flash.geom.ColorTransform; + import com.ankamagames.jerakine.types.Uri; + import flash.utils.Dictionary; + import flash.display.DisplayObject; + import com.ankamagames.berilia.types.data.TreeData; + import flash.display.Sprite; + import com.ankamagames.berilia.components.Texture; + import com.ankamagames.berilia.components.Label; + import flash.events.MouseEvent; + import com.ankamagames.jerakine.messages.Message; + import com.ankamagames.berilia.UIComponent; + import flash.display.Shape; + import flash.geom.Transform; + import com.ankamagames.jerakine.interfaces.IInterfaceListener; + import com.ankamagames.berilia.components.Tree; + import com.ankamagames.berilia.Berilia; + import com.ankamagames.jerakine.logger.Log; + import flash.utils.getQualifiedClassName; + + public class TreeGridRenderer extends Object implements IGridRenderer + { + + public function TreeGridRenderer(param1:String) + { + var _loc2_:Array = null; + this._log = Log.getLogger(getQualifiedClassName(TreeGridRenderer)); + this._shapeIndex = new Dictionary(true); + this._indexRef = new Dictionary(true); + this._uriRef = new Array(); + super(); + if(param1) + { + _loc2_ = param1.length?param1.split(","):null; + if((_loc2_[0]) && (_loc2_[0].length)) { - params = ((strParams.length) ? strParams.split(",") : null); - if (((params[0]) && (params[0].length))) - { - this._cssUri = new Uri(params[0]); - }; - if (((params[1]) && (params[1].length))) - { - this._bgColor1 = new ColorTransform(); - this._bgColor1.color = parseInt(params[1], 16); - }; - if (((params[2]) && (params[2].length))) - { - this._bgColor2 = new ColorTransform(); - this._bgColor2.color = parseInt(params[2], 16); - }; - if (((params[3]) && (params[3].length))) - { - this._overColor = new ColorTransform(); - this._overColor.color = parseInt(params[3], 16); - }; - if (((params[4]) && (params[4].length))) - { - this._selectedColor = new ColorTransform(); - this._selectedColor.color = parseInt(params[4], 16); - }; - if (((params[5]) && (params[5].length))) - { - this._expendBtnUri = new Uri(params[5]); - }; - if (((params[6]) && (params[6].length))) - { - this._simpleItemUri = new Uri(params[6]); - }; - if (((params[7]) && (params[7].length))) - { - this._endItemUri = new Uri(params[7]); - }; - }; - } - - public function set grid(g:Grid):void - { - this._grid = g; - } - - public function render(data:*, index:uint, selected:Boolean, subIndex:uint=0):DisplayObject - { - var treeData:TreeData; - var raw:Sprite = new Sprite(); - raw.mouseEnabled = false; - this._indexRef[raw] = data; - treeData = data; - var texture:Texture = new Texture(); - texture.mouseEnabled = true; - texture.width = 10; - texture.height = (this._grid.slotHeight + 1); - texture.y = ((this._grid.slotHeight - 18) / 2); - if (treeData) + this._cssUri = new Uri(_loc2_[0]); + } + if((_loc2_[1]) && (_loc2_[1].length)) { - texture.x = (treeData.depth * texture.width); - if (((treeData.children) && (treeData.children.length))) - { - texture.uri = this._expendBtnUri; - texture.buttonMode = true; - } - else - { - if (treeData.parent.children.indexOf(treeData) == (treeData.parent.children.length - 1)) - { - texture.uri = this._endItemUri; - } - else - { - texture.uri = this._simpleItemUri; - }; - }; - if (treeData.expend) - { - texture.gotoAndStop = "selected"; - } - else - { - texture.gotoAndStop = "normal"; - }; - }; - texture.finalize(); - var label:Label = new Label(); - label.mouseEnabled = true; - label.useHandCursor = true; - label.x = ((texture.x + texture.width) + 3); - label.width = (this._grid.slotWidth - label.x); - label.height = this._grid.slotHeight; - if (((data) && (data.value.hasOwnProperty("css")))) + this._bgColor1 = new ColorTransform(); + this._bgColor1.color = parseInt(_loc2_[1],16); + } + if((_loc2_[2]) && (_loc2_[2].length)) { - if ((data.css is String)) - { - if (!(this._uriRef[data.value.css])) - { - this._uriRef[data.value.css] = new Uri(data.value.css); - }; - label.css = this._uriRef[data.value.css]; - } - else - { - label.css = data.value.css; - }; - if (data.value.hasOwnProperty("cssClass")) - { - label.cssClass = data.value.cssClass; - }; - }; - if ((((data is String)) || ((data == null)))) + this._bgColor2 = new ColorTransform(); + this._bgColor2.color = parseInt(_loc2_[2],16); + } + if((_loc2_[3]) && (_loc2_[3].length)) { - label.text = data; + this._overColor = new ColorTransform(); + this._overColor.color = parseInt(_loc2_[3],16); } - else + if((_loc2_[4]) && (_loc2_[4].length)) { - label.text = data.label; - }; - if (this._cssUri) + this._selectedColor = new ColorTransform(); + this._selectedColor.color = parseInt(_loc2_[4],16); + } + if((_loc2_[5]) && (_loc2_[5].length)) { - label.css = this._cssUri; - }; - this.updateBackground(raw, index, selected); - label.addEventListener(MouseEvent.MOUSE_OVER, this.onRollOver); - label.addEventListener(MouseEvent.MOUSE_OUT, this.onRollOut); - texture.addEventListener(MouseEvent.CLICK, this.onRelease); - label.finalize(); - raw.addChild(texture); - raw.addChild(label); - return (raw); - } - - public function getDataLength(data:*, selected:Boolean):uint - { - return (1); - } - - public function update(data:*, index:uint, dispObj:DisplayObject, selected:Boolean, subIndex:uint=0):void - { - var treeData:TreeData; - var texture:Texture; - var label:Label; - if ((dispObj is Sprite)) + this._expendBtnUri = new Uri(_loc2_[5]); + } + if((_loc2_[6]) && (_loc2_[6].length)) { - treeData = data; - this._indexRef[dispObj] = treeData; - texture = (Sprite(dispObj).getChildAt(1) as Texture); - label = (Sprite(dispObj).getChildAt(2) as Label); - if (treeData != null) - { - texture.x = ((treeData.depth * 10) + 3); - if (((treeData.children) && (treeData.children.length))) - { - texture.uri = this._expendBtnUri; - if (treeData.expend) - { - texture.gotoAndStop = "selected"; - } - else - { - texture.gotoAndStop = "normal"; - }; - } - else - { - if (treeData.parent.children.indexOf(treeData) == (treeData.parent.children.length - 1)) - { - texture.uri = this._endItemUri; - } - else - { - texture.uri = this._simpleItemUri; - }; - }; - label.x = ((texture.x + texture.width) + 3); - label.width = (this._grid.slotWidth - label.x); - label.css = this._cssUri; - label.cssClass = ""; - if (((data) && (data.value.hasOwnProperty("css")))) - { - if ((data.value.css is String)) - { - if (!(this._uriRef[data.value.css])) - { - this._uriRef[data.value.css] = new Uri(data.value.css); - }; - label.css = this._uriRef[data.value.css]; - } - else - { - label.css = data.value.css; - }; - if (data.value.hasOwnProperty("cssClass")) - { - label.cssClass = data.value.cssClass; - }; - }; - label.text = treeData.label; - label.finalize(); - } - else - { - label.text = ""; - texture.uri = null; - }; - this.updateBackground((dispObj as Sprite), index, selected); + this._simpleItemUri = new Uri(_loc2_[6]); + } + if((_loc2_[7]) && (_loc2_[7].length)) + { + this._endItemUri = new Uri(_loc2_[7]); + } + } + } + + protected var _log:Logger; + + private var _grid:Grid; + + private var _bgColor1:ColorTransform; + + private var _bgColor2:ColorTransform; + + private var _selectedColor:ColorTransform; + + private var _overColor:ColorTransform; + + private var _cssUri:Uri; + + private var _expendBtnUri:Uri; + + private var _simpleItemUri:Uri; + + private var _endItemUri:Uri; + + private var _shapeIndex:Dictionary; + + private var _indexRef:Dictionary; + + private var _uriRef:Array; + + public function set grid(param1:Grid) : void + { + this._grid = param1; + } + + public function render(param1:*, param2:uint, param3:Boolean, param4:uint = 0) : DisplayObject + { + var _loc6_:TreeData = null; + var _loc5_:Sprite = new Sprite(); + _loc5_.mouseEnabled = false; + this._indexRef[_loc5_] = param1; + _loc6_ = param1; + var _loc7_:Texture = new Texture(); + _loc7_.mouseEnabled = true; + _loc7_.width = 10; + _loc7_.height = this._grid.slotHeight + 1; + _loc7_.y = (this._grid.slotHeight - 18) / 2; + if(_loc6_) + { + _loc7_.x = _loc6_.depth * _loc7_.width; + if((_loc6_.children) && (_loc6_.children.length)) + { + _loc7_.uri = this._expendBtnUri; + _loc7_.buttonMode = true; + } + else if(_loc6_.parent.children.indexOf(_loc6_) == _loc6_.parent.children.length - 1) + { + _loc7_.uri = this._endItemUri; } else { - this._log.warn((("Can't update, " + dispObj.name) + " is not a Sprite")); - }; - } - - public function remove(dispObj:DisplayObject):void - { - var label:Label; - this._indexRef[dispObj] = null; - if ((dispObj is Label)) + _loc7_.uri = this._simpleItemUri; + } + + if(_loc6_.expend) { - label = (dispObj as Label); - if (label.parent) - { - label.parent.removeChild(dispObj); - }; - label.removeEventListener(MouseEvent.MOUSE_OUT, this.onRollOut); - label.removeEventListener(MouseEvent.MOUSE_OVER, this.onRollOver); - }; - } - - public function destroy():void - { - this._grid = null; - this._shapeIndex = null; - } - - public function renderModificator(childs:Array):Array - { - return (childs); - } - - public function eventModificator(msg:Message, functionName:String, args:Array, target:UIComponent):String - { - return (functionName); - } - - private function updateBackground(raw:Sprite, index:uint, selected:Boolean):void - { - var shape:Shape; - if (!(this._shapeIndex[raw])) + _loc7_.gotoAndStop = "selected"; + } + else { - shape = new Shape(); - shape.graphics.beginFill(0xFFFFFF); - shape.graphics.drawRect(0, 0, this._grid.slotWidth, (this._grid.slotHeight + 1)); - raw.addChildAt(shape, 0); - this._shapeIndex[raw] = { - "trans":new Transform(shape), - "shape":shape - }; - }; - var t:ColorTransform = (((index % 2)) ? this._bgColor1 : this._bgColor2); - if (((selected) && (this._selectedColor))) + _loc7_.gotoAndStop = "normal"; + } + } + _loc7_.finalize(); + var _loc8_:Label = new Label(); + _loc8_.mouseEnabled = true; + _loc8_.useHandCursor = true; + _loc8_.x = _loc7_.x + _loc7_.width + 3; + _loc8_.width = this._grid.slotWidth - _loc8_.x; + _loc8_.height = this._grid.slotHeight; + if((param1) && (param1.value.hasOwnProperty("css"))) + { + if(param1.css is String) { - t = this._selectedColor; - }; - this._shapeIndex[raw].currentColor = t; - DisplayObject(this._shapeIndex[raw].shape).visible = !((t == null)); - if (t) + if(!this._uriRef[param1.value.css]) + { + this._uriRef[param1.value.css] = new Uri(param1.value.css); + } + _loc8_.css = this._uriRef[param1.value.css]; + } + else { - Transform(this._shapeIndex[raw].trans).colorTransform = t; - }; - } - - private function onRollOver(e:MouseEvent):void - { - var raw:Sprite; - if ((((e.target.name.indexOf("extension") == -1)) && (e.target.text.length))) + _loc8_.css = param1.value.css; + } + if(param1.value.hasOwnProperty("cssClass")) { - raw = (e.target.parent as Sprite); - if (this._overColor) - { - Transform(this._shapeIndex[raw].trans).colorTransform = this._overColor; - DisplayObject(this._shapeIndex[raw].shape).visible = true; - }; - }; - } - - private function onRollOut(e:MouseEvent):void - { - var raw:Sprite; - if (e.target.name.indexOf("extension") == -1) + _loc8_.cssClass = param1.value.cssClass; + } + } + if(param1 is String || param1 == null) + { + _loc8_.text = param1; + } + else + { + _loc8_.text = param1.label; + } + if(this._cssUri) + { + _loc8_.css = this._cssUri; + } + this.updateBackground(_loc5_,param2,param3); + _loc8_.addEventListener(MouseEvent.MOUSE_OVER,this.onRollOver); + _loc8_.addEventListener(MouseEvent.MOUSE_OUT,this.onRollOut); + _loc7_.addEventListener(MouseEvent.CLICK,this.onRelease); + _loc8_.finalize(); + _loc5_.addChild(_loc7_); + _loc5_.addChild(_loc8_); + return _loc5_; + } + + public function getDataLength(param1:*, param2:Boolean) : uint + { + return 1; + } + + public function update(param1:*, param2:uint, param3:DisplayObject, param4:Boolean, param5:uint = 0) : void + { + var _loc6_:TreeData = null; + var _loc7_:Texture = null; + var _loc8_:Label = null; + if(param3 is Sprite) + { + _loc6_ = param1; + this._indexRef[param3] = _loc6_; + _loc7_ = Sprite(param3).getChildAt(1) as Texture; + _loc8_ = Sprite(param3).getChildAt(2) as Label; + if(_loc6_ != null) { - raw = (e.target.parent as Sprite); - if (this._shapeIndex[raw]) - { - if (this._shapeIndex[raw].currentColor) - { - Transform(this._shapeIndex[raw].trans).colorTransform = this._shapeIndex[raw].currentColor; - }; - DisplayObject(this._shapeIndex[raw].shape).visible = !((this._shapeIndex[raw].currentColor == null)); - }; - }; - } - - private function onRelease(e:MouseEvent):void - { - var listener:IInterfaceListener; - var data:TreeData = this._indexRef[e.target.parent]; - data.expend = !(data.expend); - Tree(this._grid).rerender(); - for each (listener in Berilia.getInstance().UISoundListeners) + _loc7_.x = _loc6_.depth * 10 + 3; + if((_loc6_.children) && (_loc6_.children.length)) + { + _loc7_.uri = this._expendBtnUri; + if(_loc6_.expend) + { + _loc7_.gotoAndStop = "selected"; + } + else + { + _loc7_.gotoAndStop = "normal"; + } + } + else if(_loc6_.parent.children.indexOf(_loc6_) == _loc6_.parent.children.length - 1) + { + _loc7_.uri = this._endItemUri; + } + else + { + _loc7_.uri = this._simpleItemUri; + } + + _loc8_.x = _loc7_.x + _loc7_.width + 3; + _loc8_.width = this._grid.slotWidth - _loc8_.x; + _loc8_.css = this._cssUri; + _loc8_.cssClass = ""; + if((param1) && (param1.value.hasOwnProperty("css"))) + { + if(param1.value.css is String) + { + if(!this._uriRef[param1.value.css]) + { + this._uriRef[param1.value.css] = new Uri(param1.value.css); + } + _loc8_.css = this._uriRef[param1.value.css]; + } + else + { + _loc8_.css = param1.value.css; + } + if(param1.value.hasOwnProperty("cssClass")) + { + _loc8_.cssClass = param1.value.cssClass; + } + } + _loc8_.text = _loc6_.label; + _loc8_.finalize(); + } + else + { + _loc8_.text = ""; + _loc7_.uri = null; + } + this.updateBackground(param3 as Sprite,param2,param4); + } + else + { + this._log.warn("Can\'t update, " + param3.name + " is not a Sprite"); + } + } + + public function remove(param1:DisplayObject) : void + { + var _loc2_:Label = null; + this._indexRef[param1] = null; + if(param1 is Label) + { + _loc2_ = param1 as Label; + if(_loc2_.parent) { - listener.playUISound("16004"); + _loc2_.parent.removeChild(param1); + } + _loc2_.removeEventListener(MouseEvent.MOUSE_OUT,this.onRollOut); + _loc2_.removeEventListener(MouseEvent.MOUSE_OVER,this.onRollOver); + } + } + + public function destroy() : void + { + this._grid = null; + this._shapeIndex = null; + } + + public function renderModificator(param1:Array) : Array + { + return param1; + } + + public function eventModificator(param1:Message, param2:String, param3:Array, param4:UIComponent) : String + { + return param2; + } + + private function updateBackground(param1:Sprite, param2:uint, param3:Boolean) : void + { + var _loc5_:Shape = null; + if(!this._shapeIndex[param1]) + { + _loc5_ = new Shape(); + _loc5_.graphics.beginFill(16777215); + _loc5_.graphics.drawRect(0,0,this._grid.slotWidth,this._grid.slotHeight + 1); + param1.addChildAt(_loc5_,0); + this._shapeIndex[param1] = { + "trans":new Transform(_loc5_), + "shape":_loc5_ }; - } - - - } -}//package com.ankamagames.berilia.components.gridRenderer - + } + var _loc4_:ColorTransform = param2 % 2?this._bgColor1:this._bgColor2; + if((param3) && (this._selectedColor)) + { + _loc4_ = this._selectedColor; + } + this._shapeIndex[param1].currentColor = _loc4_; + DisplayObject(this._shapeIndex[param1].shape).visible = !(_loc4_ == null); + if(_loc4_) + { + Transform(this._shapeIndex[param1].trans).colorTransform = _loc4_; + } + } + + private function onRollOver(param1:MouseEvent) : void + { + var _loc2_:Sprite = null; + if(param1.target.name.indexOf("extension") == -1 && (param1.target.text.length)) + { + _loc2_ = param1.target.parent as Sprite; + if(this._overColor) + { + Transform(this._shapeIndex[_loc2_].trans).colorTransform = this._overColor; + DisplayObject(this._shapeIndex[_loc2_].shape).visible = true; + } + } + } + + private function onRollOut(param1:MouseEvent) : void + { + var _loc2_:Sprite = null; + if(param1.target.name.indexOf("extension") == -1) + { + _loc2_ = param1.target.parent as Sprite; + if(this._shapeIndex[_loc2_]) + { + if(this._shapeIndex[_loc2_].currentColor) + { + Transform(this._shapeIndex[_loc2_].trans).colorTransform = this._shapeIndex[_loc2_].currentColor; + } + DisplayObject(this._shapeIndex[_loc2_].shape).visible = !(this._shapeIndex[_loc2_].currentColor == null); + } + } + } + + private function onRelease(param1:MouseEvent) : void + { + var _loc3_:IInterfaceListener = null; + var _loc2_:TreeData = this._indexRef[param1.target.parent]; + _loc2_.expend = !_loc2_.expend; + Tree(this._grid).rerender(); + for each(_loc3_ in Berilia.getInstance().UISoundListeners) + { + _loc3_.playUISound("16004"); + } + } + } +} diff --git a/com/ankamagames/berilia/components/gridRenderer/XmlUiGridRenderer.as b/com/ankamagames/berilia/components/gridRenderer/XmlUiGridRenderer.as index 839e7223f..521440d8f 100644 --- a/com/ankamagames/berilia/components/gridRenderer/XmlUiGridRenderer.as +++ b/com/ankamagames/berilia/components/gridRenderer/XmlUiGridRenderer.as @@ -1,224 +1,236 @@ -package com.ankamagames.berilia.components.gridRenderer +package com.ankamagames.berilia.components.gridRenderer { - import com.ankamagames.berilia.interfaces.IGridRenderer; - import com.ankamagames.jerakine.logger.Logger; - import flash.display.Sprite; - import com.ankamagames.berilia.Berilia; - import com.ankamagames.berilia.types.graphic.UiRootContainer; - import com.ankamagames.berilia.components.Grid; - import flash.geom.ColorTransform; - import flash.utils.Dictionary; - import com.ankamagames.jerakine.logger.Log; - import flash.utils.getQualifiedClassName; - import com.ankamagames.berilia.managers.UiModuleManager; - import com.ankamagames.berilia.types.data.UiModule; - import com.ankamagames.berilia.utils.errors.BeriliaError; - import com.ankamagames.jerakine.utils.display.StageShareManager; - import com.ankamagames.berilia.types.event.UiRenderEvent; - import com.ankamagames.berilia.components.params.GridScriptProperties; - import flash.display.DisplayObject; - import com.ankamagames.berilia.managers.SecureCenter; - import com.ankamagames.jerakine.messages.Message; - import com.ankamagames.berilia.UIComponent; - import flash.display.Shape; - import flash.geom.Transform; - - [RendererArgs(eventLineColor="uint", oddLineColor="uint")] - public class XmlUiGridRenderer implements IGridRenderer - { - - protected var _log:Logger; - private var _sUiName:String; - private var _sUiModule:String; - private var _ctr:Sprite; - private var _berilia:Berilia; - private var _uiCtr:UiRootContainer; - private var _grid:Grid; - private var _bgColor1:ColorTransform; - private var _bgColor2:ColorTransform; - private var _shapeIndex:Dictionary; - private var _dWaitingUpdate:Dictionary; - - public function XmlUiGridRenderer(args:String) - { - var tmp:Array; - this._log = Log.getLogger(getQualifiedClassName(XmlUiGridRenderer)); - this._berilia = Berilia.getInstance(); - this._shapeIndex = new Dictionary(true); - this._dWaitingUpdate = new Dictionary(true); - super(); - var params:Array = args.split(","); - var uiName:String = params[0]; - if (params[1]) - { - this._bgColor1 = new ColorTransform(); - this._bgColor1.color = parseInt(params[1], 16); - }; - if (params[2]) + import com.ankamagames.berilia.interfaces.IGridRenderer; + import com.ankamagames.jerakine.logger.Logger; + import flash.display.Sprite; + import com.ankamagames.berilia.Berilia; + import com.ankamagames.berilia.types.graphic.UiRootContainer; + import com.ankamagames.berilia.components.Grid; + import flash.geom.ColorTransform; + import flash.utils.Dictionary; + import flash.display.DisplayObject; + import com.ankamagames.jerakine.utils.display.StageShareManager; + import com.ankamagames.berilia.types.event.UiRenderEvent; + import com.ankamagames.berilia.utils.errors.BeriliaError; + import com.ankamagames.berilia.components.params.GridScriptProperties; + import com.ankamagames.berilia.managers.SecureCenter; + import com.ankamagames.jerakine.messages.Message; + import com.ankamagames.berilia.UIComponent; + import flash.display.Shape; + import flash.geom.Transform; + import com.ankamagames.jerakine.logger.Log; + import flash.utils.getQualifiedClassName; + import com.ankamagames.berilia.managers.UiModuleManager; + import com.ankamagames.berilia.types.data.UiModule; + + public class XmlUiGridRenderer extends Object implements IGridRenderer + { + + public function XmlUiGridRenderer(param1:String) + { + var _loc4_:Array = null; + this._log = Log.getLogger(getQualifiedClassName(XmlUiGridRenderer)); + this._berilia = Berilia.getInstance(); + this._shapeIndex = new Dictionary(true); + this._dWaitingUpdate = new Dictionary(true); + super(); + var _loc2_:Array = param1.split(","); + var _loc3_:String = _loc2_[0]; + if(_loc2_[1]) + { + this._bgColor1 = new ColorTransform(); + this._bgColor1.color = parseInt(_loc2_[1],16); + } + if(_loc2_[2]) + { + this._bgColor2 = new ColorTransform(); + this._bgColor2.color = parseInt(_loc2_[2],16); + } + if(_loc3_.indexOf("::") != -1) + { + _loc4_ = _loc3_.split("::"); + if(UiModuleManager.getInstance().getModules()[_loc4_[0]]) { - this._bgColor2 = new ColorTransform(); - this._bgColor2.color = parseInt(params[2], 16); - }; - if (uiName.indexOf("::") != -1) - { - tmp = uiName.split("::"); - if (UiModuleManager.getInstance().getModules()[tmp[0]]) - { - this._sUiModule = tmp[0]; - if (UiModule(UiModuleManager.getInstance().getModules()[tmp[0]]).uis[tmp[1]]) - { - this._sUiName = tmp[1]; - } - else - { - throw (new BeriliaError((((((("Ui [" + tmp[1]) + "] does not exit in module [") + tmp[0]) + "] (grid parameter name [") + uiName) + "])"))); - }; - } - else - { - throw (new BeriliaError((((("Module [" + tmp[0]) + "] does not exit (grid parameter name [") + uiName) + "])"))); - }; + this._sUiModule = _loc4_[0]; + if(UiModule(UiModuleManager.getInstance().getModules()[_loc4_[0]]).uis[_loc4_[1]]) + { + this._sUiName = _loc4_[1]; + } + else + { + throw new BeriliaError("Ui [" + _loc4_[1] + "] does not exit in module [" + _loc4_[0] + "] (grid parameter name [" + _loc3_ + "])"); + } } else { - this._sUiName = uiName; - }; - } - - public function set grid(g:Grid):void - { - this._grid = g; - } - - public function render(data:*, index:uint, selected:Boolean, subIndex:uint=0):DisplayObject - { - var mainUi:UiRootContainer = this._grid.getUi(); - this._uiCtr = new UiRootContainer(StageShareManager.stage, mainUi.uiModule.uis[this._sUiName], this._ctr); - this._uiCtr.uiModule = mainUi.uiModule; - this._uiCtr.addEventListener(UiRenderEvent.UIRenderComplete, this.onItemUiLoaded); - this._uiCtr.mouseEnabled = true; - if (!(mainUi.uiModule.uis[this._sUiName])) - { - throw (new BeriliaError((((((("Ui [" + this._sUiName) + "] does not exit in module [") + this._uiCtr.uiModule.id) + "] (grid parameter name [") + this._sUiName) + "])"))); - }; - this.updateBackground(this._uiCtr, index); - this._berilia.loadUiInside(mainUi.uiModule.uis[this._sUiName], this._uiCtr.name, this._uiCtr, new GridScriptProperties(data, selected, this._grid)); - return (this._uiCtr); - } - - public function update(data:*, index:uint, dispObj:DisplayObject, selected:Boolean, subIndex:uint=0):void - { - if ((dispObj is UiRootContainer)) + throw new BeriliaError("Module [" + _loc4_[0] + "] does not exit (grid parameter name [" + _loc3_ + "])"); + } + } + else + { + this._sUiName = _loc3_; + } + } + + protected var _log:Logger; + + private var _sUiName:String; + + private var _sUiModule:String; + + private var _ctr:Sprite; + + private var _berilia:Berilia; + + private var _uiCtr:UiRootContainer; + + private var _grid:Grid; + + private var _bgColor1:ColorTransform; + + private var _bgColor2:ColorTransform; + + private var _shapeIndex:Dictionary; + + private var _dWaitingUpdate:Dictionary; + + public function set grid(param1:Grid) : void + { + this._grid = param1; + } + + public function render(param1:*, param2:uint, param3:Boolean, param4:uint = 0) : DisplayObject + { + var _loc5_:UiRootContainer = this._grid.getUi(); + this._uiCtr = new UiRootContainer(StageShareManager.stage,_loc5_.uiModule.uis[this._sUiName],this._ctr); + this._uiCtr.uiModule = _loc5_.uiModule; + this._uiCtr.addEventListener(UiRenderEvent.UIRenderComplete,this.onItemUiLoaded); + this._uiCtr.mouseEnabled = true; + if(!_loc5_.uiModule.uis[this._sUiName]) + { + throw new BeriliaError("Ui [" + this._sUiName + "] does not exit in module [" + this._uiCtr.uiModule.id + "] (grid parameter name [" + this._sUiName + "])"); + } + else + { + this.updateBackground(this._uiCtr,param2); + this._berilia.loadUiInside(_loc5_.uiModule.uis[this._sUiName],this._uiCtr.name,this._uiCtr,new GridScriptProperties(param1,param3,this._grid)); + return this._uiCtr; + } + } + + public function update(param1:*, param2:uint, param3:DisplayObject, param4:Boolean, param5:uint = 0) : void + { + if(param3 is UiRootContainer) + { + if((UiRootContainer(param3).ready) && (Object(UiRootContainer(param3).uiClass))) { - if (((UiRootContainer(dispObj).ready) && (Object(UiRootContainer(dispObj).uiClass)))) - { - if (((!((Object(UiRootContainer(dispObj).uiClass).data == null))) || (!((data == null))))) - { - this.updateBackground(UiRootContainer(dispObj), index); - Object(UiRootContainer(dispObj).uiClass).update(SecureCenter.secure(data), selected); - }; - } - else - { - this._dWaitingUpdate[dispObj] = new WaitingUpdate(data, index, dispObj, selected, true); - }; + if(!(Object(UiRootContainer(param3).uiClass).data == null) || !(param1 == null)) + { + this.updateBackground(UiRootContainer(param3),param2); + Object(UiRootContainer(param3).uiClass).update(SecureCenter.secure(param1),param4); + } } else { - this._log.warn((("Can't update, " + dispObj.name) + " is not a SecureUi")); - }; - } - - public function getDataLength(data:*, selected:Boolean):uint - { - return (1); - } - - public function remove(dispObj:DisplayObject):void - { - if ((dispObj is UiRootContainer)) - { - Berilia.getInstance().unloadUi(UiRootContainer(dispObj).name); - }; - } - - public function destroy():void - { - this._berilia = null; - this._uiCtr = null; - this._grid = null; - } - - public function renderModificator(childs:Array):Array - { - return (childs); - } - - public function eventModificator(msg:Message, functionName:String, args:Array, target:UIComponent):String - { - return (functionName); - } - - private function onItemUiLoaded(e:UiRenderEvent):void - { - var data:WaitingUpdate; - if (this._dWaitingUpdate[e.uiTarget]) + this._dWaitingUpdate[param3] = new WaitingUpdate(param1,param2,param3,param4,true); + } + } + else + { + this._log.warn("Can\'t update, " + param3.name + " is not a SecureUi"); + } + } + + public function getDataLength(param1:*, param2:Boolean) : uint + { + return 1; + } + + public function remove(param1:DisplayObject) : void + { + if(param1 is UiRootContainer) + { + Berilia.getInstance().unloadUi(UiRootContainer(param1).name); + } + } + + public function destroy() : void + { + this._berilia = null; + this._uiCtr = null; + this._grid = null; + } + + public function renderModificator(param1:Array) : Array + { + return param1; + } + + public function eventModificator(param1:Message, param2:String, param3:Array, param4:UIComponent) : String + { + return param2; + } + + private function onItemUiLoaded(param1:UiRenderEvent) : void + { + var _loc2_:WaitingUpdate = null; + if(this._dWaitingUpdate[param1.uiTarget]) + { + _loc2_ = this._dWaitingUpdate[param1.uiTarget]; + this.update(_loc2_.data,_loc2_.index,_loc2_.dispObj,_loc2_.selected); + this._dWaitingUpdate[param1.uiTarget] = null; + } + } + + private function updateBackground(param1:UiRootContainer, param2:uint) : void + { + var _loc3_:ColorTransform = null; + var _loc4_:Shape = null; + if((this._bgColor1) || (this._bgColor2)) + { + if(!this._shapeIndex[param1]) { - data = this._dWaitingUpdate[e.uiTarget]; - this.update(data.data, data.index, data.dispObj, data.selected); - this._dWaitingUpdate[e.uiTarget] = null; - }; - } - - private function updateBackground(uiContainer:UiRootContainer, index:uint):void - { - var t:ColorTransform; - var shape:Shape; - if (((this._bgColor1) || (this._bgColor2))) + _loc4_ = new Shape(); + _loc4_.graphics.beginFill(16777215); + _loc4_.graphics.drawRect(0,0,this._grid.slotWidth,this._grid.slotHeight); + this._uiCtr.getStrata(0).addChild(_loc4_); + this._shapeIndex[param1] = { + "trans":new Transform(_loc4_), + "shape":_loc4_ + }; + } + _loc3_ = param2 % 2?this._bgColor1:this._bgColor2; + DisplayObject(this._shapeIndex[param1].shape).visible = !(_loc3_ == null); + if(_loc3_) { - if (!(this._shapeIndex[uiContainer])) - { - shape = new Shape(); - shape.graphics.beginFill(0xFFFFFF); - shape.graphics.drawRect(0, 0, this._grid.slotWidth, this._grid.slotHeight); - this._uiCtr.getStrata(0).addChild(shape); - this._shapeIndex[uiContainer] = { - "trans":new Transform(shape), - "shape":shape - }; - }; - t = (((index % 2)) ? this._bgColor1 : this._bgColor2); - DisplayObject(this._shapeIndex[uiContainer].shape).visible = !((t == null)); - if (t) - { - Transform(this._shapeIndex[uiContainer].trans).colorTransform = t; - }; - }; - } - - - } -}//package com.ankamagames.berilia.components.gridRenderer - + Transform(this._shapeIndex[param1].trans).colorTransform = _loc3_; + } + } + } + } +} import flash.display.DisplayObject; -class WaitingUpdate +class WaitingUpdate extends Object { - - public var data; - public var index; - public var selected:Boolean; - public var drawBackground:Boolean; - public var dispObj:DisplayObject; - - public function WaitingUpdate(data:*, index:uint, dispObj:DisplayObject, selected:Boolean, drawBackground:Boolean) - { - this.data = data; - this.selected = selected; - this.drawBackground = drawBackground; - this.dispObj = dispObj; - this.index = index; - } - + + function WaitingUpdate(param1:*, param2:uint, param3:DisplayObject, param4:Boolean, param5:Boolean) + { + super(); + this.data = param1; + this.selected = param4; + this.drawBackground = param5; + this.dispObj = param3; + this.index = param2; + } + + public var data; + + public var index; + + public var selected:Boolean; + + public var drawBackground:Boolean; + + public var dispObj:DisplayObject; } - diff --git a/com/ankamagames/berilia/components/messages/BrowserDomReady.as b/com/ankamagames/berilia/components/messages/BrowserDomReady.as index 108e402d1..4556e2eed 100644 --- a/com/ankamagames/berilia/components/messages/BrowserDomReady.as +++ b/com/ankamagames/berilia/components/messages/BrowserDomReady.as @@ -1,15 +1,13 @@ -package com.ankamagames.berilia.components.messages +package com.ankamagames.berilia.components.messages { - import flash.display.InteractiveObject; - - public class BrowserDomReady extends ComponentMessage - { - - public function BrowserDomReady(target:InteractiveObject) - { - super(target); - } - - } -}//package com.ankamagames.berilia.components.messages - + import flash.display.InteractiveObject; + + public class BrowserDomReady extends ComponentMessage + { + + public function BrowserDomReady(param1:InteractiveObject) + { + super(param1); + } + } +} diff --git a/com/ankamagames/berilia/components/messages/BrowserSessionTimeout.as b/com/ankamagames/berilia/components/messages/BrowserSessionTimeout.as index bb1158529..a6da0dd9e 100644 --- a/com/ankamagames/berilia/components/messages/BrowserSessionTimeout.as +++ b/com/ankamagames/berilia/components/messages/BrowserSessionTimeout.as @@ -1,15 +1,13 @@ -package com.ankamagames.berilia.components.messages +package com.ankamagames.berilia.components.messages { - import flash.display.InteractiveObject; - - public class BrowserSessionTimeout extends ComponentMessage - { - - public function BrowserSessionTimeout(target:InteractiveObject) - { - super(target); - } - - } -}//package com.ankamagames.berilia.components.messages - + import flash.display.InteractiveObject; + + public class BrowserSessionTimeout extends ComponentMessage + { + + public function BrowserSessionTimeout(param1:InteractiveObject) + { + super(param1); + } + } +} diff --git a/com/ankamagames/berilia/components/messages/ChangeMessage.as b/com/ankamagames/berilia/components/messages/ChangeMessage.as index a13808295..9e7dc4381 100644 --- a/com/ankamagames/berilia/components/messages/ChangeMessage.as +++ b/com/ankamagames/berilia/components/messages/ChangeMessage.as @@ -1,15 +1,13 @@ -package com.ankamagames.berilia.components.messages +package com.ankamagames.berilia.components.messages { - import flash.display.InteractiveObject; - - public class ChangeMessage extends ComponentMessage - { - - public function ChangeMessage(target:InteractiveObject) - { - super(target); - } - - } -}//package com.ankamagames.berilia.components.messages - + import flash.display.InteractiveObject; + + public class ChangeMessage extends ComponentMessage + { + + public function ChangeMessage(param1:InteractiveObject) + { + super(param1); + } + } +} diff --git a/com/ankamagames/berilia/components/messages/ColorChangeMessage.as b/com/ankamagames/berilia/components/messages/ColorChangeMessage.as index f636b8f4b..47beccf09 100644 --- a/com/ankamagames/berilia/components/messages/ColorChangeMessage.as +++ b/com/ankamagames/berilia/components/messages/ColorChangeMessage.as @@ -1,15 +1,13 @@ -package com.ankamagames.berilia.components.messages +package com.ankamagames.berilia.components.messages { - import flash.display.InteractiveObject; - - public class ColorChangeMessage extends ComponentMessage - { - - public function ColorChangeMessage(target:InteractiveObject) - { - super(target); - } - - } -}//package com.ankamagames.berilia.components.messages - + import flash.display.InteractiveObject; + + public class ColorChangeMessage extends ComponentMessage + { + + public function ColorChangeMessage(param1:InteractiveObject) + { + super(param1); + } + } +} diff --git a/com/ankamagames/berilia/components/messages/ComponentMessage.as b/com/ankamagames/berilia/components/messages/ComponentMessage.as index f7b4b8cb7..8e045ef38 100644 --- a/com/ankamagames/berilia/components/messages/ComponentMessage.as +++ b/com/ankamagames/berilia/components/messages/ComponentMessage.as @@ -1,67 +1,73 @@ -package com.ankamagames.berilia.components.messages +package com.ankamagames.berilia.components.messages { - import com.ankamagames.jerakine.messages.Message; - import com.ankamagames.jerakine.logger.Logger; - import com.ankamagames.jerakine.logger.Log; - import flash.utils.getQualifiedClassName; - import flash.display.InteractiveObject; - import flash.display.DisplayObject; - import com.ankamagames.jerakine.handlers.messages.InvalidCancelError; - import com.ankamagames.jerakine.handlers.messages.Action; - - public class ComponentMessage implements Message - { - - protected static const _log:Logger = Log.getLogger(getQualifiedClassName(ComponentMessage)); - - protected var _target:InteractiveObject; - private var _canceled:Boolean; - private var _actions:Array; - public var bubbling:Boolean; - - public function ComponentMessage(target:InteractiveObject) - { - this._target = target; - } - - public function get target():DisplayObject - { - return (this._target); - } - - public function get canceled():Boolean - { - return (this._canceled); - } - - public function set canceled(value:Boolean):void - { - if (this.bubbling) - { - throw (new InvalidCancelError("Can't cancel a bubbling message.")); - }; - if (((this._canceled) && (!(value)))) - { - throw (new InvalidCancelError("Can't uncancel a canceled message.")); - }; - this._canceled = value; - } - - public function get actions():Array - { - return (this._actions); - } - - public function addAction(action:Action):void - { - if (this._actions == null) - { - this._actions = new Array(); - }; - this._actions.push(action); - } - - - } -}//package com.ankamagames.berilia.components.messages - + import com.ankamagames.jerakine.messages.Message; + import com.ankamagames.jerakine.logger.Logger; + import com.ankamagames.jerakine.logger.Log; + import flash.utils.getQualifiedClassName; + import flash.display.InteractiveObject; + import flash.display.DisplayObject; + import com.ankamagames.jerakine.handlers.messages.InvalidCancelError; + import com.ankamagames.jerakine.handlers.messages.Action; + + public class ComponentMessage extends Object implements Message + { + + public function ComponentMessage(param1:InteractiveObject) + { + super(); + this._target = param1; + } + + protected static const _log:Logger = Log.getLogger(getQualifiedClassName(ComponentMessage)); + + protected var _target:InteractiveObject; + + private var _canceled:Boolean; + + private var _actions:Array; + + public var bubbling:Boolean; + + public function get target() : DisplayObject + { + return this._target; + } + + public function get canceled() : Boolean + { + return this._canceled; + } + + public function set canceled(param1:Boolean) : void + { + if(this.bubbling) + { + throw new InvalidCancelError("Can\'t cancel a bubbling message."); + } + else if((this._canceled) && !param1) + { + throw new InvalidCancelError("Can\'t uncancel a canceled message."); + } + else + { + this._canceled = param1; + return; + } + + } + + public function get actions() : Array + { + return this._actions; + } + + public function addAction(param1:Action) : void + { + if(this._actions == null) + { + this._actions = new Array(); + } + this._actions.push(param1); + } + } +} diff --git a/com/ankamagames/berilia/components/messages/ComponentReadyMessage.as b/com/ankamagames/berilia/components/messages/ComponentReadyMessage.as index c543a850f..ce17e8c7d 100644 --- a/com/ankamagames/berilia/components/messages/ComponentReadyMessage.as +++ b/com/ankamagames/berilia/components/messages/ComponentReadyMessage.as @@ -1,15 +1,13 @@ -package com.ankamagames.berilia.components.messages +package com.ankamagames.berilia.components.messages { - import flash.display.InteractiveObject; - - public class ComponentReadyMessage extends ComponentMessage - { - - public function ComponentReadyMessage(target:InteractiveObject) - { - super(target); - } - - } -}//package com.ankamagames.berilia.components.messages - + import flash.display.InteractiveObject; + + public class ComponentReadyMessage extends ComponentMessage + { + + public function ComponentReadyMessage(param1:InteractiveObject) + { + super(param1); + } + } +} diff --git a/com/ankamagames/berilia/components/messages/CreateTabMessage.as b/com/ankamagames/berilia/components/messages/CreateTabMessage.as index 547dec464..92e845161 100644 --- a/com/ankamagames/berilia/components/messages/CreateTabMessage.as +++ b/com/ankamagames/berilia/components/messages/CreateTabMessage.as @@ -1,15 +1,13 @@ -package com.ankamagames.berilia.components.messages +package com.ankamagames.berilia.components.messages { - import flash.display.InteractiveObject; - - public class CreateTabMessage extends ComponentMessage - { - - public function CreateTabMessage(target:InteractiveObject) - { - super(target); - } - - } -}//package com.ankamagames.berilia.components.messages - + import flash.display.InteractiveObject; + + public class CreateTabMessage extends ComponentMessage + { + + public function CreateTabMessage(param1:InteractiveObject) + { + super(param1); + } + } +} diff --git a/com/ankamagames/berilia/components/messages/DeleteTabMessage.as b/com/ankamagames/berilia/components/messages/DeleteTabMessage.as index 2482cdb17..af3c866de 100644 --- a/com/ankamagames/berilia/components/messages/DeleteTabMessage.as +++ b/com/ankamagames/berilia/components/messages/DeleteTabMessage.as @@ -1,24 +1,21 @@ -package com.ankamagames.berilia.components.messages +package com.ankamagames.berilia.components.messages { - import flash.display.InteractiveObject; - - public class DeleteTabMessage extends ComponentMessage - { - - private var _deletedIndex:int; - - public function DeleteTabMessage(target:InteractiveObject, deletedIndex:int) - { - super(target); - this._deletedIndex = deletedIndex; - } - - public function get deletedIndex():int - { - return (this._deletedIndex); - } - - - } -}//package com.ankamagames.berilia.components.messages - + import flash.display.InteractiveObject; + + public class DeleteTabMessage extends ComponentMessage + { + + public function DeleteTabMessage(param1:InteractiveObject, param2:int) + { + super(param1); + this._deletedIndex = param2; + } + + private var _deletedIndex:int; + + public function get deletedIndex() : int + { + return this._deletedIndex; + } + } +} diff --git a/com/ankamagames/berilia/components/messages/DropMessage.as b/com/ankamagames/berilia/components/messages/DropMessage.as index f4d3eaf4a..3607f13fd 100644 --- a/com/ankamagames/berilia/components/messages/DropMessage.as +++ b/com/ankamagames/berilia/components/messages/DropMessage.as @@ -1,25 +1,22 @@ -package com.ankamagames.berilia.components.messages +package com.ankamagames.berilia.components.messages { - import com.ankamagames.jerakine.interfaces.ISlotDataHolder; - import flash.display.InteractiveObject; - - public class DropMessage extends ComponentMessage - { - - private var _source:ISlotDataHolder; - - public function DropMessage(target:InteractiveObject, source:ISlotDataHolder) - { - super(target); - this._source = source; - } - - public function get source():ISlotDataHolder - { - return (this._source); - } - - - } -}//package com.ankamagames.berilia.components.messages - + import com.ankamagames.jerakine.interfaces.ISlotDataHolder; + import flash.display.InteractiveObject; + + public class DropMessage extends ComponentMessage + { + + public function DropMessage(param1:InteractiveObject, param2:ISlotDataHolder) + { + super(param1); + this._source = param2; + } + + private var _source:ISlotDataHolder; + + public function get source() : ISlotDataHolder + { + return this._source; + } + } +} diff --git a/com/ankamagames/berilia/components/messages/EntityReadyMessage.as b/com/ankamagames/berilia/components/messages/EntityReadyMessage.as index 7343f038d..5c435f932 100644 --- a/com/ankamagames/berilia/components/messages/EntityReadyMessage.as +++ b/com/ankamagames/berilia/components/messages/EntityReadyMessage.as @@ -1,15 +1,13 @@ -package com.ankamagames.berilia.components.messages +package com.ankamagames.berilia.components.messages { - import flash.display.InteractiveObject; - - public class EntityReadyMessage extends ComponentMessage - { - - public function EntityReadyMessage(target:InteractiveObject) - { - super(target); - } - - } -}//package com.ankamagames.berilia.components.messages - + import flash.display.InteractiveObject; + + public class EntityReadyMessage extends ComponentMessage + { + + public function EntityReadyMessage(param1:InteractiveObject) + { + super(param1); + } + } +} diff --git a/com/ankamagames/berilia/components/messages/ItemRightClickMessage.as b/com/ankamagames/berilia/components/messages/ItemRightClickMessage.as index 5fa0907d6..acaa01ba1 100644 --- a/com/ankamagames/berilia/components/messages/ItemRightClickMessage.as +++ b/com/ankamagames/berilia/components/messages/ItemRightClickMessage.as @@ -1,25 +1,22 @@ -package com.ankamagames.berilia.components.messages +package com.ankamagames.berilia.components.messages { - import com.ankamagames.berilia.types.data.GridItem; - import com.ankamagames.berilia.components.Grid; - - public class ItemRightClickMessage extends ComponentMessage - { - - private var _gridItem:GridItem; - - public function ItemRightClickMessage(grid:Grid, gridItem:GridItem) - { - super(grid); - this._gridItem = gridItem; - } - - public function get item():GridItem - { - return (this._gridItem); - } - - - } -}//package com.ankamagames.berilia.components.messages - + import com.ankamagames.berilia.types.data.GridItem; + import com.ankamagames.berilia.components.Grid; + + public class ItemRightClickMessage extends ComponentMessage + { + + public function ItemRightClickMessage(param1:Grid, param2:GridItem) + { + super(param1); + this._gridItem = param2; + } + + private var _gridItem:GridItem; + + public function get item() : GridItem + { + return this._gridItem; + } + } +} diff --git a/com/ankamagames/berilia/components/messages/ItemRollOutMessage.as b/com/ankamagames/berilia/components/messages/ItemRollOutMessage.as index 9fe7a6a91..a0f8c2263 100644 --- a/com/ankamagames/berilia/components/messages/ItemRollOutMessage.as +++ b/com/ankamagames/berilia/components/messages/ItemRollOutMessage.as @@ -1,25 +1,22 @@ -package com.ankamagames.berilia.components.messages +package com.ankamagames.berilia.components.messages { - import com.ankamagames.berilia.types.data.GridItem; - import com.ankamagames.berilia.types.graphic.GraphicContainer; - - public class ItemRollOutMessage extends ComponentMessage - { - - private var _gridItem:GridItem; - - public function ItemRollOutMessage(target:GraphicContainer, gridItem:GridItem) - { - super(target); - this._gridItem = gridItem; - } - - public function get item():GridItem - { - return (this._gridItem); - } - - - } -}//package com.ankamagames.berilia.components.messages - + import com.ankamagames.berilia.types.data.GridItem; + import com.ankamagames.berilia.types.graphic.GraphicContainer; + + public class ItemRollOutMessage extends ComponentMessage + { + + public function ItemRollOutMessage(param1:GraphicContainer, param2:GridItem) + { + super(param1); + this._gridItem = param2; + } + + private var _gridItem:GridItem; + + public function get item() : GridItem + { + return this._gridItem; + } + } +} diff --git a/com/ankamagames/berilia/components/messages/ItemRollOverMessage.as b/com/ankamagames/berilia/components/messages/ItemRollOverMessage.as index dc8ccbe92..81ebc5e74 100644 --- a/com/ankamagames/berilia/components/messages/ItemRollOverMessage.as +++ b/com/ankamagames/berilia/components/messages/ItemRollOverMessage.as @@ -1,25 +1,22 @@ -package com.ankamagames.berilia.components.messages +package com.ankamagames.berilia.components.messages { - import com.ankamagames.berilia.types.data.GridItem; - import com.ankamagames.berilia.types.graphic.GraphicContainer; - - public class ItemRollOverMessage extends ComponentMessage - { - - private var _gridItem:GridItem; - - public function ItemRollOverMessage(target:GraphicContainer, gridItem:GridItem) - { - super(target); - this._gridItem = gridItem; - } - - public function get item():GridItem - { - return (this._gridItem); - } - - - } -}//package com.ankamagames.berilia.components.messages - + import com.ankamagames.berilia.types.data.GridItem; + import com.ankamagames.berilia.types.graphic.GraphicContainer; + + public class ItemRollOverMessage extends ComponentMessage + { + + public function ItemRollOverMessage(param1:GraphicContainer, param2:GridItem) + { + super(param1); + this._gridItem = param2; + } + + private var _gridItem:GridItem; + + public function get item() : GridItem + { + return this._gridItem; + } + } +} diff --git a/com/ankamagames/berilia/components/messages/MapElementRightClickMessage.as b/com/ankamagames/berilia/components/messages/MapElementRightClickMessage.as index d73ca8433..0ae3f3c2d 100644 --- a/com/ankamagames/berilia/components/messages/MapElementRightClickMessage.as +++ b/com/ankamagames/berilia/components/messages/MapElementRightClickMessage.as @@ -1,26 +1,23 @@ -package com.ankamagames.berilia.components.messages +package com.ankamagames.berilia.components.messages { - import com.ankamagames.berilia.types.data.MapElement; - import com.ankamagames.berilia.types.graphic.GraphicContainer; - - public class MapElementRightClickMessage extends ComponentMessage - { - - private var _targetedElement:MapElement; - - public function MapElementRightClickMessage(target:GraphicContainer, targetedElement:MapElement) - { - super(target); - this._targetedElement = targetedElement; - _target = target; - } - - public function get targetedElement():MapElement - { - return (this._targetedElement); - } - - - } -}//package com.ankamagames.berilia.components.messages - + import com.ankamagames.berilia.types.data.MapElement; + import com.ankamagames.berilia.types.graphic.GraphicContainer; + + public class MapElementRightClickMessage extends ComponentMessage + { + + public function MapElementRightClickMessage(param1:GraphicContainer, param2:MapElement) + { + super(param1); + this._targetedElement = param2; + _target = param1; + } + + private var _targetedElement:MapElement; + + public function get targetedElement() : MapElement + { + return this._targetedElement; + } + } +} diff --git a/com/ankamagames/berilia/components/messages/MapElementRollOutMessage.as b/com/ankamagames/berilia/components/messages/MapElementRollOutMessage.as index f7c164249..904621e24 100644 --- a/com/ankamagames/berilia/components/messages/MapElementRollOutMessage.as +++ b/com/ankamagames/berilia/components/messages/MapElementRollOutMessage.as @@ -1,26 +1,23 @@ -package com.ankamagames.berilia.components.messages +package com.ankamagames.berilia.components.messages { - import com.ankamagames.berilia.types.data.MapElement; - import com.ankamagames.berilia.types.graphic.GraphicContainer; - - public class MapElementRollOutMessage extends ComponentMessage - { - - private var _targetedElement:MapElement; - - public function MapElementRollOutMessage(target:GraphicContainer, targetedElement:MapElement) - { - super(target); - this._targetedElement = targetedElement; - _target = target; - } - - public function get targetedElement():MapElement - { - return (this._targetedElement); - } - - - } -}//package com.ankamagames.berilia.components.messages - + import com.ankamagames.berilia.types.data.MapElement; + import com.ankamagames.berilia.types.graphic.GraphicContainer; + + public class MapElementRollOutMessage extends ComponentMessage + { + + public function MapElementRollOutMessage(param1:GraphicContainer, param2:MapElement) + { + super(param1); + this._targetedElement = param2; + _target = param1; + } + + private var _targetedElement:MapElement; + + public function get targetedElement() : MapElement + { + return this._targetedElement; + } + } +} diff --git a/com/ankamagames/berilia/components/messages/MapElementRollOverMessage.as b/com/ankamagames/berilia/components/messages/MapElementRollOverMessage.as index df5e7eeec..2e0c5c95a 100644 --- a/com/ankamagames/berilia/components/messages/MapElementRollOverMessage.as +++ b/com/ankamagames/berilia/components/messages/MapElementRollOverMessage.as @@ -1,26 +1,23 @@ -package com.ankamagames.berilia.components.messages +package com.ankamagames.berilia.components.messages { - import com.ankamagames.berilia.types.data.MapElement; - import com.ankamagames.berilia.types.graphic.GraphicContainer; - - public class MapElementRollOverMessage extends ComponentMessage - { - - private var _targetedElement:MapElement; - - public function MapElementRollOverMessage(target:GraphicContainer, targetedElement:MapElement) - { - super(target); - this._targetedElement = targetedElement; - _target = target; - } - - public function get targetedElement():MapElement - { - return (this._targetedElement); - } - - - } -}//package com.ankamagames.berilia.components.messages - + import com.ankamagames.berilia.types.data.MapElement; + import com.ankamagames.berilia.types.graphic.GraphicContainer; + + public class MapElementRollOverMessage extends ComponentMessage + { + + public function MapElementRollOverMessage(param1:GraphicContainer, param2:MapElement) + { + super(param1); + this._targetedElement = param2; + _target = param1; + } + + private var _targetedElement:MapElement; + + public function get targetedElement() : MapElement + { + return this._targetedElement; + } + } +} diff --git a/com/ankamagames/berilia/components/messages/MapMoveMessage.as b/com/ankamagames/berilia/components/messages/MapMoveMessage.as index 3fceafdd5..db8eb9848 100644 --- a/com/ankamagames/berilia/components/messages/MapMoveMessage.as +++ b/com/ankamagames/berilia/components/messages/MapMoveMessage.as @@ -1,17 +1,15 @@ -package com.ankamagames.berilia.components.messages +package com.ankamagames.berilia.components.messages { - import com.ankamagames.berilia.components.MapViewer; - - public class MapMoveMessage extends ComponentMessage - { - - private var _map:MapViewer; - - public function MapMoveMessage(map:MapViewer) - { - super(map); - } - - } -}//package com.ankamagames.berilia.components.messages - + import com.ankamagames.berilia.components.MapViewer; + + public class MapMoveMessage extends ComponentMessage + { + + public function MapMoveMessage(param1:MapViewer) + { + super(param1); + } + + private var _map:MapViewer; + } +} diff --git a/com/ankamagames/berilia/components/messages/MapRollOverMessage.as b/com/ankamagames/berilia/components/messages/MapRollOverMessage.as index 5a12234fc..4a1ad7a97 100644 --- a/com/ankamagames/berilia/components/messages/MapRollOverMessage.as +++ b/com/ankamagames/berilia/components/messages/MapRollOverMessage.as @@ -1,31 +1,29 @@ -package com.ankamagames.berilia.components.messages +package com.ankamagames.berilia.components.messages { - import flash.display.InteractiveObject; - - public class MapRollOverMessage extends ComponentMessage - { - - private var _x:int; - private var _y:int; - - public function MapRollOverMessage(target:InteractiveObject, x:int, y:int) - { - super(target); - this._x = x; - this._y = y; - } - - public function get x():int - { - return (this._x); - } - - public function get y():int - { - return (this._y); - } - - - } -}//package com.ankamagames.berilia.components.messages - + import flash.display.InteractiveObject; + + public class MapRollOverMessage extends ComponentMessage + { + + public function MapRollOverMessage(param1:InteractiveObject, param2:int, param3:int) + { + super(param1); + this._x = param2; + this._y = param3; + } + + private var _x:int; + + private var _y:int; + + public function get x() : int + { + return this._x; + } + + public function get y() : int + { + return this._y; + } + } +} diff --git a/com/ankamagames/berilia/components/messages/RenameTabMessage.as b/com/ankamagames/berilia/components/messages/RenameTabMessage.as index 4d6b74624..ffd424679 100644 --- a/com/ankamagames/berilia/components/messages/RenameTabMessage.as +++ b/com/ankamagames/berilia/components/messages/RenameTabMessage.as @@ -1,31 +1,29 @@ -package com.ankamagames.berilia.components.messages +package com.ankamagames.berilia.components.messages { - import flash.display.InteractiveObject; - - public class RenameTabMessage extends ComponentMessage - { - - private var _index:int; - private var _name:String; - - public function RenameTabMessage(target:InteractiveObject, index:int, name:String) - { - super(target); - this._index = index; - this._name = name; - } - - public function get index():int - { - return (this._index); - } - - public function get name():String - { - return (this._name); - } - - - } -}//package com.ankamagames.berilia.components.messages - + import flash.display.InteractiveObject; + + public class RenameTabMessage extends ComponentMessage + { + + public function RenameTabMessage(param1:InteractiveObject, param2:int, param3:String) + { + super(param1); + this._index = param2; + this._name = param3; + } + + private var _index:int; + + private var _name:String; + + public function get index() : int + { + return this._index; + } + + public function get name() : String + { + return this._name; + } + } +} diff --git a/com/ankamagames/berilia/components/messages/SelectEmptyItemMessage.as b/com/ankamagames/berilia/components/messages/SelectEmptyItemMessage.as index 12ca0c5d8..d89423521 100644 --- a/com/ankamagames/berilia/components/messages/SelectEmptyItemMessage.as +++ b/com/ankamagames/berilia/components/messages/SelectEmptyItemMessage.as @@ -1,24 +1,21 @@ -package com.ankamagames.berilia.components.messages +package com.ankamagames.berilia.components.messages { - import flash.display.InteractiveObject; - - public class SelectEmptyItemMessage extends ComponentMessage - { - - private var _method:uint; - - public function SelectEmptyItemMessage(target:InteractiveObject, selectMethod:uint=7) - { - super(target); - this._method = selectMethod; - } - - public function get selectMethod():uint - { - return (this._method); - } - - - } -}//package com.ankamagames.berilia.components.messages - + import flash.display.InteractiveObject; + + public class SelectEmptyItemMessage extends ComponentMessage + { + + public function SelectEmptyItemMessage(param1:InteractiveObject, param2:uint = 7) + { + super(param1); + this._method = param2; + } + + private var _method:uint; + + public function get selectMethod() : uint + { + return this._method; + } + } +} diff --git a/com/ankamagames/berilia/components/messages/SelectItemMessage.as b/com/ankamagames/berilia/components/messages/SelectItemMessage.as index b431f83f4..f8c726423 100644 --- a/com/ankamagames/berilia/components/messages/SelectItemMessage.as +++ b/com/ankamagames/berilia/components/messages/SelectItemMessage.as @@ -1,31 +1,29 @@ -package com.ankamagames.berilia.components.messages +package com.ankamagames.berilia.components.messages { - import flash.display.InteractiveObject; - - public class SelectItemMessage extends ComponentMessage - { - - private var _method:uint; - private var _isNewSelection:Boolean; - - public function SelectItemMessage(target:InteractiveObject, selectMethod:uint=7, isNewSelection:Boolean=true) - { - super(target); - this._method = selectMethod; - this._isNewSelection = isNewSelection; - } - - public function get selectMethod():uint - { - return (this._method); - } - - public function get isNewSelection():Boolean - { - return (this._isNewSelection); - } - - - } -}//package com.ankamagames.berilia.components.messages - + import flash.display.InteractiveObject; + + public class SelectItemMessage extends ComponentMessage + { + + public function SelectItemMessage(param1:InteractiveObject, param2:uint = 7, param3:Boolean = true) + { + super(param1); + this._method = param2; + this._isNewSelection = param3; + } + + private var _method:uint; + + private var _isNewSelection:Boolean; + + public function get selectMethod() : uint + { + return this._method; + } + + public function get isNewSelection() : Boolean + { + return this._isNewSelection; + } + } +} diff --git a/com/ankamagames/berilia/components/messages/TextClickMessage.as b/com/ankamagames/berilia/components/messages/TextClickMessage.as index 8745ccc10..a34fe8efc 100644 --- a/com/ankamagames/berilia/components/messages/TextClickMessage.as +++ b/com/ankamagames/berilia/components/messages/TextClickMessage.as @@ -1,24 +1,21 @@ -package com.ankamagames.berilia.components.messages +package com.ankamagames.berilia.components.messages { - import flash.display.InteractiveObject; - - public class TextClickMessage extends ComponentMessage - { - - private var _textEvent:String; - - public function TextClickMessage(target:InteractiveObject, textEvent:String) - { - this._textEvent = textEvent; - super(target); - } - - public function get textEvent():String - { - return (this._textEvent); - } - - - } -}//package com.ankamagames.berilia.components.messages - + import flash.display.InteractiveObject; + + public class TextClickMessage extends ComponentMessage + { + + public function TextClickMessage(param1:InteractiveObject, param2:String) + { + this._textEvent = param2; + super(param1); + } + + private var _textEvent:String; + + public function get textEvent() : String + { + return this._textEvent; + } + } +} diff --git a/com/ankamagames/berilia/components/messages/TextureLoadFailMessage.as b/com/ankamagames/berilia/components/messages/TextureLoadFailMessage.as index 3ece6446f..3cc72be7e 100644 --- a/com/ankamagames/berilia/components/messages/TextureLoadFailMessage.as +++ b/com/ankamagames/berilia/components/messages/TextureLoadFailMessage.as @@ -1,24 +1,21 @@ -package com.ankamagames.berilia.components.messages +package com.ankamagames.berilia.components.messages { - import com.ankamagames.berilia.components.Texture; - - public class TextureLoadFailMessage extends ComponentMessage - { - - private var _texture:Texture; - - public function TextureLoadFailMessage(pTexture:Texture) - { - super(pTexture); - this._texture = pTexture; - } - - public function get texture():Texture - { - return (this._texture); - } - - - } -}//package com.ankamagames.berilia.components.messages - + import com.ankamagames.berilia.components.Texture; + + public class TextureLoadFailMessage extends ComponentMessage + { + + public function TextureLoadFailMessage(param1:Texture) + { + super(param1); + this._texture = param1; + } + + private var _texture:Texture; + + public function get texture() : Texture + { + return this._texture; + } + } +} diff --git a/com/ankamagames/berilia/components/messages/TextureReadyMessage.as b/com/ankamagames/berilia/components/messages/TextureReadyMessage.as index 354742263..4b9263dc4 100644 --- a/com/ankamagames/berilia/components/messages/TextureReadyMessage.as +++ b/com/ankamagames/berilia/components/messages/TextureReadyMessage.as @@ -1,24 +1,21 @@ -package com.ankamagames.berilia.components.messages +package com.ankamagames.berilia.components.messages { - import com.ankamagames.berilia.components.Texture; - - public class TextureReadyMessage extends ComponentMessage - { - - private var _texture:Texture; - - public function TextureReadyMessage(texture:Texture) - { - super(texture); - this._texture = texture; - } - - public function get texture():Texture - { - return (this._texture); - } - - - } -}//package com.ankamagames.berilia.components.messages - + import com.ankamagames.berilia.components.Texture; + + public class TextureReadyMessage extends ComponentMessage + { + + public function TextureReadyMessage(param1:Texture) + { + super(param1); + this._texture = param1; + } + + private var _texture:Texture; + + public function get texture() : Texture + { + return this._texture; + } + } +} diff --git a/com/ankamagames/berilia/components/messages/VideoBufferChangeMessage.as b/com/ankamagames/berilia/components/messages/VideoBufferChangeMessage.as index 8f013147b..8f8b2d8e4 100644 --- a/com/ankamagames/berilia/components/messages/VideoBufferChangeMessage.as +++ b/com/ankamagames/berilia/components/messages/VideoBufferChangeMessage.as @@ -1,24 +1,21 @@ -package com.ankamagames.berilia.components.messages +package com.ankamagames.berilia.components.messages { - import flash.display.InteractiveObject; - - public class VideoBufferChangeMessage extends ComponentMessage - { - - private var _state:uint; - - public function VideoBufferChangeMessage(target:InteractiveObject, state:uint):void - { - super(target); - this._state = state; - } - - public function get state():uint - { - return (this._state); - } - - - } -}//package com.ankamagames.berilia.components.messages - + import flash.display.InteractiveObject; + + public class VideoBufferChangeMessage extends ComponentMessage + { + + public function VideoBufferChangeMessage(param1:InteractiveObject, param2:uint) + { + super(param1); + this._state = param2; + } + + private var _state:uint; + + public function get state() : uint + { + return this._state; + } + } +} diff --git a/com/ankamagames/berilia/components/messages/VideoConnectFailedMessage.as b/com/ankamagames/berilia/components/messages/VideoConnectFailedMessage.as index 88ca068c8..a5bb796c7 100644 --- a/com/ankamagames/berilia/components/messages/VideoConnectFailedMessage.as +++ b/com/ankamagames/berilia/components/messages/VideoConnectFailedMessage.as @@ -1,15 +1,13 @@ -package com.ankamagames.berilia.components.messages +package com.ankamagames.berilia.components.messages { - import flash.display.InteractiveObject; - - public class VideoConnectFailedMessage extends ComponentMessage - { - - public function VideoConnectFailedMessage(target:InteractiveObject) - { - super(target); - } - - } -}//package com.ankamagames.berilia.components.messages - + import flash.display.InteractiveObject; + + public class VideoConnectFailedMessage extends ComponentMessage + { + + public function VideoConnectFailedMessage(param1:InteractiveObject) + { + super(param1); + } + } +} diff --git a/com/ankamagames/berilia/components/messages/VideoConnectSuccessMessage.as b/com/ankamagames/berilia/components/messages/VideoConnectSuccessMessage.as index 894da7061..f8c5d4a5e 100644 --- a/com/ankamagames/berilia/components/messages/VideoConnectSuccessMessage.as +++ b/com/ankamagames/berilia/components/messages/VideoConnectSuccessMessage.as @@ -1,15 +1,13 @@ -package com.ankamagames.berilia.components.messages +package com.ankamagames.berilia.components.messages { - import flash.display.InteractiveObject; - - public class VideoConnectSuccessMessage extends ComponentMessage - { - - public function VideoConnectSuccessMessage(target:InteractiveObject):void - { - super(target); - } - - } -}//package com.ankamagames.berilia.components.messages - + import flash.display.InteractiveObject; + + public class VideoConnectSuccessMessage extends ComponentMessage + { + + public function VideoConnectSuccessMessage(param1:InteractiveObject) + { + super(param1); + } + } +} diff --git a/com/ankamagames/berilia/components/params/GridScriptProperties.as b/com/ankamagames/berilia/components/params/GridScriptProperties.as index 1efe3c2f8..367211bcd 100644 --- a/com/ankamagames/berilia/components/params/GridScriptProperties.as +++ b/com/ankamagames/berilia/components/params/GridScriptProperties.as @@ -1,23 +1,24 @@ -package com.ankamagames.berilia.components.params +package com.ankamagames.berilia.components.params { - import com.ankamagames.berilia.utils.UiProperties; - import com.ankamagames.jerakine.utils.memory.WeakProxyReference; - import com.ankamagames.berilia.components.Grid; - - public class GridScriptProperties extends UiProperties - { - - public var data; - public var selected:Boolean; - public var grid:WeakProxyReference; - - public function GridScriptProperties(d:*, b:Boolean=false, grid:Grid=null) - { - this.data = d; - this.selected = b; - this.grid = new WeakProxyReference(grid); - } - - } -}//package com.ankamagames.berilia.components.params - + import com.ankamagames.berilia.utils.UiProperties; + import com.ankamagames.jerakine.utils.memory.WeakProxyReference; + import com.ankamagames.berilia.components.Grid; + + public class GridScriptProperties extends UiProperties + { + + public function GridScriptProperties(param1:*, param2:Boolean = false, param3:Grid = null) + { + super(); + this.data = param1; + this.selected = param2; + this.grid = new WeakProxyReference(param3); + } + + public var data; + + public var selected:Boolean; + + public var grid:WeakProxyReference; + } +} diff --git a/com/ankamagames/berilia/components/params/TooltipProperties.as b/com/ankamagames/berilia/components/params/TooltipProperties.as index b55e3bba7..9e4e4bdb6 100644 --- a/com/ankamagames/berilia/components/params/TooltipProperties.as +++ b/com/ankamagames/berilia/components/params/TooltipProperties.as @@ -1,41 +1,51 @@ -package com.ankamagames.berilia.components.params +package com.ankamagames.berilia.components.params { - import com.ankamagames.berilia.utils.UiProperties; - import com.ankamagames.jerakine.interfaces.IRectangle; - import com.ankamagames.berilia.types.tooltip.Tooltip; - - public class TooltipProperties extends UiProperties - { - - public var position:IRectangle; - public var tooltip:Tooltip; - public var autoHide:Boolean; - public var point:uint = 0; - public var relativePoint:uint = 2; - public var offset:int = 3; - public var data = null; - public var makerName:String; - public var makerParam:Object; - public var zoom:Number; - public var alwaysDisplayed:Boolean; - public var target; - - public function TooltipProperties(tooltip:Tooltip, autoHide:Boolean, position:IRectangle, point:uint, relativePoint:uint, offset:int, data:*, makerParam:Object, zoom:Number=1, alwaysDisplayed:Boolean=true, target:*=null) - { - this.position = position; - this.tooltip = tooltip; - this.autoHide = autoHide; - this.point = point; - this.relativePoint = relativePoint; - this.offset = offset; - this.data = data; - this.makerName = tooltip.makerName; - this.makerParam = makerParam; - this.zoom = zoom; - this.alwaysDisplayed = alwaysDisplayed; - this.target = target; - } - - } -}//package com.ankamagames.berilia.components.params - + import com.ankamagames.berilia.utils.UiProperties; + import com.ankamagames.jerakine.interfaces.IRectangle; + import com.ankamagames.berilia.types.tooltip.Tooltip; + + public class TooltipProperties extends UiProperties + { + + public function TooltipProperties(param1:Tooltip, param2:Boolean, param3:IRectangle, param4:uint, param5:uint, param6:int, param7:*, param8:Object, param9:Number = 1, param10:Boolean = true, param11:* = null) + { + super(); + this.position = param3; + this.tooltip = param1; + this.autoHide = param2; + this.point = param4; + this.relativePoint = param5; + this.offset = param6; + this.data = param7; + this.makerName = param1.makerName; + this.makerParam = param8; + this.zoom = param9; + this.alwaysDisplayed = param10; + this.target = param11; + } + + public var position:IRectangle; + + public var tooltip:Tooltip; + + public var autoHide:Boolean; + + public var point:uint = 0; + + public var relativePoint:uint = 2; + + public var offset:int = 3; + + public var data = null; + + public var makerName:String; + + public var makerParam:Object; + + public var zoom:Number; + + public var alwaysDisplayed:Boolean; + + public var target; + } +} diff --git a/com/ankamagames/berilia/enums/EventEnums.as b/com/ankamagames/berilia/enums/EventEnums.as index 4ca7865a1..c7204d579 100644 --- a/com/ankamagames/berilia/enums/EventEnums.as +++ b/com/ankamagames/berilia/enums/EventEnums.as @@ -1,166 +1,240 @@ -package com.ankamagames.berilia.enums +package com.ankamagames.berilia.enums { - [Trusted] - public class EventEnums - { - - public static const EVENT_ONROLLOVER:String = "onRollOver"; - public static const EVENT_ONROLLOUT:String = "onRollOut"; - public static const EVENT_ONRELEASE:String = "onRelease"; - public static const EVENT_ONRELEASEOUTSIDE:String = "onReleaseOutside"; - public static const EVENT_ONRIGHTCLICK:String = "onRightClick"; - public static const EVENT_ONPRESS:String = "onPress"; - public static const EVENT_ONDOUBLECLICK:String = "onDoubleClick"; - public static const EVENT_ONWHEEL:String = "onWheel"; - public static const EVENT_ONMOUSEUP:String = "onMouseUp"; - public static const EVENT_MIDDLECLICK:String = "onMiddleClick"; - public static const EVENT_ONCHANGE:String = "onChange"; - public static const EVENT_ONCOLORCHANGE:String = "onColorChange"; - public static const EVENT_ONENTITYREADY:String = "onEntityReady"; - public static const EVENT_ONSELECTITEM:String = "onSelectItem"; - public static const EVENT_ONSELECTEMPTYITEM:String = "onSelectEmptyItem"; - public static const EVENT_ONITEMROLLOVER:String = "onItemRollOver"; - public static const EVENT_ONITEMROLLOUT:String = "onItemRollOut"; - public static const EVENT_ONITEMRIGHTCLICK:String = "onItemRightClick"; - public static const EVENT_ONDROP:String = "onDrop"; - public static const EVENT_ONCREATETAB:String = "onCreateTab"; - public static const EVENT_ONDELETETAB:String = "onDeleteTab"; - public static const EVENT_ONRENAMETAB:String = "onRenameTab"; - public static const EVENT_ONTEXTUREREADY:String = "onTextureReady"; - public static const EVENT_ONTEXTURELOADFAIL:String = "onTextureLoadFail"; - public static const EVENT_ONMAPELEMENTROLLOVER:String = "onMapElementRollOver"; - public static const EVENT_ONMAPELEMENTROLLOUT:String = "onMapElementRollOut"; - public static const EVENT_ONMAPELEMENTRIGHTCLICK:String = "onMapElementRightClick"; - public static const EVENT_ONMAPMOVE:String = "onMapMove"; - public static const EVENT_ONMAPROLLOVER:String = "onMapRollOver"; - public static const EVENT_ONCOMPONENTREADY:String = "onComponentReadyMessage"; - public static const EVENT_ONBROWSER_SESSION_TIMEOUT:String = "onBrowserSessionTimeout"; - public static const EVENT_ONBROWSER_DOM_READY:String = "onBrowserDomReady"; - public static const EVENT_ONTEXTCLICK:String = "onTextClick"; - public static const EVENT_ONVIDEOCONNECTFAILED:String = "onVideoConnectFailed"; - public static const EVENT_ONVIDEOCONNECTSUCCESS:String = "onVideoConnectSuccess"; - public static const EVENT_ONVIDEOBUFFERCHANGE:String = "onVideoBufferChange"; - public static const EVENT_MOUSE_CLASS_MSG:String = "com.ankamagames.jerakine.handlers.messages.mouse::"; - public static const EVENT_UI_MSG:String = "com.ankamagames.berilia.components.messages::"; - public static const EVENT_ONROLLOVER_MSG:String = (EVENT_MOUSE_CLASS_MSG + "MouseOverMessage"); - public static const EVENT_ONROLLOUT_MSG:String = (EVENT_MOUSE_CLASS_MSG + "MouseOutMessage"); - public static const EVENT_ONRELEASE_MSG:String = (EVENT_MOUSE_CLASS_MSG + "MouseClickMessage"); - public static const EVENT_ONRIGHTCLICK_MSG:String = (EVENT_MOUSE_CLASS_MSG + "MouseRightClickMessage"); - public static const EVENT_ONPRESS_MSG:String = (EVENT_MOUSE_CLASS_MSG + "MouseDownMessage"); - public static const EVENT_ONRELEASEOUTSIDE_MSG:String = (EVENT_MOUSE_CLASS_MSG + "MouseReleaseOutsideMessage"); - public static const EVENT_ONDOUBLECLICK_MSG:String = (EVENT_MOUSE_CLASS_MSG + "MouseDoubleClickMessage"); - public static const EVENT_ONWHEEL_MSG:String = (EVENT_MOUSE_CLASS_MSG + "MouseWheelMessage"); - public static const EVENT_ONMOUSEUP_MSG:String = (EVENT_MOUSE_CLASS_MSG + "MouseUpMessage"); - public static const EVENT_ONTEXTCLICK_MSG:String = (EVENT_UI_MSG + "TextClickMessage"); - public static const EVENT_MIDDLECLICK_MSG:String = (EVENT_MOUSE_CLASS_MSG + "MouseMiddleClickMessage"); - public static const EVENT_ONCHANGE_MSG:String = (EVENT_UI_MSG + "ChangeMessage"); - public static const EVENT_ONCOLORCHANGE_MSG:String = (EVENT_UI_MSG + "ColorChangeMessage"); - public static const EVENT_ONENTITYREADY_MSG:String = (EVENT_UI_MSG + "EntityReadyMessage"); - public static const EVENT_ONSELECTITEM_MSG:String = (EVENT_UI_MSG + "SelectItemMessage"); - public static const EVENT_ONITEMROLLOVER_MSG:String = (EVENT_UI_MSG + "ItemRollOverMessage"); - public static const EVENT_ONITEMROLLOUT_MSG:String = (EVENT_UI_MSG + "ItemRollOutMessage"); - public static const EVENT_ONSELECTEMPTYITEM_MSG:String = (EVENT_UI_MSG + "SelectEmptyItemMessage"); - public static const EVENT_ONITEMRIGHTCLICK_MSG:String = (EVENT_UI_MSG + "ItemRightClickMessage"); - public static const EVENT_ONDROP_MSG:String = (EVENT_UI_MSG + "DropMessage"); - public static const EVENT_ONCREATETAB_MSG:String = (EVENT_UI_MSG + "CreateTabMessage"); - public static const EVENT_ONDELETETAB_MSG:String = (EVENT_UI_MSG + "DeleteTabMessage"); - public static const EVENT_ONRENAMETAB_MSG:String = (EVENT_UI_MSG + "RenameTabMessage"); - public static const EVENT_ONTEXTUREREADY_MSG:String = (EVENT_UI_MSG + "TextureReadyMessage"); - public static const EVENT_ONTEXTURELOADFAIL_MSG:String = (EVENT_UI_MSG + "TextureLoadFailMessage"); - public static const EVENT_ONMAPELEMENTROLLOVER_MSG:String = (EVENT_UI_MSG + "MapElementRollOverMessage"); - public static const EVENT_ONMAPELEMENTROLLOUT_MSG:String = (EVENT_UI_MSG + "MapElementRollOutMessage"); - public static const EVENT_ONMAPELEMENTRIGHTCLICK_MSG:String = (EVENT_UI_MSG + "MapElementRightClickMessage"); - public static const EVENT_ONCOMPONENTREADY_MSG:String = (EVENT_UI_MSG + "ComponentReadyMessage"); - public static const EVENT_ONMAPMOVE_MSG:String = (EVENT_UI_MSG + "MapMoveMessage"); - public static const EVENT_ONMAPROLLOVER_MSG:String = (EVENT_UI_MSG + "MapRollOverMessage"); - public static const EVENT_ONBROWSER_SESSION_TIMEOUT_MSG:String = (EVENT_UI_MSG + "BrowserSessionTimeout"); - public static const EVENT_ONBROWSER_DOM_READY_MSG:String = (EVENT_UI_MSG + "BrowserDomReady"); - public static const EVENT_ONVIDEOCONNECTFAILED_MSG:String = (EVENT_UI_MSG + "VideoConnectFailedMessage"); - public static const EVENT_ONVIDEOCONNECTSUCCESS_MSG:String = (EVENT_UI_MSG + "VideoConnectSuccessMessage"); - public static const EVENT_ONVIDEOBUFFERCHANGE_MSG:String = (EVENT_UI_MSG + "VideoBufferChangeMessage"); - - - public static function convertMsgToFct(msgName:String):String - { - switch (msgName) - { - case EVENT_ONPRESS_MSG: - return (EVENT_ONPRESS); - case EVENT_ONRELEASE_MSG: - return (EVENT_ONRELEASE); - case EVENT_ONROLLOUT_MSG: - return (EVENT_ONROLLOUT); - case EVENT_ONROLLOVER_MSG: - return (EVENT_ONROLLOVER); - case EVENT_ONRELEASEOUTSIDE_MSG: - return (EVENT_ONRELEASEOUTSIDE); - case EVENT_ONRIGHTCLICK_MSG: - return (EVENT_ONRIGHTCLICK); - case EVENT_ONDOUBLECLICK_MSG: - return (EVENT_ONDOUBLECLICK); - case EVENT_ONCOLORCHANGE_MSG: - return (EVENT_ONCOLORCHANGE); - case EVENT_ONENTITYREADY_MSG: - return (EVENT_ONENTITYREADY); - case EVENT_ONCHANGE_MSG: - return (EVENT_ONCHANGE); - case EVENT_ONSELECTITEM_MSG: - return (EVENT_ONSELECTITEM); - case EVENT_ONSELECTEMPTYITEM_MSG: - return (EVENT_ONSELECTEMPTYITEM); - case EVENT_ONDROP_MSG: - return (EVENT_ONDROP); - case EVENT_ONWHEEL_MSG: - return (EVENT_ONWHEEL); - case EVENT_ONMOUSEUP_MSG: - return (EVENT_ONMOUSEUP); - case EVENT_ONCREATETAB_MSG: - return (EVENT_ONCREATETAB); - case EVENT_ONDELETETAB_MSG: - return (EVENT_ONDELETETAB); - case EVENT_ONRENAMETAB_MSG: - return (EVENT_ONRENAMETAB); - case EVENT_ONITEMROLLOVER_MSG: - return (EVENT_ONITEMROLLOVER); - case EVENT_ONITEMROLLOUT_MSG: - return (EVENT_ONITEMROLLOUT); - case EVENT_ONITEMRIGHTCLICK_MSG: - return (EVENT_ONITEMRIGHTCLICK); - case EVENT_ONTEXTUREREADY_MSG: - return (EVENT_ONTEXTUREREADY); - case EVENT_ONTEXTURELOADFAIL_MSG: - return (EVENT_ONTEXTURELOADFAIL); - case EVENT_ONMAPMOVE_MSG: - return (EVENT_ONMAPMOVE); - case EVENT_ONMAPELEMENTROLLOUT_MSG: - return (EVENT_ONMAPELEMENTROLLOUT); - case EVENT_ONMAPELEMENTROLLOVER_MSG: - return (EVENT_ONMAPELEMENTROLLOVER); - case EVENT_ONMAPELEMENTRIGHTCLICK_MSG: - return (EVENT_ONMAPELEMENTRIGHTCLICK); - case EVENT_ONMAPROLLOVER_MSG: - return (EVENT_ONMAPROLLOVER); - case EVENT_ONVIDEOCONNECTFAILED_MSG: - return (EVENT_ONVIDEOCONNECTFAILED); - case EVENT_ONVIDEOCONNECTSUCCESS_MSG: - return (EVENT_ONVIDEOCONNECTSUCCESS); - case EVENT_ONVIDEOBUFFERCHANGE_MSG: - return (EVENT_ONVIDEOBUFFERCHANGE); - case EVENT_ONCOMPONENTREADY_MSG: - return (EVENT_ONCOMPONENTREADY); - case EVENT_ONBROWSER_SESSION_TIMEOUT_MSG: - return (EVENT_ONBROWSER_SESSION_TIMEOUT); - case EVENT_ONBROWSER_DOM_READY_MSG: - return (EVENT_ONBROWSER_DOM_READY); - case EVENT_ONTEXTCLICK_MSG: - return (EVENT_ONTEXTCLICK); - case EVENT_MIDDLECLICK_MSG: - return (EVENT_MIDDLECLICK); - }; - return (null); - } - - - } -}//package com.ankamagames.berilia.enums - + public class EventEnums extends Object + { + + public function EventEnums() + { + super(); + } + + public static const EVENT_ONROLLOVER:String = "onRollOver"; + + public static const EVENT_ONROLLOUT:String = "onRollOut"; + + public static const EVENT_ONRELEASE:String = "onRelease"; + + public static const EVENT_ONRELEASEOUTSIDE:String = "onReleaseOutside"; + + public static const EVENT_ONRIGHTCLICK:String = "onRightClick"; + + public static const EVENT_ONPRESS:String = "onPress"; + + public static const EVENT_ONDOUBLECLICK:String = "onDoubleClick"; + + public static const EVENT_ONWHEEL:String = "onWheel"; + + public static const EVENT_ONMOUSEUP:String = "onMouseUp"; + + public static const EVENT_MIDDLECLICK:String = "onMiddleClick"; + + public static const EVENT_ONCHANGE:String = "onChange"; + + public static const EVENT_ONCOLORCHANGE:String = "onColorChange"; + + public static const EVENT_ONENTITYREADY:String = "onEntityReady"; + + public static const EVENT_ONSELECTITEM:String = "onSelectItem"; + + public static const EVENT_ONSELECTEMPTYITEM:String = "onSelectEmptyItem"; + + public static const EVENT_ONITEMROLLOVER:String = "onItemRollOver"; + + public static const EVENT_ONITEMROLLOUT:String = "onItemRollOut"; + + public static const EVENT_ONITEMRIGHTCLICK:String = "onItemRightClick"; + + public static const EVENT_ONDROP:String = "onDrop"; + + public static const EVENT_ONCREATETAB:String = "onCreateTab"; + + public static const EVENT_ONDELETETAB:String = "onDeleteTab"; + + public static const EVENT_ONRENAMETAB:String = "onRenameTab"; + + public static const EVENT_ONTEXTUREREADY:String = "onTextureReady"; + + public static const EVENT_ONTEXTURELOADFAIL:String = "onTextureLoadFail"; + + public static const EVENT_ONMAPELEMENTROLLOVER:String = "onMapElementRollOver"; + + public static const EVENT_ONMAPELEMENTROLLOUT:String = "onMapElementRollOut"; + + public static const EVENT_ONMAPELEMENTRIGHTCLICK:String = "onMapElementRightClick"; + + public static const EVENT_ONMAPMOVE:String = "onMapMove"; + + public static const EVENT_ONMAPROLLOVER:String = "onMapRollOver"; + + public static const EVENT_ONCOMPONENTREADY:String = "onComponentReadyMessage"; + + public static const EVENT_ONBROWSER_SESSION_TIMEOUT:String = "onBrowserSessionTimeout"; + + public static const EVENT_ONBROWSER_DOM_READY:String = "onBrowserDomReady"; + + public static const EVENT_ONTEXTCLICK:String = "onTextClick"; + + public static const EVENT_ONVIDEOCONNECTFAILED:String = "onVideoConnectFailed"; + + public static const EVENT_ONVIDEOCONNECTSUCCESS:String = "onVideoConnectSuccess"; + + public static const EVENT_ONVIDEOBUFFERCHANGE:String = "onVideoBufferChange"; + + public static const EVENT_MOUSE_CLASS_MSG:String = "com.ankamagames.jerakine.handlers.messages.mouse::"; + + public static const EVENT_UI_MSG:String = "com.ankamagames.berilia.components.messages::"; + + public static const EVENT_ONROLLOVER_MSG:String = EVENT_MOUSE_CLASS_MSG + "MouseOverMessage"; + + public static const EVENT_ONROLLOUT_MSG:String = EVENT_MOUSE_CLASS_MSG + "MouseOutMessage"; + + public static const EVENT_ONRELEASE_MSG:String = EVENT_MOUSE_CLASS_MSG + "MouseClickMessage"; + + public static const EVENT_ONRIGHTCLICK_MSG:String = EVENT_MOUSE_CLASS_MSG + "MouseRightClickMessage"; + + public static const EVENT_ONPRESS_MSG:String = EVENT_MOUSE_CLASS_MSG + "MouseDownMessage"; + + public static const EVENT_ONRELEASEOUTSIDE_MSG:String = EVENT_MOUSE_CLASS_MSG + "MouseReleaseOutsideMessage"; + + public static const EVENT_ONDOUBLECLICK_MSG:String = EVENT_MOUSE_CLASS_MSG + "MouseDoubleClickMessage"; + + public static const EVENT_ONWHEEL_MSG:String = EVENT_MOUSE_CLASS_MSG + "MouseWheelMessage"; + + public static const EVENT_ONMOUSEUP_MSG:String = EVENT_MOUSE_CLASS_MSG + "MouseUpMessage"; + + public static const EVENT_ONTEXTCLICK_MSG:String = EVENT_UI_MSG + "TextClickMessage"; + + public static const EVENT_MIDDLECLICK_MSG:String = EVENT_MOUSE_CLASS_MSG + "MouseMiddleClickMessage"; + + public static const EVENT_ONCHANGE_MSG:String = EVENT_UI_MSG + "ChangeMessage"; + + public static const EVENT_ONCOLORCHANGE_MSG:String = EVENT_UI_MSG + "ColorChangeMessage"; + + public static const EVENT_ONENTITYREADY_MSG:String = EVENT_UI_MSG + "EntityReadyMessage"; + + public static const EVENT_ONSELECTITEM_MSG:String = EVENT_UI_MSG + "SelectItemMessage"; + + public static const EVENT_ONITEMROLLOVER_MSG:String = EVENT_UI_MSG + "ItemRollOverMessage"; + + public static const EVENT_ONITEMROLLOUT_MSG:String = EVENT_UI_MSG + "ItemRollOutMessage"; + + public static const EVENT_ONSELECTEMPTYITEM_MSG:String = EVENT_UI_MSG + "SelectEmptyItemMessage"; + + public static const EVENT_ONITEMRIGHTCLICK_MSG:String = EVENT_UI_MSG + "ItemRightClickMessage"; + + public static const EVENT_ONDROP_MSG:String = EVENT_UI_MSG + "DropMessage"; + + public static const EVENT_ONCREATETAB_MSG:String = EVENT_UI_MSG + "CreateTabMessage"; + + public static const EVENT_ONDELETETAB_MSG:String = EVENT_UI_MSG + "DeleteTabMessage"; + + public static const EVENT_ONRENAMETAB_MSG:String = EVENT_UI_MSG + "RenameTabMessage"; + + public static const EVENT_ONTEXTUREREADY_MSG:String = EVENT_UI_MSG + "TextureReadyMessage"; + + public static const EVENT_ONTEXTURELOADFAIL_MSG:String = EVENT_UI_MSG + "TextureLoadFailMessage"; + + public static const EVENT_ONMAPELEMENTROLLOVER_MSG:String = EVENT_UI_MSG + "MapElementRollOverMessage"; + + public static const EVENT_ONMAPELEMENTROLLOUT_MSG:String = EVENT_UI_MSG + "MapElementRollOutMessage"; + + public static const EVENT_ONMAPELEMENTRIGHTCLICK_MSG:String = EVENT_UI_MSG + "MapElementRightClickMessage"; + + public static const EVENT_ONCOMPONENTREADY_MSG:String = EVENT_UI_MSG + "ComponentReadyMessage"; + + public static const EVENT_ONMAPMOVE_MSG:String = EVENT_UI_MSG + "MapMoveMessage"; + + public static const EVENT_ONMAPROLLOVER_MSG:String = EVENT_UI_MSG + "MapRollOverMessage"; + + public static const EVENT_ONBROWSER_SESSION_TIMEOUT_MSG:String = EVENT_UI_MSG + "BrowserSessionTimeout"; + + public static const EVENT_ONBROWSER_DOM_READY_MSG:String = EVENT_UI_MSG + "BrowserDomReady"; + + public static const EVENT_ONVIDEOCONNECTFAILED_MSG:String = EVENT_UI_MSG + "VideoConnectFailedMessage"; + + public static const EVENT_ONVIDEOCONNECTSUCCESS_MSG:String = EVENT_UI_MSG + "VideoConnectSuccessMessage"; + + public static const EVENT_ONVIDEOBUFFERCHANGE_MSG:String = EVENT_UI_MSG + "VideoBufferChangeMessage"; + + public static function convertMsgToFct(param1:String) : String + { + switch(param1) + { + case EVENT_ONPRESS_MSG: + return EVENT_ONPRESS; + case EVENT_ONRELEASE_MSG: + return EVENT_ONRELEASE; + case EVENT_ONROLLOUT_MSG: + return EVENT_ONROLLOUT; + case EVENT_ONROLLOVER_MSG: + return EVENT_ONROLLOVER; + case EVENT_ONRELEASEOUTSIDE_MSG: + return EVENT_ONRELEASEOUTSIDE; + case EVENT_ONRIGHTCLICK_MSG: + return EVENT_ONRIGHTCLICK; + case EVENT_ONDOUBLECLICK_MSG: + return EVENT_ONDOUBLECLICK; + case EVENT_ONCOLORCHANGE_MSG: + return EVENT_ONCOLORCHANGE; + case EVENT_ONENTITYREADY_MSG: + return EVENT_ONENTITYREADY; + case EVENT_ONCHANGE_MSG: + return EVENT_ONCHANGE; + case EVENT_ONSELECTITEM_MSG: + return EVENT_ONSELECTITEM; + case EVENT_ONSELECTEMPTYITEM_MSG: + return EVENT_ONSELECTEMPTYITEM; + case EVENT_ONDROP_MSG: + return EVENT_ONDROP; + case EVENT_ONWHEEL_MSG: + return EVENT_ONWHEEL; + case EVENT_ONMOUSEUP_MSG: + return EVENT_ONMOUSEUP; + case EVENT_ONCREATETAB_MSG: + return EVENT_ONCREATETAB; + case EVENT_ONDELETETAB_MSG: + return EVENT_ONDELETETAB; + case EVENT_ONRENAMETAB_MSG: + return EVENT_ONRENAMETAB; + case EVENT_ONITEMROLLOVER_MSG: + return EVENT_ONITEMROLLOVER; + case EVENT_ONITEMROLLOUT_MSG: + return EVENT_ONITEMROLLOUT; + case EVENT_ONITEMRIGHTCLICK_MSG: + return EVENT_ONITEMRIGHTCLICK; + case EVENT_ONTEXTUREREADY_MSG: + return EVENT_ONTEXTUREREADY; + case EVENT_ONTEXTURELOADFAIL_MSG: + return EVENT_ONTEXTURELOADFAIL; + case EVENT_ONMAPMOVE_MSG: + return EVENT_ONMAPMOVE; + case EVENT_ONMAPELEMENTROLLOUT_MSG: + return EVENT_ONMAPELEMENTROLLOUT; + case EVENT_ONMAPELEMENTROLLOVER_MSG: + return EVENT_ONMAPELEMENTROLLOVER; + case EVENT_ONMAPELEMENTRIGHTCLICK_MSG: + return EVENT_ONMAPELEMENTRIGHTCLICK; + case EVENT_ONMAPROLLOVER_MSG: + return EVENT_ONMAPROLLOVER; + case EVENT_ONVIDEOCONNECTFAILED_MSG: + return EVENT_ONVIDEOCONNECTFAILED; + case EVENT_ONVIDEOCONNECTSUCCESS_MSG: + return EVENT_ONVIDEOCONNECTSUCCESS; + case EVENT_ONVIDEOBUFFERCHANGE_MSG: + return EVENT_ONVIDEOBUFFERCHANGE; + case EVENT_ONCOMPONENTREADY_MSG: + return EVENT_ONCOMPONENTREADY; + case EVENT_ONBROWSER_SESSION_TIMEOUT_MSG: + return EVENT_ONBROWSER_SESSION_TIMEOUT; + case EVENT_ONBROWSER_DOM_READY_MSG: + return EVENT_ONBROWSER_DOM_READY; + case EVENT_ONTEXTCLICK_MSG: + return EVENT_ONTEXTCLICK; + case EVENT_MIDDLECLICK_MSG: + return EVENT_MIDDLECLICK; + default: + return null; + } + } + } +} diff --git a/com/ankamagames/berilia/enums/LocationTypeEnum.as b/com/ankamagames/berilia/enums/LocationTypeEnum.as index ec0fe7de1..1a1debc5f 100644 --- a/com/ankamagames/berilia/enums/LocationTypeEnum.as +++ b/com/ankamagames/berilia/enums/LocationTypeEnum.as @@ -1,13 +1,15 @@ -package com.ankamagames.berilia.enums +package com.ankamagames.berilia.enums { - [Trusted] - public class LocationTypeEnum - { - - public static const LOCATION_TYPE_RELATIVE:uint = 1; - public static const LOCATION_TYPE_ABSOLUTE:uint = 0; - - - } -}//package com.ankamagames.berilia.enums - + public class LocationTypeEnum extends Object + { + + public function LocationTypeEnum() + { + super(); + } + + public static const LOCATION_TYPE_RELATIVE:uint = 1; + + public static const LOCATION_TYPE_ABSOLUTE:uint = 0; + } +} diff --git a/com/ankamagames/berilia/enums/SelectMethodEnum.as b/com/ankamagames/berilia/enums/SelectMethodEnum.as index e9a718a15..f89f82025 100644 --- a/com/ankamagames/berilia/enums/SelectMethodEnum.as +++ b/com/ankamagames/berilia/enums/SelectMethodEnum.as @@ -1,22 +1,35 @@ -package com.ankamagames.berilia.enums +package com.ankamagames.berilia.enums { - public class SelectMethodEnum - { - - public static const CLICK:uint = 0; - public static const DOUBLE_CLICK:uint = 1; - public static const MANUAL:uint = 2; - public static const UP_ARROW:uint = 3; - public static const DOWN_ARROW:uint = 4; - public static const LEFT_ARROW:uint = 5; - public static const RIGHT_ARROW:uint = 6; - public static const AUTO:uint = 7; - public static const WHEEL:uint = 8; - public static const CTRL_DOUBLE_CLICK:uint = 9; - public static const ALT_DOUBLE_CLICK:uint = 10; - public static const SEARCH:uint = 11; - - - } -}//package com.ankamagames.berilia.enums - + public class SelectMethodEnum extends Object + { + + public function SelectMethodEnum() + { + super(); + } + + public static const CLICK:uint = 0; + + public static const DOUBLE_CLICK:uint = 1; + + public static const MANUAL:uint = 2; + + public static const UP_ARROW:uint = 3; + + public static const DOWN_ARROW:uint = 4; + + public static const LEFT_ARROW:uint = 5; + + public static const RIGHT_ARROW:uint = 6; + + public static const AUTO:uint = 7; + + public static const WHEEL:uint = 8; + + public static const CTRL_DOUBLE_CLICK:uint = 9; + + public static const ALT_DOUBLE_CLICK:uint = 10; + + public static const SEARCH:uint = 11; + } +} diff --git a/com/ankamagames/berilia/enums/ShortcutsEnum.as b/com/ankamagames/berilia/enums/ShortcutsEnum.as index 296a33c3b..abb217e4f 100644 --- a/com/ankamagames/berilia/enums/ShortcutsEnum.as +++ b/com/ankamagames/berilia/enums/ShortcutsEnum.as @@ -1,14 +1,17 @@ -package com.ankamagames.berilia.enums +package com.ankamagames.berilia.enums { - [Trusted] - public class ShortcutsEnum - { - - public static const BASIC_SHORTCUT_KEYCODE:Array = new Array(); - public static const BASIC_SHORTCUT_NAME:Array = new Array(); - public static const BASIC_SHORTCUT_FORBIDDEN:Array = new Array(); - - - } -}//package com.ankamagames.berilia.enums - + public class ShortcutsEnum extends Object + { + + public function ShortcutsEnum() + { + super(); + } + + public static const BASIC_SHORTCUT_KEYCODE:Array = new Array(); + + public static const BASIC_SHORTCUT_NAME:Array = new Array(); + + public static const BASIC_SHORTCUT_FORBIDDEN:Array = new Array(); + } +} diff --git a/com/ankamagames/berilia/enums/StatesEnum.as b/com/ankamagames/berilia/enums/StatesEnum.as index 7f1cdf8c3..30d218f4e 100644 --- a/com/ankamagames/berilia/enums/StatesEnum.as +++ b/com/ankamagames/berilia/enums/StatesEnum.as @@ -1,33 +1,44 @@ -package com.ankamagames.berilia.enums +package com.ankamagames.berilia.enums { - import __AS3__.vec.Vector; - import __AS3__.vec.*; - - public class StatesEnum - { - - public static const STATE_NORMAL:uint = 0; - public static const STATE_OVER:uint = 1; - public static const STATE_CLICKED:uint = 2; - public static const STATE_SELECTED:uint = 3; - public static const STATE_SELECTED_OVER:uint = 4; - public static const STATE_SELECTED_CLICKED:uint = 5; - public static const STATE_DISABLED:uint = 6; - public static const STATE_NORMAL_STRING:String = "NORMAL"; - public static const STATE_OVER_STRING:String = "OVER"; - public static const STATE_CLICKED_STRING:String = "PRESSED"; - public static const STATE_DISABLED_STRING:String = "DISABLED"; - public static const STATE_SELECTED_STRING:String = "SELECTED"; - public static const STATE_SELECTED_OVER_STRING:String = "SELECTED_OVER"; - public static const STATE_SELECTED_CLICKED_STRING:String = "SELECTED_PRESSED"; - - - public static function getStateEnumList():Vector. - { - return (Vector.([STATE_NORMAL_STRING, STATE_CLICKED_STRING, STATE_DISABLED_STRING, STATE_OVER_STRING, STATE_SELECTED_CLICKED_STRING, STATE_SELECTED_OVER_STRING, STATE_SELECTED_STRING])); - } - - - } -}//package com.ankamagames.berilia.enums - + public class StatesEnum extends Object + { + + public function StatesEnum() + { + super(); + } + + public static const STATE_NORMAL:uint = 0; + + public static const STATE_OVER:uint = 1; + + public static const STATE_CLICKED:uint = 2; + + public static const STATE_SELECTED:uint = 3; + + public static const STATE_SELECTED_OVER:uint = 4; + + public static const STATE_SELECTED_CLICKED:uint = 5; + + public static const STATE_DISABLED:uint = 6; + + public static const STATE_NORMAL_STRING:String = "NORMAL"; + + public static const STATE_OVER_STRING:String = "OVER"; + + public static const STATE_CLICKED_STRING:String = "PRESSED"; + + public static const STATE_DISABLED_STRING:String = "DISABLED"; + + public static const STATE_SELECTED_STRING:String = "SELECTED"; + + public static const STATE_SELECTED_OVER_STRING:String = "SELECTED_OVER"; + + public static const STATE_SELECTED_CLICKED_STRING:String = "SELECTED_PRESSED"; + + public static function getStateEnumList() : Vector. + { + return Vector.([STATE_NORMAL_STRING,STATE_CLICKED_STRING,STATE_DISABLED_STRING,STATE_OVER_STRING,STATE_SELECTED_CLICKED_STRING,STATE_SELECTED_OVER_STRING,STATE_SELECTED_STRING]); + } + } +} diff --git a/com/ankamagames/berilia/enums/StrataEnum.as b/com/ankamagames/berilia/enums/StrataEnum.as index 9fb7601ae..bc02d5195 100644 --- a/com/ankamagames/berilia/enums/StrataEnum.as +++ b/com/ankamagames/berilia/enums/StrataEnum.as @@ -1,21 +1,33 @@ -package com.ankamagames.berilia.enums +package com.ankamagames.berilia.enums { - public class StrataEnum - { - - public static const STRATA_WORLD:int = -1; - public static const STRATA_LOW:int = 0; - public static const STRATA_MEDIUM:int = 1; - public static const STRATA_HIGH:int = 2; - public static const STRATA_TOP:int = 3; - public static const STRATA_TOOLTIP:int = 4; - public static const STRATA_NAME_LOW:String = "LOW"; - public static const STRATA_NAME_MEDIUM:String = "MEDIUM"; - public static const STRATA_NAME_HIGH:String = "HIGH"; - public static const STRATA_NAME_TOP:String = "TOP"; - public static const STRATA_NAME_TOOLTIP:String = "TOOLTIP"; - - - } -}//package com.ankamagames.berilia.enums - + public class StrataEnum extends Object + { + + public function StrataEnum() + { + super(); + } + + public static const STRATA_WORLD:int = -1; + + public static const STRATA_LOW:int = 0; + + public static const STRATA_MEDIUM:int = 1; + + public static const STRATA_HIGH:int = 2; + + public static const STRATA_TOP:int = 3; + + public static const STRATA_TOOLTIP:int = 4; + + public static const STRATA_NAME_LOW:String = "LOW"; + + public static const STRATA_NAME_MEDIUM:String = "MEDIUM"; + + public static const STRATA_NAME_HIGH:String = "HIGH"; + + public static const STRATA_NAME_TOP:String = "TOP"; + + public static const STRATA_NAME_TOOLTIP:String = "TOOLTIP"; + } +} diff --git a/com/ankamagames/berilia/enums/XmlAttributesEnum.as b/com/ankamagames/berilia/enums/XmlAttributesEnum.as index 0cd307d46..57e843834 100644 --- a/com/ankamagames/berilia/enums/XmlAttributesEnum.as +++ b/com/ankamagames/berilia/enums/XmlAttributesEnum.as @@ -1,27 +1,45 @@ -package com.ankamagames.berilia.enums +package com.ankamagames.berilia.enums { - public class XmlAttributesEnum - { - - public static const ATTRIBUTE_NAME:String = "name"; - public static const ATTRIBUTE_VISIBLE:String = "visible"; - public static const ATTRIBUTE_POINT:String = "point"; - public static const ATTRIBUTE_RELATIVETO:String = "relativeTo"; - public static const ATTRIBUTE_RELATIVEPOINT:String = "relativePoint"; - public static const ATTRIBUTE_STRATA:String = "strata"; - public static const ATTRIBUTE_URL:String = "url"; - public static const ATTRIBUTE_DEBUG:String = "debug"; - public static const ATTRIBUTE_USECACHE:String = "useCache"; - public static const ATTRIBUTE_USEPROPERTIESCACHE:String = "usePropertiesCache"; - public static const ATTRIBUTE_MODAL:String = "modal"; - public static const ATTRIBUTE_SCALABLE:String = "scalable"; - public static const ATTRIBUTE_ALPHA:String = "alpha"; - public static const ATTRIBUTE_TYPE:String = "type"; - public static const ATTRIBUTE_TARGET:String = "target"; - public static const ATTRIBUTE_FOCUS:String = "giveFocus"; - public static const ATTRIBUTE_TRANSMITFOCUS:String = "transmitFocus"; - - - } -}//package com.ankamagames.berilia.enums - + public class XmlAttributesEnum extends Object + { + + public function XmlAttributesEnum() + { + super(); + } + + public static const ATTRIBUTE_NAME:String = "name"; + + public static const ATTRIBUTE_VISIBLE:String = "visible"; + + public static const ATTRIBUTE_POINT:String = "point"; + + public static const ATTRIBUTE_RELATIVETO:String = "relativeTo"; + + public static const ATTRIBUTE_RELATIVEPOINT:String = "relativePoint"; + + public static const ATTRIBUTE_STRATA:String = "strata"; + + public static const ATTRIBUTE_URL:String = "url"; + + public static const ATTRIBUTE_DEBUG:String = "debug"; + + public static const ATTRIBUTE_USECACHE:String = "useCache"; + + public static const ATTRIBUTE_USEPROPERTIESCACHE:String = "usePropertiesCache"; + + public static const ATTRIBUTE_MODAL:String = "modal"; + + public static const ATTRIBUTE_SCALABLE:String = "scalable"; + + public static const ATTRIBUTE_ALPHA:String = "alpha"; + + public static const ATTRIBUTE_TYPE:String = "type"; + + public static const ATTRIBUTE_TARGET:String = "target"; + + public static const ATTRIBUTE_FOCUS:String = "giveFocus"; + + public static const ATTRIBUTE_TRANSMITFOCUS:String = "transmitFocus"; + } +} diff --git a/com/ankamagames/berilia/enums/XmlTagsEnum.as b/com/ankamagames/berilia/enums/XmlTagsEnum.as index 807d87e04..1dd2d31f0 100644 --- a/com/ankamagames/berilia/enums/XmlTagsEnum.as +++ b/com/ankamagames/berilia/enums/XmlTagsEnum.as @@ -1,39 +1,69 @@ -package com.ankamagames.berilia.enums +package com.ankamagames.berilia.enums { - public class XmlTagsEnum - { - - public static const TAG_CONTAINER:String = "Container"; - public static const TAG_STATECONTAINER:String = "StateContainer"; - public static const TAG_SCROLLCONTAINER:String = "ScrollContainer"; - public static const TAG_BUTTON:String = "Button"; - public static const TAG_GRID:String = "Grid"; - public static const TAG_COMBOBOX:String = "ComboBox"; - public static const TAG_INPUTCOMBOBOX:String = "InputComboBox"; - public static const TAG_TREE:String = "Tree"; - public static const TAG_COMMON:String = "Common"; - public static const TAG_STATE:String = "State"; - public static const TAG_SETPROPERTY:String = "SetProperties"; - public static const TAG_ANCHORS:String = "Anchors"; - public static const TAG_ANCHOR:String = "Anchor"; - public static const TAG_SIZE:String = "Size"; - public static const TAG_OFFSET:String = "Offset"; - public static const TAG_RELDIMENSION:String = "RelDimension"; - public static const TAG_ABSDIMENSION:String = "AbsDimension"; - public static const TAG_EVENTS:String = "Hooks"; - public static const TAG_SYSTMEEVENTS:String = "SystemEvents"; - public static const TAG_IMPORT:String = "Import"; - public static const TAG_SHORTCUTS:String = "Shortcuts"; - public static const TAG_MINIMALSIZE:String = "MinimalSize"; - public static const TAG_MAXIMALSIZE:String = "MaximalSize"; - public static const TAG_CONSTANTS:String = "Constants"; - public static const TAG_CONSTANT:String = "Constant"; - public static const TAG_VAR:String = "Var"; - public static const TAG_PARAM:String = "Param"; - public static const TAG_VALUE:String = "Value"; - public static const TAG_DEFAULTVALUE:String = "DefaultValue"; - - - } -}//package com.ankamagames.berilia.enums - + public class XmlTagsEnum extends Object + { + + public function XmlTagsEnum() + { + super(); + } + + public static const TAG_CONTAINER:String = "Container"; + + public static const TAG_STATECONTAINER:String = "StateContainer"; + + public static const TAG_SCROLLCONTAINER:String = "ScrollContainer"; + + public static const TAG_BUTTON:String = "Button"; + + public static const TAG_GRID:String = "Grid"; + + public static const TAG_COMBOBOX:String = "ComboBox"; + + public static const TAG_INPUTCOMBOBOX:String = "InputComboBox"; + + public static const TAG_TREE:String = "Tree"; + + public static const TAG_COMMON:String = "Common"; + + public static const TAG_STATE:String = "State"; + + public static const TAG_SETPROPERTY:String = "SetProperties"; + + public static const TAG_ANCHORS:String = "Anchors"; + + public static const TAG_ANCHOR:String = "Anchor"; + + public static const TAG_SIZE:String = "Size"; + + public static const TAG_OFFSET:String = "Offset"; + + public static const TAG_RELDIMENSION:String = "RelDimension"; + + public static const TAG_ABSDIMENSION:String = "AbsDimension"; + + public static const TAG_EVENTS:String = "Hooks"; + + public static const TAG_SYSTMEEVENTS:String = "SystemEvents"; + + public static const TAG_IMPORT:String = "Import"; + + public static const TAG_SHORTCUTS:String = "Shortcuts"; + + public static const TAG_MINIMALSIZE:String = "MinimalSize"; + + public static const TAG_MAXIMALSIZE:String = "MaximalSize"; + + public static const TAG_CONSTANTS:String = "Constants"; + + public static const TAG_CONSTANT:String = "Constant"; + + public static const TAG_VAR:String = "Var"; + + public static const TAG_PARAM:String = "Param"; + + public static const TAG_VALUE:String = "Value"; + + public static const TAG_DEFAULTVALUE:String = "DefaultValue"; + } +} diff --git a/com/ankamagames/berilia/eventInterface/EventOnShortcut.as b/com/ankamagames/berilia/eventInterface/EventOnShortcut.as index cc694dbdd..70ed8c128 100644 --- a/com/ankamagames/berilia/eventInterface/EventOnShortcut.as +++ b/com/ankamagames/berilia/eventInterface/EventOnShortcut.as @@ -1,10 +1,8 @@ -package com.ankamagames.berilia.eventInterface +package com.ankamagames.berilia.eventInterface { - public interface EventOnShortcut extends UIEvent - { - - function eventOnShortcut(_arg_1:String):Boolean; - - } -}//package com.ankamagames.berilia.eventInterface - + public interface EventOnShortcut extends UIEvent + { + + function eventOnShortcut(param1:String) : Boolean; + } +} diff --git a/com/ankamagames/berilia/eventInterface/UIEvent.as b/com/ankamagames/berilia/eventInterface/UIEvent.as index b4696a98e..94eeb80ea 100644 --- a/com/ankamagames/berilia/eventInterface/UIEvent.as +++ b/com/ankamagames/berilia/eventInterface/UIEvent.as @@ -1,8 +1,6 @@ -package com.ankamagames.berilia.eventInterface +package com.ankamagames.berilia.eventInterface { - public interface UIEvent - { - - } -}//package com.ankamagames.berilia.eventInterface - + public interface UIEvent + { + } +} diff --git a/com/ankamagames/berilia/events/LinkInteractionEvent.as b/com/ankamagames/berilia/events/LinkInteractionEvent.as index 77c94e26d..a7c4e0961 100644 --- a/com/ankamagames/berilia/events/LinkInteractionEvent.as +++ b/com/ankamagames/berilia/events/LinkInteractionEvent.as @@ -1,21 +1,20 @@ -package com.ankamagames.berilia.events +package com.ankamagames.berilia.events { - import flash.events.Event; - - public class LinkInteractionEvent extends Event - { - - public static const ROLL_OVER:String = "RollOverLink"; - public static const ROLL_OUT:String = "RollOutLink"; - - public var text:String; - - public function LinkInteractionEvent(type:String, pText:String="") - { - this.text = pText; - super(type, false, false); - } - - } -}//package com.ankamagames.berilia.events - + import flash.events.Event; + + public class LinkInteractionEvent extends Event + { + + public function LinkInteractionEvent(param1:String, param2:String = "") + { + this.text = param2; + super(param1,false,false); + } + + public static const ROLL_OVER:String = "RollOverLink"; + + public static const ROLL_OUT:String = "RollOutLink"; + + public var text:String; + } +} diff --git a/com/ankamagames/berilia/factories/HyperlinkFactory.as b/com/ankamagames/berilia/factories/HyperlinkFactory.as index 0761b5f7d..b57c95bd1 100644 --- a/com/ankamagames/berilia/factories/HyperlinkFactory.as +++ b/com/ankamagames/berilia/factories/HyperlinkFactory.as @@ -1,292 +1,313 @@ -package com.ankamagames.berilia.factories +package com.ankamagames.berilia.factories { - import flash.utils.Dictionary; - import flash.text.StyleSheet; - import flash.utils.Timer; - import flash.text.TextField; - import flash.events.TextEvent; - import flash.events.EventDispatcher; - import com.ankamagames.berilia.events.LinkInteractionEvent; - import com.ankamagames.berilia.managers.HtmlManager; - import com.ankamagames.jerakine.data.XmlConfig; - import com.ankamagames.jerakine.utils.display.FrameIdManager; - import com.ankamagames.jerakine.utils.display.StageShareManager; - import com.ankamagames.berilia.frames.ShortcutsFrame; - import com.ankamagames.berilia.managers.KernelEventsManager; - import com.ankamagames.berilia.utils.BeriliaHookList; - import flash.events.TimerEvent; - - public class HyperlinkFactory - { - - private static var LEFT:String = "{"; - private static var RIGHT:String = "}"; - private static var SEPARATOR:String = "::"; - private static var PROTOCOL:Dictionary = new Dictionary(); - private static var PROTOCOL_TEXT:Dictionary = new Dictionary(); - private static var PROTOCOL_SHIFT:Dictionary = new Dictionary(); - private static var PROTOCOL_BOLD:Dictionary = new Dictionary(); - private static var PROTOCOL_ROLL_OVER:Dictionary = new Dictionary(); - private static var staticStyleSheet:StyleSheet; - public static var lastClickEventFrame:uint; - private static var _rollOverTimer:Timer; - private static var _rollOverData:String; - - - public static function protocolIsRegister(protocolName:String):Boolean - { - return (((PROTOCOL[protocolName]) ? true : false)); - } - - public static function textProtocolIsRegister(protocolName:String):Boolean - { - return (((PROTOCOL_TEXT[protocolName]) ? true : false)); - } - - public static function shiftProtocolIsRegister(protocolName:String):Boolean - { - return (((PROTOCOL_SHIFT[protocolName]) ? true : false)); - } - - public static function boldProtocolIsRegister(protocolName:String):Boolean - { - return (((PROTOCOL_BOLD[protocolName]) ? true : false)); - } - - public static function createTextClickHandler(component:EventDispatcher, styleSheet:Boolean=false):void - { - var t:TextField; - if ((component is TextField)) + import flash.utils.Dictionary; + import flash.text.StyleSheet; + import flash.events.EventDispatcher; + import flash.text.TextField; + import flash.events.TextEvent; + import com.ankamagames.berilia.events.LinkInteractionEvent; + import com.ankamagames.berilia.managers.HtmlManager; + import com.ankamagames.jerakine.data.XmlConfig; + import com.ankamagames.jerakine.utils.display.FrameIdManager; + import com.ankamagames.jerakine.utils.display.StageShareManager; + import com.ankamagames.berilia.frames.ShortcutsFrame; + import com.ankamagames.berilia.managers.KernelEventsManager; + import com.ankamagames.berilia.utils.BeriliaHookList; + import flash.utils.Timer; + import flash.events.TimerEvent; + + public class HyperlinkFactory extends Object + { + + public function HyperlinkFactory() + { + super(); + } + + private static var LEFT:String = "{"; + + private static var RIGHT:String = "}"; + + private static var SEPARATOR:String = "::"; + + private static var PROTOCOL:Dictionary = new Dictionary(); + + private static var PROTOCOL_TEXT:Dictionary = new Dictionary(); + + private static var PROTOCOL_SHIFT:Dictionary = new Dictionary(); + + private static var PROTOCOL_BOLD:Dictionary = new Dictionary(); + + private static var PROTOCOL_ROLL_OVER:Dictionary = new Dictionary(); + + private static var staticStyleSheet:StyleSheet; + + public static var lastClickEventFrame:uint; + + public static function protocolIsRegister(param1:String) : Boolean + { + return PROTOCOL[param1]?true:false; + } + + public static function textProtocolIsRegister(param1:String) : Boolean + { + return PROTOCOL_TEXT[param1]?true:false; + } + + public static function shiftProtocolIsRegister(param1:String) : Boolean + { + return PROTOCOL_SHIFT[param1]?true:false; + } + + public static function boldProtocolIsRegister(param1:String) : Boolean + { + return PROTOCOL_BOLD[param1]?true:false; + } + + public static function createTextClickHandler(param1:EventDispatcher, param2:Boolean = false) : void + { + var _loc3_:TextField = null; + if(param1 is TextField) + { + _loc3_ = param1 as TextField; + _loc3_.htmlText = decode(_loc3_.htmlText,true,param2?_loc3_:null); + _loc3_.mouseEnabled = true; + } + param1.addEventListener(TextEvent.LINK,processClick); + } + + public static function createRollOverHandler(param1:EventDispatcher) : void + { + param1.addEventListener(LinkInteractionEvent.ROLL_OVER,processRollOver); + param1.addEventListener(LinkInteractionEvent.ROLL_OUT,processRollOut); + } + + public static function activeSmallHyperlink(param1:TextField) : void + { + param1.addEventListener(TextEvent.LINK,processClick); + } + + public static function decode(param1:String, param2:Boolean = true, param3:TextField = null) : String + { + var _loc5_:* = 0; + var _loc6_:* = 0; + var _loc7_:String = null; + var _loc8_:String = null; + var _loc9_:String = null; + var _loc10_:Array = null; + var _loc11_:String = null; + var _loc12_:Array = null; + var _loc13_:String = null; + var _loc14_:String = null; + var _loc15_:String = null; + var _loc16_:* = 0; + var _loc17_:* = 0; + var _loc18_:String = null; + var _loc19_:Function = null; + var _loc20_:String = null; + var _loc21_:* = false; + var _loc22_:StyleSheet = null; + var _loc4_:String = param1; + while(true) + { + _loc5_ = _loc4_.indexOf(LEFT); + if(_loc5_ == -1) { - t = (component as TextField); - t.htmlText = decode(t.htmlText, true, ((styleSheet) ? t : null)); - t.mouseEnabled = true; - }; - component.addEventListener(TextEvent.LINK, processClick); - } - - public static function createRollOverHandler(component:EventDispatcher):void - { - component.addEventListener(LinkInteractionEvent.ROLL_OVER, processRollOver); - component.addEventListener(LinkInteractionEvent.ROLL_OUT, processRollOut); - } - - public static function activeSmallHyperlink(textField:TextField):void - { - textField.addEventListener(TextEvent.LINK, processClick); - } - - public static function decode(string:String, htmlMode:Boolean=true, textField:TextField=null):String - { - var leftIndex:int; - var rightIndex:int; - var leftBlock:String; - var rightBlock:String; - var middleBlock:String; - var linkInfo:Array; - var param:String; - var paramList:Array; - var protocolName:String; - var linkColor:String; - var hoverColor:String; - var i:int; - var nbParams:int; - var p:String; - var getTextFunction:Function; - var text:String; - var customStyleSheet:Boolean; - var styleSheet:StyleSheet; - var currentText:String = string; - while (true) + break; + } + _loc6_ = _loc4_.indexOf(RIGHT); + if(_loc6_ == -1) { - leftIndex = currentText.indexOf(LEFT); - if (leftIndex == -1) break; - rightIndex = currentText.indexOf(RIGHT); - if (rightIndex == -1) break; - if (leftIndex > rightIndex) break; - leftBlock = currentText.substring(0, leftIndex); - rightBlock = currentText.substring((rightIndex + 1)); - middleBlock = currentText.substring(leftIndex, rightIndex); - linkInfo = middleBlock.split("::"); - param = linkInfo[0].substr(1); - paramList = param.split(","); - protocolName = paramList.shift(); - nbParams = paramList.length; - i = 0; - while (i < nbParams) - { - p = paramList[i]; - if (p.indexOf("linkColor") != -1) - { - linkColor = p.split(":")[1]; - paramList.splice(i, 1); - i--; - nbParams--; - }; - if (p.indexOf("hoverColor") != -1) - { - hoverColor = p.split(":")[1]; - paramList.splice(i, 1); - i--; - nbParams--; - }; - i++; - }; - if (((linkColor) || (hoverColor))) - { - param = ((protocolName + ",") + paramList.join(",")); - }; - if (linkInfo.length == 1) - { - getTextFunction = PROTOCOL_TEXT[protocolName]; - if (getTextFunction != null) - { - linkInfo.push(getTextFunction.apply(getTextFunction, paramList)); - }; - }; - if (htmlMode) - { - text = linkInfo[1]; - if (PROTOCOL_BOLD[protocolName]) - { - text = HtmlManager.addTag(text, HtmlManager.BOLD); - }; - currentText = leftBlock; - currentText = (currentText + HtmlManager.addLink(text, ("event:" + param), null, true)); - currentText = (currentText + rightBlock); - if (textField) - { - customStyleSheet = ((linkColor) || (hoverColor)); - if (!(linkColor)) - { - linkColor = XmlConfig.getInstance().getEntry("colors.hyperlink.link"); - linkColor = linkColor.replace("0x", "#"); - }; - if (!(hoverColor)) - { - hoverColor = XmlConfig.getInstance().getEntry("colors.hyperlink.hover"); - hoverColor = hoverColor.replace("0x", "#"); - }; - if (!(customStyleSheet)) - { - if (!(staticStyleSheet)) - { - staticStyleSheet = new StyleSheet(); - }; - styleSheet = staticStyleSheet; - } - else - { - styleSheet = new StyleSheet(); - }; - if (styleSheet.styleNames.length == 0) - { - styleSheet.setStyle("a:link", {"color":linkColor}); - styleSheet.setStyle("a:hover", {"color":hoverColor}); - }; - textField.styleSheet = styleSheet; - }; - } - else - { - currentText = ((leftBlock + linkInfo[1]) + rightBlock); - }; - }; - return (currentText); - } - - public static function registerProtocol(name:String, callBack:Function, textCallBack:Function=null, shiftCallBack:Function=null, useBoldText:Boolean=true, rollOverCallback:Function=null):void - { - PROTOCOL[name] = callBack; - if (textCallBack != null) + break; + } + if(_loc5_ > _loc6_) { - PROTOCOL_TEXT[name] = textCallBack; - }; - if (shiftCallBack != null) + break; + } + _loc7_ = _loc4_.substring(0,_loc5_); + _loc8_ = _loc4_.substring(_loc6_ + 1); + _loc9_ = _loc4_.substring(_loc5_,_loc6_); + _loc10_ = _loc9_.split("::"); + _loc11_ = _loc10_[0].substr(1); + _loc12_ = _loc11_.split(","); + _loc13_ = _loc12_.shift(); + _loc17_ = _loc12_.length; + _loc16_ = 0; + while(_loc16_ < _loc17_) { - PROTOCOL_SHIFT[name] = shiftCallBack; - }; - if (useBoldText) + _loc18_ = _loc12_[_loc16_]; + if(_loc18_.indexOf("linkColor") != -1) + { + _loc14_ = _loc18_.split(":")[1]; + _loc12_.splice(_loc16_,1); + _loc16_--; + _loc17_--; + } + if(_loc18_.indexOf("hoverColor") != -1) + { + _loc15_ = _loc18_.split(":")[1]; + _loc12_.splice(_loc16_,1); + _loc16_--; + _loc17_--; + } + _loc16_++; + } + if((_loc14_) || (_loc15_)) { - PROTOCOL_BOLD[name] = true; - }; - if (rollOverCallback != null) + _loc11_ = _loc13_ + "," + _loc12_.join(","); + } + if(_loc10_.length == 1) { - PROTOCOL_ROLL_OVER[name] = rollOverCallback; - }; - } - - public static function processClick(event:TextEvent):void - { - var shiftCallBack:Function; - var _local_4:Function; - lastClickEventFrame = FrameIdManager.frameId; - StageShareManager.stage.focus = StageShareManager.stage; - var param:Array = event.text.split(","); - if (ShortcutsFrame.shiftKey) + _loc19_ = PROTOCOL_TEXT[_loc13_]; + if(_loc19_ != null) + { + _loc10_.push(_loc19_.apply(_loc19_,_loc12_)); + } + } + if(param2) { - shiftCallBack = PROTOCOL_SHIFT[param[0]]; - if (shiftCallBack == null) - { - KernelEventsManager.getInstance().processCallback(BeriliaHookList.ChatHyperlink, (("{" + param.join(",")) + "}")); - } - else - { - param.shift(); - shiftCallBack.apply(null, param); - }; + _loc20_ = _loc10_[1]; + if(PROTOCOL_BOLD[_loc13_]) + { + _loc20_ = HtmlManager.addTag(_loc20_,HtmlManager.BOLD); + } + _loc4_ = _loc7_; + _loc4_ = _loc4_ + HtmlManager.addLink(_loc20_,"event:" + _loc11_,null,true); + _loc4_ = _loc4_ + _loc8_; + if(param3) + { + _loc21_ = (_loc14_) || (_loc15_); + if(!_loc14_) + { + _loc14_ = XmlConfig.getInstance().getEntry("colors.hyperlink.link"); + _loc14_ = _loc14_.replace("0x","#"); + } + if(!_loc15_) + { + _loc15_ = XmlConfig.getInstance().getEntry("colors.hyperlink.hover"); + _loc15_ = _loc15_.replace("0x","#"); + } + if(!_loc21_) + { + if(!staticStyleSheet) + { + staticStyleSheet = new StyleSheet(); + } + _loc22_ = staticStyleSheet; + } + else + { + _loc22_ = new StyleSheet(); + } + if(_loc22_.styleNames.length == 0) + { + _loc22_.setStyle("a:link",{"color":_loc14_}); + _loc22_.setStyle("a:hover",{"color":_loc15_}); + } + param3.styleSheet = _loc22_; + } } else { - _local_4 = PROTOCOL[param.shift()]; - if (_local_4 != null) - { - _local_4.apply(null, param); - }; - }; - } - - public static function processRollOver(pEvt:LinkInteractionEvent):void - { - if (_rollOverTimer == null) + _loc4_ = _loc7_ + _loc10_[1] + _loc8_; + } + } + return _loc4_; + } + + public static function registerProtocol(param1:String, param2:Function, param3:Function = null, param4:Function = null, param5:Boolean = true, param6:Function = null) : void + { + PROTOCOL[param1] = param2; + if(param3 != null) + { + PROTOCOL_TEXT[param1] = param3; + } + if(param4 != null) + { + PROTOCOL_SHIFT[param1] = param4; + } + if(param5) + { + PROTOCOL_BOLD[param1] = true; + } + if(param6 != null) + { + PROTOCOL_ROLL_OVER[param1] = param6; + } + } + + public static function processClick(param1:TextEvent) : void + { + var _loc3_:Function = null; + var _loc4_:Function = null; + lastClickEventFrame = FrameIdManager.frameId; + StageShareManager.stage.focus = StageShareManager.stage; + var _loc2_:Array = param1.text.split(","); + if(ShortcutsFrame.shiftKey) + { + _loc3_ = PROTOCOL_SHIFT[_loc2_[0]]; + if(_loc3_ == null) { - _rollOverTimer = new Timer(800, 1); - _rollOverTimer.addEventListener(TimerEvent.TIMER_COMPLETE, onRollOverTimerComplete); + KernelEventsManager.getInstance().processCallback(BeriliaHookList.ChatHyperlink,"{" + _loc2_.join(",") + "}"); } else { - _rollOverTimer.reset(); - }; - _rollOverData = pEvt.text; - _rollOverTimer.start(); - } - - public static function processRollOut(pEvt:LinkInteractionEvent):void - { - if (_rollOverTimer != null) - { - _rollOverTimer.reset(); - }; - _rollOverData = null; - } - - private static function onRollOverTimerComplete(pEvt:TimerEvent):void - { - if (_rollOverData == null) - { - return; - }; - _rollOverTimer.stop(); - var param:Array = _rollOverData.split(","); - param[1] = StageShareManager.stage.mouseX; - var callback:Function = PROTOCOL_ROLL_OVER[param.shift()]; - if (callback != null) + _loc2_.shift(); + _loc3_.apply(null,_loc2_); + } + } + else + { + _loc4_ = PROTOCOL[_loc2_.shift()]; + if(_loc4_ != null) { - callback.apply(null, param); - }; - } - - - } -}//package com.ankamagames.berilia.factories - + _loc4_.apply(null,_loc2_); + } + } + } + + public static function processRollOver(param1:LinkInteractionEvent) : void + { + if(_rollOverTimer == null) + { + _rollOverTimer = new Timer(800,1); + _rollOverTimer.addEventListener(TimerEvent.TIMER_COMPLETE,onRollOverTimerComplete); + } + else + { + _rollOverTimer.reset(); + } + _rollOverData = param1.text; + _rollOverTimer.start(); + } + + public static function processRollOut(param1:LinkInteractionEvent) : void + { + if(_rollOverTimer != null) + { + _rollOverTimer.reset(); + } + _rollOverData = null; + } + + private static function onRollOverTimerComplete(param1:TimerEvent) : void + { + if(_rollOverData == null) + { + return; + } + _rollOverTimer.stop(); + var _loc2_:Array = _rollOverData.split(","); + _loc2_[1] = StageShareManager.stage.mouseX; + var _loc3_:Function = PROTOCOL_ROLL_OVER[_loc2_.shift()]; + if(_loc3_ != null) + { + _loc3_.apply(null,_loc2_); + } + } + + private static var _rollOverTimer:Timer; + + private static var _rollOverData:String; + } +} diff --git a/com/ankamagames/berilia/factories/MenusFactory.as b/com/ankamagames/berilia/factories/MenusFactory.as index 90c7dfbf5..84607c3af 100644 --- a/com/ankamagames/berilia/factories/MenusFactory.as +++ b/com/ankamagames/berilia/factories/MenusFactory.as @@ -1,85 +1,88 @@ -package com.ankamagames.berilia.factories +package com.ankamagames.berilia.factories { - import flash.utils.getQualifiedClassName; - import com.ankamagames.berilia.managers.SecureCenter; - import com.ankamagames.berilia.types.data.ContextMenuData; - - public class MenusFactory - { - - private static var _registeredMaker:Array = new Array(); - private static var _makerAssoc:Array = new Array(); - - - public static function registerMaker(makerName:String, maker:Class, scriptClass:Class=null):void - { - _registeredMaker[makerName] = new MenuData(maker, scriptClass); - } - - public static function registerAssoc(dataClass:*, makerName:String):void - { - _makerAssoc[getQualifiedClassName(dataClass)] = makerName; - } - - public static function unregister(dataType:Class, maker:Class):void - { - if (MenuData(_registeredMaker[getQualifiedClassName(dataType)]).maker === maker) - { - delete _registeredMaker[getQualifiedClassName(dataType)]; - }; - } - - public static function create(data:*, makerName:String=null, makerParam:Object=null):ContextMenuData - { - var td:MenuData; - var maker:*; - var tt:Array; - if (!(makerName)) - { - makerName = _makerAssoc[getQualifiedClassName(data)]; - }; - if (makerName) - { - td = _registeredMaker[makerName]; - }; - if (td) - { - maker = new (td.maker)(); - tt = maker.createMenu(SecureCenter.secure(data), SecureCenter.secure(makerParam)); - return (new ContextMenuData(data, makerName, tt)); - }; - if ((makerParam is Array)) - { - return (new ContextMenuData(data, makerName, (makerParam as Array))); - }; - return (null); - } - - public static function getMenuMaker(makerName:String):Object - { - return (_registeredMaker[makerName]); - } - - public static function existMakerAssoc(dataClass:*):Boolean - { - return (((_makerAssoc[getQualifiedClassName(dataClass)]) ? true : false)); - } - - - } -}//package com.ankamagames.berilia.factories - -class MenuData + import flash.utils.getQualifiedClassName; + import com.ankamagames.berilia.types.data.ContextMenuData; + import com.ankamagames.berilia.managers.SecureCenter; + + public class MenusFactory extends Object + { + + public function MenusFactory() + { + super(); + } + + private static var _registeredMaker:Array = new Array(); + + private static var _makerAssoc:Array = new Array(); + + public static function registerMaker(param1:String, param2:Class, param3:Class = null) : void + { + _registeredMaker[param1] = new MenuData(param2,param3); + } + + public static function registerAssoc(param1:*, param2:String) : void + { + _makerAssoc[getQualifiedClassName(param1)] = param2; + } + + public static function unregister(param1:Class, param2:Class) : void + { + if(MenuData(_registeredMaker[getQualifiedClassName(param1)]).maker === param2) + { + delete _registeredMaker[getQualifiedClassName(param1)]; + true; + } + } + + public static function create(param1:*, param2:String = null, param3:Object = null) : ContextMenuData + { + var _loc4_:MenuData = null; + var _loc5_:* = undefined; + var _loc6_:Array = null; + if(!param2) + { + var param2:String = _makerAssoc[getQualifiedClassName(param1)]; + } + if(param2) + { + _loc4_ = _registeredMaker[param2]; + } + if(_loc4_) + { + _loc5_ = new _loc4_.maker(); + _loc6_ = _loc5_.createMenu(SecureCenter.secure(param1),SecureCenter.secure(param3)); + return new ContextMenuData(param1,param2,_loc6_); + } + if(param3 is Array) + { + return new ContextMenuData(param1,param2,param3 as Array); + } + return null; + } + + public static function getMenuMaker(param1:String) : Object + { + return _registeredMaker[param1]; + } + + public static function existMakerAssoc(param1:*) : Boolean + { + return _makerAssoc[getQualifiedClassName(param1)]?true:false; + } + } +} +class MenuData extends Object { - - public var maker:Class; - public var scriptClass:Class; - - public function MenuData(maker:Class, scriptClass:Class) - { - this.maker = maker; - this.scriptClass = scriptClass; - } - + + function MenuData(param1:Class, param2:Class) + { + super(); + this.maker = param1; + this.scriptClass = param2; + } + + public var maker:Class; + + public var scriptClass:Class; } - diff --git a/com/ankamagames/berilia/factories/TooltipsFactory.as b/com/ankamagames/berilia/factories/TooltipsFactory.as index 97b16b81f..e95df6687 100644 --- a/com/ankamagames/berilia/factories/TooltipsFactory.as +++ b/com/ankamagames/berilia/factories/TooltipsFactory.as @@ -1,99 +1,102 @@ -package com.ankamagames.berilia.factories +package com.ankamagames.berilia.factories { - import flash.utils.getQualifiedClassName; - import com.ankamagames.berilia.types.tooltip.Tooltip; - import com.ankamagames.berilia.managers.SecureCenter; - import com.ankamagames.berilia.types.tooltip.EmptyTooltip; - import com.ankamagames.berilia.managers.TooltipManager; - - public class TooltipsFactory - { - - private static var _registeredMaker:Array = new Array(); - private static var _makerAssoc:Array = new Array(); - - - public static function registerMaker(makerName:String, maker:Class, scriptClass:Class=null):void - { - _registeredMaker[makerName] = new TooltipData(maker, scriptClass); - } - - public static function registerAssoc(dataClass:*, makerName:String):void - { - _makerAssoc[getQualifiedClassName(dataClass)] = makerName; - } - - public static function existRegisterMaker(makerName:String):Boolean - { - return (((_registeredMaker[makerName]) ? true : false)); - } - - public static function existMakerAssoc(dataClass:*):Boolean - { - return (((_makerAssoc[getQualifiedClassName(dataClass)]) ? true : false)); - } - - public static function unregister(dataType:Class, maker:Class):void - { - if (TooltipData(_registeredMaker[getQualifiedClassName(dataType)]).maker === maker) + import flash.utils.getQualifiedClassName; + import com.ankamagames.berilia.types.tooltip.Tooltip; + import com.ankamagames.berilia.managers.SecureCenter; + import com.ankamagames.berilia.types.tooltip.EmptyTooltip; + import com.ankamagames.berilia.managers.TooltipManager; + + public class TooltipsFactory extends Object + { + + public function TooltipsFactory() + { + super(); + } + + private static var _registeredMaker:Array = new Array(); + + private static var _makerAssoc:Array = new Array(); + + public static function registerMaker(param1:String, param2:Class, param3:Class = null) : void + { + _registeredMaker[param1] = new TooltipData(param2,param3); + } + + public static function registerAssoc(param1:*, param2:String) : void + { + _makerAssoc[getQualifiedClassName(param1)] = param2; + } + + public static function existRegisterMaker(param1:String) : Boolean + { + return _registeredMaker[param1]?true:false; + } + + public static function existMakerAssoc(param1:*) : Boolean + { + return _makerAssoc[getQualifiedClassName(param1)]?true:false; + } + + public static function unregister(param1:Class, param2:Class) : void + { + if(TooltipData(_registeredMaker[getQualifiedClassName(param1)]).maker === param2) + { + delete _registeredMaker[getQualifiedClassName(param1)]; + true; + } + } + + public static function create(param1:*, param2:String = null, param3:Class = null, param4:Object = null) : Tooltip + { + var _loc6_:* = undefined; + var _loc7_:Tooltip = null; + var _loc8_:Object = null; + if(!param2) + { + var param2:String = _makerAssoc[getQualifiedClassName(param1)]; + } + var _loc5_:TooltipData = _registeredMaker[param2]; + if(_loc5_) + { + _loc6_ = new _loc5_.maker(); + _loc8_ = _loc6_.createTooltip(SecureCenter.secure(param1),param4); + if(_loc8_ == "") { - delete _registeredMaker[getQualifiedClassName(dataType)]; - }; - } - - public static function create(data:*, makerName:String=null, script:Class=null, makerParam:Object=null):Tooltip - { - var maker:*; - var tt:Tooltip; - var toolt:Object; - if (!(makerName)) + _loc7_ = new EmptyTooltip(); + return _loc7_; + } + _loc7_ = _loc8_ as Tooltip; + if(_loc7_ == null) { - makerName = _makerAssoc[getQualifiedClassName(data)]; - }; - var td:TooltipData = _registeredMaker[makerName]; - if (td) + return null; + } + if(TooltipManager.defaultTooltipUiScript == param3) { - maker = new (td.maker)(); - toolt = maker.createTooltip(SecureCenter.secure(data), makerParam); - if (toolt == "") - { - tt = new EmptyTooltip(); - return (tt); - }; - tt = (toolt as Tooltip); - if (tt == null) - { - return (null); - }; - if (TooltipManager.defaultTooltipUiScript == script) - { - tt.scriptClass = ((td.scriptClass) ? td.scriptClass : script); - } - else - { - tt.scriptClass = script; - }; - tt.makerName = makerName; - return (tt); - }; - return (null); - } - - - } -}//package com.ankamagames.berilia.factories - -class TooltipData + _loc7_.scriptClass = _loc5_.scriptClass?_loc5_.scriptClass:param3; + } + else + { + _loc7_.scriptClass = param3; + } + _loc7_.makerName = param2; + return _loc7_; + } + return null; + } + } +} +class TooltipData extends Object { - - public var maker:Class; - public var scriptClass:Class; - - public function TooltipData(maker:Class, scriptClass:Class) - { - this.maker = maker; - this.scriptClass = scriptClass; - } - + + function TooltipData(param1:Class, param2:Class) + { + super(); + this.maker = param1; + this.scriptClass = param2; + } + + public var maker:Class; + + public var scriptClass:Class; } - diff --git a/com/ankamagames/berilia/frames/ShortcutsFrame.as b/com/ankamagames/berilia/frames/ShortcutsFrame.as index ab26393a3..ee2662add 100644 --- a/com/ankamagames/berilia/frames/ShortcutsFrame.as +++ b/com/ankamagames/berilia/frames/ShortcutsFrame.as @@ -1,262 +1,266 @@ -package com.ankamagames.berilia.frames +package com.ankamagames.berilia.frames { - import com.ankamagames.jerakine.messages.Frame; - import com.ankamagames.jerakine.logger.Logger; - import com.ankamagames.jerakine.logger.Log; - import flash.utils.getQualifiedClassName; - import __AS3__.vec.Vector; - import com.ankamagames.jerakine.types.enums.Priority; - import com.ankamagames.jerakine.handlers.messages.keyboard.KeyboardKeyDownMessage; - import com.ankamagames.berilia.types.shortcut.Shortcut; - import com.ankamagames.jerakine.handlers.messages.keyboard.KeyboardKeyUpMessage; - import flash.ui.Keyboard; - import com.ankamagames.jerakine.messages.Message; - import flash.text.TextField; - import com.ankamagames.berilia.managers.BindsManager; - import flash.system.IME; - import com.ankamagames.berilia.Berilia; - import com.ankamagames.jerakine.handlers.FocusHandler; - import com.ankamagames.berilia.components.Input; - import com.ankamagames.berilia.types.shortcut.Bind; - import com.ankamagames.berilia.managers.KernelEventsManager; - import com.ankamagames.berilia.utils.BeriliaHookList; - import com.ankamagames.jerakine.utils.display.StageShareManager; - import flash.text.TextFieldType; - import com.ankamagames.jerakine.replay.LogFrame; - import com.ankamagames.jerakine.replay.LogTypeEnum; - import com.ankamagames.jerakine.replay.KeyboardShortcut; - import com.ankamagames.jerakine.handlers.messages.keyboard.KeyboardMessage; - import flash.events.Event; - import com.ankamagames.jerakine.utils.system.AirScanner; - import __AS3__.vec.*; - - public class ShortcutsFrame implements Frame - { - - protected static const _log:Logger = Log.getLogger(getQualifiedClassName(ShortcutsFrame)); - public static var shiftKey:Boolean = false; - public static var ctrlKey:Boolean = false; - public static var altKey:Boolean = false; - public static var ctrlKeyDown:Boolean; - public static var altKeyDown:Boolean; - public static var shortcutsEnabled:Boolean = true; - - private var _lastCtrlKey:Boolean = false; - private var _isProcessingDirectInteraction:Boolean; - private var _heldShortcuts:Vector.; - - - public function get isProcessingDirectInteraction():Boolean - { - return (this._isProcessingDirectInteraction); - } - - public function get heldShortcuts():Vector. - { - return (this._heldShortcuts); - } - - public function get priority():int - { - return (Priority.NORMAL); - } - - public function process(msg:Message):Boolean - { - var _local_2:KeyboardKeyDownMessage; - var _local_3:Shortcut; - var _local_4:KeyboardKeyUpMessage; - this._isProcessingDirectInteraction = false; - if (!(shortcutsEnabled)) - { - return (false); - }; - switch (true) + import com.ankamagames.jerakine.messages.Frame; + import com.ankamagames.jerakine.logger.Logger; + import com.ankamagames.jerakine.logger.Log; + import flash.utils.getQualifiedClassName; + import com.ankamagames.jerakine.types.enums.Priority; + import com.ankamagames.jerakine.messages.Message; + import com.ankamagames.jerakine.handlers.messages.keyboard.KeyboardKeyDownMessage; + import com.ankamagames.berilia.types.shortcut.Shortcut; + import com.ankamagames.jerakine.handlers.messages.keyboard.KeyboardKeyUpMessage; + import flash.ui.Keyboard; + import com.ankamagames.jerakine.handlers.messages.keyboard.KeyboardMessage; + import flash.text.TextField; + import com.ankamagames.berilia.managers.BindsManager; + import com.ankamagames.jerakine.handlers.FocusHandler; + import com.ankamagames.berilia.Berilia; + import flash.system.IME; + import com.ankamagames.berilia.components.Input; + import com.ankamagames.berilia.types.shortcut.Bind; + import com.ankamagames.berilia.managers.KernelEventsManager; + import com.ankamagames.berilia.utils.BeriliaHookList; + import com.ankamagames.jerakine.utils.display.StageShareManager; + import flash.text.TextFieldType; + import com.ankamagames.jerakine.replay.LogFrame; + import com.ankamagames.jerakine.replay.LogTypeEnum; + import com.ankamagames.jerakine.replay.KeyboardShortcut; + import flash.events.Event; + import com.ankamagames.jerakine.utils.system.AirScanner; + + public class ShortcutsFrame extends Object implements Frame + { + + public function ShortcutsFrame() + { + super(); + } + + protected static const _log:Logger = Log.getLogger(getQualifiedClassName(ShortcutsFrame)); + + public static var shiftKey:Boolean = false; + + public static var ctrlKey:Boolean = false; + + public static var altKey:Boolean = false; + + public static var ctrlKeyDown:Boolean; + + public static var altKeyDown:Boolean; + + public static var shortcutsEnabled:Boolean = true; + + private var _lastCtrlKey:Boolean = false; + + private var _isProcessingDirectInteraction:Boolean; + + private var _heldShortcuts:Vector.; + + public function get isProcessingDirectInteraction() : Boolean + { + return this._isProcessingDirectInteraction; + } + + public function get heldShortcuts() : Vector. + { + return this._heldShortcuts; + } + + public function get priority() : int + { + return Priority.NORMAL; + } + + public function process(param1:Message) : Boolean + { + var _loc2_:KeyboardKeyDownMessage = null; + var _loc3_:Shortcut = null; + var _loc4_:KeyboardKeyUpMessage = null; + this._isProcessingDirectInteraction = false; + if(!shortcutsEnabled) + { + return false; + } + switch(true) + { + case param1 is KeyboardKeyDownMessage: + _loc2_ = KeyboardKeyDownMessage(param1); + shiftKey = _loc2_.keyboardEvent.shiftKey; + ctrlKey = _loc2_.keyboardEvent.ctrlKey; + altKey = _loc2_.keyboardEvent.altKey; + this._lastCtrlKey = false; + if(!ctrlKeyDown) + { + ctrlKeyDown = _loc2_.keyboardEvent.keyCode == Keyboard.CONTROL; + } + if(!altKeyDown) + { + altKeyDown = _loc2_.keyboardEvent.keyCode == Keyboard.ALTERNATE; + } + _loc3_ = this.getShortcut(_loc2_); + if((_loc3_) && (_loc3_.holdKeys) && this._heldShortcuts.indexOf(_loc3_.defaultBind.targetedShortcut) == -1) + { + this.handleMessage(_loc2_); + this._heldShortcuts.push(_loc3_.defaultBind.targetedShortcut); + } + return false; + case param1 is KeyboardKeyUpMessage: + _loc4_ = KeyboardKeyUpMessage(param1); + shiftKey = _loc4_.keyboardEvent.shiftKey; + ctrlKey = _loc4_.keyboardEvent.ctrlKey; + altKey = _loc4_.keyboardEvent.altKey; + switch(_loc4_.keyboardEvent.keyCode) + { + case Keyboard.CONTROL: + ctrlKeyDown = false; + break; + case Keyboard.ALTERNATE: + altKeyDown = false; + break; + } + return this.handleMessage(_loc4_); + default: + this._isProcessingDirectInteraction = false; + return false; + } + } + + private function handleMessage(param1:KeyboardMessage) : Boolean + { + var _loc4_:* = false; + var _loc7_:Shortcut = null; + var _loc8_:TextField = null; + var _loc9_:TextField = null; + var _loc10_:* = 0; + var _loc2_:int = param1.keyboardEvent.keyCode; + if(_loc2_ == Keyboard.CONTROL) + { + this._lastCtrlKey = true; + } + else if(this._lastCtrlKey) + { + this._lastCtrlKey = false; + return false; + } + + this._isProcessingDirectInteraction = true; + var _loc3_:String = BindsManager.getInstance().getShortcutString(param1.keyboardEvent.keyCode,this.getCharCode(param1)); + if(FocusHandler.getInstance().getFocus() is TextField && (Berilia.getInstance().useIME) && (IME.enabled)) + { + _loc8_ = FocusHandler.getInstance().getFocus() as TextField; + if(_loc8_.parent is Input) { - case (msg is KeyboardKeyDownMessage): - _local_2 = KeyboardKeyDownMessage(msg); - shiftKey = _local_2.keyboardEvent.shiftKey; - ctrlKey = _local_2.keyboardEvent.ctrlKey; - altKey = _local_2.keyboardEvent.altKey; - this._lastCtrlKey = false; - if (!(ctrlKeyDown)) - { - ctrlKeyDown = (_local_2.keyboardEvent.keyCode == Keyboard.CONTROL); - }; - if (!(altKeyDown)) - { - altKeyDown = (_local_2.keyboardEvent.keyCode == Keyboard.ALTERNATE); - }; - _local_3 = this.getShortcut(_local_2); - if (((((_local_3) && (_local_3.holdKeys))) && ((this._heldShortcuts.indexOf(_local_3.defaultBind.targetedShortcut) == -1)))) - { - this.handleMessage(_local_2); - this._heldShortcuts.push(_local_3.defaultBind.targetedShortcut); - }; - return (false); - case (msg is KeyboardKeyUpMessage): - _local_4 = KeyboardKeyUpMessage(msg); - shiftKey = _local_4.keyboardEvent.shiftKey; - ctrlKey = _local_4.keyboardEvent.ctrlKey; - altKey = _local_4.keyboardEvent.altKey; - switch (_local_4.keyboardEvent.keyCode) - { - case Keyboard.CONTROL: - ctrlKeyDown = false; - break; - case Keyboard.ALTERNATE: - altKeyDown = false; - break; - }; - return (this.handleMessage(_local_4)); - }; + _loc4_ = !(_loc8_.text == Input(_loc8_.parent).lastTextOnInput); + if(!_loc4_ && (Input(_loc8_.parent).imeActive)) + { + Input(_loc8_.parent).imeActive = false; + _loc4_ = true; + } + else + { + Input(_loc8_.parent).imeActive = _loc4_; + } + } + } + else + { + IME.enabled = false; + } + if(_loc3_ == null || (_loc4_)) + { this._isProcessingDirectInteraction = false; - return (false); - } - - private function handleMessage(pKeyboardMessage:KeyboardMessage):Boolean - { - var imeActive:Boolean; - var sh:Shortcut; - var tf:TextField; - var focusAsTextField:TextField; - var heldShortcutIndex:int; - var keyCode:int = pKeyboardMessage.keyboardEvent.keyCode; - if (keyCode == Keyboard.CONTROL) + return true; + } + var _loc5_:Bind = new Bind(_loc3_,"",param1.keyboardEvent.altKey,param1.keyboardEvent.ctrlKey,param1.keyboardEvent.shiftKey); + var _loc6_:Bind = BindsManager.getInstance().getBind(_loc5_); + if(_loc6_ != null) + { + _loc7_ = Shortcut.getShortcutByName(_loc6_.targetedShortcut); + } + if((BindsManager.getInstance().canBind(_loc5_)) && (!(_loc7_ == null) && !_loc7_.disable || _loc7_ == null)) + { + KernelEventsManager.getInstance().processCallback(BeriliaHookList.KeyboardShortcut,_loc5_,param1.keyboardEvent.keyCode); + } + if((!(_loc6_ == null)) && (_loc7_) && !_loc7_.disable) + { + if(!Shortcut.getShortcutByName(_loc6_.targetedShortcut)) { - this._lastCtrlKey = true; + return false; } - else - { - if (this._lastCtrlKey) - { - this._lastCtrlKey = false; - return (false); - }; - }; - this._isProcessingDirectInteraction = true; - var sShortcut:String = BindsManager.getInstance().getShortcutString(pKeyboardMessage.keyboardEvent.keyCode, this.getCharCode(pKeyboardMessage)); - if ((((((FocusHandler.getInstance().getFocus() is TextField)) && (Berilia.getInstance().useIME))) && (IME.enabled))) + if(_loc7_.holdKeys) { - tf = (FocusHandler.getInstance().getFocus() as TextField); - if ((tf.parent is Input)) - { - imeActive = !((tf.text == Input(tf.parent).lastTextOnInput)); - if (((!(imeActive)) && (Input(tf.parent).imeActive))) - { - Input(tf.parent).imeActive = false; - imeActive = true; - } - else - { - Input(tf.parent).imeActive = imeActive; - }; - }; + _loc10_ = this._heldShortcuts.indexOf(_loc7_.defaultBind.targetedShortcut); + if(_loc10_ != -1) + { + this._heldShortcuts.splice(_loc10_,1); + } } - else - { - IME.enabled = false; - }; - if ((((sShortcut == null)) || (imeActive))) - { - this._isProcessingDirectInteraction = false; - return (true); - }; - var bind:Bind = new Bind(sShortcut, "", pKeyboardMessage.keyboardEvent.altKey, pKeyboardMessage.keyboardEvent.ctrlKey, pKeyboardMessage.keyboardEvent.shiftKey); - var shortcut:Bind = BindsManager.getInstance().getBind(bind); - if (shortcut != null) - { - sh = Shortcut.getShortcutByName(shortcut.targetedShortcut); - }; - if (((BindsManager.getInstance().canBind(bind)) && (((((!((sh == null))) && (!(sh.disable)))) || ((sh == null)))))) + _loc9_ = StageShareManager.stage.focus as TextField; + if((_loc9_) && _loc9_.type == TextFieldType.INPUT) { - KernelEventsManager.getInstance().processCallback(BeriliaHookList.KeyboardShortcut, bind, pKeyboardMessage.keyboardEvent.keyCode); - }; - if (((((!((shortcut == null))) && (sh))) && (!(sh.disable)))) - { - if (!(Shortcut.getShortcutByName(shortcut.targetedShortcut))) - { - return (false); - }; - if (sh.holdKeys) - { - heldShortcutIndex = this._heldShortcuts.indexOf(sh.defaultBind.targetedShortcut); - if (heldShortcutIndex != -1) - { - this._heldShortcuts.splice(heldShortcutIndex, 1); - }; - }; - focusAsTextField = (StageShareManager.stage.focus as TextField); - if (((focusAsTextField) && ((focusAsTextField.type == TextFieldType.INPUT)))) - { - if (!(Shortcut.getShortcutByName(shortcut.targetedShortcut).textfieldEnabled)) - { - return (false); - }; - }; - LogFrame.log(LogTypeEnum.SHORTCUT, new KeyboardShortcut(shortcut.targetedShortcut)); - BindsManager.getInstance().processCallback(shortcut, shortcut.targetedShortcut); - }; - this._isProcessingDirectInteraction = false; - return (false); - } - - private function getShortcut(pKeyboardMessage:KeyboardMessage):Shortcut - { - var sShortcut:String = BindsManager.getInstance().getShortcutString(pKeyboardMessage.keyboardEvent.keyCode, this.getCharCode(pKeyboardMessage)); - var bind:Bind = BindsManager.getInstance().getBind(new Bind(sShortcut, "", pKeyboardMessage.keyboardEvent.altKey, pKeyboardMessage.keyboardEvent.ctrlKey, pKeyboardMessage.keyboardEvent.shiftKey)); - return (((bind) ? Shortcut.getShortcutByName(bind.targetedShortcut) : null)); - } - - private function getCharCode(pKeyboardMessage:KeyboardMessage):int - { - var charCode:int; - if (((pKeyboardMessage.keyboardEvent.shiftKey) && ((pKeyboardMessage.keyboardEvent.keyCode == 52)))) - { - charCode = 39; + if(!Shortcut.getShortcutByName(_loc6_.targetedShortcut).textfieldEnabled) + { + return false; + } } - else - { - if (((pKeyboardMessage.keyboardEvent.shiftKey) && ((pKeyboardMessage.keyboardEvent.keyCode == 54)))) - { - charCode = 45; - } - else - { - charCode = pKeyboardMessage.keyboardEvent.charCode; - }; - }; - return (charCode); - } - - private function onWindowDeactivate(pEvent:Event):void - { - this._heldShortcuts.length = 0; - shiftKey = (ctrlKey = (altKey = false)); - ctrlKeyDown = false; - altKeyDown = false; - } - - public function pushed():Boolean - { - this._heldShortcuts = new Vector.(0); - if (AirScanner.hasAir()) - { - StageShareManager.stage.nativeWindow.addEventListener(Event.DEACTIVATE, this.onWindowDeactivate); - }; - return (true); - } - - public function pulled():Boolean - { - if (AirScanner.hasAir()) - { - StageShareManager.stage.nativeWindow.removeEventListener(Event.DEACTIVATE, this.onWindowDeactivate); - }; - return (true); - } - - - } -}//package com.ankamagames.berilia.frames - + LogFrame.log(LogTypeEnum.SHORTCUT,new com.ankamagames.jerakine.replay.KeyboardShortcut(_loc6_.targetedShortcut)); + BindsManager.getInstance().processCallback(_loc6_,_loc6_.targetedShortcut); + } + this._isProcessingDirectInteraction = false; + return false; + } + + private function getShortcut(param1:KeyboardMessage) : Shortcut + { + var _loc2_:String = BindsManager.getInstance().getShortcutString(param1.keyboardEvent.keyCode,this.getCharCode(param1)); + var _loc3_:Bind = BindsManager.getInstance().getBind(new Bind(_loc2_,"",param1.keyboardEvent.altKey,param1.keyboardEvent.ctrlKey,param1.keyboardEvent.shiftKey)); + return _loc3_?Shortcut.getShortcutByName(_loc3_.targetedShortcut):null; + } + + private function getCharCode(param1:KeyboardMessage) : int + { + var _loc2_:* = 0; + if((param1.keyboardEvent.shiftKey) && param1.keyboardEvent.keyCode == 52) + { + _loc2_ = 39; + } + else if((param1.keyboardEvent.shiftKey) && param1.keyboardEvent.keyCode == 54) + { + _loc2_ = 45; + } + else + { + _loc2_ = param1.keyboardEvent.charCode; + } + + return _loc2_; + } + + private function onWindowDeactivate(param1:Event) : void + { + this._heldShortcuts.length = 0; + shiftKey = ctrlKey = altKey = false; + ctrlKeyDown = false; + altKeyDown = false; + } + + public function pushed() : Boolean + { + this._heldShortcuts = new Vector.(0); + if(AirScanner.hasAir()) + { + StageShareManager.stage.nativeWindow.addEventListener(Event.DEACTIVATE,this.onWindowDeactivate); + } + return true; + } + + public function pulled() : Boolean + { + if(AirScanner.hasAir()) + { + StageShareManager.stage.nativeWindow.removeEventListener(Event.DEACTIVATE,this.onWindowDeactivate); + } + return true; + } + } +} diff --git a/com/ankamagames/berilia/frames/UIInteractionFrame.as b/com/ankamagames/berilia/frames/UIInteractionFrame.as index 1f7bc4b50..1ae274305 100644 --- a/com/ankamagames/berilia/frames/UIInteractionFrame.as +++ b/com/ankamagames/berilia/frames/UIInteractionFrame.as @@ -1,529 +1,531 @@ -package com.ankamagames.berilia.frames +package com.ankamagames.berilia.frames { - import com.ankamagames.jerakine.messages.Frame; - import com.ankamagames.jerakine.logger.Logger; - import com.ankamagames.jerakine.logger.Log; - import flash.utils.getQualifiedClassName; - import flash.display.DisplayObject; - import com.ankamagames.jerakine.types.enums.Priority; - import com.ankamagames.jerakine.handlers.messages.FocusChangeMessage; - import com.ankamagames.berilia.types.graphic.UiRootContainer; - import com.ankamagames.berilia.components.Input; - import com.ankamagames.jerakine.handlers.messages.HumanInputMessage; - import com.ankamagames.berilia.components.Grid; - import com.ankamagames.berilia.components.messages.ComponentMessage; - import flash.geom.Point; - import com.ankamagames.jerakine.handlers.messages.keyboard.KeyboardKeyDownMessage; - import com.ankamagames.jerakine.handlers.messages.keyboard.KeyboardKeyUpMessage; - import com.ankamagames.berilia.UIComponent; - import com.ankamagames.jerakine.handlers.messages.mouse.MouseClickMessage; - import com.ankamagames.jerakine.handlers.messages.Action; - import com.ankamagames.berilia.types.event.InstanceEvent; - import com.ankamagames.berilia.Berilia; - import com.ankamagames.jerakine.utils.display.StageShareManager; - import com.ankamagames.berilia.managers.KernelEventsManager; - import com.ankamagames.berilia.utils.BeriliaHookList; - import com.ankamagames.berilia.managers.SecureCenter; - import com.ankamagames.jerakine.handlers.messages.mouse.MouseMiddleClickMessage; - import com.ankamagames.berilia.types.graphic.GraphicContainer; - import com.ankamagames.berilia.managers.UiSoundManager; - import com.ankamagames.berilia.enums.EventEnums; - import com.ankamagames.berilia.managers.UIEventManager; - import com.ankamagames.jerakine.handlers.messages.mouse.MouseDoubleClickMessage; - import com.ankamagames.jerakine.pools.GenericPool; - import flash.display.InteractiveObject; - import flash.events.MouseEvent; - import com.ankamagames.berilia.components.messages.ChangeMessage; - import com.ankamagames.berilia.components.messages.BrowserSessionTimeout; - import com.ankamagames.berilia.components.messages.BrowserDomReady; - import com.ankamagames.berilia.components.messages.ColorChangeMessage; - import com.ankamagames.berilia.components.messages.EntityReadyMessage; - import com.ankamagames.berilia.components.messages.SelectItemMessage; - import com.ankamagames.berilia.enums.SelectMethodEnum; - import com.ankamagames.berilia.components.messages.SelectEmptyItemMessage; - import com.ankamagames.berilia.components.messages.ItemRollOverMessage; - import com.ankamagames.berilia.components.messages.ItemRollOutMessage; - import com.ankamagames.berilia.components.messages.ItemRightClickMessage; - import com.ankamagames.berilia.components.messages.TextureReadyMessage; - import com.ankamagames.berilia.components.messages.TextureLoadFailMessage; - import com.ankamagames.berilia.components.messages.DropMessage; - import com.ankamagames.berilia.components.messages.CreateTabMessage; - import com.ankamagames.berilia.components.messages.DeleteTabMessage; - import com.ankamagames.berilia.components.messages.RenameTabMessage; - import com.ankamagames.berilia.api.ReadOnlyObject; - import com.ankamagames.berilia.components.messages.MapElementRollOverMessage; - import com.ankamagames.berilia.components.messages.MapElementRollOutMessage; - import com.ankamagames.berilia.components.messages.MapElementRightClickMessage; - import com.ankamagames.berilia.components.messages.MapMoveMessage; - import com.ankamagames.berilia.components.messages.MapRollOverMessage; - import com.ankamagames.berilia.components.messages.VideoConnectFailedMessage; - import com.ankamagames.berilia.components.messages.VideoConnectSuccessMessage; - import com.ankamagames.berilia.components.messages.VideoBufferChangeMessage; - import com.ankamagames.berilia.components.messages.ComponentReadyMessage; - import com.ankamagames.berilia.components.messages.TextClickMessage; - import com.ankamagames.jerakine.logger.ModuleLogger; - import com.ankamagames.jerakine.managers.ErrorManager; - import com.ankamagames.jerakine.messages.Message; - import flash.events.Event; - import com.ankamagames.jerakine.utils.system.AirScanner; - import com.ankamagames.jerakine.handlers.messages.mouse.MouseWheelMessage; - import com.ankamagames.jerakine.utils.misc.CallWithParameters; - import flash.utils.getTimer; - import flash.utils.setTimeout; - import com.ankamagames.jerakine.handlers.FocusHandler; - - public class UIInteractionFrame implements Frame - { - - protected static const _log:Logger = Log.getLogger(getQualifiedClassName(UIInteractionFrame)); - - private var hierarchy:Array; - private var currentDo:DisplayObject; - private var _isProcessingDirectInteraction:Boolean; - private var _warning:InputWarning; - private var _lastTs:uint = 0; - private var _lastW:uint; - private var _lastH:uint; - - - public function get priority():int - { - return (Priority.HIGHEST); - } - - public function get isProcessingDirectInteraction():Boolean - { - return (this._isProcessingDirectInteraction); - } - - public function process(msg:Message):Boolean - { - var _local_2:FocusChangeMessage; - var _local_3:UiRootContainer; - var _local_4:Input; - var _local_5:HumanInputMessage; - var _local_6:Boolean; - var _local_7:Boolean; - var _local_8:Grid; - var _local_9:Boolean; - var _local_10:ComponentMessage; - var inputPos:Point; - var kkdmsg:KeyboardKeyDownMessage; - var kkumsg:KeyboardKeyUpMessage; - var uic:UIComponent; - var res:Boolean; - var newMsg:MouseClickMessage; - var _local_17:UIComponent; - var uic4:UIComponent; - var act2:Action; - var targetFct:String; - var ie2:InstanceEvent; - var args:Array; - this._isProcessingDirectInteraction = false; - this.currentDo = null; - switch (true) - { - case (msg is FocusChangeMessage): - _local_2 = FocusChangeMessage(msg); - this.hierarchy = new Array(); - this.currentDo = _local_2.target; - while (this.currentDo != null) - { - if ((this.currentDo is UIComponent)) - { - this.hierarchy.unshift(this.currentDo); - }; - this.currentDo = this.currentDo.parent; - }; - _local_3 = (this.hierarchy[0] as UiRootContainer); - _local_4 = (this.hierarchy[(this.hierarchy.length - 1)] as Input); - if ((((((((this.hierarchy.length > 0)) && (_local_3))) && (_local_4))) && (!(_local_3.uiData.module.trusted)))) - { - if (!(this._warning)) - { - this._warning = new InputWarning(); - }; - Berilia.getInstance().docMain.addChild(this._warning); - this._warning.width = _local_4.width; - inputPos = _local_4.localToGlobal(new Point(_local_4.x, _local_4.y)); - this._warning.x = inputPos.x; - this._warning.y = ((inputPos.y - this._warning.height) - 4); - if (this._warning.y < 0) + import com.ankamagames.jerakine.messages.Frame; + import com.ankamagames.jerakine.logger.Logger; + import com.ankamagames.jerakine.logger.Log; + import flash.utils.getQualifiedClassName; + import com.ankamagames.jerakine.types.enums.Priority; + import flash.display.DisplayObject; + import com.ankamagames.jerakine.messages.Message; + import com.ankamagames.jerakine.handlers.messages.FocusChangeMessage; + import com.ankamagames.berilia.types.graphic.UiRootContainer; + import com.ankamagames.berilia.components.Input; + import com.ankamagames.jerakine.handlers.messages.HumanInputMessage; + import com.ankamagames.berilia.components.Grid; + import com.ankamagames.berilia.components.messages.ComponentMessage; + import flash.geom.Point; + import com.ankamagames.jerakine.handlers.messages.keyboard.KeyboardKeyDownMessage; + import com.ankamagames.jerakine.handlers.messages.keyboard.KeyboardKeyUpMessage; + import com.ankamagames.berilia.UIComponent; + import com.ankamagames.jerakine.handlers.messages.mouse.MouseClickMessage; + import com.ankamagames.jerakine.handlers.messages.Action; + import com.ankamagames.berilia.types.event.InstanceEvent; + import com.ankamagames.berilia.Berilia; + import com.ankamagames.jerakine.utils.display.StageShareManager; + import com.ankamagames.berilia.managers.KernelEventsManager; + import com.ankamagames.berilia.utils.BeriliaHookList; + import com.ankamagames.berilia.managers.SecureCenter; + import com.ankamagames.jerakine.handlers.messages.mouse.MouseMiddleClickMessage; + import com.ankamagames.berilia.types.graphic.GraphicContainer; + import com.ankamagames.berilia.managers.UiSoundManager; + import com.ankamagames.berilia.enums.EventEnums; + import com.ankamagames.berilia.managers.UIEventManager; + import com.ankamagames.jerakine.handlers.messages.mouse.MouseDoubleClickMessage; + import com.ankamagames.jerakine.pools.GenericPool; + import flash.display.InteractiveObject; + import flash.events.MouseEvent; + import com.ankamagames.berilia.components.messages.SelectItemMessage; + import com.ankamagames.berilia.enums.SelectMethodEnum; + import com.ankamagames.berilia.components.messages.SelectEmptyItemMessage; + import com.ankamagames.berilia.components.messages.ItemRollOverMessage; + import com.ankamagames.berilia.components.messages.ItemRollOutMessage; + import com.ankamagames.berilia.components.messages.ItemRightClickMessage; + import com.ankamagames.berilia.components.messages.DropMessage; + import com.ankamagames.berilia.components.messages.DeleteTabMessage; + import com.ankamagames.berilia.components.messages.RenameTabMessage; + import com.ankamagames.berilia.api.ReadOnlyObject; + import com.ankamagames.berilia.components.messages.MapElementRollOverMessage; + import com.ankamagames.berilia.components.messages.MapElementRollOutMessage; + import com.ankamagames.berilia.components.messages.MapElementRightClickMessage; + import com.ankamagames.berilia.components.messages.MapRollOverMessage; + import com.ankamagames.berilia.components.messages.VideoBufferChangeMessage; + import com.ankamagames.berilia.components.messages.TextClickMessage; + import com.ankamagames.berilia.components.messages.ChangeMessage; + import com.ankamagames.berilia.components.messages.BrowserSessionTimeout; + import com.ankamagames.berilia.components.messages.BrowserDomReady; + import com.ankamagames.berilia.components.messages.ColorChangeMessage; + import com.ankamagames.berilia.components.messages.EntityReadyMessage; + import com.ankamagames.berilia.components.messages.TextureReadyMessage; + import com.ankamagames.berilia.components.messages.TextureLoadFailMessage; + import com.ankamagames.berilia.components.messages.CreateTabMessage; + import com.ankamagames.berilia.components.messages.MapMoveMessage; + import com.ankamagames.berilia.components.messages.VideoConnectFailedMessage; + import com.ankamagames.berilia.components.messages.VideoConnectSuccessMessage; + import com.ankamagames.berilia.components.messages.ComponentReadyMessage; + import com.ankamagames.jerakine.logger.ModuleLogger; + import com.ankamagames.jerakine.managers.ErrorManager; + import flash.events.Event; + import com.ankamagames.jerakine.utils.system.AirScanner; + import com.ankamagames.jerakine.handlers.messages.mouse.MouseWheelMessage; + import com.ankamagames.jerakine.utils.misc.CallWithParameters; + import flash.utils.getTimer; + import flash.utils.setTimeout; + import com.ankamagames.jerakine.handlers.FocusHandler; + + public class UIInteractionFrame extends Object implements Frame + { + + public function UIInteractionFrame() + { + super(); + } + + protected static const _log:Logger = Log.getLogger(getQualifiedClassName(UIInteractionFrame)); + + public function get priority() : int + { + return Priority.HIGHEST; + } + + private var hierarchy:Array; + + private var currentDo:DisplayObject; + + private var _isProcessingDirectInteraction:Boolean; + + private var _warning:InputWarning; + + public function get isProcessingDirectInteraction() : Boolean + { + return this._isProcessingDirectInteraction; + } + + public function process(param1:Message) : Boolean + { + var _loc2_:FocusChangeMessage = null; + var _loc3_:UiRootContainer = null; + var _loc4_:Input = null; + var _loc5_:HumanInputMessage = null; + var _loc6_:* = false; + var _loc7_:* = false; + var _loc8_:Grid = null; + var _loc9_:* = false; + var _loc10_:ComponentMessage = null; + var _loc11_:Point = null; + var _loc12_:KeyboardKeyDownMessage = null; + var _loc13_:KeyboardKeyUpMessage = null; + var _loc14_:UIComponent = null; + var _loc15_:* = false; + var _loc16_:MouseClickMessage = null; + var _loc17_:UIComponent = null; + var _loc18_:UIComponent = null; + var _loc19_:Action = null; + var _loc20_:String = null; + var _loc21_:InstanceEvent = null; + var _loc22_:Array = null; + this._isProcessingDirectInteraction = false; + this.currentDo = null; + switch(true) + { + case param1 is FocusChangeMessage: + _loc2_ = FocusChangeMessage(param1); + this.hierarchy = new Array(); + this.currentDo = _loc2_.target; + while(this.currentDo != null) + { + if(this.currentDo is UIComponent) + { + this.hierarchy.unshift(this.currentDo); + } + this.currentDo = this.currentDo.parent; + } + _loc3_ = this.hierarchy[0] as UiRootContainer; + _loc4_ = this.hierarchy[this.hierarchy.length - 1] as Input; + if((this.hierarchy.length > 0 && _loc3_) && (_loc4_) && !_loc3_.uiData.module.trusted) + { + if(!this._warning) + { + this._warning = new InputWarning(); + } + Berilia.getInstance().docMain.addChild(this._warning); + this._warning.width = _loc4_.width; + _loc11_ = _loc4_.localToGlobal(new Point(_loc4_.x,_loc4_.y)); + this._warning.x = _loc11_.x; + this._warning.y = _loc11_.y - this._warning.height - 4; + if(this._warning.y < 0) + { + this._warning.y = _loc11_.y + _loc4_.height + 4; + } + if(this._warning.y + this._warning.height > StageShareManager.startHeight) + { + this._warning.y = (StageShareManager.startHeight - this._warning.height) / 2; + } + } + else if((this._warning) && (this._warning.parent)) + { + this._warning.parent.removeChild(this._warning); + } + + if(this.hierarchy.length > 0) + { + KernelEventsManager.getInstance().processCallback(BeriliaHookList.FocusChange,SecureCenter.secure(this.hierarchy[this.hierarchy.length - 1])); + } + else + { + KernelEventsManager.getInstance().processCallback(BeriliaHookList.FocusChange,null); + } + return true; + case param1 is HumanInputMessage: + this._isProcessingDirectInteraction = true; + _loc5_ = HumanInputMessage(param1); + this.hierarchy = new Array(); + this.currentDo = _loc5_.target; + while(this.currentDo != null) + { + if(this.currentDo is UIComponent) + { + this.hierarchy.push(this.currentDo); + } + this.currentDo = this.currentDo.parent; + } + if(param1 is MouseClickMessage) + { + KernelEventsManager.getInstance().processCallback(BeriliaHookList.MouseClick,SecureCenter.secure(MouseClickMessage(param1).target)); + if(!this.hierarchy[this.hierarchy.length - 1]) + { + KernelEventsManager.getInstance().processCallback(BeriliaHookList.FocusChange,SecureCenter.secure(MouseClickMessage(param1).target)); + } + } + if(param1 is MouseMiddleClickMessage) + { + KernelEventsManager.getInstance().processCallback(BeriliaHookList.MouseMiddleClick,SecureCenter.secure(MouseMiddleClickMessage(param1).target)); + } + if(param1 is KeyboardKeyDownMessage) + { + _loc12_ = KeyboardKeyDownMessage(param1); + KernelEventsManager.getInstance().processCallback(BeriliaHookList.KeyDown,SecureCenter.secure(_loc12_.target),_loc12_.keyboardEvent.keyCode); + } + if(param1 is KeyboardKeyUpMessage) + { + _loc13_ = KeyboardKeyUpMessage(param1); + KernelEventsManager.getInstance().processCallback(BeriliaHookList.KeyUp,SecureCenter.secure(_loc13_.target),_loc13_.keyboardEvent.keyCode); + } + _loc6_ = false; + _loc9_ = false; + for each(_loc14_ in this.hierarchy) + { + _loc7_ = UIComponent(_loc14_) is Grid; + if(!_loc6_ || (_loc7_)) + { + _loc15_ = UIComponent(_loc14_).process(_loc5_); + if(_loc15_) + { + if((_loc7_) && !_loc5_.canceled) { - this._warning.y = ((inputPos.y + _local_4.height) + 4); - }; - if ((this._warning.y + this._warning.height) > StageShareManager.startHeight) + _loc9_ = true; + _loc6_ = true; + } + else { - this._warning.y = ((StageShareManager.startHeight - this._warning.height) / 2); - }; - } - else - { - if (((this._warning) && (this._warning.parent))) + this.hierarchy = null; + this.currentDo = null; + this._isProcessingDirectInteraction = false; + return true; + } + } + } + if(!_loc8_ && (_loc7_)) + { + _loc8_ = Grid(_loc14_); + } + } + this.currentDo = _loc5_.target; + while(this.currentDo != null) + { + if(this.currentDo is GraphicContainer) + { + UiSoundManager.getInstance().fromUiElement(this.currentDo as GraphicContainer,EventEnums.convertMsgToFct(getQualifiedClassName(param1))); + } + if(UIEventManager.getInstance().isRegisteredInstance(this.currentDo,param1)) + { + _loc9_ = true; + this.processRegisteredUiEvent(param1,_loc8_); + break; + } + this.currentDo = this.currentDo.parent; + } + if(param1 is MouseClickMessage) + { + KernelEventsManager.getInstance().processCallback(BeriliaHookList.PostMouseClick,SecureCenter.secure(MouseClickMessage(param1).target)); + } + if(param1 is MouseDoubleClickMessage && !_loc9_) + { + _loc16_ = GenericPool.get(MouseClickMessage,_loc5_.target as InteractiveObject,new MouseEvent(MouseEvent.CLICK)); + Berilia.getInstance().handler.process(_loc16_); + } + this.hierarchy = null; + this.currentDo = null; + this._isProcessingDirectInteraction = false; + break; + case param1 is ComponentMessage: + _loc10_ = ComponentMessage(param1); + this.hierarchy = new Array(); + this.currentDo = _loc10_.target; + while(this.currentDo != null) + { + if(this.currentDo is UIComponent) + { + this.hierarchy.unshift(this.currentDo); + } + this.currentDo = this.currentDo.parent; + } + if(this.hierarchy.length == 0) + { + this._isProcessingDirectInteraction = false; + return false; + } + for each(_loc17_ in this.hierarchy) + { + UIComponent(_loc17_).process(_loc10_); + } + _loc10_.bubbling = true; + this.hierarchy.reverse(); + this.hierarchy.pop(); + for each(_loc18_ in this.hierarchy) + { + UIComponent(_loc18_).process(_loc10_); + } + this.hierarchy = null; + if(!_loc10_.canceled) + { + for each(_loc19_ in _loc10_.actions) + { + Berilia.getInstance().handler.process(_loc19_); + } + _loc20_ = EventEnums.convertMsgToFct(getQualifiedClassName(param1)); + UiSoundManager.getInstance().fromUiElement(_loc10_.target as GraphicContainer,_loc20_); + this.currentDo = _loc10_.target; + while(this.currentDo != null) + { + if((UIEventManager.getInstance().instances[this.currentDo]) && (UIEventManager.getInstance().instances[this.currentDo].events[getQualifiedClassName(param1)])) + { + _loc21_ = InstanceEvent(UIEventManager.getInstance().instances[this.currentDo]); + switch(true) { - this._warning.parent.removeChild(this._warning); - }; - }; - if (this.hierarchy.length > 0) - { - KernelEventsManager.getInstance().processCallback(BeriliaHookList.FocusChange, SecureCenter.secure(this.hierarchy[(this.hierarchy.length - 1)])); - } - else - { - KernelEventsManager.getInstance().processCallback(BeriliaHookList.FocusChange, null); - }; - return (true); - case (msg is HumanInputMessage): - this._isProcessingDirectInteraction = true; - _local_5 = HumanInputMessage(msg); - this.hierarchy = new Array(); - this.currentDo = _local_5.target; - while (this.currentDo != null) - { - if ((this.currentDo is UIComponent)) + case param1 is MouseMiddleClickMessage: + case param1 is ChangeMessage: + _loc22_ = [SecureCenter.secure(_loc21_.instance)]; + break; + case param1 is BrowserSessionTimeout: + _loc22_ = [SecureCenter.secure(_loc21_.instance)]; + break; + case param1 is BrowserDomReady: + _loc22_ = [SecureCenter.secure(_loc21_.instance)]; + break; + case param1 is ColorChangeMessage: + _loc22_ = [SecureCenter.secure(_loc21_.instance)]; + break; + case param1 is EntityReadyMessage: + _loc22_ = [SecureCenter.secure(_loc21_.instance)]; + break; + case param1 is SelectItemMessage: + if(!(SelectItemMessage(param1).selectMethod == SelectMethodEnum.MANUAL) && !(SelectItemMessage(param1).selectMethod == SelectMethodEnum.AUTO)) + { + this._isProcessingDirectInteraction = true; + } + _loc22_ = [SecureCenter.secure(_loc21_.instance),SelectItemMessage(param1).selectMethod,SelectItemMessage(param1).isNewSelection]; + break; + case param1 is SelectEmptyItemMessage: + if(!(SelectEmptyItemMessage(param1).selectMethod == SelectMethodEnum.MANUAL) && !(SelectEmptyItemMessage(param1).selectMethod == SelectMethodEnum.AUTO)) + { + this._isProcessingDirectInteraction = true; + } + _loc22_ = [SecureCenter.secure(_loc21_.instance),SelectEmptyItemMessage(param1).selectMethod]; + break; + case param1 is ItemRollOverMessage: + _loc22_ = [SecureCenter.secure(_loc21_.instance),ItemRollOverMessage(param1).item]; + break; + case param1 is ItemRollOutMessage: + _loc22_ = [SecureCenter.secure(_loc21_.instance),ItemRollOutMessage(param1).item]; + break; + case param1 is ItemRightClickMessage: + this._isProcessingDirectInteraction = true; + _loc22_ = [SecureCenter.secure(_loc21_.instance),ItemRightClickMessage(param1).item]; + break; + case param1 is TextureReadyMessage: + _loc22_ = [SecureCenter.secure(_loc21_.instance)]; + break; + case param1 is TextureLoadFailMessage: + _loc22_ = [SecureCenter.secure(_loc21_.instance)]; + break; + case param1 is DropMessage: + this._isProcessingDirectInteraction = true; + _loc22_ = [DropMessage(param1).target,DropMessage(param1).source]; + break; + case param1 is CreateTabMessage: + _loc22_ = [SecureCenter.secure(_loc21_.instance)]; + break; + case param1 is DeleteTabMessage: + _loc22_ = [SecureCenter.secure(_loc21_.instance),DeleteTabMessage(param1).deletedIndex]; + break; + case param1 is RenameTabMessage: + _loc22_ = [SecureCenter.secure(_loc21_.instance),RenameTabMessage(param1).index,RenameTabMessage(param1).name]; + break; + case param1 is MapElementRollOverMessage: + _loc22_ = [SecureCenter.secure(_loc21_.instance),ReadOnlyObject.create(MapElementRollOverMessage(param1).targetedElement)]; + break; + case param1 is MapElementRollOutMessage: + _loc22_ = [SecureCenter.secure(_loc21_.instance),ReadOnlyObject.create(MapElementRollOutMessage(param1).targetedElement)]; + break; + case param1 is MapElementRightClickMessage: + _loc22_ = [SecureCenter.secure(_loc21_.instance),ReadOnlyObject.create(MapElementRightClickMessage(param1).targetedElement)]; + break; + case param1 is MapMoveMessage: + _loc22_ = [SecureCenter.secure(_loc21_.instance)]; + break; + case param1 is MapRollOverMessage: + _loc22_ = [SecureCenter.secure(_loc21_.instance),MapRollOverMessage(param1).x,MapRollOverMessage(param1).y]; + break; + case param1 is VideoConnectFailedMessage: + _loc22_ = [SecureCenter.secure(_loc21_.instance)]; + break; + case param1 is VideoConnectSuccessMessage: + _loc22_ = [SecureCenter.secure(_loc21_.instance)]; + break; + case param1 is VideoBufferChangeMessage: + _loc22_ = [SecureCenter.secure(_loc21_.instance),VideoBufferChangeMessage(param1).state]; + break; + case param1 is ComponentReadyMessage: + _loc22_ = [SecureCenter.secure(_loc21_.instance)]; + break; + case param1 is TextClickMessage: + this._isProcessingDirectInteraction = true; + _loc22_ = [SecureCenter.secure(_loc21_.instance),(param1 as TextClickMessage).textEvent]; + break; + } + if(_loc22_) { - this.hierarchy.push(this.currentDo); - }; - this.currentDo = this.currentDo.parent; - }; - if ((msg is MouseClickMessage)) - { - KernelEventsManager.getInstance().processCallback(BeriliaHookList.MouseClick, SecureCenter.secure(MouseClickMessage(msg).target)); - if (!(this.hierarchy[(this.hierarchy.length - 1)])) - { - KernelEventsManager.getInstance().processCallback(BeriliaHookList.FocusChange, SecureCenter.secure(MouseClickMessage(msg).target)); - }; - }; - if ((msg is MouseMiddleClickMessage)) - { - KernelEventsManager.getInstance().processCallback(BeriliaHookList.MouseMiddleClick, SecureCenter.secure(MouseMiddleClickMessage(msg).target)); - }; - if ((msg is KeyboardKeyDownMessage)) - { - kkdmsg = KeyboardKeyDownMessage(msg); - KernelEventsManager.getInstance().processCallback(BeriliaHookList.KeyDown, SecureCenter.secure(kkdmsg.target), kkdmsg.keyboardEvent.keyCode); - }; - if ((msg is KeyboardKeyUpMessage)) - { - kkumsg = KeyboardKeyUpMessage(msg); - KernelEventsManager.getInstance().processCallback(BeriliaHookList.KeyUp, SecureCenter.secure(kkumsg.target), kkumsg.keyboardEvent.keyCode); - }; - _local_6 = false; - _local_9 = false; - for each (uic in this.hierarchy) - { - _local_7 = (UIComponent(uic) is Grid); - if (((!(_local_6)) || (_local_7))) - { - res = UIComponent(uic).process(_local_5); - if (res) - { - if (((_local_7) && (!(_local_5.canceled)))) - { - _local_9 = true; - _local_6 = true; - } - else - { - this.hierarchy = null; - this.currentDo = null; - this._isProcessingDirectInteraction = false; - return (true); - }; - }; - }; - if (((!(_local_8)) && (_local_7))) - { - _local_8 = Grid(uic); - }; - }; - this.currentDo = _local_5.target; - while (this.currentDo != null) - { - if ((this.currentDo is GraphicContainer)) - { - UiSoundManager.getInstance().fromUiElement((this.currentDo as GraphicContainer), EventEnums.convertMsgToFct(getQualifiedClassName(msg))); - }; - if (UIEventManager.getInstance().isRegisteredInstance(this.currentDo, msg)) - { - _local_9 = true; - this.processRegisteredUiEvent(msg, _local_8); - break; - }; - this.currentDo = this.currentDo.parent; - }; - if ((msg is MouseClickMessage)) - { - KernelEventsManager.getInstance().processCallback(BeriliaHookList.PostMouseClick, SecureCenter.secure(MouseClickMessage(msg).target)); - }; - if ((((msg is MouseDoubleClickMessage)) && (!(_local_9)))) - { - newMsg = GenericPool.get(MouseClickMessage, (_local_5.target as InteractiveObject), new MouseEvent(MouseEvent.CLICK)); - Berilia.getInstance().handler.process(newMsg); - }; - this.hierarchy = null; - this.currentDo = null; - this._isProcessingDirectInteraction = false; - break; - case (msg is ComponentMessage): - _local_10 = ComponentMessage(msg); - this.hierarchy = new Array(); - this.currentDo = _local_10.target; - while (this.currentDo != null) - { - if ((this.currentDo is UIComponent)) - { - this.hierarchy.unshift(this.currentDo); - }; - this.currentDo = this.currentDo.parent; - }; - if (this.hierarchy.length == 0) - { - this._isProcessingDirectInteraction = false; - return (false); - }; - for each (_local_17 in this.hierarchy) - { - UIComponent(_local_17).process(_local_10); - }; - _local_10.bubbling = true; - this.hierarchy.reverse(); - this.hierarchy.pop(); - for each (uic4 in this.hierarchy) - { - UIComponent(uic4).process(_local_10); - }; - this.hierarchy = null; - if (!(_local_10.canceled)) - { - for each (act2 in _local_10.actions) - { - Berilia.getInstance().handler.process(act2); - }; - targetFct = EventEnums.convertMsgToFct(getQualifiedClassName(msg)); - UiSoundManager.getInstance().fromUiElement((_local_10.target as GraphicContainer), targetFct); - this.currentDo = _local_10.target; - while (this.currentDo != null) - { - if (((UIEventManager.getInstance().instances[this.currentDo]) && (UIEventManager.getInstance().instances[this.currentDo].events[getQualifiedClassName(msg)]))) - { - ie2 = InstanceEvent(UIEventManager.getInstance().instances[this.currentDo]); - switch (true) - { - case (msg is MouseMiddleClickMessage): - case (msg is ChangeMessage): - args = [SecureCenter.secure(ie2.instance)]; - break; - case (msg is BrowserSessionTimeout): - args = [SecureCenter.secure(ie2.instance)]; - break; - case (msg is BrowserDomReady): - args = [SecureCenter.secure(ie2.instance)]; - break; - case (msg is ColorChangeMessage): - args = [SecureCenter.secure(ie2.instance)]; - break; - case (msg is EntityReadyMessage): - args = [SecureCenter.secure(ie2.instance)]; - break; - case (msg is SelectItemMessage): - if (((!((SelectItemMessage(msg).selectMethod == SelectMethodEnum.MANUAL))) && (!((SelectItemMessage(msg).selectMethod == SelectMethodEnum.AUTO))))) - { - this._isProcessingDirectInteraction = true; - }; - args = [SecureCenter.secure(ie2.instance), SelectItemMessage(msg).selectMethod, SelectItemMessage(msg).isNewSelection]; - break; - case (msg is SelectEmptyItemMessage): - if (((!((SelectEmptyItemMessage(msg).selectMethod == SelectMethodEnum.MANUAL))) && (!((SelectEmptyItemMessage(msg).selectMethod == SelectMethodEnum.AUTO))))) - { - this._isProcessingDirectInteraction = true; - }; - args = [SecureCenter.secure(ie2.instance), SelectEmptyItemMessage(msg).selectMethod]; - break; - case (msg is ItemRollOverMessage): - args = [SecureCenter.secure(ie2.instance), ItemRollOverMessage(msg).item]; - break; - case (msg is ItemRollOutMessage): - args = [SecureCenter.secure(ie2.instance), ItemRollOutMessage(msg).item]; - break; - case (msg is ItemRightClickMessage): - this._isProcessingDirectInteraction = true; - args = [SecureCenter.secure(ie2.instance), ItemRightClickMessage(msg).item]; - break; - case (msg is TextureReadyMessage): - args = [SecureCenter.secure(ie2.instance)]; - break; - case (msg is TextureLoadFailMessage): - args = [SecureCenter.secure(ie2.instance)]; - break; - case (msg is DropMessage): - this._isProcessingDirectInteraction = true; - args = [DropMessage(msg).target, DropMessage(msg).source]; - break; - case (msg is CreateTabMessage): - args = [SecureCenter.secure(ie2.instance)]; - break; - case (msg is DeleteTabMessage): - args = [SecureCenter.secure(ie2.instance), DeleteTabMessage(msg).deletedIndex]; - break; - case (msg is RenameTabMessage): - args = [SecureCenter.secure(ie2.instance), RenameTabMessage(msg).index, RenameTabMessage(msg).name]; - break; - case (msg is MapElementRollOverMessage): - args = [SecureCenter.secure(ie2.instance), ReadOnlyObject.create(MapElementRollOverMessage(msg).targetedElement)]; - break; - case (msg is MapElementRollOutMessage): - args = [SecureCenter.secure(ie2.instance), ReadOnlyObject.create(MapElementRollOutMessage(msg).targetedElement)]; - break; - case (msg is MapElementRightClickMessage): - args = [SecureCenter.secure(ie2.instance), ReadOnlyObject.create(MapElementRightClickMessage(msg).targetedElement)]; - break; - case (msg is MapMoveMessage): - args = [SecureCenter.secure(ie2.instance)]; - break; - case (msg is MapRollOverMessage): - args = [SecureCenter.secure(ie2.instance), MapRollOverMessage(msg).x, MapRollOverMessage(msg).y]; - break; - case (msg is VideoConnectFailedMessage): - args = [SecureCenter.secure(ie2.instance)]; - break; - case (msg is VideoConnectSuccessMessage): - args = [SecureCenter.secure(ie2.instance)]; - break; - case (msg is VideoBufferChangeMessage): - args = [SecureCenter.secure(ie2.instance), VideoBufferChangeMessage(msg).state]; - break; - case (msg is ComponentReadyMessage): - args = [SecureCenter.secure(ie2.instance)]; - break; - case (msg is TextClickMessage): - this._isProcessingDirectInteraction = true; - args = [SecureCenter.secure(ie2.instance), (msg as TextClickMessage).textEvent]; - break; - }; - if (args) - { - ModuleLogger.log(msg, ie2.instance); - args = SecureCenter.secureContent(args); - ErrorManager.tryFunction(GraphicContainer(ie2.instance).getUi().call, [ie2.callbackObject[targetFct], args, SecureCenter.ACCESS_KEY], ("Erreur lors du traitement de " + msg)); - this._isProcessingDirectInteraction = false; - return (true); - }; - break; - }; - this.currentDo = this.currentDo.parent; - }; - }; - break; - }; - this._isProcessingDirectInteraction = false; - return (false); - } - - public function pushed():Boolean - { - StageShareManager.stage.addEventListener(Event.RESIZE, this.onStageResize); - if (AirScanner.hasAir()) + ModuleLogger.log(param1,_loc21_.instance); + _loc22_ = SecureCenter.secureContent(_loc22_); + ErrorManager.tryFunction(GraphicContainer(_loc21_.instance).getUi().call,[_loc21_.callbackObject[_loc20_],_loc22_,SecureCenter.ACCESS_KEY],"Erreur lors du traitement de " + param1); + this._isProcessingDirectInteraction = false; + return true; + } + break; + } + this.currentDo = this.currentDo.parent; + } + } + break; + } + this._isProcessingDirectInteraction = false; + return false; + } + + public function pushed() : Boolean + { + StageShareManager.stage.addEventListener(Event.RESIZE,this.onStageResize); + if(AirScanner.hasAir()) + { + StageShareManager.stage.nativeWindow.addEventListener(Event.DEACTIVATE,this.onWindowDeactivate); + } + return true; + } + + public function pulled() : Boolean + { + StageShareManager.stage.removeEventListener(Event.RESIZE,this.onStageResize); + if(AirScanner.hasAir()) + { + StageShareManager.stage.nativeWindow.removeEventListener(Event.DEACTIVATE,this.onWindowDeactivate); + } + if((this._warning) && (this._warning.parent)) + { + this._warning.parent.removeChild(this._warning); + } + this._warning = null; + return true; + } + + private function processRegisteredUiEvent(param1:Message, param2:Grid) : void + { + var _loc5_:Array = null; + var _loc6_:String = null; + var _loc3_:InstanceEvent = InstanceEvent(UIEventManager.getInstance().instances[this.currentDo]); + var _loc4_:String = EventEnums.convertMsgToFct(getQualifiedClassName(param1)); + ModuleLogger.log(param1,_loc3_.instance); + if(param2) + { + if(param1 is MouseWheelMessage) { - StageShareManager.stage.nativeWindow.addEventListener(Event.DEACTIVATE, this.onWindowDeactivate); - }; - return (true); - } - - public function pulled():Boolean - { - StageShareManager.stage.removeEventListener(Event.RESIZE, this.onStageResize); - if (AirScanner.hasAir()) - { - StageShareManager.stage.nativeWindow.removeEventListener(Event.DEACTIVATE, this.onWindowDeactivate); - }; - if (((this._warning) && (this._warning.parent))) - { - this._warning.parent.removeChild(this._warning); - }; - this._warning = null; - return (true); - } - - private function processRegisteredUiEvent(msg:Message, gridInstance:Grid):void - { - var args:Array; - var fct:String; - var ie:InstanceEvent = InstanceEvent(UIEventManager.getInstance().instances[this.currentDo]); - var fctName:String = EventEnums.convertMsgToFct(getQualifiedClassName(msg)); - ModuleLogger.log(msg, ie.instance); - if (gridInstance) - { - if ((msg is MouseWheelMessage)) - { - args = [SecureCenter.secure(ie.instance), MouseWheelMessage(msg).mouseEvent.delta]; - } - else - { - args = [SecureCenter.secure(ie.instance)]; - }; - fct = gridInstance.renderer.eventModificator(msg, fctName, args, (ie.instance as UIComponent)); - ErrorManager.tryFunction(CallWithParameters.call, [ie.callbackObject[fctName], args], ("Erreur lors du traitement de " + msg)); + _loc5_ = [SecureCenter.secure(_loc3_.instance),MouseWheelMessage(param1).mouseEvent.delta]; } else { - if ((msg is MouseWheelMessage)) - { - ErrorManager.tryFunction(ie.callbackObject[fctName], [SecureCenter.secure(ie.instance), MouseWheelMessage(msg).mouseEvent.delta]); - } - else - { - ErrorManager.tryFunction(ie.callbackObject[fctName], [SecureCenter.secure(ie.instance)]); - }; - }; - } - - private function onStageResize(e:Event=null):void - { - if ((((this._lastW == StageShareManager.stage.stageWidth)) && ((this._lastH == StageShareManager.stage.stageHeight)))) - { - return; - }; - if ((getTimer() - this._lastTs) > 100) - { - this._lastTs = getTimer(); - this._lastW = StageShareManager.stage.stageWidth; - this._lastH = StageShareManager.stage.stageHeight; - KernelEventsManager.getInstance().processCallback(BeriliaHookList.WindowResize, this._lastW, this._lastH, StageShareManager.windowScale); - }; - setTimeout(this.onStageResize, 101); - } - - private function onWindowDeactivate(pEvent:Event):void - { - if (((Berilia.getInstance().docMain) && (Berilia.getInstance().docMain.stage))) - { - Berilia.getInstance().docMain.stage.focus = null; - FocusHandler.getInstance().setFocus(null); - }; - } - - - } -}//package com.ankamagames.berilia.frames - + _loc5_ = [SecureCenter.secure(_loc3_.instance)]; + } + _loc6_ = param2.renderer.eventModificator(param1,_loc4_,_loc5_,_loc3_.instance as UIComponent); + ErrorManager.tryFunction(CallWithParameters.call,[_loc3_.callbackObject[_loc4_],_loc5_],"Erreur lors du traitement de " + param1); + } + else if(param1 is MouseWheelMessage) + { + ErrorManager.tryFunction(_loc3_.callbackObject[_loc4_],[SecureCenter.secure(_loc3_.instance),MouseWheelMessage(param1).mouseEvent.delta]); + } + else + { + ErrorManager.tryFunction(_loc3_.callbackObject[_loc4_],[SecureCenter.secure(_loc3_.instance)]); + } + + } + + private var _lastTs:uint = 0; + + private var _lastW:uint; + + private var _lastH:uint; + + private function onStageResize(param1:Event = null) : void + { + if(this._lastW == StageShareManager.stage.stageWidth && this._lastH == StageShareManager.stage.stageHeight) + { + return; + } + if(getTimer() - this._lastTs > 100) + { + this._lastTs = getTimer(); + this._lastW = StageShareManager.stage.stageWidth; + this._lastH = StageShareManager.stage.stageHeight; + KernelEventsManager.getInstance().processCallback(BeriliaHookList.WindowResize,this._lastW,this._lastH,StageShareManager.windowScale); + } + setTimeout(this.onStageResize,101); + } + + private function onWindowDeactivate(param1:Event) : void + { + if((Berilia.getInstance().docMain) && (Berilia.getInstance().docMain.stage)) + { + Berilia.getInstance().docMain.stage.focus = null; + FocusHandler.getInstance().setFocus(null); + } + } + } +} import flash.text.TextField; import flash.text.TextFieldAutoSize; import flash.text.TextFormat; import com.ankamagames.jerakine.data.I18n; -class InputWarning extends TextField +class InputWarning extends TextField { - - public function InputWarning() - { - background = true; - backgroundColor = 7348259; - autoSize = TextFieldAutoSize.LEFT; - wordWrap = true; - defaultTextFormat = new TextFormat("Verdana", 12, 0xFFFFFF, true); - text = I18n.getUiText("ui.module.input.warning"); - } - + + function InputWarning() + { + super(); + background = true; + backgroundColor = 7348259; + autoSize = TextFieldAutoSize.LEFT; + wordWrap = true; + defaultTextFormat = new TextFormat("Verdana",12,16777215,true); + text = I18n.getUiText("ui.module.input.warning"); + } } - diff --git a/com/ankamagames/berilia/interfaces/IApi.as b/com/ankamagames/berilia/interfaces/IApi.as index 0e6f2784a..3442af3a9 100644 --- a/com/ankamagames/berilia/interfaces/IApi.as +++ b/com/ankamagames/berilia/interfaces/IApi.as @@ -1,8 +1,6 @@ -package com.ankamagames.berilia.interfaces +package com.ankamagames.berilia.interfaces { - public interface IApi - { - - } -}//package com.ankamagames.berilia.interfaces - + public interface IApi + { + } +} diff --git a/com/ankamagames/berilia/interfaces/IApplicationContainer.as b/com/ankamagames/berilia/interfaces/IApplicationContainer.as index 70273b354..2482179e7 100644 --- a/com/ankamagames/berilia/interfaces/IApplicationContainer.as +++ b/com/ankamagames/berilia/interfaces/IApplicationContainer.as @@ -1,8 +1,6 @@ -package com.ankamagames.berilia.interfaces +package com.ankamagames.berilia.interfaces { - public interface IApplicationContainer - { - - } -}//package com.ankamagames.berilia.interfaces - + public interface IApplicationContainer + { + } +} diff --git a/com/ankamagames/berilia/interfaces/IClonable.as b/com/ankamagames/berilia/interfaces/IClonable.as index a6b0e4fd5..6249d8c20 100644 --- a/com/ankamagames/berilia/interfaces/IClonable.as +++ b/com/ankamagames/berilia/interfaces/IClonable.as @@ -1,10 +1,8 @@ -package com.ankamagames.berilia.interfaces +package com.ankamagames.berilia.interfaces { - public interface IClonable - { - - function clone(); - - } -}//package com.ankamagames.berilia.interfaces - + public interface IClonable + { + + function clone() : *; + } +} diff --git a/com/ankamagames/berilia/interfaces/IGridRenderer.as b/com/ankamagames/berilia/interfaces/IGridRenderer.as index 7857b1f23..d04ee1663 100644 --- a/com/ankamagames/berilia/interfaces/IGridRenderer.as +++ b/com/ankamagames/berilia/interfaces/IGridRenderer.as @@ -1,22 +1,27 @@ -package com.ankamagames.berilia.interfaces +package com.ankamagames.berilia.interfaces { - import com.ankamagames.berilia.components.Grid; - import flash.display.DisplayObject; - import com.ankamagames.jerakine.messages.Message; - import com.ankamagames.berilia.UIComponent; - - public interface IGridRenderer - { - - function set grid(_arg_1:Grid):void; - function render(_arg_1:*, _arg_2:uint, _arg_3:Boolean, _arg_4:uint=0):DisplayObject; - function update(_arg_1:*, _arg_2:uint, _arg_3:DisplayObject, _arg_4:Boolean, _arg_5:uint=0):void; - function remove(_arg_1:DisplayObject):void; - function destroy():void; - function renderModificator(_arg_1:Array):Array; - function eventModificator(_arg_1:Message, _arg_2:String, _arg_3:Array, _arg_4:UIComponent):String; - function getDataLength(_arg_1:*, _arg_2:Boolean):uint; - - } -}//package com.ankamagames.berilia.interfaces - + import com.ankamagames.berilia.components.Grid; + import flash.display.DisplayObject; + import com.ankamagames.jerakine.messages.Message; + import com.ankamagames.berilia.UIComponent; + + public interface IGridRenderer + { + + function set grid(param1:Grid) : void; + + function render(param1:*, param2:uint, param3:Boolean, param4:uint = 0) : DisplayObject; + + function update(param1:*, param2:uint, param3:DisplayObject, param4:Boolean, param5:uint = 0) : void; + + function remove(param1:DisplayObject) : void; + + function destroy() : void; + + function renderModificator(param1:Array) : Array; + + function eventModificator(param1:Message, param2:String, param3:Array, param4:UIComponent) : String; + + function getDataLength(param1:*, param2:Boolean) : uint; + } +} diff --git a/com/ankamagames/berilia/interfaces/IMenuMaker.as b/com/ankamagames/berilia/interfaces/IMenuMaker.as index 154fe2025..1acf005dd 100644 --- a/com/ankamagames/berilia/interfaces/IMenuMaker.as +++ b/com/ankamagames/berilia/interfaces/IMenuMaker.as @@ -1,10 +1,8 @@ -package com.ankamagames.berilia.interfaces +package com.ankamagames.berilia.interfaces { - public interface IMenuMaker - { - - function createMenu(_arg_1:*, _arg_2:Object):Array; - - } -}//package com.ankamagames.berilia.interfaces - + public interface IMenuMaker + { + + function createMenu(param1:*, param2:Object) : Array; + } +} diff --git a/com/ankamagames/berilia/interfaces/IRadioItem.as b/com/ankamagames/berilia/interfaces/IRadioItem.as index 2fe41bdea..4b005b21b 100644 --- a/com/ankamagames/berilia/interfaces/IRadioItem.as +++ b/com/ankamagames/berilia/interfaces/IRadioItem.as @@ -1,14 +1,16 @@ -package com.ankamagames.berilia.interfaces +package com.ankamagames.berilia.interfaces { - public interface IRadioItem - { - - function get id():String; - function set value(_arg_1:*):void; - function get value(); - function set selected(_arg_1:Boolean):void; - function get selected():Boolean; - - } -}//package com.ankamagames.berilia.interfaces - + public interface IRadioItem + { + + function get id() : String; + + function set value(param1:*) : void; + + function get value() : *; + + function set selected(param1:Boolean) : void; + + function get selected() : Boolean; + } +} diff --git a/com/ankamagames/berilia/interfaces/ITooltipMaker.as b/com/ankamagames/berilia/interfaces/ITooltipMaker.as index c3667c624..4db307264 100644 --- a/com/ankamagames/berilia/interfaces/ITooltipMaker.as +++ b/com/ankamagames/berilia/interfaces/ITooltipMaker.as @@ -1,10 +1,8 @@ -package com.ankamagames.berilia.interfaces +package com.ankamagames.berilia.interfaces { - public interface ITooltipMaker - { - - function createTooltip(_arg_1:*, _arg_2:Object):Object; - - } -}//package com.ankamagames.berilia.interfaces - + public interface ITooltipMaker + { + + function createTooltip(param1:*, param2:Object) : Object; + } +} diff --git a/com/ankamagames/berilia/managers/BindsManager.as b/com/ankamagames/berilia/managers/BindsManager.as index a369afb08..5fa700f9f 100644 --- a/com/ankamagames/berilia/managers/BindsManager.as +++ b/com/ankamagames/berilia/managers/BindsManager.as @@ -1,727 +1,733 @@ -package com.ankamagames.berilia.managers +package com.ankamagames.berilia.managers { - import com.ankamagames.jerakine.resources.loaders.IResourceLoader; - import com.ankamagames.jerakine.utils.errors.SingletonError; - import com.ankamagames.jerakine.managers.StoreDataManager; - import com.ankamagames.berilia.BeriliaConstants; - import flash.filesystem.File; - import com.ankamagames.berilia.types.shortcut.Bind; - import com.ankamagames.jerakine.resources.loaders.ResourceLoaderFactory; - import com.ankamagames.jerakine.resources.loaders.ResourceLoaderType; - import com.ankamagames.jerakine.resources.events.ResourceLoadedEvent; - import com.ankamagames.jerakine.resources.events.ResourceErrorEvent; - import com.ankamagames.jerakine.resources.events.ResourceLoaderProgressEvent; - import com.ankamagames.jerakine.managers.LangManager; - import com.ankamagames.jerakine.types.Uri; - import com.ankamagames.berilia.enums.ShortcutsEnum; - import com.ankamagames.berilia.types.shortcut.Shortcut; - import com.ankamagames.berilia.utils.BeriliaHookList; - import com.ankamagames.berilia.types.listener.GenericListener; - import flash.text.TextField; - import com.ankamagames.berilia.types.graphic.UiRootContainer; - import com.ankamagames.jerakine.handlers.FocusHandler; - import com.ankamagames.berilia.components.Input; - import com.ankamagames.berilia.Berilia; - import com.ankamagames.jerakine.logger.ModuleLogger; - import com.ankamagames.berilia.utils.errors.ApiError; - import com.ankamagames.berilia.types.shortcut.LocalizedKeyboard; - import flash.ui.Keyboard; - import __AS3__.vec.Vector; - import __AS3__.vec.*; - - public class BindsManager extends GenericEventsManager - { - - private static var _self:BindsManager; - - private var _aRegisterKey:Array; - private var _loader:IResourceLoader; - private var _loaderKeyboard:IResourceLoader; - private var _availableKeyboards:Array; - private var _waitingBinds:Array; - private var _bindsToCheck:Array; - private var _shortcutsLoaded:Boolean; - private var _bindsLoaded:Boolean; - - public function BindsManager() - { - if (_self != null) - { - throw (new SingletonError("ShortcutsManager constructor should not be called directly.")); - }; + import com.ankamagames.jerakine.resources.loaders.IResourceLoader; + import com.ankamagames.jerakine.managers.StoreDataManager; + import com.ankamagames.berilia.BeriliaConstants; + import flash.filesystem.File; + import com.ankamagames.berilia.types.shortcut.Bind; + import com.ankamagames.jerakine.resources.loaders.ResourceLoaderFactory; + import com.ankamagames.jerakine.resources.loaders.ResourceLoaderType; + import com.ankamagames.jerakine.resources.events.ResourceLoadedEvent; + import com.ankamagames.jerakine.resources.events.ResourceErrorEvent; + import com.ankamagames.jerakine.resources.events.ResourceLoaderProgressEvent; + import com.ankamagames.jerakine.managers.LangManager; + import com.ankamagames.jerakine.types.Uri; + import com.ankamagames.berilia.enums.ShortcutsEnum; + import com.ankamagames.berilia.types.shortcut.Shortcut; + import com.ankamagames.berilia.utils.BeriliaHookList; + import com.ankamagames.berilia.types.listener.GenericListener; + import flash.text.TextField; + import com.ankamagames.berilia.types.graphic.UiRootContainer; + import com.ankamagames.jerakine.handlers.FocusHandler; + import com.ankamagames.berilia.components.Input; + import com.ankamagames.berilia.Berilia; + import com.ankamagames.jerakine.logger.ModuleLogger; + import com.ankamagames.berilia.utils.errors.ApiError; + import com.ankamagames.berilia.types.shortcut.LocalizedKeyboard; + import flash.ui.Keyboard; + import com.ankamagames.jerakine.utils.errors.SingletonError; + + public class BindsManager extends GenericEventsManager + { + + public function BindsManager() + { + super(); + if(_self != null) + { + throw new SingletonError("ShortcutsManager constructor should not be called directly."); + } + else + { _self = this; this._aRegisterKey = new Array(); this._availableKeyboards = new Array(); - } - - public static function getInstance():BindsManager - { - if (_self == null) - { - _self = new (BindsManager)(); - }; - return (_self); - } - - public static function destroy():void - { - if (_self != null) - { - _self = null; - }; - } - - - public function get availableKeyboards():Array - { - return (this._availableKeyboards); - } - - public function get currentLocale():String - { - return (StoreDataManager.getInstance().getData(BeriliaConstants.DATASTORE_BINDS, "locale")); - } - - override public function initialize():void - { - var file:File; - var s:Bind; - super.initialize(); - this._shortcutsLoaded = false; - this._bindsLoaded = false; - this._loader = ResourceLoaderFactory.getLoader(ResourceLoaderType.SERIAL_LOADER); - this._loader.addEventListener(ResourceLoadedEvent.LOADED, this.objectLoaded); - this._loader.addEventListener(ResourceErrorEvent.ERROR, this.objectLoadedFailed); - this._loaderKeyboard = ResourceLoaderFactory.getLoader(ResourceLoaderType.PARALLEL_LOADER); - this._loaderKeyboard.addEventListener(ResourceLoadedEvent.LOADED, this.keyboardFileLoaded); - this._loaderKeyboard.addEventListener(ResourceLoaderProgressEvent.LOADER_COMPLETE, this.keyboardFileAllLoaded); - this._loaderKeyboard.addEventListener(ResourceErrorEvent.ERROR, this.objectLoadedFailed); - StoreDataManager.getInstance().registerClass(new Bind()); - this._waitingBinds = new Array(); - this._aRegisterKey = StoreDataManager.getInstance().getSetData(BeriliaConstants.DATASTORE_BINDS, "registeredKeys", new Array()); - if (((this._aRegisterKey) && (!((this._aRegisterKey[0] is Bind))))) - { - this._aRegisterKey = new Array(); - }; - this.fillShortcutsEnum(); - var path:String = LangManager.getInstance().getEntry("config.binds.path.root").split("file://")[1]; - if (!(path)) - { - path = LangManager.getInstance().getEntry("config.binds.path.root"); - }; - var bindFilesPath:File = new File(((File.applicationDirectory.nativePath + File.separator) + path)); - bindFilesPath.createDirectory(); - var bindFiles:Array = bindFilesPath.getDirectoryListing(); - var uris:Array = new Array(); - for each (file in bindFiles) - { - if (((!(file.isDirectory)) && ((file.extension == "xml")))) - { - uris.push(new Uri(file.nativePath)); - }; - }; - this._loaderKeyboard.load(uris); - if (this._aRegisterKey.length == 0) - { - s = new Bind("ALL", "ALL", true, true, true); - this._aRegisterKey.push(s); - }; - } - - public function get binds():Array - { - return (this._aRegisterKey); - } - - public function getShortcutString(nKeyCode:uint, nCharCode:uint):String - { - if (ShortcutsEnum.BASIC_SHORTCUT_KEYCODE[nKeyCode] != null) - { - return (ShortcutsEnum.BASIC_SHORTCUT_KEYCODE[nKeyCode]); - }; - if (nCharCode == 0) - { - return (null); - }; - return (String.fromCharCode(nCharCode)); - } - - public function getBind(s:Bind, returnDisabled:Boolean=false):Bind - { - var b:Bind; - if (this._aRegisterKey == null) - { - return (null); - }; - var i:int = -1; - var num:int = this._aRegisterKey.length; - while (++i < num) - { - b = (this._aRegisterKey[i] as Bind); - if (((((b) && (b.equals(s)))) && (((returnDisabled) || (!(b.disabled)))))) - { - return (b); - }; - }; - return (null); - } - - public function isRegister(s:Bind):Boolean - { - var i:uint; - while (i < this._aRegisterKey.length) - { - if (((this._aRegisterKey[i]) && (this._aRegisterKey[i].equals(s)))) - { - return (true); - }; - i++; - }; - return (false); - } - - public function isPermanent(s:Bind):Boolean - { - var shortcut:Shortcut; - var i:uint; - while (i < this._aRegisterKey.length) - { - if (((this._aRegisterKey[i]) && (this._aRegisterKey[i].equals(s)))) - { - shortcut = Shortcut.getShortcutByName(this._aRegisterKey[i].targetedShortcut); - if (((!((shortcut == null))) && (!(shortcut.bindable)))) - { - return (true); - }; - }; - i++; - }; - return (false); - } - - public function isDisabled(s:Bind):Boolean - { - var b:Bind; - var i:uint; - while (i < this._aRegisterKey.length) - { - if (((this._aRegisterKey[i]) && (this._aRegisterKey[i].equals(s)))) - { - b = (this._aRegisterKey[i] as Bind); - return (b.disabled); - }; - i++; - }; - return (false); - } - - public function setDisabled(s:Bind, disabled:Boolean):void - { - var b:Bind; - var i:uint; - while (i < this._aRegisterKey.length) - { - if (((this._aRegisterKey[i]) && (this._aRegisterKey[i].equals(s)))) - { - b = (this._aRegisterKey[i] as Bind); - b.disabled = disabled; - return; - }; - i++; - }; - } - - public function isRegisteredName(s:String):Boolean - { - var i:uint; - while (i < this._aRegisterKey.length) - { - if (((this._aRegisterKey[i]) && ((this._aRegisterKey[i].targetedShortcut == s)))) - { - return (true); - }; - i++; - }; - return (false); - } - - public function canBind(s:Bind):Boolean - { - var i:uint; - while (i < ShortcutsEnum.BASIC_SHORTCUT_FORBIDDEN.length) - { - if (ShortcutsEnum.BASIC_SHORTCUT_FORBIDDEN[i].equals(s)) - { - return (false); - }; - i++; - }; - return (true); - } - - public function removeBind(b:Bind):void - { - var target:String; - var i:uint; - while (i < this._aRegisterKey.length) - { - if (((this._aRegisterKey[i]) && (this._aRegisterKey[i].equals(b)))) - { - target = Bind(this._aRegisterKey[i]).targetedShortcut; - Bind(this._aRegisterKey[i]).reset(); - StoreDataManager.getInstance().setData(BeriliaConstants.DATASTORE_BINDS, "registeredKeys", this._aRegisterKey, true); - KernelEventsManager.getInstance().processCallback(BeriliaHookList.ShortcutUpdate, target, null); - return; - }; - i++; - }; - } - - public function addBind(bind:Bind):void - { - if (!(this.canBind(bind))) - { - _log.warn((bind.toString() + " cannot be bind.")); - return; - }; - this.removeBind(bind); - var i:uint; - while (i < this._aRegisterKey.length) - { - if (((this._aRegisterKey[i]) && ((Bind(this._aRegisterKey[i]).targetedShortcut == bind.targetedShortcut)))) - { - this._aRegisterKey.splice(i, 1, bind); - StoreDataManager.getInstance().setData(BeriliaConstants.DATASTORE_BINDS, "registeredKeys", this._aRegisterKey, true); - KernelEventsManager.getInstance().processCallback(BeriliaHookList.ShortcutUpdate, bind.targetedShortcut, bind); - return; - }; - i++; - }; - this._aRegisterKey.push(bind); - StoreDataManager.getInstance().setData(BeriliaConstants.DATASTORE_BINDS, "registeredKeys", this._aRegisterKey, true); - KernelEventsManager.getInstance().processCallback(BeriliaHookList.ShortcutUpdate, bind.targetedShortcut, bind); - } - - public function isRegisteredShortcut(s:Bind, disableGenericBind:Boolean=false):Boolean - { - return (((!((_aEvent[s.targetedShortcut] == null))) || (((!(disableGenericBind)) && (_aEvent["ALL"]))))); - } - - public function getBindFromShortcut(shorcutName:String, returnDisabled:Boolean=false):Bind - { - var b:Bind; - for each (b in this._aRegisterKey) - { - if (((((b) && ((b.targetedShortcut == shorcutName)))) && (((returnDisabled) || (!(b.disabled)))))) - { - return (b); - }; - }; - return (null); - } - - public function processCallback(o:*, ... args):void - { - var e:GenericListener; - var aGe:Array; - var currentFocus:TextField; - var inputUi:UiRootContainer; - var modalUi:Boolean; - var i:uint; - var urc:UiRootContainer; - var result:*; - var s:Bind = Bind(o); - if (!(this.isRegisteredShortcut(s))) - { - return; - }; - var bContinue:Boolean = true; - if (_aEvent[s.targetedShortcut]) - { - aGe = _aEvent[s.targetedShortcut].concat(_aEvent["ALL"]); - aGe.sortOn("sortIndex", (Array.DESCENDING | Array.NUMERIC)); - currentFocus = (FocusHandler.getInstance().getFocus() as TextField); - if (((((currentFocus) && ((currentFocus.parent is Input)))) && (Input(currentFocus.parent).focusEventHandlerPriority))) - { - inputUi = Input(currentFocus.parent).getUi(); - modalUi = false; - i = 0; - while (i < aGe.length) - { - e = aGe[i]; - if (((((((e) && ((e.listenerType == GenericListener.LISTENER_TYPE_UI)))) && (e.listenerContext))) && (e.listenerContext.object))) - { - urc = UiRootContainer(e.listenerContext.object); - if (urc) - { - if (urc.modal) - { - modalUi = true; - }; - if ((((((inputUi == urc)) && (!(modalUi)))) || ((urc.modal == true)))) - { - aGe = aGe.splice(i, 1); - aGe.unshift(e); - }; - }; - }; - i++; - }; - }; - for each (e in aGe) - { - if (!(bContinue)) break; - if (e) - { - if (((Berilia.getInstance().getUi(e.listener)) && ((Berilia.getInstance().getUi(e.listener).depth < Berilia.getInstance().highestModalDepth)))) - { - return; - }; - _log.info(((("Dispatch " + args) + " to ") + e.listener)); - ModuleLogger.log(s, e.listener); - result = e.callback.apply(null, args); - if ((((result === null)) || (!((result is Boolean))))) - { - throw (new ApiError((e.callback + " does not return a Boolean value"))); - }; - bContinue = !(result); - }; - }; - }; - } - - public function reset():void - { - var bind:Bind; - var shortcut:Shortcut; - var nameIndexed:Array = new Array(); - for each (bind in this._aRegisterKey) - { - if (bind) - { - nameIndexed[bind.targetedShortcut] = bind; - }; - }; - for each (shortcut in Shortcut.getShortcuts()) - { - if ((((((nameIndexed[shortcut.name] == null)) || ((nameIndexed[shortcut.name].key == null)))) || (!((shortcut.defaultBind == nameIndexed[shortcut.name]))))) - { - if (shortcut.defaultBind) - { - this.addBind(shortcut.defaultBind.copy()); - } - else - { - this.removeBind(nameIndexed[shortcut.name]); - }; - }; - }; - } - - public function changeKeyboard(locale:String, removeOldBind:Boolean=false):void - { - var k:LocalizedKeyboard; - for each (k in this._availableKeyboards) - { - if (k.locale == locale) - { - StoreDataManager.getInstance().setData(BeriliaConstants.DATASTORE_BINDS, "locale", locale); - k.uri.tag = removeOldBind; - this._loader.load(k.uri); - break; - }; - }; - } - - public function getRegisteredBind(s:Bind):Bind - { - var i:uint; - while (i < this._aRegisterKey.length) - { - if (((this._aRegisterKey[i]) && (this._aRegisterKey[i].equals(s)))) - { - return (this._aRegisterKey[i]); - }; - i++; - }; - return (null); - } - - public function newShortcut(shortcut:Shortcut):void - { - var bind:Bind; - var b:Bind; - var i:int; - while (i < this._waitingBinds.length) - { - if (this._waitingBinds[i].targetedShortcut == shortcut.name) - { - bind = this._waitingBinds[i]; - break; - }; - i++; - }; - if (!(bind)) - { - return; - }; - this._waitingBinds.splice(i, 1); - if (!(this.canBind(bind))) - { - _log.warn((bind.toString() + " cannot be bind.")); - return; - }; - shortcut.defaultBind = bind.copy(); - if (this.isRegister(bind)) - { - return; - }; - for each (b in this._aRegisterKey) - { - if (((b) && ((b.targetedShortcut == bind.targetedShortcut)))) - { - return; - }; - }; - this._aRegisterKey.push(bind); - StoreDataManager.getInstance().setData(BeriliaConstants.DATASTORE_BINDS, "registeredKeys", this._aRegisterKey, true); - } - - public function checkBinds():void - { - var updateData:Boolean; - var o:Object; - this._shortcutsLoaded = true; - if (((((((this._shortcutsLoaded) && (this._bindsLoaded))) && (this._bindsToCheck))) && ((this._bindsToCheck.length > 0)))) - { - updateData = false; - for each (o in this._bindsToCheck) - { - if (!(Shortcut.getShortcutByName(o.bind.targetedShortcut))) - { - this._aRegisterKey.splice(o.index, 1, null); - updateData = true; - }; - }; - if (updateData) - { - StoreDataManager.getInstance().setData(BeriliaConstants.DATASTORE_BINDS, "registeredKeys", this._aRegisterKey, true); - }; - this._bindsToCheck.length = 0; - }; - } - - private function fillShortcutsEnum():void - { - var i:String; - ShortcutsEnum.BASIC_SHORTCUT_FORBIDDEN.push(new Bind("C", "", false, true)); - ShortcutsEnum.BASIC_SHORTCUT_FORBIDDEN.push(new Bind("V", "", false, true)); - ShortcutsEnum.BASIC_SHORTCUT_FORBIDDEN.push(new Bind("(F4)", "", true, false)); - ShortcutsEnum.BASIC_SHORTCUT_FORBIDDEN.push(new Bind("(del)", "", true, true)); - ShortcutsEnum.BASIC_SHORTCUT_FORBIDDEN.push(new Bind("(tab)", "", true)); - ShortcutsEnum.BASIC_SHORTCUT_FORBIDDEN.push(new Bind("(backspace)")); - ShortcutsEnum.BASIC_SHORTCUT_FORBIDDEN.push(new Bind("(insert)")); - ShortcutsEnum.BASIC_SHORTCUT_FORBIDDEN.push(new Bind("(del)")); - ShortcutsEnum.BASIC_SHORTCUT_FORBIDDEN.push(new Bind("(locknum)")); - ShortcutsEnum.BASIC_SHORTCUT_FORBIDDEN.push(new Bind("Z", "", false, true)); - ShortcutsEnum.BASIC_SHORTCUT_FORBIDDEN.push(new Bind("Y", "", false, true)); - ShortcutsEnum.BASIC_SHORTCUT_FORBIDDEN.push(new Bind("Z", "", false, true, true)); - ShortcutsEnum.BASIC_SHORTCUT_KEYCODE[Keyboard.ESCAPE] = "(escape)"; - ShortcutsEnum.BASIC_SHORTCUT_KEYCODE[Keyboard.ENTER] = "(enter)"; - ShortcutsEnum.BASIC_SHORTCUT_KEYCODE[Keyboard.TAB] = "(tab)"; - ShortcutsEnum.BASIC_SHORTCUT_KEYCODE[Keyboard.BACKSPACE] = "(backspace)"; - ShortcutsEnum.BASIC_SHORTCUT_KEYCODE[Keyboard.UP] = "(upArrow)"; - ShortcutsEnum.BASIC_SHORTCUT_KEYCODE[Keyboard.RIGHT] = "(rightArrow)"; - ShortcutsEnum.BASIC_SHORTCUT_KEYCODE[Keyboard.DOWN] = "(downArrow)"; - ShortcutsEnum.BASIC_SHORTCUT_KEYCODE[Keyboard.LEFT] = "(leftArrow)"; - ShortcutsEnum.BASIC_SHORTCUT_KEYCODE[Keyboard.SPACE] = "(space)"; - ShortcutsEnum.BASIC_SHORTCUT_KEYCODE[Keyboard.PAGE_UP] = "(pageUp)"; - ShortcutsEnum.BASIC_SHORTCUT_KEYCODE[Keyboard.PAGE_DOWN] = "(pageDown)"; - ShortcutsEnum.BASIC_SHORTCUT_KEYCODE[Keyboard.DELETE] = "(delete)"; - ShortcutsEnum.BASIC_SHORTCUT_KEYCODE[144] = "(numLock)"; - ShortcutsEnum.BASIC_SHORTCUT_KEYCODE[Keyboard.INSERT] = "(insert)"; - ShortcutsEnum.BASIC_SHORTCUT_KEYCODE[Keyboard.END] = "(end)"; - ShortcutsEnum.BASIC_SHORTCUT_KEYCODE[Keyboard.SHIFT] = "(shift)"; - ShortcutsEnum.BASIC_SHORTCUT_KEYCODE[Keyboard.F1] = "(F1)"; - ShortcutsEnum.BASIC_SHORTCUT_KEYCODE[Keyboard.F2] = "(F2)"; - ShortcutsEnum.BASIC_SHORTCUT_KEYCODE[Keyboard.F3] = "(F3)"; - ShortcutsEnum.BASIC_SHORTCUT_KEYCODE[Keyboard.F4] = "(F4)"; - ShortcutsEnum.BASIC_SHORTCUT_KEYCODE[Keyboard.F5] = "(F5)"; - ShortcutsEnum.BASIC_SHORTCUT_KEYCODE[Keyboard.F6] = "(F6)"; - ShortcutsEnum.BASIC_SHORTCUT_KEYCODE[Keyboard.F7] = "(F7)"; - ShortcutsEnum.BASIC_SHORTCUT_KEYCODE[Keyboard.F8] = "(F8)"; - ShortcutsEnum.BASIC_SHORTCUT_KEYCODE[Keyboard.F9] = "(F9)"; - ShortcutsEnum.BASIC_SHORTCUT_KEYCODE[Keyboard.F10] = "(F10)"; - ShortcutsEnum.BASIC_SHORTCUT_KEYCODE[Keyboard.F11] = "(F11)"; - ShortcutsEnum.BASIC_SHORTCUT_KEYCODE[Keyboard.F12] = "(F12)"; - for (i in ShortcutsEnum.BASIC_SHORTCUT_KEYCODE) - { - ShortcutsEnum.BASIC_SHORTCUT_NAME[ShortcutsEnum.BASIC_SHORTCUT_KEYCODE] = i; - }; - } - - private function parseBindsXml(sXml:String, removeOldbinds:Boolean):void - { - var s:Bind; - var shortcut:Shortcut; - var bind:Bind; - var init:Boolean; - var registeredKeys:Array; - var elementsToRemove:Vector.; - var xBind:XML; - var o:Object; - var i:uint; - var nbElementsToRemove:int; - var binds:XML = XML(sXml); - var nameIndexed:Array = new Array(); - for each (bind in this._aRegisterKey) - { - if (bind) - { - nameIndexed[bind.targetedShortcut] = bind; - }; - }; - init = (this._aRegisterKey.length > 1); - registeredKeys = new Array(); - if (init) - { - i = 0; - while (i < this._aRegisterKey.length) - { - if (((!(this._aRegisterKey[i])) || ((((this._aRegisterKey[i].targetedShortcut == "ALL")) && (!((i == (this._aRegisterKey.length - 1)))))))) - { - if (!(elementsToRemove)) - { - elementsToRemove = new Vector.(0); - }; - elementsToRemove.push(i); - }; - i++; - }; - nbElementsToRemove = ((elementsToRemove) ? elementsToRemove.length : 0); - i = 0; - while (i < nbElementsToRemove) - { - this._aRegisterKey.splice(elementsToRemove[i], 1); - i++; - }; - i = 0; - while (i < this._aRegisterKey.length) - { - if (this._aRegisterKey[i]) - { - registeredKeys[this._aRegisterKey[i].targetedShortcut] = { - "exist":((Shortcut.getShortcutByName(this._aRegisterKey[i].targetedShortcut)) ? true : false), - "bind":this._aRegisterKey[i], - "index":i - }; - }; - i++; - }; - }; - for each (xBind in binds..bind) - { - shortcut = Shortcut.getShortcutByName(xBind..@shortcut); - s = new Bind(xBind, xBind..@shortcut, (xBind..@alt == true), (xBind..@ctrl == true), (xBind..@shift == true)); - if (registeredKeys[s.targetedShortcut]) - { - registeredKeys[s.targetedShortcut].exist = true; - }; - if (!(shortcut)) - { - this._waitingBinds.push(s); - } - else - { - if (!(this.canBind(s))) - { - _log.warn((s.toString() + " cannot be bind.")); - } - else - { - shortcut.defaultBind = s.copy(); - if (this.isRegister(s)) + return; + } + } + + private static var _self:BindsManager; + + public static function getInstance() : BindsManager + { + if(_self == null) + { + _self = new BindsManager(); + } + return _self; + } + + public static function destroy() : void + { + if(_self != null) + { + _self = null; + } + } + + private var _aRegisterKey:Array; + + private var _loader:IResourceLoader; + + private var _loaderKeyboard:IResourceLoader; + + private var _availableKeyboards:Array; + + private var _waitingBinds:Array; + + private var _bindsToCheck:Array; + + private var _shortcutsLoaded:Boolean; + + private var _bindsLoaded:Boolean; + + public function get availableKeyboards() : Array + { + return this._availableKeyboards; + } + + public function get currentLocale() : String + { + return StoreDataManager.getInstance().getData(BeriliaConstants.DATASTORE_BINDS,"locale"); + } + + override public function initialize() : void + { + var _loc5_:File = null; + var _loc6_:Bind = null; + super.initialize(); + this._shortcutsLoaded = false; + this._bindsLoaded = false; + this._loader = ResourceLoaderFactory.getLoader(ResourceLoaderType.SERIAL_LOADER); + this._loader.addEventListener(ResourceLoadedEvent.LOADED,this.objectLoaded); + this._loader.addEventListener(ResourceErrorEvent.ERROR,this.objectLoadedFailed); + this._loaderKeyboard = ResourceLoaderFactory.getLoader(ResourceLoaderType.PARALLEL_LOADER); + this._loaderKeyboard.addEventListener(ResourceLoadedEvent.LOADED,this.keyboardFileLoaded); + this._loaderKeyboard.addEventListener(ResourceLoaderProgressEvent.LOADER_COMPLETE,this.keyboardFileAllLoaded); + this._loaderKeyboard.addEventListener(ResourceErrorEvent.ERROR,this.objectLoadedFailed); + StoreDataManager.getInstance().registerClass(new Bind()); + this._waitingBinds = new Array(); + this._aRegisterKey = StoreDataManager.getInstance().getSetData(BeriliaConstants.DATASTORE_BINDS,"registeredKeys",new Array()); + if((this._aRegisterKey) && !(this._aRegisterKey[0] is Bind)) + { + this._aRegisterKey = new Array(); + } + this.fillShortcutsEnum(); + var _loc1_:String = LangManager.getInstance().getEntry("config.binds.path.root").split("file://")[1]; + if(!_loc1_) + { + _loc1_ = LangManager.getInstance().getEntry("config.binds.path.root"); + } + var _loc2_:File = new File(File.applicationDirectory.nativePath + File.separator + _loc1_); + _loc2_.createDirectory(); + var _loc3_:Array = _loc2_.getDirectoryListing(); + var _loc4_:Array = new Array(); + for each(_loc5_ in _loc3_) + { + if(!_loc5_.isDirectory && _loc5_.extension == "xml") + { + _loc4_.push(new Uri(_loc5_.nativePath)); + } + } + this._loaderKeyboard.load(_loc4_); + if(this._aRegisterKey.length == 0) + { + _loc6_ = new Bind("ALL","ALL",true,true,true); + this._aRegisterKey.push(_loc6_); + } + } + + public function get binds() : Array + { + return this._aRegisterKey; + } + + public function getShortcutString(param1:uint, param2:uint) : String + { + if(ShortcutsEnum.BASIC_SHORTCUT_KEYCODE[param1] != null) + { + return ShortcutsEnum.BASIC_SHORTCUT_KEYCODE[param1]; + } + if(param2 == 0) + { + return null; + } + return String.fromCharCode(param2); + } + + public function getBind(param1:Bind, param2:Boolean = false) : Bind + { + var _loc5_:Bind = null; + if(this._aRegisterKey == null) + { + return null; + } + var _loc3_:* = -1; + var _loc4_:int = this._aRegisterKey.length; + while(++_loc3_ < _loc4_) + { + _loc5_ = this._aRegisterKey[_loc3_] as Bind; + if((_loc5_) && (_loc5_.equals(param1)) && ((param2) || !_loc5_.disabled)) + { + return _loc5_; + } + } + return null; + } + + public function isRegister(param1:Bind) : Boolean + { + var _loc2_:uint = 0; + while(_loc2_ < this._aRegisterKey.length) + { + if((this._aRegisterKey[_loc2_]) && (this._aRegisterKey[_loc2_].equals(param1))) + { + return true; + } + _loc2_++; + } + return false; + } + + public function isPermanent(param1:Bind) : Boolean + { + var _loc2_:Shortcut = null; + var _loc3_:uint = 0; + while(_loc3_ < this._aRegisterKey.length) + { + if((this._aRegisterKey[_loc3_]) && (this._aRegisterKey[_loc3_].equals(param1))) + { + _loc2_ = Shortcut.getShortcutByName(this._aRegisterKey[_loc3_].targetedShortcut); + if(!(_loc2_ == null) && !_loc2_.bindable) + { + return true; + } + } + _loc3_++; + } + return false; + } + + public function isDisabled(param1:Bind) : Boolean + { + var _loc3_:Bind = null; + var _loc2_:uint = 0; + while(_loc2_ < this._aRegisterKey.length) + { + if((this._aRegisterKey[_loc2_]) && (this._aRegisterKey[_loc2_].equals(param1))) + { + _loc3_ = this._aRegisterKey[_loc2_] as Bind; + return _loc3_.disabled; + } + _loc2_++; + } + return false; + } + + public function setDisabled(param1:Bind, param2:Boolean) : void + { + var _loc4_:Bind = null; + var _loc3_:uint = 0; + while(_loc3_ < this._aRegisterKey.length) + { + if((this._aRegisterKey[_loc3_]) && (this._aRegisterKey[_loc3_].equals(param1))) + { + _loc4_ = this._aRegisterKey[_loc3_] as Bind; + _loc4_.disabled = param2; + return; + } + _loc3_++; + } + } + + public function isRegisteredName(param1:String) : Boolean + { + var _loc2_:uint = 0; + while(_loc2_ < this._aRegisterKey.length) + { + if((this._aRegisterKey[_loc2_]) && this._aRegisterKey[_loc2_].targetedShortcut == param1) + { + return true; + } + _loc2_++; + } + return false; + } + + public function canBind(param1:Bind) : Boolean + { + var _loc2_:uint = 0; + while(_loc2_ < ShortcutsEnum.BASIC_SHORTCUT_FORBIDDEN.length) + { + if(ShortcutsEnum.BASIC_SHORTCUT_FORBIDDEN[_loc2_].equals(param1)) + { + return false; + } + _loc2_++; + } + return true; + } + + public function removeBind(param1:Bind) : void + { + var _loc3_:String = null; + var _loc2_:uint = 0; + while(_loc2_ < this._aRegisterKey.length) + { + if((this._aRegisterKey[_loc2_]) && (this._aRegisterKey[_loc2_].equals(param1))) + { + _loc3_ = Bind(this._aRegisterKey[_loc2_]).targetedShortcut; + Bind(this._aRegisterKey[_loc2_]).reset(); + StoreDataManager.getInstance().setData(BeriliaConstants.DATASTORE_BINDS,"registeredKeys",this._aRegisterKey,true); + KernelEventsManager.getInstance().processCallback(BeriliaHookList.ShortcutUpdate,_loc3_,null); + break; + } + _loc2_++; + } + } + + public function addBind(param1:Bind) : void + { + if(!this.canBind(param1)) + { + _log.warn(param1.toString() + " cannot be bind."); + return; + } + this.removeBind(param1); + var _loc2_:uint = 0; + while(_loc2_ < this._aRegisterKey.length) + { + if((this._aRegisterKey[_loc2_]) && Bind(this._aRegisterKey[_loc2_]).targetedShortcut == param1.targetedShortcut) + { + this._aRegisterKey.splice(_loc2_,1,param1); + StoreDataManager.getInstance().setData(BeriliaConstants.DATASTORE_BINDS,"registeredKeys",this._aRegisterKey,true); + KernelEventsManager.getInstance().processCallback(BeriliaHookList.ShortcutUpdate,param1.targetedShortcut,param1); + return; + } + _loc2_++; + } + this._aRegisterKey.push(param1); + StoreDataManager.getInstance().setData(BeriliaConstants.DATASTORE_BINDS,"registeredKeys",this._aRegisterKey,true); + KernelEventsManager.getInstance().processCallback(BeriliaHookList.ShortcutUpdate,param1.targetedShortcut,param1); + } + + public function isRegisteredShortcut(param1:Bind, param2:Boolean = false) : Boolean + { + return !(_aEvent[param1.targetedShortcut] == null) || !param2 && (_aEvent["ALL"]); + } + + public function getBindFromShortcut(param1:String, param2:Boolean = false) : Bind + { + var _loc3_:Bind = null; + for each(_loc3_ in this._aRegisterKey) + { + if((_loc3_) && (_loc3_.targetedShortcut == param1) && ((param2) || !_loc3_.disabled)) + { + return _loc3_; + } + } + return null; + } + + public function processCallback(param1:*, ... rest) : void + { + var _loc4_:GenericListener = null; + var _loc6_:Array = null; + var _loc7_:TextField = null; + var _loc8_:UiRootContainer = null; + var _loc9_:* = false; + var _loc10_:uint = 0; + var _loc11_:UiRootContainer = null; + var _loc12_:* = undefined; + var _loc3_:Bind = Bind(param1); + if(!this.isRegisteredShortcut(_loc3_)) + { + return; + } + var _loc5_:* = true; + if(_aEvent[_loc3_.targetedShortcut]) + { + _loc6_ = _aEvent[_loc3_.targetedShortcut].concat(_aEvent["ALL"]); + _loc6_.sortOn("sortIndex",Array.DESCENDING | Array.NUMERIC); + _loc7_ = FocusHandler.getInstance().getFocus() as TextField; + if((_loc7_) && (_loc7_.parent is Input) && (Input(_loc7_.parent).focusEventHandlerPriority)) + { + _loc8_ = Input(_loc7_.parent).getUi(); + _loc9_ = false; + _loc10_ = 0; + while(_loc10_ < _loc6_.length) + { + _loc4_ = _loc6_[_loc10_]; + if((_loc4_ && _loc4_.listenerType == GenericListener.LISTENER_TYPE_UI) && (_loc4_.listenerContext) && (_loc4_.listenerContext.object)) + { + _loc11_ = UiRootContainer(_loc4_.listenerContext.object); + if(_loc11_) + { + if(_loc11_.modal) { + _loc9_ = true; } - else + if(_loc8_ == _loc11_ && !_loc9_ || _loc11_.modal == true) { - if (nameIndexed[s.targetedShortcut]) - { - if (removeOldbinds) - { - this.addBind(s); - } - else - { - continue; - }; - } - else - { - if (!(init)) - { - this._aRegisterKey.push(s); - }; - }; - }; - }; - }; - }; - if (!(this._shortcutsLoaded)) - { - this._bindsToCheck = new Array(); - }; - for each (o in registeredKeys) + _loc6_ = _loc6_.splice(_loc10_,1); + _loc6_.unshift(_loc4_); + } + } + } + _loc10_++; + } + } + for each(_loc4_ in _loc6_) + { + if(!_loc5_) + { + break; + } + if((_loc4_) && !(_loc4_.callback == null)) + { + if((Berilia.getInstance().getUi(_loc4_.listener)) && Berilia.getInstance().getUi(_loc4_.listener).depth < Berilia.getInstance().highestModalDepth) + { + return; + } + _log.info("Dispatch " + rest + " to " + _loc4_.listener); + ModuleLogger.log(_loc3_,_loc4_.listener); + _loc12_ = _loc4_.callback.apply(null,rest); + if(_loc12_ === null || !(_loc12_ is Boolean)) + { + throw new ApiError(_loc4_.callback + " does not return a Boolean value"); + } + else + { + _loc5_ = !_loc12_; + continue; + } + } + else + { + continue; + } + break; + } + } + } + + public function reset() : void + { + var _loc2_:Bind = null; + var _loc3_:Shortcut = null; + var _loc1_:Array = new Array(); + for each(_loc2_ in this._aRegisterKey) + { + if(_loc2_) + { + _loc1_[_loc2_.targetedShortcut] = _loc2_; + } + } + for each(_loc3_ in Shortcut.getShortcuts()) + { + if(_loc1_[_loc3_.name] == null || _loc1_[_loc3_.name].key == null || !(_loc3_.defaultBind == _loc1_[_loc3_.name])) + { + if(_loc3_.defaultBind) + { + this.addBind(_loc3_.defaultBind.copy()); + } + else + { + this.removeBind(_loc1_[_loc3_.name]); + } + } + } + } + + public function changeKeyboard(param1:String, param2:Boolean = false) : void + { + var _loc3_:LocalizedKeyboard = null; + for each(_loc3_ in this._availableKeyboards) + { + if(_loc3_.locale == param1) + { + StoreDataManager.getInstance().setData(BeriliaConstants.DATASTORE_BINDS,"locale",param1); + _loc3_.uri.tag = param2; + this._loader.load(_loc3_.uri); + break; + } + } + } + + public function getRegisteredBind(param1:Bind) : Bind + { + var _loc2_:uint = 0; + while(_loc2_ < this._aRegisterKey.length) + { + if((this._aRegisterKey[_loc2_]) && (this._aRegisterKey[_loc2_].equals(param1))) + { + return this._aRegisterKey[_loc2_]; + } + _loc2_++; + } + return null; + } + + public function newShortcut(param1:Shortcut) : void + { + var _loc2_:Bind = null; + var _loc4_:Bind = null; + var _loc3_:* = 0; + while(_loc3_ < this._waitingBinds.length) + { + if(this._waitingBinds[_loc3_].targetedShortcut == param1.name) + { + _loc2_ = this._waitingBinds[_loc3_]; + break; + } + _loc3_++; + } + if(!_loc2_) + { + return; + } + this._waitingBinds.splice(_loc3_,1); + if(!this.canBind(_loc2_)) + { + _log.warn(_loc2_.toString() + " cannot be bind."); + return; + } + param1.defaultBind = _loc2_.copy(); + if(this.isRegister(_loc2_)) + { + return; + } + for each(_loc4_ in this._aRegisterKey) + { + if((_loc4_) && _loc4_.targetedShortcut == _loc2_.targetedShortcut) + { + return; + } + } + this._aRegisterKey.push(_loc2_); + StoreDataManager.getInstance().setData(BeriliaConstants.DATASTORE_BINDS,"registeredKeys",this._aRegisterKey,true); + } + + public function checkBinds() : void + { + var _loc1_:* = false; + var _loc2_:Object = null; + this._shortcutsLoaded = true; + if((this._shortcutsLoaded && this._bindsLoaded) && (this._bindsToCheck) && this._bindsToCheck.length > 0) + { + _loc1_ = false; + for each(_loc2_ in this._bindsToCheck) + { + if(!Shortcut.getShortcutByName(_loc2_.bind.targetedShortcut)) + { + this._aRegisterKey.splice(_loc2_.index,1,null); + _loc1_ = true; + } + } + if(_loc1_) { - if (((!(o.exist)) || (((this._shortcutsLoaded) && (!(Shortcut.getShortcutByName(o.bind.targetedShortcut))))))) - { - if (!(this._shortcutsLoaded)) - { - this._bindsToCheck.push(o); - } - else - { - this._aRegisterKey.splice(o.index, 1, null); - }; - }; - }; - this._bindsLoaded = true; - if (this._shortcutsLoaded) + StoreDataManager.getInstance().setData(BeriliaConstants.DATASTORE_BINDS,"registeredKeys",this._aRegisterKey,true); + } + this._bindsToCheck.length = 0; + } + } + + private function fillShortcutsEnum() : void + { + var _loc1_:String = null; + ShortcutsEnum.BASIC_SHORTCUT_FORBIDDEN.push(new Bind("C","",false,true)); + ShortcutsEnum.BASIC_SHORTCUT_FORBIDDEN.push(new Bind("V","",false,true)); + ShortcutsEnum.BASIC_SHORTCUT_FORBIDDEN.push(new Bind("(F4)","",true,false)); + ShortcutsEnum.BASIC_SHORTCUT_FORBIDDEN.push(new Bind("(del)","",true,true)); + ShortcutsEnum.BASIC_SHORTCUT_FORBIDDEN.push(new Bind("(tab)","",true)); + ShortcutsEnum.BASIC_SHORTCUT_FORBIDDEN.push(new Bind("(backspace)")); + ShortcutsEnum.BASIC_SHORTCUT_FORBIDDEN.push(new Bind("(insert)")); + ShortcutsEnum.BASIC_SHORTCUT_FORBIDDEN.push(new Bind("(del)")); + ShortcutsEnum.BASIC_SHORTCUT_FORBIDDEN.push(new Bind("(locknum)")); + ShortcutsEnum.BASIC_SHORTCUT_FORBIDDEN.push(new Bind("Z","",false,true)); + ShortcutsEnum.BASIC_SHORTCUT_FORBIDDEN.push(new Bind("Y","",false,true)); + ShortcutsEnum.BASIC_SHORTCUT_FORBIDDEN.push(new Bind("Z","",false,true,true)); + ShortcutsEnum.BASIC_SHORTCUT_KEYCODE[Keyboard.ESCAPE] = "(escape)"; + ShortcutsEnum.BASIC_SHORTCUT_KEYCODE[Keyboard.ENTER] = "(enter)"; + ShortcutsEnum.BASIC_SHORTCUT_KEYCODE[Keyboard.TAB] = "(tab)"; + ShortcutsEnum.BASIC_SHORTCUT_KEYCODE[Keyboard.BACKSPACE] = "(backspace)"; + ShortcutsEnum.BASIC_SHORTCUT_KEYCODE[Keyboard.UP] = "(upArrow)"; + ShortcutsEnum.BASIC_SHORTCUT_KEYCODE[Keyboard.RIGHT] = "(rightArrow)"; + ShortcutsEnum.BASIC_SHORTCUT_KEYCODE[Keyboard.DOWN] = "(downArrow)"; + ShortcutsEnum.BASIC_SHORTCUT_KEYCODE[Keyboard.LEFT] = "(leftArrow)"; + ShortcutsEnum.BASIC_SHORTCUT_KEYCODE[Keyboard.SPACE] = "(space)"; + ShortcutsEnum.BASIC_SHORTCUT_KEYCODE[Keyboard.PAGE_UP] = "(pageUp)"; + ShortcutsEnum.BASIC_SHORTCUT_KEYCODE[Keyboard.PAGE_DOWN] = "(pageDown)"; + ShortcutsEnum.BASIC_SHORTCUT_KEYCODE[Keyboard.DELETE] = "(delete)"; + ShortcutsEnum.BASIC_SHORTCUT_KEYCODE[144] = "(numLock)"; + ShortcutsEnum.BASIC_SHORTCUT_KEYCODE[Keyboard.INSERT] = "(insert)"; + ShortcutsEnum.BASIC_SHORTCUT_KEYCODE[Keyboard.END] = "(end)"; + ShortcutsEnum.BASIC_SHORTCUT_KEYCODE[Keyboard.SHIFT] = "(shift)"; + ShortcutsEnum.BASIC_SHORTCUT_KEYCODE[Keyboard.F1] = "(F1)"; + ShortcutsEnum.BASIC_SHORTCUT_KEYCODE[Keyboard.F2] = "(F2)"; + ShortcutsEnum.BASIC_SHORTCUT_KEYCODE[Keyboard.F3] = "(F3)"; + ShortcutsEnum.BASIC_SHORTCUT_KEYCODE[Keyboard.F4] = "(F4)"; + ShortcutsEnum.BASIC_SHORTCUT_KEYCODE[Keyboard.F5] = "(F5)"; + ShortcutsEnum.BASIC_SHORTCUT_KEYCODE[Keyboard.F6] = "(F6)"; + ShortcutsEnum.BASIC_SHORTCUT_KEYCODE[Keyboard.F7] = "(F7)"; + ShortcutsEnum.BASIC_SHORTCUT_KEYCODE[Keyboard.F8] = "(F8)"; + ShortcutsEnum.BASIC_SHORTCUT_KEYCODE[Keyboard.F9] = "(F9)"; + ShortcutsEnum.BASIC_SHORTCUT_KEYCODE[Keyboard.F10] = "(F10)"; + ShortcutsEnum.BASIC_SHORTCUT_KEYCODE[Keyboard.F11] = "(F11)"; + ShortcutsEnum.BASIC_SHORTCUT_KEYCODE[Keyboard.F12] = "(F12)"; + for(ShortcutsEnum.BASIC_SHORTCUT_NAME[ShortcutsEnum.BASIC_SHORTCUT_KEYCODE] in ShortcutsEnum.BASIC_SHORTCUT_KEYCODE) + { + } + } + + private function parseBindsXml(param1:String, param2:Boolean) : void + { + var _loc4_:Bind = null; + var _loc5_:Shortcut = null; + var _loc7_:Bind = null; + var _loc8_:* = false; + var _loc9_:Array = null; + var _loc10_:Vector. = null; + var _loc11_:XML = null; + var _loc12_:Object = null; + var _loc13_:uint = 0; + var _loc14_:* = 0; + var _loc3_:XML = XML(param1); + var _loc6_:Array = new Array(); + for each(_loc7_ in this._aRegisterKey) + { + if(_loc7_) + { + _loc6_[_loc7_.targetedShortcut] = _loc7_; + } + } + _loc8_ = this._aRegisterKey.length > 1; + _loc9_ = new Array(); + if(_loc8_) + { + _loc13_ = 0; + while(_loc13_ < this._aRegisterKey.length) + { + if(!this._aRegisterKey[_loc13_] || this._aRegisterKey[_loc13_].targetedShortcut == "ALL" && !(_loc13_ == this._aRegisterKey.length - 1)) + { + if(!_loc10_) + { + _loc10_ = new Vector.(0); + } + _loc10_.push(_loc13_); + } + _loc13_++; + } + _loc14_ = _loc10_?_loc10_.length:0; + _loc13_ = 0; + while(_loc13_ < _loc14_) { - StoreDataManager.getInstance().setData(BeriliaConstants.DATASTORE_BINDS, "registeredKeys", this._aRegisterKey, true); - }; - } - - public function objectLoaded(e:ResourceLoadedEvent):void - { - this.parseBindsXml(e.resource, e.uri.tag); - } - - public function keyboardFileLoaded(e:ResourceLoadedEvent):void - { - var xml:XML = XML(e.resource); - this._availableKeyboards.push(new LocalizedKeyboard(e.uri, xml.@locale, xml.@description)); - } - - public function keyboardFileAllLoaded(e:ResourceLoaderProgressEvent):void - { - var locale:String; - try + this._aRegisterKey.splice(_loc10_[_loc13_],1); + _loc13_++; + } + _loc13_ = 0; + while(_loc13_ < this._aRegisterKey.length) + { + if(this._aRegisterKey[_loc13_]) + { + _loc9_[this._aRegisterKey[_loc13_].targetedShortcut] = { + "exist":(Shortcut.getShortcutByName(this._aRegisterKey[_loc13_].targetedShortcut)?true:false), + "bind":this._aRegisterKey[_loc13_], + "index":_loc13_ + }; + } + _loc13_++; + } + } + for each(_loc11_ in _loc3_..bind) + { + _loc5_ = Shortcut.getShortcutByName(_loc11_..@shortcut); + _loc4_ = new Bind(_loc11_,_loc11_..@shortcut,_loc11_..@alt == true,_loc11_..@ctrl == true,_loc11_..@shift == true); + if(_loc9_[_loc4_.targetedShortcut]) + { + _loc9_[_loc4_.targetedShortcut].exist = true; + } + if(!_loc5_) { - locale = StoreDataManager.getInstance().getSetData(BeriliaConstants.DATASTORE_BINDS, "locale", LangManager.getInstance().getEntry("config.binds.current")); - this.changeKeyboard(locale); + this._waitingBinds.push(_loc4_); } - catch(e:Error) + else if(!this.canBind(_loc4_)) { - }; - } - - public function objectLoadedFailed(e:ResourceErrorEvent):void - { - _log.debug(((("objectLoadedFailed : " + e.uri) + ", ") + e.errorMsg)); - } - - - } -}//package com.ankamagames.berilia.managers - + _log.warn(_loc4_.toString() + " cannot be bind."); + } + else + { + _loc5_.defaultBind = _loc4_.copy(); + if(!this.isRegister(_loc4_)) + { + if(_loc6_[_loc4_.targetedShortcut]) + { + if(param2) + { + this.addBind(_loc4_); + } + } + else if(!_loc8_) + { + this._aRegisterKey.push(_loc4_); + } + + } + } + + } + if(!this._shortcutsLoaded) + { + this._bindsToCheck = new Array(); + } + for each(_loc12_ in _loc9_) + { + if(!_loc12_.exist || (this._shortcutsLoaded) && !Shortcut.getShortcutByName(_loc12_.bind.targetedShortcut)) + { + if(!this._shortcutsLoaded) + { + this._bindsToCheck.push(_loc12_); + } + else + { + this._aRegisterKey.splice(_loc12_.index,1,null); + } + } + } + this._bindsLoaded = true; + if(this._shortcutsLoaded) + { + StoreDataManager.getInstance().setData(BeriliaConstants.DATASTORE_BINDS,"registeredKeys",this._aRegisterKey,true); + } + } + + public function objectLoaded(param1:ResourceLoadedEvent) : void + { + this.parseBindsXml(param1.resource,param1.uri.tag); + } + + public function keyboardFileLoaded(param1:ResourceLoadedEvent) : void + { + var _loc2_:XML = XML(param1.resource); + this._availableKeyboards.push(new LocalizedKeyboard(param1.uri,_loc2_.@locale,_loc2_.@description)); + } + + public function keyboardFileAllLoaded(param1:ResourceLoaderProgressEvent) : void + { + var _loc2_:String = null; + try + { + _loc2_ = StoreDataManager.getInstance().getSetData(BeriliaConstants.DATASTORE_BINDS,"locale",LangManager.getInstance().getEntry("config.binds.current")); + this.changeKeyboard(_loc2_); + } + catch(e:Error) + { + } + } + + public function objectLoadedFailed(param1:ResourceErrorEvent) : void + { + _log.debug("objectLoadedFailed : " + param1.uri + ", " + param1.errorMsg); + } + } +} diff --git a/com/ankamagames/berilia/managers/CssManager.as b/com/ankamagames/berilia/managers/CssManager.as index cd0bd5828..dc094574c 100644 --- a/com/ankamagames/berilia/managers/CssManager.as +++ b/com/ankamagames/berilia/managers/CssManager.as @@ -1,309 +1,318 @@ -package com.ankamagames.berilia.managers +package com.ankamagames.berilia.managers { - import com.ankamagames.jerakine.logger.Logger; - import com.ankamagames.jerakine.logger.Log; - import flash.utils.getQualifiedClassName; - import com.ankamagames.jerakine.resources.loaders.IResourceLoader; - import com.ankamagames.jerakine.utils.errors.SingletonError; - import com.ankamagames.jerakine.resources.loaders.ResourceLoaderFactory; - import com.ankamagames.jerakine.resources.loaders.ResourceLoaderType; - import com.ankamagames.jerakine.resources.events.ResourceLoadedEvent; - import com.ankamagames.jerakine.resources.events.ResourceErrorEvent; - import com.ankamagames.jerakine.managers.StoreDataManager; - import com.ankamagames.berilia.BeriliaConstants; - import com.ankamagames.jerakine.types.Uri; - import com.ankamagames.jerakine.types.Callback; - import com.ankamagames.berilia.types.data.ExtendedStyleSheet; - import flash.text.StyleSheet; - import com.ankamagames.berilia.types.event.CssEvent; - import com.ankamagames.jerakine.managers.ErrorManager; - - public class CssManager - { - - protected static const _log:Logger = Log.getLogger(getQualifiedClassName(CssManager)); - private static const CSS_ARRAY_KEY:String = "cssFilesContents"; - private static var _self:CssManager; - private static var _useCache:Boolean = true; - - private var _aCss:Array; - private var _aWaiting:Array; - private var _aMultiWaiting:Array; - private var _loader:IResourceLoader; - private var _aLoadingFile:Array; - - public function CssManager() - { - if (_self) - { - throw (new SingletonError()); - }; + import com.ankamagames.jerakine.logger.Logger; + import com.ankamagames.jerakine.managers.StoreDataManager; + import com.ankamagames.berilia.BeriliaConstants; + import com.ankamagames.jerakine.logger.Log; + import flash.utils.getQualifiedClassName; + import com.ankamagames.jerakine.resources.loaders.IResourceLoader; + import com.ankamagames.jerakine.types.Uri; + import com.ankamagames.jerakine.types.Callback; + import com.ankamagames.berilia.types.data.ExtendedStyleSheet; + import flash.text.StyleSheet; + import com.ankamagames.berilia.types.event.CssEvent; + import com.ankamagames.jerakine.resources.events.ResourceLoadedEvent; + import com.ankamagames.jerakine.resources.events.ResourceErrorEvent; + import com.ankamagames.jerakine.managers.ErrorManager; + import com.ankamagames.jerakine.utils.errors.SingletonError; + import com.ankamagames.jerakine.resources.loaders.ResourceLoaderFactory; + import com.ankamagames.jerakine.resources.loaders.ResourceLoaderType; + + public class CssManager extends Object + { + + public function CssManager() + { + super(); + if(_self) + { + throw new SingletonError(); + } + else + { this._aCss = new Array(); this._aWaiting = new Array(); this._aMultiWaiting = new Array(); this._aLoadingFile = new Array(); this._loader = ResourceLoaderFactory.getLoader(ResourceLoaderType.PARALLEL_LOADER); - this._loader.addEventListener(ResourceLoadedEvent.LOADED, this.complete); - this._loader.addEventListener(ResourceErrorEvent.ERROR, this.error); - } - - public static function getInstance():CssManager - { - if (!(_self)) - { - _self = new (CssManager)(); - }; - return (_self); - } - - public static function set useCache(b:Boolean):void - { - _useCache = b; - if (!(b)) + this._loader.addEventListener(ResourceLoadedEvent.LOADED,this.complete); + this._loader.addEventListener(ResourceErrorEvent.ERROR,this.error); + return; + } + } + + protected static const _log:Logger = Log.getLogger(getQualifiedClassName(CssManager)); + + private static const CSS_ARRAY_KEY:String = "cssFilesContents"; + + private static var _self:CssManager; + + private static var _useCache:Boolean = true; + + public static function getInstance() : CssManager + { + if(!_self) + { + _self = new CssManager(); + } + return _self; + } + + public static function set useCache(param1:Boolean) : void + { + _useCache = param1; + if(!param1) + { + clear(); + } + } + + public static function get useCache() : Boolean + { + return _useCache; + } + + public static function clear() : void + { + StoreDataManager.getInstance().clear(BeriliaConstants.DATASTORE_UI_CSS); + } + + private var _aCss:Array; + + private var _aWaiting:Array; + + private var _aMultiWaiting:Array; + + private var _loader:IResourceLoader; + + private var _aLoadingFile:Array; + + public function getLoadedCss() : Array + { + return this._aCss; + } + + public function load(param1:*) : void + { + var _loc2_:Uri = null; + var _loc4_:uint = 0; + var _loc3_:Array = new Array(); + if(param1 is String) + { + _loc2_ = new Uri(param1); + if(!this.exists(_loc2_.uri) && !this.inQueue(_loc2_.uri)) { - clear(); - }; - } - - public static function get useCache():Boolean - { - return (_useCache); - } - - public static function clear():void - { - StoreDataManager.getInstance().clear(BeriliaConstants.DATASTORE_UI_CSS); - } - - - public function getLoadedCss():Array - { - return (this._aCss); - } - - public function load(oFile:*):void - { - var uri:Uri; - var i:uint; - var aQueue:Array = new Array(); - if ((oFile is String)) - { - uri = new Uri(oFile); - if (((!(this.exists(uri.uri))) && (!(this.inQueue(uri.uri))))) - { - aQueue.push(uri); - this._aLoadingFile[uri.uri] = true; - }; + _loc3_.push(_loc2_); + this._aLoadingFile[_loc2_.uri] = true; } - else + } + else if(param1 is Array) + { + _loc4_ = 0; + while(_loc4_ < (param1 as Array).length) { - if ((oFile is Array)) - { - i = 0; - while (i < (oFile as Array).length) - { - uri = new Uri(oFile[i]); - if (((!(this.exists(uri.uri))) && (!(this.inQueue(uri.uri))))) - { - this._aLoadingFile[uri.uri] = true; - aQueue.push(uri); - }; - i++; - }; - }; - }; - if (aQueue.length) + _loc2_ = new Uri(param1[_loc4_]); + if(!this.exists(_loc2_.uri) && !this.inQueue(_loc2_.uri)) + { + this._aLoadingFile[_loc2_.uri] = true; + _loc3_.push(_loc2_); + } + _loc4_++; + } + } + + if(_loc3_.length) + { + this._loader.load(_loc3_); + } + } + + public function exists(param1:String) : Boolean + { + var _loc2_:Uri = new Uri(param1); + return !(this._aCss[_loc2_.uri] == null); + } + + public function inQueue(param1:String) : Boolean + { + return this._aLoadingFile[param1]; + } + + public function askCss(param1:String, param2:Callback) : void + { + var _loc3_:Uri = null; + var _loc4_:Array = null; + if(this.exists(param1)) + { + param2.exec(); + } + else + { + _loc3_ = new Uri(param1); + if(!this._aWaiting[_loc3_.uri]) { - this._loader.load(aQueue); - }; - } - - public function exists(sUrl:String):Boolean - { - var uri:Uri = new Uri(sUrl); - return (!((this._aCss[uri.uri] == null))); - } - - public function inQueue(sUrl:String):Boolean - { - return (this._aLoadingFile[sUrl]); - } - - public function askCss(sUrl:String, callback:Callback):void - { - var _local_3:Uri; - var files:Array; - if (this.exists(sUrl)) + this._aWaiting[_loc3_.uri] = new Array(); + } + this._aWaiting[_loc3_.uri].push(param2); + if(param1.indexOf(",") != -1) { - callback.exec(); + _loc4_ = param1.split(","); + this._aMultiWaiting[_loc3_.uri] = _loc4_; + this.load(_loc4_); } else { - _local_3 = new Uri(sUrl); - if (!(this._aWaiting[_local_3.uri])) - { - this._aWaiting[_local_3.uri] = new Array(); - }; - this._aWaiting[_local_3.uri].push(callback); - if (sUrl.indexOf(",") != -1) - { - files = sUrl.split(","); - this._aMultiWaiting[_local_3.uri] = files; - this.load(files); - } - else - { - this.load(sUrl); - }; - }; - } - - public function preloadCss(sUrl:String):void - { - if (!(this.exists(sUrl))) - { - this.load(sUrl); - }; - } - - public function getCss(sUrl:String):ExtendedStyleSheet - { - var uri:Uri = new Uri(sUrl); - return (this._aCss[uri.uri]); - } - - public function merge(aStyleSheet:Array):ExtendedStyleSheet - { - var newCssName:String = ""; - var j:uint; - while (j < aStyleSheet.length) - { - newCssName = (newCssName + (((j) ? "," : "") + aStyleSheet[j].url)); - j++; - }; - if (this.exists(newCssName)) - { - return (this.getCss(newCssName)); - }; - var newEss:ExtendedStyleSheet = new ExtendedStyleSheet(newCssName); - var i:uint = (aStyleSheet.length - 1); - while ((i - 1) > -1) - { - newEss.merge((aStyleSheet[i] as ExtendedStyleSheet)); - i--; - }; - this._aCss[newCssName] = newEss; - return (newEss); - } - - protected function init():void - { - var aSavedCss:Array; - var file:String; - if (_useCache) - { - aSavedCss = StoreDataManager.getInstance().getSetData(BeriliaConstants.DATASTORE_UI_CSS, CSS_ARRAY_KEY, new Array()); - for (file in aSavedCss) - { - this.parseCss(file, aSavedCss[file]); - }; - }; - } - - private function parseCss(sUrl:String, content:String):void - { - var uri:Uri = new Uri(sUrl); - var styleSheet:StyleSheet = new ExtendedStyleSheet(uri.uri); - this._aCss[uri.uri] = styleSheet; - styleSheet.addEventListener(CssEvent.CSS_PARSED, this.onCssParsed); - styleSheet.parseCSS(content); - } - - private function updateWaitingMultiUrl(loadedUrl:String):void - { - var ok:Boolean; - var url:String; - var i:uint; - var files:Array; - var sse:Array; - var k:uint; - for (url in this._aMultiWaiting) + this.load(param1); + } + } + } + + public function preloadCss(param1:String) : void + { + if(!this.exists(param1)) + { + this.load(param1); + } + } + + public function getCss(param1:String) : ExtendedStyleSheet + { + var _loc2_:Uri = new Uri(param1); + return this._aCss[_loc2_.uri]; + } + + public function merge(param1:Array) : ExtendedStyleSheet + { + var _loc2_:* = ""; + var _loc3_:uint = 0; + while(_loc3_ < param1.length) + { + _loc2_ = _loc2_ + ((_loc3_?",":"") + param1[_loc3_].url); + _loc3_++; + } + if(this.exists(_loc2_)) + { + return this.getCss(_loc2_); + } + var _loc4_:ExtendedStyleSheet = new ExtendedStyleSheet(_loc2_); + var _loc5_:uint = param1.length - 1; + while(_loc5_ - 1 > -1) + { + _loc4_.merge(param1[_loc5_] as ExtendedStyleSheet); + _loc5_--; + } + this._aCss[_loc2_] = _loc4_; + return _loc4_; + } + + protected function init() : void + { + var _loc1_:Array = null; + var _loc2_:String = null; + if(_useCache) + { + _loc1_ = StoreDataManager.getInstance().getSetData(BeriliaConstants.DATASTORE_UI_CSS,CSS_ARRAY_KEY,new Array()); + for(_loc2_ in _loc1_) { - if (this._aMultiWaiting[url]) - { - ok = true; - i = 0; - while (i < this._aMultiWaiting[url].length) - { - if (this._aMultiWaiting[url][i] == loadedUrl) - { - this._aMultiWaiting[url][i] = true; - }; - ok = ((ok) && ((this._aMultiWaiting[url][i] === true))); - i++; - }; - if (ok) - { - delete this._aMultiWaiting[url]; - files = url.split(","); - sse = new Array(); - k = 0; - while (k < files.length) - { - sse.push(this.getCss(files[k])); - k++; - }; - this.merge(sse); - this.dispatchWaitingCallbabk(url); - }; - }; - }; - } - - private function dispatchWaitingCallbabk(url:String):void - { - var i:uint; - if (this._aWaiting[url]) + this.parseCss(_loc2_,_loc1_[_loc2_]); + } + } + } + + private function parseCss(param1:String, param2:String) : void + { + var _loc3_:Uri = new Uri(param1); + var _loc4_:StyleSheet = new ExtendedStyleSheet(_loc3_.uri); + this._aCss[_loc3_.uri] = _loc4_; + _loc4_.addEventListener(CssEvent.CSS_PARSED,this.onCssParsed); + _loc4_.parseCSS(param2); + } + + private function updateWaitingMultiUrl(param1:String) : void + { + var _loc2_:* = false; + var _loc3_:String = null; + var _loc4_:uint = 0; + var _loc5_:Array = null; + var _loc6_:Array = null; + var _loc7_:uint = 0; + for(_loc3_ in this._aMultiWaiting) + { + if(this._aMultiWaiting[_loc3_]) { - i = 0; - while (i < this._aWaiting[url].length) - { - Callback(this._aWaiting[url][i]).exec(); - i++; - }; - delete this._aWaiting[url]; - }; - } - - protected function complete(e:ResourceLoadedEvent):void - { - var aSavedCss:Array; - if (_useCache) + _loc2_ = true; + _loc4_ = 0; + while(_loc4_ < this._aMultiWaiting[_loc3_].length) + { + if(this._aMultiWaiting[_loc3_][_loc4_] == param1) + { + this._aMultiWaiting[_loc3_][_loc4_] = true; + } + _loc2_ = (_loc2_) && this._aMultiWaiting[_loc3_][_loc4_] === true; + _loc4_++; + } + if(_loc2_) + { + delete this._aMultiWaiting[_loc3_]; + true; + _loc5_ = _loc3_.split(","); + _loc6_ = new Array(); + _loc7_ = 0; + while(_loc7_ < _loc5_.length) + { + _loc6_.push(this.getCss(_loc5_[_loc7_])); + _loc7_++; + } + this.merge(_loc6_); + this.dispatchWaitingCallbabk(_loc3_); + } + } + } + } + + private function dispatchWaitingCallbabk(param1:String) : void + { + var _loc2_:uint = 0; + if(this._aWaiting[param1]) + { + _loc2_ = 0; + while(_loc2_ < this._aWaiting[param1].length) { - aSavedCss = StoreDataManager.getInstance().getSetData(BeriliaConstants.DATASTORE_UI_CSS, CSS_ARRAY_KEY, new Array()); - aSavedCss[e.uri.uri] = e.resource; - StoreDataManager.getInstance().setData(BeriliaConstants.DATASTORE_UI_CSS, CSS_ARRAY_KEY, aSavedCss); - }; - this._aLoadingFile[e.uri.uri] = false; - this.parseCss(e.uri.uri, e.resource); - } - - protected function error(e:ResourceErrorEvent):void - { - ErrorManager.addError((("Impossible de trouver la feuille de style (url: " + e.uri) + ")")); - this._aLoadingFile[e.uri.uri] = false; - delete this._aWaiting[e.uri.uri]; - } - - private function onCssParsed(e:CssEvent):void - { - e.stylesheet.removeEventListener(CssEvent.CSS_PARSED, this.onCssParsed); - var uri:Uri = new Uri(e.stylesheet.url); - this.dispatchWaitingCallbabk(uri.uri); - this.updateWaitingMultiUrl(uri.uri); - } - - - } -}//package com.ankamagames.berilia.managers - + Callback(this._aWaiting[param1][_loc2_]).exec(); + _loc2_++; + } + delete this._aWaiting[param1]; + true; + } + } + + protected function complete(param1:ResourceLoadedEvent) : void + { + var _loc2_:Array = null; + if(_useCache) + { + _loc2_ = StoreDataManager.getInstance().getSetData(BeriliaConstants.DATASTORE_UI_CSS,CSS_ARRAY_KEY,new Array()); + _loc2_[param1.uri.uri] = param1.resource; + StoreDataManager.getInstance().setData(BeriliaConstants.DATASTORE_UI_CSS,CSS_ARRAY_KEY,_loc2_); + } + this._aLoadingFile[param1.uri.uri] = false; + this.parseCss(param1.uri.uri,param1.resource); + } + + protected function error(param1:ResourceErrorEvent) : void + { + ErrorManager.addError("Impossible de trouver la feuille de style (url: " + param1.uri + ")"); + this._aLoadingFile[param1.uri.uri] = false; + delete this._aWaiting[param1.uri.uri]; + true; + } + + private function onCssParsed(param1:CssEvent) : void + { + param1.stylesheet.removeEventListener(CssEvent.CSS_PARSED,this.onCssParsed); + var _loc2_:Uri = new Uri(param1.stylesheet.url); + this.dispatchWaitingCallbabk(_loc2_.uri); + this.updateWaitingMultiUrl(_loc2_.uri); + } + } +} diff --git a/com/ankamagames/berilia/managers/EmbedFontManager.as b/com/ankamagames/berilia/managers/EmbedFontManager.as index 65c92b27e..78d61e88b 100644 --- a/com/ankamagames/berilia/managers/EmbedFontManager.as +++ b/com/ankamagames/berilia/managers/EmbedFontManager.as @@ -1,145 +1,150 @@ -package com.ankamagames.berilia.managers +package com.ankamagames.berilia.managers { - import flash.events.EventDispatcher; - import com.ankamagames.jerakine.logger.Logger; - import com.ankamagames.jerakine.logger.Log; - import flash.utils.getQualifiedClassName; - import com.ankamagames.jerakine.resources.loaders.IResourceLoader; - import com.ankamagames.jerakine.utils.errors.SingletonError; - import com.ankamagames.jerakine.resources.loaders.ResourceLoaderFactory; - import com.ankamagames.jerakine.resources.loaders.ResourceLoaderType; - import com.ankamagames.jerakine.resources.events.ResourceLoadedEvent; - import com.ankamagames.jerakine.resources.events.ResourceErrorEvent; - import com.ankamagames.jerakine.resources.events.ResourceLoaderProgressEvent; - import flash.text.Font; - import flash.events.Event; - import com.ankamagames.jerakine.types.Uri; - import com.ankamagames.jerakine.types.Swl; - import com.ankamagames.jerakine.utils.files.FileUtils; - - public class EmbedFontManager extends EventDispatcher - { - - private static var _self:EmbedFontManager; - protected static const _log:Logger = Log.getLogger(getQualifiedClassName(EmbedFontManager)); - - private var _aFonts:Array; - private var _currentlyLoading:String; - private var _loadingFonts:Array; - private var _loader:IResourceLoader; - - public function EmbedFontManager() - { - if (_self != null) - { - throw (new SingletonError("EmbedFontManager constructor should not be called directly.")); - }; + import flash.events.EventDispatcher; + import com.ankamagames.jerakine.logger.Logger; + import com.ankamagames.jerakine.logger.Log; + import flash.utils.getQualifiedClassName; + import com.ankamagames.jerakine.resources.loaders.IResourceLoader; + import flash.text.Font; + import flash.events.Event; + import com.ankamagames.jerakine.types.Uri; + import com.ankamagames.jerakine.resources.events.ResourceLoadedEvent; + import com.ankamagames.jerakine.types.Swl; + import com.ankamagames.jerakine.utils.files.FileUtils; + import com.ankamagames.jerakine.resources.events.ResourceLoaderProgressEvent; + import com.ankamagames.jerakine.resources.events.ResourceErrorEvent; + import com.ankamagames.jerakine.utils.errors.SingletonError; + import com.ankamagames.jerakine.resources.loaders.ResourceLoaderFactory; + import com.ankamagames.jerakine.resources.loaders.ResourceLoaderType; + + public class EmbedFontManager extends EventDispatcher + { + + public function EmbedFontManager() + { + super(); + if(_self != null) + { + throw new SingletonError("EmbedFontManager constructor should not be called directly."); + } + else + { _self = this; this._aFonts = new Array(); this._loader = ResourceLoaderFactory.getLoader(ResourceLoaderType.SERIAL_LOADER); - this._loader.addEventListener(ResourceLoadedEvent.LOADED, this.onComplete); - this._loader.addEventListener(ResourceErrorEvent.ERROR, this.onError); - this._loader.addEventListener(ResourceLoaderProgressEvent.LOADER_COMPLETE, this.onAllFontLoaded); - } - - public static function getInstance():EmbedFontManager - { - if (_self == null) - { - _self = new (EmbedFontManager)(); - }; - return (_self); - } - - - public function initialize(fontList:Array):void - { - if (this._loadingFonts == null) - { - this._loadingFonts = new Array(); - }; - this._loadingFonts = this._loadingFonts.concat(fontList); - this.loadFonts(); - } - - public function isEmbed(fontName:String):Boolean - { - return ((this._aFonts[fontName] == true)); - } - - public function getFont(fontName:String):Font - { - var aFonts:Array = Font.enumerateFonts(); - var i:uint; - while (i < aFonts.length) - { - if (Font(aFonts[i]).fontName.toUpperCase() == fontName.toUpperCase()) - { - return (aFonts[i]); - }; - i++; - }; - return (null); - } - - private function loadFonts():void - { - var font:String; - if (this._currentlyLoading != null) - { - return; - }; - if (this._loadingFonts.length == 0) + this._loader.addEventListener(ResourceLoadedEvent.LOADED,this.onComplete); + this._loader.addEventListener(ResourceErrorEvent.ERROR,this.onError); + this._loader.addEventListener(ResourceLoaderProgressEvent.LOADER_COMPLETE,this.onAllFontLoaded); + return; + } + } + + private static var _self:EmbedFontManager; + + protected static const _log:Logger = Log.getLogger(getQualifiedClassName(EmbedFontManager)); + + public static function getInstance() : EmbedFontManager + { + if(_self == null) + { + _self = new EmbedFontManager(); + } + return _self; + } + + private var _aFonts:Array; + + private var _currentlyLoading:String; + + private var _loadingFonts:Array; + + private var _loader:IResourceLoader; + + public function initialize(param1:Array) : void + { + if(this._loadingFonts == null) + { + this._loadingFonts = new Array(); + } + this._loadingFonts = this._loadingFonts.concat(param1); + this.loadFonts(); + } + + public function isEmbed(param1:String) : Boolean + { + return this._aFonts[param1] == true; + } + + public function getFont(param1:String) : Font + { + var _loc2_:Array = Font.enumerateFonts(); + var _loc3_:uint = 0; + while(_loc3_ < _loc2_.length) + { + if(Font(_loc2_[_loc3_]).fontName.toUpperCase() == param1.toUpperCase()) { - dispatchEvent(new Event(Event.COMPLETE)); - return; - }; - var aQueue:Array = new Array(); - for each (font in this._loadingFonts) - { - aQueue.push(new Uri(font)); - }; - this._loadingFonts = null; - this._loader.load(aQueue); - } - - private function onComplete(e:ResourceLoadedEvent):void - { - var _local_3:Array; - var i:int; - var fontClass:Class = (Swl(e.resource).getDefinition(FileUtils.getFileStartName(e.uri.uri)) as Class); - this._aFonts[FileUtils.getFileStartName(e.uri.uri)] = true; - if (fontClass["EMBED_FONT"]) - { - Font.registerFont(fontClass["EMBED_FONT"]); + return _loc2_[_loc3_]; } - else - { - _local_3 = fontClass["FONTS_LIST"]; - if (_local_3) - { - i = 0; - while (i < _local_3.length) - { - Font.registerFont(_local_3[i]); - i++; - }; - }; - }; - this._currentlyLoading = null; - } - - private function onAllFontLoaded(e:ResourceLoaderProgressEvent):void - { + _loc3_++; + } + return null; + } + + private function loadFonts() : void + { + var _loc2_:String = null; + if(this._currentlyLoading != null) + { + return; + } + if(this._loadingFonts.length == 0) + { dispatchEvent(new Event(Event.COMPLETE)); - } - - private function onError(e:ResourceErrorEvent):void - { - _log.error(("Unabled to load a font : " + e.uri)); - } - - - } -}//package com.ankamagames.berilia.managers - + return; + } + var _loc1_:Array = new Array(); + for each(_loc2_ in this._loadingFonts) + { + _loc1_.push(new Uri(_loc2_)); + } + this._loadingFonts = null; + this._loader.load(_loc1_); + } + + private function onComplete(param1:ResourceLoadedEvent) : void + { + var _loc3_:Array = null; + var _loc4_:* = 0; + var _loc2_:Class = Swl(param1.resource).getDefinition(FileUtils.getFileStartName(param1.uri.uri)) as Class; + this._aFonts[FileUtils.getFileStartName(param1.uri.uri)] = true; + if(_loc2_["EMBED_FONT"]) + { + Font.registerFont(_loc2_["EMBED_FONT"]); + } + else + { + _loc3_ = _loc2_["FONTS_LIST"]; + if(_loc3_) + { + _loc4_ = 0; + while(_loc4_ < _loc3_.length) + { + Font.registerFont(_loc3_[_loc4_]); + _loc4_++; + } + } + } + this._currentlyLoading = null; + } + + private function onAllFontLoaded(param1:ResourceLoaderProgressEvent) : void + { + dispatchEvent(new Event(Event.COMPLETE)); + } + + private function onError(param1:ResourceErrorEvent) : void + { + _log.error("Unabled to load a font : " + param1.uri); + } + } +} diff --git a/com/ankamagames/berilia/managers/GenericEventsManager.as b/com/ankamagames/berilia/managers/GenericEventsManager.as index 61a00174e..8247f1251 100644 --- a/com/ankamagames/berilia/managers/GenericEventsManager.as +++ b/com/ankamagames/berilia/managers/GenericEventsManager.as @@ -1,117 +1,104 @@ -package com.ankamagames.berilia.managers +package com.ankamagames.berilia.managers { - import com.ankamagames.jerakine.logger.Logger; - import com.ankamagames.jerakine.logger.Log; - import flash.utils.getQualifiedClassName; - import com.ankamagames.berilia.types.listener.GenericListener; - - public class GenericEventsManager - { - - protected static const _log:Logger = Log.getLogger(getQualifiedClassName(GenericEventsManager)); - - protected var _aEvent:Array; - - public function GenericEventsManager() - { - this._aEvent = new Array(); - super(); - } - - public function initialize():void - { - this._aEvent = new Array(); - } - - public function registerEvent(ge:GenericListener):void - { - if (this._aEvent[ge.event] == null) + import com.ankamagames.jerakine.logger.Logger; + import com.ankamagames.jerakine.logger.Log; + import flash.utils.getQualifiedClassName; + import com.ankamagames.berilia.types.listener.GenericListener; + + public class GenericEventsManager extends Object + { + + public function GenericEventsManager() + { + this._aEvent = new Array(); + super(); + } + + protected static const _log:Logger = Log.getLogger(getQualifiedClassName(GenericEventsManager)); + + protected var _aEvent:Array; + + public function initialize() : void + { + this._aEvent = new Array(); + } + + public function registerEvent(param1:GenericListener) : void + { + if(this._aEvent[param1.event] == null) + { + this._aEvent[param1.event] = new Array(); + } + this._aEvent[param1.event].push(param1); + (this._aEvent[param1.event] as Array).sortOn("sortIndex",Array.NUMERIC | Array.DESCENDING); + } + + public function removeEventListener(param1:GenericListener) : void + { + var _loc2_:String = null; + var _loc3_:* = 0; + var _loc4_:GenericListener = null; + for(_loc2_ in this._aEvent) + { + if(this._aEvent[_loc2_]) { - this._aEvent[ge.event] = new Array(); - }; - this._aEvent[ge.event].push(ge); - (this._aEvent[ge.event] as Array).sortOn("sortIndex", (Array.NUMERIC | Array.DESCENDING)); - } - - public function removeEventListener(ge:GenericListener):void - { - var i:String; - var j:int; - var genericListener:GenericListener; - for (i in this._aEvent) + _loc3_ = 0; + while(_loc3_ < this._aEvent[_loc2_].length) + { + _loc4_ = this._aEvent[_loc2_][_loc3_]; + if(_loc4_) + { + if(_loc4_ == param1) + { + _loc4_.destroy(); + (this._aEvent[_loc2_] as Array).splice(_loc3_,1); + _loc3_--; + } + } + _loc3_++; + } + if(!this._aEvent[_loc2_].length) + { + this._aEvent[_loc2_] = null; + delete this._aEvent[_loc2_]; + true; + } + } + } + } + + public function removeAllEventListeners(param1:*) : void + { + var _loc2_:String = null; + var _loc3_:* = 0; + var _loc4_:GenericListener = null; + for(_loc2_ in this._aEvent) + { + if(this._aEvent[_loc2_]) { - if (!(this._aEvent[i])) - { - } - else - { - j = 0; - while (j < this._aEvent[i].length) - { - genericListener = this._aEvent[i][j]; - if (!(genericListener)) - { - } - else - { - if (genericListener == ge) - { - genericListener.destroy(); - (this._aEvent[i] as Array).splice(j, 1); - j--; - }; - }; - j++; - }; - if (!(this._aEvent[i].length)) - { - this._aEvent[i] = null; - delete this._aEvent[i]; - }; - }; - }; - } - - public function removeAllEventListeners(sListener:*):void - { - var i:String; - var j:int; - var genericListener:GenericListener; - for (i in this._aEvent) - { - if (!(this._aEvent[i])) - { - } - else - { - j = 0; - while (j < this._aEvent[i].length) - { - genericListener = this._aEvent[i][j]; - if (!(genericListener)) - { - } - else - { - if (genericListener.listener == sListener) - { - genericListener.destroy(); - (this._aEvent[i] as Array).splice(j, 1); - j--; - }; - }; - j++; - }; - if (!(this._aEvent[i].length)) - { - this._aEvent[i] = null; - delete this._aEvent[i]; - }; - }; - }; - } - - - } -}//package com.ankamagames.berilia.managers - + _loc3_ = 0; + while(_loc3_ < this._aEvent[_loc2_].length) + { + _loc4_ = this._aEvent[_loc2_][_loc3_]; + if(_loc4_) + { + if(_loc4_.listener == param1) + { + _loc4_.destroy(); + (this._aEvent[_loc2_] as Array).splice(_loc3_,1); + _loc3_--; + } + } + _loc3_++; + } + if(!this._aEvent[_loc2_].length) + { + this._aEvent[_loc2_] = null; + delete this._aEvent[_loc2_]; + true; + } + } + } + } + } +} diff --git a/com/ankamagames/berilia/managers/HtmlManager.as b/com/ankamagames/berilia/managers/HtmlManager.as index 50c64bac6..fb285e1cb 100644 --- a/com/ankamagames/berilia/managers/HtmlManager.as +++ b/com/ankamagames/berilia/managers/HtmlManager.as @@ -1,253 +1,263 @@ -package com.ankamagames.berilia.managers +package com.ankamagames.berilia.managers { - import com.adobe.utils.StringUtil; - import flashx.textLayout.elements.SpanElement; - - public class HtmlManager - { - - public static const LINK:String = "a"; - public static const SPAN:String = "span"; - public static const COLOR:String = "color"; - public static const UNDERLINE:String = "underline"; - public static const ITALIC:String = "italic"; - public static const BOLD:String = "bold"; - private static var htmlVersion:String; - public static const OLD_FASHION:String = "old"; - public static const INLINE_CSS_VERSION:String = "inline"; - - - public static function changeCssHandler(val:String):void - { - switch (val) + import com.adobe.utils.StringUtil; + import flashx.textLayout.elements.SpanElement; + + public class HtmlManager extends Object + { + + public function HtmlManager() + { + super(); + } + + public static const LINK:String = "a"; + + public static const SPAN:String = "span"; + + public static const COLOR:String = "color"; + + public static const UNDERLINE:String = "underline"; + + public static const ITALIC:String = "italic"; + + public static const BOLD:String = "bold"; + + private static var htmlVersion:String; + + public static const OLD_FASHION:String = "old"; + + public static const INLINE_CSS_VERSION:String = "inline"; + + public static function changeCssHandler(param1:String) : void + { + switch(param1) + { + case OLD_FASHION: + case INLINE_CSS_VERSION: + htmlVersion = param1; + break; + default: + htmlVersion = OLD_FASHION; + } + } + + public static function addTag(param1:String, param2:String, param3:Object = null) : String + { + if(htmlVersion == INLINE_CSS_VERSION) + { + if(isTagValide(param2)) { - case OLD_FASHION: - case INLINE_CSS_VERSION: - htmlVersion = val; - return; - default: - htmlVersion = OLD_FASHION; - }; - } - - public static function addTag(pText:String, pBalise:String, pStyle:Object=null):String - { - if (htmlVersion == INLINE_CSS_VERSION) - { - if (isTagValide(pBalise)) - { - return ((((((((("<" + pBalise) + " ") + formateStyleWithInlineCss(pStyle)) + ">") + pText) + "")); - }; - trace((('ERROR TAG: "' + pBalise) + '" NOT VALID !!')); - return (pText); - }; - if (pStyle == null) - { - pStyle = new Object(); - }; - if (pBalise == BOLD) - { - pStyle[BOLD] = true; - }; - if (pBalise == ITALIC) - { - pStyle[ITALIC] = true; - }; - if (pBalise == UNDERLINE) - { - pStyle["text-decoration"] = UNDERLINE; - }; - return (formateStyleWithTags(pText, pStyle)); - } - - private static function formateStyleWithInlineCss(pStyle:Object=null):String - { - var htmlText:String = ""; - if (pStyle != null) + return "<" + param2 + " " + formateStyleWithInlineCss(param3) + ">" + param1 + ""; + } + trace("ERROR TAG: \"" + param2 + "\" NOT VALID !!"); + return param1; + } + if(param3 == null) + { + var param3:Object = new Object(); + } + if(param2 == BOLD) + { + param3[BOLD] = true; + } + if(param2 == ITALIC) + { + param3[ITALIC] = true; + } + if(param2 == UNDERLINE) + { + param3["text-decoration"] = UNDERLINE; + } + return formateStyleWithTags(param1,param3); + } + + private static function formateStyleWithInlineCss(param1:Object = null) : String + { + var _loc2_:* = ""; + if(param1 != null) + { + _loc2_ = _loc2_ + " style=\""; + if(param1[COLOR]) { - htmlText = (htmlText + ' style="'); - if (pStyle[COLOR]) - { - htmlText = (htmlText + (("color:" + getHexaColor(pStyle[COLOR])) + ";")); - }; - if (pStyle[ITALIC]) - { - htmlText = (htmlText + (("font-style:" + pStyle[ITALIC]) + ";")); - }; - if (pStyle[BOLD]) - { - htmlText = (htmlText + "font-weight: bold;"); - }; - htmlText = (htmlText + '"'); - }; - return (htmlText); - } - - private static function formateStyleWithTags(pText:String, pStyle:Object=null):String - { - var htmlText:String = ""; - if (pStyle != null) + _loc2_ = _loc2_ + ("color:" + getHexaColor(param1[COLOR]) + ";"); + } + if(param1[ITALIC]) { - if (pStyle[COLOR]) - { - htmlText = (htmlText + (('')); - }; - if (pStyle[ITALIC]) - { - htmlText = (htmlText + ""); - }; - if (pStyle[BOLD]) - { - htmlText = (htmlText + ""); - }; - if ((((pStyle["text-decoration"] == UNDERLINE)) || ((pStyle["textDecoration"] == UNDERLINE)))) - { - htmlText = (htmlText + ""); - }; - htmlText = (htmlText + pText); - if ((((pStyle["text-decoration"] == UNDERLINE)) || ((pStyle["textDecoration"] == UNDERLINE)))) - { - htmlText = (htmlText + ""); - }; - if (pStyle[BOLD]) - { - htmlText = (htmlText + ""); - }; - if (pStyle[ITALIC]) - { - htmlText = (htmlText + ""); - }; - if (pStyle[COLOR]) - { - htmlText = (htmlText + ""); - }; + _loc2_ = _loc2_ + ("font-style:" + param1[ITALIC] + ";"); } - else + if(param1[BOLD]) { - htmlText = pText; - }; - return (htmlText); - } - - private static function getHexaColor(pColor:*):String - { - var hexaColor:String = ""; - switch (true) + _loc2_ = _loc2_ + "font-weight: bold;"; + } + _loc2_ = _loc2_ + "\""; + } + return _loc2_; + } + + private static function formateStyleWithTags(param1:String, param2:Object = null) : String + { + var _loc3_:* = ""; + if(param2 != null) + { + if(param2[COLOR]) { - case (pColor is int): - case (pColor is uint): - hexaColor = ("#" + pColor.toString(16)); - break; - case (pColor is String): - if (pColor.indexOf("#") == 0) - { - hexaColor = String(pColor); - } - else - { - hexaColor = pColor.replace("0x", "#"); - }; - break; - default: - hexaColor = "#FF0000"; - }; - return (hexaColor); - } - - public static function addLink(pText:String, pHref:String="", pStyle:Object=null, pForceInlineCss:Boolean=false):String - { - if ((((htmlVersion == INLINE_CSS_VERSION)) || (pForceInlineCss))) + _loc3_ = _loc3_ + (""); + } + if(param2[ITALIC]) { - if (pStyle != null) - { - return ((((((((((("<" + LINK) + " href='") + pHref) + "'") + formateStyleWithInlineCss(pStyle)) + ">") + pText) + "")); - }; - return ((((((((("<" + LINK) + " href='") + pHref) + "'>") + pText) + "")); - }; - return ((((((((("<" + LINK) + " href='") + pHref) + "'>") + pText) + "")); - } - - public static function removeStyle(pText:String, pBalise:String, pAllOccurrences:Boolean=false):String - { - return (pText); - } - - public static function addStyleToWords(pParagraphe:String, pText:String, pBalise:String):String - { - return (pParagraphe); - } - - private static function isTagValide(pTag:String):Boolean - { - switch (pTag) + _loc3_ = _loc3_ + ""; + } + if(param2[BOLD]) { - case SPAN: - return (true); - }; - return (false); - } - - public static function parseStyle(val:String):Array - { - var val1:String; - var tab2:Array; - var style:Array = new Array(); - var tab1:Array = val.split(";"); - for each (val1 in tab1) + _loc3_ = _loc3_ + ""; + } + if(param2["text-decoration"] == UNDERLINE || param2["textDecoration"] == UNDERLINE) { - tab2 = val1.split(":"); - if (tab2[0] != "") - { - style[tab2[0]] = StringUtil.trim(tab2[1]); - }; - }; - return (style); - } - - public static function formateSpan(span:SpanElement, pStyle:String):SpanElement - { - var style:Array = parseStyle(pStyle); - if (style["font-weight"]) + _loc3_ = _loc3_ + ""; + } + _loc3_ = _loc3_ + param1; + if(param2["text-decoration"] == UNDERLINE || param2["textDecoration"] == UNDERLINE) { - span.fontWeight = style["font-weight"]; - }; - if (style["color"]) + _loc3_ = _loc3_ + ""; + } + if(param2[BOLD]) { - span.color = style["color"]; - }; - if (style["background-color"]) + _loc3_ = _loc3_ + ""; + } + if(param2[ITALIC]) { - span.backgroundColor = style["background-color"]; - }; - if (style["text-decoration"]) + _loc3_ = _loc3_ + ""; + } + if(param2[COLOR]) { - span.textDecoration = style["text-decoration"]; - }; - if (style["font-style"]) + _loc3_ = _loc3_ + ""; + } + } + else + { + _loc3_ = param1; + } + return _loc3_; + } + + private static function getHexaColor(param1:*) : String + { + var _loc2_:* = ""; + switch(true) + { + case param1 is int: + case param1 is uint: + _loc2_ = "#" + param1.toString(16); + break; + case param1 is String: + if(param1.indexOf("#") == 0) + { + _loc2_ = String(param1); + } + else + { + _loc2_ = param1.replace("0x","#"); + } + break; + default: + _loc2_ = "#FF0000"; + } + return _loc2_; + } + + public static function addLink(param1:String, param2:String = "", param3:Object = null, param4:Boolean = false) : String + { + if(htmlVersion == INLINE_CSS_VERSION || (param4)) + { + if(param3 != null) { - span.fontStyle = style["font-style"]; - }; - return (span); - } - - public static function addValueToInlineStyle(inlineStyle:String, data:String, value:String):String - { - if (inlineStyle.length > 0) + return "<" + LINK + " href=\'" + param2 + "\'" + formateStyleWithInlineCss(param3) + ">" + param1 + ""; + } + return "<" + LINK + " href=\'" + param2 + "\'>" + param1 + ""; + } + return "<" + LINK + " href=\'" + param2 + "\'>" + param1 + ""; + } + + public static function removeStyle(param1:String, param2:String, param3:Boolean = false) : String + { + return param1; + } + + public static function addStyleToWords(param1:String, param2:String, param3:String) : String + { + return param1; + } + + private static function isTagValide(param1:String) : Boolean + { + switch(param1) + { + case SPAN: + return true; + default: + return false; + } + } + + public static function parseStyle(param1:String) : Array + { + var _loc4_:String = null; + var _loc5_:Array = null; + var _loc2_:Array = new Array(); + var _loc3_:Array = param1.split(";"); + for each(_loc4_ in _loc3_) + { + _loc5_ = _loc4_.split(":"); + if(_loc5_[0] != "") { - if (inlineStyle.charAt((inlineStyle.length - 1)) != ";") - { - inlineStyle = (inlineStyle + ";"); - }; - inlineStyle = (inlineStyle + (((data + ":") + value) + ";")); + _loc2_[_loc5_[0]] = StringUtil.trim(_loc5_[1]); } - else + } + return _loc2_; + } + + public static function formateSpan(param1:SpanElement, param2:String) : SpanElement + { + var _loc3_:Array = parseStyle(param2); + if(_loc3_["font-weight"]) + { + param1.fontWeight = _loc3_["font-weight"]; + } + if(_loc3_["color"]) + { + param1.color = _loc3_["color"]; + } + if(_loc3_["background-color"]) + { + param1.backgroundColor = _loc3_["background-color"]; + } + if(_loc3_["text-decoration"]) + { + param1.textDecoration = _loc3_["text-decoration"]; + } + if(_loc3_["font-style"]) + { + param1.fontStyle = _loc3_["font-style"]; + } + return param1; + } + + public static function addValueToInlineStyle(param1:String, param2:String, param3:String) : String + { + if(param1.length > 0) + { + if(param1.charAt(param1.length - 1) != ";") { - inlineStyle = (((data + ":") + value) + ";"); - }; - return (inlineStyle); - } - - - } -}//package com.ankamagames.berilia.managers - + var param1:* = param1 + ";"; + } + param1 = param1 + (param2 + ":" + param3 + ";"); + } + else + { + param1 = param2 + ":" + param3 + ";"; + } + return param1; + } + } +} diff --git a/com/ankamagames/berilia/managers/KernelEventsManager.as b/com/ankamagames/berilia/managers/KernelEventsManager.as index 69c23af47..838279855 100644 --- a/com/ankamagames/berilia/managers/KernelEventsManager.as +++ b/com/ankamagames/berilia/managers/KernelEventsManager.as @@ -1,154 +1,159 @@ -package com.ankamagames.berilia.managers +package com.ankamagames.berilia.managers { - import flash.events.EventDispatcher; - import com.ankamagames.jerakine.utils.errors.SingletonError; - import com.ankamagames.berilia.Berilia; - import com.ankamagames.berilia.types.event.UiRenderEvent; - import com.ankamagames.berilia.types.listener.GenericListener; - import com.ankamagames.jerakine.utils.benchmark.monitoring.FpsManager; - import com.ankamagames.berilia.types.data.OldMessage; - import com.ankamagames.berilia.types.event.HookLogEvent; - import com.ankamagames.jerakine.logger.ModuleLogger; - import com.ankamagames.jerakine.managers.ErrorManager; - import com.ankamagames.berilia.types.event.HookEvent; - import com.ankamagames.berilia.types.data.Hook; - - public class KernelEventsManager extends GenericEventsManager - { - - private static var _self:KernelEventsManager; - - private var _aLoadingUi:Array; - private var _eventDispatcher:EventDispatcher; - - public function KernelEventsManager() - { - if (_self != null) - { - throw (new SingletonError("KernelEventsManager is a singleton and should not be instanciated directly.")); - }; + import flash.events.EventDispatcher; + import com.ankamagames.berilia.types.data.Hook; + import com.ankamagames.berilia.types.listener.GenericListener; + import com.ankamagames.jerakine.utils.benchmark.monitoring.FpsManager; + import com.ankamagames.berilia.Berilia; + import com.ankamagames.berilia.types.data.OldMessage; + import com.ankamagames.berilia.types.event.HookLogEvent; + import com.ankamagames.jerakine.logger.ModuleLogger; + import com.ankamagames.jerakine.managers.ErrorManager; + import com.ankamagames.berilia.types.event.HookEvent; + import com.ankamagames.berilia.types.event.UiRenderEvent; + import com.ankamagames.jerakine.utils.errors.SingletonError; + + public class KernelEventsManager extends GenericEventsManager + { + + public function KernelEventsManager() + { + super(); + if(_self != null) + { + throw new SingletonError("KernelEventsManager is a singleton and should not be instanciated directly."); + } + else + { this._eventDispatcher = new EventDispatcher(); this._aLoadingUi = new Array(); - Berilia.getInstance().addEventListener(UiRenderEvent.UIRenderComplete, this.processOldMessage); - Berilia.getInstance().addEventListener(UiRenderEvent.UIRenderFailed, this.processOldMessage); - } - - public static function getInstance():KernelEventsManager - { - if (_self == null) - { - _self = new (KernelEventsManager)(); - }; - return (_self); - } - - - public function get eventDispatcher():EventDispatcher - { - return (this._eventDispatcher); - } - - public function isRegisteredEvent(name:String):Boolean - { - return (!((_aEvent[name] == null))); - } - - [APALogInfo(customInfo="'Hook: ' + hook.name")] - public function processCallback(hook:Hook, ... args):void - { - var s:String; - var e:GenericListener; - FpsManager.getInstance().startTracking("hook", 7108545); - if (!(UiModuleManager.getInstance().ready)) - { - _log.warn((("Hook " + hook.name) + " discarded")); - return; - }; - var boxedParam:Array = SecureCenter.secureContent(args); - var num:int; - var loadingUi:Array = Berilia.getInstance().loadingUi; - for (s in loadingUi) - { - num++; - if (!!(Berilia.getInstance().loadingUi[s])) - { - if (this._aLoadingUi[s] == null) - { - this._aLoadingUi[s] = new Array(); - }; - this._aLoadingUi[s].push(new OldMessage(hook, boxedParam)); - }; - }; - _log.logDirectly(new HookLogEvent(hook.name, [])); - if (!(_aEvent[hook.name])) - { - return; - }; - ModuleLogger.log(hook, args); - var tmpListner:Array = []; - for each (e in _aEvent[hook.name]) - { - tmpListner.push(e); - }; - for each (e in tmpListner) - { - if (!!(e)) - { - if ((((e.listenerType == GenericListener.LISTENER_TYPE_UI)) && (!(Berilia.getInstance().getUi(e.listener))))) - { - _log.info(((("L'UI " + e.listener) + " n'existe plus pour recevoir le hook ") + e.event)); - } - else - { - ErrorManager.tryFunction(e.callback, boxedParam, ("Une erreur est survenue lors du traitement du hook " + hook.name)); - }; - }; - }; - if (this._eventDispatcher.hasEventListener(HookEvent.DISPATCHED)) - { - this._eventDispatcher.dispatchEvent(new HookEvent(HookEvent.DISPATCHED, hook)); - }; - FpsManager.getInstance().stopTracking("hook"); - } - - private function processOldMessage(e:UiRenderEvent):void - { - var hook:Hook; - var args:Array; - var s:String; - var eGl:GenericListener; - if (!(this._aLoadingUi[e.uiTarget.name])) + Berilia.getInstance().addEventListener(UiRenderEvent.UIRenderComplete,this.processOldMessage); + Berilia.getInstance().addEventListener(UiRenderEvent.UIRenderFailed,this.processOldMessage); + return; + } + } + + private static var _self:KernelEventsManager; + + public static function getInstance() : KernelEventsManager + { + if(_self == null) + { + _self = new KernelEventsManager(); + } + return _self; + } + + private var _aLoadingUi:Array; + + private var _eventDispatcher:EventDispatcher; + + public function get eventDispatcher() : EventDispatcher + { + return this._eventDispatcher; + } + + public function isRegisteredEvent(param1:String) : Boolean + { + return !(_aEvent[param1] == null); + } + + public function processCallback(param1:Hook, ... rest) : void + { + var _loc6_:String = null; + var _loc7_:GenericListener = null; + FpsManager.getInstance().startTracking("hook",7108545); + if(!UiModuleManager.getInstance().ready) + { + _log.warn("Hook " + param1.name + " discarded"); + return; + } + var _loc3_:Array = SecureCenter.secureContent(rest); + var _loc4_:* = 0; + var _loc5_:Array = Berilia.getInstance().loadingUi; + for(_loc6_ in _loc5_) + { + _loc4_++; + if(Berilia.getInstance().loadingUi[_loc6_]) { - return; - }; - if (e.type == UiRenderEvent.UIRenderFailed) + if(this._aLoadingUi[_loc6_] == null) + { + this._aLoadingUi[_loc6_] = new Array(); + } + this._aLoadingUi[_loc6_].push(new OldMessage(param1,_loc3_)); + } + } + _log.logDirectly(new HookLogEvent(param1.name,[])); + if(!_aEvent[param1.name]) + { + return; + } + ModuleLogger.log(param1,rest); + var _loc8_:Array = []; + for each(_loc7_ in _aEvent[param1.name]) + { + _loc8_.push(_loc7_); + } + for each(_loc7_ in _loc8_) + { + if(_loc7_) { - this._aLoadingUi[e.uiTarget.name] = null; - return; - }; - var i:uint; - while (i < this._aLoadingUi[e.uiTarget.name].length) + if(_loc7_.listenerType == GenericListener.LISTENER_TYPE_UI && !Berilia.getInstance().getUi(_loc7_.listener)) + { + _log.info("L\'UI " + _loc7_.listener + " n\'existe plus pour recevoir le hook " + _loc7_.event); + } + else + { + ErrorManager.tryFunction(_loc7_.callback,_loc3_,"Une erreur est survenue lors du traitement du hook " + param1.name); + } + } + } + if(this._eventDispatcher.hasEventListener(HookEvent.DISPATCHED)) + { + this._eventDispatcher.dispatchEvent(new HookEvent(HookEvent.DISPATCHED,param1)); + } + FpsManager.getInstance().stopTracking("hook"); + } + + private function processOldMessage(param1:UiRenderEvent) : void + { + var _loc2_:Hook = null; + var _loc3_:Array = null; + var _loc5_:String = null; + var _loc6_:GenericListener = null; + if(!this._aLoadingUi[param1.uiTarget.name]) + { + return; + } + if(param1.type == UiRenderEvent.UIRenderFailed) + { + this._aLoadingUi[param1.uiTarget.name] = null; + return; + } + var _loc4_:uint = 0; + while(_loc4_ < this._aLoadingUi[param1.uiTarget.name].length) + { + _loc2_ = this._aLoadingUi[param1.uiTarget.name][_loc4_].hook; + _loc3_ = this._aLoadingUi[param1.uiTarget.name][_loc4_].args; + for(_loc5_ in _aEvent[_loc2_.name]) { - hook = this._aLoadingUi[e.uiTarget.name][i].hook; - args = this._aLoadingUi[e.uiTarget.name][i].args; - for (s in _aEvent[hook.name]) - { - if (_aEvent[hook.name][s]) - { - eGl = _aEvent[hook.name][s]; - if (eGl.listener == e.uiTarget.name) - { - eGl.callback.apply(null, args); - }; - if (_aEvent[hook.name] == null) break; - }; - }; - i++; - }; - delete this._aLoadingUi[e.uiTarget.name]; - } - - - } -}//package com.ankamagames.berilia.managers - + if(_aEvent[_loc2_.name][_loc5_]) + { + _loc6_ = _aEvent[_loc2_.name][_loc5_]; + if(_loc6_.listener == param1.uiTarget.name) + { + _loc6_.callback.apply(null,_loc3_); + } + if(_aEvent[_loc2_.name] == null) + { + break; + } + } + } + _loc4_++; + } + delete this._aLoadingUi[param1.uiTarget.name]; + true; + } + } +} diff --git a/com/ankamagames/berilia/managers/LinkedCursorSpriteManager.as b/com/ankamagames/berilia/managers/LinkedCursorSpriteManager.as index b20b8f19b..881e3b38f 100644 --- a/com/ankamagames/berilia/managers/LinkedCursorSpriteManager.as +++ b/com/ankamagames/berilia/managers/LinkedCursorSpriteManager.as @@ -1,155 +1,160 @@ -package com.ankamagames.berilia.managers +package com.ankamagames.berilia.managers { - import com.ankamagames.jerakine.logger.Logger; - import com.ankamagames.jerakine.logger.Log; - import flash.utils.getQualifiedClassName; - import com.ankamagames.jerakine.utils.errors.SingletonError; - import com.ankamagames.berilia.types.data.LinkedCursorData; - import com.ankamagames.berilia.Berilia; - import com.ankamagames.jerakine.utils.display.StageShareManager; - import com.ankamagames.jerakine.utils.display.EnterFrameDispatcher; - import flash.display.DisplayObject; - - public class LinkedCursorSpriteManager - { - - protected static const _log:Logger = Log.getLogger(getQualifiedClassName(LinkedCursorSpriteManager)); - private static var _self:LinkedCursorSpriteManager; - - private var items:Array; - private var _mustBeRemoved:Array; - private var _mustClean:Boolean; - - public function LinkedCursorSpriteManager() - { - this.items = new Array(); - this._mustBeRemoved = new Array(); - super(); - if (_self) + import com.ankamagames.jerakine.logger.Logger; + import com.ankamagames.jerakine.logger.Log; + import flash.utils.getQualifiedClassName; + import com.ankamagames.berilia.types.data.LinkedCursorData; + import com.ankamagames.berilia.Berilia; + import com.ankamagames.jerakine.utils.display.StageShareManager; + import com.ankamagames.jerakine.utils.display.EnterFrameDispatcher; + import flash.display.DisplayObject; + import com.ankamagames.jerakine.utils.errors.SingletonError; + + public class LinkedCursorSpriteManager extends Object + { + + public function LinkedCursorSpriteManager() + { + this.items = new Array(); + this._mustBeRemoved = new Array(); + super(); + if(_self) + { + throw new SingletonError(); + } + else + { + return; + } + } + + protected static const _log:Logger = Log.getLogger(getQualifiedClassName(LinkedCursorSpriteManager)); + + private static var _self:LinkedCursorSpriteManager; + + public static function getInstance() : LinkedCursorSpriteManager + { + if(!_self) + { + _self = new LinkedCursorSpriteManager(); + } + return _self; + } + + private var items:Array; + + private var _mustBeRemoved:Array; + + private var _mustClean:Boolean; + + public function getItem(param1:String) : LinkedCursorData + { + return this.items[param1]; + } + + public function addItem(param1:String, param2:LinkedCursorData, param3:Boolean = false) : void + { + this._mustBeRemoved[param1] = false; + if(this.items[param1]) + { + this.removeItem(param1); + } + this.items[param1] = param2; + param2.sprite.mouseChildren = false; + param2.sprite.mouseEnabled = false; + if(param3) + { + Berilia.getInstance().strataSuperTooltip.addChild(param2.sprite); + } + else + { + Berilia.getInstance().strataTooltip.addChild(param2.sprite); + } + var _loc4_:* = StageShareManager.mouseX; + var _loc5_:* = StageShareManager.mouseY; + param2.sprite.x = (param2.lockX?param2.sprite.x:StageShareManager.mouseX) - (param2.offset?param2.offset.x:param2.sprite.width / 2); + param2.sprite.y = (param2.lockY?param2.sprite.y:StageShareManager.mouseY) - (param2.offset?param2.offset.y:param2.sprite.height / 2); + if((param2.lockX) || (param2.lockY)) + { + } + this.updateCursors(); + EnterFrameDispatcher.addEventListener(this.updateCursors,"updateCursors"); + } + + public function removeItem(param1:String, param2:Boolean = false) : Boolean + { + if(!this.items[param1]) + { + return false; + } + this._mustBeRemoved[param1] = true; + if(param2) + { + this._mustClean = true; + EnterFrameDispatcher.addEventListener(this.updateCursors,"updateCursors"); + } + else + { + this.remove(param1); + } + return true; + } + + private function updateCursors(param1:* = null) : void + { + var _loc4_:LinkedCursorData = null; + var _loc5_:String = null; + if(this._mustClean) + { + this._mustClean = false; + for(_loc5_ in this._mustBeRemoved) { - throw (new SingletonError()); - }; - } - - public static function getInstance():LinkedCursorSpriteManager - { - if (!(_self)) - { - _self = new (LinkedCursorSpriteManager)(); - }; - return (_self); - } - - - public function getItem(name:String):LinkedCursorData - { - return (this.items[name]); - } - - public function addItem(name:String, item:LinkedCursorData, overAll:Boolean=false):void - { - this._mustBeRemoved[name] = false; - if (this.items[name]) - { - this.removeItem(name); - }; - this.items[name] = item; - item.sprite.mouseChildren = false; - item.sprite.mouseEnabled = false; - if (overAll) - { - Berilia.getInstance().strataSuperTooltip.addChild(item.sprite); + if((this._mustBeRemoved[_loc5_]) && (this.items[_loc5_])) + { + this.remove(_loc5_); + } } - else - { - Berilia.getInstance().strataTooltip.addChild(item.sprite); - }; - var fmouseX:* = StageShareManager.mouseX; - var fmouseY:* = StageShareManager.mouseY; - item.sprite.x = (((item.lockX) ? item.sprite.x : StageShareManager.mouseX) - ((item.offset) ? item.offset.x : (item.sprite.width / 2))); - item.sprite.y = (((item.lockY) ? item.sprite.y : StageShareManager.mouseY) - ((item.offset) ? item.offset.y : (item.sprite.height / 2))); - if (((item.lockX) || (item.lockY))) - { - }; - this.updateCursors(); - EnterFrameDispatcher.addEventListener(this.updateCursors, "updateCursors"); - } - - public function removeItem(name:String, asynch:Boolean=false):Boolean - { - if (!(this.items[name])) - { - return (false); - }; - this._mustBeRemoved[name] = true; - if (asynch) + } + var _loc2_:int = StageShareManager.mouseX; + var _loc3_:int = StageShareManager.mouseY; + for each(_loc4_ in this.items) + { + if(_loc4_) { - this._mustClean = true; - EnterFrameDispatcher.addEventListener(this.updateCursors, "updateCursors"); + if(!_loc4_.lockX) + { + _loc4_.sprite.x = _loc2_ + (_loc4_.offset?_loc4_.offset.x:0); + } + if(!_loc4_.lockY) + { + _loc4_.sprite.y = _loc3_ + (_loc4_.offset?_loc4_.offset.y:0); + } } - else - { - this.remove(name); - }; - return (true); - } - - private function updateCursors(e:*=null):void - { - var item:LinkedCursorData; - var cursorName:String; - if (this._mustClean) - { - this._mustClean = false; - for (cursorName in this._mustBeRemoved) - { - if (((this._mustBeRemoved[cursorName]) && (this.items[cursorName]))) - { - this.remove(cursorName); - }; - }; - }; - var xMouse:int = StageShareManager.mouseX; - var yMouse:int = StageShareManager.mouseY; - for each (item in this.items) - { - if (item) - { - if (!(item.lockX)) - { - item.sprite.x = (xMouse + ((item.offset) ? item.offset.x : 0)); - }; - if (!(item.lockY)) - { - item.sprite.y = (yMouse + ((item.offset) ? item.offset.y : 0)); - }; - }; - }; - } - - private function remove(name:String):void - { - var o:Object; - var s:DisplayObject = (this.items[name].sprite as DisplayObject); - if (s.parent) - { - s.parent.removeChild(s); - }; - this.items[name] = null; - delete this.items[name]; - delete this._mustBeRemoved[name]; - var empty:Boolean = true; - for (o in this.items) - { - empty = false; - }; - if (empty) - { - EnterFrameDispatcher.removeEventListener(this.updateCursors); - }; - } - - - } -}//package com.ankamagames.berilia.managers - + } + } + + private function remove(param1:String) : void + { + var _loc4_:Object = null; + var _loc2_:DisplayObject = this.items[param1].sprite as DisplayObject; + if(_loc2_.parent) + { + _loc2_.parent.removeChild(_loc2_); + } + this.items[param1] = null; + delete this.items[param1]; + true; + delete this._mustBeRemoved[param1]; + true; + var _loc3_:* = true; + for(_loc4_ in this.items) + { + _loc3_ = false; + } + if(_loc3_) + { + EnterFrameDispatcher.removeEventListener(this.updateCursors); + } + } + } +} diff --git a/com/ankamagames/berilia/managers/SecureCenter.as b/com/ankamagames/berilia/managers/SecureCenter.as index 20574ea59..ccdd025fa 100644 --- a/com/ankamagames/berilia/managers/SecureCenter.as +++ b/com/ankamagames/berilia/managers/SecureCenter.as @@ -1,160 +1,141 @@ -package com.ankamagames.berilia.managers +package com.ankamagames.berilia.managers { - import com.ankamagames.jerakine.logger.Logger; - import com.ankamagames.jerakine.logger.Log; - import flash.utils.getQualifiedClassName; - import com.ankamagames.jerakine.handlers.FocusHandler; - import com.ankamagames.jerakine.handlers.HumanInputHandler; - import flash.geom.Point; - import com.ankamagames.jerakine.interfaces.Secure; - import com.ankamagames.jerakine.interfaces.ISecurizable; - import com.ankamagames.jerakine.network.INetworkType; - import com.ankamagames.jerakine.interfaces.IDataCenter; - import com.ankamagames.jerakine.interfaces.IModuleUtil; - import flash.system.ApplicationDomain; - import com.ankamagames.berilia.types.graphic.UiRootContainer; - import com.ankamagames.berilia.types.graphic.GraphicContainer; - import com.ankamagames.berilia.api.ReadOnlyObject; - import com.ankamagames.jerakine.interfaces.INoBoxing; - import com.ankamagames.jerakine.utils.misc.CallWithParameters; - import flash.errors.IllegalOperationError; - - public class SecureCenter - { - - protected static var SharedSecureComponent:Class; - protected static var SharedReadOnlyData:Class; - protected static var DirectAccessObject:Class; - public static const ACCESS_KEY:Object = new Object(); - private static const _log:Logger = Log.getLogger(getQualifiedClassName(SecureCenter)); - - - public static function init(sharedSecureComponent:Object, sharedReadOnlyData:Object, directAccessObject:Object):void - { - SharedSecureComponent = (sharedSecureComponent as Class); - SharedReadOnlyData = (sharedReadOnlyData as Class); - DirectAccessObject = (directAccessObject as Class); - FocusHandler.getInstance().handler = HumanInputHandler.getInstance().handler; - } - - public static function destroy(target:*):void - { - switch (true) - { - case (target is SharedSecureComponent): - var _local_2 = SharedSecureComponent; - (_local_2["destroy"](target, ACCESS_KEY)); - return; - }; - } - - public static function secure(target:*, trusted:Boolean=false) - { - var iDataCenter:* = undefined; - var iModuleUtil:* = undefined; - switch (true) - { - case (target == null): - case (target is uint): - case (target is int): - case (target is Number): - case (target is String): - case (target is Boolean): - case (target is Point): - case (target == undefined): - case (target is Secure): - case ((!((SharedSecureComponent == null))) && ((target is SharedSecureComponent))): - case ((!((SharedReadOnlyData == null))) && ((target is SharedReadOnlyData))): - case ((!((DirectAccessObject == null))) && ((target is DirectAccessObject))): - return (target); - case (target is ISecurizable): - return (ISecurizable(target).getSecureObject()); - case (target is INetworkType): - return (SharedReadOnlyData["create"](target, "d2network", ACCESS_KEY)); - case (target is IDataCenter): - iDataCenter = SharedReadOnlyData["create"](target, "d2data", ACCESS_KEY); - return (iDataCenter); - case (target is IModuleUtil): - iModuleUtil = DirectAccessObject["create"](target, "d2utils", ACCESS_KEY); - return (iModuleUtil); - case (target is UiRootContainer): - return (SharedSecureComponent["getSecureComponent"](target, trusted, ((target.uiModule) ? target.uiModule.applicationDomain : new ApplicationDomain()), ACCESS_KEY)); - case (target is GraphicContainer): - return (SharedSecureComponent["getSecureComponent"](target, trusted, ((target.getUi()) ? target.getUi().uiModule.applicationDomain : null), ACCESS_KEY)); - case (target is Function): - return (function (... args) - { - var nb:* = args.length; - var i:* = 0; - while (i < nb) - { - args[i] = unsecure(args[i]); - i++; - }; - return (secure(target.apply(null, args))); - }); - default: - return (ReadOnlyObject.create(target)); - }; - } - - public static function secureContent(target:Array, trusted:Boolean=false):Array - { - var key:*; - var result:Array = []; - for (key in target) - { - result[key] = secure(target[key], trusted); - }; - return (result); - } - - public static function unsecure(target:*) - { - switch (true) - { - case (((target is Secure)) && (!((target is INoBoxing)))): - case (target is SharedSecureComponent): - case (target is SharedReadOnlyData): - case (target is DirectAccessObject): - return (target.getObject(ACCESS_KEY)); - case (target is Function): - return (function (... args) - { - var nb:* = args.length; - var i:* = 0; - while (i < nb) - { - args[i] = secure(args[i]); - i++; - }; - var result:* = CallWithParameters.callR(target, args); - return (unsecure(result)); - }); - }; - return (target); - } - - public static function unsecureContent(target:Array):Array - { - var key:*; - var result:Array = []; - for (key in target) - { - result[key] = unsecure(target[key]); - }; - return (result); - } - - public static function checkAccessKey(accessKey:Object):void - { - if (accessKey != ACCESS_KEY) - { - throw (new IllegalOperationError("Wrong access key")); - }; - } - - - } -}//package com.ankamagames.berilia.managers - + import com.ankamagames.jerakine.logger.Logger; + import com.ankamagames.jerakine.handlers.FocusHandler; + import com.ankamagames.jerakine.handlers.HumanInputHandler; + import com.ankamagames.jerakine.interfaces.ISecurizable; + import flash.system.ApplicationDomain; + import com.ankamagames.berilia.api.ReadOnlyObject; + import flash.geom.Point; + import com.ankamagames.jerakine.interfaces.Secure; + import com.ankamagames.jerakine.network.INetworkType; + import com.ankamagames.jerakine.interfaces.IDataCenter; + import com.ankamagames.jerakine.interfaces.IModuleUtil; + import com.ankamagames.berilia.types.graphic.UiRootContainer; + import com.ankamagames.berilia.types.graphic.GraphicContainer; + import com.ankamagames.jerakine.utils.misc.CallWithParameters; + import com.ankamagames.jerakine.interfaces.INoBoxing; + import flash.errors.IllegalOperationError; + import com.ankamagames.jerakine.logger.Log; + import flash.utils.getQualifiedClassName; + + public class SecureCenter extends Object + { + + public function SecureCenter() + { + super(); + } + + protected static var SharedSecureComponent:Class; + + protected static var SharedReadOnlyData:Class; + + protected static var DirectAccessObject:Class; + + public static const ACCESS_KEY:Object = new Object(); + + private static const _log:Logger = Log.getLogger(getQualifiedClassName(SecureCenter)); + + public static function init(param1:Object, param2:Object, param3:Object) : void + { + SharedSecureComponent = param1 as Class; + SharedReadOnlyData = param2 as Class; + DirectAccessObject = param3 as Class; + FocusHandler.getInstance().handler = HumanInputHandler.getInstance().handler; + } + + public static function destroy(param1:*) : void + { + switch(true) + { + case param1 is SharedSecureComponent: + SharedSecureComponent["destroy"](param1,ACCESS_KEY); + break; + } + } + + public static function secure(param1:*, param2:Boolean = false) : * + { + var iDataCenter:* = undefined; + var iModuleUtil:* = undefined; + var target:* = param1; + var trusted:Boolean = param2; + switch(true) + { + case target == null: + case target is uint: + case target is int: + case target is Number: + case target is String: + case target is Boolean: + case target is Point: + case target == undefined: + case target is Secure: + return target; + } + } + + public static function secureContent(param1:Array, param2:Boolean = false) : Array + { + var _loc4_:* = undefined; + var _loc3_:Array = []; + for(_loc4_ in param1) + { + _loc3_[_loc4_] = secure(param1[_loc4_],param2); + } + return _loc3_; + } + + public static function unsecure(param1:*) : * + { + var target:* = param1; + switch(null) + { + case target is Secure && !(target is INoBoxing): + case target is SharedSecureComponent: + case target is SharedReadOnlyData: + case target is DirectAccessObject: + return target.getObject(ACCESS_KEY); + case target is Function: + return function(... rest):* + { + var _loc2_:* = rest.length; + var _loc3_:* = 0; + while(_loc3_ < _loc2_) + { + rest[_loc3_] = secure(rest[_loc3_]); + _loc3_++; + } + var _loc4_:* = CallWithParameters.callR(target,rest); + return unsecure(_loc4_); + }; + default: + return target; + } + } + + public static function unsecureContent(param1:Array) : Array + { + var _loc3_:* = undefined; + var _loc2_:Array = []; + for(_loc3_ in param1) + { + _loc2_[_loc3_] = unsecure(param1[_loc3_]); + } + return _loc2_; + } + + public static function checkAccessKey(param1:Object) : void + { + if(param1 != ACCESS_KEY) + { + throw new IllegalOperationError("Wrong access key"); + } + else + { + return; + } + } + } +} diff --git a/com/ankamagames/berilia/managers/SlotDataHolderManager.as b/com/ankamagames/berilia/managers/SlotDataHolderManager.as index 433e44d02..c5b842f33 100644 --- a/com/ankamagames/berilia/managers/SlotDataHolderManager.as +++ b/com/ankamagames/berilia/managers/SlotDataHolderManager.as @@ -1,80 +1,77 @@ -package com.ankamagames.berilia.managers +package com.ankamagames.berilia.managers { - import com.ankamagames.jerakine.logger.Logger; - import com.ankamagames.jerakine.logger.Log; - import flash.utils.getQualifiedClassName; - import flash.utils.Dictionary; - import __AS3__.vec.Vector; - import com.ankamagames.jerakine.interfaces.ISlotData; - import com.ankamagames.jerakine.interfaces.ISlotDataHolder; - import __AS3__.vec.*; - - public class SlotDataHolderManager - { - - protected static const _log:Logger = Log.getLogger(getQualifiedClassName(SlotDataHolderManager)); - - private var _weakHolderReference:Dictionary; - private var _linkedSlotsData:Vector.; - - public function SlotDataHolderManager(linkedSlotData:ISlotData) - { - this._weakHolderReference = new Dictionary(true); - super(); + import com.ankamagames.jerakine.logger.Logger; + import com.ankamagames.jerakine.logger.Log; + import flash.utils.getQualifiedClassName; + import flash.utils.Dictionary; + import com.ankamagames.jerakine.interfaces.ISlotData; + import com.ankamagames.jerakine.interfaces.ISlotDataHolder; + + public class SlotDataHolderManager extends Object + { + + public function SlotDataHolderManager(param1:ISlotData) + { + this._weakHolderReference = new Dictionary(true); + super(); + this._linkedSlotsData = new Vector.(); + this._linkedSlotsData.push(param1); + } + + protected static const _log:Logger = Log.getLogger(getQualifiedClassName(SlotDataHolderManager)); + + private var _weakHolderReference:Dictionary; + + private var _linkedSlotsData:Vector.; + + public function setLinkedSlotData(param1:ISlotData) : void + { + if(!this._linkedSlotsData) + { this._linkedSlotsData = new Vector.(); - this._linkedSlotsData.push(linkedSlotData); - } - - public function setLinkedSlotData(slotData:ISlotData):void - { - if (!(this._linkedSlotsData)) + } + if(this._linkedSlotsData.indexOf(param1) == -1) + { + this._linkedSlotsData.push(param1); + } + } + + public function addHolder(param1:ISlotDataHolder) : void + { + this._weakHolderReference[param1] = true; + } + + public function removeHolder(param1:ISlotDataHolder) : void + { + delete this._weakHolderReference[param1]; + true; + } + + public function getHolders() : Array + { + var _loc2_:Object = null; + var _loc1_:Array = []; + for(_loc2_ in this._weakHolderReference) + { + _loc1_.push(_loc2_); + } + return _loc1_; + } + + public function refreshAll() : void + { + var _loc1_:Object = null; + var _loc2_:ISlotData = null; + for(_loc1_ in this._weakHolderReference) + { + for each(_loc2_ in this._linkedSlotsData) { - this._linkedSlotsData = new Vector.(); - }; - if (this._linkedSlotsData.indexOf(slotData) == -1) - { - this._linkedSlotsData.push(slotData); - }; - } - - public function addHolder(h:ISlotDataHolder):void - { - this._weakHolderReference[h] = true; - } - - public function removeHolder(h:ISlotDataHolder):void - { - delete this._weakHolderReference[h]; - } - - public function getHolders():Array - { - var h:Object; - var result:Array = []; - for (h in this._weakHolderReference) - { - result.push(h); - }; - return (result); - } - - public function refreshAll():void - { - var h:Object; - var linkedSlotData:ISlotData; - for (h in this._weakHolderReference) - { - for each (linkedSlotData in this._linkedSlotsData) - { - if (((h) && ((ISlotDataHolder(h).data === linkedSlotData)))) - { - h.refresh(); - }; - }; - }; - } - - - } -}//package com.ankamagames.berilia.managers - + if((_loc1_) && ISlotDataHolder(_loc1_).data === _loc2_) + { + _loc1_.refresh(); + } + } + } + } + } +} diff --git a/com/ankamagames/berilia/managers/TemplateManager.as b/com/ankamagames/berilia/managers/TemplateManager.as index ca7ce8259..62259b31f 100644 --- a/com/ankamagames/berilia/managers/TemplateManager.as +++ b/com/ankamagames/berilia/managers/TemplateManager.as @@ -1,126 +1,130 @@ -package com.ankamagames.berilia.managers +package com.ankamagames.berilia.managers { - import flash.events.EventDispatcher; - import com.ankamagames.jerakine.logger.Logger; - import com.ankamagames.jerakine.logger.Log; - import flash.utils.getQualifiedClassName; - import com.ankamagames.jerakine.resources.loaders.IResourceLoader; - import com.ankamagames.jerakine.newCache.impl.Cache; - import com.ankamagames.berilia.utils.errors.BeriliaError; - import com.ankamagames.jerakine.resources.loaders.ResourceLoaderFactory; - import com.ankamagames.jerakine.resources.loaders.ResourceLoaderType; - import com.ankamagames.jerakine.resources.events.ResourceLoadedEvent; - import com.ankamagames.jerakine.resources.events.ResourceErrorEvent; - import com.ankamagames.jerakine.newCache.garbage.LruGarbageCollector; - import com.ankamagames.berilia.types.template.XmlTemplate; - import com.ankamagames.berilia.types.event.TemplateLoadedEvent; - import com.ankamagames.jerakine.types.Uri; - - public class TemplateManager extends EventDispatcher - { - - protected static const _log:Logger = Log.getLogger(getQualifiedClassName(TemplateManager)); - private static var _self:TemplateManager; - - private var _aTemplates:Array; - private var _loader:IResourceLoader; - private var _cache:Cache; - - public function TemplateManager() - { - if (_self != null) - { - throw (new BeriliaError("TemplateManager is a singleton and should not be instanciated directly.")); - }; + import flash.events.EventDispatcher; + import com.ankamagames.jerakine.logger.Logger; + import com.ankamagames.jerakine.logger.Log; + import flash.utils.getQualifiedClassName; + import com.ankamagames.jerakine.resources.loaders.IResourceLoader; + import com.ankamagames.jerakine.newCache.impl.Cache; + import com.ankamagames.jerakine.newCache.garbage.LruGarbageCollector; + import com.ankamagames.berilia.types.template.XmlTemplate; + import com.ankamagames.berilia.types.event.TemplateLoadedEvent; + import com.ankamagames.jerakine.types.Uri; + import com.ankamagames.jerakine.resources.events.ResourceLoadedEvent; + import com.ankamagames.jerakine.resources.events.ResourceErrorEvent; + import com.ankamagames.berilia.utils.errors.BeriliaError; + import com.ankamagames.jerakine.resources.loaders.ResourceLoaderFactory; + import com.ankamagames.jerakine.resources.loaders.ResourceLoaderType; + + public class TemplateManager extends EventDispatcher + { + + public function TemplateManager() + { + super(); + if(_self != null) + { + throw new BeriliaError("TemplateManager is a singleton and should not be instanciated directly."); + } + else + { this._loader = ResourceLoaderFactory.getLoader(ResourceLoaderType.SERIAL_LOADER); - this._loader.addEventListener(ResourceLoadedEvent.LOADED, this.objectLoaded); - this._loader.addEventListener(ResourceErrorEvent.ERROR, this.objectLoadedFailed); + this._loader.addEventListener(ResourceLoadedEvent.LOADED,this.objectLoaded); + this._loader.addEventListener(ResourceErrorEvent.ERROR,this.objectLoadedFailed); this.init(); - } - - public static function getInstance():TemplateManager - { - if (_self == null) - { - _self = new (TemplateManager)(); - }; - return (_self); - } - - - public function init():void - { - this._aTemplates = new Array(); - this._cache = Cache.create(30, new LruGarbageCollector(), getQualifiedClassName(this)); - } - - public function getTemplate(sName:String):XmlTemplate - { - var aTmp:Array = sName.split("/"); - var sFileName:String = aTmp[(aTmp.length - 1)]; - if (-1 == sFileName.indexOf(".xml")) - { - sFileName = (sFileName + ".xml"); - }; - return (this._aTemplates[sFileName]); - } - - public function isRegistered(sPath:String):Boolean - { - var aTmp:Array = sPath.split("/"); - var sFileName:String = aTmp[(aTmp.length - 1)]; - return (!((this._aTemplates[sFileName] == null))); - } - - public function isLoaded(sPath:String):Boolean - { - var aTmp:Array = sPath.split("/"); - var sFileName:String = aTmp[(aTmp.length - 1)]; - return ((this._aTemplates[sFileName] is XmlTemplate)); - } - - public function areLoaded(aPath:Array):Boolean - { - var i:uint; - while (i < aPath.length) + return; + } + } + + protected static const _log:Logger = Log.getLogger(getQualifiedClassName(TemplateManager)); + + private static var _self:TemplateManager; + + public static function getInstance() : TemplateManager + { + if(_self == null) + { + _self = new TemplateManager(); + } + return _self; + } + + private var _aTemplates:Array; + + private var _loader:IResourceLoader; + + private var _cache:Cache; + + public function init() : void + { + this._aTemplates = new Array(); + this._cache = Cache.create(30,new LruGarbageCollector(),getQualifiedClassName(this)); + } + + public function getTemplate(param1:String) : XmlTemplate + { + var _loc2_:Array = param1.split("/"); + var _loc3_:String = _loc2_[_loc2_.length - 1]; + if(-1 == _loc3_.indexOf(".xml")) + { + _loc3_ = _loc3_ + ".xml"; + } + return this._aTemplates[_loc3_]; + } + + public function isRegistered(param1:String) : Boolean + { + var _loc2_:Array = param1.split("/"); + var _loc3_:String = _loc2_[_loc2_.length - 1]; + return !(this._aTemplates[_loc3_] == null); + } + + public function isLoaded(param1:String) : Boolean + { + var _loc2_:Array = param1.split("/"); + var _loc3_:String = _loc2_[_loc2_.length - 1]; + return this._aTemplates[_loc3_] is XmlTemplate; + } + + public function areLoaded(param1:Array) : Boolean + { + var _loc2_:uint = 0; + while(_loc2_ < param1.length) + { + if(!this.isLoaded(param1[_loc2_])) { - if (!(this.isLoaded(aPath[i]))) - { - return (false); - }; - i++; - }; - return (!((aPath.length == 0))); - } - - public function register(sPath:String):void - { - var aTmp:Array = sPath.split("/"); - var sFileName:String = aTmp[(aTmp.length - 1)]; - if (this.isRegistered(sFileName)) + return false; + } + _loc2_++; + } + return !(param1.length == 0); + } + + public function register(param1:String) : void + { + var _loc2_:Array = param1.split("/"); + var _loc3_:String = _loc2_[_loc2_.length - 1]; + if(this.isRegistered(_loc3_)) + { + if(this.isLoaded(_loc3_)) { - if (this.isLoaded(sFileName)) - { - dispatchEvent(new TemplateLoadedEvent(sPath)); - }; - return; - }; - this._aTemplates[sFileName] = false; - this._loader.load(new Uri(sPath)); - } - - public function objectLoaded(e:ResourceLoadedEvent):void - { - this._aTemplates[e.uri.fileName] = new XmlTemplate(e.resource, e.uri.fileName); - dispatchEvent(new TemplateLoadedEvent(e.uri.uri)); - } - - public function objectLoadedFailed(e:ResourceErrorEvent):void - { - _log.debug(((("objectLoadedFailed : " + e.uri) + " : ") + e.errorMsg)); - } - - - } -}//package com.ankamagames.berilia.managers - + dispatchEvent(new TemplateLoadedEvent(param1)); + } + return; + } + this._aTemplates[_loc3_] = false; + this._loader.load(new Uri(param1)); + } + + public function objectLoaded(param1:ResourceLoadedEvent) : void + { + this._aTemplates[param1.uri.fileName] = new XmlTemplate(param1.resource,param1.uri.fileName); + dispatchEvent(new TemplateLoadedEvent(param1.uri.uri)); + } + + public function objectLoadedFailed(param1:ResourceErrorEvent) : void + { + _log.debug("objectLoadedFailed : " + param1.uri + " : " + param1.errorMsg); + } + } +} diff --git a/com/ankamagames/berilia/managers/ThemeManager.as b/com/ankamagames/berilia/managers/ThemeManager.as index 79a0e80d1..f726c65d2 100644 --- a/com/ankamagames/berilia/managers/ThemeManager.as +++ b/com/ankamagames/berilia/managers/ThemeManager.as @@ -1,284 +1,296 @@ -package com.ankamagames.berilia.managers +package com.ankamagames.berilia.managers { - import com.ankamagames.jerakine.logger.Logger; - import com.ankamagames.jerakine.logger.Log; - import flash.utils.getQualifiedClassName; - import com.ankamagames.jerakine.resources.loaders.IResourceLoader; - import flash.filesystem.File; - import com.ankamagames.jerakine.utils.errors.SingletonError; - import com.ankamagames.jerakine.resources.loaders.ResourceLoaderFactory; - import com.ankamagames.jerakine.resources.loaders.ResourceLoaderType; - import com.ankamagames.jerakine.resources.events.ResourceErrorEvent; - import com.ankamagames.jerakine.resources.events.ResourceLoadedEvent; - import com.ankamagames.jerakine.utils.system.AirScanner; - import com.ankamagames.jerakine.resources.protocols.ProtocolFactory; - import com.ankamagames.berilia.utils.ThemeFlashProtocol; - import com.ankamagames.berilia.utils.ThemeProtocol; - import com.ankamagames.jerakine.types.Uri; - import flash.filesystem.FileStream; - import com.ankamagames.jerakine.managers.LangManager; - import com.ankamagames.jerakine.utils.system.SystemManager; - import com.ankamagames.jerakine.enum.OperatingSystem; - import flash.filesystem.FileMode; - import com.ankamagames.jerakine.managers.ErrorManager; - import com.ankamagames.berilia.Berilia; - import com.ankamagames.berilia.types.messages.ThemeLoadErrorMessage; - import com.ankamagames.berilia.types.data.Theme; - import com.ankamagames.berilia.types.messages.NoThemeErrorMessage; - import com.ankamagames.jerakine.managers.OptionManager; - import com.ankamagames.jerakine.data.XmlConfig; - import com.ankamagames.berilia.types.messages.ThemeLoadedMessage; - - public class ThemeManager - { - - protected static const _log:Logger = Log.getLogger(getQualifiedClassName(ThemeManager)); - private static var _self:ThemeManager; - - private var _loader:IResourceLoader; - private var _themes:Array; - private var _themeNames:Array; - private var _dtFileToLoad:uint = 0; - private var _themeCount:uint = 0; - private var _themesRoot:File; - private var _currentTheme:String; - private var _applyWaiting:String = ""; - - public function ThemeManager() - { - if (_self) - { - throw (new SingletonError()); - }; + import com.ankamagames.jerakine.logger.Logger; + import com.ankamagames.jerakine.logger.Log; + import flash.utils.getQualifiedClassName; + import com.ankamagames.jerakine.resources.loaders.IResourceLoader; + import flash.filesystem.File; + import com.ankamagames.jerakine.types.Uri; + import flash.filesystem.FileStream; + import com.ankamagames.jerakine.managers.LangManager; + import com.ankamagames.jerakine.utils.system.SystemManager; + import com.ankamagames.jerakine.enum.OperatingSystem; + import flash.filesystem.FileMode; + import com.ankamagames.jerakine.managers.ErrorManager; + import com.ankamagames.berilia.Berilia; + import com.ankamagames.berilia.types.messages.ThemeLoadErrorMessage; + import com.ankamagames.berilia.types.data.Theme; + import com.ankamagames.berilia.types.messages.NoThemeErrorMessage; + import com.ankamagames.jerakine.managers.OptionManager; + import com.ankamagames.jerakine.data.XmlConfig; + import com.ankamagames.jerakine.resources.events.ResourceErrorEvent; + import com.ankamagames.jerakine.resources.events.ResourceLoadedEvent; + import com.ankamagames.berilia.types.messages.ThemeLoadedMessage; + import com.ankamagames.jerakine.utils.errors.SingletonError; + import com.ankamagames.jerakine.resources.loaders.ResourceLoaderFactory; + import com.ankamagames.jerakine.resources.loaders.ResourceLoaderType; + import com.ankamagames.jerakine.utils.system.AirScanner; + import com.ankamagames.jerakine.resources.protocols.ProtocolFactory; + import com.ankamagames.berilia.utils.ThemeFlashProtocol; + import com.ankamagames.berilia.utils.ThemeProtocol; + + public class ThemeManager extends Object + { + + public function ThemeManager() + { + super(); + if(_self) + { + throw new SingletonError(); + } + else + { this._loader = ResourceLoaderFactory.getLoader(ResourceLoaderType.PARALLEL_LOADER); - this._loader.addEventListener(ResourceErrorEvent.ERROR, this.onLoadError, false, 0, true); - this._loader.addEventListener(ResourceLoadedEvent.LOADED, this.onLoad, false, 0, true); - if (AirScanner.isStreamingVersion()) + this._loader.addEventListener(ResourceErrorEvent.ERROR,this.onLoadError,false,0,true); + this._loader.addEventListener(ResourceLoadedEvent.LOADED,this.onLoad,false,0,true); + if(AirScanner.isStreamingVersion()) { - ProtocolFactory.addProtocol("theme", ThemeFlashProtocol); + ProtocolFactory.addProtocol("theme",ThemeFlashProtocol); } else { - ProtocolFactory.addProtocol("theme", ThemeProtocol); - }; - } - - public static function getInstance():ThemeManager - { - if (!(_self)) - { - _self = new (ThemeManager)(); - }; - return (_self); - } - - - public function get themeCount():uint - { - return (this._themeCount); - } - - public function get currentTheme():String - { - return (this._currentTheme); - } - - public function init():void - { - var uri:Uri; - var file:File; - var dtFile:File; - var len:int; - var substr:String; - var fs:FileStream; - var data:XML; - var folder:Array; - this._themes = new Array(); - this._themeNames = new Array(); - this._themeCount = 0; - this._dtFileToLoad = 0; - var themePath:String = ((File.applicationDirectory.nativePath + File.separator) + LangManager.getInstance().getEntry("config.ui.common.themes").replace("file://", "")); - this._themesRoot = new File(themePath); - if (this._themesRoot.exists) - { - for each (file in this._themesRoot.getDirectoryListing()) - { - if (!((!(file.isDirectory)) || ((file.name.charAt(0) == ".")))) - { - dtFile = this.searchDtFile(file); - if (dtFile) - { - this._dtFileToLoad++; - if (dtFile.url.indexOf("app:/") == 0) - { - len = "app:/".length; - substr = dtFile.url.substring(len, dtFile.url.length); - uri = new Uri(substr); - } - else - { - uri = new Uri(dtFile.nativePath); - }; - uri.tag = dtFile; - if (SystemManager.getSingleton().os == OperatingSystem.MAC_OS) - { - _log.debug((("Using FileStream to load " + dtFile.nativePath) + " on MAC OS X!")); - fs = new FileStream(); - fs.open(dtFile, FileMode.READ); - data = XML(fs.readUTFBytes(fs.bytesAvailable)); - fs.close(); - folder = uri.path.split("/"); - this.loadDT(data, uri.fileName.split(".")[0], folder[(folder.length - 2)]); - } - else - { - this._loader.load(uri); - }; - } - else - { - ErrorManager.addError(("Impossible de trouver le fichier de description de thème dans le dossier " + file.nativePath)); - Berilia.getInstance().handler.process(new ThemeLoadErrorMessage(file.name)); - }; - }; - }; + ProtocolFactory.addProtocol("theme",ThemeProtocol); } - else + return; + } + } + + protected static const _log:Logger = Log.getLogger(getQualifiedClassName(ThemeManager)); + + private static var _self:ThemeManager; + + public static function getInstance() : ThemeManager + { + if(!_self) + { + _self = new ThemeManager(); + } + return _self; + } + + private var _loader:IResourceLoader; + + private var _themes:Array; + + private var _themeNames:Array; + + private var _dtFileToLoad:uint = 0; + + private var _themeCount:uint = 0; + + private var _themesRoot:File; + + private var _currentTheme:String; + + private var _applyWaiting:String = ""; + + public function get themeCount() : uint + { + return this._themeCount; + } + + public function get currentTheme() : String + { + return this._currentTheme; + } + + public function init() : void + { + var _loc2_:Uri = null; + var _loc3_:File = null; + var _loc4_:File = null; + var _loc5_:* = 0; + var _loc6_:String = null; + var _loc7_:FileStream = null; + var _loc8_:XML = null; + var _loc9_:Array = null; + this._themes = new Array(); + this._themeNames = new Array(); + this._themeCount = 0; + this._dtFileToLoad = 0; + var _loc1_:String = File.applicationDirectory.nativePath + File.separator + LangManager.getInstance().getEntry("config.ui.common.themes").replace("file://",""); + this._themesRoot = new File(_loc1_); + if(this._themesRoot.exists) + { + for each(_loc3_ in this._themesRoot.getDirectoryListing()) { - ErrorManager.addError((("Le dossier des thèmes est introuvable (url:" + LangManager.getInstance().getEntry("config.ui.common.themes")) + ")")); - }; - } - - public function getThemes():Array - { - return (this._themes); - } - - public function getTheme(name:String):Theme - { - return (this._themes[name]); - } - - public function applyTheme(name:String):void - { - var _local_2:String; - if (this._dtFileToLoad == this._themeCount) + if(!(!_loc3_.isDirectory || _loc3_.name.charAt(0) == ".")) + { + _loc4_ = this.searchDtFile(_loc3_); + if(_loc4_) + { + this._dtFileToLoad++; + if(_loc4_.url.indexOf("app:/") == 0) + { + _loc5_ = "app:/".length; + _loc6_ = _loc4_.url.substring(_loc5_,_loc4_.url.length); + _loc2_ = new Uri(_loc6_); + } + else + { + _loc2_ = new Uri(_loc4_.nativePath); + } + _loc2_.tag = _loc4_; + if(SystemManager.getSingleton().os == OperatingSystem.MAC_OS) + { + _log.debug("Using FileStream to load " + _loc4_.nativePath + " on MAC OS X!"); + _loc7_ = new FileStream(); + _loc7_.open(_loc4_,FileMode.READ); + _loc8_ = XML(_loc7_.readUTFBytes(_loc7_.bytesAvailable)); + _loc7_.close(); + _loc9_ = _loc2_.path.split("/"); + this.loadDT(_loc8_,_loc2_.fileName.split(".")[0],_loc9_[_loc9_.length - 2]); + } + else + { + this._loader.load(_loc2_); + } + } + else + { + ErrorManager.addError("Impossible de trouver le fichier de description de thème dans le dossier " + _loc3_.nativePath); + Berilia.getInstance().handler.process(new ThemeLoadErrorMessage(_loc3_.name)); + } + } + } + } + else + { + ErrorManager.addError("Le dossier des thèmes est introuvable (url:" + LangManager.getInstance().getEntry("config.ui.common.themes") + ")"); + } + } + + public function getThemes() : Array + { + return this._themes; + } + + public function getTheme(param1:String) : Theme + { + return this._themes[param1]; + } + + public function applyTheme(param1:String) : void + { + var _loc2_:String = null; + if(this._dtFileToLoad == this._themeCount) + { + if(this._themeNames.length == 0) { - if (this._themeNames.length == 0) - { - Berilia.getInstance().handler.process(new NoThemeErrorMessage()); - } - else - { - this._applyWaiting = null; - if (!(this._themes[name])) - { - name = this._themeNames[0]; - OptionManager.getOptionManager("dofus")["switchUiSkin"] = name; - UiRenderManager.getInstance().clearCache(); - }; - this._currentTheme = name; - _local_2 = ((LangManager.getInstance().getEntry("config.ui.common.themes") + name) + "/"); - LangManager.getInstance().setEntry("config.ui.skin", _local_2, "string"); - XmlConfig.getInstance().setEntry("config.ui.skin", _local_2); - LangManager.getInstance().loadFile((_local_2 + "colors.xml")); - }; + Berilia.getInstance().handler.process(new NoThemeErrorMessage()); } else { - this._applyWaiting = name; - }; - } - - private function onLoadError(e:ResourceErrorEvent):void - { - var f:File; - _log.error((((("Cannot load " + e.uri) + "(") + e.errorMsg) + ")")); - var path:String = e.uri.toString(); - try - { - f = e.uri.toFile(); - path = (path + (("(" + f.nativePath) + ")")); + this._applyWaiting = null; + if(!this._themes[param1]) + { + var param1:String = this._themeNames[0]; + OptionManager.getOptionManager("dofus")["switchUiSkin"] = param1; + UiRenderManager.getInstance().clearCache(); + } + this._currentTheme = param1; + _loc2_ = LangManager.getInstance().getEntry("config.ui.common.themes") + param1 + "/"; + LangManager.getInstance().setEntry("config.ui.skin",_loc2_,"string"); + XmlConfig.getInstance().setEntry("config.ui.skin",_loc2_); + LangManager.getInstance().loadFile(_loc2_ + "colors.xml"); } - catch(e:Error) - { - }; - ErrorManager.addError(("Cannot load " + path)); - Berilia.getInstance().handler.process(new ThemeLoadErrorMessage(e.uri.fileName)); - } - - private function onLoad(e:ResourceLoadedEvent):void - { - switch (e.uri.fileType.toLowerCase()) + } + else + { + this._applyWaiting = param1; + } + } + + private function onLoadError(param1:ResourceErrorEvent) : void + { + var _loc3_:File = null; + _log.error("Cannot load " + param1.uri + "(" + param1.errorMsg + ")"); + var _loc2_:String = param1.uri.toString(); + try + { + _loc3_ = param1.uri.toFile(); + _loc2_ = _loc2_ + ("(" + _loc3_.nativePath + ")"); + } + catch(e:Error) + { + } + ErrorManager.addError("Cannot load " + _loc2_); + Berilia.getInstance().handler.process(new ThemeLoadErrorMessage(param1.uri.fileName)); + } + + private function onLoad(param1:ResourceLoadedEvent) : void + { + switch(param1.uri.fileType.toLowerCase()) + { + case "dt": + this.onDTLoad(param1); + break; + } + } + + private function onDTLoad(param1:ResourceLoadedEvent) : void + { + var _loc2_:XML = param1.resource as XML; + var _loc3_:String = param1.uri.fileName.split(".")[0]; + var _loc4_:* = param1.uri.path.split("/"); + var _loc5_:String = _loc4_[_loc4_.length - 2]; + this.loadDT(_loc2_,_loc3_,_loc5_); + } + + private function loadDT(param1:XML, param2:String, param3:String) : void + { + var _loc4_:String = null; + var _loc5_:String = null; + var _loc6_:Theme = null; + this._themeCount++; + if(param2 == param3) + { + _loc4_ = param1.name; + _loc5_ = param1.description; + _loc6_ = new Theme(param2,_loc4_,_loc5_,param1.previewUri); + this._themes[param2] = _loc6_; + this._themeNames.push(param2); + Berilia.getInstance().handler.process(new ThemeLoadedMessage(param2)); + if(this._applyWaiting != "") { - case "dt": - this.onDTLoad(e); - return; - }; - } - - private function onDTLoad(e:ResourceLoadedEvent):void - { - var dt:XML = (e.resource as XML); - var dtFileName:String = e.uri.fileName.split(".")[0]; - var folder:Array = e.uri.path.split("/"); - var folderName:String = folder[(folder.length - 2)]; - this.loadDT(dt, dtFileName, folderName); - } - - private function loadDT(dt:XML, dtFileName:String, folderName:String):void - { - var thName:String; - var thDesc:String; - var th:Theme; - this._themeCount++; - if (dtFileName == folderName) - { - thName = dt.name; - thDesc = dt.description; - th = new Theme(dtFileName, thName, thDesc, dt.previewUri); - this._themes[dtFileName] = th; - this._themeNames.push(dtFileName); - Berilia.getInstance().handler.process(new ThemeLoadedMessage(dtFileName)); - if (this._applyWaiting != "") - { - this.applyTheme(this._applyWaiting); - }; + this.applyTheme(this._applyWaiting); } - else - { - Berilia.getInstance().handler.process(new ThemeLoadErrorMessage(dtFileName)); - }; - } - - private function searchDtFile(rootPath:File):File - { - var file:File; - var dt:File; - if (rootPath.nativePath.indexOf(".svn") != -1) + } + else + { + Berilia.getInstance().handler.process(new ThemeLoadErrorMessage(param2)); + } + } + + private function searchDtFile(param1:File) : File + { + var _loc3_:File = null; + var _loc4_:File = null; + if(param1.nativePath.indexOf(".svn") != -1) + { + return null; + } + var _loc2_:Array = param1.getDirectoryListing(); + for each(_loc3_ in _loc2_) + { + if(!_loc3_.isDirectory && _loc3_.extension.toLowerCase() == "dt") { - return (null); - }; - var files:Array = rootPath.getDirectoryListing(); - for each (file in files) - { - if (((!(file.isDirectory)) && ((file.extension.toLowerCase() == "dt")))) - { - return (file); - }; - }; - for each (file in files) + return _loc3_; + } + } + for each(_loc3_ in _loc2_) + { + if(_loc3_.isDirectory) { - if (file.isDirectory) - { - dt = this.searchDtFile(file); - if (dt) break; - }; - }; - return (dt); - } - - - } -}//package com.ankamagames.berilia.managers - + _loc4_ = this.searchDtFile(_loc3_); + if(_loc4_) + { + break; + } + } + } + return _loc4_; + } + } +} diff --git a/com/ankamagames/berilia/managers/TooltipManager.as b/com/ankamagames/berilia/managers/TooltipManager.as index d5bed2a43..0d8f57f24 100644 --- a/com/ankamagames/berilia/managers/TooltipManager.as +++ b/com/ankamagames/berilia/managers/TooltipManager.as @@ -1,380 +1,390 @@ -package com.ankamagames.berilia.managers +package com.ankamagames.berilia.managers { - import com.ankamagames.jerakine.logger.Logger; - import com.ankamagames.jerakine.logger.Log; - import flash.utils.getQualifiedClassName; - import flash.utils.Dictionary; - import com.ankamagames.berilia.types.tooltip.Tooltip; - import com.ankamagames.berilia.Berilia; - import com.ankamagames.berilia.types.event.UiRenderEvent; - import com.ankamagames.berilia.types.event.UiUnloadEvent; - import flash.display.DisplayObjectContainer; - import com.ankamagames.berilia.components.params.TooltipProperties; - import com.ankamagames.berilia.factories.TooltipsFactory; - import com.ankamagames.berilia.enums.StrataEnum; - import com.ankamagames.jerakine.types.Callback; - import com.ankamagames.berilia.types.data.UiModule; - import com.ankamagames.berilia.types.tooltip.TooltipPlacer; - import com.ankamagames.berilia.types.graphic.UiRootContainer; - import com.ankamagames.berilia.types.tooltip.TooltipRectangle; - import com.ankamagames.berilia.types.data.UiData; - import flash.geom.Point; - import flash.geom.Rectangle; - import com.ankamagames.jerakine.utils.display.StageShareManager; - import flash.display.DisplayObject; - import com.ankamagames.berilia.interfaces.IApplicationContainer; - - public class TooltipManager - { - - protected static var _log:Logger = Log.getLogger(getQualifiedClassName(TooltipManager)); - private static var _tooltips:Array = new Array(); - private static var _tooltipsStrata:Array = new Array(); - private static var _tooltipsDico:Dictionary = new Dictionary(); - private static const TOOLTIP_UI_NAME_PREFIX:String = "tooltip_"; - public static const TOOLTIP_STANDAR_NAME:String = "standard"; - public static var _tooltipCache:Dictionary = new Dictionary(); - public static var _tooltipCacheParam:Dictionary = new Dictionary(); - public static var defaultTooltipUiScript:Class; - private static var _isInit:Boolean = false; - - - public static function show(data:*, target:*, uiModule:UiModule, autoHide:Boolean=true, name:String="standard", point:uint=0, relativePoint:uint=2, offset:int=3, usePrefix:Boolean=true, tooltipMaker:String=null, script:Class=null, makerParam:Object=null, cacheName:String=null, mouseEnabled:Boolean=false, strata:int=4, zoom:Number=1, alwaysDisplayed:Boolean=true):Tooltip - { - var cacheNameInfo:Array; - var tooltipCache:Tooltip; - if (!(_isInit)) + import com.ankamagames.jerakine.logger.Logger; + import flash.utils.Dictionary; + import com.ankamagames.berilia.types.tooltip.Tooltip; + import com.ankamagames.berilia.types.data.UiModule; + import com.ankamagames.berilia.Berilia; + import com.ankamagames.berilia.types.event.UiRenderEvent; + import com.ankamagames.berilia.types.event.UiUnloadEvent; + import flash.display.DisplayObjectContainer; + import com.ankamagames.berilia.components.params.TooltipProperties; + import com.ankamagames.berilia.factories.TooltipsFactory; + import flash.utils.getQualifiedClassName; + import com.ankamagames.berilia.enums.StrataEnum; + import com.ankamagames.jerakine.types.Callback; + import com.ankamagames.berilia.types.tooltip.TooltipPlacer; + import com.ankamagames.berilia.types.graphic.UiRootContainer; + import com.ankamagames.berilia.types.tooltip.TooltipRectangle; + import com.ankamagames.berilia.types.data.UiData; + import flash.geom.Point; + import flash.geom.Rectangle; + import com.ankamagames.jerakine.utils.display.StageShareManager; + import flash.display.DisplayObject; + import com.ankamagames.berilia.interfaces.IApplicationContainer; + import com.ankamagames.jerakine.logger.Log; + + public class TooltipManager extends Object + { + + public function TooltipManager() + { + super(); + } + + protected static var _log:Logger = Log.getLogger(getQualifiedClassName(TooltipManager)); + + private static var _tooltips:Array = new Array(); + + private static var _tooltipsStrata:Array = new Array(); + + private static var _tooltipsDico:Dictionary = new Dictionary(); + + private static const TOOLTIP_UI_NAME_PREFIX:String = "tooltip_"; + + public static const TOOLTIP_STANDAR_NAME:String = "standard"; + + public static var _tooltipCache:Dictionary = new Dictionary(); + + public static var _tooltipCacheParam:Dictionary = new Dictionary(); + + public static var defaultTooltipUiScript:Class; + + private static var _isInit:Boolean = false; + + public static function show(param1:*, param2:*, param3:UiModule, param4:Boolean = true, param5:String = "standard", param6:uint = 0, param7:uint = 2, param8:int = 3, param9:Boolean = true, param10:String = null, param11:Class = null, param12:Object = null, param13:String = null, param14:Boolean = false, param15:int = 4, param16:Number = 1, param17:Boolean = true) : Tooltip + { + var _loc19_:Array = null; + var _loc20_:Tooltip = null; + if(!_isInit) + { + Berilia.getInstance().addEventListener(UiRenderEvent.UIRenderComplete,onUiRenderComplete); + Berilia.getInstance().addEventListener(UiUnloadEvent.UNLOAD_UI_STARTED,onUiUnloadStarted); + _isInit = true; + } + var param5:String = (param9?TOOLTIP_UI_NAME_PREFIX:"") + param5; + if(param11 == null) + { + var param11:Class = defaultTooltipUiScript; + } + if(_tooltips[param5]) + { + hide(param5); + } + if(param13) + { + _loc19_ = param13.split("#"); + if((_tooltipCache[_loc19_[0]]) && (_loc19_.length == 1) || (_tooltipCache[_loc19_[0]] && _loc19_.length > 1) && (_tooltipCacheParam[_loc19_[0]] == _loc19_[1])) { - Berilia.getInstance().addEventListener(UiRenderEvent.UIRenderComplete, onUiRenderComplete); - Berilia.getInstance().addEventListener(UiUnloadEvent.UNLOAD_UI_STARTED, onUiUnloadStarted); - _isInit = true; - }; - name = (((usePrefix) ? TOOLTIP_UI_NAME_PREFIX : "") + name); - if (script == null) - { - script = defaultTooltipUiScript; - }; - if (_tooltips[name]) - { - hide(name); - }; - if (cacheName) - { - cacheNameInfo = cacheName.split("#"); - if (((((_tooltipCache[cacheNameInfo[0]]) && ((cacheNameInfo.length == 1)))) || (((((_tooltipCache[cacheNameInfo[0]]) && ((cacheNameInfo.length > 1)))) && ((_tooltipCacheParam[cacheNameInfo[0]] == cacheNameInfo[1])))))) - { - tooltipCache = (_tooltipCache[cacheNameInfo[0]] as Tooltip); - _tooltips[name] = data; - _tooltipsStrata[name] = tooltipCache.display.strata; - Berilia.getInstance().uiList[name] = tooltipCache.display; - DisplayObjectContainer(Berilia.getInstance().docMain.getChildAt((strata + 1))).addChild(tooltipCache.display); - if (((((!((tooltipCache == null))) && (!((tooltipCache.display == null))))) && (!((tooltipCache.display.uiClass == null))))) - { - tooltipCache.display.x = (tooltipCache.display.y = 0); - tooltipCache.display.scaleX = (tooltipCache.display.scaleY = zoom); - tooltipCache.display.uiClass.main(new TooltipProperties(tooltipCache, autoHide, getTargetRect(target), point, relativePoint, offset, SecureCenter.secure(data), makerParam, zoom, alwaysDisplayed, target)); - }; - return (tooltipCache); - }; - }; - var tt:Tooltip = TooltipsFactory.create(data, tooltipMaker, script, makerParam); - if (!(tt)) - { - _log.error((((("Erreur lors du rendu du tooltip de " + data) + " (") + getQualifiedClassName(data)) + ")")); - return (null); - }; - if (uiModule) - { - tt.uiModuleName = uiModule.id; - }; - _tooltips[name] = data; - if (mouseEnabled) - { - strata = StrataEnum.STRATA_TOP; - }; - tt.askTooltip(new Callback(onTooltipReady, tt, uiModule, name, data, target, autoHide, point, relativePoint, offset, cacheName, strata, makerParam, zoom, alwaysDisplayed)); - _tooltipsDico[name] = tt; - return (tt); - } - - public static function hide(name:String="standard"):void - { - if (name == null) - { - name = TOOLTIP_STANDAR_NAME; - }; - if (name.indexOf(TOOLTIP_UI_NAME_PREFIX) == -1) - { - name = (TOOLTIP_UI_NAME_PREFIX + name); - }; - if (_tooltips[name]) - { - if (Berilia.getInstance().getUi(name)) - { - TooltipPlacer.removeTooltipPosition(Berilia.getInstance().getUi(name)); - } - else - { - TooltipPlacer.removeTooltipPositionByName(name); - }; - Berilia.getInstance().unloadUi(name); - delete _tooltips[name]; - delete _tooltipsDico[name]; + _loc20_ = _tooltipCache[_loc19_[0]] as Tooltip; + _tooltips[param5] = param1; + _tooltipsStrata[param5] = _loc20_.display.strata; + Berilia.getInstance().uiList[param5] = _loc20_.display; + DisplayObjectContainer(Berilia.getInstance().docMain.getChildAt(param15 + 1)).addChild(_loc20_.display); + if(!(_loc20_ == null) && !(_loc20_.display == null) && !(_loc20_.display.uiClass == null)) + { + _loc20_.display.x = _loc20_.display.y = 0; + _loc20_.display.scaleX = _loc20_.display.scaleY = param16; + _loc20_.display.uiClass.main(new TooltipProperties(_loc20_,param4,getTargetRect(param2),param6,param7,param8,SecureCenter.secure(param1),param12,param16,param17,param2)); + } + return _loc20_; } - else - { - TooltipPlacer.removeTooltipPositionByName(name); - }; - } - - public static function getTooltipName(pTooltip:UiRootContainer):String - { - var name:String; - if (pTooltip.cached) + } + var _loc18_:Tooltip = TooltipsFactory.create(param1,param10,param11,param12); + if(!_loc18_) + { + _log.error("Erreur lors du rendu du tooltip de " + param1 + " (" + getQualifiedClassName(param1) + ")"); + return null; + } + if(param3) + { + _loc18_.uiModuleName = param3.id; + } + _tooltips[param5] = param1; + if(param14) + { + var param15:int = StrataEnum.STRATA_TOP; + } + _loc18_.askTooltip(new Callback(onTooltipReady,_loc18_,param3,param5,param1,param2,param4,param6,param7,param8,param13,param15,param12,param16,param17)); + _tooltipsDico[param5] = _loc18_; + return _loc18_; + } + + public static function hide(param1:String = "standard") : void + { + if(param1 == null) + { + var param1:String = TOOLTIP_STANDAR_NAME; + } + if(param1.indexOf(TOOLTIP_UI_NAME_PREFIX) == -1) + { + param1 = TOOLTIP_UI_NAME_PREFIX + param1; + } + if(_tooltips[param1]) + { + if(Berilia.getInstance().getUi(param1)) { - for (name in Berilia.getInstance().uiList) - { - if (Berilia.getInstance().uiList[name] == pTooltip) - { - return (name); - }; - }; + TooltipPlacer.removeTooltipPosition(Berilia.getInstance().getUi(param1)); } else { - for (name in _tooltips) - { - if (((_tooltipsDico[name]) && ((_tooltipsDico[name].display == pTooltip)))) - { - return (name); - }; - }; - }; - return (null); - } - - public static function isVisible(name:String):Boolean - { - if (name.indexOf(TOOLTIP_UI_NAME_PREFIX) == -1) - { - name = (TOOLTIP_UI_NAME_PREFIX + name); - }; - return (!((_tooltips[name] == null))); - } - - public static function updateContent(ttCacheName:String, ttName:String, data:Object):void - { - var tooltipCache:Tooltip; - if (isVisible(ttName)) + TooltipPlacer.removeTooltipPositionByName(param1); + } + Berilia.getInstance().unloadUi(param1); + delete _tooltips[param1]; + true; + delete _tooltipsDico[param1]; + true; + } + else + { + TooltipPlacer.removeTooltipPositionByName(param1); + } + } + + public static function getTooltipName(param1:UiRootContainer) : String + { + var _loc2_:String = null; + if(param1.cached) + { + for(_loc2_ in Berilia.getInstance().uiList) { - tooltipCache = (_tooltipCache[ttCacheName] as Tooltip); - if (tooltipCache) - { - tooltipCache.display.uiClass.updateContent(new TooltipProperties(tooltipCache, false, null, 0, 0, 0, data, null)); - }; - }; - } - - public static function updatePosition(ttCacheName:String, ttName:String, target:*, point:uint, relativePoint:uint, offset:int, alwaysDisplayed:Boolean=true, checkSuperposition:Boolean=false, cellId:int=-1):void - { - var tooltipCache:Tooltip; - var ttRect:TooltipRectangle; - if (isVisible(ttName)) + if(Berilia.getInstance().uiList[_loc2_] == param1) + { + return _loc2_; + } + } + } + else + { + for(_loc2_ in _tooltips) { - tooltipCache = (_tooltipCache[ttCacheName] as Tooltip); - if (tooltipCache) - { - tooltipCache.display.x = 0; - tooltipCache.display.y = 0; - ttRect = getTargetRect(target); - TooltipPlacer.place(tooltipCache.display, ttRect, point, relativePoint, offset, alwaysDisplayed); - if (((checkSuperposition) && (!((cellId == -1))))) - { - TooltipPlacer.addTooltipPosition(tooltipCache.display, ttRect, cellId); - }; - }; - }; - } - - public static function hideAll():void - { - var name:String; - var strata:int; - var ttt:Tooltip; - for (name in _tooltips) + if((_tooltipsDico[_loc2_]) && _tooltipsDico[_loc2_].display == param1) + { + return _loc2_; + } + } + } + return null; + } + + public static function isVisible(param1:String) : Boolean + { + if(param1.indexOf(TOOLTIP_UI_NAME_PREFIX) == -1) + { + var param1:String = TOOLTIP_UI_NAME_PREFIX + param1; + } + return !(_tooltips[param1] == null); + } + + public static function updateContent(param1:String, param2:String, param3:Object) : void + { + var _loc4_:Tooltip = null; + if(isVisible(param2)) + { + _loc4_ = _tooltipCache[param1] as Tooltip; + if(_loc4_) { - strata = _tooltipsStrata[name]; - ttt = _tooltipsDico[name]; - if ((((((strata == StrataEnum.STRATA_TOOLTIP)) || ((strata == StrataEnum.STRATA_WORLD)))) && ((((ttt == null)) || (ttt.mustBeHidden))))) - { - hide(name); - }; - }; - } - - public static function clearCache():void - { - var tt:Tooltip; - var berilia:Berilia = Berilia.getInstance(); - for each (tt in _tooltipCache) + _loc4_.display.uiClass.updateContent(new TooltipProperties(_loc4_,false,null,0,0,0,param3,null)); + } + } + } + + public static function updatePosition(param1:String, param2:String, param3:*, param4:uint, param5:uint, param6:int, param7:Boolean = true, param8:Boolean = false, param9:int = -1) : void + { + var _loc10_:Tooltip = null; + var _loc11_:TooltipRectangle = null; + if(isVisible(param2)) + { + _loc10_ = _tooltipCache[param1] as Tooltip; + if(_loc10_) { - tt.display.cached = false; - berilia.uiList[tt.display.name] = tt.display; - berilia.unloadUi(tt.display.name); - }; - _tooltipCache = new Dictionary(); - _tooltipCacheParam = new Dictionary(); - } - - public static function updateAllPositions(pOffsetX:Number, pOffsetY:Number):void - { - var tt:UiRootContainer; - var ttName:String; - for (ttName in _tooltips) + _loc10_.display.x = 0; + _loc10_.display.y = 0; + _loc11_ = getTargetRect(param3); + TooltipPlacer.place(_loc10_.display,_loc11_,param4,param5,param6,param7); + if((param8) && !(param9 == -1)) + { + TooltipPlacer.addTooltipPosition(_loc10_.display,_loc11_,param9); + } + } + } + } + + public static function hideAll() : void + { + var _loc1_:String = null; + var _loc2_:* = 0; + var _loc3_:Tooltip = null; + for(_loc1_ in _tooltips) + { + _loc2_ = _tooltipsStrata[_loc1_]; + _loc3_ = _tooltipsDico[_loc1_]; + if((_loc2_ == StrataEnum.STRATA_TOOLTIP || _loc2_ == StrataEnum.STRATA_WORLD) && (_loc3_ == null || (_loc3_.mustBeHidden))) { - tt = Berilia.getInstance().getUi(ttName); - if (tt) - { - tt.x = (tt.x + pOffsetX); - tt.y = (tt.y + pOffsetY); - }; - }; - } - - private static function onTooltipReady(tt:Tooltip, uiModule:UiModule, name:String, data:*, target:*, autoHide:Boolean, point:uint, relativePoint:uint, offset:int, cacheName:String, strata:int, param:Object, zoom:Number, alwaysDisplayed:Boolean):void - { - var uiData:UiData; - var cacheNameInfo:Array; - var cacheMode:Boolean = !((cacheName == null)); - var showNow:Boolean = ((_tooltips[name]) && ((_tooltips[name] === data))); - _tooltipsStrata[name] = strata; - if (((showNow) || (cacheName))) + hide(_loc1_); + } + } + } + + public static function clearCache() : void + { + var _loc2_:Tooltip = null; + var _loc1_:Berilia = Berilia.getInstance(); + for each(_loc2_ in _tooltipCache) + { + _loc2_.display.cached = false; + _loc1_.uiList[_loc2_.display.name] = _loc2_.display; + _loc1_.unloadUi(_loc2_.display.name); + } + _tooltipCache = new Dictionary(); + _tooltipCacheParam = new Dictionary(); + } + + public static function updateAllPositions(param1:Number, param2:Number) : void + { + var _loc3_:UiRootContainer = null; + var _loc4_:String = null; + for(_loc4_ in _tooltips) + { + _loc3_ = Berilia.getInstance().getUi(_loc4_); + if(_loc3_) { - uiData = new UiData(uiModule, name, null, null); - uiData.xml = tt.content; - uiData.uiClass = tt.scriptClass; - tt.display = Berilia.getInstance().loadUi(uiModule, uiData, name, new TooltipProperties(tt, autoHide, getTargetRect(target), point, relativePoint, offset, SecureCenter.secure(data), param, zoom, alwaysDisplayed), true, strata, !(showNow), null); - if (cacheName) - { - cacheNameInfo = cacheName.split("#"); - _tooltipCache[cacheNameInfo[0]] = tt; - if (cacheNameInfo.length > 0) - { - _tooltipCacheParam[cacheNameInfo[0]] = cacheNameInfo[1]; - }; - tt.display.cached = true; - tt.display.cacheAsBitmap = true; - if (tt.display.scale != zoom) - { - tt.display.scale = zoom; - }; - } - else - { - tt.display.scale = zoom; - }; - }; - } - - private static function getTargetRect(target:*):TooltipRectangle - { - var coord:Point; - var localCoord:Point; - var sx:Number; - var sy:Number; - var inBerilia:Boolean; - var ttrect:TooltipRectangle; - var realtarget:* = SecureCenter.unsecure(target); - if (realtarget) + _loc3_.x = _loc3_.x + param1; + _loc3_.y = _loc3_.y + param2; + } + } + } + + private static function onTooltipReady(param1:Tooltip, param2:UiModule, param3:String, param4:*, param5:*, param6:Boolean, param7:uint, param8:uint, param9:int, param10:String, param11:int, param12:Object, param13:Number, param14:Boolean) : void + { + var _loc17_:UiData = null; + var _loc18_:Array = null; + var _loc15_:* = !(param10 == null); + var _loc16_:Boolean = (_tooltips[param3]) && _tooltips[param3] === param4; + _tooltipsStrata[param3] = param11; + if((_loc16_) || (param10)) + { + _loc17_ = new UiData(param2,param3,null,null); + _loc17_.xml = param1.content; + _loc17_.uiClass = param1.scriptClass; + param1.display = Berilia.getInstance().loadUi(param2,_loc17_,param3,new TooltipProperties(param1,param6,getTargetRect(param5),param7,param8,param9,SecureCenter.secure(param4),param12,param13,param14),true,param11,!_loc16_,null); + if(param10) { - if ((realtarget is Rectangle)) - { - coord = new Point(realtarget.x, realtarget.y); - } - else - { - if (((realtarget.hasOwnProperty("parent")) && (realtarget.parent))) - { - coord = localToGlobal(realtarget.parent, new Point(realtarget.x, realtarget.y)); - } - else - { - coord = realtarget.localToGlobal(new Point(realtarget.x, realtarget.y)); - }; - }; - localCoord = Berilia.getInstance().strataTooltip.globalToLocal(coord); - sx = StageShareManager.stageScaleX; - sy = StageShareManager.stageScaleY; - inBerilia = (((realtarget is DisplayObject)) ? Berilia.getInstance().docMain.contains(realtarget) : false); - ttrect = new TooltipRectangle((localCoord.x * ((inBerilia) ? sx : 1)), (localCoord.y * ((inBerilia) ? sy : 1)), (realtarget.width / sx), (realtarget.height / sy)); - return (ttrect); - }; - return (null); - } - - private static function localToGlobal(t:Object, p:Point=null):Point - { - if (!(p)) + _loc18_ = param10.split("#"); + _tooltipCache[_loc18_[0]] = param1; + if(_loc18_.length > 0) + { + _tooltipCacheParam[_loc18_[0]] = _loc18_[1]; + } + param1.display.cached = true; + param1.display.cacheAsBitmap = true; + if(param1.display.scale != param13) + { + param1.display.scale = param13; + } + } + else { - p = new Point(); - }; - if (!(t.hasOwnProperty("parent"))) + param1.display.scale = param13; + } + } + } + + private static function getTargetRect(param1:*) : TooltipRectangle + { + var _loc2_:Point = null; + var _loc4_:Point = null; + var _loc5_:* = NaN; + var _loc6_:* = NaN; + var _loc7_:* = false; + var _loc8_:TooltipRectangle = null; + var _loc3_:* = SecureCenter.unsecure(param1); + if(_loc3_) + { + if(_loc3_ is Rectangle) { - return (t.localToGlobal(new Point(t.x, t.y))); - }; - p.x = (p.x + t.x); - p.y = (p.y + t.y); - if (((t.parent) && (!((t.parent is IApplicationContainer))))) + _loc2_ = new Point(_loc3_.x,_loc3_.y); + } + else if((_loc3_.hasOwnProperty("parent")) && (_loc3_.parent)) { - p.x = (p.x * t.parent.scaleX); - p.y = (p.y * t.parent.scaleY); - p = localToGlobal(t.parent, p); - }; - return (p); - } - - private static function onUiRenderComplete(pEvt:UiRenderEvent):void - { - TooltipManager.removeTooltipsHiddenByUi(pEvt.uiTarget.name); - } - - private static function onUiUnloadStarted(pEvt:UiUnloadEvent):void - { - TooltipManager.removeTooltipsHiddenByUi(pEvt.name); - } - - private static function removeTooltipsHiddenByUi(uiname:String):void - { - var name:String; - var strata:int; - var ttt:Tooltip; - var e:Rectangle; - var berilia:Berilia = Berilia.getInstance(); - var ctr:UiRootContainer = berilia.getUi(uiname); - if (((!(ctr)) || (_tooltips[uiname]))) + _loc2_ = localToGlobal(_loc3_.parent,new Point(_loc3_.x,_loc3_.y)); + } + else { - return; - }; - var containerBounds:Rectangle = ctr.getBounds(StageShareManager.stage); - for (name in _tooltips) + _loc2_ = _loc3_.localToGlobal(new Point(_loc3_.x,_loc3_.y)); + } + + _loc4_ = Berilia.getInstance().strataTooltip.globalToLocal(_loc2_); + _loc5_ = StageShareManager.stageScaleX; + _loc6_ = StageShareManager.stageScaleY; + _loc7_ = _loc3_ is DisplayObject?Berilia.getInstance().docMain.contains(_loc3_):false; + _loc8_ = new TooltipRectangle(_loc4_.x * (_loc7_?_loc5_:1),_loc4_.y * (_loc7_?_loc6_:1),_loc3_.width / _loc5_,_loc3_.height / _loc6_); + return _loc8_; + } + return null; + } + + private static function localToGlobal(param1:Object, param2:Point = null) : Point + { + if(!param2) + { + var param2:Point = new Point(); + } + if(!param1.hasOwnProperty("parent")) + { + return param1.localToGlobal(new Point(param1.x,param1.y)); + } + param2.x = param2.x + param1.x; + param2.y = param2.y + param1.y; + if((param1.parent) && !(param1.parent is IApplicationContainer)) + { + param2.x = param2.x * param1.parent.scaleX; + param2.y = param2.y * param1.parent.scaleY; + param2 = localToGlobal(param1.parent,param2); + } + return param2; + } + + private static function onUiRenderComplete(param1:UiRenderEvent) : void + { + TooltipManager.removeTooltipsHiddenByUi(param1.uiTarget.name); + } + + private static function onUiUnloadStarted(param1:UiUnloadEvent) : void + { + TooltipManager.removeTooltipsHiddenByUi(param1.name); + } + + private static function removeTooltipsHiddenByUi(param1:String) : void + { + var _loc5_:String = null; + var _loc6_:* = 0; + var _loc7_:Tooltip = null; + var _loc8_:Rectangle = null; + var _loc2_:Berilia = Berilia.getInstance(); + var _loc3_:UiRootContainer = _loc2_.getUi(param1); + if(!_loc3_ || (_tooltips[param1])) + { + return; + } + var _loc4_:Rectangle = _loc3_.getBounds(StageShareManager.stage); + for(_loc5_ in _tooltips) + { + _loc6_ = _tooltipsStrata[_loc5_]; + _loc7_ = _tooltipsDico[_loc5_]; + if((_loc6_ == StrataEnum.STRATA_TOOLTIP || _loc6_ == StrataEnum.STRATA_WORLD) && (_loc7_ == null || (_loc7_.mustBeHidden))) { - strata = _tooltipsStrata[name]; - ttt = _tooltipsDico[name]; - if ((((((strata == StrataEnum.STRATA_TOOLTIP)) || ((strata == StrataEnum.STRATA_WORLD)))) && ((((ttt == null)) || (ttt.mustBeHidden))))) - { - if (!!(berilia.getUi(name))) - { - e = berilia.getUi(name).getBounds(StageShareManager.stage); - if ((((((((e.x > containerBounds.x)) && (((e.x + e.width) < (containerBounds.x + containerBounds.width))))) && ((e.y > containerBounds.y)))) && (((e.y + e.height) < (containerBounds.x + containerBounds.height))))) - { - hide(name); - }; - }; - }; - }; - } - - - } -}//package com.ankamagames.berilia.managers - + if(_loc2_.getUi(_loc5_)) + { + _loc8_ = _loc2_.getUi(_loc5_).getBounds(StageShareManager.stage); + if(_loc8_.x > _loc4_.x && _loc8_.x + _loc8_.width < _loc4_.x + _loc4_.width && _loc8_.y > _loc4_.y && _loc8_.y + _loc8_.height < _loc4_.x + _loc4_.height) + { + hide(_loc5_); + } + } + } + } + } + } +} diff --git a/com/ankamagames/berilia/managers/UIEventManager.as b/com/ankamagames/berilia/managers/UIEventManager.as index 3a1262b0d..c284e32a0 100644 --- a/com/ankamagames/berilia/managers/UIEventManager.as +++ b/com/ankamagames/berilia/managers/UIEventManager.as @@ -1,62 +1,64 @@ -package com.ankamagames.berilia.managers +package com.ankamagames.berilia.managers { - import com.ankamagames.jerakine.logger.Logger; - import com.ankamagames.jerakine.logger.Log; - import flash.utils.getQualifiedClassName; - import flash.utils.Dictionary; - import com.ankamagames.berilia.utils.errors.BeriliaError; - import com.ankamagames.berilia.types.event.InstanceEvent; - import flash.display.DisplayObject; - - public class UIEventManager - { - - private static var _self:UIEventManager; - protected static const _log:Logger = Log.getLogger(getQualifiedClassName(UIEventManager)); - - private var _dInstanceIndex:Dictionary; - - public function UIEventManager() - { - this._dInstanceIndex = new Dictionary(true); - super(); - if (_self != null) - { - throw (new BeriliaError("UIEventManager is a singleton and should not be instanciated directly.")); - }; - } - - public static function getInstance():UIEventManager - { - if (_self == null) - { - _self = new (UIEventManager)(); - }; - return (_self); - } - - - public function get instances():Dictionary - { - return (this._dInstanceIndex); - } - - public function registerInstance(ie:InstanceEvent):void - { - this._dInstanceIndex[ie.instance] = ie; - } - - public function isRegisteredInstance(target:DisplayObject, msg:*=null):Boolean - { - return (((this._dInstanceIndex[target]) && (this._dInstanceIndex[target].events[getQualifiedClassName(msg)]))); - } - - public function removeInstance(instance:*):void - { - delete this._dInstanceIndex[instance]; - } - - - } -}//package com.ankamagames.berilia.managers - + import com.ankamagames.jerakine.logger.Logger; + import com.ankamagames.jerakine.logger.Log; + import flash.utils.getQualifiedClassName; + import flash.utils.Dictionary; + import com.ankamagames.berilia.types.event.InstanceEvent; + import flash.display.DisplayObject; + import com.ankamagames.berilia.utils.errors.BeriliaError; + + public class UIEventManager extends Object + { + + public function UIEventManager() + { + this._dInstanceIndex = new Dictionary(true); + super(); + if(_self != null) + { + throw new BeriliaError("UIEventManager is a singleton and should not be instanciated directly."); + } + else + { + return; + } + } + + private static var _self:UIEventManager; + + protected static const _log:Logger = Log.getLogger(getQualifiedClassName(UIEventManager)); + + public static function getInstance() : UIEventManager + { + if(_self == null) + { + _self = new UIEventManager(); + } + return _self; + } + + private var _dInstanceIndex:Dictionary; + + public function get instances() : Dictionary + { + return this._dInstanceIndex; + } + + public function registerInstance(param1:InstanceEvent) : void + { + this._dInstanceIndex[param1.instance] = param1; + } + + public function isRegisteredInstance(param1:DisplayObject, param2:* = null) : Boolean + { + return (this._dInstanceIndex[param1]) && (this._dInstanceIndex[param1].events[getQualifiedClassName(param2)]); + } + + public function removeInstance(param1:*) : void + { + delete this._dInstanceIndex[param1]; + true; + } + } +} diff --git a/com/ankamagames/berilia/managers/UiGroupManager.as b/com/ankamagames/berilia/managers/UiGroupManager.as index 21ec861cc..c8036bd1b 100644 --- a/com/ankamagames/berilia/managers/UiGroupManager.as +++ b/com/ankamagames/berilia/managers/UiGroupManager.as @@ -1,120 +1,124 @@ -package com.ankamagames.berilia.managers +package com.ankamagames.berilia.managers { - import com.ankamagames.jerakine.logger.Logger; - import com.ankamagames.jerakine.logger.Log; - import flash.utils.getQualifiedClassName; - import com.ankamagames.jerakine.utils.errors.SingletonError; - import com.ankamagames.berilia.Berilia; - import com.ankamagames.berilia.types.event.UiRenderAskEvent; - import com.ankamagames.berilia.types.data.UiGroup; - - public class UiGroupManager - { - - protected static const _log:Logger = Log.getLogger(getQualifiedClassName(UiGroupManager)); - private static var _self:UiGroupManager; - - private var _registeredGroup:Array; - private var _uis:Array; - - public function UiGroupManager() - { - this._registeredGroup = new Array(); - this._uis = new Array(); - super(); - if (_self) + import com.ankamagames.jerakine.logger.Logger; + import com.ankamagames.jerakine.logger.Log; + import flash.utils.getQualifiedClassName; + import com.ankamagames.berilia.types.data.UiGroup; + import com.ankamagames.berilia.Berilia; + import com.ankamagames.berilia.types.event.UiRenderAskEvent; + import com.ankamagames.jerakine.utils.errors.SingletonError; + + public class UiGroupManager extends Object + { + + public function UiGroupManager() + { + this._registeredGroup = new Array(); + this._uis = new Array(); + super(); + if(_self) + { + throw new SingletonError(); + } + else + { + Berilia.getInstance().addEventListener(UiRenderAskEvent.UI_RENDER_ASK,this.onUiRenderAsk); + return; + } + } + + protected static const _log:Logger = Log.getLogger(getQualifiedClassName(UiGroupManager)); + + private static var _self:UiGroupManager; + + public static function getInstance() : UiGroupManager + { + if(!_self) + { + _self = new UiGroupManager(); + } + return _self; + } + + private var _registeredGroup:Array; + + private var _uis:Array; + + public function registerGroup(param1:UiGroup) : void + { + this._registeredGroup[param1.name] = param1; + } + + public function removeGroup(param1:String) : void + { + delete this._registeredGroup[param1]; + true; + } + + public function getGroup(param1:String) : UiGroup + { + return this._registeredGroup[param1]; + } + + public function destroy() : void + { + Berilia.getInstance().removeEventListener(UiRenderAskEvent.UI_RENDER_ASK,this.onUiRenderAsk); + _self = null; + } + + private function onUiRenderAsk(param1:UiRenderAskEvent) : void + { + var _loc3_:UiGroup = null; + var _loc4_:Array = null; + var _loc5_:String = null; + var _loc6_:* = false; + var _loc7_:String = null; + if(!param1.uiData) + { + _log.error("No data for this UI."); + return; + } + if(!param1.uiData.uiGroupName || !this._registeredGroup[param1.uiData.uiGroupName]) + { + return; + } + if(!this._uis[param1.uiData.uiGroupName]) + { + this._uis[param1.uiData.uiGroupName] = new Array(); + } + var _loc2_:UiGroup = this.getGroup(param1.uiData.uiGroupName); + if(!_loc2_) + { + return; + } + for each(_loc3_ in this._registeredGroup) + { + if((_loc2_.exclusive) && !_loc3_.permanent && !(_loc3_.name == _loc2_.name)) { - throw (new SingletonError()); - }; - Berilia.getInstance().addEventListener(UiRenderAskEvent.UI_RENDER_ASK, this.onUiRenderAsk); - } - - public static function getInstance():UiGroupManager - { - if (!(_self)) - { - _self = new (UiGroupManager)(); - }; - return (_self); - } - - - public function registerGroup(g:UiGroup):void - { - this._registeredGroup[g.name] = g; - } - - public function removeGroup(name:String):void - { - delete this._registeredGroup[name]; - } - - public function getGroup(name:String):UiGroup - { - return (this._registeredGroup[name]); - } - - public function destroy():void - { - Berilia.getInstance().removeEventListener(UiRenderAskEvent.UI_RENDER_ASK, this.onUiRenderAsk); - _self = null; - } - - private function onUiRenderAsk(e:UiRenderAskEvent):void - { - var group:UiGroup; - var actualGroupUis:Array; - var uiName:String; - var close:Boolean; - var uiName2:String; - if (!(e.uiData)) - { - _log.error("No data for this UI."); - return; - }; - if (((!(e.uiData.uiGroupName)) || (!(this._registeredGroup[e.uiData.uiGroupName])))) - { - return; - }; - if (!(this._uis[e.uiData.uiGroupName])) - { - this._uis[e.uiData.uiGroupName] = new Array(); - }; - var currentGroup:UiGroup = this.getGroup(e.uiData.uiGroupName); - if (!(currentGroup)) - { - return; - }; - for each (group in this._registeredGroup) - { - if (((((currentGroup.exclusive) && (!(group.permanent)))) && (!((group.name == currentGroup.name))))) - { - if (this._uis[group.name] != null) - { - actualGroupUis = this._registeredGroup[group.name].uis; - for each (uiName in actualGroupUis) + if(this._uis[_loc3_.name] != null) + { + _loc4_ = this._registeredGroup[_loc3_.name].uis; + for each(_loc5_ in _loc4_) + { + _loc6_ = true; + for each(_loc7_ in _loc2_.uis) + { + if(_loc5_ == _loc7_) { - close = true; - for each (uiName2 in currentGroup.uis) - { - if (uiName == uiName2) - { - close = false; - }; - }; - if (((close) && (!((uiName2 == null))))) - { - Berilia.getInstance().unloadUi(uiName); - }; - delete this._uis[group.name][uiName]; - }; - }; - }; - }; - this._uis[e.uiData.uiGroupName][e.name] = e.uiData; - } - - - } -}//package com.ankamagames.berilia.managers - + _loc6_ = false; + } + } + if((_loc6_) && !(_loc7_ == null)) + { + Berilia.getInstance().unloadUi(_loc5_); + } + delete this._uis[_loc3_.name][_loc5_]; + true; + } + } + } + } + this._uis[param1.uiData.uiGroupName][param1.name] = param1.uiData; + } + } +} diff --git a/com/ankamagames/berilia/managers/UiModuleManager.as b/com/ankamagames/berilia/managers/UiModuleManager.as index 724d3cc10..ecb2f65e8 100644 --- a/com/ankamagames/berilia/managers/UiModuleManager.as +++ b/com/ankamagames/berilia/managers/UiModuleManager.as @@ -1,1846 +1,1122 @@ -package com.ankamagames.berilia.managers +package com.ankamagames.berilia.managers { - import com.ankamagames.jerakine.logger.Logger; - import com.ankamagames.jerakine.logger.Log; - import flash.utils.getQualifiedClassName; - import com.ankamagames.jerakine.resources.loaders.IResourceLoader; - import flash.system.ApplicationDomain; - import flash.utils.Dictionary; - import flash.filesystem.File; - import com.ankamagames.jerakine.utils.errors.SingletonError; - import com.ankamagames.jerakine.resources.loaders.ResourceLoaderFactory; - import com.ankamagames.jerakine.resources.loaders.ResourceLoaderType; - import com.ankamagames.jerakine.resources.events.ResourceErrorEvent; - import com.ankamagames.jerakine.resources.events.ResourceLoadedEvent; - import com.ankamagames.berilia.utils.web.HttpServer; - import com.ankamagames.jerakine.types.Uri; - import com.ankamagames.jerakine.resources.adapters.impl.AdvancedSwfAdapter; - import com.ankamagames.jerakine.utils.display.FrameIdManager; - import com.ankamagames.jerakine.utils.display.StageShareManager; - import com.ankamagames.jerakine.utils.display.EnterFrameDispatcher; - import com.ankamagames.jerakine.utils.system.AirScanner; - import com.ankamagames.jerakine.resources.protocols.ProtocolFactory; - import com.ankamagames.berilia.utils.ModProtocol; - import com.ankamagames.berilia.utils.ModFlashProtocol; - import com.ankamagames.jerakine.managers.LangManager; - import com.ankamagames.jerakine.managers.ErrorManager; - import com.ankamagames.berilia.types.data.UiModule; - import __AS3__.vec.Vector; - import com.ankamagames.berilia.types.shortcut.Shortcut; - import com.ankamagames.berilia.Berilia; - import com.ankamagames.berilia.api.ApiBinder; - import com.ankamagames.berilia.types.graphic.UiRootContainer; - import com.ankamagames.berilia.types.data.UiGroup; - import com.ankamagames.jerakine.utils.misc.DescribeTypeCache; - import com.ankamagames.berilia.utils.errors.UntrustedApiCallError; - import flash.events.Event; - import flash.utils.getTimer; - import com.ankamagames.berilia.types.messages.AllModulesLoadedMessage; - import com.ankamagames.jerakine.resources.adapters.impl.TxtAdapter; - import com.ankamagames.jerakine.newCache.ICache; - import com.ankamagames.jerakine.utils.files.FileUtils; - import com.ankamagames.berilia.utils.UriCacheFactory; - import com.ankamagames.jerakine.newCache.impl.Cache; - import com.ankamagames.jerakine.newCache.garbage.LruGarbageCollector; - import com.ankamagames.berilia.types.messages.ModuleRessourceLoadFailedMessage; - import flash.system.LoaderContext; - import flash.filesystem.FileStream; - import flash.utils.ByteArray; - import com.ankamagames.jerakine.utils.crypto.Signature; - import com.ankamagames.berilia.types.data.UiData; - import com.ankamagames.jerakine.resources.ResourceType; - import com.ankamagames.berilia.types.data.PreCompiledUiModule; - import flash.filesystem.FileMode; - import by.blooddy.crypto.MD5; - import com.ankamagames.jerakine.resources.adapters.impl.SignedFileAdapter; - import com.ankamagames.jerakine.resources.adapters.impl.BinaryAdapter; - import com.ankamagames.jerakine.resources.adapters.impl.AdvancedSignedFileAdapter; - import flash.events.IOErrorEvent; - import flash.display.Loader; - import flash.display.LoaderInfo; - import com.ankamagames.berilia.types.shortcut.ShortcutCategory; - import com.ankamagames.jerakine.resources.events.ResourceLoaderProgressEvent; - import com.ankamagames.berilia.uiRender.XmlParsor; - import com.ankamagames.berilia.types.event.ParsingErrorEvent; - import com.ankamagames.berilia.types.messages.AllUiXmlParsedMessage; - import com.ankamagames.berilia.types.messages.UiXmlParsedMessage; - import com.ankamagames.berilia.types.event.ParsorEvent; - import com.ankamagames.berilia.types.messages.UiXmlParsedErrorMessage; - import com.ankamagames.jerakine.types.ASwf; - - public class UiModuleManager - { - - protected static const _log:Logger = Log.getLogger(getQualifiedClassName(UiModuleManager)); - private static const _lastModulesToUnload:Array = ["Ankama_GameUiCore", "Ankama_Common", "Ankama_Tooltips", "Ankama_ContextMenu"]; - private static var _self:UiModuleManager; - - private var _sharedDefinitionLoader:IResourceLoader; - private var _sharedDefinition:ApplicationDomain; - private var _useSharedDefinition:Boolean; - private var _loader:IResourceLoader; - private var _uiLoader:IResourceLoader; - private var _scriptNum:uint; - private var _modules:Array; - private var _preprocessorIndex:Dictionary; - private var _uiFiles:Array; - private var _regImport:RegExp; - private var _versions:Array; - private var _clearUi:Array; - private var _uiFileToLoad:uint; - private var _moduleCount:uint = 0; - private var _cacheLoader:IResourceLoader; - private var _unparsedXml:Array; - private var _unparsedXmlCount:uint; - private var _unparsedXmlTotalCount:uint; - private var _modulesRoot:File; - private var _modulesPaths:Dictionary; - private var _modulesHashs:Dictionary; - private var _resetState:Boolean; - private var _parserAvaibleCount:uint = 2; - private var _moduleLaunchWaitForSharedDefinition:Boolean; - private var _unInitializedModules:Array; - private var _useHttpServer:Boolean; - private var _moduleLoaders:Dictionary; - private var _loadingModule:Dictionary; - private var _disabledModules:Array; - private var _sharedDefinitionInstance:Object; - private var _timeOutFrameNumber:int; - private var _waitingInit:Boolean; - private var _filter:Array; - private var _filterInclude:Boolean; - public var isDevMode:Boolean; - private var _moduleScriptLoadedRef:Dictionary; - private var _uiLoaded:Dictionary; - private var _loadModuleFunction:Function; - - public function UiModuleManager(dontUseLocalServer:Boolean=false) - { - this._regImport = /) : void + { + var _loc2_:UiModule = null; + this._resetState = false; + this._modules = new Array(); + this._modulesPaths = new Dictionary(); + for each(this._modules[_loc2_.id] in param1) + { + this._modulesPaths[_loc2_.id] = _loc2_.rootPath; + } + } + + public function getModules() : Array + { + return this._modules; + } + + public function getModule(param1:String, param2:Boolean = false) : UiModule + { + var _loc3_:UiModule = null; + if(this._modules) + { + _loc3_ = this._modules[param1]; + } + if(!_loc3_ && (param2) && (this._unInitializedModules)) + { + _loc3_ = this._unInitializedModules[param1]; + } + return _loc3_; + } + + public function get disabledModules() : Array + { + return this._disabledModules; + } + + public function reset() : void + { + var _loc1_:UiModule = null; + var _loc2_:* = 0; + _log.warn("Reset des modules"); + this._resetState = true; + if(this._loader) + { + this._loader.cancel(); + } + if(this._cacheLoader) + { + this._cacheLoader.cancel(); + } + if(this._uiLoader) + { + this._uiLoader.cancel(); + } + TooltipManager.clearCache(); + for each(_loc1_ in this._modules) + { + if(_lastModulesToUnload.indexOf(_loc1_.id) == -1) + { + this.unloadModule(_loc1_.id); + } + } + _loc2_ = 0; + while(_loc2_ < _lastModulesToUnload.length) + { + if(this._modules[_lastModulesToUnload[_loc2_]]) { - for each (file in this._modulesRoot.getDirectoryListing()) - { - if (!((!(file.isDirectory)) || ((file.name.charAt(0) == ".")))) - { - if (!((filter.indexOf(file.name) == -1)) == filterInclude) - { - this.loadModule(file.name); - }; - }; - }; + this.unloadModule(_lastModulesToUnload[_loc2_]); + } + _loc2_++; + } + Shortcut.reset(); + Berilia.getInstance().reset(); + ApiBinder.reset(); + KernelEventsManager.getInstance().initialize(); + this._modules = []; + this._uiFileToLoad = 0; + this._scriptNum = 0; + this._moduleCount = 0; + this._parserAvaibleCount = 2; + this._modulesPaths = new Dictionary(); + } + + public function getModulePath(param1:String) : String + { + return this._modulesPaths[param1]; + } + + public function loadModule(param1:String) : void + { + var _loc3_:File = null; + var _loc4_:Uri = null; + var _loc5_:String = null; + var _loc6_:* = 0; + var _loc7_:String = null; + this.unloadModule(param1); + var _loc2_:File = this._modulesRoot.resolvePath(param1); + if(_loc2_.exists) + { + _loc3_ = this.searchDmFile(_loc2_); + if(_loc3_) + { + this._moduleCount++; + this._scriptNum++; + if(_loc3_.nativePath.indexOf("app:/") == 0) + { + _loc6_ = "app:/".length; + _loc7_ = _loc3_.nativePath.substring(_loc6_,_loc3_.url.length); + _loc4_ = new Uri(_loc7_); + _loc5_ = _loc7_.substr(0,_loc7_.lastIndexOf("/")); + } + else + { + _loc4_ = new Uri(_loc3_.nativePath); + _loc5_ = _loc3_.parent.nativePath; + } + _loc4_.tag = _loc3_; + this._modulesPaths[param1] = _loc5_; + this._loader.load(_loc4_); } else { - ErrorManager.addError((("Impossible de trouver le dossier contenant les modules (url: " + LangManager.getInstance().getEntry("config.mod.path")) + ")")); - return; - }; - } - - public function lightInit(moduleList:Vector.):void - { - var m:UiModule; - this._resetState = false; - this._modules = new Array(); - this._modulesPaths = new Dictionary(); - for each (m in moduleList) - { - this._modules[m.id] = m; - this._modulesPaths[m.id] = m.rootPath; - }; - } - - public function getModules():Array - { - return (this._modules); - } - - public function getModule(name:String, includeUnInitialized:Boolean=false):UiModule - { - var module:UiModule; - if (this._modules) - { - module = this._modules[name]; - }; - if (((((!(module)) && (includeUnInitialized))) && (this._unInitializedModules))) - { - module = this._unInitializedModules[name]; - }; - return (module); - } - - public function get disabledModules():Array - { - return (this._disabledModules); - } - - public function reset():void - { - var module:UiModule; - var i:int; - _log.warn("Reset des modules"); - this._resetState = true; - if (this._loader) - { - this._loader.cancel(); - }; - if (this._cacheLoader) - { - this._cacheLoader.cancel(); - }; - if (this._uiLoader) - { - this._uiLoader.cancel(); - }; - TooltipManager.clearCache(); - for each (module in this._modules) - { - if (_lastModulesToUnload.indexOf(module.id) != -1) - { - } - else - { - this.unloadModule(module.id); - }; - }; - i = 0; - while (i < _lastModulesToUnload.length) - { - if (this._modules[_lastModulesToUnload[i]]) - { - this.unloadModule(_lastModulesToUnload[i]); - }; - i++; - }; - Shortcut.reset(); - Berilia.getInstance().reset(); - ApiBinder.reset(); - KernelEventsManager.getInstance().initialize(); - this._modules = []; - this._uiFileToLoad = 0; - this._scriptNum = 0; - this._moduleCount = 0; - this._parserAvaibleCount = 2; - this._modulesPaths = new Dictionary(); - } - - public function getModulePath(moduleName:String):String - { - return (this._modulesPaths[moduleName]); - } - - public function loadModule(id:String):void - { - var dmFile:File; - var uri:Uri; - var modulePath:String; - var len:int; - var substr:String; - this.unloadModule(id); - var targetedModuleFolder:File = this._modulesRoot.resolvePath(id); - if (targetedModuleFolder.exists) - { - dmFile = this.searchDmFile(targetedModuleFolder); - if (dmFile) - { - this._moduleCount++; - this._scriptNum++; - if (dmFile.nativePath.indexOf("app:/") == 0) - { - len = "app:/".length; - substr = dmFile.nativePath.substring(len, dmFile.url.length); - uri = new Uri(substr); - modulePath = substr.substr(0, substr.lastIndexOf("/")); - } - else - { - uri = new Uri(dmFile.nativePath); - modulePath = dmFile.parent.nativePath; - }; - uri.tag = dmFile; - this._modulesPaths[id] = modulePath; - this._loader.load(uri); - } - else - { - _log.error(("Cannot found .dm or .d2ui file in " + targetedModuleFolder.url)); - }; - }; - } - - public function unloadModule(id:String):void - { - var uiCtr:UiRootContainer; - var ui:String; - var group:UiGroup; - var variables:Array; - var varName:String; - var apiList:Vector.; - var api:Object; - if (this._modules == null) - { - return; - }; - var m:UiModule = this._modules[id]; - if (!(m)) - { - return; - }; - var moduleUiInstances:Array = []; - for each (uiCtr in Berilia.getInstance().uiList) - { - if (uiCtr.uiModule == m) - { - moduleUiInstances.push(uiCtr.name); - }; - }; - for each (ui in moduleUiInstances) - { - Berilia.getInstance().unloadUi(ui); - }; - for each (group in m.groups) - { - UiGroupManager.getInstance().removeGroup(group.name); - }; - variables = DescribeTypeCache.getVariables(m.mainClass, true); - for each (varName in variables) - { - if ((m.mainClass[varName] is Object)) - { - m.mainClass[varName] = null; - }; - }; - m.destroy(); - apiList = m.apiList; - while (apiList.length) - { - api = apiList.shift(); - if (((api) && (api.hasOwnProperty("destroy")))) - { - try - { - var _local_3 = api; - (_local_3["destroy"]()); - } - catch(e:UntrustedApiCallError) - { - var _local_4 = api; - (_local_4["destroy"](SecureCenter.ACCESS_KEY)); - }; - }; - }; - if (((m.mainClass) && (m.mainClass.hasOwnProperty("unload")))) - { - _local_3 = m.mainClass; - (_local_3["unload"]()); - }; - BindsManager.getInstance().removeAllEventListeners(("__module_" + m.id)); - KernelEventsManager.getInstance().removeAllEventListeners(("__module_" + m.id)); - delete this._modules[id]; - this._disabledModules[id] = m; - } - - public function checkSharedDefinitionHash(hashUrl:String):void - { - var hashUri:Uri = new Uri(hashUrl); - } - - private function onTimeOut():void - { - goto _label_2; - - _label_1: - EnterFrameDispatcher.removeEventListener(this.timeOutFrameCount); - for (;;) - { - this.switchToNoHttpMode(); - goto _label_1; - var _local_2 = _local_2; - - _label_2: - _log.error("SharedDefinition load Timeout"); - continue; - return; - }; + _log.error("Cannot found .dm or .d2ui file in " + _loc2_.url); + } + } + } + + public function unloadModule(param1:String) : void + { + var uiCtr:UiRootContainer = null; + var ui:String = null; + var group:UiGroup = null; + var variables:Array = null; + var varName:String = null; + var apiList:Vector. = null; + var api:Object = null; + var id:String = param1; + if(this._modules == null) + { return; - } - - private function timeOutFrameCount(e:Event):void - { - this._timeOutFrameNumber--; - if (this._timeOutFrameNumber <= 0) - { - while (this.onTimeOut(), true) - { - return; - }; - var _local_3 = _local_3; - }; + } + var m:UiModule = this._modules[id]; + if(!m) + { return; - } - - private function launchModule():void - { - var module:UiModule; - var missingName:String; - var missingModule:UiModule; - var notLoaded:Array; - var m:UiModule; - var ts:uint; - while (true) + } + var moduleUiInstances:Array = []; + for each(uiCtr in Berilia.getInstance().uiList) + { + if(uiCtr.uiModule == m) { - goto _label_2; - }; - - _label_1: - this._moduleLaunchWaitForSharedDefinition = false; - goto _label_3; - - _label_2: - goto _label_1; - - _label_3: - var modules:Array = new Array(); - for each (module in this._unInitializedModules) - { - if (module.trusted) - { - modules.unshift(module); - } - else - { - modules.push(module); - }; - }; - while (modules.length > 0) - { - for (;;) - { - //unresolved jump - continue; - }; - for each (m in modules) - { - while (true) - { - ApiBinder.addApiData("currentUi", null); - missingName = ApiBinder.initApi(m.mainClass, m, this._sharedDefinition); - goto _label_4; - }; - var _local_10 = _local_10; - - _label_4: - if (missingName) - { - missingModule = m; - notLoaded.push(m); - } - else - { - if (m.mainClass) + moduleUiInstances.push(uiCtr.name); + } + } + for each(ui in moduleUiInstances) + { + Berilia.getInstance().unloadUi(ui); + } + for each(group in m.groups) + { + UiGroupManager.getInstance().removeGroup(group.name); + } + variables = DescribeTypeCache.getVariables(m.mainClass,true); + for each(varName in variables) + { + if(m.mainClass[varName] is Object) + { + m.mainClass[varName] = null; + } + } + m.destroy(); + apiList = m.apiList; + while(apiList.length) + { + api = apiList.shift(); + if((api) && (api.hasOwnProperty("destroy"))) + { + try + { + api["destroy"](); + } + catch(e:UntrustedApiCallError) + { + api["destroy"](SecureCenter.ACCESS_KEY); + continue; + } + } + } + if((m.mainClass) && (m.mainClass.hasOwnProperty("unload"))) + { + m.mainClass["unload"](); + } + BindsManager.getInstance().removeAllEventListeners("__module_" + m.id); + KernelEventsManager.getInstance().removeAllEventListeners("__module_" + m.id); + delete this._modules[id]; + true; + this._disabledModules[id] = m; + } + + public function checkSharedDefinitionHash(param1:String) : void + { + var _loc2_:Uri = new Uri(param1); + } + + private function onTimeOut() : void + { + if(!_loc2_) + { + _log.error("SharedDefinition load Timeout"); + if(_loc1_) + { + if(_loc2_) + { + while(true) + { + EnterFrameDispatcher.removeEventListener(this.timeOutFrameCount); + if(!_loc2_) + { + if(_loc1_) { - while (true) - { - delete this._unInitializedModules[m.id]; - goto _label_6; - - _label_5: - ts = getTimer(); - goto _label_7; - }; - var _local_9 = _local_9; - - _label_6: - goto _label_5; - - _label_7: - ErrorManager.tryFunction(m.mainClass.main, null, ("Une erreur est survenue lors de l'appel à la fonction main() du module " + m.id)); + break; } - else - { - _log.error(("Impossible d'instancier la classe principale du module " + m.id)); - }; - }; - }; - if (notLoaded.length == modules.length) - { - ErrorManager.addError(((("Le module " + missingModule.id) + " demande une référence vers un module inexistant : ") + missingName)); - goto _label_9; - - _label_8: - continue; - }; - - _label_9: - modules = notLoaded; - goto _label_8; - }; - while (Berilia.getInstance().handler.process(new AllModulesLoadedMessage()), true) - { - return; - }; - var _local_8 = _local_8; - return; - } - - private function launchUiCheck():void - { - while ((this._uiFileToLoad = this._uiFiles.length), true) - { - goto _label_1; - }; - var _local_2 = _local_2; - - _label_1: - if (this._uiFiles.length) - { - this._uiLoader.load(this._uiFiles, null, TxtAdapter); + break; + } + } + return; + } + while(true) + { + this.switchToNoHttpMode(); + } + } + } + while(true) + { + if(_loc1_) + { + EnterFrameDispatcher.removeEventListener(this.timeOutFrameCount); + if(!_loc2_) + { + if(!_loc1_) + { + this.switchToNoHttpMode(); + continue; + } + } + else + { + continue; + } } - else - { - this.onAllUiChecked(null); - }; return; - } - - private function processCachedFiles(files:Array):void - { - var uri:Uri; - var file:Uri; - var _local_4:ICache; - while (true) - { - //unresolved jump - }; - var _local_6 = _local_6; - for each (file in files) + } + } + + private function timeOutFrameCount(param1:Event) : void + { + var _loc4_:* = false; + var _loc5_:* = true; + if(!_loc4_) + { + if(_loc5_) { - switch (file.fileType.toLowerCase()) - { - case "css": - while (true) - { - CssManager.getInstance().load(file.uri); - goto _label_1; - }; - var _local_0 = this; - - _label_1: - continue; - case "jpg": - case "png": - while ((uri = new Uri(FileUtils.getFilePath(file.normalizedUri))), true) - { - goto _label_2; - }; - var _local_8 = _local_8; - - _label_2: - _local_4 = UriCacheFactory.getCacheFromUri(uri); - if (!(_local_4)) - { - goto _label_6; - - _label_3: - goto _label_7; - }; - - _label_4: - this._cacheLoader.load(file, _local_4); - goto _label_3; - var _local_7 = _local_7; - - _label_5: - goto _label_4; - - _label_6: - _local_4 = UriCacheFactory.init(uri.uri, new Cache(files.length, new LruGarbageCollector())); - goto _label_5; - - _label_7: - continue; - default: - while (true) - { - ErrorManager.addError((("Impossible de mettre en cache le fichier " + file.uri) + ", le type n'est pas supporté (uniquement css, jpg et png)")); - //unresolved jump - }; - var _local_5 = _local_5; - }; - }; - return; - } - - private function onLoadError(e:ResourceErrorEvent):void - { - while (true) + } + if(!_loc4_) { - goto _label_1; - }; - var _local_6 = _local_6; - - _label_1: - _log.error(("onLoadError() - " + e.errorMsg)); - var sduri:Uri = new Uri(HttpServer.getInstance().getUrlTo("SharedDefinitions.swf")); - if (e.uri == sduri) + _loc2_._timeOutFrameNumber = _loc3_; + } + if(!_loc4_) + { + if(_loc4_) + { + } + if(this._timeOutFrameNumber <= 0) + { + if(_loc5_) + { + this.onTimeOut(); + } + } + } + } + } + + private function launchModule() : void + { + /* + * Erreur de décompilation + * Le code est probablement obsfusqué + * Astuce : Vous pouvez tenter d'activer la "désobfuscation automatique" dans les paramètres + * Type d'erreur: EmptyStackException + */ + throw new flash.errors.IllegalOperationError("Non décompilé car il y a des erreurs"); + } + + private function launchUiCheck() : void + { + var _loc1_:* = true; + var _loc2_:* = false; + if(!_loc2_) + { + this._uiFileToLoad = this._uiFiles.length; + if(_loc1_) { - this.switchToNoHttpMode(); } - else + this._uiLoader.load(this._uiFiles,null,TxtAdapter); + if(_loc1_) { - if (e.uri.fileType != "metas") - { - Berilia.getInstance().handler.process(new ModuleRessourceLoadFailedMessage(e.uri.tag, e.uri)); - }; - switch (e.uri.fileType.toLowerCase()) - { - case "swfs": - while (true) - { - ErrorManager.addError((((("Impossible de charger le fichier " + e.uri) + " (") + e.errorMsg) + ")")); - //unresolved jump - }; - var _local_0 = this; - if (!(--_local_0._scriptNum)) - { - _local_0.launchUiCheck(); - }; - return; - case "metas": - return; - default: - while (true) - { - ErrorManager.addError((((("Impossible de charger le fichier " + e.uri) + " (") + e.errorMsg) + ")")); - //unresolved jump - }; - var _local_3 = _local_3; - }; - }; + } return; - } - - private function switchToNoHttpMode():void - { - goto _label_1; - while (this._sharedDefinitionLoader.cancel(), goto _label_2, true) - { - _log.fatal("Failed Loading SharedDefinitions, Going no HttpServer Style !"); - continue; - var _local_3 = _local_3; - }; - var sharedDefUri = sharedDefUri; - - _label_1: + } + if(this._uiFiles.length) + { + if(!_loc2_) + { + this._uiLoader.load(this._uiFiles,null,TxtAdapter); + if(_loc1_) + { + } + } + } + else + { + this.onAllUiChecked(null); + } + } + + private function processCachedFiles(param1:Array) : void + { + /* + * Erreur de décompilation + * Le code est probablement obsfusqué + * Astuce : Vous pouvez tenter d'activer la "désobfuscation automatique" dans les paramètres + * Type d'erreur: EmptyStackException + */ + throw new flash.errors.IllegalOperationError("Non décompilé car il y a des erreurs"); + } + + private function onLoadError(param1:ResourceErrorEvent) : void + { + /* + * Erreur de décompilation + * Le code est probablement obsfusqué + * Astuce : Vous pouvez tenter d'activer la "désobfuscation automatique" dans les paramètres + * Type d'erreur: EmptyStackException + */ + throw new flash.errors.IllegalOperationError("Non décompilé car il y a des erreurs"); + } + + private function switchToNoHttpMode() : void + { + var _loc2_:* = true; + var _loc3_:* = false; + if(!_loc3_) + { this._useHttpServer = false; - //unresolved jump - var _local_2 = _local_2; - - _label_2: - sharedDefUri = new Uri("SharedDefinitions.swf"); - for (;;) + if(_loc2_) { - this.sharedDefinitionContainer = sharedDefUri; - //unresolved jump - sharedDefUri.loaderContext = new LoaderContext(false, new ApplicationDomain()); - continue; - }; - return; - } - - private function onUiLoadError(e:ResourceErrorEvent):void - { - for (;;) - { - Berilia.getInstance().handler.process(new ModuleRessourceLoadFailedMessage(e.uri.tag, e.uri)); - //unresolved jump - - _label_1: - ErrorManager.addError((((("Impossible de charger le fichier d'interface " + e.uri) + " (") + e.errorMsg) + ")")); - continue; - goto _label_1; - var _local_5 = _local_5; - }; - this._uiFileToLoad--; + } + this._sharedDefinitionLoader.cancel(); + var _loc1_:Uri = new Uri("SharedDefinitions.swf"); + if(!_loc3_) + { + _loc1_.loaderContext = new LoaderContext(false,new ApplicationDomain()); + if(!_loc3_) + { + this.sharedDefinitionContainer = _loc1_; + } + } return; - } - - private function onLoad(e:ResourceLoadedEvent):void - { - if (this._resetState) + } + _log.fatal("Failed Loading SharedDefinitions, Going no HttpServer Style !"); + if(_loc2_) + { + this._sharedDefinitionLoader.cancel(); + } + _loc1_ = new Uri("SharedDefinitions.swf"); + if(!_loc3_) + { + _loc1_.loaderContext = new LoaderContext(false,new ApplicationDomain()); + if(!_loc3_) + { + this.sharedDefinitionContainer = _loc1_; + } + } + } + + private function onUiLoadError(param1:ResourceErrorEvent) : void + { + var _loc4_:* = false; + var _loc5_:* = true; + if(_loc5_) + { + if(!_loc4_) + { + if(_loc5_) + { + if(!_loc4_) + { + if(_loc4_) + { + } + } + if(_loc4_) + { + } + } + if(_loc5_) + { + if(_loc4_) + { + } + } + else if(_loc4_) + { + } + + } + ErrorManager.addError("Impossible de charger le fichier d\'interface "); + if(_loc5_) { - return; - }; - switch (e.uri.fileType.toLowerCase()) + } + if(!_loc4_) { - case "swf": - case "swfs": - while (true) - { - this.onScriptLoad(e); - goto _label_1; - }; - - _label_1: - return; - case "d2ui": - case "dm": - while (true) - { - this.onDMLoad(e); - goto _label_2; - }; - var _local_3 = _local_3; - - _label_2: - return; - case "xml": - while (true) - { - this.onShortcutLoad(e); - goto _label_3; - }; - var _local_2 = _local_2; - - _label_3: - return; - case "metas": - while (true) - { - this.onHashLoaded(e); - goto _label_4; - }; - - _label_4: - return; - }; + _loc2_._uiFileToLoad = _loc3_; + } return; - } - - private function onDMLoad(e:ResourceLoadedEvent):void - { - var um:UiModule; - var uiUri:Uri; - var currentFile:File; - var path:String; - var scriptUrl:String; - var scriptUri:Uri; - var scriptFile:File; - var fs:FileStream; - var swfContent:ByteArray; - var fooOutput:ByteArray; - var sig:Signature; - var shortcutsUri:Uri; - var mp:String; - var ui:UiData; - var _local_18:Array; - var _local_19:File; - while (true) - { - goto _label_2; - }; - var _local_22 = _local_22; - - _label_1: - goto _label_3; - - _label_2: - goto _label_1; - - _label_3: - if (e.resourceType == ResourceType.RESOURCE_XML) + } + Berilia.getInstance().handler.process(new ModuleRessourceLoadFailedMessage(param1.uri.tag,param1.uri)); + if(_loc5_) + { + if(!_loc4_) { - um = UiModule.createFromXml((e.resource as XML), FileUtils.getFilePath(e.uri.path), File(e.uri.tag).parent.name); + _loc2_._uiFileToLoad = _loc3_; + } + } + } + + private function onLoad(param1:ResourceLoadedEvent) : void + { + var _loc3_:* = true; + var _loc4_:* = false; + if(_loc3_) + { + if(this._resetState) + { + if(_loc4_) + { + } } else { - um = PreCompiledUiModule.fromRaw(e.resource, FileUtils.getFilePath(e.uri.path), File(e.uri.tag).parent.name); - goto _label_5; - }; - - _label_4: - this._unInitializedModules[um.id] = um; - goto _label_6; - - _label_5: - goto _label_4; - - _label_6: - if (um.script) - { - for (;;) - { - goto _label_9; - - _label_7: - scriptUrl = unescape(um.script); - continue; - - _label_8: - goto _label_7; - var _local_20 = _local_20; - goto _label_8; - }; - - _label_9: - if (Berilia.getInstance().checkModuleAuthority) - { - while ((scriptFile = scriptUri.toFile()), true) - { - goto _label_10; - }; - - _label_10: - _log.debug(("hash " + scriptUri)); - if (scriptFile.exists) - { - while (goto _label_14, fs.close(), true) + if(!_loc4_) + { + if("swf" === _loc2_) + { + if(_loc4_) + { + } + } + else if(!_loc4_) + { + if("swfs" === _loc2_) + { + if(_loc3_) { - goto _label_18; - - _label_11: - goto _label_17; - }; - - _label_12: - fs.open(scriptFile, FileMode.READ); - goto _label_16; - - _label_13: - fs = new FileStream(); - goto _label_12; - - _label_14: - goto _label_13; - - _label_15: - //unresolved jump - var _local_0 = this; - - _label_16: - swfContent = new ByteArray(); - goto _label_11; - var _local_25 = _local_25; - - _label_17: - fs.readBytes(swfContent); - goto _label_15; - - _label_18: - if (scriptUri.fileType == "swf") + } + } + else + { + if(_loc3_) { - while ((um.trusted = (MD5.hashBytes(swfContent) == _local_0._modulesHashs[scriptUri.fileName])), true) - { - goto _label_19; - }; - - _label_19: - if (!(um.trusted)) - { - _log.error(("Hash incorrect pour le module " + um.id)); - }; + } + if("d2ui" === _loc2_) + { + if(!_loc4_) + { + if(_loc4_) + { + } + } + if(_loc4_) + { + } } else { - if (scriptUri.fileType == "swfs") - { - goto _label_22; - - _label_20: - fooOutput = new ByteArray(); - goto _label_23; - - _label_21: - goto _label_20; - - _label_22: - goto _label_21; - - _label_23: - sig = new Signature(SignedFileAdapter.defaultSignatureKey); - if (!(sig.verify(swfContent, fooOutput))) - { - _log.fatal(("Invalid signature in " + scriptFile.nativePath)); - _local_0._moduleCount--; - _local_0._scriptNum--; - while ((um.trusted = false), true) - { - return; - }; - }; - um.trusted = true; - }; - }; - } - else - { - ErrorManager.addError((((("Le script du module " + um.id) + " est introuvable (url: ") + scriptFile.nativePath) + ")")); - this._moduleCount--; - this._scriptNum--; - while ((um.trusted = false), true) + if("metas" !== _loc2_) + { + if(_loc4_) + { + } + } + if("metas" === _loc2_) + { + } + } + if(_loc3_) { - return; - }; - return; - }; - } - else - { - um.trusted = true; - }; - if (!(um.enable)) - { - _log.fatal((("Le module " + um.id) + " est désactivé")); - this._moduleCount--; - this._scriptNum--; - this._disabledModules[um.id] = um; - while (true) - { - return; - }; - var _local_24 = _local_24; - }; - if (um.shortcuts) - { - for (;;) - { - //unresolved jump - continue; - - _label_24: - this._loader.load(shortcutsUri); - goto _label_26; - }; - - _label_25: - goto _label_24; - }; - - _label_26: - if (((this._useHttpServer) && (!((scriptUri.fileType == "swfs"))))) - { - while ((mp = File.applicationDirectory.nativePath.split("\\").join("/")), true) - { - goto _label_27; - }; - var _local_23 = _local_23; - - _label_27: - if (scriptUrl.indexOf(mp) != -1) - { - while ((scriptUrl = scriptUrl.substr((scriptUrl.indexOf(mp) + mp.length))), goto _label_29, _log.trace(("[WebServer] Load " + scriptUrl)), true) + } + } + } + + } + if("swf" === _loc2_) + { + if(_loc3_) + { + } + } + else + { + if(!_loc4_) + { + if("dm" === _loc2_) + { + if(_loc3_) { - this._loadModuleFunction(scriptUrl, this.onModuleScriptLoaded, this.onScriptLoadFail, um); - //unresolved jump - }; - }; - - _label_28: - scriptUrl = HttpServer.getInstance().getUrlTo(scriptUrl); - //unresolved jump - - _label_29: - goto _label_28; - var files = files; - } - else - { - if (um.trusted) - { - goto _label_34; - - _label_30: - //unresolved jump - - _label_31: - scriptUri.loaderContext = new LoaderContext(); - goto _label_30; - - _label_32: - while (_log.trace(("[Classic] Load " + scriptUri)), goto _label_36, (scriptUri.loaderContext.applicationDomain = new ApplicationDomain(this._sharedDefinition)), true) + } + } + else + { + if(_loc4_) { - goto _label_35; - - _label_33: - goto _label_31; - }; - - _label_34: - scriptUri.tag = um.id; - goto _label_33; - - _label_35: - this._loadingModule[um] = um.id; - goto _label_32; - - _label_36: - this._loader.load(scriptUri, null, ((!((scriptUri.fileType == "swfs"))) ? BinaryAdapter : AdvancedSignedFileAdapter)); - } - else - { - this._moduleCount--; - this._scriptNum--; - ErrorManager.addError((((("Failed to load custom module " + um.author) + "_") + um.name) + ", because the local HTTP server is not available.")); - while (true) + } + if("xml" === _loc2_) { - return; - }; - }; - }; - }; - files = new Array(); - if (!((um is PreCompiledUiModule))) - { - _loop_1: - for each (ui in um.uis) - { - if (ui.file) - { - while ((uiUri = new Uri(ui.file)), goto _label_37, (uiUri.tag = { - "mod":um.id, - "base":ui.file - }), true) + if(_loc3_) + { + } + } + else if(_loc4_) { - this._uiFiles.push(uiUri); - continue _loop_1; - }; + } - _label_37: - //unresolved jump - }; - }; - }; - var root:File = this._modulesRoot.resolvePath(um.id); - files = new Array(); - for each (path in um.cachedFiles) - { - //unresolved jump - - _label_38: - if (currentFile.exists) - { - if (!(currentFile.isDirectory)) - { - files.push(new Uri(((("mod://" + um.id) + "/") + path))); - } - else - { - _local_18 = currentFile.getDirectoryListing(); - for each (_local_19 in _local_18) + } + } + if("dm" === _loc2_) + { + if(!_loc4_) + { + if(_loc4_) { - if (!(_local_19.isDirectory)) - { - goto _label_40; - - _label_39: - continue; - }; - - _label_40: - files.push(new Uri(((((("mod://" + um.id) + "/") + path) + "/") + FileUtils.getFileName(_local_19.url)))); - goto _label_39; - }; - }; - }; - }; - while (this.processCachedFiles(files), true) - { - return; - }; - return; - } - - private function onScriptLoadFail(e:IOErrorEvent, uiModule:UiModule):void - { - while (true) - { - _log.error((("Le script du module " + uiModule.id) + " est introuvable")); - //unresolved jump - }; - var _local_5 = _local_5; - if (!(--this._scriptNum)) - { - this.launchUiCheck(); - }; - return; - } - - private function onScriptLoad(e:ResourceLoadedEvent):void - { - while (true) - { - goto _label_1; - }; - var moduleLoader = moduleLoader; - - _label_1: - var uiModule:UiModule = this._unInitializedModules[e.uri.tag]; - moduleLoader = new Loader(); - this._moduleScriptLoadedRef[moduleLoader] = uiModule; - var lc:LoaderContext = new LoaderContext(false, new ApplicationDomain(this._sharedDefinition)); - while (AirScanner.allowByteCodeExecution(lc, true), true) - { - moduleLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, this.onModuleScriptLoaded); - while (true) - { - moduleLoader.loadBytes((e.resource as ByteArray), lc); - goto _label_2; - }; - var _local_6 = _local_6; - }; - - _label_2: - return; - } - - private function onModuleScriptLoaded(e:Event, uiModule:UiModule=null):void - { - while (true) - { - goto _label_1; - }; - - _label_1: - var l:Loader = LoaderInfo(e.target).loader; - while (l.contentLoaderInfo.removeEventListener(Event.COMPLETE, this.onModuleScriptLoaded), true) - { - goto _label_2; - }; - - _label_2: - if (!(uiModule)) - { - goto _label_11; - }; - - _label_3: - delete this._loadingModule[uiModule]; - for (;;) - { - //unresolved jump - goto _label_12; - - _label_4: - uiModule.applicationDomain = l.contentLoaderInfo.applicationDomain; - goto _label_7; - - _label_5: - uiModule.mainClass = l.content; - continue; - - _label_6: - goto _label_10; - }; - var _local_7 = _local_7; - - _label_7: - goto _label_5; - var _local_6 = _local_6; - - _label_8: - //unresolved jump - - _label_9: - goto _label_3; - - _label_10: - uiModule.loader = l; - goto _label_4; - - _label_11: - uiModule = this._moduleScriptLoadedRef[l]; - goto _label_9; - - _label_12: - _log.trace(((((("Load script " + uiModule.id) + ", ") + ((this._moduleCount - this._scriptNum) + 1)) + "/") + this._moduleCount)); - goto _label_6; - if (!(--this._scriptNum)) - { - this.launchUiCheck(); - }; - return; - } - - private function onShortcutLoad(e:ResourceLoadedEvent):void - { - var category:XML; - var cat:ShortcutCategory; - var permanent:Boolean; - var visible:Boolean; - var required:Boolean; - var holdKeys:Boolean; - var shortcut:XML; - while (true) - { - goto _label_1; - }; - - _label_1: - var shortcutsXml:XML = e.resource; - for each (category in shortcutsXml..category) - { - //unresolved jump - - _label_2: - //unresolved jump - for each (shortcut in category..shortcut) - { - if (((!(shortcut.@name)) || (!(shortcut.@name.toString().length)))) - { - goto _label_3; - } - else - { - permanent = false; - goto _label_4; - }; - return; - - _label_3: - ErrorManager.addError(("Le fichier de raccourci est mal formé, il manque la priopriété name dans le fichier " + e.uri)); - //unresolved jump - - _label_4: - if (((shortcut.@permanent) && ((shortcut.@permanent == "true")))) - { - //unresolved jump - }; - - _label_5: - visible = true; - while (goto _label_6, (permanent = true), true) - { - goto _label_5; - }; - var _local_10 = _local_10; - - _label_6: - if (((shortcut.@visible) && ((shortcut.@visible == "false")))) - { - goto _label_9; - }; - - _label_7: - required = false; - goto _label_10; - - _label_8: - goto _label_7; - var _local_12 = _local_12; - - _label_9: - visible = false; - goto _label_8; - - _label_10: - if (((shortcut.@required) && ((shortcut.@required == "true")))) - { - required = true; - }; - holdKeys = false; - if (((shortcut.@holdKeys) && ((shortcut.@holdKeys == "true")))) - { - goto _label_13; - }; - - _label_11: - new Shortcut(shortcut.@name, (shortcut.@textfieldEnabled == "true"), LangManager.getInstance().replaceKey(shortcut.toString()), cat, !(permanent), visible, required, holdKeys, LangManager.getInstance().replaceKey(shortcut.@tooltipContent)); - continue; - - _label_12: - goto _label_11; - - _label_13: - holdKeys = true; - goto _label_12; - var _local_11 = _local_11; - }; - }; - return; - } - - private function onHashLoaded(e:ResourceLoadedEvent):void - { - var file:XML; - for each (file in e.resource..file) - { - //unresolved jump - var _local_4 = _local_4; - }; - return; - } - - private function onAllUiChecked(e:ResourceLoaderProgressEvent):void - { - var module:UiModule; - var url:String; - var ui:UiData; - var uiDataList:Array = new Array(); - for each (module in this._unInitializedModules) - { - //unresolved jump - for each (ui in module.uis) - { - uiDataList[UiData(ui).file] = ui; - }; - }; - this._unparsedXml = []; - _loop_1: - for (url in this._clearUi) - { - for (;;) - { - //unresolved jump - continue; - }; - var _local_11 = _local_11; - - _label_1: - if (uiDataList[url]) - { - while (this._unparsedXml.push(uiDataList[url]), true) - { - continue _loop_1; - }; - }; - }; - this._unparsedXmlCount = (this._unparsedXmlTotalCount = this._unparsedXml.length); - while (this.parseNextXml(), true) - { - return; - }; - return; - } - - private function parseNextXml():void - { - var uiData:UiData; - var xmlParsor:XmlParsor; - this._unparsedXmlCount = this._unparsedXml.length; - if (this._unparsedXml.length) - { - if (this._parserAvaibleCount) - { - this._parserAvaibleCount--; - while ((uiData = (this._unparsedXml.shift() as UiData)), true) - { - goto _label_5; - - _label_1: - goto _label_8; - - _label_2: - goto _label_6; - - _label_3: - xmlParsor.rootPath = uiData.module.rootPath; - goto _label_4; - }; - - _label_4: - xmlParsor.addEventListener(Event.COMPLETE, this.onXmlParsed, false, 0, true); - goto _label_2; - var _local_3 = _local_3; - - _label_5: - xmlParsor = new XmlParsor(); - goto _label_7; - - _label_6: - xmlParsor.addEventListener(ParsingErrorEvent.ERROR, this.onXmlParsingError); - goto _label_1; - var _local_5 = _local_5; - - _label_7: - goto _label_3; - var _local_4 = _local_4; - - _label_8: - xmlParsor.processFile(uiData.file); - }; - } - else - { - BindsManager.getInstance().checkBinds(); - while (true) - { - Berilia.getInstance().handler.process(new AllUiXmlParsedMessage()); - goto _label_9; - }; - - _label_9: - if (((!(this._useSharedDefinition)) || (this._sharedDefinition))) - { - this.launchModule(); - } - else - { - this._moduleLaunchWaitForSharedDefinition = true; - }; - }; - return; - } - - private function onXmlParsed(e:ParsorEvent):void - { - if (e.uiDefinition) - { - while ((e.uiDefinition.name = XmlParsor(e.target).url), true) - { - UiRenderManager.getInstance().setUiDefinition(e.uiDefinition); - goto _label_1; - }; - var _local_2 = _local_2; - - _label_1: - Berilia.getInstance().handler.process(new UiXmlParsedMessage(e.uiDefinition.name)); - }; - this._parserAvaibleCount++; - while (this.parseNextXml(), true) - { - return; - }; - return; - } - - private function onXmlParsingError(e:ParsingErrorEvent):void - { - while (true) - { - Berilia.getInstance().handler.process(new UiXmlParsedErrorMessage(e.url, e.msg)); - goto _label_1; - }; - - _label_1: - return; - } - - private function onUiLoaded(e:ResourceLoadedEvent):void - { - var res:Array; - var filePath:String; - var modName:String; - var templateUri:Uri; - goto _label_6; - - _label_1: - goto _label_5; - - _label_2: - goto _label_1; - var base = base; - - _label_3: - goto _label_8; - - _label_4: - goto _label_2; - var versionOk = versionOk; - - _label_5: - goto _label_7; - - _label_6: - goto _label_4; - var mod = mod; - - _label_7: - goto _label_3; - var xml = xml; - - _label_8: - if (this._resetState) - { - return; - }; - var uriPos:int = this._uiFiles.indexOf(e.uri); - this._uiFiles.splice(this._uiFiles.indexOf(e.uri), 1); - mod = this._unInitializedModules[e.uri.tag.mod]; - base = e.uri.tag.base; - var md5:String = ((!((this._versions[e.uri.uri] == null))) ? this._versions[e.uri.uri] : MD5.hash((e.resource as String))); - versionOk = (md5 == UiRenderManager.getInstance().getUiVersion(e.uri.uri)); - if (!(versionOk)) - { - while ((this._clearUi[e.uri.uri] = md5), true) - { - goto _label_9; - }; - var _local_0 = this; - - _label_9: - if (e.uri.tag.template) - { - _local_0._clearUi[e.uri.tag.base] = _local_0._versions[e.uri.tag.base]; - goto _label_11; - }; - }; - - _label_10: - this._versions[e.uri.uri] = md5; - goto _label_12; - - _label_11: - goto _label_10; - - _label_12: - xml = (e.resource as String); - while ((res = this._regImport.exec(xml))) - { - while (goto _label_13, (filePath = LangManager.getInstance().replaceKey(res[1])), true) - { - goto _label_14; - }; - - _label_13: - //unresolved jump - - _label_14: - if (filePath.indexOf("mod://") != -1) - { - while (true) - { - modName = filePath.substr(6, (filePath.indexOf("/", 6) - 6)); - while (true) + } + } + if(_loc4_) + { + } + } + else + { + if("metas" !== _loc2_) + { + if(_loc4_) { - filePath = (this._modulesPaths[modName] + filePath.substr((6 + modName.length))); - //unresolved jump - }; - }; - } - else - { - if ((((filePath.indexOf(":") == -1)) && ((filePath.indexOf("ui/Ankama_Common") == -1)))) - { - filePath = (mod.rootPath + filePath); - }; - }; - if (this._clearUi[filePath]) - { - for (;;) - { - this._clearUi[base] = this._versions[base]; - //unresolved jump - this._clearUi[e.uri.uri] = md5; - continue; - }; - - _label_15: - continue; - }; - if (!!(this._uiLoaded[filePath])) continue; - while (true) - { - this._uiLoaded[filePath] = true; - //unresolved jump - }; - this._uiFileToLoad++; - while ((templateUri = new Uri(filePath)), true) - { - templateUri.tag = { - "mod":mod.id, - "base":base, - "template":true - }; - //unresolved jump - }; - }; - if (!(--this._uiFileToLoad)) + } + } + if("metas" === _loc2_) + { + } + } + if(_loc3_) + { + } + } + } + if(this._resetState) { - while (this.onAllUiChecked(null), true) - { - return; - }; - var _local_14 = _local_14; - }; + return; + } return; - } - - private function searchDmFile(rootPath:File):File - { - var file:File; - var dm:File; - goto _label_3; - - _label_1: - goto _label_4; - - _label_2: - goto _label_1; - - _label_3: - goto _label_2; - var _local_7 = _local_7; - - _label_4: - if (rootPath.nativePath.indexOf(".svn") != -1) - { - return (null); - }; - var files:Array = rootPath.getDirectoryListing(); - _loop_1: - for each (file in files) - { - if (((!(file.isDirectory)) && (file.extension))) - { - if (file.extension.toLowerCase() == "d2ui") - { - return (file); - }; - if (((!(dm)) && ((file.extension.toLowerCase() == "dm")))) - { - while ((dm = file), true) - { - continue _loop_1; - }; - var _local_6 = _local_6; - }; - }; - }; - if (dm) - { - return (dm); - }; - for each (file in files) - { - if (file.isDirectory) - { - while ((dm = this.searchDmFile(file)), true) - { - goto _label_5; - }; - - _label_5: - if (dm) - { - break; - }; - }; - }; - return (dm); - } - - private function onSharedDefinitionLoad(e:ResourceLoadedEvent):void - { - //unresolved jump - - _label_1: - for (;;) - { - continue; - EnterFrameDispatcher.removeEventListener(this.timeOutFrameCount); - goto _label_2; - }; - var directAccessObject = directAccessObject; - - _label_2: - var aswf:ASwf = (e.resource as ASwf); - this._sharedDefinition = aswf.applicationDomain; - var sharedSecureComponent:Object = this._sharedDefinition.getDefinition("d2components::SecureComponent"); - sharedSecureComponent.init(SecureCenter.ACCESS_KEY, SecureCenter.unsecureContent, SecureCenter.secure, SecureCenter.unsecure, DescribeTypeCache.getVariables); - var sharedReadOnlyData:Object = this._sharedDefinition.getDefinition("utils::ReadOnlyData"); - sharedReadOnlyData.init(SecureCenter.ACCESS_KEY, SecureCenter.unsecureContent, SecureCenter.secure, SecureCenter.unsecure); - directAccessObject = this._sharedDefinition.getDefinition("utils::DirectAccessObject"); - goto _label_7; - - _label_3: - goto _label_9; - - _label_4: - this._loadModuleFunction = Object(aswf.content).loadModule; - goto _label_3; - - _label_5: - goto _label_4; - - _label_6: - goto _label_8; - - _label_7: - directAccessObject.init(SecureCenter.ACCESS_KEY); - goto _label_6; - var _local_7 = _local_7; - - _label_8: - SecureCenter.init(sharedSecureComponent, sharedReadOnlyData, directAccessObject); - while (true) - { - this._sharedDefinitionInstance = Object(aswf.content); - goto _label_5; - }; - var _local_6 = _local_6; - - _label_9: - if (this._waitingInit) - { - while (this.init(this._filter, this._filterInclude), true) - { - goto _label_10; - }; - }; - - _label_10: - if (this._moduleLaunchWaitForSharedDefinition) + } + } + + private function onDMLoad(param1:ResourceLoadedEvent) : void + { + /* + * Erreur de décompilation + * Le code est probablement obsfusqué + * Astuce : Vous pouvez tenter d'activer la "désobfuscation automatique" dans les paramètres + * Type d'erreur: EmptyStackException + */ + throw new flash.errors.IllegalOperationError("Non décompilé car il y a des erreurs"); + } + + private function onScriptLoadFail(param1:IOErrorEvent, param2:UiModule) : void + { + var _loc5_:* = false; + var _loc6_:* = true; + if(!_loc5_) + { + if(_loc6_) + { + if(_loc6_) + { + } + } + _log.error("Le script du module "); + if(!_loc5_) + { + if(!_loc5_) + { + if(_loc6_) + { + _loc3_._scriptNum = _loc4_; + } + } + if(!(_loc3_._scriptNum - 1)) + { + if(_loc5_) + { + } + } + return; + } + } + this.launchUiCheck(); + } + + private var _moduleScriptLoadedRef:Dictionary; + + private function onScriptLoad(param1:ResourceLoadedEvent) : void + { + /* + * Erreur de décompilation + * Le code est probablement obsfusqué + * Astuce : Vous pouvez tenter d'activer la "désobfuscation automatique" dans les paramètres + * Type d'erreur: TranslateException + */ + throw new flash.errors.IllegalOperationError("Non décompilé car il y a des erreurs"); + } + + private function onModuleScriptLoaded(param1:Event, param2:UiModule = null) : void + { + /* + * Erreur de décompilation + * Le code est probablement obsfusqué + * Astuce : Vous pouvez tenter d'activer la "désobfuscation automatique" dans les paramètres + * Type d'erreur: EmptyStackException + */ + throw new flash.errors.IllegalOperationError("Non décompilé car il y a des erreurs"); + } + + private function onShortcutLoad(param1:ResourceLoadedEvent) : void + { + /* + * Erreur de décompilation + * Le code est probablement obsfusqué + * Astuce : Vous pouvez tenter d'activer la "désobfuscation automatique" dans les paramètres + * Type d'erreur: EmptyStackException + */ + throw new flash.errors.IllegalOperationError("Non décompilé car il y a des erreurs"); + } + + private function onHashLoaded(param1:ResourceLoadedEvent) : void + { + var _loc5_:* = false; + var _loc6_:* = true; + var _loc2_:XML = null; + if(!_loc5_) + { + if(_loc5_) { - while (this.launchModule(), true) - { - return; - }; - var _local_0 = this; - }; - return; - } - - - } -}//package com.ankamagames.berilia.managers - + } + if(!_loc5_) + { + if(!_loc5_) + { + for each(_loc2_ in param1.resource..file) + { + if(!_loc5_) + { + this._modulesHashs[_loc2_.@name.toString()] = _loc2_.toString(); + } + } + } + } + } + } + + private function onAllUiChecked(param1:ResourceLoaderProgressEvent) : void + { + /* + * Erreur de décompilation + * Le code est probablement obsfusqué + * Astuce : Vous pouvez tenter d'activer la "désobfuscation automatique" dans les paramètres + * Type d'erreur: EmptyStackException + */ + throw new flash.errors.IllegalOperationError("Non décompilé car il y a des erreurs"); + } + + private function parseNextXml() : void + { + /* + * Erreur de décompilation + * Le code est probablement obsfusqué + * Astuce : Vous pouvez tenter d'activer la "désobfuscation automatique" dans les paramètres + * Type d'erreur: EmptyStackException + */ + throw new flash.errors.IllegalOperationError("Non décompilé car il y a des erreurs"); + } + + private function onXmlParsed(param1:ParsorEvent) : void + { + var _loc4_:* = false; + var _loc5_:* = true; + if(param1.uiDefinition) + { + if(!_loc4_) + { + param1.uiDefinition.name = XmlParsor(param1.target).url; + } + UiRenderManager.getInstance().setUiDefinition(param1.uiDefinition); + Berilia.getInstance().handler.process(new UiXmlParsedMessage(param1.uiDefinition.name)); + } + if(_loc5_) + { + _loc2_._parserAvaibleCount = _loc3_; + } + this.parseNextXml(); + } + + private function onXmlParsingError(param1:ParsingErrorEvent) : void + { + var _loc2_:* = false; + var _loc3_:* = true; + if(!_loc2_) + { + Berilia.getInstance().handler.process(new UiXmlParsedErrorMessage(param1.url,param1.msg)); + } + } + + private function onUiLoaded(param1:ResourceLoadedEvent) : void + { + /* + * Erreur de décompilation + * Le code est probablement obsfusqué + * Astuce : Vous pouvez tenter d'activer la "désobfuscation automatique" dans les paramètres + * Type d'erreur: EmptyStackException + */ + throw new flash.errors.IllegalOperationError("Non décompilé car il y a des erreurs"); + } + + private var _uiLoaded:Dictionary; + + private function searchDmFile(param1:File) : File + { + /* + * Erreur de décompilation + * Le code est probablement obsfusqué + * Astuce : Vous pouvez tenter d'activer la "désobfuscation automatique" dans les paramètres + * Type d'erreur: EmptyStackException + */ + throw new flash.errors.IllegalOperationError("Non décompilé car il y a des erreurs"); + } + + private function onSharedDefinitionLoad(param1:ResourceLoadedEvent) : void + { + var _loc6_:* = true; + var _loc7_:* = false; + if(!_loc7_) + { + EnterFrameDispatcher.removeEventListener(this.timeOutFrameCount); + } + var _loc2_:ASwf = param1.resource as ASwf; + if(_loc6_) + { + this._sharedDefinition = _loc2_.applicationDomain; + } + var _loc3_:Object = this._sharedDefinition.getDefinition("d2components::SecureComponent"); + if(_loc6_) + { + _loc3_.init(SecureCenter.ACCESS_KEY,SecureCenter.unsecureContent,SecureCenter.secure,SecureCenter.unsecure,DescribeTypeCache.getVariables); + } + var _loc4_:* = this._sharedDefinition.getDefinition("utils::ReadOnlyData"); + this._sharedDefinition.getDefinition("utils::ReadOnlyData").init(SecureCenter.ACCESS_KEY,SecureCenter.unsecureContent,SecureCenter.secure,SecureCenter.unsecure); + var _loc5_:Object = this._sharedDefinition.getDefinition("utils::DirectAccessObject"); + _loc5_.init(SecureCenter.ACCESS_KEY); + if(!_loc7_) + { + SecureCenter.init(_loc3_,_loc4_,_loc5_); + this._sharedDefinitionInstance = Object(_loc2_.content); + this._loadModuleFunction = Object(_loc2_.content).loadModule; + } + if(_loc6_) + { + if(this._waitingInit) + { + this.init(this._filter,this._filterInclude); + } + } + if(this._waitingInit) + { + this.launchModule(); + } + } + + private var _loadModuleFunction:Function; + } +} diff --git a/com/ankamagames/berilia/managers/UiRenderManager.as b/com/ankamagames/berilia/managers/UiRenderManager.as index a55a54d34..29fb29614 100644 --- a/com/ankamagames/berilia/managers/UiRenderManager.as +++ b/com/ankamagames/berilia/managers/UiRenderManager.as @@ -1,55 +1,46 @@ -package com.ankamagames.berilia.managers +package com.ankamagames.berilia.managers { - import flash.events.EventDispatcher; - import flash.utils.Dictionary; - import com.ankamagames.jerakine.logger.Logger; - import com.ankamagames.jerakine.logger.Log; - import flash.utils.getQualifiedClassName; - import com.ankamagames.jerakine.utils.errors.SingletonError; - import com.ankamagames.jerakine.managers.StoreDataManager; - import com.ankamagames.berilia.types.uiDefinition.UiDefinition; - import com.ankamagames.berilia.types.uiDefinition.BasicElement; - import com.ankamagames.berilia.types.uiDefinition.ButtonElement; - import com.ankamagames.berilia.types.uiDefinition.ComponentElement; - import com.ankamagames.berilia.types.uiDefinition.ContainerElement; - import com.ankamagames.jerakine.types.Uri; - import com.ankamagames.berilia.types.uiDefinition.StateContainerElement; - import com.ankamagames.berilia.types.uiDefinition.GridElement; - import com.ankamagames.berilia.types.uiDefinition.ScrollContainerElement; - import com.ankamagames.berilia.types.uiDefinition.PropertyElement; - import com.ankamagames.berilia.types.uiDefinition.LocationELement; - import com.ankamagames.berilia.types.uiDefinition.SizeElement; - import com.ankamagames.berilia.BeriliaConstants; - import com.ankamagames.berilia.pools.PoolableUiRenderer; - import com.ankamagames.berilia.types.data.PreCompiledUiModule; - import flash.utils.getTimer; - import com.ankamagames.berilia.pools.PoolsManager; - import flash.events.Event; - import com.ankamagames.berilia.types.data.UiData; - import com.ankamagames.berilia.types.graphic.UiRootContainer; - import com.ankamagames.berilia.types.event.UiRenderEvent; - - public class UiRenderManager extends EventDispatcher - { - - public static var MEMORY_LOG:Dictionary = new Dictionary(true); - private static var _self:UiRenderManager; - private static const DATASTORE_CATEGORY_CACHE:String = "cache"; - private static const DATASTORE_CATEGORY_APP_VERSION:String = "appVersion"; - private static const DATASTORE_CATEGORY_VERSION:String = "uiVersion"; - protected static const _log:Logger = Log.getLogger(getQualifiedClassName(UiRenderManager)); - - private var _aCache:Array; - private var _aVersion:Array; - private var _aRendering:Array; - private var _lastRenderStart:uint; - - public function UiRenderManager() - { - if (_self != null) - { - throw (new SingletonError("UiRenderManager is a singleton and should not be instanciated directly.")); - }; + import flash.events.EventDispatcher; + import flash.utils.Dictionary; + import com.ankamagames.jerakine.logger.Logger; + import com.ankamagames.jerakine.logger.Log; + import flash.utils.getQualifiedClassName; + import com.ankamagames.berilia.types.data.UiData; + import com.ankamagames.berilia.types.graphic.UiRootContainer; + import com.ankamagames.berilia.pools.PoolableUiRenderer; + import com.ankamagames.berilia.BeriliaConstants; + import com.ankamagames.berilia.types.data.PreCompiledUiModule; + import flash.utils.getTimer; + import com.ankamagames.berilia.pools.PoolsManager; + import flash.events.Event; + import com.ankamagames.jerakine.managers.StoreDataManager; + import com.ankamagames.berilia.types.uiDefinition.UiDefinition; + import com.ankamagames.berilia.types.event.UiRenderEvent; + import com.ankamagames.jerakine.utils.errors.SingletonError; + import com.ankamagames.berilia.types.uiDefinition.BasicElement; + import com.ankamagames.berilia.types.uiDefinition.ButtonElement; + import com.ankamagames.berilia.types.uiDefinition.ComponentElement; + import com.ankamagames.berilia.types.uiDefinition.ContainerElement; + import com.ankamagames.jerakine.types.Uri; + import com.ankamagames.berilia.types.uiDefinition.StateContainerElement; + import com.ankamagames.berilia.types.uiDefinition.GridElement; + import com.ankamagames.berilia.types.uiDefinition.ScrollContainerElement; + import com.ankamagames.berilia.types.uiDefinition.PropertyElement; + import com.ankamagames.berilia.types.uiDefinition.LocationELement; + import com.ankamagames.berilia.types.uiDefinition.SizeElement; + + public class UiRenderManager extends EventDispatcher + { + + public function UiRenderManager() + { + super(); + if(_self != null) + { + throw new SingletonError("UiRenderManager is a singleton and should not be instanciated directly."); + } + else + { StoreDataManager.getInstance().registerClass(new UiDefinition()); StoreDataManager.getInstance().registerClass(new BasicElement()); StoreDataManager.getInstance().registerClass(new ButtonElement()); @@ -63,212 +54,233 @@ StoreDataManager.getInstance().registerClass(new LocationELement()); StoreDataManager.getInstance().registerClass(new SizeElement()); this._aRendering = new Array(); - this._aCache = StoreDataManager.getInstance().getSetData(BeriliaConstants.DATASTORE_UI_DEFINITION, DATASTORE_CATEGORY_CACHE, new Array()); - this._aVersion = StoreDataManager.getInstance().getSetData(BeriliaConstants.DATASTORE_UI_VERSION, DATASTORE_CATEGORY_VERSION, new Array()); - } - - public static function getInstance():UiRenderManager - { - if (_self == null) - { - _self = new (UiRenderManager)(); - }; - return (_self); - } - - - public function loadUi(uiData:UiData, spContainer:UiRootContainer, oProperties:*=null, checkCache:Boolean=true):void - { - var uiRenderer:PoolableUiRenderer; - var sId:String = uiData.file; - if (!(sId)) - { - sId = uiData.name; - }; - if (BeriliaConstants.USE_UI_CACHE) + this._aCache = StoreDataManager.getInstance().getSetData(BeriliaConstants.DATASTORE_UI_DEFINITION,DATASTORE_CATEGORY_CACHE,new Array()); + this._aVersion = StoreDataManager.getInstance().getSetData(BeriliaConstants.DATASTORE_UI_VERSION,DATASTORE_CATEGORY_VERSION,new Array()); + return; + } + } + + public static var MEMORY_LOG:Dictionary = new Dictionary(true); + + private static var _self:UiRenderManager; + + private static const DATASTORE_CATEGORY_CACHE:String = "cache"; + + private static const DATASTORE_CATEGORY_APP_VERSION:String = "appVersion"; + + private static const DATASTORE_CATEGORY_VERSION:String = "uiVersion"; + + protected static const _log:Logger = Log.getLogger(getQualifiedClassName(UiRenderManager)); + + public static function getInstance() : UiRenderManager + { + if(_self == null) + { + _self = new UiRenderManager(); + } + return _self; + } + + private var _aCache:Array; + + private var _aVersion:Array; + + private var _aRendering:Array; + + private var _lastRenderStart:uint; + + public function loadUi(param1:UiData, param2:UiRootContainer, param3:* = null, param4:Boolean = true) : void + { + var _loc5_:PoolableUiRenderer = null; + var _loc6_:String = param1.file; + if(!_loc6_) + { + _loc6_ = param1.name; + } + if(BeriliaConstants.USE_UI_CACHE) + { + if(param1.module is PreCompiledUiModule) { - if ((uiData.module is PreCompiledUiModule)) - { - this._aCache[sId] = PreCompiledUiModule(uiData.module).getDefinition(uiData); - }; - if (((!((this._aCache[sId] == null))) && (this._aCache[sId].useCache))) - { - this._lastRenderStart = getTimer(); - uiRenderer = (PoolsManager.getInstance().getUiRendererPool().checkOut() as PoolableUiRenderer); - uiRenderer.addEventListener(Event.COMPLETE, this.onUiRender); - uiRenderer.fromCache = true; - uiRenderer.script = uiData.uiClass; - uiRenderer.uiRender(this._aCache[sId], this._aCache[sId].name, spContainer, oProperties); - return; - }; - if (((((this._aRendering[sId]) && (!(this._aCache[sId])))) && (checkCache))) - { - this._aRendering[sId].push(new RenderQueueItem(uiData, spContainer, oProperties)); - return; - }; + this._aCache[_loc6_] = PreCompiledUiModule(param1.module).getDefinition(param1); } - else + if(!(this._aCache[_loc6_] == null) && (this._aCache[_loc6_].useCache)) { - this._aCache = new Array(); - }; - if (((((!(this._aCache[sId])) || (((this._aCache[sId]) && (this._aCache[sId].useCache))))) && (checkCache))) - { - this._aRendering[sId] = new Array(); - }; - if (uiData.file) - { - this._lastRenderStart = getTimer(); - uiRenderer = (PoolsManager.getInstance().getUiRendererPool().checkOut() as PoolableUiRenderer); - uiRenderer.addEventListener(Event.COMPLETE, this.onUiRender); - uiRenderer.script = uiData.uiClass; - uiRenderer.fileRender(uiData.file, sId, spContainer, oProperties); + this._lastRenderStart = getTimer(); + _loc5_ = PoolsManager.getInstance().getUiRendererPool().checkOut() as PoolableUiRenderer; + _loc5_.addEventListener(Event.COMPLETE,this.onUiRender); + _loc5_.fromCache = true; + _loc5_.script = param1.uiClass; + _loc5_.uiRender(this._aCache[_loc6_],this._aCache[_loc6_].name,param2,param3); + return; } - else + if((this._aRendering[_loc6_]) && (!this._aCache[_loc6_]) && (param4)) { - if (uiData.xml) - { - this._lastRenderStart = getTimer(); - uiRenderer = (PoolsManager.getInstance().getUiRendererPool().checkOut() as PoolableUiRenderer); - uiRenderer.addEventListener(Event.COMPLETE, this.onUiRender); - uiRenderer.script = uiData.uiClass; - uiRenderer.xmlRender(uiData.xml, sId, spContainer, oProperties); - }; - }; - } - - public function clearCache():void - { - this._aVersion = new Array(); + this._aRendering[_loc6_].push(new RenderQueueItem(param1,param2,param3)); + return; + } + } + else + { this._aCache = new Array(); - TemplateManager.getInstance().init(); - StoreDataManager.getInstance().setData(BeriliaConstants.DATASTORE_UI_VERSION, DATASTORE_CATEGORY_VERSION, this._aVersion); - StoreDataManager.getInstance().setData(BeriliaConstants.DATASTORE_UI_DEFINITION, DATASTORE_CATEGORY_CACHE, this._aCache); - } - - public function clearCacheFromId(id:String):void - { - delete this._aCache[id]; - delete this._aVersion[id]; - StoreDataManager.getInstance().setData(BeriliaConstants.DATASTORE_UI_VERSION, DATASTORE_CATEGORY_VERSION, this._aVersion); - StoreDataManager.getInstance().setData(BeriliaConstants.DATASTORE_UI_DEFINITION, DATASTORE_CATEGORY_CACHE, this._aCache); - } - - public function clearCacheFromUiName(name:String):void - { - var id:String; - var url:String; - name = (name + ".xml").toLowerCase(); - for (url in this._aCache) - { - if (url.toLowerCase().indexOf(name) != -1) - { - id = url; - break; - }; - }; - if (id) + } + if(((!this._aCache[_loc6_]) || (this._aCache[_loc6_] && this._aCache[_loc6_].useCache)) && (param4)) + { + this._aRendering[_loc6_] = new Array(); + } + if(param1.file) + { + this._lastRenderStart = getTimer(); + _loc5_ = PoolsManager.getInstance().getUiRendererPool().checkOut() as PoolableUiRenderer; + _loc5_.addEventListener(Event.COMPLETE,this.onUiRender); + _loc5_.script = param1.uiClass; + _loc5_.fileRender(param1.file,_loc6_,param2,param3); + } + else if(param1.xml) + { + this._lastRenderStart = getTimer(); + _loc5_ = PoolsManager.getInstance().getUiRendererPool().checkOut() as PoolableUiRenderer; + _loc5_.addEventListener(Event.COMPLETE,this.onUiRender); + _loc5_.script = param1.uiClass; + _loc5_.xmlRender(param1.xml,_loc6_,param2,param3); + } + + } + + public function clearCache() : void + { + this._aVersion = new Array(); + this._aCache = new Array(); + TemplateManager.getInstance().init(); + StoreDataManager.getInstance().setData(BeriliaConstants.DATASTORE_UI_VERSION,DATASTORE_CATEGORY_VERSION,this._aVersion); + StoreDataManager.getInstance().setData(BeriliaConstants.DATASTORE_UI_DEFINITION,DATASTORE_CATEGORY_CACHE,this._aCache); + } + + public function clearCacheFromId(param1:String) : void + { + delete this._aCache[param1]; + true; + delete this._aVersion[param1]; + true; + StoreDataManager.getInstance().setData(BeriliaConstants.DATASTORE_UI_VERSION,DATASTORE_CATEGORY_VERSION,this._aVersion); + StoreDataManager.getInstance().setData(BeriliaConstants.DATASTORE_UI_DEFINITION,DATASTORE_CATEGORY_CACHE,this._aCache); + } + + public function clearCacheFromUiName(param1:String) : void + { + var _loc2_:String = null; + var _loc3_:String = null; + var param1:String = (param1 + ".xml").toLowerCase(); + for(_loc3_ in this._aCache) + { + if(_loc3_.toLowerCase().indexOf(param1) != -1) { - this.clearCacheFromId(id); + _loc2_ = _loc3_; + break; } - else - { - _log.error((("Couldn't clear cache for ui '" + name) + "', didn't find any reference to it!")); - }; - } - - public function getUiDefinition(uiId:String):UiDefinition - { - return (this._aCache[uiId]); - } - - public function updateCachedUiDefinition():void - { - StoreDataManager.getInstance().setData(BeriliaConstants.DATASTORE_UI_DEFINITION, DATASTORE_CATEGORY_CACHE, this._aCache); - } - - public function getUiVersion(id:String):String - { - return (this._aVersion[id]); - } - - public function setUiVersion(id:String, version:String):void - { - this._aVersion[id] = version; - StoreDataManager.getInstance().setData(BeriliaConstants.DATASTORE_UI_VERSION, DATASTORE_CATEGORY_VERSION, this._aVersion); - } - - public function setUiDefinition(uiDefinition:UiDefinition):void - { - this._aCache[uiDefinition.name] = uiDefinition; - StoreDataManager.getInstance().setData(BeriliaConstants.DATASTORE_UI_DEFINITION, DATASTORE_CATEGORY_CACHE, this._aCache); - } - - public function cancelRender(uiData:UiData):void - { - if (uiData) - { - delete this._aRendering[uiData.file]; - }; - } - - private function processWaitingUi(sId:String, checkCache:Boolean=true):void - { - var currentUi:RenderQueueItem; - if (!(this._aRendering[sId])) - { - return; - }; - while (((this._aRendering[sId]) && (this._aRendering[sId].length))) - { - currentUi = this._aRendering[sId].shift(); - this._lastRenderStart = getTimer(); - this.loadUi(currentUi.uiData, currentUi.container, currentUi.properties, checkCache); - }; - delete this._aRendering[sId]; - } - - private function onUiRender(e:UiRenderEvent):void - { - var uiDef:UiDefinition = e.uiRenderer.uiDefinition; - if (((((((((!((e.uiTarget.uiData.module is PreCompiledUiModule))) && (uiDef))) && (uiDef.useCache))) && (!(this._aCache[uiDef.name])))) && (BeriliaConstants.USE_UI_CACHE))) - { - this._aCache[uiDef.name] = uiDef; - StoreDataManager.getInstance().setData(BeriliaConstants.DATASTORE_UI_DEFINITION, DATASTORE_CATEGORY_CACHE, this._aCache); - }; - if (uiDef) - { - _log.info((((((((((uiDef.name + " rendered in ") + (getTimer() - this._lastRenderStart)) + " ms (parsing: ") + e.uiRenderer.parsingTime) + " ms, build: ") + e.uiRenderer.buildTime) + " ms, script:") + e.uiRenderer.scriptTime) + " ms )")); - }; - PoolsManager.getInstance().getUiRendererPool().checkIn((e.uiRenderer as PoolableUiRenderer)); - dispatchEvent(new UiRenderEvent(UiRenderEvent.UIRenderComplete, e.bubbles, e.cancelable, e.uiTarget, e.uiRenderer)); - if (uiDef) - { - this.processWaitingUi(uiDef.name, uiDef.useCache); - }; - } - - - } -}//package com.ankamagames.berilia.managers - + } + if(_loc2_) + { + this.clearCacheFromId(_loc2_); + } + else + { + _log.error("Couldn\'t clear cache for ui \'" + param1 + "\', didn\'t find any reference to it!"); + } + } + + public function getUiDefinition(param1:String) : UiDefinition + { + return this._aCache[param1]; + } + + public function updateCachedUiDefinition() : void + { + StoreDataManager.getInstance().setData(BeriliaConstants.DATASTORE_UI_DEFINITION,DATASTORE_CATEGORY_CACHE,this._aCache); + } + + public function getUiVersion(param1:String) : String + { + return this._aVersion[param1]; + } + + public function setUiVersion(param1:String, param2:String) : void + { + this._aVersion[param1] = param2; + StoreDataManager.getInstance().setData(BeriliaConstants.DATASTORE_UI_VERSION,DATASTORE_CATEGORY_VERSION,this._aVersion); + } + + public function setUiDefinition(param1:UiDefinition) : void + { + this._aCache[param1.name] = param1; + StoreDataManager.getInstance().setData(BeriliaConstants.DATASTORE_UI_DEFINITION,DATASTORE_CATEGORY_CACHE,this._aCache); + } + + public function cancelRender(param1:UiData) : void + { + if(param1) + { + delete this._aRendering[param1.file]; + true; + } + } + + private function processWaitingUi(param1:String, param2:Boolean = true) : void + { + var _loc3_:RenderQueueItem = null; + if(!this._aRendering[param1]) + { + return; + } + while((this._aRendering[param1]) && (this._aRendering[param1].length)) + { + _loc3_ = this._aRendering[param1].shift(); + this._lastRenderStart = getTimer(); + this.loadUi(_loc3_.uiData,_loc3_.container,_loc3_.properties,param2); + } + delete this._aRendering[param1]; + true; + } + + private function onUiRender(param1:UiRenderEvent) : void + { + var _loc2_:UiDefinition = param1.uiRenderer.uiDefinition; + if((!(param1.uiTarget.uiData.module is PreCompiledUiModule) && _loc2_ && _loc2_.useCache) && (!this._aCache[_loc2_.name]) && (BeriliaConstants.USE_UI_CACHE)) + { + this._aCache[_loc2_.name] = _loc2_; + StoreDataManager.getInstance().setData(BeriliaConstants.DATASTORE_UI_DEFINITION,DATASTORE_CATEGORY_CACHE,this._aCache); + } + if(_loc2_) + { + _log.info(_loc2_.name + " rendered in " + (getTimer() - this._lastRenderStart) + " ms (parsing: " + param1.uiRenderer.parsingTime + " ms, build: " + param1.uiRenderer.buildTime + " ms, script:" + param1.uiRenderer.scriptTime + " ms )"); + } + PoolsManager.getInstance().getUiRendererPool().checkIn(param1.uiRenderer as PoolableUiRenderer); + dispatchEvent(new UiRenderEvent(UiRenderEvent.UIRenderComplete,param1.bubbles,param1.cancelable,param1.uiTarget,param1.uiRenderer)); + if(_loc2_) + { + this.processWaitingUi(_loc2_.name,_loc2_.useCache); + } + } + } +} import com.ankamagames.berilia.types.graphic.UiRootContainer; import com.ankamagames.berilia.types.data.UiData; import com.ankamagames.berilia.managers.UiRenderManager; -class RenderQueueItem +class RenderQueueItem extends Object { - - public var container:UiRootContainer; - public var properties; - public var uiData:UiData; - - public function RenderQueueItem(uiData:UiData, cont:UiRootContainer, prop:*) - { - this.container = cont; - this.properties = prop; - this.uiData = uiData; - UiRenderManager.MEMORY_LOG[this] = 1; - } - + + function RenderQueueItem(param1:UiData, param2:UiRootContainer, param3:*) + { + super(); + this.container = param2; + this.properties = param3; + this.uiData = param1; + UiRenderManager.MEMORY_LOG[this] = 1; + } + + public var container:UiRootContainer; + + public var properties; + + public var uiData:UiData; } - diff --git a/com/ankamagames/berilia/managers/UiSoundManager.as b/com/ankamagames/berilia/managers/UiSoundManager.as index 76987f4b5..606dcdd6e 100644 --- a/com/ankamagames/berilia/managers/UiSoundManager.as +++ b/com/ankamagames/berilia/managers/UiSoundManager.as @@ -1,130 +1,129 @@ -package com.ankamagames.berilia.managers +package com.ankamagames.berilia.managers { - import flash.utils.Dictionary; - import com.ankamagames.berilia.types.data.BeriliaUiSound; - import com.ankamagames.berilia.types.data.BeriliaUiElementSound; - import com.ankamagames.berilia.types.data.Hook; - import __AS3__.vec.Vector; - import com.ankamagames.berilia.types.graphic.GraphicContainer; - import com.ankamagames.berilia.types.graphic.UiRootContainer; - import __AS3__.vec.*; - - public class UiSoundManager - { - - public static const UI_LOAD:uint = 0; - public static const UI_UNLOAD:uint = 1; - private static var _self:UiSoundManager; - - private var _registeredHook:Dictionary; - private var _registeredUi:Dictionary; - private var _registeredUiElement:Dictionary; - public var playSound:Function; - - public function UiSoundManager() - { - this._registeredHook = new Dictionary(); - this._registeredUi = new Dictionary(); - this._registeredUiElement = new Dictionary(); - super(); - } - - public static function getInstance():UiSoundManager - { - if (!(_self)) + import flash.utils.Dictionary; + import com.ankamagames.berilia.types.data.BeriliaUiSound; + import com.ankamagames.berilia.types.data.BeriliaUiElementSound; + import com.ankamagames.berilia.types.data.Hook; + import com.ankamagames.berilia.types.graphic.GraphicContainer; + import com.ankamagames.berilia.types.graphic.UiRootContainer; + + public class UiSoundManager extends Object + { + + public function UiSoundManager() + { + this._registeredHook = new Dictionary(); + this._registeredUi = new Dictionary(); + this._registeredUiElement = new Dictionary(); + super(); + } + + public static const UI_LOAD:uint = 0; + + public static const UI_UNLOAD:uint = 1; + + private static var _self:UiSoundManager; + + public static function getInstance() : UiSoundManager + { + if(!_self) + { + _self = new UiSoundManager(); + } + return _self; + } + + private var _registeredHook:Dictionary; + + private var _registeredUi:Dictionary; + + private var _registeredUiElement:Dictionary; + + public var playSound:Function; + + public function registerUi(param1:String, param2:String = null, param3:String = null) : void + { + var _loc4_:BeriliaUiSound = this._registeredUi[param1]; + if(!_loc4_) + { + _loc4_ = new BeriliaUiSound(); + _loc4_.uiName = param1; + _loc4_.openFile = param2; + _loc4_.closeFile = param3; + this._registeredUi[param1] = _loc4_; + } + else + { + _loc4_.openFile = param2; + _loc4_.closeFile = param3; + } + } + + public function getUi(param1:String) : BeriliaUiSound + { + return this._registeredUi[param1]; + } + + public function registerUiElement(param1:String, param2:String, param3:String, param4:String) : void + { + var _loc5_:BeriliaUiElementSound = new BeriliaUiElementSound(); + _loc5_.name = param2; + _loc5_.file = param4; + _loc5_.hook = param3; + this._registeredUiElement[param1 + "::" + param2 + "::" + param3] = _loc5_; + } + + public function fromHook(param1:Hook, param2:Array = null) : Boolean + { + this._registeredHook[Object(param1).prototype]; + return true; + } + + public function getAllSoundUiElement(param1:GraphicContainer) : Vector. + { + var _loc5_:String = null; + var _loc2_:Vector. = new Vector.(); + if(!param1.getUi()) + { + return _loc2_; + } + var _loc3_:* = param1.getUi().name + "::"; + var _loc4_:uint = _loc3_.length; + for(_loc5_ in this._registeredUiElement) + { + if(_loc5_.substr(0,_loc4_) == _loc3_ && _loc5_.substr(_loc4_,param1.name.length) == param1.name) { - _self = new (UiSoundManager)(); - }; - return (_self); - } - - - public function registerUi(uiName:String, openFile:String=null, closeFile:String=null):void - { - var uiSound:BeriliaUiSound = this._registeredUi[uiName]; - if (!(uiSound)) - { - uiSound = new BeriliaUiSound(); - uiSound.uiName = uiName; - uiSound.openFile = openFile; - uiSound.closeFile = closeFile; - this._registeredUi[uiName] = uiSound; + _loc2_.push(this._registeredUiElement[_loc5_]); } - else - { - uiSound.openFile = openFile; - uiSound.closeFile = closeFile; - }; - } - - public function getUi(uiName:String):BeriliaUiSound - { - return (this._registeredUi[uiName]); - } - - public function registerUiElement(uiName:String, instanceName:String, hookFct:String, file:String):void - { - var uiElementSound:BeriliaUiElementSound = new BeriliaUiElementSound(); - uiElementSound.name = instanceName; - uiElementSound.file = file; - uiElementSound.hook = hookFct; - this._registeredUiElement[((((uiName + "::") + instanceName) + "::") + hookFct)] = uiElementSound; - } - - public function fromHook(target:Hook, params:Array=null):Boolean - { - this._registeredHook[Object(target).prototype]; - return (true); - } - - public function getAllSoundUiElement(target:GraphicContainer):Vector. - { - var elementHash:String; - var result:Vector. = new Vector.(); - if (!(target.getUi())) - { - return (result); - }; - var uiName:String = (target.getUi().name + "::"); - var uiNameLen:uint = uiName.length; - for (elementHash in this._registeredUiElement) - { - if ((((elementHash.substr(0, uiNameLen) == uiName)) && ((elementHash.substr(uiNameLen, target.name.length) == target.name)))) - { - result.push(this._registeredUiElement[elementHash]); - }; - }; - return (result); - } - - public function fromUiElement(target:GraphicContainer, hookFct:String):Boolean - { - if (((((!(target)) || (!(hookFct)))) || (!(target.getUi())))) + } + return _loc2_; + } + + public function fromUiElement(param1:GraphicContainer, param2:String) : Boolean + { + if(!param1 || !param2 || !param1.getUi()) + { + return false; + } + var _loc3_:BeriliaUiElementSound = this._registeredUiElement[param1.getUi().name + "::" + param1.name + "::" + param2]; + if((param1.getUi()) && (_loc3_)) + { + if(this.playSound != null) { - return (false); - }; - var sndElem:BeriliaUiElementSound = this._registeredUiElement[((((target.getUi().name + "::") + target.name) + "::") + hookFct)]; - if (((target.getUi()) && (sndElem))) - { - if (this.playSound != null) - { - this.playSound(sndElem.file); - }; - return (true); - }; - return (false); - } - - public function fromUi(target:UiRootContainer, eventType:uint):Boolean - { - if (this._registeredUi[target.name]) - { - return (true); - }; - return (false); - } - - - } -}//package com.ankamagames.berilia.managers - + this.playSound(_loc3_.file); + } + return true; + } + return false; + } + + public function fromUi(param1:UiRootContainer, param2:uint) : Boolean + { + if(this._registeredUi[param1.name]) + { + return true; + } + return false; + } + } +} diff --git a/com/ankamagames/berilia/pools/PoolableUiRenderer.as b/com/ankamagames/berilia/pools/PoolableUiRenderer.as index 509a97380..8f2984276 100644 --- a/com/ankamagames/berilia/pools/PoolableUiRenderer.as +++ b/com/ankamagames/berilia/pools/PoolableUiRenderer.as @@ -1,19 +1,20 @@ -package com.ankamagames.berilia.pools +package com.ankamagames.berilia.pools { - import com.ankamagames.berilia.uiRender.UiRenderer; - import com.ankamagames.jerakine.pools.Poolable; - - public class PoolableUiRenderer extends UiRenderer implements Poolable - { - - - public function free():void - { - _nTimeStamp = 0; - _scUi = null; - } - - - } -}//package com.ankamagames.berilia.pools - + import com.ankamagames.berilia.uiRender.UiRenderer; + import com.ankamagames.jerakine.pools.Poolable; + + public class PoolableUiRenderer extends UiRenderer implements Poolable + { + + public function PoolableUiRenderer() + { + super(); + } + + public function free() : void + { + _nTimeStamp = 0; + _scUi = null; + } + } +} diff --git a/com/ankamagames/berilia/pools/PoolableXmlParsor.as b/com/ankamagames/berilia/pools/PoolableXmlParsor.as index 18f910472..0ef6be031 100644 --- a/com/ankamagames/berilia/pools/PoolableXmlParsor.as +++ b/com/ankamagames/berilia/pools/PoolableXmlParsor.as @@ -1,17 +1,18 @@ -package com.ankamagames.berilia.pools +package com.ankamagames.berilia.pools { - import com.ankamagames.berilia.uiRender.XmlParsor; - import com.ankamagames.jerakine.pools.Poolable; - - public class PoolableXmlParsor extends XmlParsor implements Poolable - { - - - public function free():void - { - } - - - } -}//package com.ankamagames.berilia.pools - + import com.ankamagames.berilia.uiRender.XmlParsor; + import com.ankamagames.jerakine.pools.Poolable; + + public class PoolableXmlParsor extends XmlParsor implements Poolable + { + + public function PoolableXmlParsor() + { + super(); + } + + public function free() : void + { + } + } +} diff --git a/com/ankamagames/berilia/pools/PoolsManager.as b/com/ankamagames/berilia/pools/PoolsManager.as index 1de16a317..22ab7a95d 100644 --- a/com/ankamagames/berilia/pools/PoolsManager.as +++ b/com/ankamagames/berilia/pools/PoolsManager.as @@ -1,64 +1,67 @@ -package com.ankamagames.berilia.pools +package com.ankamagames.berilia.pools { - import com.ankamagames.jerakine.pools.Pool; - import com.ankamagames.jerakine.utils.errors.SingletonError; - import com.ankamagames.jerakine.pools.PoolableLoader; - - public class PoolsManager - { - - private static var _self:PoolsManager; - - private var _loadersPool:Pool; - private var _xmlParsorPool:Pool; - private var _uiRendererPool:Pool; - - public function PoolsManager() - { - if (_self) - { - throw (new SingletonError("Direct initialization of singleton is forbidden. Please access PoolsManager using the getInstance method.")); - }; - } - - public static function getInstance():PoolsManager - { - if (_self == null) - { - _self = new (PoolsManager)(); - }; - return (_self); - } - - - public function getLoadersPool():Pool - { - if (this._loadersPool == null) - { - this._loadersPool = new Pool(PoolableLoader, 1, 1, 1); - }; - return (this._loadersPool); - } - - public function getXmlParsorPool():Pool - { - if (this._xmlParsorPool == null) - { - this._xmlParsorPool = new Pool(PoolableXmlParsor, 10, 5, 25); - }; - return (this._xmlParsorPool); - } - - public function getUiRendererPool():Pool - { - if (this._uiRendererPool == null) - { - this._uiRendererPool = new Pool(PoolableUiRenderer, 10, 5, 25); - }; - return (this._uiRendererPool); - } - - - } -}//package com.ankamagames.berilia.pools - + import com.ankamagames.jerakine.pools.Pool; + import com.ankamagames.jerakine.pools.PoolableLoader; + import com.ankamagames.jerakine.utils.errors.SingletonError; + + public class PoolsManager extends Object + { + + public function PoolsManager() + { + super(); + if(_self) + { + throw new SingletonError("Direct initialization of singleton is forbidden. Please access PoolsManager using the getInstance method."); + } + else + { + return; + } + } + + private static var _self:PoolsManager; + + public static function getInstance() : PoolsManager + { + if(_self == null) + { + _self = new PoolsManager(); + } + return _self; + } + + private var _loadersPool:Pool; + + private var _xmlParsorPool:Pool; + + private var _uiRendererPool:Pool; + + public function getLoadersPool() : Pool + { + if(this._loadersPool == null) + { + this._loadersPool = new Pool(PoolableLoader,1,1,1); + } + return this._loadersPool; + } + + public function getXmlParsorPool() : Pool + { + if(this._xmlParsorPool == null) + { + this._xmlParsorPool = new Pool(PoolableXmlParsor,10,5,25); + } + return this._xmlParsorPool; + } + + public function getUiRendererPool() : Pool + { + if(this._uiRendererPool == null) + { + this._uiRendererPool = new Pool(PoolableUiRenderer,10,5,25); + } + return this._uiRendererPool; + } + } +} diff --git a/com/ankamagames/berilia/types/BeriliaOptions.as b/com/ankamagames/berilia/types/BeriliaOptions.as index 818042141..48905c2af 100644 --- a/com/ankamagames/berilia/types/BeriliaOptions.as +++ b/com/ankamagames/berilia/types/BeriliaOptions.as @@ -1,16 +1,14 @@ -package com.ankamagames.berilia.types +package com.ankamagames.berilia.types { - import com.ankamagames.jerakine.managers.OptionManager; - - public dynamic class BeriliaOptions extends OptionManager - { - - public function BeriliaOptions() - { - super("berilia"); - add("uiShadows", true); - } - - } -}//package com.ankamagames.berilia.types - + import com.ankamagames.jerakine.managers.OptionManager; + + public dynamic class BeriliaOptions extends OptionManager + { + + public function BeriliaOptions() + { + super("berilia"); + add("uiShadows",true); + } + } +} diff --git a/com/ankamagames/berilia/types/LocationEnum.as b/com/ankamagames/berilia/types/LocationEnum.as index 59f98a838..7942aedff 100644 --- a/com/ankamagames/berilia/types/LocationEnum.as +++ b/com/ankamagames/berilia/types/LocationEnum.as @@ -1,19 +1,29 @@ -package com.ankamagames.berilia.types +package com.ankamagames.berilia.types { - public class LocationEnum - { - - public static const POINT_TOPLEFT:uint = 0; - public static const POINT_TOP:uint = 1; - public static const POINT_TOPRIGHT:uint = 2; - public static const POINT_LEFT:uint = 3; - public static const POINT_CENTER:uint = 4; - public static const POINT_RIGHT:uint = 5; - public static const POINT_BOTTOMLEFT:uint = 6; - public static const POINT_BOTTOM:uint = 7; - public static const POINT_BOTTOMRIGHT:uint = 8; - - - } -}//package com.ankamagames.berilia.types - + public class LocationEnum extends Object + { + + public function LocationEnum() + { + super(); + } + + public static const POINT_TOPLEFT:uint = 0; + + public static const POINT_TOP:uint = 1; + + public static const POINT_TOPRIGHT:uint = 2; + + public static const POINT_LEFT:uint = 3; + + public static const POINT_CENTER:uint = 4; + + public static const POINT_RIGHT:uint = 5; + + public static const POINT_BOTTOMLEFT:uint = 6; + + public static const POINT_BOTTOM:uint = 7; + + public static const POINT_BOTTOMRIGHT:uint = 8; + } +} diff --git a/com/ankamagames/berilia/types/data/ApiAction.as b/com/ankamagames/berilia/types/data/ApiAction.as index ec6f602c1..9f3a3597c 100644 --- a/com/ankamagames/berilia/types/data/ApiAction.as +++ b/com/ankamagames/berilia/types/data/ApiAction.as @@ -1,90 +1,98 @@ -package com.ankamagames.berilia.types.data +package com.ankamagames.berilia.types.data { - import flash.utils.Dictionary; - import com.ankamagames.berilia.utils.errors.BeriliaError; - - public class ApiAction - { - - public static var MEMORY_LOG:Dictionary = new Dictionary(true); - protected static var _apiActionNameList:Array = new Array(); - - protected var _trusted:Boolean; - protected var _name:String; - protected var _actionClass:Class; - protected var _maxUsePerFrame:uint = 1; - protected var _needInteraction:Boolean; - protected var _minimalUseInterval:uint = 0; - protected var _needConfirmation:Boolean; - - public function ApiAction(name:String, actionClass:Class, trusted:Boolean, needInteraction:Boolean, maxUsePerFrame:uint, minimalUseInterval:uint, needConfirmation:Boolean) - { - if (!(_apiActionNameList)) - { - _apiActionNameList = new Array(); - }; - if (_apiActionNameList[name]) - { - throw (new BeriliaError((("ApiAction name (" + name) + ") aleardy used, please rename it."))); - }; - _apiActionNameList[name] = this; - this._name = name; - this._actionClass = actionClass; - this._trusted = trusted; - this._needInteraction = needInteraction; - this._maxUsePerFrame = maxUsePerFrame; - this._minimalUseInterval = minimalUseInterval; - this._needConfirmation = needConfirmation; + import flash.utils.Dictionary; + import com.ankamagames.berilia.utils.errors.BeriliaError; + + public class ApiAction extends Object + { + + public function ApiAction(param1:String, param2:Class, param3:Boolean, param4:Boolean, param5:uint, param6:uint, param7:Boolean) + { + super(); + if(!_apiActionNameList) + { + _apiActionNameList = new Array(); + } + if(_apiActionNameList[param1]) + { + throw new BeriliaError("ApiAction name (" + param1 + ") aleardy used, please rename it."); + } + else + { + _apiActionNameList[param1] = this; + this._name = param1; + this._actionClass = param2; + this._trusted = param3; + this._needInteraction = param4; + this._maxUsePerFrame = param5; + this._minimalUseInterval = param6; + this._needConfirmation = param7; MEMORY_LOG[this] = 1; - } - - public static function getApiActionByName(name:String):ApiAction - { - return (_apiActionNameList[name]); - } - - public static function getApiActionsList():Array - { - return (_apiActionNameList); - } - - - public function get trusted():Boolean - { - return (this._trusted); - } - - public function get name():String - { - return (this._name); - } - - public function get needInteraction():Boolean - { - return (this._needInteraction); - } - - public function get maxUsePerFrame():uint - { - return (this._maxUsePerFrame); - } - - public function get minimalUseInterval():uint - { - return (this._minimalUseInterval); - } - - public function get needConfirmation():Boolean - { - return (this._needConfirmation); - } - - public function get actionClass():Class - { - return (this._actionClass); - } - - - } -}//package com.ankamagames.berilia.types.data - + return; + } + } + + public static var MEMORY_LOG:Dictionary = new Dictionary(true); + + protected static var _apiActionNameList:Array = new Array(); + + public static function getApiActionByName(param1:String) : ApiAction + { + return _apiActionNameList[param1]; + } + + public static function getApiActionsList() : Array + { + return _apiActionNameList; + } + + protected var _trusted:Boolean; + + protected var _name:String; + + protected var _actionClass:Class; + + protected var _maxUsePerFrame:uint = 1; + + protected var _needInteraction:Boolean; + + protected var _minimalUseInterval:uint = 0; + + protected var _needConfirmation:Boolean; + + public function get trusted() : Boolean + { + return this._trusted; + } + + public function get name() : String + { + return this._name; + } + + public function get needInteraction() : Boolean + { + return this._needInteraction; + } + + public function get maxUsePerFrame() : uint + { + return this._maxUsePerFrame; + } + + public function get minimalUseInterval() : uint + { + return this._minimalUseInterval; + } + + public function get needConfirmation() : Boolean + { + return this._needConfirmation; + } + + public function get actionClass() : Class + { + return this._actionClass; + } + } +} diff --git a/com/ankamagames/berilia/types/data/BeriliaUiElementSound.as b/com/ankamagames/berilia/types/data/BeriliaUiElementSound.as index da6fc5f32..0ad67cf83 100644 --- a/com/ankamagames/berilia/types/data/BeriliaUiElementSound.as +++ b/com/ankamagames/berilia/types/data/BeriliaUiElementSound.as @@ -1,13 +1,17 @@ -package com.ankamagames.berilia.types.data +package com.ankamagames.berilia.types.data { - public class BeriliaUiElementSound - { - - public var name:String; - public var hook:String; - public var file:String; - - - } -}//package com.ankamagames.berilia.types.data - + public class BeriliaUiElementSound extends Object + { + + public function BeriliaUiElementSound() + { + super(); + } + + public var name:String; + + public var hook:String; + + public var file:String; + } +} diff --git a/com/ankamagames/berilia/types/data/BeriliaUiSound.as b/com/ankamagames/berilia/types/data/BeriliaUiSound.as index ab804c3ee..5bcaaf977 100644 --- a/com/ankamagames/berilia/types/data/BeriliaUiSound.as +++ b/com/ankamagames/berilia/types/data/BeriliaUiSound.as @@ -1,13 +1,17 @@ -package com.ankamagames.berilia.types.data +package com.ankamagames.berilia.types.data { - public class BeriliaUiSound - { - - public var uiName:String; - public var openFile:String; - public var closeFile:String; - - - } -}//package com.ankamagames.berilia.types.data - + public class BeriliaUiSound extends Object + { + + public function BeriliaUiSound() + { + super(); + } + + public var uiName:String; + + public var openFile:String; + + public var closeFile:String; + } +} diff --git a/com/ankamagames/berilia/types/data/ChunkData.as b/com/ankamagames/berilia/types/data/ChunkData.as index ed67ed5aa..2b2bdfc20 100644 --- a/com/ankamagames/berilia/types/data/ChunkData.as +++ b/com/ankamagames/berilia/types/data/ChunkData.as @@ -1,19 +1,19 @@ -package com.ankamagames.berilia.types.data +package com.ankamagames.berilia.types.data { - import com.ankamagames.jerakine.types.Uri; - - public class ChunkData - { - - public var name:String; - public var uri:Uri; - - public function ChunkData(name:String, uri:Uri) - { - this.name = name; - this.uri = uri; - } - - } -}//package com.ankamagames.berilia.types.data - + import com.ankamagames.jerakine.types.Uri; + + public class ChunkData extends Object + { + + public function ChunkData(param1:String, param2:Uri) + { + super(); + this.name = param1; + this.uri = param2; + } + + public var name:String; + + public var uri:Uri; + } +} diff --git a/com/ankamagames/berilia/types/data/ContextMenuData.as b/com/ankamagames/berilia/types/data/ContextMenuData.as index 60c4ba6bb..46a388e05 100644 --- a/com/ankamagames/berilia/types/data/ContextMenuData.as +++ b/com/ankamagames/berilia/types/data/ContextMenuData.as @@ -1,27 +1,27 @@ -package com.ankamagames.berilia.types.data +package com.ankamagames.berilia.types.data { - import com.ankamagames.jerakine.interfaces.IDataCenter; - - public class ContextMenuData implements IDataCenter - { - - public var data; - public var makerName:String; - public var content:UnsecureArray; - - public function ContextMenuData(data:*, makerName:String, content:Array) - { - var entry:*; - super(); - this.data = data; - this.makerName = makerName; - this.content = new UnsecureArray(); - for each (entry in content) - { - this.content.push(entry); - }; - } - - } -}//package com.ankamagames.berilia.types.data - + import com.ankamagames.jerakine.interfaces.IDataCenter; + + public class ContextMenuData extends Object implements IDataCenter + { + + public function ContextMenuData(param1:*, param2:String, param3:Array) + { + var _loc4_:* = undefined; + super(); + this.data = param1; + this.makerName = param2; + this.content = new UnsecureArray(); + for each(_loc4_ in param3) + { + this.content.push(_loc4_); + } + } + + public var data; + + public var makerName:String; + + public var content:UnsecureArray; + } +} diff --git a/com/ankamagames/berilia/types/data/ExtendedStyleSheet.as b/com/ankamagames/berilia/types/data/ExtendedStyleSheet.as index a839866b6..46b086a33 100644 --- a/com/ankamagames/berilia/types/data/ExtendedStyleSheet.as +++ b/com/ankamagames/berilia/types/data/ExtendedStyleSheet.as @@ -1,201 +1,202 @@ -package com.ankamagames.berilia.types.data +package com.ankamagames.berilia.types.data { - import flash.text.StyleSheet; - import com.ankamagames.jerakine.logger.Logger; - import com.ankamagames.jerakine.logger.Log; - import flash.utils.getQualifiedClassName; - import com.ankamagames.jerakine.managers.LangManager; - import com.ankamagames.berilia.managers.CssManager; - import com.ankamagames.jerakine.types.Callback; - import com.ankamagames.berilia.types.event.CssEvent; - import flashx.textLayout.formats.TextLayoutFormat; - import com.ankamagames.jerakine.managers.FontManager; - import flash.text.AntiAliasType; - import flash.text.engine.RenderingMode; - import flash.text.engine.FontLookup; - import flash.text.engine.CFFHinting; - - public class ExtendedStyleSheet extends StyleSheet - { - - protected static const _log:Logger = Log.getLogger(getQualifiedClassName(ExtendedStyleSheet)); - private static const CSS_INHERITANCE_KEYWORD:String = "extends"; - private static const CSS_FILES_KEYWORD:String = "files"; - - private var _inherit:Array; - private var _inherited:uint; - private var _url:String; - - public function ExtendedStyleSheet(url:String) - { - this._inherit = new Array(); - this._inherited = 0; - this._url = url; - super(); - } - - public function get inherit():Array - { - return (this._inherit); - } - - public function get ready():Boolean - { - return ((this._inherited == this._inherit.length)); - } - - public function get url():String - { - return (this._url); - } - - override public function parseCSS(content:String):void - { - var inheritance:Object; - var regFile:RegExp; - var match:Array; - var file:String; - var i:uint; - super.parseCSS(content); - var find:int = styleNames.indexOf(CSS_INHERITANCE_KEYWORD); - if (find != -1) + import flash.text.StyleSheet; + import com.ankamagames.jerakine.logger.Logger; + import com.ankamagames.jerakine.logger.Log; + import flash.utils.getQualifiedClassName; + import com.ankamagames.jerakine.managers.LangManager; + import com.ankamagames.berilia.managers.CssManager; + import com.ankamagames.jerakine.types.Callback; + import com.ankamagames.berilia.types.event.CssEvent; + import flashx.textLayout.formats.TextLayoutFormat; + import com.ankamagames.jerakine.managers.FontManager; + import flash.text.AntiAliasType; + import flash.text.engine.RenderingMode; + import flash.text.engine.FontLookup; + import flash.text.engine.CFFHinting; + + public class ExtendedStyleSheet extends StyleSheet + { + + public function ExtendedStyleSheet(param1:String) + { + this._inherit = new Array(); + this._inherited = 0; + this._url = param1; + super(); + } + + protected static const _log:Logger = Log.getLogger(getQualifiedClassName(ExtendedStyleSheet)); + + private static const CSS_INHERITANCE_KEYWORD:String = "extends"; + + private static const CSS_FILES_KEYWORD:String = "files"; + + private var _inherit:Array; + + private var _inherited:uint; + + private var _url:String; + + public function get inherit() : Array + { + return this._inherit; + } + + public function get ready() : Boolean + { + return this._inherited == this._inherit.length; + } + + public function get url() : String + { + return this._url; + } + + override public function parseCSS(param1:String) : void + { + var _loc3_:Object = null; + var _loc4_:RegExp = null; + var _loc5_:Array = null; + var _loc6_:String = null; + var _loc7_:uint = 0; + super.parseCSS(param1); + var _loc2_:int = styleNames.indexOf(CSS_INHERITANCE_KEYWORD); + if(_loc2_ != -1) + { + _loc3_ = getStyle(styleNames[_loc2_]); + if(_loc3_[CSS_FILES_KEYWORD]) { - inheritance = getStyle(styleNames[find]); - if (inheritance[CSS_FILES_KEYWORD]) - { - regFile = /url\('?([^']*)'\)?/g; - match = String(inheritance[CSS_FILES_KEYWORD]).match(regFile); - i = 0; - while (i < match.length) - { - file = String(match[i]).replace(regFile, "$1"); - if (-1 == this._inherit.indexOf(file)) - { - file = LangManager.getInstance().replaceKey(file); - CssManager.getInstance().askCss(file, new Callback(this.makeMerge, file)); - this._inherit.push(file); - }; - i++; - }; - } - else - { - _log.warn((("property '" + CSS_FILES_KEYWORD) + "' wasn't found (flash css doesn't support space between property name and colon, propertyName:value)")); - dispatchEvent(new CssEvent(CssEvent.CSS_PARSED, false, false, this)); - }; + _loc4_ = new RegExp("url\\(\'?([^\']*)\'\\)?","g"); + _loc5_ = String(_loc3_[CSS_FILES_KEYWORD]).match(_loc4_); + _loc7_ = 0; + while(_loc7_ < _loc5_.length) + { + _loc6_ = String(_loc5_[_loc7_]).replace(_loc4_,"$1"); + if(-1 == this._inherit.indexOf(_loc6_)) + { + _loc6_ = LangManager.getInstance().replaceKey(_loc6_); + CssManager.getInstance().askCss(_loc6_,new Callback(this.makeMerge,_loc6_)); + this._inherit.push(_loc6_); + } + _loc7_++; + } } else { - dispatchEvent(new CssEvent(CssEvent.CSS_PARSED, false, false, this)); - }; - } - - public function merge(stylesheet:ExtendedStyleSheet, replace:Boolean=false):void - { - var localDef:Object; - var newDef:Object; - var property:String; - var i:uint; - while (i < stylesheet.styleNames.length) - { - if (stylesheet.styleNames[i] != CSS_INHERITANCE_KEYWORD) - { - localDef = getStyle(stylesheet.styleNames[i]); - newDef = stylesheet.getStyle(stylesheet.styleNames[i]); - if (localDef) - { - for (property in newDef) - { - if ((((localDef[property] == null)) || (replace))) - { - localDef[property] = newDef[property]; - }; - }; - newDef = localDef; - }; - setStyle(stylesheet.styleNames[i], newDef); - }; - i++; - }; - } - - override public function toString():String - { - var localDef:Object; - var property:String; - var result:String = ""; - result = (result + (("File " + this.url) + " :\n")); - var i:uint; - while (i < styleNames.length) - { - localDef = getStyle(styleNames[i]); - result = (result + ((" [" + styleNames[i]) + "]\n")); - for (property in localDef) - { - result = (result + ((((" " + property) + " : ") + localDef[property]) + "\n")); - }; - i++; - }; - return (result); - } - - public function TLFTransform(formatObject:Object):TextLayoutFormat - { - var cssFont:String; - var format:TextLayoutFormat = new TextLayoutFormat(); - if (formatObject["fontFamily"]) - { - cssFont = formatObject["fontFamily"]; - if (FontManager.getInstance().getFontClassRenderingMode(cssFont) == AntiAliasType.ADVANCED) - { - format.renderingMode = RenderingMode.CFF; - format.fontLookup = FontLookup.EMBEDDED_CFF; - format.cffHinting = CFFHinting.HORIZONTAL_STEM; - }; - format.fontFamily = cssFont; - }; - if (formatObject["color"]) - { - format.color = formatObject["color"]; - }; - if (formatObject["fontSize"]) - { - format.fontSize = formatObject["fontSize"]; - }; - if (formatObject["paddingLeft"]) - { - format.paddingLeft = formatObject["paddingLeft"]; - }; - if (formatObject["paddingRight"]) - { - format.paddingRight = formatObject["paddingRight"]; - }; - if (formatObject["paddingBottom"]) - { - format.paddingBottom = formatObject["paddingBottom"]; - }; - if (formatObject["paddingTop"]) + _log.warn("property \'" + CSS_FILES_KEYWORD + "\' wasn\'t found (flash css doesn\'t support space between property name and colon, propertyName:value)"); + dispatchEvent(new CssEvent(CssEvent.CSS_PARSED,false,false,this)); + } + } + else + { + dispatchEvent(new CssEvent(CssEvent.CSS_PARSED,false,false,this)); + } + } + + public function merge(param1:ExtendedStyleSheet, param2:Boolean = false) : void + { + var _loc3_:Object = null; + var _loc4_:Object = null; + var _loc6_:String = null; + var _loc5_:uint = 0; + while(_loc5_ < param1.styleNames.length) + { + if(param1.styleNames[_loc5_] != CSS_INHERITANCE_KEYWORD) { - format.paddingTop = formatObject["paddingTop"]; - }; - if (formatObject["textIndent"]) + _loc3_ = getStyle(param1.styleNames[_loc5_]); + _loc4_ = param1.getStyle(param1.styleNames[_loc5_]); + if(_loc3_) + { + for(_loc6_ in _loc4_) + { + if(_loc3_[_loc6_] == null || (param2)) + { + _loc3_[_loc6_] = _loc4_[_loc6_]; + } + } + _loc4_ = _loc3_; + } + setStyle(param1.styleNames[_loc5_],_loc4_); + } + _loc5_++; + } + } + + override public function toString() : String + { + var _loc2_:Object = null; + var _loc4_:String = null; + var _loc1_:* = ""; + _loc1_ = _loc1_ + ("File " + this.url + " :\n"); + var _loc3_:uint = 0; + while(_loc3_ < styleNames.length) + { + _loc2_ = getStyle(styleNames[_loc3_]); + _loc1_ = _loc1_ + (" [" + styleNames[_loc3_] + "]\n"); + for(_loc4_ in _loc2_) { - format.textIndent = formatObject["textIndent"]; - }; - return (format); - } - - private function makeMerge(sUrl:String):void - { - this.merge(CssManager.getInstance().getCss(sUrl)); - this._inherited++; - if (this.ready) + _loc1_ = _loc1_ + (" " + _loc4_ + " : " + _loc2_[_loc4_] + "\n"); + } + _loc3_++; + } + return _loc1_; + } + + public function TLFTransform(param1:Object) : TextLayoutFormat + { + var _loc3_:String = null; + var _loc2_:TextLayoutFormat = new TextLayoutFormat(); + if(param1["fontFamily"]) + { + _loc3_ = param1["fontFamily"]; + if(FontManager.getInstance().getFontClassRenderingMode(_loc3_) == AntiAliasType.ADVANCED) { - dispatchEvent(new CssEvent(CssEvent.CSS_PARSED, false, false, this)); - }; - } - - - } -}//package com.ankamagames.berilia.types.data - + _loc2_.renderingMode = RenderingMode.CFF; + _loc2_.fontLookup = FontLookup.EMBEDDED_CFF; + _loc2_.cffHinting = CFFHinting.HORIZONTAL_STEM; + } + _loc2_.fontFamily = _loc3_; + } + if(param1["color"]) + { + _loc2_.color = param1["color"]; + } + if(param1["fontSize"]) + { + _loc2_.fontSize = param1["fontSize"]; + } + if(param1["paddingLeft"]) + { + _loc2_.paddingLeft = param1["paddingLeft"]; + } + if(param1["paddingRight"]) + { + _loc2_.paddingRight = param1["paddingRight"]; + } + if(param1["paddingBottom"]) + { + _loc2_.paddingBottom = param1["paddingBottom"]; + } + if(param1["paddingTop"]) + { + _loc2_.paddingTop = param1["paddingTop"]; + } + if(param1["textIndent"]) + { + _loc2_.textIndent = param1["textIndent"]; + } + return _loc2_; + } + + private function makeMerge(param1:String) : void + { + this.merge(CssManager.getInstance().getCss(param1)); + this._inherited++; + if(this.ready) + { + dispatchEvent(new CssEvent(CssEvent.CSS_PARSED,false,false,this)); + } + } + } +} diff --git a/com/ankamagames/berilia/types/data/GridItem.as b/com/ankamagames/berilia/types/data/GridItem.as index a33849b83..8d521cae9 100644 --- a/com/ankamagames/berilia/types/data/GridItem.as +++ b/com/ankamagames/berilia/types/data/GridItem.as @@ -1,22 +1,23 @@ -package com.ankamagames.berilia.types.data +package com.ankamagames.berilia.types.data { - import com.ankamagames.jerakine.interfaces.IDataCenter; - import flash.display.DisplayObject; - - public class GridItem implements IDataCenter - { - - public var index:uint; - public var container:DisplayObject; - public var data; - - public function GridItem(id:uint, c:DisplayObject, d:*) - { - this.index = id; - this.container = c; - this.data = d; - } - - } -}//package com.ankamagames.berilia.types.data - + import com.ankamagames.jerakine.interfaces.IDataCenter; + import flash.display.DisplayObject; + + public class GridItem extends Object implements IDataCenter + { + + public function GridItem(param1:uint, param2:DisplayObject, param3:*) + { + super(); + this.index = param1; + this.container = param2; + this.data = param3; + } + + public var index:uint; + + public var container:DisplayObject; + + public var data; + } +} diff --git a/com/ankamagames/berilia/types/data/Hook.as b/com/ankamagames/berilia/types/data/Hook.as index 047fde3d4..54f2aaf9e 100644 --- a/com/ankamagames/berilia/types/data/Hook.as +++ b/com/ankamagames/berilia/types/data/Hook.as @@ -1,63 +1,68 @@ -package com.ankamagames.berilia.types.data +package com.ankamagames.berilia.types.data { - import com.ankamagames.berilia.utils.errors.BeriliaError; - - public class Hook - { - - private static var _hookNameList:Array; - - private var _trusted:Boolean; - private var _name:String; - private var _nativeHook:Boolean; - - public function Hook(name:String, trusted:Boolean, nativeHook:Boolean=true) - { - if (!(_hookNameList)) + import com.ankamagames.berilia.utils.errors.BeriliaError; + + public class Hook extends Object + { + + public function Hook(param1:String, param2:Boolean, param3:Boolean = true) + { + super(); + if(!_hookNameList) + { + _hookNameList = new Array(); + } + _hookNameList[param1] = this; + this._name = param1; + this._trusted = param2; + } + + private static var _hookNameList:Array; + + public static function create(param1:String, param2:Boolean, param3:Boolean = true) : Hook + { + var _loc4_:Hook = _hookNameList[param1]; + if(_loc4_) + { + if(param2) { - _hookNameList = new Array(); - }; - _hookNameList[name] = this; - this._name = name; - this._trusted = trusted; - } - - public static function create(name:String, trusted:Boolean, nativeHook:Boolean=true):Hook - { - var h:Hook = _hookNameList[name]; - if (h) + throw new BeriliaError("Hook name (" + param1 + ") aleardy used, please rename it."); + } + else { - if (trusted) - { - throw (new BeriliaError((("Hook name (" + name) + ") aleardy used, please rename it."))); - }; - return (h); - }; - return (new (Hook)(name, trusted, nativeHook)); - } - - public static function getHookByName(name:String):Hook - { - return (_hookNameList[name]); - } - - - public function get trusted():Boolean - { - return (this._trusted); - } - - public function get name():String - { - return (this._name); - } - - public function get nativeHook():Boolean - { - return (this._nativeHook); - } - - - } -}//package com.ankamagames.berilia.types.data - + return _loc4_; + } + } + else + { + return new Hook(param1,param2,param3); + } + } + + public static function getHookByName(param1:String) : Hook + { + return _hookNameList[param1]; + } + + private var _trusted:Boolean; + + private var _name:String; + + private var _nativeHook:Boolean; + + public function get trusted() : Boolean + { + return this._trusted; + } + + public function get name() : String + { + return this._name; + } + + public function get nativeHook() : Boolean + { + return this._nativeHook; + } + } +} diff --git a/com/ankamagames/berilia/types/data/LinkedCursorData.as b/com/ankamagames/berilia/types/data/LinkedCursorData.as index eee91069d..9242ccc41 100644 --- a/com/ankamagames/berilia/types/data/LinkedCursorData.as +++ b/com/ankamagames/berilia/types/data/LinkedCursorData.as @@ -1,18 +1,24 @@ -package com.ankamagames.berilia.types.data +package com.ankamagames.berilia.types.data { - import flash.display.Sprite; - import flash.geom.Point; - - public class LinkedCursorData - { - - public var sprite:Sprite; - public var lockX:Boolean = false; - public var lockY:Boolean = false; - public var offset:Point; - public var data; - - - } -}//package com.ankamagames.berilia.types.data - + import flash.display.Sprite; + import flash.geom.Point; + + public class LinkedCursorData extends Object + { + + public function LinkedCursorData() + { + super(); + } + + public var sprite:Sprite; + + public var lockX:Boolean = false; + + public var lockY:Boolean = false; + + public var offset:Point; + + public var data; + } +} diff --git a/com/ankamagames/berilia/types/data/Map.as b/com/ankamagames/berilia/types/data/Map.as index b20869ce1..25730a60a 100644 --- a/com/ankamagames/berilia/types/data/Map.as +++ b/com/ankamagames/berilia/types/data/Map.as @@ -1,61 +1,65 @@ -package com.ankamagames.berilia.types.data +package com.ankamagames.berilia.types.data { - import __AS3__.vec.Vector; - import flash.display.DisplayObjectContainer; - import com.ankamagames.jerakine.types.Uri; - import __AS3__.vec.*; - - public class Map - { - - public var currentScale:Number; - public var initialWidth:uint; - public var initialHeight:uint; - public var chunckWidth:uint; - public var chunckHeight:uint; - public var zoom:Number; - private var _areas:Vector.; - public var container:DisplayObjectContainer; - public var numXChunck:uint; - public var numYChunck:uint; - - public function Map(zoom:Number, srcFolder:String, container:DisplayObjectContainer, initialWidth:uint, initialHeight:uint, chunckWidth:uint, chunckHeight:uint) - { - var area:MapArea; - var i:uint; - super(); - this.zoom = zoom; - this.container = container; - this.initialHeight = initialHeight; - this.initialWidth = initialWidth; - this.chunckHeight = chunckHeight; - this.chunckWidth = chunckWidth; - container.doubleClickEnabled = true; - this.numXChunck = Math.ceil(((initialWidth * zoom) / chunckWidth)); - this.numYChunck = Math.ceil(((initialHeight * zoom) / chunckHeight)); - this._areas = new Vector.((this.numXChunck * this.numYChunck), true); - var chunckId:uint = 1; - var j:uint; - while (j < this.numYChunck) + import flash.display.DisplayObjectContainer; + import com.ankamagames.jerakine.types.Uri; + + public class Map extends Object + { + + public function Map(param1:Number, param2:String, param3:DisplayObjectContainer, param4:uint, param5:uint, param6:uint, param7:uint) + { + var _loc8_:MapArea = null; + var _loc11_:uint = 0; + super(); + this.zoom = param1; + this.container = param3; + this.initialHeight = param5; + this.initialWidth = param4; + this.chunckHeight = param7; + this.chunckWidth = param6; + param3.doubleClickEnabled = true; + this.numXChunck = Math.ceil(param4 * param1 / param6); + this.numYChunck = Math.ceil(param5 * param1 / param7); + this._areas = new Vector.(this.numXChunck * this.numYChunck,true); + var _loc9_:uint = 1; + var _loc10_:uint = 0; + while(_loc10_ < this.numYChunck) + { + _loc11_ = 0; + while(_loc11_ < this.numXChunck) { - i = 0; - while (i < this.numXChunck) - { - area = new MapArea(new Uri(((srcFolder + chunckId) + ".jpg")), ((i * chunckWidth) / zoom), ((j * chunckHeight) / zoom), (chunckWidth / zoom), (chunckHeight / zoom), this); - this.areas[(chunckId - 1)] = area; - chunckId++; - i++; - }; - j++; - }; - } - - public function get areas():Vector. - { - return (this._areas); - } - - - } -}//package com.ankamagames.berilia.types.data - + _loc8_ = new MapArea(new Uri(param2 + _loc9_ + ".jpg"),_loc11_ * param6 / param1,_loc10_ * param7 / param1,param6 / param1,param7 / param1,this); + this.areas[_loc9_ - 1] = _loc8_; + _loc9_++; + _loc11_++; + } + _loc10_++; + } + } + + public var currentScale:Number; + + public var initialWidth:uint; + + public var initialHeight:uint; + + public var chunckWidth:uint; + + public var chunckHeight:uint; + + public var zoom:Number; + + private var _areas:Vector.; + + public function get areas() : Vector. + { + return this._areas; + } + + public var container:DisplayObjectContainer; + + public var numXChunck:uint; + + public var numYChunck:uint; + } +} diff --git a/com/ankamagames/berilia/types/data/MapArea.as b/com/ankamagames/berilia/types/data/MapArea.as index 26725e16e..643a7279b 100644 --- a/com/ankamagames/berilia/types/data/MapArea.as +++ b/com/ankamagames/berilia/types/data/MapArea.as @@ -1,163 +1,162 @@ -package com.ankamagames.berilia.types.data +package com.ankamagames.berilia.types.data { - import flash.geom.Rectangle; - import com.ankamagames.jerakine.resources.loaders.impl.ParallelRessourceLoader; - import com.ankamagames.jerakine.types.Uri; - import flash.display.Bitmap; - import flash.utils.Timer; - import flash.events.TimerEvent; - import com.ankamagames.jerakine.resources.events.ResourceLoadedEvent; - import flash.display.DisplayObject; - import flash.events.Event; - - public class MapArea extends Rectangle - { - - private static var _mapLoader:ParallelRessourceLoader = new ParallelRessourceLoader(10); - private static var _freeBitmap:Array = []; - - public var src:Uri; - public var parent:Map; - private var _bitmap:Bitmap; - private var _active:Boolean; - private var _freeTimer:Timer; - private var _isLoaded:Boolean; - - public function MapArea(src:Uri, x:Number, y:Number, width:Number, height:Number, parent:Map) - { - this.src = src; - this.parent = parent; - this._isLoaded = false; - super(x, y, width, height); - } - - public function get isUsed():Boolean - { - return (this._active); - } - - public function get isLoaded():Boolean - { - return (this._isLoaded); - } - - public function getBitmap():DisplayObject - { - this._active = true; - if (this._freeTimer) - { - this._freeTimer.removeEventListener(TimerEvent.TIMER, this.onDeathCountDown); - this._freeTimer.stop(); - this._freeTimer = null; - }; - if (((!(this._bitmap)) || (!(this._bitmap.bitmapData)))) + import flash.geom.Rectangle; + import com.ankamagames.jerakine.resources.loaders.impl.ParallelRessourceLoader; + import com.ankamagames.jerakine.types.Uri; + import flash.display.Bitmap; + import flash.utils.Timer; + import flash.display.DisplayObject; + import flash.events.TimerEvent; + import com.ankamagames.jerakine.resources.events.ResourceLoadedEvent; + import flash.events.Event; + + public class MapArea extends Rectangle + { + + public function MapArea(param1:Uri, param2:Number, param3:Number, param4:Number, param5:Number, param6:Map) + { + this.src = param1; + this.parent = param6; + this._isLoaded = false; + super(param2,param3,param4,param5); + } + + private static var _mapLoader:ParallelRessourceLoader = new ParallelRessourceLoader(10); + + private static var _freeBitmap:Array = []; + + public var src:Uri; + + public var parent:Map; + + private var _bitmap:Bitmap; + + private var _active:Boolean; + + private var _freeTimer:Timer; + + private var _isLoaded:Boolean; + + public function get isUsed() : Boolean + { + return this._active; + } + + public function get isLoaded() : Boolean + { + return this._isLoaded; + } + + public function getBitmap() : DisplayObject + { + this._active = true; + if(this._freeTimer) + { + this._freeTimer.removeEventListener(TimerEvent.TIMER,this.onDeathCountDown); + this._freeTimer.stop(); + this._freeTimer = null; + } + if(!this._bitmap || !this._bitmap.bitmapData) + { + if(_freeBitmap.length) { - if (_freeBitmap.length) - { - this._bitmap = _freeBitmap.pop(); - } - else - { - this._bitmap = new Bitmap(); - }; - _mapLoader.addEventListener(ResourceLoadedEvent.LOADED, this.onLoad); - this._bitmap.x = x; - this._bitmap.y = y; - _mapLoader.load(this.src); - }; - return (this._bitmap); - } - - public function free(force:Boolean=false):void - { - this._active = false; - if (force) + this._bitmap = _freeBitmap.pop(); + } + else { - this.onDeathCountDown(null); - return; - }; - if (!(this._freeTimer)) + this._bitmap = new Bitmap(); + } + _mapLoader.addEventListener(ResourceLoadedEvent.LOADED,this.onLoad); + this._bitmap.x = x; + this._bitmap.y = y; + _mapLoader.load(this.src); + } + return this._bitmap; + } + + public function free(param1:Boolean = false) : void + { + this._active = false; + if(param1) + { + this.onDeathCountDown(null); + return; + } + if(!this._freeTimer) + { + this._freeTimer = new Timer(3000); + this._freeTimer.addEventListener(TimerEvent.TIMER,this.onDeathCountDown); + } + this._freeTimer.start(); + } + + private function onDeathCountDown(param1:Event) : void + { + if(this._freeTimer) + { + this._freeTimer.removeEventListener(TimerEvent.TIMER,this.onDeathCountDown); + this._freeTimer.stop(); + this._freeTimer = null; + } + if(this._active) + { + return; + } + if(this._bitmap) + { + if(this._bitmap.parent) { - this._freeTimer = new Timer(3000); - this._freeTimer.addEventListener(TimerEvent.TIMER, this.onDeathCountDown); - }; - this._freeTimer.start(); - } - - private function onDeathCountDown(e:Event):void - { - if (this._freeTimer) + this._bitmap.parent.removeChild(this._bitmap); + } + if(this._bitmap.bitmapData) { - this._freeTimer.removeEventListener(TimerEvent.TIMER, this.onDeathCountDown); - this._freeTimer.stop(); - this._freeTimer = null; - }; - if (this._active) + this._bitmap.bitmapData.dispose(); + } + this._bitmap.bitmapData = null; + _freeBitmap.push(this._bitmap); + this._bitmap = null; + this._isLoaded = false; + } + } + + private function onLoad(param1:ResourceLoadedEvent) : void + { + var _loc2_:* = false; + var _loc3_:* = NaN; + if((this._active) && param1.uri == this.src) + { + this._isLoaded = true; + this._bitmap.bitmapData = param1.resource; + _loc2_ = !(this._bitmap.width == this._bitmap.height); + this._bitmap.width = width + 1; + this._bitmap.height = height + 1; + if(!_loc2_) { - return; - }; - if (this._bitmap) + return; + } + _loc3_ = this.parent.currentScale; + if(isNaN(_loc3_)) { - if (this._bitmap.parent) - { - this._bitmap.parent.removeChild(this._bitmap); - }; - if (this._bitmap.bitmapData) - { - this._bitmap.bitmapData.dispose(); - }; - this._bitmap.bitmapData = null; - _freeBitmap.push(this._bitmap); - this._bitmap = null; - this._isLoaded = false; - }; - } - - private function onLoad(e:ResourceLoadedEvent):void - { - var checkScale:Boolean; - var currentScale:Number; - if (((this._active) && ((e.uri == this.src)))) + if(this._bitmap.scaleX == this._bitmap.scaleY) + { + _loc3_ = this._bitmap.scaleX; + } + else if(x + width > this.parent.initialWidth) + { + _loc3_ = this._bitmap.scaleY; + } + else if(y + height > this.parent.initialHeight) + { + _loc3_ = this._bitmap.scaleX; + } + + + } + if(!(this._bitmap.scaleX == this._bitmap.scaleY) && (_loc3_)) { - this._isLoaded = true; - this._bitmap.bitmapData = e.resource; - checkScale = !((this._bitmap.width == this._bitmap.height)); - this._bitmap.width = (width + 1); - this._bitmap.height = (height + 1); - if (!(checkScale)) - { - return; - }; - currentScale = this.parent.currentScale; - if (isNaN(currentScale)) - { - if (this._bitmap.scaleX == this._bitmap.scaleY) - { - currentScale = this._bitmap.scaleX; - } - else - { - if ((x + width) > this.parent.initialWidth) - { - currentScale = this._bitmap.scaleY; - } - else - { - if ((y + height) > this.parent.initialHeight) - { - currentScale = this._bitmap.scaleX; - }; - }; - }; - }; - if (((!((this._bitmap.scaleX == this._bitmap.scaleY))) && (currentScale))) - { - this._bitmap.scaleX = (this._bitmap.scaleY = currentScale); - }; - }; - } - - - } -}//package com.ankamagames.berilia.types.data - + this._bitmap.scaleX = this._bitmap.scaleY = _loc3_; + } + } + } + } +} diff --git a/com/ankamagames/berilia/types/data/MapElement.as b/com/ankamagames/berilia/types/data/MapElement.as index 36c296db7..ea5ba663e 100644 --- a/com/ankamagames/berilia/types/data/MapElement.as +++ b/com/ankamagames/berilia/types/data/MapElement.as @@ -1,103 +1,109 @@ -package com.ankamagames.berilia.types.data +package com.ankamagames.berilia.types.data { - import com.ankamagames.jerakine.interfaces.Secure; - import flash.utils.Dictionary; - import com.ankamagames.jerakine.utils.memory.WeakReference; - import com.ankamagames.berilia.managers.SecureCenter; - import flash.errors.IllegalOperationError; - - public class MapElement implements Secure - { - - public static var _elementRef:Dictionary = new Dictionary(true); - - private var _id:String; - private var _owner:WeakReference; - public var x:int; - public var y:int; - public var layer:String; - - public function MapElement(id:String, x:int, y:int, layer:String, owner:*) - { - this.x = x; - this.y = y; - this.layer = layer; - if (!(_elementRef[owner])) + import com.ankamagames.jerakine.interfaces.Secure; + import flash.utils.Dictionary; + import com.ankamagames.jerakine.utils.memory.WeakReference; + import com.ankamagames.berilia.managers.SecureCenter; + import flash.errors.IllegalOperationError; + + public class MapElement extends Object implements Secure + { + + public function MapElement(param1:String, param2:int, param3:int, param4:String, param5:*) + { + super(); + this.x = param2; + this.y = param3; + this.layer = param4; + if(!_elementRef[param5]) + { + _elementRef[param5] = new Dictionary(); + } + this._owner = new WeakReference(param5); + _elementRef[param5][param1] = this; + this._id = param1; + } + + public static var _elementRef:Dictionary = new Dictionary(true); + + public static function getElementById(param1:String, param2:*) : MapElement + { + return _elementRef[param2]?_elementRef[param2][param1]:null; + } + + public static function removeElementById(param1:String, param2:*) : void + { + if(_elementRef[param2][param1]) + { + _elementRef[param2][param1].remove(); + } + delete _elementRef[param2][param1]; + true; + } + + public static function removeAllElements(param1:*) : void + { + var _loc2_:* = undefined; + var _loc3_:MapElement = null; + for(_loc2_ in _elementRef) + { + if(!param1 || _loc2_ == param1) { - _elementRef[owner] = new Dictionary(); - }; - this._owner = new WeakReference(owner); - _elementRef[owner][id] = this; - this._id = id; - } - - public static function getElementById(id:String, owner:*):MapElement - { - return (((_elementRef[owner]) ? _elementRef[owner][id] : null)); - } - - public static function removeElementById(id:String, owner:*):void - { - if (_elementRef[owner][id]) - { - _elementRef[owner][id].remove(); - }; - delete _elementRef[owner][id]; - } - - public static function removeAllElements(owner:*):void - { - var currentOwner:*; - var me:MapElement; - for (currentOwner in _elementRef) - { - if (((!(owner)) || ((currentOwner == owner)))) - { - for each (me in _elementRef[currentOwner]) - { - me.remove(); - }; - }; - }; - if (!(owner)) - { - _elementRef = new Dictionary(true); + for each(_loc3_ in _elementRef[_loc2_]) + { + _loc3_.remove(); + } } - else - { - _elementRef[owner] = new Dictionary(true); - }; - } - - public static function getOwnerElements(owner:*):Dictionary - { - return (_elementRef[owner]); - } - - - public function getObject(accessKey:Object) - { - if (accessKey != SecureCenter.ACCESS_KEY) - { - throw (new IllegalOperationError()); - }; - return (this); - } - - public function get id():String - { - return (this._id); - } - - public function remove():void - { - if (((this._owner.object) && (_elementRef[this._owner.object]))) - { - delete _elementRef[this._owner.object][this._id]; - }; - } - - - } -}//package com.ankamagames.berilia.types.data - + } + if(!param1) + { + _elementRef = new Dictionary(true); + } + else + { + _elementRef[param1] = new Dictionary(true); + } + } + + public static function getOwnerElements(param1:*) : Dictionary + { + return _elementRef[param1]; + } + + private var _id:String; + + private var _owner:WeakReference; + + public var x:int; + + public var y:int; + + public var layer:String; + + public function getObject(param1:Object) : * + { + if(param1 != SecureCenter.ACCESS_KEY) + { + throw new IllegalOperationError(); + } + else + { + return this; + } + } + + public function get id() : String + { + return this._id; + } + + public function remove() : void + { + if((this._owner.object) && (_elementRef[this._owner.object])) + { + delete _elementRef[this._owner.object][this._id]; + true; + } + } + } +} diff --git a/com/ankamagames/berilia/types/data/OldMessage.as b/com/ankamagames/berilia/types/data/OldMessage.as index 4f12a5f4a..47199a5c9 100644 --- a/com/ankamagames/berilia/types/data/OldMessage.as +++ b/com/ankamagames/berilia/types/data/OldMessage.as @@ -1,22 +1,22 @@ -package com.ankamagames.berilia.types.data +package com.ankamagames.berilia.types.data { - import flash.utils.Dictionary; - - public class OldMessage - { - - public static var MEMORY_LOG:Dictionary = new Dictionary(true); - - public var hook:Hook; - public var args:Array; - - public function OldMessage(pHook:Hook, pArgs:Array) - { - this.hook = pHook; - this.args = pArgs; - MEMORY_LOG[this] = 1; - } - - } -}//package com.ankamagames.berilia.types.data - + import flash.utils.Dictionary; + + public class OldMessage extends Object + { + + public function OldMessage(param1:Hook, param2:Array) + { + super(); + this.hook = param1; + this.args = param2; + MEMORY_LOG[this] = 1; + } + + public static var MEMORY_LOG:Dictionary = new Dictionary(true); + + public var hook:Hook; + + public var args:Array; + } +} diff --git a/com/ankamagames/berilia/types/data/PreCompiledUiModule.as b/com/ankamagames/berilia/types/data/PreCompiledUiModule.as index c565d47a2..90f16ebf3 100644 --- a/com/ankamagames/berilia/types/data/PreCompiledUiModule.as +++ b/com/ankamagames/berilia/types/data/PreCompiledUiModule.as @@ -1,147 +1,164 @@ -package com.ankamagames.berilia.types.data +package com.ankamagames.berilia.types.data { - import com.ankamagames.jerakine.interfaces.IModuleUtil; - import flash.utils.Dictionary; - import flash.utils.ByteArray; - import flash.utils.IDataInput; - import com.ankamagames.berilia.types.uiDefinition.UiDefinition; - import flash.utils.IDataOutput; - import flash.net.ObjectEncoding; - - public class PreCompiledUiModule extends UiModule implements IModuleUtil - { - - private static const HEADER_STR:String = "D2UI"; - - private var _uiListPosition:Dictionary; - private var _definitionCount:uint; - private var _uiListStartPosition:uint; - private var _output:ByteArray; - private var _uiBuffer:ByteArray; - private var _input:ByteArray; - private var _cacheDefinition:Dictionary; - - - public static function fromRaw(input:IDataInput, nativePath:String, id:String):PreCompiledUiModule - { - var instance:PreCompiledUiModule = new (PreCompiledUiModule)(); - var localInput:ByteArray = new ByteArray(); - instance._input = localInput; - input.readBytes(localInput); - localInput.position = 0; - var headerStr:String = localInput.readUTF(); - if (headerStr != HEADER_STR) + import com.ankamagames.jerakine.interfaces.IModuleUtil; + import flash.utils.IDataInput; + import flash.utils.ByteArray; + import flash.utils.Dictionary; + import com.ankamagames.berilia.types.uiDefinition.UiDefinition; + import flash.utils.IDataOutput; + import flash.net.ObjectEncoding; + + public class PreCompiledUiModule extends UiModule implements IModuleUtil + { + + public function PreCompiledUiModule() + { + super(); + } + + private static const HEADER_STR:String = "D2UI"; + + public static function fromRaw(param1:IDataInput, param2:String, param3:String) : PreCompiledUiModule + { + var _loc4_:PreCompiledUiModule = new PreCompiledUiModule(); + var _loc5_:ByteArray = new ByteArray(); + _loc4_._input = _loc5_; + param1.readBytes(_loc5_); + _loc5_.position = 0; + var _loc6_:String = _loc5_.readUTF(); + if(_loc6_ != HEADER_STR) + { + throw new Error("Malformated ui data file."); + } + else + { + _loc4_.fillFromXml(new XML(_loc5_.readUTF()),param2,param3); + _loc4_._definitionCount = _loc5_.readShort(); + _loc4_._uiListPosition = new Dictionary(); + _loc4_._cacheDefinition = new Dictionary(); + var _loc7_:uint = 0; + while(_loc7_ < _loc4_._definitionCount) { - throw (new Error("Malformated ui data file.")); - }; - instance.fillFromXml(new XML(localInput.readUTF()), nativePath, id); - instance._definitionCount = localInput.readShort(); - instance._uiListPosition = new Dictionary(); - instance._cacheDefinition = new Dictionary(); - var i:uint; - while (i < instance._definitionCount) + _loc4_._uiListPosition[_loc5_.readUTF()] = _loc5_.readInt(); + _loc7_++; + } + return _loc4_; + } + } + + public static function create(param1:UiModule) : PreCompiledUiModule + { + var _loc2_:PreCompiledUiModule = new PreCompiledUiModule(); + _loc2_.initWriteMode(); + _loc2_.makeHeader(param1); + return _loc2_; + } + + private var _uiListPosition:Dictionary; + + private var _definitionCount:uint; + + private var _uiListStartPosition:uint; + + private var _output:ByteArray; + + private var _uiBuffer:ByteArray; + + private var _input:ByteArray; + + private var _cacheDefinition:Dictionary; + + public function hasDefinition(param1:UiData) : Boolean + { + return !(this._uiListPosition[param1.name] == null); + } + + public function getDefinition(param1:UiData) : UiDefinition + { + if(this.hasDefinition(param1)) + { + if(this._cacheDefinition[param1.name]) { - instance._uiListPosition[localInput.readUTF()] = localInput.readInt(); - i++; - }; - return (instance); - } - - public static function create(uiModule:UiModule):PreCompiledUiModule - { - var newInstance:PreCompiledUiModule = new (PreCompiledUiModule)(); - newInstance.initWriteMode(); - newInstance.makeHeader(uiModule); - return (newInstance); - } - - - public function hasDefinition(ui:UiData):Boolean - { - return (!((this._uiListPosition[ui.name] == null))); - } - - public function getDefinition(ui:UiData):UiDefinition - { - if (this.hasDefinition(ui)) - { - if (this._cacheDefinition[ui.name]) - { - return (this._cacheDefinition[ui.name]); - }; - return (this.readUidefinition(ui.name)); - }; - return (null); - } - - public function addUiDefinition(definition:UiDefinition, ui:UiData):void - { - if (!(this._output)) - { - throw (new Error("Call method 'create' before using this method")); - }; - this.writeUiDefinition(definition, ui); - } - - public function flush(output:IDataOutput):void - { - var uiId:String; - if (!(this._output)) - { - throw (new Error("Call method 'create' before using this method")); - }; + return this._cacheDefinition[param1.name]; + } + return this.readUidefinition(param1.name); + } + return null; + } + + public function addUiDefinition(param1:UiDefinition, param2:UiData) : void + { + if(!this._output) + { + throw new Error("Call method \'create\' before using this method"); + } + else + { + this.writeUiDefinition(param1,param2); + return; + } + } + + public function flush(param1:IDataOutput) : void + { + var _loc2_:String = null; + if(!this._output) + { + throw new Error("Call method \'create\' before using this method"); + } + else + { this._output.position = this._uiListStartPosition; this._output.writeShort(this._definitionCount); - output.writeBytes(this._output); + param1.writeBytes(this._output); this._output.position = this._output.length; - var listBuffer:ByteArray = new ByteArray(); - for (uiId in this._uiListPosition) + var _loc3_:ByteArray = new ByteArray(); + for(_loc2_ in this._uiListPosition) { - listBuffer.writeUTF(uiId); - listBuffer.writeInt(0); - }; - listBuffer.position = 0; - for (uiId in this._uiListPosition) + _loc3_.writeUTF(_loc2_); + _loc3_.writeInt(0); + } + _loc3_.position = 0; + for(_loc2_ in this._uiListPosition) { - listBuffer.readUTF(); - listBuffer.writeInt(((this._uiListPosition[uiId] + this._output.length) + listBuffer.length)); - }; - output.writeBytes(listBuffer); - output.writeBytes(this._uiBuffer); - } - - private function initWriteMode():void - { - this._output = new ByteArray(); - this._uiBuffer = new ByteArray(); - this._uiListPosition = new Dictionary(); - this._uiBuffer.objectEncoding = ObjectEncoding.AMF3; - } - - private function makeHeader(uiModule:UiModule):void - { - this._output.writeUTF("D2UI"); - this._output.writeUTF(uiModule.rawXml.toXMLString()); - this._uiListStartPosition = this._output.position; - this._output.writeShort(0); - } - - private function readUidefinition(id:String):UiDefinition - { - this._input.objectEncoding = ObjectEncoding.AMF3; - this._input.position = this._uiListPosition[id]; - return (this._input.readObject()); - } - - private function writeUiDefinition(definition:UiDefinition, ui:UiData):void - { - this._definitionCount++; - this._uiListPosition[ui.name] = this._uiBuffer.position; - this._uiBuffer.objectEncoding = ObjectEncoding.AMF3; - this._uiBuffer.writeObject(definition); - } - - - } -}//package com.ankamagames.berilia.types.data - + _loc3_.readUTF(); + _loc3_.writeInt(this._uiListPosition[_loc2_] + this._output.length + _loc3_.length); + } + param1.writeBytes(_loc3_); + param1.writeBytes(this._uiBuffer); + return; + } + } + + private function initWriteMode() : void + { + this._output = new ByteArray(); + this._uiBuffer = new ByteArray(); + this._uiListPosition = new Dictionary(); + this._uiBuffer.objectEncoding = ObjectEncoding.AMF3; + } + + private function makeHeader(param1:UiModule) : void + { + this._output.writeUTF("D2UI"); + this._output.writeUTF(param1.rawXml.toXMLString()); + this._uiListStartPosition = this._output.position; + this._output.writeShort(0); + } + + private function readUidefinition(param1:String) : UiDefinition + { + this._input.objectEncoding = ObjectEncoding.AMF3; + this._input.position = this._uiListPosition[param1]; + return this._input.readObject(); + } + + private function writeUiDefinition(param1:UiDefinition, param2:UiData) : void + { + this._definitionCount++; + this._uiListPosition[param2.name] = this._uiBuffer.position; + this._uiBuffer.objectEncoding = ObjectEncoding.AMF3; + this._uiBuffer.writeObject(param1); + } + } +} diff --git a/com/ankamagames/berilia/types/data/RadioGroup.as b/com/ankamagames/berilia/types/data/RadioGroup.as index 54dd6001d..b546f8363 100644 --- a/com/ankamagames/berilia/types/data/RadioGroup.as +++ b/com/ankamagames/berilia/types/data/RadioGroup.as @@ -1,89 +1,90 @@ -package com.ankamagames.berilia.types.data +package com.ankamagames.berilia.types.data { - import com.ankamagames.jerakine.logger.Logger; - import com.ankamagames.jerakine.logger.Log; - import flash.utils.getQualifiedClassName; - import com.ankamagames.berilia.interfaces.IRadioItem; - - public class RadioGroup - { - - protected static const _log:Logger = Log.getLogger(getQualifiedClassName(RadioGroup)); - - private var _items:Array; - private var _selected:IRadioItem; - public var name:String; - - public function RadioGroup(name:String) - { - this.name = name; - this._items = new Array(); - } - - public function addItem(item:IRadioItem):void - { - this._items[item.id] = item; - if (item.selected) + import com.ankamagames.jerakine.logger.Logger; + import com.ankamagames.jerakine.logger.Log; + import flash.utils.getQualifiedClassName; + import com.ankamagames.berilia.interfaces.IRadioItem; + + public class RadioGroup extends Object + { + + public function RadioGroup(param1:String) + { + super(); + this.name = param1; + this._items = new Array(); + } + + protected static const _log:Logger = Log.getLogger(getQualifiedClassName(RadioGroup)); + + private var _items:Array; + + private var _selected:IRadioItem; + + public var name:String; + + public function addItem(param1:IRadioItem) : void + { + this._items[param1.id] = param1; + if(param1.selected) + { + this._selected = param1; + } + } + + public function removeItem(param1:IRadioItem) : void + { + delete this._items[param1.id]; + true; + } + + public function destroy() : void + { + this._items = null; + this._selected = null; + } + + public function get value() : * + { + if(this._selected) + { + return this._selected.value; + } + return null; + } + + public function set value(param1:*) : void + { + var _loc2_:IRadioItem = null; + for each(_loc2_ in this._items) + { + if(_loc2_.value == param1) { - this._selected = item; - }; - } - - public function removeItem(item:IRadioItem):void - { - delete this._items[item.id]; - } - - public function destroy():void - { - this._items = null; - this._selected = null; - } - - public function get value() - { - if (this._selected) + this.selectedItem = _loc2_; + } + } + } + + public function set selectedItem(param1:IRadioItem) : void + { + var _loc2_:IRadioItem = null; + if(this._selected == param1) + { + return; + } + for each(_loc2_ in this._items) + { + if(_loc2_.selected != param1 == _loc2_) { - return (this._selected.value); - }; - return (null); - } - - public function set value(v:*):void - { - var item:IRadioItem; - for each (item in this._items) - { - if (item.value == v) - { - this.selectedItem = item; - }; - }; - } - - public function set selectedItem(item:IRadioItem):void - { - var currentItem:IRadioItem; - if (this._selected == item) - { - return; - }; - for each (currentItem in this._items) - { - if (currentItem.selected != (item == currentItem)) - { - currentItem.selected = (item == currentItem); - }; - }; - this._selected = item; - } - - public function get selectedItem():IRadioItem - { - return (this._selected); - } - - - } -}//package com.ankamagames.berilia.types.data - + _loc2_.selected = param1 == _loc2_; + } + } + this._selected = param1; + } + + public function get selectedItem() : IRadioItem + { + return this._selected; + } + } +} diff --git a/com/ankamagames/berilia/types/data/SlotDragAndDropData.as b/com/ankamagames/berilia/types/data/SlotDragAndDropData.as index 86ce5ec86..9a6e1edc0 100644 --- a/com/ankamagames/berilia/types/data/SlotDragAndDropData.as +++ b/com/ankamagames/berilia/types/data/SlotDragAndDropData.as @@ -1,20 +1,20 @@ -package com.ankamagames.berilia.types.data +package com.ankamagames.berilia.types.data { - import com.ankamagames.jerakine.interfaces.ISlotDataHolder; - import com.ankamagames.jerakine.interfaces.ISlotData; - - public class SlotDragAndDropData - { - - public var currentHolder:ISlotDataHolder; - public var slotData:ISlotData; - - public function SlotDragAndDropData(currentHolder:ISlotDataHolder, slotData:ISlotData) - { - this.currentHolder = currentHolder; - this.slotData = slotData; - } - - } -}//package com.ankamagames.berilia.types.data - + import com.ankamagames.jerakine.interfaces.ISlotDataHolder; + import com.ankamagames.jerakine.interfaces.ISlotData; + + public class SlotDragAndDropData extends Object + { + + public function SlotDragAndDropData(param1:ISlotDataHolder, param2:ISlotData) + { + super(); + this.currentHolder = param1; + this.slotData = param2; + } + + public var currentHolder:ISlotDataHolder; + + public var slotData:ISlotData; + } +} diff --git a/com/ankamagames/berilia/types/data/TextTooltipInfo.as b/com/ankamagames/berilia/types/data/TextTooltipInfo.as index c969a4177..2ca62cad5 100644 --- a/com/ankamagames/berilia/types/data/TextTooltipInfo.as +++ b/com/ankamagames/berilia/types/data/TextTooltipInfo.as @@ -1,29 +1,32 @@ -package com.ankamagames.berilia.types.data +package com.ankamagames.berilia.types.data { - public class TextTooltipInfo - { - - public var content:String; - public var css:String; - public var cssClass:String; - public var maxWidth:int; - public var bgCornerRadius:int = 0; - - public function TextTooltipInfo(content:String, css:String=null, cssClass:String=null, maxWidth:int=400) - { - this.content = content; - this.css = css; - if (cssClass) - { - this.cssClass = cssClass; - } - else - { - this.cssClass = "text"; - }; - this.maxWidth = maxWidth; - } - - } -}//package com.ankamagames.berilia.types.data - + public class TextTooltipInfo extends Object + { + + public function TextTooltipInfo(param1:String, param2:String = null, param3:String = null, param4:int = 400) + { + super(); + this.content = param1; + this.css = param2; + if(param3) + { + this.cssClass = param3; + } + else + { + this.cssClass = "text"; + } + this.maxWidth = param4; + } + + public var content:String; + + public var css:String; + + public var cssClass:String; + + public var maxWidth:int; + + public var bgCornerRadius:int = 0; + } +} diff --git a/com/ankamagames/berilia/types/data/Theme.as b/com/ankamagames/berilia/types/data/Theme.as index 5a27a466c..de83da457 100644 --- a/com/ankamagames/berilia/types/data/Theme.as +++ b/com/ankamagames/berilia/types/data/Theme.as @@ -1,21 +1,23 @@ -package com.ankamagames.berilia.types.data +package com.ankamagames.berilia.types.data { - public class Theme - { - - public var name:String; - public var description:String; - public var previewUri:String; - public var fileName:String; - - public function Theme(fileName:String, name:String, description:String="", previewUri:String="") - { - this.name = name; - this.description = description; - this.previewUri = previewUri; - this.fileName = fileName; - } - - } -}//package com.ankamagames.berilia.types.data - + public class Theme extends Object + { + + public function Theme(param1:String, param2:String, param3:String = "", param4:String = "") + { + super(); + this.name = param2; + this.description = param3; + this.previewUri = param4; + this.fileName = param1; + } + + public var name:String; + + public var description:String; + + public var previewUri:String; + + public var fileName:String; + } +} diff --git a/com/ankamagames/berilia/types/data/TreeData.as b/com/ankamagames/berilia/types/data/TreeData.as index 92448d465..2ad4f48f4 100644 --- a/com/ankamagames/berilia/types/data/TreeData.as +++ b/com/ankamagames/berilia/types/data/TreeData.as @@ -1,68 +1,66 @@ -package com.ankamagames.berilia.types.data +package com.ankamagames.berilia.types.data { - import __AS3__.vec.Vector; - import __AS3__.vec.*; - - public class TreeData - { - - public var value; - public var label:String; - public var expend:Boolean; - public var children:Vector.; - public var parent:TreeData; - - public function TreeData(value:*, label:String, expend:Boolean=false, childs:Vector.=null, parent:TreeData=null) - { - this.value = value; - this.label = label; - this.expend = expend; - this.children = childs; - this.parent = parent; - } - - public static function fromArray(a:Object):Vector. - { - var root:TreeData = new (TreeData)(null, null, true); - root.children = _fromArray(a, root); - return (root.children); - } - - private static function _fromArray(a:Object, parent:TreeData):Vector. - { - var td:TreeData; - var children:*; - var data:*; - var res:Vector. = new Vector.(); - for each (data in a) + public class TreeData extends Object + { + + public function TreeData(param1:*, param2:String, param3:Boolean = false, param4:Vector. = null, param5:TreeData = null) + { + super(); + this.value = param1; + this.label = param2; + this.expend = param3; + this.children = param4; + this.parent = param5; + } + + public static function fromArray(param1:Object) : Vector. + { + var _loc2_:TreeData = new TreeData(null,null,true); + _loc2_.children = _fromArray(param1,_loc2_); + return _loc2_.children; + } + + private static function _fromArray(param1:Object, param2:TreeData) : Vector. + { + var _loc4_:TreeData = null; + var _loc5_:* = undefined; + var _loc6_:* = undefined; + var _loc3_:Vector. = new Vector.(); + for each(_loc6_ in param1) + { + if(Object(_loc6_).hasOwnProperty("children")) { - if (Object(data).hasOwnProperty("children")) - { - children = data.children; - } - else - { - children = null; - }; - td = new (TreeData)(data, data.label, ((Object(data).hasOwnProperty("expend")) ? Object(data).expend : false)); - td.parent = parent; - td.children = _fromArray(children, td); - res.push(td); - }; - return (res); - } - - - public function get depth():uint - { - if (this.parent) + _loc5_ = _loc6_.children; + } + else { - return ((this.parent.depth + 1)); - }; - return (0); - } - - - } -}//package com.ankamagames.berilia.types.data - + _loc5_ = null; + } + _loc4_ = new TreeData(_loc6_,_loc6_.label,Object(_loc6_).hasOwnProperty("expend")?Object(_loc6_).expend:false); + _loc4_.parent = param2; + _loc4_.children = _fromArray(_loc5_,_loc4_); + _loc3_.push(_loc4_); + } + return _loc3_; + } + + public var value; + + public var label:String; + + public var expend:Boolean; + + public var children:Vector.; + + public var parent:TreeData; + + public function get depth() : uint + { + if(this.parent) + { + return this.parent.depth + 1; + } + return 0; + } + } +} diff --git a/com/ankamagames/berilia/types/data/UiData.as b/com/ankamagames/berilia/types/data/UiData.as index 2e78dab95..15e81c0cd 100644 --- a/com/ankamagames/berilia/types/data/UiData.as +++ b/com/ankamagames/berilia/types/data/UiData.as @@ -1,97 +1,109 @@ -package com.ankamagames.berilia.types.data +package com.ankamagames.berilia.types.data { - import com.ankamagames.jerakine.interfaces.IModuleUtil; - import com.ankamagames.berilia.utils.errors.BeriliaError; - import com.ankamagames.berilia.managers.SecureCenter; - import flash.errors.IllegalOperationError; - - public class UiData implements IModuleUtil - { - - private var _name:String; - private var _file:String; - private var _uiClassName:String; - private var _uiClass:Class; - private var _xml:String; - private var _uiGroupName:String; - private var _module:UiModule; - - public function UiData(module:UiModule, name:String, file:String, uiClassName:String, uiGroupName:String=null) - { - this._module = module; - this._name = name; - this._file = file; - this._uiClassName = uiClassName; - this._uiGroupName = uiGroupName; - } - - public function get module():UiModule - { - return (this._module); - } - - public function get name():String - { - return (this._name); - } - - public function get file():String - { - return (this._file); - } - - public function get uiClassName():String - { - return (this._uiClassName); - } - - public function get xml():String - { - return (this._xml); - } - - public function get uiGroupName():String - { - return (this._uiGroupName); - } - - [HideInFakeClass] - public function set xml(v:String):void - { - if (this._xml) - { - throw (new BeriliaError("xml cannot be set twice")); - }; - this._xml = v; - } - - [HideInFakeClass] - public function get uiClass():Class - { - return (this._uiClass); - } - - [HideInFakeClass] - public function set uiClass(c:Class):void - { - if (this._uiClass) - { - throw (new BeriliaError("uiClass cannot be set twice")); - }; - this._uiClass = c; - } - - [HideInFakeClass] - public function updateXml(xml:XML, accessKey:Object):void - { - if (accessKey != SecureCenter.ACCESS_KEY) - { - throw (new IllegalOperationError("Wrong access key")); - }; - this._xml = xml; - } - - - } -}//package com.ankamagames.berilia.types.data - + import com.ankamagames.jerakine.interfaces.IModuleUtil; + import com.ankamagames.berilia.utils.errors.BeriliaError; + import com.ankamagames.berilia.managers.SecureCenter; + import flash.errors.IllegalOperationError; + + public class UiData extends Object implements IModuleUtil + { + + public function UiData(param1:UiModule, param2:String, param3:String, param4:String, param5:String = null) + { + super(); + this._module = param1; + this._name = param2; + this._file = param3; + this._uiClassName = param4; + this._uiGroupName = param5; + } + + private var _name:String; + + private var _file:String; + + private var _uiClassName:String; + + private var _uiClass:Class; + + private var _xml:String; + + private var _uiGroupName:String; + + private var _module:UiModule; + + public function get module() : UiModule + { + return this._module; + } + + public function get name() : String + { + return this._name; + } + + public function get file() : String + { + return this._file; + } + + public function get uiClassName() : String + { + return this._uiClassName; + } + + public function get xml() : String + { + return this._xml; + } + + public function get uiGroupName() : String + { + return this._uiGroupName; + } + + public function set xml(param1:String) : void + { + if(this._xml) + { + throw new BeriliaError("xml cannot be set twice"); + } + else + { + this._xml = param1; + return; + } + } + + public function get uiClass() : Class + { + return this._uiClass; + } + + public function set uiClass(param1:Class) : void + { + if(this._uiClass) + { + throw new BeriliaError("uiClass cannot be set twice"); + } + else + { + this._uiClass = param1; + return; + } + } + + public function updateXml(param1:XML, param2:Object) : void + { + if(param2 != SecureCenter.ACCESS_KEY) + { + throw new IllegalOperationError("Wrong access key"); + } + else + { + this._xml = param1; + return; + } + } + } +} diff --git a/com/ankamagames/berilia/types/data/UiGroup.as b/com/ankamagames/berilia/types/data/UiGroup.as index fcf0c53b3..6eadc7ece 100644 --- a/com/ankamagames/berilia/types/data/UiGroup.as +++ b/com/ankamagames/berilia/types/data/UiGroup.as @@ -1,51 +1,52 @@ -package com.ankamagames.berilia.types.data +package com.ankamagames.berilia.types.data { - import com.ankamagames.jerakine.interfaces.IModuleUtil; - - public class UiGroup implements IModuleUtil - { - - private var _name:String; - private var _exclusive:Boolean; - private var _permanent:Boolean; - private var _uisName:Array; - - public function UiGroup(name:String, exclusive:Boolean, permanent:Boolean, uisName:Array=null) - { - this._name = name; - this._permanent = permanent; - this._exclusive = exclusive; - if (uisName != null) - { - this._uisName = uisName; - } - else - { - this._uisName = new Array(); - }; - } - - public function get name():String - { - return (this._name); - } - - public function get exclusive():Boolean - { - return (this._exclusive); - } - - public function get permanent():Boolean - { - return (this._permanent); - } - - public function get uis():Array - { - return (this._uisName); - } - - - } -}//package com.ankamagames.berilia.types.data - + import com.ankamagames.jerakine.interfaces.IModuleUtil; + + public class UiGroup extends Object implements IModuleUtil + { + + public function UiGroup(param1:String, param2:Boolean, param3:Boolean, param4:Array = null) + { + super(); + this._name = param1; + this._permanent = param3; + this._exclusive = param2; + if(param4 != null) + { + this._uisName = param4; + } + else + { + this._uisName = new Array(); + } + } + + private var _name:String; + + private var _exclusive:Boolean; + + private var _permanent:Boolean; + + private var _uisName:Array; + + public function get name() : String + { + return this._name; + } + + public function get exclusive() : Boolean + { + return this._exclusive; + } + + public function get permanent() : Boolean + { + return this._permanent; + } + + public function get uis() : Array + { + return this._uisName; + } + } +} diff --git a/com/ankamagames/berilia/types/data/UiModule.as b/com/ankamagames/berilia/types/data/UiModule.as index 1893fcc21..91e662bdf 100644 --- a/com/ankamagames/berilia/types/data/UiModule.as +++ b/com/ankamagames/berilia/types/data/UiModule.as @@ -1,519 +1,552 @@ -package com.ankamagames.berilia.types.data +package com.ankamagames.berilia.types.data { - import com.ankamagames.jerakine.interfaces.IModuleUtil; - import flash.utils.Dictionary; - import com.ankamagames.jerakine.logger.Logger; - import com.ankamagames.jerakine.logger.Log; - import flash.utils.getQualifiedClassName; - import com.ankamagames.jerakine.types.Uri; - import __AS3__.vec.Vector; - import flash.display.Loader; - import flash.system.ApplicationDomain; - import com.ankamagames.berilia.utils.ModuleScriptAnalyzer; - import com.ankamagames.jerakine.managers.StoreDataManager; - import com.ankamagames.berilia.BeriliaConstants; - import com.ankamagames.berilia.managers.UiModuleManager; - import com.ankamagames.berilia.managers.UiGroupManager; - import com.ankamagames.berilia.utils.errors.BeriliaError; - import __AS3__.vec.*; - - public class UiModule implements IModuleUtil - { - - private static var ID_COUNT:uint = 0; - public static var MEMORY_LOG:Dictionary = new Dictionary(true); - protected static const _log:Logger = Log.getLogger(getQualifiedClassName(UiModule)); - - private var _instanceId:uint; - private var _id:String; - private var _name:String; - private var _version:String; - private var _gameVersion:String; - private var _author:String; - private var _shortDescription:String; - private var _description:String; - private var _iconUri:Uri; - private var _script:String; - private var _shortcuts:String; - private var _uis:Array; - private var _trusted:Boolean = false; - private var _trustedInit:Boolean = false; - private var _activated:Boolean = false; - private var _rootPath:String; - private var _storagePath:String; - private var _mainClass:Object; - private var _cachedFiles:Array; - private var _apiList:Vector.; - private var _groups:Vector.; - var _loader:Loader; - private var _moduleAppDomain:ApplicationDomain; - private var _enable:Boolean = true; - private var _rawXml:XML; - private var _scriptAnalyser:ModuleScriptAnalyzer; - private var _apiScriptAnalyserCallback:Dictionary; - private var _hookScriptAnalyserCallback:Dictionary; - private var _actionScriptAnalyserCallback:Dictionary; - - public function UiModule(id:String=null, name:String=null, version:String=null, gameVersion:String=null, author:String=null, shortDescription:String=null, description:String=null, iconUri:String=null, script:String=null, shortcuts:String=null, uis:Array=null, cachedFiles:Array=null, activated:Boolean=false) - { - var ui:UiData; - this._instanceId = ++ID_COUNT; - this._apiScriptAnalyserCallback = new Dictionary(); - this._hookScriptAnalyserCallback = new Dictionary(); - this._actionScriptAnalyserCallback = new Dictionary(); - super(); - MEMORY_LOG[this] = 1; - this._name = name; - this._version = version; - this._gameVersion = gameVersion; - this._author = author; - this._shortDescription = shortDescription; - this._description = description; - this._iconUri = new Uri(iconUri); - this._script = script; - this._shortcuts = shortcuts; - this._id = id; - this._uis = new Array(); - this._cachedFiles = ((cachedFiles) ? cachedFiles : new Array()); - for each (ui in uis) - { - this._uis[ui.name] = ui; - }; - this._apiList = new Vector.(); - } - - public static function createFromXml(xml:XML, nativePath:String, id:String):UiModule - { - var um:UiModule = new (UiModule)(); - um.fillFromXml(xml, nativePath, id); - return (um); - } - - - public function set loader(l:Loader):void - { - if (!(this._loader)) - { - this._loader = l; - }; - } - - public function get instanceId():uint - { - return (this._instanceId); - } - - public function get id():String - { - return (this._id); - } - - public function get name():String - { - return (this._name); - } - - public function get version():String - { - return (this._version); - } - - public function get gameVersion():String - { - return (this._gameVersion); - } - - public function get author():String - { - return (this._author); - } - - public function get shortDescription():String - { - return (this._shortDescription); - } - - public function get description():String - { - return (this._description); - } - - public function get iconUri():Uri - { - return (this._iconUri); - } - - public function get script():String - { - return (this._script); - } - - public function get shortcuts():String - { - return (this._shortcuts); - } - - public function get uis():Array - { - return (this._uis); - } - - public function get trusted():Boolean - { - return (this._trusted); - } - - public function set trusted(v:Boolean):void - { - var state:*; - if (!(this._trustedInit)) - { - this._trusted = v; - this._trustedInit = true; - state = StoreDataManager.getInstance().getData(BeriliaConstants.DATASTORE_MOD, this.id); - if (state == null) - { - this._enable = this._trusted; - } - else - { - this._enable = ((state) || (this._trusted)); - }; - if (!(this._enable)) - { - this.enable = false; - }; - }; - } - - public function get enable():Boolean - { - return (this._enable); - } - - public function set enable(v:Boolean):void - { - var _local_2:UiGroup; - StoreDataManager.getInstance().setData(BeriliaConstants.DATASTORE_MOD, this.id, v); - if (((!(this._enable)) && (v))) - { - this._enable = true; - UiModuleManager.getInstance().loadModule(this.id); + import com.ankamagames.jerakine.interfaces.IModuleUtil; + import flash.utils.Dictionary; + import com.ankamagames.jerakine.logger.Logger; + import com.ankamagames.jerakine.logger.Log; + import flash.utils.getQualifiedClassName; + import com.ankamagames.jerakine.types.Uri; + import flash.display.Loader; + import flash.system.ApplicationDomain; + import com.ankamagames.berilia.utils.ModuleScriptAnalyzer; + import com.ankamagames.jerakine.managers.StoreDataManager; + import com.ankamagames.berilia.BeriliaConstants; + import com.ankamagames.berilia.managers.UiModuleManager; + import com.ankamagames.berilia.managers.UiGroupManager; + import com.ankamagames.berilia.utils.errors.BeriliaError; + + public class UiModule extends Object implements IModuleUtil + { + + public function UiModule(param1:String = null, param2:String = null, param3:String = null, param4:String = null, param5:String = null, param6:String = null, param7:String = null, param8:String = null, param9:String = null, param10:String = null, param11:Array = null, param12:Array = null, param13:Boolean = false) + { + var _loc14_:UiData = null; + this._instanceId = ++ID_COUNT; + this._apiScriptAnalyserCallback = new Dictionary(); + this._hookScriptAnalyserCallback = new Dictionary(); + this._actionScriptAnalyserCallback = new Dictionary(); + super(); + MEMORY_LOG[this] = 1; + this._name = param2; + this._version = param3; + this._gameVersion = param4; + this._author = param5; + this._shortDescription = param6; + this._description = param7; + this._iconUri = new Uri(param8); + this._script = param9; + this._shortcuts = param10; + this._id = param1; + this._uis = new Array(); + this._cachedFiles = param12?param12:new Array(); + for each(this._uis[_loc14_.name] in param11) + { + } + this._apiList = new Vector.(); + } + + private static var ID_COUNT:uint = 0; + + public static var MEMORY_LOG:Dictionary = new Dictionary(true); + + protected static const _log:Logger = Log.getLogger(getQualifiedClassName(UiModule)); + + public static function createFromXml(param1:XML, param2:String, param3:String) : UiModule + { + var _loc4_:UiModule = new UiModule(); + _loc4_.fillFromXml(param1,param2,param3); + return _loc4_; + } + + private var _instanceId:uint; + + private var _id:String; + + private var _name:String; + + private var _version:String; + + private var _gameVersion:String; + + private var _author:String; + + private var _shortDescription:String; + + private var _description:String; + + private var _iconUri:Uri; + + private var _script:String; + + private var _shortcuts:String; + + private var _uis:Array; + + private var _trusted:Boolean = false; + + private var _trustedInit:Boolean = false; + + private var _activated:Boolean = false; + + private var _rootPath:String; + + private var _storagePath:String; + + private var _mainClass:Object; + + private var _cachedFiles:Array; + + private var _apiList:Vector.; + + private var _groups:Vector.; + + var _loader:Loader; + + private var _moduleAppDomain:ApplicationDomain; + + private var _enable:Boolean = true; + + private var _rawXml:XML; + + private var _scriptAnalyser:ModuleScriptAnalyzer; + + private var _apiScriptAnalyserCallback:Dictionary; + + private var _hookScriptAnalyserCallback:Dictionary; + + private var _actionScriptAnalyserCallback:Dictionary; + + public function set loader(param1:Loader) : void + { + if(!this._loader) + { + this._loader = param1; + } + } + + public function get instanceId() : uint + { + return this._instanceId; + } + + public function get id() : String + { + return this._id; + } + + public function get name() : String + { + return this._name; + } + + public function get version() : String + { + return this._version; + } + + public function get gameVersion() : String + { + return this._gameVersion; + } + + public function get author() : String + { + return this._author; + } + + public function get shortDescription() : String + { + return this._shortDescription; + } + + public function get description() : String + { + return this._description; + } + + public function get iconUri() : Uri + { + return this._iconUri; + } + + public function get script() : String + { + return this._script; + } + + public function get shortcuts() : String + { + return this._shortcuts; + } + + public function get uis() : Array + { + return this._uis; + } + + public function get trusted() : Boolean + { + return this._trusted; + } + + public function set trusted(param1:Boolean) : void + { + var _loc2_:* = undefined; + if(!this._trustedInit) + { + this._trusted = param1; + this._trustedInit = true; + _loc2_ = StoreDataManager.getInstance().getData(BeriliaConstants.DATASTORE_MOD,this.id); + if(_loc2_ == null) + { + this._enable = this._trusted; } else { - this._enable = false; - for each (_local_2 in this._groups) - { - UiGroupManager.getInstance().removeGroup(_local_2.name); - }; - UiModuleManager.getInstance().unloadModule(this.id); - }; - } - - public function get rootPath():String - { - return (this._rootPath); - } - - public function get storagePath():String - { - return (this._storagePath); - } - - public function get cachedFiles():Array - { - return (this._cachedFiles); - } - - public function get apiList():Vector. - { - return (this._apiList); - } - - public function set applicationDomain(appDomain:ApplicationDomain):void - { - var ui:UiData; - if (this._moduleAppDomain) - { - throw (new BeriliaError("ApplicationDomain cannot be set twice.")); - }; - for each (ui in this.uis) - { - if (((appDomain) && (appDomain.hasDefinition(ui.uiClassName)))) - { - ui.uiClass = (appDomain.getDefinition(ui.uiClassName) as Class); - } - else - { - _log.error((ui.uiClassName + " cannot be found")); - }; - }; - this._moduleAppDomain = appDomain; - } - - public function get applicationDomain():ApplicationDomain - { - return (this._moduleAppDomain); - } - - public function get mainClass():Object - { - return (this._mainClass); - } - - public function set mainClass(instance:Object):void - { - if (this._mainClass) - { - throw (new BeriliaError("mainClass cannot be set twice.")); - }; - this._mainClass = instance; - } - - public function get groups():Vector. - { - return (this._groups); - } - - public function get rawXml():XML - { - return (this._rawXml); - } - - public function addUiGroup(groupName:String, exclusive:Boolean, permanent:Boolean):void - { - if (!(this._groups)) - { - this._groups = new Vector.(); - }; - this._groups.push(new UiGroup(groupName, exclusive, permanent)); - } - - public function getUi(name:String):UiData - { - return (this._uis[name]); - } - - public function toString():String - { - var result:String = ("ID:" + this._id); - if (this._name) - { - result = (result + ("\nName:" + this._name)); - }; - if (this._trusted) - { - result = (result + ("\nTrusted:" + this._trusted)); - }; - if (this._author) - { - result = (result + ("\nAuthor:" + this._author)); - }; - if (this._description) - { - result = (result + ("\nDescription:" + this._description)); - }; - return (result); - } - - public function destroy():void - { - if (this._loader) - { - this._loader.unloadAndStop(true); - }; - } - - public function usedApiList(callBack:Function):void - { - if (this._apiScriptAnalyserCallback) - { - if (!(this._scriptAnalyser)) - { - this._scriptAnalyser = new ModuleScriptAnalyzer(this, this.onScriptAnalyserReady, null); - }; - this._apiScriptAnalyserCallback[callBack] = callBack; + this._enable = (_loc2_) || (this._trusted); } - else + if(!this._enable) { - (callBack(this._scriptAnalyser.apis)); - }; - } - - public function usedHookList(callBack:Function):void - { - if (this._hookScriptAnalyserCallback) - { - if (!(this._scriptAnalyser)) - { - this._scriptAnalyser = new ModuleScriptAnalyzer(this, this.onScriptAnalyserReady, null); - }; - this._hookScriptAnalyserCallback[callBack] = callBack; + this.enable = false; } - else - { - (callBack(this._scriptAnalyser.hooks)); - }; - } - - public function usedActionList(callBack:Function):void - { - if (this._actionScriptAnalyserCallback) - { - if (!(this._scriptAnalyser)) - { - this._scriptAnalyser = new ModuleScriptAnalyzer(this, this.onScriptAnalyserReady, null); - }; - this._actionScriptAnalyserCallback[callBack] = callBack; + } + } + + public function get enable() : Boolean + { + return this._enable; + } + + public function set enable(param1:Boolean) : void + { + var _loc2_:UiGroup = null; + StoreDataManager.getInstance().setData(BeriliaConstants.DATASTORE_MOD,this.id,param1); + if(!this._enable && (param1)) + { + this._enable = true; + UiModuleManager.getInstance().loadModule(this.id); + } + else + { + this._enable = false; + for each(_loc2_ in this._groups) + { + UiGroupManager.getInstance().removeGroup(_loc2_.name); } - else - { - (callBack(this._scriptAnalyser.actions)); - }; - } - - private function initScriptAnalyser():void - { - if (!(this._scriptAnalyser)) - { - this._scriptAnalyser = new ModuleScriptAnalyzer(this, this.onScriptAnalyserReady, this._moduleAppDomain); - }; - } - - private function onScriptAnalyserReady():void - { - var f:Function; - for each (f in this._actionScriptAnalyserCallback) - { - (f(this._scriptAnalyser.actions)); - }; - for each (f in this._hookScriptAnalyserCallback) - { - (f(this._scriptAnalyser.hooks)); - }; - for each (f in this._apiScriptAnalyserCallback) - { - (f(this._scriptAnalyser.apis)); - }; - this._actionScriptAnalyserCallback = null; - this._hookScriptAnalyserCallback = null; - this._apiScriptAnalyserCallback = null; - } - - protected function fillFromXml(xml:XML, nativePath:String, id:String):void - { - var uiGroup:UiGroup; - var group:XML; - var uiData:UiData; - var uis:XML; - var path:XML; - var uiNames:Array; - var groupName:String; - var uisXML:XMLList; - var uiName:XML; - var uisGroup:String; - var ui:XML; - var file:String; - var mod:String; - var fileuri:String; - this.setProperty("name", xml..header..name); - this.setProperty("version", xml..header..version); - this.setProperty("gameVersion", xml..header..gameVersion); - this.setProperty("author", xml..header..author); - this.setProperty("description", xml..header..description); - this.setProperty("shortDescription", xml..header..shortDescription); - this.setProperty("script", xml..script); - this.setProperty("shortcuts", xml..shortcuts); - this._rawXml = xml; - nativePath = nativePath.split("app:/").join(""); - if ((((nativePath.indexOf("file://") == -1)) && (!((nativePath.substr(0, 2) == "\\\\"))))) - { - nativePath = ("file://" + nativePath); - }; - this._id = id; - if (this.script) - { - this._script = ((nativePath + "/") + this.script); - }; - if (this.shortcuts) - { - this._shortcuts = ((nativePath + "/") + this.shortcuts); - }; - this._rootPath = (nativePath + "/"); - this._storagePath = unescape((this._rootPath + "storage/")).replace("file://", ""); - var iconPath:String = xml..header..icon; - if (((iconPath) && (iconPath.length))) - { - this._iconUri = new Uri((this._rootPath + iconPath)); - }; + UiModuleManager.getInstance().unloadModule(this.id); + } + } + + public function get rootPath() : String + { + return this._rootPath; + } + + public function get storagePath() : String + { + return this._storagePath; + } + + public function get cachedFiles() : Array + { + return this._cachedFiles; + } + + public function get apiList() : Vector. + { + return this._apiList; + } + + public function set applicationDomain(param1:ApplicationDomain) : void + { + var _loc2_:UiData = null; + if(this._moduleAppDomain) + { + throw new BeriliaError("ApplicationDomain cannot be set twice."); + } + else + { + for each(_loc2_ in this.uis) + { + if((param1) && (param1.hasDefinition(_loc2_.uiClassName))) + { + _loc2_.uiClass = param1.getDefinition(_loc2_.uiClassName) as Class; + } + else + { + _log.error(_loc2_.uiClassName + " cannot be found"); + } + } + this._moduleAppDomain = param1; + return; + } + } + + public function get applicationDomain() : ApplicationDomain + { + return this._moduleAppDomain; + } + + public function get mainClass() : Object + { + return this._mainClass; + } + + public function set mainClass(param1:Object) : void + { + if(this._mainClass) + { + throw new BeriliaError("mainClass cannot be set twice."); + } + else + { + this._mainClass = param1; + return; + } + } + + public function get groups() : Vector. + { + return this._groups; + } + + public function get rawXml() : XML + { + return this._rawXml; + } + + public function addUiGroup(param1:String, param2:Boolean, param3:Boolean) : void + { + if(!this._groups) + { this._groups = new Vector.(); - for each (group in xml.uiGroup) - { - uiNames = new Array(); - groupName = group..@name; - try - { - uisXML = xml.uis.(@group == groupName); - for each (uiName in uisXML..@name) - { - uiNames.push(uiName.toString()); - }; - } - catch(e:Error) - { - }; - uiGroup = new UiGroup(group.@name, (group.@exclusive.toString() == "true"), (group.@permanent.toString() == "true"), uiNames); - UiGroupManager.getInstance().registerGroup(uiGroup); - this._groups.push(uiGroup); - }; - for each (uis in xml.uis) - { - uisGroup = uis.@group.toString(); - for each (ui in uis..ui) - { - if (ui.@group.toString().length) - { - uisGroup = ui.@group.toString(); - }; - file = null; - if (ui.@file.toString().length) - { - if (ui.@file.indexOf("::") != -1) - { - mod = nativePath.split("Ankama")[0]; - fileuri = ui.@file; - fileuri = fileuri.replace("::", "/"); - file = (mod + fileuri); - } - else - { - file = ((nativePath + "/") + ui.@file); - }; - }; - uiData = new UiData(this, ui.@name, file, ui.@["class"], uisGroup); - this._uis[uiData.name] = uiData; - }; - }; - for each (path in xml.cachedFiles..path) - { - this.cachedFiles.push(path.children().toString()); - }; - } - - private function setProperty(key:String, value:String):void - { - if (((value) && (value.length))) - { - this[("_" + key)] = value; + } + this._groups.push(new UiGroup(param1,param2,param3)); + } + + public function getUi(param1:String) : UiData + { + return this._uis[param1]; + } + + public function toString() : String + { + var _loc1_:String = "ID:" + this._id; + if(this._name) + { + _loc1_ = _loc1_ + ("\nName:" + this._name); + } + if(this._trusted) + { + _loc1_ = _loc1_ + ("\nTrusted:" + this._trusted); + } + if(this._author) + { + _loc1_ = _loc1_ + ("\nAuthor:" + this._author); + } + if(this._description) + { + _loc1_ = _loc1_ + ("\nDescription:" + this._description); + } + return _loc1_; + } + + public function destroy() : void + { + if(this._loader) + { + this._loader.unloadAndStop(true); + } + } + + public function usedApiList(param1:Function) : void + { + if(this._apiScriptAnalyserCallback) + { + if(!this._scriptAnalyser) + { + this._scriptAnalyser = new ModuleScriptAnalyzer(this,this.onScriptAnalyserReady,null); } - else + this._apiScriptAnalyserCallback[param1] = param1; + } + else + { + param1(this._scriptAnalyser.apis); + } + } + + public function usedHookList(param1:Function) : void + { + if(this._hookScriptAnalyserCallback) + { + if(!this._scriptAnalyser) + { + this._scriptAnalyser = new ModuleScriptAnalyzer(this,this.onScriptAnalyserReady,null); + } + this._hookScriptAnalyserCallback[param1] = param1; + } + else + { + param1(this._scriptAnalyser.hooks); + } + } + + public function usedActionList(param1:Function) : void + { + if(this._actionScriptAnalyserCallback) + { + if(!this._scriptAnalyser) + { + this._scriptAnalyser = new ModuleScriptAnalyzer(this,this.onScriptAnalyserReady,null); + } + this._actionScriptAnalyserCallback[param1] = param1; + } + else + { + param1(this._scriptAnalyser.actions); + } + } + + private function initScriptAnalyser() : void + { + if(!this._scriptAnalyser) + { + this._scriptAnalyser = new ModuleScriptAnalyzer(this,this.onScriptAnalyserReady,this._moduleAppDomain); + } + } + + private function onScriptAnalyserReady() : void + { + var _loc1_:Function = null; + for each(_loc1_ in this._actionScriptAnalyserCallback) + { + _loc1_(this._scriptAnalyser.actions); + } + for each(_loc1_ in this._hookScriptAnalyserCallback) + { + _loc1_(this._scriptAnalyser.hooks); + } + for each(_loc1_ in this._apiScriptAnalyserCallback) + { + _loc1_(this._scriptAnalyser.apis); + } + this._actionScriptAnalyserCallback = null; + this._hookScriptAnalyserCallback = null; + this._apiScriptAnalyserCallback = null; + } + + protected function fillFromXml(param1:XML, param2:String, param3:String) : void + { + var uiGroup:UiGroup = null; + var group:XML = null; + var uiData:UiData = null; + var uis:XML = null; + var path:XML = null; + var uiNames:Array = null; + var groupName:String = null; + var uisXML:XMLList = null; + var uiName:XML = null; + var uisGroup:String = null; + var ui:XML = null; + var file:String = null; + var mod:String = null; + var fileuri:String = null; + var xml:XML = param1; + var nativePath:String = param2; + var id:String = param3; + this.setProperty("name",xml..header..name); + this.setProperty("version",xml..header..version); + this.setProperty("gameVersion",xml..header..gameVersion); + this.setProperty("author",xml..header..author); + this.setProperty("description",xml..header..description); + this.setProperty("shortDescription",xml..header..shortDescription); + this.setProperty("script",xml..script); + this.setProperty("shortcuts",xml..shortcuts); + this._rawXml = xml; + nativePath = nativePath.split("app:/").join(""); + if(nativePath.indexOf("file://") == -1 && !(nativePath.substr(0,2) == "\\\\")) + { + nativePath = "file://" + nativePath; + } + this._id = id; + if(this.script) + { + this._script = nativePath + "/" + this.script; + } + if(this.shortcuts) + { + this._shortcuts = nativePath + "/" + this.shortcuts; + } + this._rootPath = nativePath + "/"; + this._storagePath = unescape(this._rootPath + "storage/").replace("file://",""); + var iconPath:String = xml..header..icon; + if((iconPath) && (iconPath.length)) + { + this._iconUri = new Uri(this._rootPath + iconPath); + } + this._groups = new Vector.(); + for(;xml.uiGroup hasNext _loc5_;uiGroup = new UiGroup(group.@name,group.@exclusive.toString() == "true",group.@permanent.toString() == "true",uiNames),UiGroupManager.getInstance().registerGroup(uiGroup),this._groups.push(uiGroup)) + { + group = nextValue(_loc5_,_loc6_); + uiNames = new Array(); + groupName = group..@name; + try + { + uisXML = xml.uis.(@group == groupName); + for each(uiName in uisXML..@name) + { + uiNames.push(uiName.toString()); + } + } + catch(e:Error) { - this[("_" + key)] = null; - }; - } - - - } -}//package com.ankamagames.berilia.types.data - + continue; + } + } + for each(uis in xml.uis) + { + uisGroup = uis.@group.toString(); + for each(ui in uis..ui) + { + if(ui.@group.toString().length) + { + uisGroup = ui.@group.toString(); + } + file = null; + if(ui.@file.toString().length) + { + if(ui.@file.indexOf("::") != -1) + { + mod = nativePath.split("Ankama")[0]; + fileuri = ui.@file; + fileuri = fileuri.replace("::","/"); + file = mod + fileuri; + } + else + { + file = nativePath + "/" + ui.@file; + } + } + uiData = new UiData(this,ui.@name,file,ui["class"],uisGroup); + this._uis[uiData.name] = uiData; + } + } + for each(path in xml.cachedFiles..path) + { + this.cachedFiles.push(path.children().toString()); + } + } + + private function setProperty(param1:String, param2:String) : void + { + if((param2) && (param2.length)) + { + this["_" + param1] = param2; + } + else + { + this["_" + param1] = null; + } + } + } +} diff --git a/com/ankamagames/berilia/types/data/UnsecureArray.as b/com/ankamagames/berilia/types/data/UnsecureArray.as index fc879d9e0..e62e6dcbe 100644 --- a/com/ankamagames/berilia/types/data/UnsecureArray.as +++ b/com/ankamagames/berilia/types/data/UnsecureArray.as @@ -1,17 +1,18 @@ -package com.ankamagames.berilia.types.data +package com.ankamagames.berilia.types.data { - import com.ankamagames.jerakine.interfaces.Secure; - - public dynamic class UnsecureArray extends Array implements Secure - { - - - public function getObject(accessKey:Object) - { - return (this); - } - - - } -}//package com.ankamagames.berilia.types.data - + import com.ankamagames.jerakine.interfaces.Secure; + + public dynamic class UnsecureArray extends Array implements Secure + { + + public function UnsecureArray() + { + super(); + } + + public function getObject(param1:Object) : * + { + return this; + } + } +} diff --git a/com/ankamagames/berilia/types/event/BeriliaEvent.as b/com/ankamagames/berilia/types/event/BeriliaEvent.as index 11ba07a43..4ef8aa898 100644 --- a/com/ankamagames/berilia/types/event/BeriliaEvent.as +++ b/com/ankamagames/berilia/types/event/BeriliaEvent.as @@ -1,17 +1,15 @@ -package com.ankamagames.berilia.types.event +package com.ankamagames.berilia.types.event { - import flash.events.Event; - - public class BeriliaEvent extends Event - { - - public static const REMOVE_COMPONENT:String = "Berilia_remove_component"; - - public function BeriliaEvent(type:String, bubbles:Boolean=false, cancelable:Boolean=false) - { - super(type, bubbles, cancelable); - } - - } -}//package com.ankamagames.berilia.types.event - + import flash.events.Event; + + public class BeriliaEvent extends Event + { + + public function BeriliaEvent(param1:String, param2:Boolean = false, param3:Boolean = false) + { + super(param1,param2,param3); + } + + public static const REMOVE_COMPONENT:String = "Berilia_remove_component"; + } +} diff --git a/com/ankamagames/berilia/types/event/CssEvent.as b/com/ankamagames/berilia/types/event/CssEvent.as index 6c1f7fd80..d1d7609dd 100644 --- a/com/ankamagames/berilia/types/event/CssEvent.as +++ b/com/ankamagames/berilia/types/event/CssEvent.as @@ -1,27 +1,24 @@ -package com.ankamagames.berilia.types.event +package com.ankamagames.berilia.types.event { - import flash.events.Event; - import com.ankamagames.berilia.types.data.ExtendedStyleSheet; - - public class CssEvent extends Event - { - - public static const CSS_PARSED:String = "event_css_parsed"; - - private var _stylesheet:ExtendedStyleSheet; - - public function CssEvent(type:String, bubbles:Boolean=false, cancelable:Boolean=false, stylesheet:ExtendedStyleSheet=null) - { - super(type, bubbles, cancelable); - this._stylesheet = stylesheet; - } - - public function get stylesheet():ExtendedStyleSheet - { - return (this._stylesheet); - } - - - } -}//package com.ankamagames.berilia.types.event - + import flash.events.Event; + import com.ankamagames.berilia.types.data.ExtendedStyleSheet; + + public class CssEvent extends Event + { + + public function CssEvent(param1:String, param2:Boolean = false, param3:Boolean = false, param4:ExtendedStyleSheet = null) + { + super(param1,param2,param3); + this._stylesheet = param4; + } + + public static const CSS_PARSED:String = "event_css_parsed"; + + private var _stylesheet:ExtendedStyleSheet; + + public function get stylesheet() : ExtendedStyleSheet + { + return this._stylesheet; + } + } +} diff --git a/com/ankamagames/berilia/types/event/HookEvent.as b/com/ankamagames/berilia/types/event/HookEvent.as index 8c35e4371..ffa616f97 100644 --- a/com/ankamagames/berilia/types/event/HookEvent.as +++ b/com/ankamagames/berilia/types/event/HookEvent.as @@ -1,27 +1,24 @@ -package com.ankamagames.berilia.types.event +package com.ankamagames.berilia.types.event { - import flash.events.Event; - import com.ankamagames.berilia.types.data.Hook; - - public class HookEvent extends Event - { - - public static const DISPATCHED:String = "hooDispatched"; - - private var _hook:Hook; - - public function HookEvent(type:String, hook:Hook) - { - super(type, false, false); - this._hook = hook; - } - - public function get hook():Hook - { - return (this._hook); - } - - - } -}//package com.ankamagames.berilia.types.event - + import flash.events.Event; + import com.ankamagames.berilia.types.data.Hook; + + public class HookEvent extends Event + { + + public function HookEvent(param1:String, param2:Hook) + { + super(param1,false,false); + this._hook = param2; + } + + public static const DISPATCHED:String = "hooDispatched"; + + private var _hook:Hook; + + public function get hook() : Hook + { + return this._hook; + } + } +} diff --git a/com/ankamagames/berilia/types/event/HookLogEvent.as b/com/ankamagames/berilia/types/event/HookLogEvent.as index 8ee1c8869..a8aee8ba4 100644 --- a/com/ankamagames/berilia/types/event/HookLogEvent.as +++ b/com/ankamagames/berilia/types/event/HookLogEvent.as @@ -1,41 +1,39 @@ -package com.ankamagames.berilia.types.event +package com.ankamagames.berilia.types.event { - import com.ankamagames.jerakine.logger.LogEvent; - import flash.utils.Dictionary; - import flash.events.Event; - - public class HookLogEvent extends LogEvent - { - - public static var MEMORY_LOG:Dictionary = new Dictionary(true); - - private var _hookName:String; - private var _params:Array; - - public function HookLogEvent(hookName:String, params:Array) - { - super(null, null, 0); - this._hookName = hookName; - this._params = params; - MEMORY_LOG[this] = 1; - } - - public function get name():String - { - return (this._hookName); - } - - public function get params():Array - { - return (this._params); - } - - override public function clone():Event - { - return (new HookLogEvent(this._hookName, this._params)); - } - - - } -}//package com.ankamagames.berilia.types.event - + import com.ankamagames.jerakine.logger.LogEvent; + import flash.utils.Dictionary; + import flash.events.Event; + + public class HookLogEvent extends LogEvent + { + + public function HookLogEvent(param1:String, param2:Array) + { + super(null,null,0); + this._hookName = param1; + this._params = param2; + MEMORY_LOG[this] = 1; + } + + public static var MEMORY_LOG:Dictionary = new Dictionary(true); + + private var _hookName:String; + + private var _params:Array; + + public function get name() : String + { + return this._hookName; + } + + public function get params() : Array + { + return this._params; + } + + override public function clone() : Event + { + return new HookLogEvent(this._hookName,this._params); + } + } +} diff --git a/com/ankamagames/berilia/types/event/InstanceEvent.as b/com/ankamagames/berilia/types/event/InstanceEvent.as index d2a6f4ee1..8914ecd69 100644 --- a/com/ankamagames/berilia/types/event/InstanceEvent.as +++ b/com/ankamagames/berilia/types/event/InstanceEvent.as @@ -1,61 +1,61 @@ -package com.ankamagames.berilia.types.event +package com.ankamagames.berilia.types.event { - import flash.utils.Dictionary; - import flash.display.DisplayObject; - import flash.display.InteractiveObject; - - public class InstanceEvent - { - - public static var MEMORY_LOG:Dictionary = new Dictionary(true); - - private var _doInstance:DisplayObject; - private var _aEvent:Array; - private var _oCallback:Object; - - public function InstanceEvent(doInstance:DisplayObject, oCallback:Object) - { - this._doInstance = doInstance; - this._aEvent = new Array(); - this._oCallback = oCallback; - if ((doInstance is InteractiveObject)) - { - InteractiveObject(doInstance).mouseEnabled = true; - }; - MEMORY_LOG[this] = 1; - } - - public function get instance():DisplayObject - { - return (this._doInstance); - } - - public function get events():Array - { - return (this._aEvent); - } - - public function get callbackObject():Object - { - return (this._oCallback); - } - - public function set callbackObject(o:Object):void - { - this._oCallback = o; - } - - public function get haveEvent():Boolean - { - return (!((this._aEvent.length == 0))); - } - - public function push(sEventName:String):void - { - this._aEvent[sEventName] = true; - } - - - } -}//package com.ankamagames.berilia.types.event - + import flash.utils.Dictionary; + import flash.display.DisplayObject; + import flash.display.InteractiveObject; + + public class InstanceEvent extends Object + { + + public function InstanceEvent(param1:DisplayObject, param2:Object) + { + super(); + this._doInstance = param1; + this._aEvent = new Array(); + this._oCallback = param2; + if(param1 is InteractiveObject) + { + InteractiveObject(param1).mouseEnabled = true; + } + MEMORY_LOG[this] = 1; + } + + public static var MEMORY_LOG:Dictionary = new Dictionary(true); + + private var _doInstance:DisplayObject; + + private var _aEvent:Array; + + private var _oCallback:Object; + + public function get instance() : DisplayObject + { + return this._doInstance; + } + + public function get events() : Array + { + return this._aEvent; + } + + public function get callbackObject() : Object + { + return this._oCallback; + } + + public function set callbackObject(param1:Object) : void + { + this._oCallback = param1; + } + + public function get haveEvent() : Boolean + { + return !(this._aEvent.length == 0); + } + + public function push(param1:String) : void + { + this._aEvent[param1] = true; + } + } +} diff --git a/com/ankamagames/berilia/types/event/ParsingErrorEvent.as b/com/ankamagames/berilia/types/event/ParsingErrorEvent.as index 3f0439ec8..e5fb9d304 100644 --- a/com/ankamagames/berilia/types/event/ParsingErrorEvent.as +++ b/com/ankamagames/berilia/types/event/ParsingErrorEvent.as @@ -1,33 +1,31 @@ -package com.ankamagames.berilia.types.event +package com.ankamagames.berilia.types.event { - import flash.events.Event; - - public class ParsingErrorEvent extends Event - { - - public static const ERROR:String = "ParsingErrorEvent_Error"; - - private var _url:String; - private var _msg:String; - - public function ParsingErrorEvent(url:String, msg:String) - { - super(ERROR); - this._url = url; - this._msg = msg; - } - - public function get url():String - { - return (this._url); - } - - public function get msg():String - { - return (this._msg); - } - - - } -}//package com.ankamagames.berilia.types.event - + import flash.events.Event; + + public class ParsingErrorEvent extends Event + { + + public function ParsingErrorEvent(param1:String, param2:String) + { + super(ERROR); + this._url = param1; + this._msg = param2; + } + + public static const ERROR:String = "ParsingErrorEvent_Error"; + + private var _url:String; + + private var _msg:String; + + public function get url() : String + { + return this._url; + } + + public function get msg() : String + { + return this._msg; + } + } +} diff --git a/com/ankamagames/berilia/types/event/ParsorEvent.as b/com/ankamagames/berilia/types/event/ParsorEvent.as index ee0d7e631..e3fb0204d 100644 --- a/com/ankamagames/berilia/types/event/ParsorEvent.as +++ b/com/ankamagames/berilia/types/event/ParsorEvent.as @@ -1,32 +1,30 @@ -package com.ankamagames.berilia.types.event +package com.ankamagames.berilia.types.event { - import flash.events.Event; - import com.ankamagames.berilia.types.uiDefinition.UiDefinition; - - public class ParsorEvent extends Event - { - - private var _uiDef:UiDefinition; - private var _error:Boolean; - - public function ParsorEvent(uiDef:UiDefinition, error:Boolean) - { - super(Event.COMPLETE, false, false); - this._uiDef = uiDef; - this._error = error; - } - - public function get error():Boolean - { - return (this._error); - } - - public function get uiDefinition():UiDefinition - { - return (this._uiDef); - } - - - } -}//package com.ankamagames.berilia.types.event - + import flash.events.Event; + import com.ankamagames.berilia.types.uiDefinition.UiDefinition; + + public class ParsorEvent extends Event + { + + public function ParsorEvent(param1:UiDefinition, param2:Boolean) + { + super(Event.COMPLETE,false,false); + this._uiDef = param1; + this._error = param2; + } + + private var _uiDef:UiDefinition; + + private var _error:Boolean; + + public function get error() : Boolean + { + return this._error; + } + + public function get uiDefinition() : UiDefinition + { + return this._uiDef; + } + } +} diff --git a/com/ankamagames/berilia/types/event/PreProcessEndEvent.as b/com/ankamagames/berilia/types/event/PreProcessEndEvent.as index b437510d4..426d1e021 100644 --- a/com/ankamagames/berilia/types/event/PreProcessEndEvent.as +++ b/com/ankamagames/berilia/types/event/PreProcessEndEvent.as @@ -1,27 +1,24 @@ -package com.ankamagames.berilia.types.event +package com.ankamagames.berilia.types.event { - import flash.events.Event; - import com.ankamagames.berilia.uiRender.XmlPreProcessor; - - public class PreProcessEndEvent extends Event - { - - public static const PRE_PROCESS_END:String = "pre_process_end"; - - private var _preprocessor:XmlPreProcessor; - - public function PreProcessEndEvent(preprocessor:XmlPreProcessor) - { - super(PRE_PROCESS_END, false, false); - this._preprocessor = preprocessor; - } - - public function get preprocessor():XmlPreProcessor - { - return (this._preprocessor); - } - - - } -}//package com.ankamagames.berilia.types.event - + import flash.events.Event; + import com.ankamagames.berilia.uiRender.XmlPreProcessor; + + public class PreProcessEndEvent extends Event + { + + public function PreProcessEndEvent(param1:XmlPreProcessor) + { + super(PRE_PROCESS_END,false,false); + this._preprocessor = param1; + } + + public static const PRE_PROCESS_END:String = "pre_process_end"; + + private var _preprocessor:XmlPreProcessor; + + public function get preprocessor() : XmlPreProcessor + { + return this._preprocessor; + } + } +} diff --git a/com/ankamagames/berilia/types/event/TemplateLoadedEvent.as b/com/ankamagames/berilia/types/event/TemplateLoadedEvent.as index 13afdabc6..5d5364723 100644 --- a/com/ankamagames/berilia/types/event/TemplateLoadedEvent.as +++ b/com/ankamagames/berilia/types/event/TemplateLoadedEvent.as @@ -1,26 +1,23 @@ -package com.ankamagames.berilia.types.event +package com.ankamagames.berilia.types.event { - import flash.events.Event; - - public class TemplateLoadedEvent extends Event - { - - public static const EVENT_TEMPLATE_LOADED:String = "onTemplateLoadedEvent"; - - private var _templateUrl:String; - - public function TemplateLoadedEvent(templateUrl:String) - { - super(EVENT_TEMPLATE_LOADED, false, false); - this._templateUrl = templateUrl; - } - - public function get templateUrl():String - { - return (this._templateUrl); - } - - - } -}//package com.ankamagames.berilia.types.event - + import flash.events.Event; + + public class TemplateLoadedEvent extends Event + { + + public function TemplateLoadedEvent(param1:String) + { + super(EVENT_TEMPLATE_LOADED,false,false); + this._templateUrl = param1; + } + + public static const EVENT_TEMPLATE_LOADED:String = "onTemplateLoadedEvent"; + + private var _templateUrl:String; + + public function get templateUrl() : String + { + return this._templateUrl; + } + } +} diff --git a/com/ankamagames/berilia/types/event/TextureLoadFailedEvent.as b/com/ankamagames/berilia/types/event/TextureLoadFailedEvent.as index 934ba1bc1..7b99eb70a 100644 --- a/com/ankamagames/berilia/types/event/TextureLoadFailedEvent.as +++ b/com/ankamagames/berilia/types/event/TextureLoadFailedEvent.as @@ -1,35 +1,33 @@ -package com.ankamagames.berilia.types.event +package com.ankamagames.berilia.types.event { - import flash.events.Event; - import com.ankamagames.jerakine.types.DynamicSecureObject; - import com.ankamagames.berilia.components.Texture; - - public class TextureLoadFailedEvent extends Event - { - - public static const EVENT_TEXTURE_LOAD_FAILED:String = "TextureLoadFailedEvent"; - - private var _behavior:DynamicSecureObject; - private var _targetedTexture:Texture; - - public function TextureLoadFailedEvent(target:Texture, behavior:DynamicSecureObject) - { - super(EVENT_TEXTURE_LOAD_FAILED, false, false); - this._targetedTexture = target; - this._behavior = behavior; - } - - public function get behavior():DynamicSecureObject - { - return (this._behavior); - } - - public function get targetedTexture():Texture - { - return (this._targetedTexture); - } - - - } -}//package com.ankamagames.berilia.types.event - + import flash.events.Event; + import com.ankamagames.jerakine.types.DynamicSecureObject; + import com.ankamagames.berilia.components.Texture; + + public class TextureLoadFailedEvent extends Event + { + + public function TextureLoadFailedEvent(param1:Texture, param2:DynamicSecureObject) + { + super(EVENT_TEXTURE_LOAD_FAILED,false,false); + this._targetedTexture = param1; + this._behavior = param2; + } + + public static const EVENT_TEXTURE_LOAD_FAILED:String = "TextureLoadFailedEvent"; + + private var _behavior:DynamicSecureObject; + + private var _targetedTexture:Texture; + + public function get behavior() : DynamicSecureObject + { + return this._behavior; + } + + public function get targetedTexture() : Texture + { + return this._targetedTexture; + } + } +} diff --git a/com/ankamagames/berilia/types/event/UiRenderAskEvent.as b/com/ankamagames/berilia/types/event/UiRenderAskEvent.as index ffbd43c5a..bd6e15134 100644 --- a/com/ankamagames/berilia/types/event/UiRenderAskEvent.as +++ b/com/ankamagames/berilia/types/event/UiRenderAskEvent.as @@ -1,34 +1,32 @@ -package com.ankamagames.berilia.types.event +package com.ankamagames.berilia.types.event { - import flash.events.Event; - import com.ankamagames.berilia.types.data.UiData; - - public class UiRenderAskEvent extends Event - { - - public static const UI_RENDER_ASK:String = "UiRenderAsk"; - - private var _uiData:UiData; - private var _name:String; - - public function UiRenderAskEvent(name:String, uiData:UiData) - { - super(UI_RENDER_ASK, false, false); - this._uiData = uiData; - this._name = name; - } - - public function get name():String - { - return (this._name); - } - - public function get uiData():UiData - { - return (this._uiData); - } - - - } -}//package com.ankamagames.berilia.types.event - + import flash.events.Event; + import com.ankamagames.berilia.types.data.UiData; + + public class UiRenderAskEvent extends Event + { + + public function UiRenderAskEvent(param1:String, param2:UiData) + { + super(UI_RENDER_ASK,false,false); + this._uiData = param2; + this._name = param1; + } + + public static const UI_RENDER_ASK:String = "UiRenderAsk"; + + private var _uiData:UiData; + + private var _name:String; + + public function get name() : String + { + return this._name; + } + + public function get uiData() : UiData + { + return this._uiData; + } + } +} diff --git a/com/ankamagames/berilia/types/event/UiRenderEvent.as b/com/ankamagames/berilia/types/event/UiRenderEvent.as index 4571cd497..0d1558d5b 100644 --- a/com/ankamagames/berilia/types/event/UiRenderEvent.as +++ b/com/ankamagames/berilia/types/event/UiRenderEvent.as @@ -1,41 +1,40 @@ -package com.ankamagames.berilia.types.event +package com.ankamagames.berilia.types.event { - import flash.events.Event; - import com.ankamagames.berilia.types.graphic.UiRootContainer; - import com.ankamagames.berilia.uiRender.UiRenderer; - - public class UiRenderEvent extends Event - { - - public static var UIRenderComplete:String = "UIRenderComplete"; - public static var UIRenderFailed:String = "UIRenderFailed"; - - private var _secUiTarget:UiRootContainer; - private var _uiRenderer:UiRenderer; - - public function UiRenderEvent(type:String, bubbles:Boolean=false, cancelable:Boolean=false, uiTarget:UiRootContainer=null, uiRenderer:UiRenderer=null) - { - super(type, bubbles, cancelable); - this._secUiTarget = uiTarget; - this._uiRenderer = uiRenderer; - } - - public function get uiTarget():UiRootContainer - { - return (this._secUiTarget); - } - - public function get uiRenderer():UiRenderer - { - return (this._uiRenderer); - } - - override public function clone():Event - { - return (new UiRenderEvent(type, bubbles, cancelable, this.uiTarget, this.uiRenderer)); - } - - - } -}//package com.ankamagames.berilia.types.event - + import flash.events.Event; + import com.ankamagames.berilia.types.graphic.UiRootContainer; + import com.ankamagames.berilia.uiRender.UiRenderer; + + public class UiRenderEvent extends Event + { + + public function UiRenderEvent(param1:String, param2:Boolean = false, param3:Boolean = false, param4:UiRootContainer = null, param5:UiRenderer = null) + { + super(param1,param2,param3); + this._secUiTarget = param4; + this._uiRenderer = param5; + } + + public static var UIRenderComplete:String = "UIRenderComplete"; + + public static var UIRenderFailed:String = "UIRenderFailed"; + + private var _secUiTarget:UiRootContainer; + + private var _uiRenderer:UiRenderer; + + public function get uiTarget() : UiRootContainer + { + return this._secUiTarget; + } + + public function get uiRenderer() : UiRenderer + { + return this._uiRenderer; + } + + override public function clone() : Event + { + return new UiRenderEvent(type,bubbles,cancelable,this.uiTarget,this.uiRenderer); + } + } +} diff --git a/com/ankamagames/berilia/types/event/UiUnloadEvent.as b/com/ankamagames/berilia/types/event/UiUnloadEvent.as index 719bf9ad6..d4bc44191 100644 --- a/com/ankamagames/berilia/types/event/UiUnloadEvent.as +++ b/com/ankamagames/berilia/types/event/UiUnloadEvent.as @@ -1,27 +1,25 @@ -package com.ankamagames.berilia.types.event +package com.ankamagames.berilia.types.event { - import flash.events.Event; - - public class UiUnloadEvent extends Event - { - - public static const UNLOAD_UI_STARTED:String = "unloadUiStarted"; - public static const UNLOAD_UI_COMPLETE:String = "unloadUiComplete"; - - private var _name:String; - - public function UiUnloadEvent(type:String, name:String) - { - super(type, false, false); - this._name = name; - } - - public function get name():String - { - return (this._name); - } - - - } -}//package com.ankamagames.berilia.types.event - + import flash.events.Event; + + public class UiUnloadEvent extends Event + { + + public function UiUnloadEvent(param1:String, param2:String) + { + super(param1,false,false); + this._name = param2; + } + + public static const UNLOAD_UI_STARTED:String = "unloadUiStarted"; + + public static const UNLOAD_UI_COMPLETE:String = "unloadUiComplete"; + + private var _name:String; + + public function get name() : String + { + return this._name; + } + } +} diff --git a/com/ankamagames/berilia/types/graphic/ButtonContainer.as b/com/ankamagames/berilia/types/graphic/ButtonContainer.as index 158351e0b..f5db13e5c 100644 --- a/com/ankamagames/berilia/types/graphic/ButtonContainer.as +++ b/com/ankamagames/berilia/types/graphic/ButtonContainer.as @@ -1,383 +1,390 @@ -package com.ankamagames.berilia.types.graphic +package com.ankamagames.berilia.types.graphic { - import com.ankamagames.berilia.interfaces.IRadioItem; - import com.ankamagames.berilia.FinalizableUIComponent; - import com.ankamagames.jerakine.interfaces.IDragAndDropHandler; - import com.ankamagames.jerakine.logger.Logger; - import com.ankamagames.jerakine.logger.Log; - import flash.utils.getQualifiedClassName; - import com.ankamagames.berilia.types.data.RadioGroup; - import com.ankamagames.berilia.enums.StatesEnum; - import com.ankamagames.jerakine.interfaces.IInterfaceListener; - import com.ankamagames.jerakine.handlers.messages.mouse.MouseDownMessage; - import com.ankamagames.jerakine.utils.display.FrameIdManager; - import com.ankamagames.berilia.Berilia; - import com.ankamagames.jerakine.handlers.messages.mouse.MouseDoubleClickMessage; - import com.ankamagames.jerakine.handlers.messages.mouse.MouseClickMessage; - import com.ankamagames.jerakine.handlers.messages.mouse.MouseOverMessage; - import com.ankamagames.jerakine.handlers.messages.mouse.MouseReleaseOutsideMessage; - import com.ankamagames.jerakine.handlers.messages.mouse.MouseOutMessage; - import com.ankamagames.jerakine.messages.Message; - - public class ButtonContainer extends StateContainer implements IRadioItem, FinalizableUIComponent, IDragAndDropHandler - { - - protected static const _log:Logger = Log.getLogger(getQualifiedClassName(ButtonContainer)); - - private var _selected:Boolean = false; - protected var _mousePressed:Boolean = false; - protected var _disabled:Boolean = false; - private var _radioGroup:String; - private var _value; - private var _lastClickFameId:uint = 0xFFFFFFFF; - private var _checkbox:Boolean = false; - private var _radioMode:Boolean = false; - protected var _sLinkedTo:String; - protected var _soundId:String = "0"; - protected var _playRollOverSound:Boolean = true; - protected var _isMute:Boolean = false; - protected var _finalized:Boolean; - - public function ButtonContainer() - { - buttonMode = true; - useHandCursor = true; - mouseEnabled = true; - mouseChildren = false; - } - - public function set checkBox(b:Boolean):void - { - this._checkbox = b; - this._radioMode = ((!(b)) && (this._radioMode)); - } - - public function get checkBox():Boolean - { - return (this._checkbox); - } - - public function set radioMode(b:Boolean):void - { - this._radioMode = b; - this._checkbox = ((!(b)) && (this._checkbox)); - } - - public function get radioMode():Boolean - { - return (this._radioMode); - } - - override public function set linkedTo(sUiComponent:String):void - { - this._sLinkedTo = sUiComponent; - } - - override public function get linkedTo():String - { - return (this._sLinkedTo); - } - - public function set radioGroup(radioGroupName:String):void - { - if (radioGroupName == "") + import com.ankamagames.berilia.interfaces.IRadioItem; + import com.ankamagames.berilia.FinalizableUIComponent; + import com.ankamagames.jerakine.interfaces.IDragAndDropHandler; + import com.ankamagames.jerakine.logger.Logger; + import com.ankamagames.jerakine.logger.Log; + import flash.utils.getQualifiedClassName; + import com.ankamagames.berilia.types.data.RadioGroup; + import com.ankamagames.berilia.enums.StatesEnum; + import com.ankamagames.jerakine.messages.Message; + import com.ankamagames.jerakine.interfaces.IInterfaceListener; + import com.ankamagames.jerakine.utils.display.FrameIdManager; + import com.ankamagames.berilia.Berilia; + import com.ankamagames.jerakine.handlers.messages.mouse.MouseDownMessage; + import com.ankamagames.jerakine.handlers.messages.mouse.MouseDoubleClickMessage; + import com.ankamagames.jerakine.handlers.messages.mouse.MouseClickMessage; + import com.ankamagames.jerakine.handlers.messages.mouse.MouseOverMessage; + import com.ankamagames.jerakine.handlers.messages.mouse.MouseReleaseOutsideMessage; + import com.ankamagames.jerakine.handlers.messages.mouse.MouseOutMessage; + + public class ButtonContainer extends StateContainer implements IRadioItem, FinalizableUIComponent, IDragAndDropHandler + { + + public function ButtonContainer() + { + super(); + buttonMode = true; + useHandCursor = true; + mouseEnabled = true; + mouseChildren = false; + } + + protected static const _log:Logger = Log.getLogger(getQualifiedClassName(ButtonContainer)); + + private var _selected:Boolean = false; + + protected var _mousePressed:Boolean = false; + + protected var _disabled:Boolean = false; + + private var _radioGroup:String; + + private var _value; + + private var _lastClickFameId:uint = 4.294967295E9; + + private var _checkbox:Boolean = false; + + private var _radioMode:Boolean = false; + + protected var _sLinkedTo:String; + + protected var _soundId:String = "0"; + + protected var _playRollOverSound:Boolean = true; + + protected var _isMute:Boolean = false; + + protected var _finalized:Boolean; + + public function set checkBox(param1:Boolean) : void + { + this._checkbox = param1; + this._radioMode = !param1 && (this._radioMode); + } + + public function get checkBox() : Boolean + { + return this._checkbox; + } + + public function set radioMode(param1:Boolean) : void + { + this._radioMode = param1; + this._checkbox = !param1 && (this._checkbox); + } + + public function get radioMode() : Boolean + { + return this._radioMode; + } + + override public function set linkedTo(param1:String) : void + { + this._sLinkedTo = param1; + } + + override public function get linkedTo() : String + { + return this._sLinkedTo; + } + + public function set radioGroup(param1:String) : void + { + if(param1 == "") + { + this._radioGroup = null; + } + else + { + this._radioGroup = param1; + } + } + + public function get radioGroup() : String + { + return this._radioGroup; + } + + public function get mousePressed() : Boolean + { + return this._mousePressed; + } + + public function set selected(param1:Boolean) : void + { + var _loc2_:RadioGroup = null; + this._selected = param1; + if(changingStateData) + { + if(!changingStateData[param1?StatesEnum.STATE_SELECTED:StatesEnum.STATE_NORMAL]) { - this._radioGroup = null; + this.state = this._selected?StatesEnum.STATE_SELECTED:StatesEnum.STATE_NORMAL; } else { - this._radioGroup = radioGroupName; - }; - } - - public function get radioGroup():String - { - return (this._radioGroup); - } - - public function get mousePressed():Boolean - { - return (this._mousePressed); - } - - public function set selected(b:Boolean):void - { - var rg:RadioGroup; - this._selected = b; - if (changingStateData) - { - if (!(changingStateData[((b) ? StatesEnum.STATE_SELECTED : StatesEnum.STATE_NORMAL)])) - { - this.state = ((this._selected) ? StatesEnum.STATE_SELECTED : StatesEnum.STATE_NORMAL); - } - else - { - this.state = ((b) ? StatesEnum.STATE_SELECTED : StatesEnum.STATE_NORMAL); - }; - }; - if (((this._radioGroup) && (getUi()))) - { - rg = getUi().getRadioGroup(this._radioGroup); - if (rg) - { - rg.selectedItem = this; - }; - }; - } - - public function get selected():Boolean - { - return (this._selected); - } - - override public function set state(newState:*):void - { - if (_state == newState) - { - return; - }; - switch (newState) - { - case StatesEnum.STATE_NORMAL: - _state = newState; - restoreSnapshot(StatesEnum.STATE_NORMAL); - return; - case StatesEnum.STATE_DISABLED: - this._disabled = true; - case StatesEnum.STATE_SELECTED: - case StatesEnum.STATE_CLICKED: - case StatesEnum.STATE_OVER: - case StatesEnum.STATE_SELECTED_CLICKED: - case StatesEnum.STATE_SELECTED_OVER: - if (!(softDisabled)) - { - changeState(newState); - _state = newState; - }; - return; - }; - } - - public function get id():String - { - return (name); - } - - public function get value() - { - return (this._value); - } - - public function set value(v:*):void - { - this._value = v; - } - - public function finalize():void - { - var ui:UiRootContainer; - var rg:RadioGroup; - if (this._radioGroup) - { - ui = getUi(); - rg = ui.addRadioGroup(this._radioGroup); - rg.addItem(this); - }; - if (this._selected) - { - this.selected = this._selected; - }; - if (getUi()) - { - getUi().iAmFinalized(this); - }; - this._finalized = true; - } - - public function get finalized():Boolean - { - return (this._finalized); - } - - public function set finalized(b:Boolean):void - { - this._finalized = b; - } - - public function get soundId():String - { - return (this._soundId); - } - - public function set soundId(pSoundId:String):void - { - this._soundId = pSoundId; - } - - public function get isMute():Boolean - { - return (this._isMute); - } - - public function set isMute(pMute:Boolean):void - { - this._isMute = pMute; - } - - public function reset():void - { - _snapshot = new Array(); - this.selected = false; - _state = StatesEnum.STATE_NORMAL; - } - - override public function free():void - { - super.free(); - this._selected = false; - this._mousePressed = false; - this._disabled = false; - this._radioGroup = null; - this._value = null; - this._checkbox = false; - this._radioMode = false; - this._sLinkedTo = null; - } - - override public function remove():void - { - super.remove(); - this.free(); - } - - protected function selectSound():String - { - if (this._soundId != "0") - { - return (this._soundId); - }; - switch (true) - { - case this.checkBox: - if (this.selected) - { - return ("16006"); - }; - return ("16007"); - default: - return ("16004"); - }; - } - - [HideInFakeClass] - override public function process(msg:Message):Boolean - { - var listener:IInterfaceListener; - var soundToPLay:String; - var listenerInterface:IInterfaceListener; - var rg:RadioGroup; - var elem:GraphicContainer; - var tmpState:uint = 9999; - if (!(super.canProcessMessage(msg))) + this.state = param1?StatesEnum.STATE_SELECTED:StatesEnum.STATE_NORMAL; + } + } + if((this._radioGroup) && (getUi())) + { + _loc2_ = getUi().getRadioGroup(this._radioGroup); + if(_loc2_) { - return (true); - }; - if (!(this._disabled)) + _loc2_.selectedItem = this; + } + } + } + + public function get selected() : Boolean + { + return this._selected; + } + + override public function set state(param1:*) : void + { + if(_state == param1) + { + return; + } + switch(param1) + { + case StatesEnum.STATE_NORMAL: + _state = param1; + restoreSnapshot(StatesEnum.STATE_NORMAL); + break; + case StatesEnum.STATE_DISABLED: + this._disabled = true; + case StatesEnum.STATE_SELECTED: + case StatesEnum.STATE_CLICKED: + case StatesEnum.STATE_OVER: + case StatesEnum.STATE_SELECTED_CLICKED: + case StatesEnum.STATE_SELECTED_OVER: + if(!softDisabled) + { + changeState(param1); + _state = param1; + } + break; + } + } + + public function get id() : String + { + return name; + } + + public function get value() : * + { + return this._value; + } + + public function set value(param1:*) : void + { + this._value = param1; + } + + public function finalize() : void + { + var _loc1_:UiRootContainer = null; + var _loc2_:RadioGroup = null; + if(this._radioGroup) + { + _loc1_ = getUi(); + _loc2_ = _loc1_.addRadioGroup(this._radioGroup); + _loc2_.addItem(this); + } + if(this._selected) + { + this.selected = this._selected; + } + if(getUi()) + { + getUi().iAmFinalized(this); + } + this._finalized = true; + } + + public function get finalized() : Boolean + { + return this._finalized; + } + + public function set finalized(param1:Boolean) : void + { + this._finalized = param1; + } + + public function get soundId() : String + { + return this._soundId; + } + + public function set soundId(param1:String) : void + { + this._soundId = param1; + } + + public function get isMute() : Boolean + { + return this._isMute; + } + + public function set isMute(param1:Boolean) : void + { + this._isMute = param1; + } + + public function reset() : void + { + _snapshot = new Array(); + this.selected = false; + _state = StatesEnum.STATE_NORMAL; + } + + override public function free() : void + { + super.free(); + this._selected = false; + this._mousePressed = false; + this._disabled = false; + this._radioGroup = null; + this._value = null; + this._checkbox = false; + this._radioMode = false; + this._sLinkedTo = null; + } + + override public function remove() : void + { + super.remove(); + this.free(); + } + + protected function selectSound() : String + { + if(this._soundId != "0") + { + return this._soundId; + } + switch(true) + { + case this.checkBox: + if(this.selected) + { + return "16006"; + } + return "16007"; + default: + return "16004"; + } + } + + override public function process(param1:Message) : Boolean + { + var _loc3_:IInterfaceListener = null; + var _loc4_:String = null; + var _loc5_:IInterfaceListener = null; + var _loc6_:RadioGroup = null; + var _loc7_:GraphicContainer = null; + var _loc2_:uint = 9999; + if(!super.canProcessMessage(param1)) + { + return true; + } + if(!this._disabled) + { + switch(true) { - switch (true) - { - case (msg is MouseDownMessage): - this._mousePressed = true; - tmpState = ((this._selected) ? StatesEnum.STATE_SELECTED_CLICKED : StatesEnum.STATE_CLICKED); - break; - case (msg is MouseDoubleClickMessage): - case (msg is MouseClickMessage): - this._mousePressed = false; - if (this._lastClickFameId == FrameIdManager.frameId) - { - break; - }; - this._lastClickFameId = FrameIdManager.frameId; - if (this._checkbox) + case param1 is MouseDownMessage: + this._mousePressed = true; + _loc2_ = this._selected?StatesEnum.STATE_SELECTED_CLICKED:StatesEnum.STATE_CLICKED; + break; + case param1 is MouseDoubleClickMessage: + case param1 is MouseClickMessage: + this._mousePressed = false; + if(this._lastClickFameId == FrameIdManager.frameId) + { + break; + } + this._lastClickFameId = FrameIdManager.frameId; + if(this._checkbox) + { + this._selected = !this._selected; + } + else if(this._radioMode) + { + this._selected = true; + } + + _loc2_ = this._selected?StatesEnum.STATE_SELECTED_OVER:StatesEnum.STATE_OVER; + if(!changingStateData[_loc2_]) + { + _loc2_ = this._selected?StatesEnum.STATE_SELECTED:StatesEnum.STATE_NORMAL; + } + if(!this.isMute) + { + for each(_loc3_ in Berilia.getInstance().UISoundListeners) + { + _loc4_ = this.selectSound(); + if(int(_loc4_) != -1) { - this._selected = !(this._selected); + _loc3_.playUISound(_loc4_); } - else - { - if (this._radioMode) - { - this._selected = true; - }; - }; - tmpState = ((this._selected) ? StatesEnum.STATE_SELECTED_OVER : StatesEnum.STATE_OVER); - if (!(changingStateData[tmpState])) - { - tmpState = ((this._selected) ? StatesEnum.STATE_SELECTED : StatesEnum.STATE_NORMAL); - }; - if (!(this.isMute)) + } + } + break; + case param1 is MouseOverMessage: + if(this._mousePressed) + { + _loc2_ = this._selected?StatesEnum.STATE_SELECTED_CLICKED:StatesEnum.STATE_CLICKED; + } + else + { + if((this._playRollOverSound) && !this.isMute) + { + for each(_loc5_ in Berilia.getInstance().UISoundListeners) { - for each (listener in Berilia.getInstance().UISoundListeners) - { - soundToPLay = this.selectSound(); - if (int(soundToPLay) != -1) - { - listener.playUISound(soundToPLay); - }; - }; - }; - break; - case (msg is MouseOverMessage): - if (this._mousePressed) - { - tmpState = ((this._selected) ? StatesEnum.STATE_SELECTED_CLICKED : StatesEnum.STATE_CLICKED); + _loc5_.playUISound("16010"); } - else - { - if (((this._playRollOverSound) && (!(this.isMute)))) - { - for each (listenerInterface in Berilia.getInstance().UISoundListeners) - { - listenerInterface.playUISound("16010"); - }; - }; - tmpState = ((this._selected) ? StatesEnum.STATE_SELECTED_OVER : StatesEnum.STATE_OVER); - if (((changingStateData) && (!(changingStateData[tmpState])))) - { - tmpState = ((this._selected) ? StatesEnum.STATE_SELECTED : StatesEnum.STATE_NORMAL); - }; - }; - break; - case (msg is MouseReleaseOutsideMessage): - this._mousePressed = false; - case (msg is MouseOutMessage): - tmpState = ((this._selected) ? StatesEnum.STATE_SELECTED : StatesEnum.STATE_NORMAL); - break; - }; - }; - if (tmpState != 9999) + } + _loc2_ = this._selected?StatesEnum.STATE_SELECTED_OVER:StatesEnum.STATE_OVER; + if((changingStateData) && !changingStateData[_loc2_]) + { + _loc2_ = this._selected?StatesEnum.STATE_SELECTED:StatesEnum.STATE_NORMAL; + } + } + break; + case param1 is MouseReleaseOutsideMessage: + this._mousePressed = false; + case param1 is MouseOutMessage: + _loc2_ = this._selected?StatesEnum.STATE_SELECTED:StatesEnum.STATE_NORMAL; + break; + } + } + if(_loc2_ != 9999) + { + this.state = _loc2_; + if((this._radioGroup) && (this._selected)) { - this.state = tmpState; - if (((this._radioGroup) && (this._selected))) - { - rg = getUi().getRadioGroup(this._radioGroup); - if (rg) - { - rg.selectedItem = this; - }; - }; - }; - if (this._sLinkedTo) + _loc6_ = getUi().getRadioGroup(this._radioGroup); + if(_loc6_) + { + _loc6_.selectedItem = this; + } + } + } + if(this._sLinkedTo) + { + _loc7_ = getUi().getElement(this._sLinkedTo); + if(_loc7_) { - elem = getUi().getElement(this._sLinkedTo); - if (elem) - { - elem.process(msg); - }; - }; - return (false); - } - - - } -}//package com.ankamagames.berilia.types.graphic - + _loc7_.process(param1); + } + } + return false; + } + } +} diff --git a/com/ankamagames/berilia/types/graphic/ChatTextContainer.as b/com/ankamagames/berilia/types/graphic/ChatTextContainer.as index cc16f56f3..30ddf4ea4 100644 --- a/com/ankamagames/berilia/types/graphic/ChatTextContainer.as +++ b/com/ankamagames/berilia/types/graphic/ChatTextContainer.as @@ -1,11 +1,13 @@ -package com.ankamagames.berilia.types.graphic +package com.ankamagames.berilia.types.graphic { - import flash.display.Sprite; - - public class ChatTextContainer extends Sprite - { - - - } -}//package com.ankamagames.berilia.types.graphic - + import flash.display.Sprite; + + public class ChatTextContainer extends Sprite + { + + public function ChatTextContainer() + { + super(); + } + } +} diff --git a/com/ankamagames/berilia/types/graphic/GraphicContainer.as b/com/ankamagames/berilia/types/graphic/GraphicContainer.as index 7a2aaac0b..3412aeee4 100644 --- a/com/ankamagames/berilia/types/graphic/GraphicContainer.as +++ b/com/ankamagames/berilia/types/graphic/GraphicContainer.as @@ -1,948 +1,978 @@ -package com.ankamagames.berilia.types.graphic +package com.ankamagames.berilia.types.graphic { - import flash.display.Sprite; - import com.ankamagames.berilia.UIComponent; - import com.ankamagames.jerakine.interfaces.IRectangle; - import com.ankamagames.jerakine.pools.Poolable; - import com.ankamagames.jerakine.interfaces.IDragAndDropHandler; - import com.ankamagames.jerakine.interfaces.ICustomUnicNameGetter; - import flash.utils.Dictionary; - import com.ankamagames.jerakine.logger.Logger; - import com.ankamagames.jerakine.logger.Log; - import flash.utils.getQualifiedClassName; - import flash.filters.DropShadowFilter; - import flash.display.Shape; - import com.ankamagames.jerakine.utils.benchmark.monitoring.FpsManager; - import com.ankamagames.jerakine.handlers.FocusHandler; - import com.ankamagames.berilia.Berilia; - import flash.filters.BitmapFilterQuality; - import flash.display.DisplayObject; - import flash.geom.ColorTransform; - import flash.display.DisplayObjectContainer; - import com.ankamagames.jerakine.handlers.messages.mouse.MouseClickMessage; - import com.ankamagames.jerakine.pools.GenericPool; - import com.ankamagames.jerakine.messages.Message; - import flash.geom.Rectangle; - import com.ankamagames.berilia.managers.SecureCenter; - import com.ankamagames.jerakine.utils.display.StageShareManager; - import com.ankamagames.jerakine.utils.display.EnterFrameDispatcher; - import gs.TweenLite; - import gs.easing.Strong; - import flash.geom.Point; - import flash.display.MovieClip; - import com.ankamagames.tiphon.display.TiphonSprite; - import flash.events.Event; - import com.ankamagames.jerakine.handlers.messages.mouse.MouseOutMessage; - import com.ankamagames.jerakine.handlers.messages.mouse.MouseOverMessage; - import com.ankamagames.berilia.components.messages.ItemRollOverMessage; - import com.ankamagames.berilia.components.messages.ItemRollOutMessage; - - public class GraphicContainer extends Sprite implements UIComponent, IRectangle, Poolable, IDragAndDropHandler, ICustomUnicNameGetter - { - - public static var MEMORY_LOG:Dictionary = new Dictionary(true); - protected static const _log:Logger = Log.getLogger(getQualifiedClassName(GraphicContainer)); - - protected var __width:uint; - protected var __widthReal:uint; - protected var __height:uint; - protected var __heightReal:uint; - protected var __removed:Boolean; - protected var _bgColor:int = -1; - protected var _bgAlpha:Number = 1; - protected var _borderColor:int = -1; - protected var _bgCornerRadius:uint = 0; - protected var _aStrata:Array; - private var _scale:Number = 1; - private var _sLinkedTo:String; - private var _bDynamicPosition:Boolean; - private var _bDisabled:Boolean; - private var _bSoftDisabled:Boolean; - private var _bGreyedOut:Boolean; - private var _shadow:DropShadowFilter; - private var _luminosity:Number = 1; - private var _nMouseX:int; - private var _nMouseY:int; - private var _nStartWidth:int; - private var _nStartHeight:int; - private var _nLastWidth:int; - private var _nLastHeight:int; - private var _shResizeBorder:Shape; - private var _bUseSimpleResize:Boolean = true; - var _uiRootContainer:UiRootContainer; - private var _dropValidatorFunction:Function; - private var _processDropFunction:Function; - private var _removeDropSourceFunction:Function; - private var _startSlideTime:int; - private var _timeSlide:int; - private var _slideBaseX:int; - private var _slideBaseY:int; - private var _slideWidth:int; - private var _slideHeight:int; - public var minSize:GraphicSize; - public var maxSize:GraphicSize; - private var _customName:String; - - public function GraphicContainer() - { - this._dropValidatorFunction = this.defaultDropValidatorFunction; - this._processDropFunction = this.defaultProcessDropFunction; - this._removeDropSourceFunction = this.defaultRemoveDropSourceFunction; - super(); - this._aStrata = new Array(); - focusRect = false; - this.mouseEnabled = false; - FpsManager.getInstance().watchObject(this); - doubleClickEnabled = true; - } - - public function get customUnicName():String - { - if (!(this._customName)) - { - if (this.getUi()) - { - if (name.indexOf((this.getUi().name + "::")) == 0) - { - this._customName = name; - } - else - { - this._customName = ((this.getUi().name + "::") + name); - }; - }; - }; - return (this._customName); - } - - [NoReplaceInFakeClass] - public function set dropValidator(dv:Function):void - { - this._dropValidatorFunction = dv; - } - - [NoReplaceInFakeClass] - public function get dropValidator():Function - { - return (this._dropValidatorFunction); - } - - [NoReplaceInFakeClass] - public function set removeDropSource(rds:Function):void - { - this._removeDropSourceFunction = rds; - } - - [NoReplaceInFakeClass] - public function get removeDropSource():Function - { - return (this._removeDropSourceFunction); - } - - [NoReplaceInFakeClass] - public function set processDrop(pd:Function):void - { - this._processDropFunction = pd; - } - - [NoReplaceInFakeClass] - public function get processDrop():Function - { - return (this._processDropFunction); - } - - public function focus():void - { - FocusHandler.getInstance().setFocus(this); - } - - public function get hasFocus():Boolean - { - return (FocusHandler.getInstance().hasFocus(this)); - } - - public function get scale():Number - { - return (this._scale); - } - - public function set scale(nScale:Number):void - { - this.__width = (this.__widthReal * (1 - nScale)); - this.__height = (this.__heightReal * (1 - nScale)); - scaleX = nScale; - scaleY = nScale; - this._scale = nScale; - } - - override public function set width(nW:Number):void - { - var ge:GraphicElement; - if (nW < 1) - { - this.__width = 1; + import flash.display.Sprite; + import com.ankamagames.berilia.UIComponent; + import com.ankamagames.jerakine.interfaces.IRectangle; + import com.ankamagames.jerakine.pools.Poolable; + import com.ankamagames.jerakine.interfaces.IDragAndDropHandler; + import com.ankamagames.jerakine.interfaces.ICustomUnicNameGetter; + import flash.utils.Dictionary; + import com.ankamagames.jerakine.logger.Logger; + import com.ankamagames.jerakine.logger.Log; + import flash.utils.getQualifiedClassName; + import flash.filters.DropShadowFilter; + import flash.display.Shape; + import com.ankamagames.jerakine.handlers.FocusHandler; + import com.ankamagames.berilia.Berilia; + import flash.filters.BitmapFilterQuality; + import flash.display.DisplayObject; + import flash.geom.ColorTransform; + import flash.display.DisplayObjectContainer; + import com.ankamagames.jerakine.messages.Message; + import com.ankamagames.jerakine.handlers.messages.mouse.MouseClickMessage; + import com.ankamagames.jerakine.pools.GenericPool; + import flash.geom.Rectangle; + import com.ankamagames.berilia.managers.SecureCenter; + import com.ankamagames.jerakine.utils.display.StageShareManager; + import com.ankamagames.jerakine.utils.display.EnterFrameDispatcher; + import gs.TweenLite; + import gs.easing.Strong; + import flash.geom.Point; + import flash.display.MovieClip; + import com.ankamagames.tiphon.display.TiphonSprite; + import flash.events.Event; + import com.ankamagames.berilia.components.messages.ItemRollOutMessage; + import com.ankamagames.berilia.components.messages.ItemRollOverMessage; + import com.ankamagames.jerakine.handlers.messages.mouse.MouseOverMessage; + import com.ankamagames.jerakine.handlers.messages.mouse.MouseOutMessage; + import com.ankamagames.jerakine.utils.benchmark.monitoring.FpsManager; + + public class GraphicContainer extends Sprite implements UIComponent, IRectangle, Poolable, IDragAndDropHandler, ICustomUnicNameGetter + { + + public function GraphicContainer() + { + this._dropValidatorFunction = this.defaultDropValidatorFunction; + this._processDropFunction = this.defaultProcessDropFunction; + this._removeDropSourceFunction = this.defaultRemoveDropSourceFunction; + super(); + this._aStrata = new Array(); + focusRect = false; + this.mouseEnabled = false; + FpsManager.getInstance().watchObject(this); + doubleClickEnabled = true; + } + + public static var MEMORY_LOG:Dictionary = new Dictionary(true); + + protected static const _log:Logger = Log.getLogger(getQualifiedClassName(GraphicContainer)); + + protected var __width:uint; + + protected var __widthReal:uint; + + protected var __height:uint; + + protected var __heightReal:uint; + + protected var __removed:Boolean; + + protected var _bgColor:int = -1; + + protected var _bgAlpha:Number = 1; + + protected var _borderColor:int = -1; + + protected var _bgCornerRadius:uint = 0; + + protected var _aStrata:Array; + + private var _scale:Number = 1.0; + + private var _sLinkedTo:String; + + private var _bDynamicPosition:Boolean; + + private var _bDisabled:Boolean; + + private var _bSoftDisabled:Boolean; + + private var _bGreyedOut:Boolean; + + private var _shadow:DropShadowFilter; + + private var _luminosity:Number = 1.0; + + private var _nMouseX:int; + + private var _nMouseY:int; + + private var _nStartWidth:int; + + private var _nStartHeight:int; + + private var _nLastWidth:int; + + private var _nLastHeight:int; + + private var _shResizeBorder:Shape; + + private var _bUseSimpleResize:Boolean = true; + + var _uiRootContainer:UiRootContainer; + + private var _dropValidatorFunction:Function; + + private var _processDropFunction:Function; + + private var _removeDropSourceFunction:Function; + + private var _startSlideTime:int; + + private var _timeSlide:int; + + private var _slideBaseX:int; + + private var _slideBaseY:int; + + private var _slideWidth:int; + + private var _slideHeight:int; + + public var minSize:GraphicSize; + + public var maxSize:GraphicSize; + + private var _customName:String; + + public function get customUnicName() : String + { + if(!this._customName) + { + if(this.getUi()) + { + if(name.indexOf(this.getUi().name + "::") == 0) + { + this._customName = name; + } + else + { + this._customName = this.getUi().name + "::" + name; + } } - else - { - this.__width = nW; - }; - if (this._bgColor != -1) - { - this.bgColor = this._bgColor; - }; - this.__widthReal = this.__width; - var ui:UiRootContainer = this.getUi(); - if (ui) + } + return this._customName; + } + + public function set dropValidator(param1:Function) : void + { + this._dropValidatorFunction = param1; + } + + public function get dropValidator() : Function + { + return this._dropValidatorFunction; + } + + public function set removeDropSource(param1:Function) : void + { + this._removeDropSourceFunction = param1; + } + + public function get removeDropSource() : Function + { + return this._removeDropSourceFunction; + } + + public function set processDrop(param1:Function) : void + { + this._processDropFunction = param1; + } + + public function get processDrop() : Function + { + return this._processDropFunction; + } + + public function focus() : void + { + FocusHandler.getInstance().setFocus(this); + } + + public function get hasFocus() : Boolean + { + return FocusHandler.getInstance().hasFocus(this); + } + + public function get scale() : Number + { + return this._scale; + } + + public function set scale(param1:Number) : void + { + this.__width = this.__widthReal * (1 - param1); + this.__height = this.__heightReal * (1 - param1); + scaleX = param1; + scaleY = param1; + this._scale = param1; + } + + override public function set width(param1:Number) : void + { + var _loc3_:GraphicElement = null; + if(param1 < 1) + { + this.__width = 1; + } + else + { + this.__width = param1; + } + if(this._bgColor != -1) + { + this.bgColor = this._bgColor; + } + this.__widthReal = this.__width; + var _loc2_:UiRootContainer = this.getUi(); + if(_loc2_) + { + _loc3_ = _loc2_.getElementById(name); + if((_loc3_) && (_loc2_.ready)) + { + _loc3_.size.setX(param1,_loc3_.size.xUnit); + } + _loc2_.updateLinkedUi(); + } + } + + override public function set height(param1:Number) : void + { + var _loc3_:GraphicElement = null; + if(param1 < 1) + { + this.__height = 1; + } + else + { + this.__height = param1; + } + if(this._bgColor != -1) + { + this.bgColor = this._bgColor; + } + this.__heightReal = this.__height; + var _loc2_:UiRootContainer = this.getUi(); + if(_loc2_) + { + _loc3_ = _loc2_.getElementById(name); + if((_loc3_) && (_loc2_.ready)) + { + _loc3_.size.setY(param1,_loc3_.size.yUnit); + } + _loc2_.updateLinkedUi(); + } + } + + override public function get width() : Number + { + if((isNaN(this.__width)) || !this.__width) + { + return this.getBounds(this).width * scaleX; + } + return this.__width * scaleX; + } + + override public function get height() : Number + { + if((isNaN(this.__height)) || !this.__height) + { + return this.getBounds(this).height * scaleY; + } + return this.__height * scaleY; + } + + public function get contentWidth() : Number + { + return super.width; + } + + public function get contentHeight() : Number + { + return super.height; + } + + override public function set x(param1:Number) : void + { + var _loc3_:GraphicElement = null; + super.x = param1; + var _loc2_:UiRootContainer = this.getUi(); + if(_loc2_) + { + _loc3_ = _loc2_.getElementById(name); + if((_loc3_) && (_loc2_.ready)) + { + _loc3_.location.setOffsetX(param1); + } + _loc2_.updateLinkedUi(); + } + } + + override public function set y(param1:Number) : void + { + var _loc3_:GraphicElement = null; + super.y = param1; + var _loc2_:UiRootContainer = this.getUi(); + if(_loc2_) + { + _loc3_ = _loc2_.getElementById(name); + if((_loc3_) && (_loc2_.ready)) + { + _loc3_.location.setOffsetY(param1); + } + _loc2_.updateLinkedUi(); + } + } + + public function get anchorY() : Number + { + var _loc2_:GraphicElement = null; + var _loc1_:UiRootContainer = this.getUi(); + if(_loc1_) + { + _loc2_ = _loc1_.getElementById(name); + if((_loc2_) && (_loc1_.ready)) + { + return _loc2_.location.getOffsetY(); + } + } + return NaN; + } + + public function get anchorX() : Number + { + var _loc2_:GraphicElement = null; + var _loc1_:UiRootContainer = this.getUi(); + if(_loc1_) + { + _loc2_ = _loc1_.getElementById(name); + if((_loc2_) && (_loc1_.ready)) + { + return _loc2_.location.getOffsetX(); + } + } + return NaN; + } + + public function set bgColor(param1:int) : void + { + this._bgColor = param1; + graphics.clear(); + if(this.bgColor == -1 || !this.width || !this.height) + { + return; + } + if(this._borderColor != -1) + { + graphics.lineStyle(1,this._borderColor); + } + graphics.beginFill(param1,this._bgAlpha); + if(!this._bgCornerRadius) + { + graphics.drawRect(0,0,this.width,this.height); + } + else + { + graphics.drawRoundRect(0,0,this.width,this.height,this._bgCornerRadius,this._bgCornerRadius); + } + graphics.endFill(); + } + + public function get bgColor() : int + { + return this._bgColor; + } + + public function set bgAlpha(param1:Number) : void + { + this._bgAlpha = param1; + this.bgColor = this.bgColor; + } + + public function get bgAlpha() : Number + { + return this._bgAlpha; + } + + public function set borderColor(param1:int) : void + { + this._borderColor = param1; + this.bgColor = this.bgColor; + } + + public function get borderColor() : int + { + return this._borderColor; + } + + public function set bgCornerRadius(param1:uint) : void + { + this._bgCornerRadius = param1; + this.bgColor = this.bgColor; + } + + public function get bgCornerRadius() : uint + { + return this._bgCornerRadius; + } + + public function set luminosity(param1:Number) : void + { + this._luminosity = param1; + } + + public function get luminosity() : Number + { + return this._luminosity; + } + + public function set linkedTo(param1:String) : void + { + this._sLinkedTo = param1; + } + + public function get linkedTo() : String + { + return this._sLinkedTo; + } + + public function set shadowColor(param1:int) : void + { + if(Berilia.getInstance().options.uiShadows) + { + if(param1 >= 0) + { + this._shadow = new DropShadowFilter(3,90,param1,1,10,10,0.61,BitmapFilterQuality.HIGH); + filters = [this._shadow]; + } + else if(param1 == -1 && (this._shadow)) { - ge = ui.getElementById(name); - if (((ge) && (ui.ready))) - { - ge.size.setX(nW, ge.size.xUnit); - }; - ui.updateLinkedUi(); - }; - } - - override public function set height(nH:Number):void - { - var ge:GraphicElement; - if (nH < 1) + this._shadow = null; + filters = []; + } + + } + } + + public function get shadowColor() : int + { + return this._shadow?this._shadow.color:-1; + } + + public function get topParent() : DisplayObject + { + return this.getTopParent(this); + } + + public function setAdvancedGlow(param1:uint, param2:Number = 1, param3:Number = 6.0, param4:Number = 6.0, param5:Number = 2) : void + { + } + + public function clearFilters() : void + { + filters = []; + } + + public function getStrata(param1:uint) : Sprite + { + var _loc2_:uint = 0; + var _loc3_:uint = 0; + if(this._aStrata[param1] != null) + { + return this._aStrata[param1]; + } + this._aStrata[param1] = new Sprite(); + this._aStrata[param1].name = "strata_" + param1; + this._aStrata[param1].mouseEnabled = false; + this._aStrata[param1].doubleClickEnabled = true; + _loc2_ = 0; + _loc3_ = 0; + while(_loc3_ < this._aStrata.length) + { + if(this._aStrata[_loc3_] != null) + { + addChildAt(this._aStrata[_loc3_],_loc2_++); + } + _loc3_++; + } + return this._aStrata[param1]; + } + + public function set dynamicPosition(param1:Boolean) : void + { + this._bDynamicPosition = param1; + } + + public function get dynamicPosition() : Boolean + { + return this._bDynamicPosition; + } + + public function set disabled(param1:Boolean) : void + { + if(param1) + { + transform.colorTransform = new ColorTransform(0.6,0.6,0.6,1); + this.handCursor = false; + this.mouseEnabled = false; + mouseChildren = false; + } + else + { + if(!this.greyedOut) { - this.__height = 1; + transform.colorTransform = new ColorTransform(1,1,1,1); + } + this.handCursor = true; + this.mouseEnabled = true; + mouseChildren = true; + } + this._bDisabled = param1; + } + + public function get disabled() : Boolean + { + return this._bDisabled; + } + + public function set softDisabled(param1:Boolean) : void + { + if(this._bSoftDisabled != param1) + { + if(param1) + { + transform.colorTransform = new ColorTransform(0.6,0.6,0.6,1); } else { - this.__height = nH; - }; - if (this._bgColor != -1) - { - this.bgColor = this._bgColor; - }; - this.__heightReal = this.__height; - var ui:UiRootContainer = this.getUi(); - if (ui) - { - ge = ui.getElementById(name); - if (((ge) && (ui.ready))) - { - ge.size.setY(nH, ge.size.yUnit); - }; - ui.updateLinkedUi(); - }; - } - - override public function get width():Number - { - if (((isNaN(this.__width)) || (!(this.__width)))) - { - return ((this.getBounds(this).width * scaleX)); - }; - return ((this.__width * scaleX)); - } - - override public function get height():Number - { - if (((isNaN(this.__height)) || (!(this.__height)))) - { - return ((this.getBounds(this).height * scaleY)); - }; - return ((this.__height * scaleY)); - } - - public function get contentWidth():Number - { - return (super.width); - } - - public function get contentHeight():Number - { - return (super.height); - } - - override public function set x(value:Number):void - { - var ge:GraphicElement; - super.x = value; - var ui:UiRootContainer = this.getUi(); - if (ui) - { - ge = ui.getElementById(name); - if (((ge) && (ui.ready))) - { - ge.location.setOffsetX(value); - }; - ui.updateLinkedUi(); - }; - } - - override public function set y(value:Number):void - { - var ge:GraphicElement; - super.y = value; - var ui:UiRootContainer = this.getUi(); - if (ui) - { - ge = ui.getElementById(name); - if (((ge) && (ui.ready))) - { - ge.location.setOffsetY(value); - }; - ui.updateLinkedUi(); - }; - } - - public function get anchorY():Number - { - var ge:GraphicElement; - var ui:UiRootContainer = this.getUi(); - if (ui) - { - ge = ui.getElementById(name); - if (((ge) && (ui.ready))) - { - return (ge.location.getOffsetY()); - }; - }; - return (NaN); - } - - public function get anchorX():Number - { - var ge:GraphicElement; - var ui:UiRootContainer = this.getUi(); - if (ui) - { - ge = ui.getElementById(name); - if (((ge) && (ui.ready))) - { - return (ge.location.getOffsetX()); - }; - }; - return (NaN); - } - - public function set bgColor(nColor:int):void - { - this._bgColor = nColor; - graphics.clear(); - if ((((((this.bgColor == -1)) || (!(this.width)))) || (!(this.height)))) - { - return; - }; - if (this._borderColor != -1) + transform.colorTransform = new ColorTransform(1,1,1,1); + } + } + this._bSoftDisabled = param1; + } + + public function get softDisabled() : Boolean + { + return this._bSoftDisabled; + } + + public function set greyedOut(param1:Boolean) : void + { + if(this._bGreyedOut != param1) + { + if(param1) + { + transform.colorTransform = new ColorTransform(0.6,0.6,0.6,1); + } + else if(!this.disabled) { - graphics.lineStyle(1, this._borderColor); - }; - graphics.beginFill(nColor, this._bgAlpha); - if (!(this._bgCornerRadius)) + transform.colorTransform = new ColorTransform(1,1,1,1); + } + + } + this._bGreyedOut = param1; + } + + public function get greyedOut() : Boolean + { + return this._bGreyedOut; + } + + public function get depths() : Array + { + var _loc1_:Array = new Array(); + var _loc2_:GraphicContainer = this; + while(_loc2_.getParent() != null) + { + _loc1_.unshift(_loc2_.getParent()); + _loc2_ = _loc2_.getParent(); + } + return _loc1_; + } + + public function set handCursor(param1:Boolean) : void + { + this.buttonMode = param1; + this.mouseChildren = !param1; + } + + public function get handCursor() : Boolean + { + return (this.buttonMode) && !this.mouseChildren; + } + + override public function set mouseEnabled(param1:Boolean) : void + { + var _loc2_:DisplayObjectContainer = null; + super.mouseEnabled = param1; + for each(_loc2_ in this._aStrata) + { + _loc2_.mouseEnabled = param1; + } + } + + public function process(param1:Message) : Boolean + { + var _loc2_:UiRootContainer = null; + var _loc3_:MouseClickMessage = null; + if(!this.canProcessMessage(param1)) + { + return true; + } + if(param1 is MouseClickMessage && (this._sLinkedTo)) + { + _loc2_ = this.getUi(); + if(_loc2_ != null) + { + _loc3_ = GenericPool.get(MouseClickMessage,_loc2_.getElement(this._sLinkedTo),MouseClickMessage(param1).mouseEvent); + _loc2_.getElement(this._sLinkedTo).process(_loc3_); + } + } + return false; + } + + override public function stopDrag() : void + { + super.stopDrag(); + this.x = x; + this.y = y; + } + + public function getStageRect() : Rectangle + { + return this.getRect(stage); + } + + public function remove() : void + { + var _loc1_:UiRootContainer = this.getUi(); + if(_loc1_) + { + _loc1_.deleteId(name); + } + this.destroy(this); + SecureCenter.destroy(this); + if(parent) + { + parent.removeChild(this); + } + this.__removed = true; + } + + public function addContent(param1:GraphicContainer, param2:int = -1) : GraphicContainer + { + if(param2 == -1) + { + this.getStrata(0).addChild(param1); + } + else + { + this.getStrata(0).addChildAt(param1,param2); + } + return param1; + } + + public function removeFromParent() : void + { + if(parent) + { + parent.removeChild(this); + } + } + + public function getParent() : GraphicContainer + { + if(this.parent == null || this is UiRootContainer) + { + return null; + } + var _loc1_:DisplayObjectContainer = DisplayObjectContainer(this.parent); + while(!(_loc1_ is GraphicContainer)) + { + _loc1_ = DisplayObjectContainer(_loc1_.parent); + } + return GraphicContainer(_loc1_); + } + + public function getUi() : UiRootContainer + { + if(this._uiRootContainer) + { + return this._uiRootContainer; + } + if(this.parent == null) + { + return null; + } + var _loc1_:Sprite = Sprite(this.parent); + while(!(_loc1_ is UiRootContainer) && !(_loc1_ == null)) + { + if(_loc1_ is GraphicContainer && (GraphicContainer(_loc1_)._uiRootContainer)) + { + _loc1_ = GraphicContainer(_loc1_)._uiRootContainer; + } + else if(_loc1_.parent is Sprite) { - graphics.drawRect(0, 0, this.width, this.height); + _loc1_ = Sprite(_loc1_.parent); } else { - graphics.drawRoundRect(0, 0, this.width, this.height, this._bgCornerRadius, this._bgCornerRadius); - }; - graphics.endFill(); - } - - public function get bgColor():int - { - return (this._bgColor); - } - - public function set bgAlpha(nAlpha:Number):void - { - this._bgAlpha = nAlpha; - this.bgColor = this.bgColor; - } - - public function get bgAlpha():Number - { - return (this._bgAlpha); - } - - public function set borderColor(color:int):void - { - this._borderColor = color; - this.bgColor = this.bgColor; - } - - public function get borderColor():int - { - return (this._borderColor); - } - - public function set bgCornerRadius(value:uint):void - { - this._bgCornerRadius = value; - this.bgColor = this.bgColor; - } - - public function get bgCornerRadius():uint - { - return (this._bgCornerRadius); - } - - public function set luminosity(nColor:Number):void - { - this._luminosity = nColor; - } - - public function get luminosity():Number - { - return (this._luminosity); - } - - public function set linkedTo(sUiComponent:String):void - { - this._sLinkedTo = sUiComponent; - } - - public function get linkedTo():String - { - return (this._sLinkedTo); - } - - public function set shadowColor(nColor:int):void - { - if (Berilia.getInstance().options.uiShadows) - { - if (nColor >= 0) - { - this._shadow = new DropShadowFilter(3, 90, nColor, 1, 10, 10, 0.61, BitmapFilterQuality.HIGH); - filters = [this._shadow]; - } - else - { - if ((((nColor == -1)) && (this._shadow))) - { - this._shadow = null; - filters = []; - }; - }; - }; - } - - public function get shadowColor():int - { - return (((this._shadow) ? this._shadow.color : -1)); - } - - public function get topParent():DisplayObject - { - return (this.getTopParent(this)); - } - - public function setAdvancedGlow(nColor:uint, nAlpha:Number=1, nBlurX:Number=6, nBlurY:Number=6, nStrength:Number=2):void - { - } - - public function clearFilters():void - { - filters = []; - } - - [NoReplaceInFakeClass] - public function getStrata(nStrata:uint):Sprite - { - var _local_2:uint; - var _local_3:uint; - if (this._aStrata[nStrata] != null) - { - return (this._aStrata[nStrata]); - }; - this._aStrata[nStrata] = new Sprite(); - this._aStrata[nStrata].name = ("strata_" + nStrata); - this._aStrata[nStrata].mouseEnabled = false; - this._aStrata[nStrata].doubleClickEnabled = true; - _local_2 = 0; - _local_3 = 0; - while (_local_3 < this._aStrata.length) - { - if (this._aStrata[_local_3] != null) - { - addChildAt(this._aStrata[_local_3], _local_2++); - }; - _local_3++; - }; - return (this._aStrata[nStrata]); - } - - public function set dynamicPosition(bool:Boolean):void - { - this._bDynamicPosition = bool; - } - - public function get dynamicPosition():Boolean - { - return (this._bDynamicPosition); - } - - public function set disabled(bool:Boolean):void - { - if (bool) - { - transform.colorTransform = new ColorTransform(0.6, 0.6, 0.6, 1); - this.handCursor = false; - this.mouseEnabled = false; - mouseChildren = false; + _loc1_ = null; + } + + } + if(_loc1_ == null) + { + return null; + } + this._uiRootContainer = UiRootContainer(_loc1_); + return UiRootContainer(_loc1_); + } + + public function setUi(param1:UiRootContainer, param2:Object) : void + { + if(param2 != SecureCenter.ACCESS_KEY) + { + throw new SecurityError(); + } + else + { + this._uiRootContainer = param1; + return; + } + } + + public function getTopParent(param1:DisplayObject) : DisplayObject + { + if(param1.parent != null) + { + return this.getTopParent(param1.parent); + } + return param1; + } + + public function startResize() : void + { + this._nMouseX = StageShareManager.mouseX; + this._nMouseY = StageShareManager.mouseY; + this._nStartWidth = this.width; + this._nStartHeight = this.height; + if(this._bUseSimpleResize) + { + this._shResizeBorder = new Shape(); + addChild(this._shResizeBorder); + } + this.getUi().removeFromRenderList(name); + EnterFrameDispatcher.addEventListener(this.onEnterFrame,"GraphicContainer"); + } + + public function endResize() : void + { + EnterFrameDispatcher.removeEventListener(this.onEnterFrame); + if(this._bUseSimpleResize) + { + this.getUi().render(); + if((this._shResizeBorder) && (this._shResizeBorder.parent)) + { + this._shResizeBorder.parent.removeChild(this._shResizeBorder); + } + } + } + + public function slide(param1:int, param2:int, param3:int) : void + { + TweenLite.to(this,param3 / 1000,{ + "x":param1, + "y":param2, + "ease":Strong.easeOut + }); + } + + private function defaultDropValidatorFunction(param1:*, param2:*, param3:*) : Boolean + { + var _loc4_:DisplayObject = this; + do + { + _loc4_ = _loc4_.parent; + } + while(!(_loc4_ is IDragAndDropHandler) && (_loc4_.parent)); + + if(_loc4_ is IDragAndDropHandler) + { + return (_loc4_ as IDragAndDropHandler).dropValidator(param1,param2,param3); + } + return false; + } + + private function defaultProcessDropFunction(param1:*, param2:*, param3:*) : void + { + var _loc4_:DisplayObject = this; + do + { + _loc4_ = _loc4_.parent; + } + while(!(_loc4_ is IDragAndDropHandler) && (_loc4_.parent)); + + if(_loc4_ is IDragAndDropHandler) + { + (_loc4_ as IDragAndDropHandler).processDrop(param1,param2,param3); + } + } + + private function defaultRemoveDropSourceFunction(param1:*) : void + { + var _loc2_:DisplayObject = this; + do + { + _loc2_ = _loc2_.parent; + } + while(!(_loc2_ is IDragAndDropHandler) && (_loc2_.parent)); + + if(_loc2_ is IDragAndDropHandler) + { + (_loc2_ as IDragAndDropHandler).removeDropSource(param1); + } + } + + override public function localToGlobal(param1:Point) : Point + { + var _loc2_:DisplayObject = this; + var _loc3_:Point = param1; + while((_loc2_) && (_loc2_.parent)) + { + _loc3_.x = _loc3_.x + _loc2_.parent.x; + _loc3_.y = _loc3_.y + _loc2_.parent.y; + _loc2_ = _loc2_.parent; + } + return _loc3_; + } + + protected function destroy(param1:DisplayObjectContainer) : void + { + var _loc2_:DisplayObject = null; + if(!param1 || param1 is MovieClip && MovieClip(param1).totalFrames > 1) + { + return; + } + var _loc3_:uint = 0; + var _loc4_:int = param1.numChildren; + while(param1.numChildren) + { + _loc2_ = param1.removeChildAt(0); + if(_loc2_ is TiphonSprite) + { + (_loc2_ as TiphonSprite).destroy(); } else { - if (!(this.greyedOut)) - { - transform.colorTransform = new ColorTransform(1, 1, 1, 1); - }; - this.handCursor = true; - this.mouseEnabled = true; - mouseChildren = true; - }; - this._bDisabled = bool; - } - - public function get disabled():Boolean - { - return (this._bDisabled); - } - - public function set softDisabled(bool:Boolean):void - { - if (this._bSoftDisabled != bool) - { - if (bool) - { - transform.colorTransform = new ColorTransform(0.6, 0.6, 0.6, 1); - } - else - { - transform.colorTransform = new ColorTransform(1, 1, 1, 1); - }; - }; - this._bSoftDisabled = bool; - } - - public function get softDisabled():Boolean - { - return (this._bSoftDisabled); - } - - public function set greyedOut(bool:Boolean):void - { - if (this._bGreyedOut != bool) - { - if (bool) - { - transform.colorTransform = new ColorTransform(0.6, 0.6, 0.6, 1); - } - else - { - if (!(this.disabled)) - { - transform.colorTransform = new ColorTransform(1, 1, 1, 1); - }; - }; - }; - this._bGreyedOut = bool; - } - - public function get greyedOut():Boolean - { - return (this._bGreyedOut); - } - - public function get depths():Array - { - var aDepth:Array = new Array(); - var doParent:GraphicContainer = this; - while (doParent.getParent() != null) - { - aDepth.unshift(doParent.getParent()); - doParent = doParent.getParent(); - }; - return (aDepth); - } - - public function set handCursor(bValue:Boolean):void - { - this.buttonMode = bValue; - this.mouseChildren = !(bValue); - } - - public function get handCursor():Boolean - { - return (((this.buttonMode) && (!(this.mouseChildren)))); - } - - override public function set mouseEnabled(v:Boolean):void - { - var ctr:DisplayObjectContainer; - super.mouseEnabled = v; - for each (ctr in this._aStrata) - { - ctr.mouseEnabled = v; - }; - } - - [HideInFakeClass] - public function process(msg:Message):Boolean - { - var ui:UiRootContainer; - var newMsg:MouseClickMessage; - if (!(this.canProcessMessage(msg))) - { - return (true); - }; - if ((((msg is MouseClickMessage)) && (this._sLinkedTo))) - { - ui = this.getUi(); - if (ui != null) - { - newMsg = GenericPool.get(MouseClickMessage, ui.getElement(this._sLinkedTo), MouseClickMessage(msg).mouseEvent); - ui.getElement(this._sLinkedTo).process(newMsg); - }; - }; - return (false); - } - - override public function stopDrag():void - { - super.stopDrag(); - this.x = x; - this.y = y; - } - - public function getStageRect():Rectangle - { - return (this.getRect(stage)); - } - - public function remove():void - { - var ui:UiRootContainer = this.getUi(); - if (ui) + if(_loc2_ is GraphicContainer) + { + (_loc2_ as GraphicContainer).remove(); + } + if(_loc2_ is DisplayObjectContainer) + { + this.destroy(_loc2_ as DisplayObjectContainer); + } + } + } + } + + public function free() : void + { + this.__width = 0; + this.__widthReal = 0; + this.__height = 0; + this.__heightReal = 0; + this.__removed = false; + this._bgColor = -1; + this._bgAlpha = 1; + this.minSize = null; + this.maxSize = null; + this._scale = 1; + this._sLinkedTo = null; + this._bDisabled = false; + this._shadow = null; + this._luminosity = 1; + this._bgCornerRadius = 0; + this._nMouseX = 0; + this._nMouseY = 0; + this._nStartWidth = 0; + this._nStartHeight = 0; + this._nLastWidth = 0; + this._nLastHeight = 0; + this._shResizeBorder = null; + this._bUseSimpleResize = false; + this._uiRootContainer = null; + } + + override public function contains(param1:DisplayObject) : Boolean + { + return super.contains(param1); + } + + private function onEnterFrame(param1:Event) : void + { + var _loc2_:int = this._nStartWidth + StageShareManager.mouseX - this._nMouseX; + var _loc3_:int = this._nStartHeight + StageShareManager.mouseY - this._nMouseY; + if(this.minSize != null) + { + if(!isNaN(this.minSize.x) && _loc2_ < this.minSize.x) + { + _loc2_ = this.minSize.x; + } + if(!isNaN(this.minSize.y) && _loc3_ < this.minSize.y) { - ui.deleteId(name); - }; - this.destroy(this); - SecureCenter.destroy(this); - if (parent) + _loc3_ = this.minSize.y; + } + } + if(this.maxSize != null) + { + if(!isNaN(this.maxSize.x) && _loc2_ > this.maxSize.x) { - parent.removeChild(this); - }; - this.__removed = true; - } - - [NoReplaceInFakeClass] - public function addContent(child:GraphicContainer, index:int=-1):GraphicContainer - { - if (index == -1) + _loc2_ = this.maxSize.x; + } + if(!isNaN(this.maxSize.y) && _loc3_ > this.maxSize.y) { - this.getStrata(0).addChild(child); + _loc3_ = this.maxSize.y; + } + } + this.width = _loc2_; + this.height = _loc3_; + if(!(this._nLastWidth == this.width) || !(this._nLastHeight == this.height)) + { + if(this._bUseSimpleResize) + { + this._shResizeBorder.graphics.clear(); + this._shResizeBorder.graphics.beginFill(16777215,0.05); + this._shResizeBorder.graphics.lineStyle(1,0,0.2); + this._shResizeBorder.graphics.drawRect(0,0,this.width,this.height); + this._shResizeBorder.graphics.endFill(); } else { - this.getStrata(0).addChildAt(child, index); - }; - return (child); - } - - public function removeFromParent():void - { - if (parent) - { - parent.removeChild(this); - }; - } - - public function getParent():GraphicContainer - { - if ((((this.parent == null)) || ((this is UiRootContainer)))) - { - return (null); - }; - var doCurrent:DisplayObjectContainer = DisplayObjectContainer(this.parent); - while (!((doCurrent is GraphicContainer))) - { - doCurrent = DisplayObjectContainer(doCurrent.parent); - }; - return (GraphicContainer(doCurrent)); - } - - public function getUi():UiRootContainer - { - if (this._uiRootContainer) - { - return (this._uiRootContainer); - }; - if (this.parent == null) - { - return (null); - }; - var doCurrent:Sprite = Sprite(this.parent); - while (((!((doCurrent is UiRootContainer))) && (!((doCurrent == null))))) - { - if ((((doCurrent is GraphicContainer)) && (GraphicContainer(doCurrent)._uiRootContainer))) - { - doCurrent = GraphicContainer(doCurrent)._uiRootContainer; - } - else - { - if ((doCurrent.parent is Sprite)) - { - doCurrent = Sprite(doCurrent.parent); - } - else - { - doCurrent = null; - }; - }; - }; - if (doCurrent == null) - { - return (null); - }; - this._uiRootContainer = UiRootContainer(doCurrent); - return (UiRootContainer(doCurrent)); - } - - [hideInFakeClass] - public function setUi(ui:UiRootContainer, key:Object):void - { - if (key != SecureCenter.ACCESS_KEY) - { - throw (new SecurityError()); - }; - this._uiRootContainer = ui; - } - - public function getTopParent(d:DisplayObject):DisplayObject - { - if (d.parent != null) - { - return (this.getTopParent(d.parent)); - }; - return (d); - } - - public function startResize():void - { - this._nMouseX = StageShareManager.mouseX; - this._nMouseY = StageShareManager.mouseY; - this._nStartWidth = this.width; - this._nStartHeight = this.height; - if (this._bUseSimpleResize) - { - this._shResizeBorder = new Shape(); - addChild(this._shResizeBorder); - }; - this.getUi().removeFromRenderList(name); - EnterFrameDispatcher.addEventListener(this.onEnterFrame, "GraphicContainer"); - } - - public function endResize():void - { - EnterFrameDispatcher.removeEventListener(this.onEnterFrame); - if (this._bUseSimpleResize) - { - this.getUi().render(); - if (((this._shResizeBorder) && (this._shResizeBorder.parent))) - { - this._shResizeBorder.parent.removeChild(this._shResizeBorder); - }; - }; - } - - public function slide(endX:int, endY:int, time:int):void - { - TweenLite.to(this, (time / 1000), { - "x":endX, - "y":endY, - "ease":Strong.easeOut - }); - } - - private function defaultDropValidatorFunction(target:*, data:*, source:*):Boolean - { - var parent:DisplayObject = this; - do - { - parent = parent.parent; - } while (((!((parent is IDragAndDropHandler))) && (parent.parent))); - if ((parent is IDragAndDropHandler)) - { - return ((parent as IDragAndDropHandler).dropValidator(target, data, source)); - }; - return (false); - } - - private function defaultProcessDropFunction(target:*, data:*, source:*):void - { - var parent:DisplayObject = this; - do - { - parent = parent.parent; - } while (((!((parent is IDragAndDropHandler))) && (parent.parent))); - if ((parent is IDragAndDropHandler)) - { - (parent as IDragAndDropHandler).processDrop(target, data, source); - }; - } - - private function defaultRemoveDropSourceFunction(target:*):void - { - var parent:DisplayObject = this; - do - { - parent = parent.parent; - } while (((!((parent is IDragAndDropHandler))) && (parent.parent))); - if ((parent is IDragAndDropHandler)) - { - (parent as IDragAndDropHandler).removeDropSource(target); - }; - } - - override public function localToGlobal(point:Point):Point - { - var target:DisplayObject = this; - var coord:Point = point; - while (((target) && (target.parent))) - { - coord.x = (coord.x + target.parent.x); - coord.y = (coord.y + target.parent.y); - target = target.parent; - }; - return (coord); - } - - protected function destroy(target:DisplayObjectContainer):void - { - var item:DisplayObject; - if (((!(target)) || ((((target is MovieClip)) && ((MovieClip(target).totalFrames > 1)))))) - { - return; - }; - var index:uint; - var num:int = target.numChildren; - while (target.numChildren) - { - item = target.removeChildAt(0); - if ((item is TiphonSprite)) - { - (item as TiphonSprite).destroy(); - } - else - { - if ((item is GraphicContainer)) - { - (item as GraphicContainer).remove(); - }; - if ((item is DisplayObjectContainer)) - { - this.destroy((item as DisplayObjectContainer)); - }; - }; - }; - } - - public function free():void - { - this.__width = 0; - this.__widthReal = 0; - this.__height = 0; - this.__heightReal = 0; - this.__removed = false; - this._bgColor = -1; - this._bgAlpha = 1; - this.minSize = null; - this.maxSize = null; - this._scale = 1; - this._sLinkedTo = null; - this._bDisabled = false; - this._shadow = null; - this._luminosity = 1; - this._bgCornerRadius = 0; - this._nMouseX = 0; - this._nMouseY = 0; - this._nStartWidth = 0; - this._nStartHeight = 0; - this._nLastWidth = 0; - this._nLastHeight = 0; - this._shResizeBorder = null; - this._bUseSimpleResize = false; - this._uiRootContainer = null; - } - - override public function contains(child:DisplayObject):Boolean - { - return (super.contains(child)); - } - - private function onEnterFrame(e:Event):void - { - var w:int = ((this._nStartWidth + StageShareManager.mouseX) - this._nMouseX); - var h:int = ((this._nStartHeight + StageShareManager.mouseY) - this._nMouseY); - if (this.minSize != null) - { - if (((!(isNaN(this.minSize.x))) && ((w < this.minSize.x)))) - { - w = this.minSize.x; - }; - if (((!(isNaN(this.minSize.y))) && ((h < this.minSize.y)))) - { - h = this.minSize.y; - }; - }; - if (this.maxSize != null) - { - if (((!(isNaN(this.maxSize.x))) && ((w > this.maxSize.x)))) - { - w = this.maxSize.x; - }; - if (((!(isNaN(this.maxSize.y))) && ((h > this.maxSize.y)))) - { - h = this.maxSize.y; - }; - }; - this.width = w; - this.height = h; - if (((!((this._nLastWidth == this.width))) || (!((this._nLastHeight == this.height))))) - { - if (this._bUseSimpleResize) - { - this._shResizeBorder.graphics.clear(); - this._shResizeBorder.graphics.beginFill(0xFFFFFF, 0.05); - this._shResizeBorder.graphics.lineStyle(1, 0, 0.2); - this._shResizeBorder.graphics.drawRect(0, 0, this.width, this.height); - this._shResizeBorder.graphics.endFill(); - } - else - { - try - { - this.getUi().render(); - } - catch(err:Error) - { - }; - }; - this._nLastWidth = this.width; - this._nLastHeight = this.height; - }; - } - - protected function canProcessMessage(pMsg:Message):Boolean - { - if (this._bSoftDisabled) - { - if (!((((((((pMsg is ItemRollOutMessage)) || ((pMsg is ItemRollOverMessage)))) || ((pMsg is MouseOverMessage)))) || ((pMsg is MouseOutMessage))))) - { - return (false); - }; - }; - return (true); - } - - - } -}//package com.ankamagames.berilia.types.graphic - + try + { + this.getUi().render(); + } + catch(err:Error) + { + } + } + this._nLastWidth = this.width; + this._nLastHeight = this.height; + } + } + + protected function canProcessMessage(param1:Message) : Boolean + { + if(this._bSoftDisabled) + { + if(!(param1 is ItemRollOutMessage || param1 is ItemRollOverMessage || param1 is MouseOverMessage || param1 is MouseOutMessage)) + { + return false; + } + } + return true; + } + } +} diff --git a/com/ankamagames/berilia/types/graphic/GraphicElement.as b/com/ankamagames/berilia/types/graphic/GraphicElement.as index 2bd16176c..4c11f341d 100644 --- a/com/ankamagames/berilia/types/graphic/GraphicElement.as +++ b/com/ankamagames/berilia/types/graphic/GraphicElement.as @@ -1,71 +1,75 @@ -package com.ankamagames.berilia.types.graphic +package com.ankamagames.berilia.types.graphic { - import com.ankamagames.jerakine.logger.Logger; - import com.ankamagames.jerakine.logger.Log; - import flash.utils.getQualifiedClassName; - - public class GraphicElement - { - - private static var _aGEIndex:Array = new Array(); - protected static const _log:Logger = Log.getLogger(getQualifiedClassName(GraphicElement)); - - public var sprite:GraphicContainer; - public var location:GraphicLocation; - public var name:String; - public var render:Boolean = false; - public var size:GraphicSize; - public var locations:Array; - - public function GraphicElement(spSprite:GraphicContainer, aLocations:Array, sName:String) - { - this.sprite = spSprite; - if (((!((aLocations == null))) && (!((aLocations[0] == null))))) + import com.ankamagames.jerakine.logger.Logger; + import com.ankamagames.jerakine.logger.Log; + import flash.utils.getQualifiedClassName; + + public class GraphicElement extends Object + { + + public function GraphicElement(param1:GraphicContainer, param2:Array, param3:String) + { + super(); + this.sprite = param1; + if(!(param2 == null) && !(param2[0] == null)) + { + this.locations = param2; + this.location = param2[0]; + } + else + { + this.location = new GraphicLocation(); + this.locations = new Array(this.location); + } + this.name = param3; + this.size = new GraphicSize(); + } + + private static var _aGEIndex:Array = new Array(); + + protected static const _log:Logger = Log.getLogger(getQualifiedClassName(GraphicElement)); + + public static function getGraphicElement(param1:GraphicContainer, param2:Array, param3:String = null) : GraphicElement + { + var _loc4_:GraphicElement = null; + if(param3 == null || _aGEIndex[param3] == null) + { + _loc4_ = new GraphicElement(param1,param2,param3); + if(param3 != null) { - this.locations = aLocations; - this.location = aLocations[0]; + _aGEIndex[param3] = _loc4_; } - else + } + else + { + _loc4_ = _aGEIndex[param3]; + } + if(param2 != null) + { + _loc4_.locations = param2; + if(!(param2 == null) && !(param2[0] == null)) { - this.location = new GraphicLocation(); - this.locations = new Array(this.location); - }; - this.name = sName; - this.size = new GraphicSize(); - } - - public static function getGraphicElement(spSprite:GraphicContainer, aLocations:Array, sName:String=null):GraphicElement - { - var ge:GraphicElement; - if ((((sName == null)) || ((_aGEIndex[sName] == null)))) - { - ge = new (GraphicElement)(spSprite, aLocations, sName); - if (sName != null) - { - _aGEIndex[sName] = ge; - }; + _loc4_.location = param2[0]; } - else - { - ge = _aGEIndex[sName]; - }; - if (aLocations != null) - { - ge.locations = aLocations; - if (((!((aLocations == null))) && (!((aLocations[0] == null))))) - { - ge.location = aLocations[0]; - }; - }; - return (ge); - } - - public static function init():void - { - _aGEIndex = new Array(); - } - - - } -}//package com.ankamagames.berilia.types.graphic - + } + return _loc4_; + } + + public static function init() : void + { + _aGEIndex = new Array(); + } + + public var sprite:GraphicContainer; + + public var location:GraphicLocation; + + public var name:String; + + public var render:Boolean = false; + + public var size:GraphicSize; + + public var locations:Array; + } +} diff --git a/com/ankamagames/berilia/types/graphic/GraphicLocation.as b/com/ankamagames/berilia/types/graphic/GraphicLocation.as index 692740956..945bd8d72 100644 --- a/com/ankamagames/berilia/types/graphic/GraphicLocation.as +++ b/com/ankamagames/berilia/types/graphic/GraphicLocation.as @@ -1,199 +1,206 @@ -package com.ankamagames.berilia.types.graphic +package com.ankamagames.berilia.types.graphic { - import com.ankamagames.jerakine.logger.Logger; - import com.ankamagames.jerakine.logger.Log; - import flash.utils.getQualifiedClassName; - import com.ankamagames.berilia.types.LocationEnum; - import com.ankamagames.berilia.utils.errors.BeriliaXmlParsingError; - import com.ankamagames.berilia.enums.LocationTypeEnum; - import com.ankamagames.berilia.types.uiDefinition.LocationELement; - - public class GraphicLocation - { - - protected static const _log:Logger = Log.getLogger(getQualifiedClassName(GraphicLocation)); - public static const REF_PARENT:String = "$PARENT"; - public static const REF_TOP:String = "$TOP"; - public static const REF_SCREEN:String = "$SCREEN"; - public static const REF_LAST:String = "$LAST"; - - private var _nPoint:uint; - private var _nRelativePoint:uint; - private var _sRelativeTo:String; - protected var _nOffsetX:Number; - protected var _nOffsetY:Number; - public var offsetXType:uint; - public var offsetYType:uint; - - public function GraphicLocation(nPoint:Number=NaN, nRelativePoint:Number=NaN, sRelativeTo:String=null) - { - this._nOffsetX = 0; - this._nOffsetY = 0; - this._nPoint = LocationEnum.POINT_TOPLEFT; - this._nRelativePoint = LocationEnum.POINT_TOPLEFT; - this._sRelativeTo = REF_PARENT; - if (!(isNaN(nPoint))) - { - this._nPoint = nPoint; - }; - if (!(isNaN(nRelativePoint))) - { - this._nRelativePoint = nRelativePoint; - }; - if (sRelativeTo != null) - { - this._sRelativeTo = sRelativeTo; - }; - } - - public static function convertPointStringToInt(sPoint:String):uint - { - switch (sPoint) - { - case "TOPLEFT": - return (LocationEnum.POINT_TOPLEFT); - case "TOP": - return (LocationEnum.POINT_TOP); - case "TOPRIGHT": - return (LocationEnum.POINT_TOPRIGHT); - case "LEFT": - return (LocationEnum.POINT_LEFT); - case "CENTER": - return (LocationEnum.POINT_CENTER); - case "RIGHT": - return (LocationEnum.POINT_RIGHT); - case "BOTTOMLEFT": - return (LocationEnum.POINT_BOTTOMLEFT); - case "BOTTOM": - return (LocationEnum.POINT_BOTTOM); - case "BOTTOMRIGHT": - return (LocationEnum.POINT_BOTTOMRIGHT); - default: - throw (new BeriliaXmlParsingError((sPoint + " is not a valid value for a point location"))); - }; - } - - public static function convertPointIntToString(nPoint:uint):String - { - switch (nPoint) - { - case LocationEnum.POINT_TOPLEFT: - return ("TOPLEFT"); - case LocationEnum.POINT_TOP: - return ("TOP"); - case LocationEnum.POINT_TOPRIGHT: - return ("TOPRIGHT"); - case LocationEnum.POINT_LEFT: - return ("LEFT"); - case LocationEnum.POINT_CENTER: - return ("CENTER"); - case LocationEnum.POINT_RIGHT: - return ("RIGHT"); - case LocationEnum.POINT_BOTTOMLEFT: - return ("BOTTOMLEFT"); - case LocationEnum.POINT_BOTTOM: - return ("BOTTOM"); - case LocationEnum.POINT_BOTTOMRIGHT: - return ("BOTTOMRIGHT"); - default: - throw (new BeriliaXmlParsingError((nPoint + " is not a valid value for a point location"))); - }; - } - - - public function setPoint(sPoint:String):void - { - this._nPoint = convertPointStringToInt(sPoint); - } - - public function getPoint():uint - { - return (this._nPoint); - } - - public function setRelativePoint(sPoint:String):void - { - this._nRelativePoint = convertPointStringToInt(sPoint); - } - - public function getRelativePoint():uint - { - return (this._nRelativePoint); - } - - public function setRelativeTo(sPoint:String):void - { - this._sRelativeTo = sPoint; - } - - public function getRelativeTo():String - { - return (this._sRelativeTo); - } - - public function setOffsetX(nOffset:Number):void - { - if (this.offsetXType == LocationTypeEnum.LOCATION_TYPE_ABSOLUTE) - { - this._nOffsetX = Math.floor(nOffset); - } - else - { - this._nOffsetX = nOffset; - }; - } - - public function getOffsetX():Number - { - return (this._nOffsetX); - } - - public function setOffsetY(nOffset:Number):void - { - if (this.offsetYType == LocationTypeEnum.LOCATION_TYPE_ABSOLUTE) - { - this._nOffsetY = Math.floor(nOffset); - } - else - { - this._nOffsetY = nOffset; - }; - } - - public function getOffsetY():Number - { - return (this._nOffsetY); - } - - public function toString():String - { - return (((((((((("GraphicLocation [point : " + convertPointIntToString(this.getPoint())) + ", relativePoint : ") + convertPointIntToString(this.getRelativePoint())) + ", relativeTo : ") + this.getRelativeTo()) + ", offset : ") + this.getOffsetX()) + "/") + this.getOffsetY())); - } - - public function clone():GraphicLocation - { - var tmp:GraphicLocation = new GraphicLocation(this._nPoint, this._nRelativePoint, this._sRelativeTo); - tmp.offsetXType = this.offsetXType; - tmp.offsetYType = this.offsetYType; - tmp.setOffsetX(this.getOffsetX()); - tmp.setOffsetY(this.getOffsetY()); - return (tmp); - } - - public function toLocationElement():LocationELement - { - var le:LocationELement = new LocationELement(); - le.offsetXType = this.offsetXType; - le.offsetYType = this.offsetYType; - le.offsetX = this.getOffsetX(); - le.offsetY = this.getOffsetY(); - le.point = this.getPoint(); - le.relativePoint = this.getRelativePoint(); - le.relativeTo = this.getRelativeTo(); - return (le); - } - - - } -}//package com.ankamagames.berilia.types.graphic - + import com.ankamagames.jerakine.logger.Logger; + import com.ankamagames.berilia.types.LocationEnum; + import com.ankamagames.berilia.utils.errors.BeriliaXmlParsingError; + import com.ankamagames.jerakine.logger.Log; + import flash.utils.getQualifiedClassName; + import com.ankamagames.berilia.enums.LocationTypeEnum; + import com.ankamagames.berilia.types.uiDefinition.LocationELement; + + public class GraphicLocation extends Object + { + + public function GraphicLocation(param1:Number = NaN, param2:Number = NaN, param3:String = null) + { + super(); + this._nOffsetX = 0; + this._nOffsetY = 0; + this._nPoint = LocationEnum.POINT_TOPLEFT; + this._nRelativePoint = LocationEnum.POINT_TOPLEFT; + this._sRelativeTo = REF_PARENT; + if(!isNaN(param1)) + { + this._nPoint = param1; + } + if(!isNaN(param2)) + { + this._nRelativePoint = param2; + } + if(param3 != null) + { + this._sRelativeTo = param3; + } + } + + protected static const _log:Logger = Log.getLogger(getQualifiedClassName(GraphicLocation)); + + public static const REF_PARENT:String = "$PARENT"; + + public static const REF_TOP:String = "$TOP"; + + public static const REF_SCREEN:String = "$SCREEN"; + + public static const REF_LAST:String = "$LAST"; + + public static function convertPointStringToInt(param1:String) : uint + { + switch(param1) + { + case "TOPLEFT": + return LocationEnum.POINT_TOPLEFT; + case "TOP": + return LocationEnum.POINT_TOP; + case "TOPRIGHT": + return LocationEnum.POINT_TOPRIGHT; + case "LEFT": + return LocationEnum.POINT_LEFT; + case "CENTER": + return LocationEnum.POINT_CENTER; + case "RIGHT": + return LocationEnum.POINT_RIGHT; + case "BOTTOMLEFT": + return LocationEnum.POINT_BOTTOMLEFT; + case "BOTTOM": + return LocationEnum.POINT_BOTTOM; + case "BOTTOMRIGHT": + return LocationEnum.POINT_BOTTOMRIGHT; + default: + throw new BeriliaXmlParsingError(param1 + " is not a valid value for a point location"); + } + } + + public static function convertPointIntToString(param1:uint) : String + { + switch(param1) + { + case LocationEnum.POINT_TOPLEFT: + return "TOPLEFT"; + case LocationEnum.POINT_TOP: + return "TOP"; + case LocationEnum.POINT_TOPRIGHT: + return "TOPRIGHT"; + case LocationEnum.POINT_LEFT: + return "LEFT"; + case LocationEnum.POINT_CENTER: + return "CENTER"; + case LocationEnum.POINT_RIGHT: + return "RIGHT"; + case LocationEnum.POINT_BOTTOMLEFT: + return "BOTTOMLEFT"; + case LocationEnum.POINT_BOTTOM: + return "BOTTOM"; + case LocationEnum.POINT_BOTTOMRIGHT: + return "BOTTOMRIGHT"; + default: + throw new BeriliaXmlParsingError(param1 + " is not a valid value for a point location"); + } + } + + private var _nPoint:uint; + + private var _nRelativePoint:uint; + + private var _sRelativeTo:String; + + protected var _nOffsetX:Number; + + protected var _nOffsetY:Number; + + public var offsetXType:uint; + + public var offsetYType:uint; + + public function setPoint(param1:String) : void + { + this._nPoint = convertPointStringToInt(param1); + } + + public function getPoint() : uint + { + return this._nPoint; + } + + public function setRelativePoint(param1:String) : void + { + this._nRelativePoint = convertPointStringToInt(param1); + } + + public function getRelativePoint() : uint + { + return this._nRelativePoint; + } + + public function setRelativeTo(param1:String) : void + { + this._sRelativeTo = param1; + } + + public function getRelativeTo() : String + { + return this._sRelativeTo; + } + + public function setOffsetX(param1:Number) : void + { + if(this.offsetXType == LocationTypeEnum.LOCATION_TYPE_ABSOLUTE) + { + this._nOffsetX = Math.floor(param1); + } + else + { + this._nOffsetX = param1; + } + } + + public function getOffsetX() : Number + { + return this._nOffsetX; + } + + public function setOffsetY(param1:Number) : void + { + if(this.offsetYType == LocationTypeEnum.LOCATION_TYPE_ABSOLUTE) + { + this._nOffsetY = Math.floor(param1); + } + else + { + this._nOffsetY = param1; + } + } + + public function getOffsetY() : Number + { + return this._nOffsetY; + } + + public function toString() : String + { + return "GraphicLocation [point : " + convertPointIntToString(this.getPoint()) + ", relativePoint : " + convertPointIntToString(this.getRelativePoint()) + ", relativeTo : " + this.getRelativeTo() + ", offset : " + this.getOffsetX() + "/" + this.getOffsetY(); + } + + public function clone() : GraphicLocation + { + var _loc1_:GraphicLocation = new GraphicLocation(this._nPoint,this._nRelativePoint,this._sRelativeTo); + _loc1_.offsetXType = this.offsetXType; + _loc1_.offsetYType = this.offsetYType; + _loc1_.setOffsetX(this.getOffsetX()); + _loc1_.setOffsetY(this.getOffsetY()); + return _loc1_; + } + + public function toLocationElement() : LocationELement + { + var _loc1_:LocationELement = new LocationELement(); + _loc1_.offsetXType = this.offsetXType; + _loc1_.offsetYType = this.offsetYType; + _loc1_.offsetX = this.getOffsetX(); + _loc1_.offsetY = this.getOffsetY(); + _loc1_.point = this.getPoint(); + _loc1_.relativePoint = this.getRelativePoint(); + _loc1_.relativeTo = this.getRelativeTo(); + return _loc1_; + } + } +} diff --git a/com/ankamagames/berilia/types/graphic/GraphicSize.as b/com/ankamagames/berilia/types/graphic/GraphicSize.as index 695086872..7e99e0368 100644 --- a/com/ankamagames/berilia/types/graphic/GraphicSize.as +++ b/com/ankamagames/berilia/types/graphic/GraphicSize.as @@ -1,62 +1,62 @@ -package com.ankamagames.berilia.types.graphic +package com.ankamagames.berilia.types.graphic { - import flash.geom.Point; - import com.ankamagames.berilia.types.uiDefinition.SizeElement; - - public class GraphicSize extends Point - { - - public static const SIZE_PIXEL:uint = 0; - public static const SIZE_PRC:uint = 1; - - private var _nXUnit:uint; - private var _nYUnit:uint; - - public function GraphicSize() - { - x = NaN; - y = NaN; - } - - public function setX(nX:Number, nType:uint):void - { - x = nX; - this._nXUnit = nType; - } - - public function setY(nY:Number, nType:uint):void - { - y = nY; - this._nYUnit = nType; - } - - public function get xUnit():uint - { - return (this._nXUnit); - } - - public function get yUnit():uint - { - return (this._nYUnit); - } - - public function toSizeElement():SizeElement - { - var se:SizeElement = new SizeElement(); - if (!(isNaN(x))) - { - se.x = x; - se.xUnit = this._nXUnit; - }; - if (!(isNaN(y))) - { - se.y = y; - se.yUnit = this._nYUnit; - }; - return (se); - } - - - } -}//package com.ankamagames.berilia.types.graphic - + import flash.geom.Point; + import com.ankamagames.berilia.types.uiDefinition.SizeElement; + + public class GraphicSize extends Point + { + + public function GraphicSize() + { + super(); + x = NaN; + y = NaN; + } + + public static const SIZE_PIXEL:uint = 0; + + public static const SIZE_PRC:uint = 1; + + private var _nXUnit:uint; + + private var _nYUnit:uint; + + public function setX(param1:Number, param2:uint) : void + { + x = param1; + this._nXUnit = param2; + } + + public function setY(param1:Number, param2:uint) : void + { + y = param1; + this._nYUnit = param2; + } + + public function get xUnit() : uint + { + return this._nXUnit; + } + + public function get yUnit() : uint + { + return this._nYUnit; + } + + public function toSizeElement() : SizeElement + { + var _loc1_:SizeElement = new SizeElement(); + if(!isNaN(x)) + { + _loc1_.x = x; + _loc1_.xUnit = this._nXUnit; + } + if(!isNaN(y)) + { + _loc1_.y = y; + _loc1_.yUnit = this._nYUnit; + } + return _loc1_; + } + } +} diff --git a/com/ankamagames/berilia/types/graphic/InternalComponentAccess.as b/com/ankamagames/berilia/types/graphic/InternalComponentAccess.as index ee9faf1e3..4a40da2ba 100644 --- a/com/ankamagames/berilia/types/graphic/InternalComponentAccess.as +++ b/com/ankamagames/berilia/types/graphic/InternalComponentAccess.as @@ -1,22 +1,23 @@ -package com.ankamagames.berilia.types.graphic +package com.ankamagames.berilia.types.graphic { - import com.ankamagames.berilia.UIComponent; - - public class InternalComponentAccess - { - - - public static function getProperty(target:UIComponent, property:String) - { - return (target[property]); - } - - public static function setProperty(target:UIComponent, property:String, value:*):void - { - target[property] = value; - } - - - } -}//package com.ankamagames.berilia.types.graphic - + import com.ankamagames.berilia.UIComponent; + + public class InternalComponentAccess extends Object + { + + public function InternalComponentAccess() + { + super(); + } + + public static function getProperty(param1:UIComponent, param2:String) : * + { + return param1[param2]; + } + + public static function setProperty(param1:UIComponent, param2:String, param3:*) : void + { + param1[param2] = param3; + } + } +} diff --git a/com/ankamagames/berilia/types/graphic/MapAreaShape.as b/com/ankamagames/berilia/types/graphic/MapAreaShape.as index cddb34cde..9f6a6c296 100644 --- a/com/ankamagames/berilia/types/graphic/MapAreaShape.as +++ b/com/ankamagames/berilia/types/graphic/MapAreaShape.as @@ -1,139 +1,156 @@ -package com.ankamagames.berilia.types.graphic +package com.ankamagames.berilia.types.graphic { - import com.ankamagames.berilia.types.data.MapElement; - import com.ankamagames.berilia.components.Texture; - import flash.geom.ColorTransform; - import com.ankamagames.jerakine.utils.display.EnterFrameDispatcher; - import flash.utils.getTimer; - import flash.events.Event; - - public class MapAreaShape extends MapElement - { - - public var shape:Texture; - private var _lineColor:uint; - private var _fillColor:uint; - private var _duration:int; - private var _t0:int; - private var _redMultiplier:Number = 1; - private var _greenMultiplier:Number = 1; - private var _blueMultiplier:Number = 1; - private var _alphaMultiplier:Number = 0; - private var _redOffset:Number = 0; - private var _greenOffset:Number = 0; - private var _blueOffset:Number = 0; - private var _alphaOffset:Number = 0; - private var _lastRedMultiplier:Number; - private var _lastGreenMultiplier:Number; - private var _lastBlueMultiplier:Number; - private var _lastAlphaMultiplier:Number; - private var _lastRedOffset:Number; - private var _lastGreenOffset:Number; - private var _lastBlueOffset:Number; - private var _lastAlphaOffset:Number; - - public function MapAreaShape(id:String, layer:String, shape:Texture, x:int, y:int, lineColor:uint, fillColor:uint, owner:*) - { - this._lineColor = lineColor; - this._fillColor = fillColor; - super(id, x, y, layer, owner); - this.shape = shape; - shape.transform.colorTransform = new ColorTransform(1, 1, 1, 0); - } - - public function get lineColor():uint - { - return (this._lineColor); - } - - public function get fillColor():uint - { - return (this._fillColor); - } - - public function colorTransform(duration:int, rM:Number=1, gM:Number=1, bM:Number=1, aM:Number=1, rO:Number=0, gO:Number=0, bO:Number=0, aO:Number=0):void - { - this._lastAlphaMultiplier = this._alphaMultiplier; - this._lastAlphaOffset = this._alphaOffset; - this._lastBlueMultiplier = this._blueMultiplier; - this._lastBlueOffset = this._blueOffset; - this._lastGreenMultiplier = this._greenMultiplier; - this._lastGreenOffset = this._greenOffset; - this._lastRedMultiplier = this._redMultiplier; - this._lastRedOffset = this._redOffset; - this._redMultiplier = rM; - this._blueMultiplier = bM; - this._greenMultiplier = gM; - this._alphaMultiplier = aM; - this._redOffset = rO; - this._greenOffset = gO; - this._blueOffset = bO; - this._alphaOffset = aO; - this._duration = duration; - if (EnterFrameDispatcher.hasEventListener(this.onEnterFrame)) + import com.ankamagames.berilia.types.data.MapElement; + import com.ankamagames.berilia.components.Texture; + import com.ankamagames.jerakine.utils.display.EnterFrameDispatcher; + import flash.geom.ColorTransform; + import flash.utils.getTimer; + import flash.events.Event; + + public class MapAreaShape extends MapElement + { + + public function MapAreaShape(param1:String, param2:String, param3:Texture, param4:int, param5:int, param6:uint, param7:uint, param8:*) + { + this._lineColor = param6; + this._fillColor = param7; + super(param1,param4,param5,param2,param8); + this.shape = param3; + param3.transform.colorTransform = new ColorTransform(1,1,1,0); + } + + public var shape:Texture; + + private var _lineColor:uint; + + private var _fillColor:uint; + + private var _duration:int; + + private var _t0:int; + + private var _redMultiplier:Number = 1; + + private var _greenMultiplier:Number = 1; + + private var _blueMultiplier:Number = 1; + + private var _alphaMultiplier:Number = 0; + + private var _redOffset:Number = 0; + + private var _greenOffset:Number = 0; + + private var _blueOffset:Number = 0; + + private var _alphaOffset:Number = 0; + + private var _lastRedMultiplier:Number; + + private var _lastGreenMultiplier:Number; + + private var _lastBlueMultiplier:Number; + + private var _lastAlphaMultiplier:Number; + + private var _lastRedOffset:Number; + + private var _lastGreenOffset:Number; + + private var _lastBlueOffset:Number; + + private var _lastAlphaOffset:Number; + + public function get lineColor() : uint + { + return this._lineColor; + } + + public function get fillColor() : uint + { + return this._fillColor; + } + + public function colorTransform(param1:int, param2:Number = 1, param3:Number = 1, param4:Number = 1, param5:Number = 1, param6:Number = 0, param7:Number = 0, param8:Number = 0, param9:Number = 0) : void + { + this._lastAlphaMultiplier = this._alphaMultiplier; + this._lastAlphaOffset = this._alphaOffset; + this._lastBlueMultiplier = this._blueMultiplier; + this._lastBlueOffset = this._blueOffset; + this._lastGreenMultiplier = this._greenMultiplier; + this._lastGreenOffset = this._greenOffset; + this._lastRedMultiplier = this._redMultiplier; + this._lastRedOffset = this._redOffset; + this._redMultiplier = param2; + this._blueMultiplier = param4; + this._greenMultiplier = param3; + this._alphaMultiplier = param5; + this._redOffset = param6; + this._greenOffset = param7; + this._blueOffset = param8; + this._alphaOffset = param9; + this._duration = param1; + if(EnterFrameDispatcher.hasEventListener(this.onEnterFrame)) + { + EnterFrameDispatcher.removeEventListener(this.onEnterFrame); + } + if(this._alphaMultiplier != 0) + { + if(this._duration == 0) { - EnterFrameDispatcher.removeEventListener(this.onEnterFrame); - }; - if (this._alphaMultiplier != 0) - { - if (this._duration == 0) - { - this.shape.transform.colorTransform = new ColorTransform(rM, gM, bM, aM, rO, gO, bO, aO); - this.shape.visible = true; - } - else - { - this._t0 = getTimer(); - EnterFrameDispatcher.addEventListener(this.onEnterFrame, "AreaShapeColorTransform", 20); - }; + this.shape.transform.colorTransform = new ColorTransform(param2,param3,param4,param5,param6,param7,param8,param9); + this.shape.visible = true; } else { - this.shape.visible = false; - }; - } - - override public function remove():void - { - this.shape.removeEventListener("enterFrame", this.onEnterFrame); - if (this.shape.parent) + this._t0 = getTimer(); + EnterFrameDispatcher.addEventListener(this.onEnterFrame,"AreaShapeColorTransform",20); + } + } + else + { + this.shape.visible = false; + } + } + + override public function remove() : void + { + this.shape.removeEventListener("enterFrame",this.onEnterFrame); + if(this.shape.parent) + { + this.shape.parent.removeChild(this.shape); + } + this.shape = null; + super.remove(); + } + + private function onEnterFrame(param1:Event) : void + { + var _loc2_:Number = (getTimer() - this._t0) / this._duration; + if(this.shape) + { + if(_loc2_ >= 1) { - this.shape.parent.removeChild(this.shape); - }; - this.shape = null; - super.remove(); - } - - private function onEnterFrame(e:Event):void - { - var percent:Number = ((getTimer() - this._t0) / this._duration); - if (this.shape) + EnterFrameDispatcher.removeEventListener(this.onEnterFrame); + if(this._alphaMultiplier == 0) + { + this.shape.visible = false; + } + else + { + this.shape.visible = true; + } + this.shape.transform.colorTransform = new ColorTransform(this._redMultiplier,this._greenMultiplier,this._blueMultiplier,this._alphaMultiplier,this._redOffset,this._greenOffset,this._blueOffset,this._alphaOffset); + } + else { - if (percent >= 1) - { - EnterFrameDispatcher.removeEventListener(this.onEnterFrame); - if (this._alphaMultiplier == 0) - { - this.shape.visible = false; - } - else - { - this.shape.visible = true; - }; - this.shape.transform.colorTransform = new ColorTransform(this._redMultiplier, this._greenMultiplier, this._blueMultiplier, this._alphaMultiplier, this._redOffset, this._greenOffset, this._blueOffset, this._alphaOffset); - } - else - { - this.shape.transform.colorTransform = new ColorTransform((this._lastRedMultiplier + ((this._redMultiplier - this._lastRedMultiplier) * percent)), (this._lastGreenMultiplier + ((this._greenMultiplier - this._lastGreenMultiplier) * percent)), (this._lastBlueMultiplier + ((this._blueMultiplier - this._lastBlueMultiplier) * percent)), (this._lastAlphaMultiplier + ((this._alphaMultiplier - this._lastAlphaMultiplier) * percent)), (this._lastRedOffset + ((this._redOffset - this._lastRedOffset) * percent)), (this._lastGreenOffset + ((this._greenOffset - this._lastGreenOffset) * percent)), (this._lastBlueOffset + ((this._blueOffset - this._lastBlueOffset) * percent)), (this._lastAlphaOffset + ((this._alphaOffset - this._lastAlphaOffset) * percent))); - if (((!((this._alphaMultiplier == 0))) && (!(this.shape.visible)))) - { - this.shape.visible = true; - }; - }; - }; - } - - - } -}//package com.ankamagames.berilia.types.graphic - + this.shape.transform.colorTransform = new ColorTransform(this._lastRedMultiplier + (this._redMultiplier - this._lastRedMultiplier) * _loc2_,this._lastGreenMultiplier + (this._greenMultiplier - this._lastGreenMultiplier) * _loc2_,this._lastBlueMultiplier + (this._blueMultiplier - this._lastBlueMultiplier) * _loc2_,this._lastAlphaMultiplier + (this._alphaMultiplier - this._lastAlphaMultiplier) * _loc2_,this._lastRedOffset + (this._redOffset - this._lastRedOffset) * _loc2_,this._lastGreenOffset + (this._greenOffset - this._lastGreenOffset) * _loc2_,this._lastBlueOffset + (this._blueOffset - this._lastBlueOffset) * _loc2_,this._lastAlphaOffset + (this._alphaOffset - this._lastAlphaOffset) * _loc2_); + if(!(this._alphaMultiplier == 0) && !this.shape.visible) + { + this.shape.visible = true; + } + } + } + } + } +} diff --git a/com/ankamagames/berilia/types/graphic/MapGroupElement.as b/com/ankamagames/berilia/types/graphic/MapGroupElement.as index a98ab30b9..98b7d9c73 100644 --- a/com/ankamagames/berilia/types/graphic/MapGroupElement.as +++ b/com/ankamagames/berilia/types/graphic/MapGroupElement.as @@ -1,179 +1,182 @@ -package com.ankamagames.berilia.types.graphic +package com.ankamagames.berilia.types.graphic { - import flash.display.Sprite; - import flash.display.Shape; - import flash.display.DisplayObject; - import flash.geom.Point; - import flash.display.GradientType; - import gs.TweenMax; - import gs.events.TweenEvent; - - public class MapGroupElement extends Sprite - { - - private var _icons:Array; - private var _initialPos:Array; - private var _mapWidth:uint; - private var _mapHeight:uint; - private var _tween:Array; - private var _shape:Shape; - private var _open:Boolean; - - public function MapGroupElement(mapWidth:uint, mapHeight:uint) - { - this._icons = new Array(); - super(); - this._mapWidth = mapWidth; - this._mapHeight = mapHeight; - doubleClickEnabled = true; - } - - public function get opened():Boolean - { - return (this._open); - } - - public function open():void - { - var icon:DisplayObject; - var destX:Number; - var destY:Number; - var pos:Object; - var radius:uint = (this._icons.length * 5); - var center:Point = new Point(0, 0); - if (radius < ((this._mapWidth * 3) / 4)) - { - radius = ((this._mapWidth * 3) / 4); - }; - if (radius < ((this._mapHeight * 3) / 4)) - { - radius = ((this._mapHeight * 3) / 4); - }; - var tweenTime:Number = Math.min((0.1 * this._icons.length), 0.5); - if (!(this._shape)) + import flash.display.Sprite; + import flash.display.Shape; + import flash.display.DisplayObject; + import flash.geom.Point; + import flash.display.GradientType; + import gs.TweenMax; + import gs.events.TweenEvent; + + public class MapGroupElement extends Sprite + { + + public function MapGroupElement(param1:uint, param2:uint) + { + this._icons = new Array(); + super(); + this._mapWidth = param1; + this._mapHeight = param2; + doubleClickEnabled = true; + } + + private var _icons:Array; + + private var _initialPos:Array; + + private var _mapWidth:uint; + + private var _mapHeight:uint; + + private var _tween:Array; + + private var _shape:Shape; + + private var _open:Boolean; + + public function get opened() : Boolean + { + return this._open; + } + + public function open() : void + { + var _loc8_:DisplayObject = null; + var _loc9_:* = NaN; + var _loc10_:* = NaN; + var _loc11_:Object = null; + var _loc1_:uint = this._icons.length * 5; + var _loc2_:Point = new Point(0,0); + if(_loc1_ < this._mapWidth * 3 / 4) + { + _loc1_ = this._mapWidth * 3 / 4; + } + if(_loc1_ < this._mapHeight * 3 / 4) + { + _loc1_ = this._mapHeight * 3 / 4; + } + var _loc3_:Number = Math.min(0.1 * this._icons.length,0.5); + if(!this._shape) + { + this._shape = new Shape(); + } + else + { + this._shape.graphics.clear(); + } + this._shape.alpha = 0; + this._shape.graphics.beginGradientFill(GradientType.RADIAL,[16777215,16777215],[0,0.6],[0,127]); + this._shape.graphics.drawCircle(_loc2_.x,_loc2_.y,_loc1_ + 10); + this._shape.graphics.beginFill(16777215,0.3); + this._shape.graphics.drawCircle(_loc2_.x,_loc2_.y,Math.min(this._mapWidth,this._mapHeight) / 3); + super.addChildAt(this._shape,0); + this.killAllTween(); + this._tween.push(new TweenMax(this._shape,_loc3_,{"alpha":1})); + var _loc4_:* = false; + if(!this._initialPos) + { + this._initialPos = new Array(); + _loc4_ = true; + } + var _loc5_:Number = Math.PI * 2 / this._icons.length; + var _loc6_:Number = Math.PI / 2 + Math.PI / 4; + var _loc7_:int = this._icons.length - 1; + while(_loc7_ >= 0) + { + _loc8_ = this._icons[_loc7_]; + if(_loc4_) { - this._shape = new Shape(); + this._initialPos.push({ + "icon":_loc8_, + "x":_loc8_.x, + "y":_loc8_.y + }); } - else - { - this._shape.graphics.clear(); - }; - this._shape.alpha = 0; - this._shape.graphics.beginGradientFill(GradientType.RADIAL, [0xFFFFFF, 0xFFFFFF], [0, 0.6], [0, 127]); - this._shape.graphics.drawCircle(center.x, center.y, (radius + 10)); - this._shape.graphics.beginFill(0xFFFFFF, 0.3); - this._shape.graphics.drawCircle(center.x, center.y, (Math.min(this._mapWidth, this._mapHeight) / 3)); - super.addChildAt(this._shape, 0); - this.killAllTween(); - this._tween.push(new TweenMax(this._shape, tweenTime, {"alpha":1})); - var saveInitialPosition:Boolean; - if (!(this._initialPos)) - { - this._initialPos = new Array(); - saveInitialPosition = true; - }; - var step:Number = ((Math.PI * 2) / this._icons.length); - var offset:Number = ((Math.PI / 2) + (Math.PI / 4)); - var i:int = (this._icons.length - 1); - while (i >= 0) - { - icon = this._icons[i]; - if (saveInitialPosition) - { - this._initialPos.push({ - "icon":icon, - "x":icon.x, - "y":icon.y - }); - }; - destX = ((Math.cos(((step * i) + offset)) * radius) + center.x); - destY = ((Math.sin(((step * i) + offset)) * radius) + center.y); - if (icon.parent != this) - { - pos = this.getInitialPos(icon); - destX = (pos.x + destX); - destY = (pos.y + destY); - }; - this._tween.push(new TweenMax(icon, tweenTime, { - "x":destX, - "y":destY - })); - i--; - }; - this._open = true; - } - - private function getInitialPos(pIcon:Object):Object - { - var iconPos:Object; - for each (iconPos in this._initialPos) + _loc9_ = Math.cos(_loc5_ * _loc7_ + _loc6_) * _loc1_ + _loc2_.x; + _loc10_ = Math.sin(_loc5_ * _loc7_ + _loc6_) * _loc1_ + _loc2_.y; + if(_loc8_.parent != this) { - if (iconPos.icon == pIcon) - { - return (iconPos); - }; - }; - return (null); - } - - public function close():void - { - var icon:Object; - graphics.clear(); - this.killAllTween(); - this._tween.push(new TweenMax(this._shape, 0.2, { - "alpha":0, - "onCompleteListener":this.shapeTweenFinished + _loc11_ = this.getInitialPos(_loc8_); + _loc9_ = _loc11_.x + _loc9_; + _loc10_ = _loc11_.y + _loc10_; + } + this._tween.push(new TweenMax(_loc8_,_loc3_,{ + "x":_loc9_, + "y":_loc10_ })); - for each (icon in this._initialPos) - { - this._tween.push(new TweenMax(icon.icon, 0.2, { - "x":icon.x, - "y":icon.y - })); - }; - this._open = false; - } - - override public function addChild(child:DisplayObject):DisplayObject - { - super.addChild(child); - this._icons.push(child); - return (child); - } - - public function remove():void - { - while (numChildren) - { - removeChildAt(0); - }; - this._icons = null; - this.killAllTween(); - } - - private function killAllTween():void - { - var t:TweenMax; - for each (t in this._tween) + _loc7_--; + } + this._open = true; + } + + private function getInitialPos(param1:Object) : Object + { + var _loc2_:Object = null; + for each(_loc2_ in this._initialPos) + { + if(_loc2_.icon == param1) { - t.clear(); - t.gc = true; - }; - this._tween = new Array(); - } - - private function shapeTweenFinished(e:TweenEvent):void - { - this._shape.graphics.clear(); - } - - public function get icons():Array - { - return (this._icons); - } - - - } -}//package com.ankamagames.berilia.types.graphic - + return _loc2_; + } + } + return null; + } + + public function close() : void + { + var _loc1_:Object = null; + graphics.clear(); + this.killAllTween(); + this._tween.push(new TweenMax(this._shape,0.2,{ + "alpha":0, + "onCompleteListener":this.shapeTweenFinished + })); + for each(_loc1_ in this._initialPos) + { + this._tween.push(new TweenMax(_loc1_.icon,0.2,{ + "x":_loc1_.x, + "y":_loc1_.y + })); + } + this._open = false; + } + + override public function addChild(param1:DisplayObject) : DisplayObject + { + super.addChild(param1); + this._icons.push(param1); + return param1; + } + + public function remove() : void + { + while(numChildren) + { + removeChildAt(0); + } + this._icons = null; + this.killAllTween(); + } + + private function killAllTween() : void + { + var _loc1_:TweenMax = null; + for each(_loc1_ in this._tween) + { + _loc1_.clear(); + _loc1_.gc = true; + } + this._tween = new Array(); + } + + private function shapeTweenFinished(param1:TweenEvent) : void + { + this._shape.graphics.clear(); + } + + public function get icons() : Array + { + return this._icons; + } + } +} diff --git a/com/ankamagames/berilia/types/graphic/ScrollContainer.as b/com/ankamagames/berilia/types/graphic/ScrollContainer.as index e262c46f8..2942021e0 100644 --- a/com/ankamagames/berilia/types/graphic/ScrollContainer.as +++ b/com/ankamagames/berilia/types/graphic/ScrollContainer.as @@ -1,318 +1,319 @@ -package com.ankamagames.berilia.types.graphic +package com.ankamagames.berilia.types.graphic { - import com.ankamagames.berilia.FinalizableUIComponent; - import flash.display.Shape; - import flash.display.DisplayObjectContainer; - import com.ankamagames.berilia.components.ScrollBar; - import com.ankamagames.jerakine.types.Uri; - import flash.display.Sprite; - import flash.events.Event; - import com.ankamagames.berilia.types.event.UiRenderEvent; - import flash.display.DisplayObject; - import com.ankamagames.jerakine.handlers.messages.mouse.MouseWheelMessage; - import com.ankamagames.jerakine.messages.Message; - - public class ScrollContainer extends GraphicContainer implements FinalizableUIComponent - { - - private var _finalized:Boolean = false; - private var _mask:Shape; - private var _content:DisplayObjectContainer; - private var d:Shape; - private var _hScrollbar:ScrollBar; - private var _vScrollbar:ScrollBar; - private var _hScrollbarSpeed:Number = 1; - private var _vScrollbarSpeed:Number = 1; - private var _useHorizontalScroll:Boolean = true; - private var _scrollBarCss:Uri; - private var _scrollBarSize:uint = 16; - - public function ScrollContainer() - { - this.d = new Shape(); - super(); - mouseEnabled = true; - this._mask = new Shape(); - this._mask.graphics.beginFill(0xFFFF00); - this._mask.graphics.drawRect(0, 0, 1, 1); - this._content = new Sprite(); - this._content.mask = this._mask; - super.addChild(this._content); - super.addChild(this._mask); - } - - public function set finalized(b:Boolean):void - { - this._finalized = b; - } - - public function get finalized():Boolean - { - return (this._finalized); - } - - override public function set width(n:Number):void - { - super.width = n; - this._mask.width = n; - } - - override public function set height(n:Number):void - { - super.height = n; - this._mask.height = n; - } - - public function set scrollbarCss(sValue:Uri):void - { - this._scrollBarCss = sValue; - } - - public function get verticalScrollSpeed():Number - { - if (this._vScrollbar) + import com.ankamagames.berilia.FinalizableUIComponent; + import flash.display.Shape; + import flash.display.DisplayObjectContainer; + import com.ankamagames.berilia.components.ScrollBar; + import com.ankamagames.jerakine.types.Uri; + import flash.display.DisplayObject; + import flash.events.Event; + import com.ankamagames.berilia.types.event.UiRenderEvent; + import com.ankamagames.jerakine.messages.Message; + import com.ankamagames.jerakine.handlers.messages.mouse.MouseWheelMessage; + import flash.display.Sprite; + + public class ScrollContainer extends GraphicContainer implements FinalizableUIComponent + { + + public function ScrollContainer() + { + this.d = new Shape(); + super(); + mouseEnabled = true; + this._mask = new Shape(); + this._mask.graphics.beginFill(16776960); + this._mask.graphics.drawRect(0,0,1,1); + this._content = new Sprite(); + this._content.mask = this._mask; + super.addChild(this._content); + super.addChild(this._mask); + } + + private var _finalized:Boolean = false; + + private var _mask:Shape; + + private var _content:DisplayObjectContainer; + + private var d:Shape; + + private var _hScrollbar:ScrollBar; + + private var _vScrollbar:ScrollBar; + + private var _hScrollbarSpeed:Number = 1; + + private var _vScrollbarSpeed:Number = 1; + + private var _useHorizontalScroll:Boolean = true; + + private var _scrollBarCss:Uri; + + private var _scrollBarSize:uint = 16; + + public function set finalized(param1:Boolean) : void + { + this._finalized = param1; + } + + public function get finalized() : Boolean + { + return this._finalized; + } + + override public function set width(param1:Number) : void + { + super.width = param1; + this._mask.width = param1; + } + + override public function set height(param1:Number) : void + { + super.height = param1; + this._mask.height = param1; + } + + public function set scrollbarCss(param1:Uri) : void + { + this._scrollBarCss = param1; + } + + public function get verticalScrollSpeed() : Number + { + if(this._vScrollbar) + { + return this._vScrollbar.scrollSpeed; + } + return this._vScrollbarSpeed; + } + + public function set verticalScrollSpeed(param1:Number) : void + { + if(this._vScrollbar) + { + this._vScrollbar.scrollSpeed = param1; + } + this._vScrollbarSpeed = param1; + } + + public function set verticalScrollbarValue(param1:int) : void + { + if(this._vScrollbar) + { + this._vScrollbar.value = param1; + this.onVerticalScroll(null); + } + } + + public function get verticalScrollbarValue() : int + { + if(this._vScrollbar) + { + return this._vScrollbar.value; + } + return -1; + } + + public function get useHorizontalScroll() : Boolean + { + return this._useHorizontalScroll; + } + + public function set useHorizontalScroll(param1:Boolean) : void + { + this._useHorizontalScroll = param1; + } + + public function get horizontalScrollSpeed() : Number + { + if(this._hScrollbar) + { + return this._hScrollbar.scrollSpeed; + } + return this._hScrollbarSpeed; + } + + public function set horizontalScrollSpeed(param1:Number) : void + { + if(this._hScrollbar) + { + this._hScrollbar.scrollSpeed = param1; + } + this._hScrollbarSpeed = param1; + } + + public function set horizontalScrollbarValue(param1:int) : void + { + if(this._hScrollbar) + { + this._hScrollbar.value = param1; + this.onHorizontalScroll(null); + } + } + + public function get horizontalScrollbarValue() : int + { + if(this._hScrollbar) + { + return this._hScrollbar.value; + } + return -1; + } + + override public function addChild(param1:DisplayObject) : DisplayObject + { + param1.addEventListener(Event.REMOVED,this.onChildRemoved); + this.getStrata(0).addChild(param1); + this.finalize(); + param1.addEventListener(UiRenderEvent.UIRenderComplete,this.onChildFinalized); + return param1; + } + + override public function addContent(param1:GraphicContainer, param2:int = -1) : GraphicContainer + { + param1.addEventListener(Event.REMOVED,this.onChildRemoved); + this.getStrata(0).addChild(param1); + this.finalize(); + param1.addEventListener(UiRenderEvent.UIRenderComplete,this.onChildFinalized); + return param1; + } + + public function finalize() : void + { + var _loc1_:Boolean = width < Math.floor(this._content.width) && (this._useHorizontalScroll); + var _loc2_:* = height < Math.floor(this._content.height); + this._mask.height = height; + this._mask.width = width; + this._content.x = 0; + this._content.y = 0; + if(_loc1_) + { + if(!this._hScrollbar) { - return (this._vScrollbar.scrollSpeed); - }; - return (this._vScrollbarSpeed); - } - - public function set verticalScrollSpeed(speed:Number):void - { - if (this._vScrollbar) - { - this._vScrollbar.scrollSpeed = speed; - }; - this._vScrollbarSpeed = speed; - } - - public function set verticalScrollbarValue(value:int):void - { - if (this._vScrollbar) - { - this._vScrollbar.value = value; - this.onVerticalScroll(null); - }; - } - - public function get verticalScrollbarValue():int - { - if (this._vScrollbar) - { - return (this._vScrollbar.value); - }; - return (-1); - } - - public function get useHorizontalScroll():Boolean - { - return (this._useHorizontalScroll); - } - - public function set useHorizontalScroll(yes:Boolean):void - { - this._useHorizontalScroll = yes; - } - - public function get horizontalScrollSpeed():Number - { - if (this._hScrollbar) - { - return (this._hScrollbar.scrollSpeed); - }; - return (this._hScrollbarSpeed); - } - - public function set horizontalScrollSpeed(speed:Number):void - { - if (this._hScrollbar) - { - this._hScrollbar.scrollSpeed = speed; - }; - this._hScrollbarSpeed = speed; - } - - public function set horizontalScrollbarValue(value:int):void - { - if (this._hScrollbar) - { - this._hScrollbar.value = value; - this.onHorizontalScroll(null); - }; - } - - public function get horizontalScrollbarValue():int - { - if (this._hScrollbar) - { - return (this._hScrollbar.value); - }; - return (-1); - } - - override public function addChild(child:DisplayObject):DisplayObject - { - child.addEventListener(Event.REMOVED, this.onChildRemoved); - this.getStrata(0).addChild(child); - this.finalize(); - child.addEventListener(UiRenderEvent.UIRenderComplete, this.onChildFinalized); - return (child); - } - - override public function addContent(child:GraphicContainer, index:int=-1):GraphicContainer - { - child.addEventListener(Event.REMOVED, this.onChildRemoved); - this.getStrata(0).addChild(child); - this.finalize(); - child.addEventListener(UiRenderEvent.UIRenderComplete, this.onChildFinalized); - return (child); - } - - public function finalize():void - { - var hScroll:Boolean = (((width < Math.floor(this._content.width))) && (this._useHorizontalScroll)); - var vScroll:Boolean = (height < Math.floor(this._content.height)); - this._mask.height = height; - this._mask.width = width; - this._content.x = 0; - this._content.y = 0; - if (hScroll) - { - if (!(this._hScrollbar)) - { - this._hScrollbar = new ScrollBar(); - this._hScrollbar.vertical = false; - this._hScrollbar.addEventListener(Event.CHANGE, this.onHorizontalScroll); - this._hScrollbar.css = this._scrollBarCss; - this._hScrollbar.min = 0; - this._hScrollbar.height = this._scrollBarSize; - this._hScrollbar.y = (height - this._hScrollbar.height); - this._hScrollbar.step = 1; - this._hScrollbar.scrollSpeed = this._hScrollbarSpeed; - super.addChild(this._hScrollbar); - this._hScrollbar.finalize(); - } - else - { - super.addChild(this._hScrollbar); - }; - this._mask.height = (height - this._scrollBarSize); - this._hScrollbar.width = (width - ((vScroll) ? this._scrollBarSize : 0)); - this._hScrollbar.max = ((this._content.width - width) + ((vScroll) ? this._scrollBarSize : 0)); + this._hScrollbar = new ScrollBar(); + this._hScrollbar.vertical = false; + this._hScrollbar.addEventListener(Event.CHANGE,this.onHorizontalScroll); + this._hScrollbar.css = this._scrollBarCss; + this._hScrollbar.min = 0; + this._hScrollbar.height = this._scrollBarSize; + this._hScrollbar.y = height - this._hScrollbar.height; + this._hScrollbar.step = 1; + this._hScrollbar.scrollSpeed = this._hScrollbarSpeed; + super.addChild(this._hScrollbar); + this._hScrollbar.finalize(); } else { - if (((this._hScrollbar) && (contains(this._hScrollbar)))) - { - removeChild(this._hScrollbar); - }; - }; - if (vScroll) + super.addChild(this._hScrollbar); + } + this._mask.height = height - this._scrollBarSize; + this._hScrollbar.width = width - (_loc2_?this._scrollBarSize:0); + this._hScrollbar.max = this._content.width - width + (_loc2_?this._scrollBarSize:0); + } + else if((this._hScrollbar) && (contains(this._hScrollbar))) + { + removeChild(this._hScrollbar); + } + + if(_loc2_) + { + if(!this._vScrollbar) { - if (!(this._vScrollbar)) - { - this._vScrollbar = new ScrollBar(); - this._vScrollbar.addEventListener(Event.CHANGE, this.onVerticalScroll); - this._vScrollbar.css = this._scrollBarCss; - this._vScrollbar.min = 0; - this._vScrollbar.width = this._scrollBarSize; - this._vScrollbar.x = (width - this._vScrollbar.width); - this._vScrollbar.vertical = false; - this._vScrollbar.step = 1; - this._vScrollbar.scrollSpeed = this._vScrollbarSpeed; - super.addChild(this._vScrollbar); - this._vScrollbar.finalize(); - } - else - { - super.addChild(this._vScrollbar); - }; - this._mask.width = (width - this._scrollBarSize); - this._vScrollbar.height = (height - ((hScroll) ? this._scrollBarSize : 0)); - this._vScrollbar.max = ((this._content.height - height) + ((vScroll) ? this._scrollBarSize : 0)); + this._vScrollbar = new ScrollBar(); + this._vScrollbar.addEventListener(Event.CHANGE,this.onVerticalScroll); + this._vScrollbar.css = this._scrollBarCss; + this._vScrollbar.min = 0; + this._vScrollbar.width = this._scrollBarSize; + this._vScrollbar.x = width - this._vScrollbar.width; + this._vScrollbar.vertical = false; + this._vScrollbar.step = 1; + this._vScrollbar.scrollSpeed = this._vScrollbarSpeed; + super.addChild(this._vScrollbar); + this._vScrollbar.finalize(); } else { - if (((this._vScrollbar) && (contains(this._vScrollbar)))) - { - removeChild(this._vScrollbar); - }; - }; - this._finalized = true; - var mouseEventCatcher:Shape = new Shape(); - mouseEventCatcher.graphics.beginFill(0, 0); - mouseEventCatcher.graphics.drawRect(0, 0, __width, __height); - super.addChild(mouseEventCatcher); - getUi().iAmFinalized(this); - } - - [HideInFakeClass] - override public function process(msg:Message):Boolean - { - switch (true) - { - case (msg is MouseWheelMessage): - if (((this._vScrollbar) && (!((this._vScrollbar.parent == null))))) - { - this._vScrollbar.onWheel(MouseWheelMessage(msg).mouseEvent); - } - else - { - if (((this._hScrollbar) && (!((this._hScrollbar.parent == null))))) - { - this._hScrollbar.onWheel(MouseWheelMessage(msg).mouseEvent); - }; - }; - return (true); - }; - return (false); - } - - override public function getStrata(nStrata:uint):Sprite - { - var _local_2:uint; - var _local_3:uint; - if (_aStrata[nStrata] != null) - { - return (_aStrata[nStrata]); - }; - _aStrata[nStrata] = new Sprite(); - _aStrata[nStrata].name = ("strata_" + nStrata); - _aStrata[nStrata].mouseEnabled = mouseEnabled; - _local_2 = 0; - _local_3 = 0; - while (_local_3 < _aStrata.length) + super.addChild(this._vScrollbar); + } + this._mask.width = width - this._scrollBarSize; + this._vScrollbar.height = height - (_loc1_?this._scrollBarSize:0); + this._vScrollbar.max = this._content.height - height + (_loc2_?this._scrollBarSize:0); + } + else if((this._vScrollbar) && (contains(this._vScrollbar))) + { + removeChild(this._vScrollbar); + } + + this._finalized = true; + var _loc3_:Shape = new Shape(); + _loc3_.graphics.beginFill(0,0); + _loc3_.graphics.drawRect(0,0,__width,__height); + super.addChild(_loc3_); + getUi().iAmFinalized(this); + } + + override public function process(param1:Message) : Boolean + { + switch(true) + { + case param1 is MouseWheelMessage: + if((this._vScrollbar) && !(this._vScrollbar.parent == null)) + { + this._vScrollbar.onWheel(MouseWheelMessage(param1).mouseEvent); + } + else if((this._hScrollbar) && !(this._hScrollbar.parent == null)) + { + this._hScrollbar.onWheel(MouseWheelMessage(param1).mouseEvent); + } + + return true; + default: + return false; + } + } + + override public function getStrata(param1:uint) : Sprite + { + var _loc2_:uint = 0; + var _loc3_:uint = 0; + if(_aStrata[param1] != null) + { + return _aStrata[param1]; + } + _aStrata[param1] = new Sprite(); + _aStrata[param1].name = "strata_" + param1; + _aStrata[param1].mouseEnabled = mouseEnabled; + _loc2_ = 0; + _loc3_ = 0; + while(_loc3_ < _aStrata.length) + { + if(_aStrata[_loc3_] != null) { - if (_aStrata[_local_3] != null) - { - this._content.addChildAt(_aStrata[_local_3], _local_2++); - }; - _local_3++; - }; - return (_aStrata[nStrata]); - } - - private function onVerticalScroll(e:Event):void - { - this._content.y = -(this._vScrollbar.value); - } - - private function onHorizontalScroll(e:Event):void - { - this._content.x = -(this._hScrollbar.value); - } - - private function onChildFinalized(e:Event):void - { - e.target.removeEventListener(UiRenderEvent.UIRenderComplete, this.onChildFinalized); - this.finalize(); - } - - private function onChildRemoved(e:Event):void - { - } - - - } -}//package com.ankamagames.berilia.types.graphic - + this._content.addChildAt(_aStrata[_loc3_],_loc2_++); + } + _loc3_++; + } + return _aStrata[param1]; + } + + private function onVerticalScroll(param1:Event) : void + { + this._content.y = -this._vScrollbar.value; + } + + private function onHorizontalScroll(param1:Event) : void + { + this._content.x = -this._hScrollbar.value; + } + + private function onChildFinalized(param1:Event) : void + { + param1.target.removeEventListener(UiRenderEvent.UIRenderComplete,this.onChildFinalized); + this.finalize(); + } + + private function onChildRemoved(param1:Event) : void + { + } + } +} diff --git a/com/ankamagames/berilia/types/graphic/StateContainer.as b/com/ankamagames/berilia/types/graphic/StateContainer.as index 3e94d0eb3..3c4b433c2 100644 --- a/com/ankamagames/berilia/types/graphic/StateContainer.as +++ b/com/ankamagames/berilia/types/graphic/StateContainer.as @@ -1,225 +1,229 @@ -package com.ankamagames.berilia.types.graphic +package com.ankamagames.berilia.types.graphic { - import com.ankamagames.berilia.UIComponent; - import com.ankamagames.jerakine.logger.Logger; - import com.ankamagames.jerakine.logger.Log; - import flash.utils.getQualifiedClassName; - import com.ankamagames.jerakine.utils.misc.DescribeTypeCache; - import com.ankamagames.berilia.enums.StatesEnum; - - public class StateContainer extends GraphicContainer implements UIComponent - { - - protected static const _log:Logger = Log.getLogger(getQualifiedClassName(StateContainer)); - - protected var _state; - protected var _snapshot:Array; - protected var _describeType:Function; - protected var _lockedProperties:Array; - protected var _lockedPropertiesStr:String; - private var _changingStateData:Array; - - public function StateContainer() - { - this._describeType = DescribeTypeCache.typeDescription; - super(); - this._state = StatesEnum.STATE_NORMAL; - this._snapshot = new Array(); - this._lockedProperties = new Array(); - this._lockedPropertiesStr = ""; - this.lockedProperties = "x,y,width,height,selected,greyedOut"; - } - - public function get changingStateData():Array - { - return (this._changingStateData); - } - - public function set changingStateData(value:Array):void - { - this._changingStateData = value; - } - - public function set state(newState:*):void - { - if (this._state == newState) + import com.ankamagames.berilia.UIComponent; + import com.ankamagames.jerakine.logger.Logger; + import com.ankamagames.jerakine.logger.Log; + import flash.utils.getQualifiedClassName; + import com.ankamagames.berilia.enums.StatesEnum; + import com.ankamagames.jerakine.utils.misc.DescribeTypeCache; + + public class StateContainer extends GraphicContainer implements UIComponent + { + + public function StateContainer() + { + this._describeType = DescribeTypeCache.typeDescription; + super(); + this._state = StatesEnum.STATE_NORMAL; + this._snapshot = new Array(); + this._lockedProperties = new Array(); + this._lockedPropertiesStr = ""; + this.lockedProperties = "x,y,width,height,selected,greyedOut"; + } + + protected static const _log:Logger = Log.getLogger(getQualifiedClassName(StateContainer)); + + protected var _state; + + protected var _snapshot:Array; + + protected var _describeType:Function; + + protected var _lockedProperties:Array; + + protected var _lockedPropertiesStr:String; + + private var _changingStateData:Array; + + public function get changingStateData() : Array + { + return this._changingStateData; + } + + public function set changingStateData(param1:Array) : void + { + this._changingStateData = param1; + } + + public function set state(param1:*) : void + { + if(this._state == param1) + { + return; + } + if(param1 == null) + { + var param1:* = StatesEnum.STATE_NORMAL; + } + this.changeState(param1); + this._state = param1; + } + + public function get state() : * + { + return this._state; + } + + override public function free() : void + { + super.free(); + this._state = null; + this._snapshot = null; + } + + override public function remove() : void + { + super.remove(); + this._snapshot = null; + this._state = null; + } + + public function get lockedProperties() : String + { + return this._lockedPropertiesStr; + } + + public function set lockedProperties(param1:String) : void + { + var _loc2_:Array = null; + var _loc3_:String = null; + this._lockedPropertiesStr = param1; + this._lockedProperties = []; + if(this._lockedPropertiesStr) + { + _loc2_ = param1.split(","); + for each(_loc3_ in _loc2_) { - return; - }; - if (newState == null) - { - newState = StatesEnum.STATE_NORMAL; - }; - this.changeState(newState); - this._state = newState; - } - - public function get state() - { - return (this._state); - } - - override public function free():void - { - super.free(); - this._state = null; - this._snapshot = null; - } - - override public function remove():void - { - super.remove(); - this._snapshot = null; - this._state = null; - } - - public function get lockedProperties():String - { - return (this._lockedPropertiesStr); - } - - public function set lockedProperties(s:String):void - { - var tmp:Array; - var propName:String; - this._lockedPropertiesStr = s; - this._lockedProperties = []; - if (this._lockedPropertiesStr) - { - tmp = s.split(","); - for each (propName in tmp) - { - this._lockedProperties[propName] = true; - }; - }; - } - - protected function changeState(newState:*):void - { - var target:GraphicContainer; - var properties:Array; - var ui:UiRootContainer; - var key:String; - var property:String; - if (!(this._snapshot)) - { - return; - }; - if (newState == StatesEnum.STATE_NORMAL) - { - this._state = newState; - this.restoreSnapshot(StatesEnum.STATE_NORMAL); + this._lockedProperties[_loc3_] = true; } - else - { - if (((!((this.changingStateData == null))) && (this.changingStateData[newState]))) - { - this._snapshot[this._state] = new Array(); - if (this._state != StatesEnum.STATE_NORMAL) - { - this.restoreSnapshot(StatesEnum.STATE_NORMAL); - }; - for (key in this.changingStateData[newState]) - { - ui = getUi(); - if (!(ui)) break; - target = ui.getElement(key); - if (target) - { - if (this._state == StatesEnum.STATE_NORMAL) - { - this.makeSnapshot(StatesEnum.STATE_NORMAL, target); - }; - properties = this.changingStateData[newState][key]; - for (property in properties) - { - target[property] = properties[property]; - }; - this.makeSnapshot(this._state, target); - }; - }; - } - else - { - _log.warn((((((name + " : No data for state '") + newState) + "' (") + this.changingStateData.length) + " states)")); - }; - }; - } - - protected function makeSnapshot(currentState:*, target:GraphicContainer):void - { - var property:String; - var propertyXml:XML; - if (!(this._snapshot[currentState])) + } + } + + protected function changeState(param1:*) : void + { + var _loc2_:GraphicContainer = null; + var _loc3_:Array = null; + var _loc4_:UiRootContainer = null; + var _loc5_:String = null; + var _loc6_:String = null; + if(!this._snapshot) + { + return; + } + if(param1 == StatesEnum.STATE_NORMAL) + { + this._state = param1; + this.restoreSnapshot(StatesEnum.STATE_NORMAL); + } + else if(!(this.changingStateData == null) && (this.changingStateData[param1])) + { + this._snapshot[this._state] = new Array(); + if(this._state != StatesEnum.STATE_NORMAL) { - this._snapshot[currentState] = new Object(); - }; - if (!(this._snapshot[currentState][target.name])) - { - this._snapshot[currentState][target.name] = new Object(); + this.restoreSnapshot(StatesEnum.STATE_NORMAL); } - else + for(_loc5_ in this.changingStateData[param1]) { - return; - }; - var def:XML = this._describeType(target); - for each (propertyXml in def..accessor) + _loc4_ = getUi(); + if(!_loc4_) + { + break; + } + _loc2_ = _loc4_.getElement(_loc5_); + if(_loc2_) + { + if(this._state == StatesEnum.STATE_NORMAL) + { + this.makeSnapshot(StatesEnum.STATE_NORMAL,_loc2_); + } + _loc3_ = this.changingStateData[param1][_loc5_]; + for(_loc6_ in _loc3_) + { + _loc2_[_loc6_] = _loc3_[_loc6_]; + } + this.makeSnapshot(this._state,_loc2_); + } + } + } + else + { + _log.warn(name + " : No data for state \'" + param1 + "\' (" + this.changingStateData.length + " states)"); + } + + } + + protected function makeSnapshot(param1:*, param2:GraphicContainer) : void + { + var _loc4_:String = null; + var _loc5_:XML = null; + if(!this._snapshot[param1]) + { + this._snapshot[param1] = new Object(); + } + if(!this._snapshot[param1][param2.name]) + { + this._snapshot[param1][param2.name] = new Object(); + var _loc3_:XML = this._describeType(param2); + for each(_loc5_ in _loc3_..accessor) { - if (propertyXml.@access == "readwrite") - { - property = propertyXml.@name; - if (!this._lockedProperties[property]) - { - switch (true) - { - case (target[property] is Boolean): - case (target[property] is uint): - case (target[property] is int): - case (target[property] is Number): - case (target[property] is String): - case (target[property] == null): - this._snapshot[currentState][target.name][property] = target[property]; - }; - }; - }; - }; - } - - protected function restoreSnapshot(currentState:*):void - { - var component:GraphicContainer; - var ui:UiRootContainer; - var target:String; - var property:String; - if (!(this._snapshot)) + if(_loc5_.@access == "readwrite") + { + _loc4_ = _loc5_.@name; + if(!this._lockedProperties[_loc4_]) + { + switch(true) + { + case param2[_loc4_] is Boolean: + case param2[_loc4_] is uint: + case param2[_loc4_] is int: + case param2[_loc4_] is Number: + case param2[_loc4_] is String: + case param2[_loc4_] == null: + this._snapshot[param1][param2.name][_loc4_] = param2[_loc4_]; + break; + } + } + } + } + return; + } + } + + protected function restoreSnapshot(param1:*) : void + { + var _loc2_:GraphicContainer = null; + var _loc3_:UiRootContainer = null; + var _loc4_:String = null; + var _loc5_:String = null; + if(!this._snapshot) + { + return; + } + for(_loc4_ in this._snapshot[param1]) + { + _loc3_ = getUi(); + if(!_loc3_) { - return; - }; - for (target in this._snapshot[currentState]) + break; + } + _loc2_ = _loc3_.getElement(_loc4_); + if(_loc2_) { - ui = getUi(); - if (!(ui)) break; - component = ui.getElement(target); - if (!!(component)) - { - for (property in this._snapshot[currentState][target]) - { - if (component[property] !== this._snapshot[currentState][target][property]) + for(_loc5_ in this._snapshot[param1][_loc4_]) + { + if(_loc2_[_loc5_] !== this._snapshot[param1][_loc4_][_loc5_]) + { + if(!(_loc2_ is ButtonContainer) || !(_loc5_ == "selected")) + { + if(!this._lockedProperties[_loc5_]) { - if (((!((component is ButtonContainer))) || (!((property == "selected"))))) - { - if (!this._lockedProperties[property]) - { - component[property] = this._snapshot[currentState][target][property]; - }; - }; - }; - }; - }; - }; - } - - - } -}//package com.ankamagames.berilia.types.graphic - + _loc2_[_loc5_] = this._snapshot[param1][_loc4_][_loc5_]; + } + } + } + } + } + } + } + } +} diff --git a/com/ankamagames/berilia/types/graphic/TimeoutHTMLLoader.as b/com/ankamagames/berilia/types/graphic/TimeoutHTMLLoader.as index 6bffdacff..182c4b6f0 100644 --- a/com/ankamagames/berilia/types/graphic/TimeoutHTMLLoader.as +++ b/com/ankamagames/berilia/types/graphic/TimeoutHTMLLoader.as @@ -1,102 +1,104 @@ -package com.ankamagames.berilia.types.graphic +package com.ankamagames.berilia.types.graphic { - import flash.html.HTMLLoader; - import com.ankamagames.jerakine.logger.Logger; - import com.ankamagames.jerakine.logger.Log; - import avmplus.getQualifiedClassName; - import flash.utils.Dictionary; - import flash.utils.Timer; - import flash.events.Event; - import flash.events.HTMLUncaughtScriptExceptionEvent; - import flash.events.TimerEvent; - - public class TimeoutHTMLLoader extends HTMLLoader - { - - protected static const _log:Logger = Log.getLogger(getQualifiedClassName(TimeoutHTMLLoader)); - private static var INSTANCE_CACHE:Dictionary = new Dictionary(); - public static const TIMEOUT:String = "TimeoutHTMLLoader_timeout"; - - private var _fromCache:Boolean; - private var _timer:Timer; - private var _uid:String; - - public function TimeoutHTMLLoader() - { - addEventListener(Event["LOCATION_CHANGE"], this.onLocationChange); - } - - public static function getLoader(uid:String=null):TimeoutHTMLLoader - { - var instance:TimeoutHTMLLoader; - if (((!((uid == null))) && (INSTANCE_CACHE[uid]))) - { - instance = INSTANCE_CACHE[uid]; - instance._fromCache = true; - instance._timer.reset(); - instance._timer.start(); - return (instance); - }; - instance = new (TimeoutHTMLLoader)(); - instance._uid = uid; - instance.addEventListener(HTMLUncaughtScriptExceptionEvent.UNCAUGHT_SCRIPT_EXCEPTION, onJsError); - if (uid) - { - INSTANCE_CACHE[uid] = instance; - }; - return (instance); - } - - public static function resetCache():void - { - INSTANCE_CACHE = new Dictionary(); - } - - private static function onJsError(event:HTMLUncaughtScriptExceptionEvent):void - { - var msg:String = (('Javascript exception "' + event.exceptionValue.message) + '"'); - var i:uint; - while (i < event.stackTrace.length) - { - msg = (msg + ((("\n" + event.stackTrace[i].functionName) + " at line ") + event.stackTrace[i].line)); - i++; - }; - _log.error(msg); - } - - - public function set life(value:Number):void - { - this._timer = new Timer(((value * 60) * 1000)); - this._timer.addEventListener(TimerEvent.TIMER, this.onTimeOut); - } - - public function get fromCache():Boolean - { - return (this._fromCache); - } - - private function onLocationChange(e:Event):void - { - if (this._timer) - { - this._timer.reset(); - this._timer.start(); - }; - } - - private function onTimeOut(e:Event):void - { - this._timer.stop(); - dispatchEvent(new Event(TIMEOUT)); - if (((!(this._timer.running)) && (this._uid))) - { - delete INSTANCE_CACHE[this._uid]; - this._timer.removeEventListener(TimerEvent.TIMER, this.onTimeOut); - }; - } - - - } -}//package com.ankamagames.berilia.types.graphic - + import flash.html.HTMLLoader; + import com.ankamagames.jerakine.logger.Logger; + import flash.utils.Dictionary; + import flash.events.HTMLUncaughtScriptExceptionEvent; + import com.ankamagames.jerakine.logger.Log; + import avmplus.getQualifiedClassName; + import flash.utils.Timer; + import flash.events.TimerEvent; + import flash.events.Event; + + public class TimeoutHTMLLoader extends HTMLLoader + { + + public function TimeoutHTMLLoader() + { + super(); + addEventListener(Event["LOCATION_CHANGE"],this.onLocationChange); + } + + protected static const _log:Logger = Log.getLogger(getQualifiedClassName(TimeoutHTMLLoader)); + + private static var INSTANCE_CACHE:Dictionary = new Dictionary(); + + public static const TIMEOUT:String = "TimeoutHTMLLoader_timeout"; + + public static function getLoader(param1:String = null) : TimeoutHTMLLoader + { + var _loc2_:TimeoutHTMLLoader = null; + if(!(param1 == null) && (INSTANCE_CACHE[param1])) + { + _loc2_ = INSTANCE_CACHE[param1]; + _loc2_._fromCache = true; + _loc2_._timer.reset(); + _loc2_._timer.start(); + return _loc2_; + } + _loc2_ = new TimeoutHTMLLoader(); + _loc2_._uid = param1; + _loc2_.addEventListener(HTMLUncaughtScriptExceptionEvent.UNCAUGHT_SCRIPT_EXCEPTION,onJsError); + if(param1) + { + INSTANCE_CACHE[param1] = _loc2_; + } + return _loc2_; + } + + public static function resetCache() : void + { + INSTANCE_CACHE = new Dictionary(); + } + + private static function onJsError(param1:HTMLUncaughtScriptExceptionEvent) : void + { + var _loc2_:* = "Javascript exception \"" + param1.exceptionValue.message + "\""; + var _loc3_:uint = 0; + while(_loc3_ < param1.stackTrace.length) + { + _loc2_ = _loc2_ + ("\n" + param1.stackTrace[_loc3_].functionName + " at line " + param1.stackTrace[_loc3_].line); + _loc3_++; + } + _log.error(_loc2_); + } + + private var _fromCache:Boolean; + + private var _timer:Timer; + + private var _uid:String; + + public function set life(param1:Number) : void + { + this._timer = new Timer(param1 * 60 * 1000); + this._timer.addEventListener(TimerEvent.TIMER,this.onTimeOut); + } + + public function get fromCache() : Boolean + { + return this._fromCache; + } + + private function onLocationChange(param1:Event) : void + { + if(this._timer) + { + this._timer.reset(); + this._timer.start(); + } + } + + private function onTimeOut(param1:Event) : void + { + this._timer.stop(); + dispatchEvent(new Event(TIMEOUT)); + if(!this._timer.running && (this._uid)) + { + delete INSTANCE_CACHE[this._uid]; + true; + this._timer.removeEventListener(TimerEvent.TIMER,this.onTimeOut); + } + } + } +} diff --git a/com/ankamagames/berilia/types/graphic/UiRootContainer.as b/com/ankamagames/berilia/types/graphic/UiRootContainer.as index 7ec7bcb51..451f2132d 100644 --- a/com/ankamagames/berilia/types/graphic/UiRootContainer.as +++ b/com/ankamagames/berilia/types/graphic/UiRootContainer.as @@ -1,501 +1,552 @@ -package com.ankamagames.berilia.types.graphic +package com.ankamagames.berilia.types.graphic { - import flash.utils.Dictionary; - import com.ankamagames.jerakine.logger.Logger; - import com.ankamagames.jerakine.logger.Log; - import flash.utils.getQualifiedClassName; - import flash.display.Stage; - import flash.display.Sprite; - import flash.utils.Timer; - import com.ankamagames.berilia.types.data.UiData; - import com.ankamagames.berilia.types.data.UiModule; - import flash.display.DisplayObjectContainer; - import com.ankamagames.berilia.FinalizableUIComponent; - import com.ankamagames.jerakine.types.Callback; - import flash.utils.getTimer; - import com.ankamagames.jerakine.utils.benchmark.monitoring.FpsManager; - import com.ankamagames.jerakine.managers.ErrorManager; - import com.ankamagames.berilia.types.event.UiRenderEvent; - import com.ankamagames.berilia.Berilia; - import com.ankamagames.berilia.utils.errors.BeriliaError; - import com.ankamagames.berilia.types.data.RadioGroup; - import com.ankamagames.berilia.managers.SecureCenter; - import flash.errors.IllegalOperationError; - import com.ankamagames.jerakine.utils.misc.CallWithParameters; - import com.ankamagames.jerakine.utils.display.StageShareManager; - import flash.geom.Point; - import flash.display.DisplayObject; - import com.ankamagames.berilia.enums.LocationTypeEnum; - import com.ankamagames.berilia.types.LocationEnum; - import com.ankamagames.berilia.managers.UiRenderManager; - import flash.events.TimerEvent; - - public class UiRootContainer extends GraphicContainer - { - - public static var MEMORY_LOG:Dictionary = new Dictionary(true); - protected static const _log:Logger = Log.getLogger(getQualifiedClassName(UiRootContainer)); - - private var _aNamedElements:Array; - private var _bUsedCustomSize:Boolean = false; - private var _stage:Stage; - private var _root:Sprite; - private var _aGraphicLocationStack:Array; - private var _aSizeStack:Array; - private var _aGraphicElementIndex:Array; - private var _aPositionnedElement:Array; - private var _linkedUi:Array; - private var _aPostFinalizeElement:Array; - private var _aFinalizeElements:Array; - private var _uiDefinitionUpdateTimer:Timer; - private var _rendering:Boolean = false; - private var _ready:Boolean; - private var _waitingFctCall:Array; - private var _properties; - private var _wasVisible:Boolean; - private var _lock:Boolean = true; - private var _renderAsk:Boolean = false; - private var _isNotFinalized:Boolean = true; - private var _tempVisible:Boolean = true; - private var _uiData:UiData; - public var uiClass; - public var uiModule:UiModule; - public var strata:int; - public var depth:int; - public var scalable:Boolean = true; - public var modal:Boolean = false; - private var _modalContainer:GraphicContainer; - public var giveFocus:Boolean = true; - public var modalIndex:uint = 0; - public var radioGroup:Array; - public var cached:Boolean = false; - public var hideAfterLoading:Boolean = false; - public var transmitFocus:Boolean = true; - public var constants:Array; - public var tempHolder:DisplayObjectContainer; - - public function UiRootContainer(stage:Stage, uiData:UiData, root:Sprite=null) - { - this._stage = stage; - this._root = root; - this._aNamedElements = new Array(); - this._aSizeStack = new Array(); - this._linkedUi = new Array(); - this._uiData = uiData; - this._aGraphicLocationStack = new Array(); - this._aGraphicElementIndex = new Array(); - this._aPostFinalizeElement = new Array(); - this._aFinalizeElements = new Array(); - this._waitingFctCall = new Array(); - this.radioGroup = new Array(); - super.visible = false; - MEMORY_LOG[this] = 1; - } - - public function set properties(o:*):void - { - if (!(this._properties)) - { - this._properties = o; - }; - } - - override public function get customUnicName():String - { - return (name); - } - - override public function set visible(value:Boolean):void - { - if (this._isNotFinalized) - { - this._tempVisible = value; + import flash.utils.Dictionary; + import com.ankamagames.jerakine.logger.Logger; + import com.ankamagames.jerakine.logger.Log; + import flash.utils.getQualifiedClassName; + import flash.display.Stage; + import flash.display.Sprite; + import flash.utils.Timer; + import com.ankamagames.berilia.types.data.UiData; + import com.ankamagames.berilia.types.data.UiModule; + import flash.display.DisplayObjectContainer; + import com.ankamagames.berilia.FinalizableUIComponent; + import com.ankamagames.jerakine.types.Callback; + import flash.utils.getTimer; + import com.ankamagames.jerakine.utils.benchmark.monitoring.FpsManager; + import com.ankamagames.jerakine.managers.ErrorManager; + import com.ankamagames.berilia.types.event.UiRenderEvent; + import com.ankamagames.berilia.Berilia; + import com.ankamagames.berilia.utils.errors.BeriliaError; + import com.ankamagames.berilia.types.data.RadioGroup; + import com.ankamagames.berilia.managers.SecureCenter; + import flash.errors.IllegalOperationError; + import com.ankamagames.jerakine.utils.misc.CallWithParameters; + import com.ankamagames.jerakine.utils.display.StageShareManager; + import flash.geom.Point; + import flash.display.DisplayObject; + import com.ankamagames.berilia.enums.LocationTypeEnum; + import com.ankamagames.berilia.types.LocationEnum; + import flash.events.TimerEvent; + import com.ankamagames.berilia.managers.UiRenderManager; + + public class UiRootContainer extends GraphicContainer + { + + public function UiRootContainer(param1:Stage, param2:UiData, param3:Sprite = null) + { + super(); + this._stage = param1; + this._root = param3; + this._aNamedElements = new Array(); + this._aSizeStack = new Array(); + this._linkedUi = new Array(); + this._uiData = param2; + this._aGraphicLocationStack = new Array(); + this._aGraphicElementIndex = new Array(); + this._aPostFinalizeElement = new Array(); + this._aFinalizeElements = new Array(); + this._waitingFctCall = new Array(); + this.radioGroup = new Array(); + super.visible = false; + MEMORY_LOG[this] = 1; + } + + public static var MEMORY_LOG:Dictionary = new Dictionary(true); + + protected static const _log:Logger = Log.getLogger(getQualifiedClassName(UiRootContainer)); + + private var _aNamedElements:Array; + + private var _bUsedCustomSize:Boolean = false; + + private var _stage:Stage; + + private var _root:Sprite; + + private var _aGraphicLocationStack:Array; + + private var _aSizeStack:Array; + + private var _aGraphicElementIndex:Array; + + private var _aPositionnedElement:Array; + + private var _linkedUi:Array; + + private var _aPostFinalizeElement:Array; + + private var _aFinalizeElements:Array; + + private var _uiDefinitionUpdateTimer:Timer; + + private var _rendering:Boolean = false; + + private var _ready:Boolean; + + private var _waitingFctCall:Array; + + private var _properties; + + private var _wasVisible:Boolean; + + private var _lock:Boolean = true; + + private var _renderAsk:Boolean = false; + + private var _isNotFinalized:Boolean = true; + + private var _tempVisible:Boolean = true; + + private var _uiData:UiData; + + public var uiClass; + + public var uiModule:UiModule; + + public var strata:int; + + public var depth:int; + + public var scalable:Boolean = true; + + public var modal:Boolean = false; + + private var _modalContainer:GraphicContainer; + + public var giveFocus:Boolean = true; + + public var modalIndex:uint = 0; + + public var radioGroup:Array; + + public var cached:Boolean = false; + + public var hideAfterLoading:Boolean = false; + + public var transmitFocus:Boolean = true; + + public var constants:Array; + + public var tempHolder:DisplayObjectContainer; + + public function set properties(param1:*) : void + { + if(!this._properties) + { + this._properties = param1; + } + } + + override public function get customUnicName() : String + { + return name; + } + + override public function set visible(param1:Boolean) : void + { + if(this._isNotFinalized) + { + this._tempVisible = param1; + } + else + { + super.visible = param1; + } + } + + override public function get width() : Number + { + if(this._bUsedCustomSize) + { + return __width; + } + return super.width; + } + + override public function set width(param1:Number) : void + { + this._bUsedCustomSize = true; + __width = param1; + } + + override public function get height() : Number + { + if(this._bUsedCustomSize) + { + return __height; + } + return super.height; + } + + override public function set height(param1:Number) : void + { + this._bUsedCustomSize = true; + __height = param1; + } + + public function set useCustomSize(param1:Boolean) : void + { + this._bUsedCustomSize = param1; + } + + public function get useCustomSize() : Boolean + { + return this._bUsedCustomSize; + } + + public function set disableRender(param1:Boolean) : void + { + this._rendering = param1; + } + + public function get disableRender() : Boolean + { + return this._rendering; + } + + public function get ready() : Boolean + { + return this._ready; + } + + public function set modalContainer(param1:GraphicContainer) : void + { + this._modalContainer = param1; + } + + public function set showModalContainer(param1:Boolean) : void + { + if((this.modal) && !(this._modalContainer == null)) + { + this._modalContainer.visible = param1; + } + } + + public function get uiData() : UiData + { + return this._uiData; + } + + public function addElement(param1:String, param2:Object) : void + { + this._aNamedElements[param1] = param2; + } + + public function removeElement(param1:String) : void + { + delete this._aNamedElements[param1]; + true; + } + + public function getElement(param1:String) : GraphicContainer + { + return this._aNamedElements[param1]; + } + + public function getElements() : Array + { + return this._aNamedElements; + } + + public function getConstant(param1:String) : * + { + return this.constants[param1]; + } + + public function iAmFinalized(param1:FinalizableUIComponent) : void + { + var _loc2_:FinalizableUIComponent = null; + var _loc4_:* = 0; + var _loc5_:Callback = null; + if(!this._lock || (this._rendering)) + { + return; + } + for each(_loc2_ in this._aFinalizeElements) + { + if(!_loc2_.finalized) + { + return; } - else - { - super.visible = value; - }; - } - - override public function get width():Number - { - if (this._bUsedCustomSize) - { - return (__width); - }; - return (super.width); - } - - override public function set width(nW:Number):void - { - this._bUsedCustomSize = true; - __width = nW; - } - - override public function get height():Number - { - if (this._bUsedCustomSize) - { - return (__height); - }; - return (super.height); - } - - override public function set height(nH:Number):void - { - this._bUsedCustomSize = true; - __height = nH; - } - - public function set useCustomSize(b:Boolean):void - { - this._bUsedCustomSize = b; - } - - public function get useCustomSize():Boolean - { - return (this._bUsedCustomSize); - } - - public function set disableRender(b:Boolean):void - { - this._rendering = b; - } - - public function get disableRender():Boolean - { - return (this._rendering); - } - - public function get ready():Boolean - { - return (this._ready); - } - - public function set modalContainer(val:GraphicContainer):void - { - this._modalContainer = val; - } - - public function set showModalContainer(val:Boolean):void - { - if (((this.modal) && (!((this._modalContainer == null))))) - { - this._modalContainer.visible = val; - }; - } - - public function get uiData():UiData - { - return (this._uiData); - } - - public function addElement(sName:String, oElement:Object):void - { - this._aNamedElements[sName] = oElement; - } - - public function removeElement(sName:String):void - { - delete this._aNamedElements[sName]; - } - - public function getElement(sName:String):GraphicContainer - { - return (this._aNamedElements[sName]); - } - - public function getElements():Array - { - return (this._aNamedElements); - } - - public function getConstant(name:String) - { - return (this.constants[name]); - } - - public function iAmFinalized(target:FinalizableUIComponent):void - { - var elem:FinalizableUIComponent; - var t:int; - var cb:Callback; - if (((!(this._lock)) || (this._rendering))) - { - return; - }; - for each (elem in this._aFinalizeElements) - { - if (!(elem.finalized)) - { - return; - }; - }; - this._lock = false; - this.render(); - this._ready = true; - if (this.tempHolder) - { - if (!(this.hideAfterLoading)) - { - this.tempHolder.parent.addChildAt(this, this.tempHolder.parent.getChildIndex(this.tempHolder)); - }; - this.tempHolder.parent.removeChild(this.tempHolder); - this.tempHolder = null; - }; - this._isNotFinalized = false; - var destroyNow:Boolean; - if (((this.uiClass) && (this.uiClass.hasOwnProperty("main")))) - { - this._rendering = true; - t = getTimer(); - FpsManager.getInstance().startTracking("hook", 7108545); - ErrorManager.tryFunction(this.uiClass["main"], [this._properties], (((("Une erreur est survenue lors de l'exécution de la fonction main de l'interface " + name) + " (") + getQualifiedClassName(this.uiClass)) + ")")); - FpsManager.getInstance().stopTracking("hook"); - this._rendering = false; - if (ErrorManager.lastTryFunctionHasException) - { - destroyNow = true; - } - else - { - if (this._renderAsk) - { - this.render(); - }; - }; - this._ready = true; - for each (cb in this._waitingFctCall) - { - cb.exec(); - }; - this._waitingFctCall = null; - }; - dispatchEvent(new UiRenderEvent(UiRenderEvent.UIRenderComplete, false, false, this)); - this.visible = this._tempVisible; - if (destroyNow) - { - _log.error((("UI " + name) + " has encountered an exception and must be unloaded.")); - _log.warn(("" + ErrorManager.lastExceptionStacktrace)); - Berilia.getInstance().unloadUi(name); - }; - } - - public function render():void - { - var i:int; - var ge:GraphicElement; - var pfc:FinalizableUIComponent; - this._renderAsk = true; - var wasReady:Boolean = this._ready; - this._ready = false; - if (((this._rendering) || (this._lock))) - { - return; - }; - var t1:uint = getTimer(); + } + this._lock = false; + this.render(); + this._ready = true; + if(this.tempHolder) + { + if(!this.hideAfterLoading) + { + this.tempHolder.parent.addChildAt(this,this.tempHolder.parent.getChildIndex(this.tempHolder)); + } + this.tempHolder.parent.removeChild(this.tempHolder); + this.tempHolder = null; + } + this._isNotFinalized = false; + var _loc3_:* = false; + if((this.uiClass) && (this.uiClass.hasOwnProperty("main"))) + { this._rendering = true; - this._aPositionnedElement = new Array(); - this.zSort(this._aSizeStack); - this.processSize(); - i = 0; - while (i < this._aGraphicLocationStack.length) - { - if (this._aGraphicLocationStack[i] != null) - { - this._aGraphicLocationStack[i].render = false; - }; - i++; - }; - i = 0; - while (i < this._aGraphicLocationStack.length) - { - if (this._aGraphicLocationStack[i] != null) - { - if (!(this._aGraphicLocationStack[i].render)) - { - ge = this._aGraphicLocationStack[i]; - if (!(ge.sprite.dynamicPosition)) - { - this.processLocation(this._aGraphicLocationStack[i]); - }; - }; - }; - i++; - }; - this.updateLinkedUi(); - for each (pfc in this._aPostFinalizeElement) - { - pfc.finalize(); - }; - this._aPositionnedElement = new Array(); + _loc4_ = getTimer(); + FpsManager.getInstance().startTracking("hook",7108545); + ErrorManager.tryFunction(this.uiClass["main"],[this._properties],"Une erreur est survenue lors de l\'exécution de la fonction main de l\'interface " + name + " (" + getQualifiedClassName(this.uiClass) + ")"); + FpsManager.getInstance().stopTracking("hook"); this._rendering = false; - this._ready = wasReady; - } - - public function registerId(sName:String, geReference:GraphicElement):void - { - if (((!((this._aGraphicElementIndex[sName] == null))) && (!((this._aGraphicElementIndex[sName] == undefined))))) - { - throw (new BeriliaError((sName + " name is already used"))); - }; - this._aGraphicElementIndex[sName] = geReference; - this.addElement(sName, geReference.sprite); - } - - public function deleteId(sName:String):void - { - if (this._aGraphicElementIndex[sName] == null) - { - return; - }; - delete this._aGraphicElementIndex[sName]; - this.removeElement(sName); - } - - public function getElementById(sName:String):GraphicElement - { - return (this._aGraphicElementIndex[sName]); - } - - public function removeFromRenderList(sName:String):void - { - var i:uint; - var ge:GraphicElement; - i = 0; - while (i < this._aGraphicLocationStack.length) - { - ge = this._aGraphicLocationStack[i]; - if (((!((ge == null))) && ((ge.sprite.name == sName)))) - { - delete this._aGraphicLocationStack[i]; - break; - }; - i++; - }; - i = 0; - while (i < this._aSizeStack.length) + if(ErrorManager.lastTryFunctionHasException) { - if (((!((this._aSizeStack[i] == null))) && ((this._aSizeStack[i].name == sName)))) - { - delete this._aSizeStack[i]; - return; - }; - i++; - }; - } - - public function addDynamicSizeElement(geReference:GraphicElement):void - { - var i:uint; - while (i < this._aSizeStack.length) - { - if (this._aSizeStack[i] == geReference) - { - return; - }; - i++; - }; - this._aSizeStack.push(geReference); - } - - public function addDynamicElement(ge:GraphicElement):void - { - var i:uint; - while (i < this._aGraphicLocationStack.length) - { - if (((!((this._aGraphicLocationStack[i] == null))) && ((this._aGraphicLocationStack[i].sprite.name == ge.sprite.name)))) - { - return; - }; - i++; - }; - this._aGraphicLocationStack.push(ge); - } - - public function addPostFinalizeComponent(fc:FinalizableUIComponent):void - { - this._aPostFinalizeElement.push(fc); - } - - public function addFinalizeElement(fc:FinalizableUIComponent):void - { - this._aFinalizeElements.push(fc); - } - - public function addRadioGroup(groupName:String):RadioGroup - { - if (!(this.radioGroup[groupName])) - { - this.radioGroup[groupName] = new RadioGroup(groupName); - }; - return (this.radioGroup[groupName]); - } - - public function getRadioGroup(name:String):RadioGroup - { - return (this.radioGroup[name]); - } - - public function addLinkedUi(uiName:String):void - { - if (uiName != name) - { - this._linkedUi[uiName] = uiName; + _loc3_ = true; } - else + else if(this._renderAsk) { - _log.error(("Cannot add link to yourself in " + name)); - }; - } - - public function removeLinkedUi(uiName:String):void - { - delete this._linkedUi[uiName]; - } - - public function updateLinkedUi():void - { - var ui:String; - for each (ui in this._linkedUi) - { - if (Berilia.getInstance().getUi(this._linkedUi[ui])) - { - Berilia.getInstance().getUi(this._linkedUi[ui]).render(); - }; - }; - } - - public function call(fct:Function, args:Array, accesKey:Object):void - { - if (accesKey !== SecureCenter.ACCESS_KEY) - { - throw (new IllegalOperationError()); - }; - if (this._ready) + this.render(); + } + + this._ready = true; + for each(_loc5_ in this._waitingFctCall) { - CallWithParameters.call(fct, args); + _loc5_.exec(); + } + this._waitingFctCall = null; + } + dispatchEvent(new UiRenderEvent(UiRenderEvent.UIRenderComplete,false,false,this)); + this.visible = this._tempVisible; + if(_loc3_) + { + _log.error("UI " + name + " has encountered an exception and must be unloaded."); + _log.warn("" + ErrorManager.lastExceptionStacktrace); + Berilia.getInstance().unloadUi(name); + } + } + + public function render() : void + { + var _loc3_:* = 0; + var _loc4_:GraphicElement = null; + var _loc5_:FinalizableUIComponent = null; + this._renderAsk = true; + var _loc1_:Boolean = this._ready; + this._ready = false; + if((this._rendering) || (this._lock)) + { + return; + } + var _loc2_:uint = getTimer(); + this._rendering = true; + this._aPositionnedElement = new Array(); + this.zSort(this._aSizeStack); + this.processSize(); + _loc3_ = 0; + while(_loc3_ < this._aGraphicLocationStack.length) + { + if(this._aGraphicLocationStack[_loc3_] != null) + { + this._aGraphicLocationStack[_loc3_].render = false; + } + _loc3_++; + } + _loc3_ = 0; + while(_loc3_ < this._aGraphicLocationStack.length) + { + if(this._aGraphicLocationStack[_loc3_] != null) + { + if(!this._aGraphicLocationStack[_loc3_].render) + { + _loc4_ = this._aGraphicLocationStack[_loc3_]; + if(!_loc4_.sprite.dynamicPosition) + { + this.processLocation(this._aGraphicLocationStack[_loc3_]); + } + } + } + _loc3_++; + } + this.updateLinkedUi(); + for each(_loc5_ in this._aPostFinalizeElement) + { + _loc5_.finalize(); + } + this._aPositionnedElement = new Array(); + this._rendering = false; + this._ready = _loc1_; + } + + public function registerId(param1:String, param2:GraphicElement) : void + { + if(!(this._aGraphicElementIndex[param1] == null) && !(this._aGraphicElementIndex[param1] == undefined)) + { + throw new BeriliaError(param1 + " name is already used"); + } + else + { + this._aGraphicElementIndex[param1] = param2; + this.addElement(param1,param2.sprite); + return; + } + } + + public function deleteId(param1:String) : void + { + if(this._aGraphicElementIndex[param1] == null) + { + return; + } + delete this._aGraphicElementIndex[param1]; + true; + this.removeElement(param1); + } + + public function getElementById(param1:String) : GraphicElement + { + return this._aGraphicElementIndex[param1]; + } + + public function removeFromRenderList(param1:String) : void + { + var _loc2_:uint = 0; + var _loc3_:GraphicElement = null; + _loc2_ = 0; + while(_loc2_ < this._aGraphicLocationStack.length) + { + _loc3_ = this._aGraphicLocationStack[_loc2_]; + if(!(_loc3_ == null) && _loc3_.sprite.name == param1) + { + delete this._aGraphicLocationStack[_loc2_]; + true; + break; + } + _loc2_++; + } + _loc2_ = 0; + while(_loc2_ < this._aSizeStack.length) + { + if(!(this._aSizeStack[_loc2_] == null) && this._aSizeStack[_loc2_].name == param1) + { + delete this._aSizeStack[_loc2_]; + true; + break; + } + _loc2_++; + } + } + + public function addDynamicSizeElement(param1:GraphicElement) : void + { + var _loc2_:uint = 0; + while(_loc2_ < this._aSizeStack.length) + { + if(this._aSizeStack[_loc2_] == param1) + { + return; + } + _loc2_++; + } + this._aSizeStack.push(param1); + } + + public function addDynamicElement(param1:GraphicElement) : void + { + var _loc2_:uint = 0; + while(_loc2_ < this._aGraphicLocationStack.length) + { + if(!(this._aGraphicLocationStack[_loc2_] == null) && this._aGraphicLocationStack[_loc2_].sprite.name == param1.sprite.name) + { + return; + } + _loc2_++; + } + this._aGraphicLocationStack.push(param1); + } + + public function addPostFinalizeComponent(param1:FinalizableUIComponent) : void + { + this._aPostFinalizeElement.push(param1); + } + + public function addFinalizeElement(param1:FinalizableUIComponent) : void + { + this._aFinalizeElements.push(param1); + } + + public function addRadioGroup(param1:String) : RadioGroup + { + if(!this.radioGroup[param1]) + { + this.radioGroup[param1] = new RadioGroup(param1); + } + return this.radioGroup[param1]; + } + + public function getRadioGroup(param1:String) : RadioGroup + { + return this.radioGroup[param1]; + } + + public function addLinkedUi(param1:String) : void + { + if(param1 != name) + { + this._linkedUi[param1] = param1; + } + else + { + _log.error("Cannot add link to yourself in " + name); + } + } + + public function removeLinkedUi(param1:String) : void + { + delete this._linkedUi[param1]; + true; + } + + public function updateLinkedUi() : void + { + var _loc1_:String = null; + for each(_loc1_ in this._linkedUi) + { + if(Berilia.getInstance().getUi(this._linkedUi[_loc1_])) + { + Berilia.getInstance().getUi(this._linkedUi[_loc1_]).render(); + } + } + } + + public function call(param1:Function, param2:Array, param3:Object) : void + { + if(param3 !== SecureCenter.ACCESS_KEY) + { + throw new IllegalOperationError(); + } + else + { + if(this._ready) + { + CallWithParameters.call(param1,param2); } else { - this._waitingFctCall.push(CallWithParameters.callConstructor(Callback, [fct].concat(args))); - }; - } - - public function destroyUi(accesKey:Object):void - { - var r:RadioGroup; - var num:int; - var i:int; - var component:GraphicContainer; - if (accesKey !== SecureCenter.ACCESS_KEY) - { - throw (new IllegalOperationError()); - }; - for each (r in this.radioGroup) - { - RadioGroup(r).destroy(); - }; + this._waitingFctCall.push(CallWithParameters.callConstructor(Callback,[param1].concat(param2))); + } + return; + } + } + + public function destroyUi(param1:Object) : void + { + var _loc2_:RadioGroup = null; + var _loc3_:* = 0; + var _loc4_:* = 0; + var _loc5_:GraphicContainer = null; + if(param1 !== SecureCenter.ACCESS_KEY) + { + throw new IllegalOperationError(); + } + else + { + for each(_loc2_ in this.radioGroup) + { + RadioGroup(_loc2_).destroy(); + } this.radioGroup = null; this._stage = null; this._root = null; @@ -505,337 +556,328 @@ this._aGraphicLocationStack = new Array(); this._aGraphicElementIndex = new Array(); this._aPostFinalizeElement = new Array(); - if (this._aFinalizeElements) - { - num = this._aFinalizeElements.length; - i = 0; - while (i < num) - { - component = this._aFinalizeElements[i]; - component.remove(); - i++; - }; - }; + if(this._aFinalizeElements) + { + _loc3_ = this._aFinalizeElements.length; + _loc4_ = 0; + while(_loc4_ < _loc3_) + { + _loc5_ = this._aFinalizeElements[_loc4_]; + _loc5_.remove(); + _loc4_++; + } + } this._aFinalizeElements = null; - } - - private function isRegisteredId(sName:String):Boolean - { - return (!((this._aGraphicElementIndex[sName] == null))); - } - - private function processSize():void - { - var ge:GraphicElement; - var i:uint; - while (i < this._aSizeStack.length) - { - ge = this._aSizeStack[i]; - if (ge != null) - { - if (((!(isNaN(ge.size.x))) && ((ge.size.xUnit == GraphicSize.SIZE_PRC)))) - { - if (((((ge.sprite) && (ge.sprite.parent))) && ((ge.sprite.parent.parent is UiRootContainer)))) - { - ge.sprite.width = int((ge.size.x * StageShareManager.startWidth)); - } - else - { - if (GraphicContainer(ge.sprite).getParent()) - { - ge.sprite.width = int((ge.size.x * GraphicContainer(ge.sprite).getParent().width)); - }; - }; - }; - if (((!(isNaN(ge.size.y))) && ((ge.size.yUnit == GraphicSize.SIZE_PRC)))) - { - if (((((ge.sprite) && (ge.sprite.parent))) && ((ge.sprite.parent.parent is UiRootContainer)))) - { - ge.sprite.height = int((ge.size.y * StageShareManager.startHeight)); - } - else - { - if (GraphicContainer(ge.sprite).getParent()) - { - ge.sprite.height = int((ge.size.y * GraphicContainer(ge.sprite).getParent().height)); - }; - }; - }; - }; - i++; - }; - } - - public function processLocation(geElem:GraphicElement):void - { - var ptTopLeftCorner:Point; - var ptBottomRightCorner:Point; - var startValueX:Number = geElem.sprite.x; - var startValueY:Number = geElem.sprite.y; - var startOffsetX:Number = geElem.location.getOffsetX(); - var startOffsetY:Number = geElem.location.getOffsetY(); - geElem.sprite.x = 0; - geElem.sprite.y = 0; - geElem.location.setOffsetX(startOffsetX); - geElem.location.setOffsetY(startOffsetY); - if (geElem.locations.length > 1) - { - geElem.sprite.width = 0; - geElem.sprite.height = 0; - ptTopLeftCorner = this.getLocation(new Point(geElem.sprite.x, geElem.sprite.y), geElem.locations[0], geElem.sprite); - ptBottomRightCorner = this.getLocation(new Point(geElem.sprite.x, geElem.sprite.y), geElem.locations[1], geElem.sprite); - if (((ptTopLeftCorner) && (ptBottomRightCorner))) - { - geElem.sprite.width = Math.floor(Math.abs((ptBottomRightCorner.x - ptTopLeftCorner.x))); - geElem.sprite.height = Math.floor(Math.abs((ptBottomRightCorner.y - ptTopLeftCorner.y))); - } - else - { - _log.error(((("Erreur de positionement dans " + name) + " avec ") + geElem.name)); - }; - }; - var ptNewPos:Point = this.getLocation(new Point(geElem.sprite.x, geElem.sprite.y), geElem.location, geElem.sprite); - if (((geElem.sprite) && (ptNewPos))) - { - geElem.sprite.x = ptNewPos.x; - geElem.sprite.y = ptNewPos.y; + return; + } + } + + private function isRegisteredId(param1:String) : Boolean + { + return !(this._aGraphicElementIndex[param1] == null); + } + + private function processSize() : void + { + var _loc1_:GraphicElement = null; + var _loc2_:uint = 0; + while(_loc2_ < this._aSizeStack.length) + { + _loc1_ = this._aSizeStack[_loc2_]; + if(_loc1_ != null) + { + if(!isNaN(_loc1_.size.x) && _loc1_.size.xUnit == GraphicSize.SIZE_PRC) + { + if((_loc1_.sprite) && (_loc1_.sprite.parent) && _loc1_.sprite.parent.parent is UiRootContainer) + { + _loc1_.sprite.width = int(_loc1_.size.x * StageShareManager.startWidth); + } + else if(GraphicContainer(_loc1_.sprite).getParent()) + { + _loc1_.sprite.width = int(_loc1_.size.x * GraphicContainer(_loc1_.sprite).getParent().width); + } + + } + if(!isNaN(_loc1_.size.y) && _loc1_.size.yUnit == GraphicSize.SIZE_PRC) + { + if((_loc1_.sprite) && (_loc1_.sprite.parent) && _loc1_.sprite.parent.parent is UiRootContainer) + { + _loc1_.sprite.height = int(_loc1_.size.y * StageShareManager.startHeight); + } + else if(GraphicContainer(_loc1_.sprite).getParent()) + { + _loc1_.sprite.height = int(_loc1_.size.y * GraphicContainer(_loc1_.sprite).getParent().height); + } + + } + } + _loc2_++; + } + } + + public function processLocation(param1:GraphicElement) : void + { + var _loc7_:Point = null; + var _loc8_:Point = null; + var _loc2_:Number = param1.sprite.x; + var _loc3_:Number = param1.sprite.y; + var _loc4_:Number = param1.location.getOffsetX(); + var _loc5_:Number = param1.location.getOffsetY(); + param1.sprite.x = 0; + param1.sprite.y = 0; + param1.location.setOffsetX(_loc4_); + param1.location.setOffsetY(_loc5_); + if(param1.locations.length > 1) + { + param1.sprite.width = 0; + param1.sprite.height = 0; + _loc7_ = this.getLocation(new Point(param1.sprite.x,param1.sprite.y),param1.locations[0],param1.sprite); + _loc8_ = this.getLocation(new Point(param1.sprite.x,param1.sprite.y),param1.locations[1],param1.sprite); + if((_loc7_) && (_loc8_)) + { + param1.sprite.width = Math.floor(Math.abs(_loc8_.x - _loc7_.x)); + param1.sprite.height = Math.floor(Math.abs(_loc8_.y - _loc7_.y)); } else { - geElem.sprite.x = startValueX; - geElem.sprite.y = startValueY; - _log.error(((("Erreur dans " + name) + " avec ") + geElem.name)); - }; - } - - private function getLocation(ptStart:Point, glLocation:GraphicLocation, doTarget:DisplayObject):Point - { - var doRelative:DisplayObject; - var ref:DisplayObject; - var uiTarget:Array; - var ui:UiRootContainer; - var pModificator:Point = new Point(); - var pRef:Point = new Point(); - var pTarget:Point = new Point(); - if ((((glLocation.offsetXType == LocationTypeEnum.LOCATION_TYPE_RELATIVE)) || ((glLocation.offsetYType == LocationTypeEnum.LOCATION_TYPE_RELATIVE)))) - { - pRef = doTarget.localToGlobal(new Point(doTarget.x, doTarget.y)); - switch (glLocation.getRelativeTo()) - { - case GraphicLocation.REF_PARENT: - pModificator.x = Math.floor((GraphicContainer(doTarget).getParent().width * glLocation.getOffsetX())); - pModificator.y = Math.floor((GraphicContainer(doTarget).getParent().height * glLocation.getOffsetY())); - break; - }; - if (glLocation.offsetXType == LocationTypeEnum.LOCATION_TYPE_RELATIVE) - { - ptStart.x = (ptStart.x + pModificator.x); - }; - if (glLocation.offsetYType == LocationTypeEnum.LOCATION_TYPE_RELATIVE) - { - ptStart.y = (ptStart.y + pModificator.y); - }; - }; - if ((((glLocation.offsetXType == LocationTypeEnum.LOCATION_TYPE_ABSOLUTE)) || ((glLocation.offsetYType == LocationTypeEnum.LOCATION_TYPE_ABSOLUTE)))) + _log.error("Erreur de positionement dans " + name + " avec " + param1.name); + } + } + var _loc6_:Point = this.getLocation(new Point(param1.sprite.x,param1.sprite.y),param1.location,param1.sprite); + if((param1.sprite) && (_loc6_)) + { + param1.sprite.x = _loc6_.x; + param1.sprite.y = _loc6_.y; + } + else + { + param1.sprite.x = _loc2_; + param1.sprite.y = _loc3_; + _log.error("Erreur dans " + name + " avec " + param1.name); + } + } + + private function getLocation(param1:Point, param2:GraphicLocation, param3:DisplayObject) : Point + { + var _loc7_:DisplayObject = null; + var _loc8_:DisplayObject = null; + var _loc9_:Array = null; + var _loc10_:UiRootContainer = null; + var _loc4_:Point = new Point(); + var _loc5_:Point = new Point(); + var _loc6_:Point = new Point(); + if(param2.offsetXType == LocationTypeEnum.LOCATION_TYPE_RELATIVE || param2.offsetYType == LocationTypeEnum.LOCATION_TYPE_RELATIVE) + { + _loc5_ = param3.localToGlobal(new Point(param3.x,param3.y)); + switch(param2.getRelativeTo()) + { + case GraphicLocation.REF_PARENT: + _loc4_.x = Math.floor(GraphicContainer(param3).getParent().width * param2.getOffsetX()); + _loc4_.y = Math.floor(GraphicContainer(param3).getParent().height * param2.getOffsetY()); + break; + } + if(param2.offsetXType == LocationTypeEnum.LOCATION_TYPE_RELATIVE) { - pModificator.x = 0; - pModificator.y = 0; - pRef = doTarget.localToGlobal(new Point(doTarget.x, doTarget.y)); - switch (glLocation.getRelativeTo()) - { - case GraphicLocation.REF_PARENT: - pModificator.x = glLocation.getOffsetX(); - pModificator.y = glLocation.getOffsetY(); - break; - case GraphicLocation.REF_SCREEN: - pTarget = doTarget.localToGlobal(new Point(doTarget.x, doTarget.y)); - pModificator.x = (glLocation.getOffsetX() - pTarget.x); - pModificator.y = (glLocation.getOffsetY() - pTarget.y); - break; - case GraphicLocation.REF_TOP: - pTarget = new Point(x, y); - pModificator.x = (glLocation.getOffsetX() + (pTarget.x - pRef.x)); - pModificator.y = (glLocation.getOffsetY() + (pTarget.y - pRef.y)); - break; - default: - if (this.isRegisteredId(glLocation.getRelativeTo())) - { - ref = this._aGraphicElementIndex[glLocation.getRelativeTo()].sprite; - } - else - { - if (Berilia.getInstance().getUi(glLocation.getRelativeTo())) - { - ref = Berilia.getInstance().getUi(glLocation.getRelativeTo()); - UiRootContainer(ref).addLinkedUi(name); - doTarget = ref; - } - else - { - if (glLocation.getRelativeTo().indexOf(".") != -1) - { - uiTarget = glLocation.getRelativeTo().split("."); - ui = Berilia.getInstance().getUi(uiTarget[0]); - if (!(ui)) - { - _log.warn((((((("[Warning] UI " + uiTarget[0]) + " does not exist (found ") + glLocation.getRelativeTo()) + " in ") + name) + ")")); - return (null); - }; - if (!(ui.getElementById(uiTarget[1]))) - { - _log.warn((((((((("[Warning] UI " + uiTarget[0]) + " does not contain element [") + uiTarget[1]) + "] (found ") + glLocation.getRelativeTo()) + " in ") + name) + ")")); - return (null); - }; - ref = ui.getElementById(uiTarget[1]).sprite; - pRef = doTarget.localToGlobal(new Point(doTarget.x, doTarget.y)); - GraphicContainer(ref).getUi().addLinkedUi(name); - } - else - { - _log.warn((("[Warning] " + glLocation.getRelativeTo()) + " is unknow graphic element reference")); - return (null); - }; - }; - }; - pTarget = doTarget.localToGlobal(new Point(ref.x, ref.y)); - pModificator.x = (glLocation.getOffsetX() + (pTarget.x - pRef.x)); - pModificator.y = (glLocation.getOffsetY() + (pTarget.y - pRef.y)); - }; - if (glLocation.offsetXType == LocationTypeEnum.LOCATION_TYPE_ABSOLUTE) - { - ptStart.x = (ptStart.x + pModificator.x); - }; - if (glLocation.offsetYType == LocationTypeEnum.LOCATION_TYPE_ABSOLUTE) - { - ptStart.y = (ptStart.y + pModificator.y); - }; - }; - pModificator = this.getOffsetModificator(glLocation.getPoint(), doTarget); - ptStart.x = (ptStart.x - pModificator.x); - ptStart.y = (ptStart.y - pModificator.y); - switch (glLocation.getRelativeTo()) + param1.x = param1.x + _loc4_.x; + } + if(param2.offsetYType == LocationTypeEnum.LOCATION_TYPE_RELATIVE) { - case GraphicLocation.REF_PARENT: - if (((doTarget.parent) && (doTarget.parent.parent))) - { - doRelative = doTarget.parent.parent; - }; - break; - case GraphicLocation.REF_SCREEN: - doRelative = this._root; - break; - case GraphicLocation.REF_TOP: - doRelative = this; - break; - default: - doRelative = ref; - if (doRelative == doTarget) - { - _log.warn((("[Warning] Wrong relative position : " + doRelative.name) + " refer to himself")); - }; - }; - pModificator = this.getOffsetModificator(glLocation.getRelativePoint(), doRelative); - ptStart.x = (ptStart.x + pModificator.x); - ptStart.y = (ptStart.y + pModificator.y); - return (ptStart); - } - - private function getOffsetModificator(nPoint:uint, doTarget:DisplayObject):Point - { - var nWidth:uint = (((((doTarget == null)) || ((doTarget is UiRootContainer)))) ? StageShareManager.startWidth : doTarget.width); - var nHeight:uint = (((((doTarget == null)) || ((doTarget is UiRootContainer)))) ? StageShareManager.startHeight : doTarget.height); - var pModificator:Point = new Point(0, 0); - switch (nPoint) + param1.y = param1.y + _loc4_.y; + } + } + if(param2.offsetXType == LocationTypeEnum.LOCATION_TYPE_ABSOLUTE || param2.offsetYType == LocationTypeEnum.LOCATION_TYPE_ABSOLUTE) + { + _loc4_.x = 0; + _loc4_.y = 0; + _loc5_ = param3.localToGlobal(new Point(param3.x,param3.y)); + switch(param2.getRelativeTo()) + { + case GraphicLocation.REF_PARENT: + _loc4_.x = param2.getOffsetX(); + _loc4_.y = param2.getOffsetY(); + break; + case GraphicLocation.REF_SCREEN: + _loc6_ = param3.localToGlobal(new Point(param3.x,param3.y)); + _loc4_.x = param2.getOffsetX() - _loc6_.x; + _loc4_.y = param2.getOffsetY() - _loc6_.y; + break; + case GraphicLocation.REF_TOP: + _loc6_ = new Point(x,y); + _loc4_.x = param2.getOffsetX() + (_loc6_.x - _loc5_.x); + _loc4_.y = param2.getOffsetY() + (_loc6_.y - _loc5_.y); + break; + default: + if(this.isRegisteredId(param2.getRelativeTo())) + { + _loc8_ = this._aGraphicElementIndex[param2.getRelativeTo()].sprite; + } + else if(Berilia.getInstance().getUi(param2.getRelativeTo())) + { + _loc8_ = Berilia.getInstance().getUi(param2.getRelativeTo()); + UiRootContainer(_loc8_).addLinkedUi(name); + var param3:DisplayObject = _loc8_; + } + else if(param2.getRelativeTo().indexOf(".") != -1) + { + _loc9_ = param2.getRelativeTo().split("."); + _loc10_ = Berilia.getInstance().getUi(_loc9_[0]); + if(!_loc10_) + { + _log.warn("[Warning] UI " + _loc9_[0] + " does not exist (found " + param2.getRelativeTo() + " in " + name + ")"); + return null; + } + if(!_loc10_.getElementById(_loc9_[1])) + { + _log.warn("[Warning] UI " + _loc9_[0] + " does not contain element [" + _loc9_[1] + "] (found " + param2.getRelativeTo() + " in " + name + ")"); + return null; + } + _loc8_ = _loc10_.getElementById(_loc9_[1]).sprite; + _loc5_ = param3.localToGlobal(new Point(param3.x,param3.y)); + GraphicContainer(_loc8_).getUi().addLinkedUi(name); + } + else + { + _log.warn("[Warning] " + param2.getRelativeTo() + " is unknow graphic element reference"); + return null; + } + + + _loc6_ = param3.localToGlobal(new Point(_loc8_.x,_loc8_.y)); + _loc4_.x = param2.getOffsetX() + (_loc6_.x - _loc5_.x); + _loc4_.y = param2.getOffsetY() + (_loc6_.y - _loc5_.y); + } + if(param2.offsetXType == LocationTypeEnum.LOCATION_TYPE_ABSOLUTE) { - case LocationEnum.POINT_TOPLEFT: - break; - case LocationEnum.POINT_TOP: - pModificator.x = (nWidth / 2); - break; - case LocationEnum.POINT_TOPRIGHT: - pModificator.x = nWidth; - break; - case LocationEnum.POINT_LEFT: - pModificator.y = (nWidth / 2); - break; - case LocationEnum.POINT_CENTER: - pModificator.x = (nWidth / 2); - pModificator.y = (nHeight / 2); - break; - case LocationEnum.POINT_RIGHT: - pModificator.x = nWidth; - pModificator.y = (nHeight / 2); - break; - case LocationEnum.POINT_BOTTOMLEFT: - pModificator.y = nHeight; - break; - case LocationEnum.POINT_BOTTOM: - pModificator.x = (nWidth / 2); - pModificator.y = nHeight; - break; - case LocationEnum.POINT_BOTTOMRIGHT: - pModificator.x = nWidth; - pModificator.y = nHeight; - break; - }; - return (pModificator); - } - - private function zSort(aSort:Array):Boolean - { - var ge:GraphicElement; - var gl:GraphicLocation; - var i:uint; - var j:uint; - var k:uint; - var bChange:Boolean = true; - var bSwap:Boolean; - while (bChange) + param1.x = param1.x + _loc4_.x; + } + if(param2.offsetYType == LocationTypeEnum.LOCATION_TYPE_ABSOLUTE) { - bChange = false; - i = 0; - while (i < aSort.length) - { - ge = aSort[i]; - if (ge != null) - { - j = 0; - while (j < ge.locations.length) + param1.y = param1.y + _loc4_.y; + } + } + _loc4_ = this.getOffsetModificator(param2.getPoint(),param3); + param1.x = param1.x - _loc4_.x; + param1.y = param1.y - _loc4_.y; + switch(param2.getRelativeTo()) + { + case GraphicLocation.REF_PARENT: + if((param3.parent) && (param3.parent.parent)) + { + _loc7_ = param3.parent.parent; + } + break; + case GraphicLocation.REF_SCREEN: + _loc7_ = this._root; + break; + case GraphicLocation.REF_TOP: + _loc7_ = this; + break; + default: + _loc7_ = _loc8_; + if(_loc7_ == param3) + { + _log.warn("[Warning] Wrong relative position : " + _loc7_.name + " refer to himself"); + } + } + _loc4_ = this.getOffsetModificator(param2.getRelativePoint(),_loc7_); + param1.x = param1.x + _loc4_.x; + param1.y = param1.y + _loc4_.y; + return param1; + } + + private function getOffsetModificator(param1:uint, param2:DisplayObject) : Point + { + var _loc3_:uint = param2 == null || param2 is UiRootContainer?StageShareManager.startWidth:param2.width; + var _loc4_:uint = param2 == null || param2 is UiRootContainer?StageShareManager.startHeight:param2.height; + var _loc5_:Point = new Point(0,0); + switch(param1) + { + case LocationEnum.POINT_TOPLEFT: + break; + case LocationEnum.POINT_TOP: + _loc5_.x = _loc3_ / 2; + break; + case LocationEnum.POINT_TOPRIGHT: + _loc5_.x = _loc3_; + break; + case LocationEnum.POINT_LEFT: + _loc5_.y = _loc3_ / 2; + break; + case LocationEnum.POINT_CENTER: + _loc5_.x = _loc3_ / 2; + _loc5_.y = _loc4_ / 2; + break; + case LocationEnum.POINT_RIGHT: + _loc5_.x = _loc3_; + _loc5_.y = _loc4_ / 2; + break; + case LocationEnum.POINT_BOTTOMLEFT: + _loc5_.y = _loc4_; + break; + case LocationEnum.POINT_BOTTOM: + _loc5_.x = _loc3_ / 2; + _loc5_.y = _loc4_; + break; + case LocationEnum.POINT_BOTTOMRIGHT: + _loc5_.x = _loc3_; + _loc5_.y = _loc4_; + break; + } + return _loc5_; + } + + private function zSort(param1:Array) : Boolean + { + var _loc2_:GraphicElement = null; + var _loc3_:GraphicLocation = null; + var _loc6_:uint = 0; + var _loc7_:uint = 0; + var _loc8_:uint = 0; + var _loc4_:* = true; + var _loc5_:* = false; + while(_loc4_) + { + _loc4_ = false; + _loc6_ = 0; + while(_loc6_ < param1.length) + { + _loc2_ = param1[_loc6_]; + if(_loc2_ != null) + { + _loc7_ = 0; + while(_loc7_ < _loc2_.locations.length) + { + _loc8_ = _loc6_ + 1; + while(_loc8_ < param1.length) + { + _loc3_ = _loc2_.locations[_loc7_]; + if(param1[_loc8_] != null) { - k = (i + 1); - while (k < aSort.length) - { - gl = ge.locations[j]; - if (aSort[k] != null) - { - if (((((!((gl.getRelativeTo().charAt(0) == "$"))) && ((gl.getRelativeTo() == aSort[k].sprite.name)))) || ((((gl.getRelativeTo() == GraphicLocation.REF_PARENT)) && ((aSort[k].sprite == ge.sprite.getParent())))))) - { - bSwap = true; - bChange = true; - aSort[i] = aSort[k]; - aSort[k] = ge; - break; - }; - }; - k++; - }; - j++; - }; - }; - i++; - }; - }; - return (bSwap); - } - - private function onDefinitionUpdateTimer(e:TimerEvent):void - { - UiRenderManager.getInstance().updateCachedUiDefinition(); - this._uiDefinitionUpdateTimer.removeEventListener(TimerEvent.TIMER, this.onDefinitionUpdateTimer); - this._uiDefinitionUpdateTimer = null; - } - - - } -}//package com.ankamagames.berilia.types.graphic - + if(!(_loc3_.getRelativeTo().charAt(0) == "$") && _loc3_.getRelativeTo() == param1[_loc8_].sprite.name || _loc3_.getRelativeTo() == GraphicLocation.REF_PARENT && param1[_loc8_].sprite == _loc2_.sprite.getParent()) + { + _loc5_ = true; + _loc4_ = true; + param1[_loc6_] = param1[_loc8_]; + param1[_loc8_] = _loc2_; + break; + } + } + _loc8_++; + } + _loc7_++; + } + } + _loc6_++; + } + } + return _loc5_; + } + + private function onDefinitionUpdateTimer(param1:TimerEvent) : void + { + UiRenderManager.getInstance().updateCachedUiDefinition(); + this._uiDefinitionUpdateTimer.removeEventListener(TimerEvent.TIMER,this.onDefinitionUpdateTimer); + this._uiDefinitionUpdateTimer = null; + } + } +} diff --git a/com/ankamagames/berilia/types/listener/GenericListener.as b/com/ankamagames/berilia/types/listener/GenericListener.as index 7bb3bafe1..37bcafd8d 100644 --- a/com/ankamagames/berilia/types/listener/GenericListener.as +++ b/com/ankamagames/berilia/types/listener/GenericListener.as @@ -1,109 +1,114 @@ -package com.ankamagames.berilia.types.listener +package com.ankamagames.berilia.types.listener { - import com.ankamagames.jerakine.interfaces.IDestroyable; - import com.ankamagames.jerakine.logger.Logger; - import com.ankamagames.jerakine.logger.Log; - import flash.utils.getQualifiedClassName; - import com.ankamagames.jerakine.utils.memory.WeakReference; - - public class GenericListener implements IDestroyable - { - - public static const LISTENER_TYPE_UI:uint = 0; - public static const LISTENER_TYPE_MODULE:uint = 1; - protected static const _log:Logger = Log.getLogger(getQualifiedClassName(GenericListener)); - - private var _sEvent:String; - private var _oListener; - private var _fCallback:Function; - private var _nSortIndex:int; - private var _nListenerType:uint; - private var _nListenerContext:WeakReference; - - public function GenericListener(sEvent:String=null, oListener:*=null, fCallback:Function=null, nSortIndex:int=0, listener_type:uint=1, listenerContext:WeakReference=null) - { - if (sEvent != null) - { - this._sEvent = sEvent; - }; - if (oListener != null) - { - this.listener = oListener; - }; - if (fCallback != null) - { - this._fCallback = fCallback; - }; - this._nSortIndex = nSortIndex; - this._nListenerType = listener_type; - this._nListenerContext = listenerContext; - } - - public function get event():String - { - return (this._sEvent); - } - - public function set event(sEvent:String):void - { - this._sEvent = sEvent; - } - - public function get listener() - { - return (this._oListener); - } - - public function set listener(oListener:*):void - { - this._oListener = oListener; - } - - public function get callback():Function - { - return (this._fCallback); - } - - public function set callback(fCallback:Function):void - { - this._fCallback = fCallback; - } - - public function get sortIndex():int - { - return (this._nSortIndex); - } - - public function set sortIndex(n:int):void - { - this._nSortIndex = n; - } - - public function get listenerType():uint - { - return (this._nListenerType); - } - - public function get listenerContext():WeakReference - { - return (this._nListenerContext); - } - - public function destroy():void - { - this._sEvent = null; - this._oListener = null; - this._fCallback = null; - this._nSortIndex = 0; - this._nListenerType = 0; - if (this._nListenerContext) - { - this._nListenerContext.destroy(); - }; - this._nListenerContext = null; - } - - - } -}//package com.ankamagames.berilia.types.listener - + import com.ankamagames.jerakine.interfaces.IDestroyable; + import com.ankamagames.jerakine.logger.Logger; + import com.ankamagames.jerakine.logger.Log; + import flash.utils.getQualifiedClassName; + import com.ankamagames.jerakine.utils.memory.WeakReference; + + public class GenericListener extends Object implements IDestroyable + { + + public function GenericListener(param1:String = null, param2:* = null, param3:Function = null, param4:int = 0, param5:uint = 1, param6:WeakReference = null) + { + super(); + if(param1 != null) + { + this._sEvent = param1; + } + if(param2 != null) + { + this.listener = param2; + } + if(param3 != null) + { + this._fCallback = param3; + } + this._nSortIndex = param4; + this._nListenerType = param5; + this._nListenerContext = param6; + } + + public static const LISTENER_TYPE_UI:uint = 0; + + public static const LISTENER_TYPE_MODULE:uint = 1; + + protected static const _log:Logger = Log.getLogger(getQualifiedClassName(GenericListener)); + + private var _sEvent:String; + + private var _oListener; + + private var _fCallback:Function; + + private var _nSortIndex:int; + + private var _nListenerType:uint; + + private var _nListenerContext:WeakReference; + + public function get event() : String + { + return this._sEvent; + } + + public function set event(param1:String) : void + { + this._sEvent = param1; + } + + public function get listener() : * + { + return this._oListener; + } + + public function set listener(param1:*) : void + { + this._oListener = param1; + } + + public function get callback() : Function + { + return this._fCallback; + } + + public function set callback(param1:Function) : void + { + this._fCallback = param1; + } + + public function get sortIndex() : int + { + return this._nSortIndex; + } + + public function set sortIndex(param1:int) : void + { + this._nSortIndex = param1; + } + + public function get listenerType() : uint + { + return this._nListenerType; + } + + public function get listenerContext() : WeakReference + { + return this._nListenerContext; + } + + public function destroy() : void + { + this._sEvent = null; + this._oListener = null; + this._fCallback = null; + this._nSortIndex = 0; + this._nListenerType = 0; + if(this._nListenerContext) + { + this._nListenerContext.destroy(); + } + this._nListenerContext = null; + } + } +} diff --git a/com/ankamagames/berilia/types/messages/AllModulesLoadedMessage.as b/com/ankamagames/berilia/types/messages/AllModulesLoadedMessage.as index d5f442925..79d8b5e1e 100644 --- a/com/ankamagames/berilia/types/messages/AllModulesLoadedMessage.as +++ b/com/ankamagames/berilia/types/messages/AllModulesLoadedMessage.as @@ -1,11 +1,13 @@ -package com.ankamagames.berilia.types.messages +package com.ankamagames.berilia.types.messages { - import com.ankamagames.jerakine.messages.Message; - - public class AllModulesLoadedMessage implements Message - { - - - } -}//package com.ankamagames.berilia.types.messages - + import com.ankamagames.jerakine.messages.Message; + + public class AllModulesLoadedMessage extends Object implements Message + { + + public function AllModulesLoadedMessage() + { + super(); + } + } +} diff --git a/com/ankamagames/berilia/types/messages/AllUiXmlParsedMessage.as b/com/ankamagames/berilia/types/messages/AllUiXmlParsedMessage.as index e9926ed54..d4c7ebcb8 100644 --- a/com/ankamagames/berilia/types/messages/AllUiXmlParsedMessage.as +++ b/com/ankamagames/berilia/types/messages/AllUiXmlParsedMessage.as @@ -1,11 +1,13 @@ -package com.ankamagames.berilia.types.messages +package com.ankamagames.berilia.types.messages { - import com.ankamagames.jerakine.messages.Message; - - public class AllUiXmlParsedMessage implements Message - { - - - } -}//package com.ankamagames.berilia.types.messages - + import com.ankamagames.jerakine.messages.Message; + + public class AllUiXmlParsedMessage extends Object implements Message + { + + public function AllUiXmlParsedMessage() + { + super(); + } + } +} diff --git a/com/ankamagames/berilia/types/messages/ModuleExecErrorMessage.as b/com/ankamagames/berilia/types/messages/ModuleExecErrorMessage.as index 79c43e75c..262a31bcc 100644 --- a/com/ankamagames/berilia/types/messages/ModuleExecErrorMessage.as +++ b/com/ankamagames/berilia/types/messages/ModuleExecErrorMessage.as @@ -1,30 +1,29 @@ -package com.ankamagames.berilia.types.messages +package com.ankamagames.berilia.types.messages { - import com.ankamagames.jerakine.messages.Message; - - public class ModuleExecErrorMessage implements Message - { - - private var _moduleName:String; - private var _stackTrace:String; - - public function ModuleExecErrorMessage(moduleName:String, stackTrace:String) - { - this._moduleName = moduleName; - this._stackTrace = stackTrace; - } - - public function get moduleName():String - { - return (this._moduleName); - } - - public function get stackTrace():String - { - return (this._stackTrace); - } - - - } -}//package com.ankamagames.berilia.types.messages - + import com.ankamagames.jerakine.messages.Message; + + public class ModuleExecErrorMessage extends Object implements Message + { + + public function ModuleExecErrorMessage(param1:String, param2:String) + { + super(); + this._moduleName = param1; + this._stackTrace = param2; + } + + private var _moduleName:String; + + private var _stackTrace:String; + + public function get moduleName() : String + { + return this._moduleName; + } + + public function get stackTrace() : String + { + return this._stackTrace; + } + } +} diff --git a/com/ankamagames/berilia/types/messages/ModuleLoadedMessage.as b/com/ankamagames/berilia/types/messages/ModuleLoadedMessage.as index eb32aaf20..6672933ad 100644 --- a/com/ankamagames/berilia/types/messages/ModuleLoadedMessage.as +++ b/com/ankamagames/berilia/types/messages/ModuleLoadedMessage.as @@ -1,23 +1,21 @@ -package com.ankamagames.berilia.types.messages +package com.ankamagames.berilia.types.messages { - import com.ankamagames.jerakine.messages.Message; - - public class ModuleLoadedMessage implements Message - { - - private var _moduleName:String; - - public function ModuleLoadedMessage(moduleName:String) - { - this._moduleName = moduleName; - } - - public function get moduleName():String - { - return (this._moduleName); - } - - - } -}//package com.ankamagames.berilia.types.messages - + import com.ankamagames.jerakine.messages.Message; + + public class ModuleLoadedMessage extends Object implements Message + { + + public function ModuleLoadedMessage(param1:String) + { + super(); + this._moduleName = param1; + } + + private var _moduleName:String; + + public function get moduleName() : String + { + return this._moduleName; + } + } +} diff --git a/com/ankamagames/berilia/types/messages/ModuleRessourceLoadFailedMessage.as b/com/ankamagames/berilia/types/messages/ModuleRessourceLoadFailedMessage.as index c78fe9706..d631da241 100644 --- a/com/ankamagames/berilia/types/messages/ModuleRessourceLoadFailedMessage.as +++ b/com/ankamagames/berilia/types/messages/ModuleRessourceLoadFailedMessage.as @@ -1,38 +1,38 @@ -package com.ankamagames.berilia.types.messages +package com.ankamagames.berilia.types.messages { - import com.ankamagames.jerakine.messages.Message; - import com.ankamagames.jerakine.types.Uri; - - public class ModuleRessourceLoadFailedMessage implements Message - { - - private var _moduleName:String; - private var _uri:Uri; - private var _isImportant:Boolean; - - public function ModuleRessourceLoadFailedMessage(moduleName:String, uri:Uri, isImportant:Boolean=true) - { - this._moduleName = moduleName; - this._uri = uri; - this._isImportant = isImportant; - } - - public function get moduleName():String - { - return (this._moduleName); - } - - public function get uri():Uri - { - return (this._uri); - } - - public function get isImportant():Boolean - { - return (this._isImportant); - } - - - } -}//package com.ankamagames.berilia.types.messages - + import com.ankamagames.jerakine.messages.Message; + import com.ankamagames.jerakine.types.Uri; + + public class ModuleRessourceLoadFailedMessage extends Object implements Message + { + + public function ModuleRessourceLoadFailedMessage(param1:String, param2:Uri, param3:Boolean = true) + { + super(); + this._moduleName = param1; + this._uri = param2; + this._isImportant = param3; + } + + private var _moduleName:String; + + private var _uri:Uri; + + private var _isImportant:Boolean; + + public function get moduleName() : String + { + return this._moduleName; + } + + public function get uri() : Uri + { + return this._uri; + } + + public function get isImportant() : Boolean + { + return this._isImportant; + } + } +} diff --git a/com/ankamagames/berilia/types/messages/NoThemeErrorMessage.as b/com/ankamagames/berilia/types/messages/NoThemeErrorMessage.as index 19bfc16dd..e11571620 100644 --- a/com/ankamagames/berilia/types/messages/NoThemeErrorMessage.as +++ b/com/ankamagames/berilia/types/messages/NoThemeErrorMessage.as @@ -1,11 +1,13 @@ -package com.ankamagames.berilia.types.messages +package com.ankamagames.berilia.types.messages { - import com.ankamagames.jerakine.messages.Message; - - public class NoThemeErrorMessage implements Message - { - - - } -}//package com.ankamagames.berilia.types.messages - + import com.ankamagames.jerakine.messages.Message; + + public class NoThemeErrorMessage extends Object implements Message + { + + public function NoThemeErrorMessage() + { + super(); + } + } +} diff --git a/com/ankamagames/berilia/types/messages/ThemeLoadErrorMessage.as b/com/ankamagames/berilia/types/messages/ThemeLoadErrorMessage.as index 97b1f4fff..9669c92d5 100644 --- a/com/ankamagames/berilia/types/messages/ThemeLoadErrorMessage.as +++ b/com/ankamagames/berilia/types/messages/ThemeLoadErrorMessage.as @@ -1,23 +1,21 @@ -package com.ankamagames.berilia.types.messages +package com.ankamagames.berilia.types.messages { - import com.ankamagames.jerakine.messages.Message; - - public class ThemeLoadErrorMessage implements Message - { - - private var _themeName:String; - - public function ThemeLoadErrorMessage(themeName:String) - { - this._themeName = themeName; - } - - public function get themeName():String - { - return (this._themeName); - } - - - } -}//package com.ankamagames.berilia.types.messages - + import com.ankamagames.jerakine.messages.Message; + + public class ThemeLoadErrorMessage extends Object implements Message + { + + public function ThemeLoadErrorMessage(param1:String) + { + super(); + this._themeName = param1; + } + + private var _themeName:String; + + public function get themeName() : String + { + return this._themeName; + } + } +} diff --git a/com/ankamagames/berilia/types/messages/ThemeLoadedMessage.as b/com/ankamagames/berilia/types/messages/ThemeLoadedMessage.as index a45c72b66..c273960b2 100644 --- a/com/ankamagames/berilia/types/messages/ThemeLoadedMessage.as +++ b/com/ankamagames/berilia/types/messages/ThemeLoadedMessage.as @@ -1,23 +1,21 @@ -package com.ankamagames.berilia.types.messages +package com.ankamagames.berilia.types.messages { - import com.ankamagames.jerakine.messages.Message; - - public class ThemeLoadedMessage implements Message - { - - private var _themeName:String; - - public function ThemeLoadedMessage(themeName:String) - { - this._themeName = themeName; - } - - public function get themeName():String - { - return (this._themeName); - } - - - } -}//package com.ankamagames.berilia.types.messages - + import com.ankamagames.jerakine.messages.Message; + + public class ThemeLoadedMessage extends Object implements Message + { + + public function ThemeLoadedMessage(param1:String) + { + super(); + this._themeName = param1; + } + + private var _themeName:String; + + public function get themeName() : String + { + return this._themeName; + } + } +} diff --git a/com/ankamagames/berilia/types/messages/UiXmlParsedErrorMessage.as b/com/ankamagames/berilia/types/messages/UiXmlParsedErrorMessage.as index 216b758b7..fea0dcaf8 100644 --- a/com/ankamagames/berilia/types/messages/UiXmlParsedErrorMessage.as +++ b/com/ankamagames/berilia/types/messages/UiXmlParsedErrorMessage.as @@ -1,30 +1,29 @@ -package com.ankamagames.berilia.types.messages +package com.ankamagames.berilia.types.messages { - import com.ankamagames.jerakine.messages.Message; - - public class UiXmlParsedErrorMessage implements Message - { - - private var _url:String; - private var _msg:String; - - public function UiXmlParsedErrorMessage(url:String, msg:String) - { - this._url = url; - this._msg = msg; - } - - public function get url():String - { - return (this._url); - } - - public function get msg():String - { - return (this._msg); - } - - - } -}//package com.ankamagames.berilia.types.messages - + import com.ankamagames.jerakine.messages.Message; + + public class UiXmlParsedErrorMessage extends Object implements Message + { + + public function UiXmlParsedErrorMessage(param1:String, param2:String) + { + super(); + this._url = param1; + this._msg = param2; + } + + private var _url:String; + + private var _msg:String; + + public function get url() : String + { + return this._url; + } + + public function get msg() : String + { + return this._msg; + } + } +} diff --git a/com/ankamagames/berilia/types/messages/UiXmlParsedMessage.as b/com/ankamagames/berilia/types/messages/UiXmlParsedMessage.as index e6e8bcc1f..e7f99f2c4 100644 --- a/com/ankamagames/berilia/types/messages/UiXmlParsedMessage.as +++ b/com/ankamagames/berilia/types/messages/UiXmlParsedMessage.as @@ -1,23 +1,21 @@ -package com.ankamagames.berilia.types.messages +package com.ankamagames.berilia.types.messages { - import com.ankamagames.jerakine.messages.Message; - - public class UiXmlParsedMessage implements Message - { - - private var _url:String; - - public function UiXmlParsedMessage(url:String) - { - this._url = url; - } - - public function get url():String - { - return (this._url); - } - - - } -}//package com.ankamagames.berilia.types.messages - + import com.ankamagames.jerakine.messages.Message; + + public class UiXmlParsedMessage extends Object implements Message + { + + public function UiXmlParsedMessage(param1:String) + { + super(); + this._url = param1; + } + + private var _url:String; + + public function get url() : String + { + return this._url; + } + } +} diff --git a/com/ankamagames/berilia/types/shortcut/Bind.as b/com/ankamagames/berilia/types/shortcut/Bind.as index a5d23df17..daa915018 100644 --- a/com/ankamagames/berilia/types/shortcut/Bind.as +++ b/com/ankamagames/berilia/types/shortcut/Bind.as @@ -1,85 +1,84 @@ -package com.ankamagames.berilia.types.shortcut +package com.ankamagames.berilia.types.shortcut { - import com.ankamagames.jerakine.interfaces.IDataCenter; - import com.ankamagames.jerakine.data.I18n; - - public class Bind implements IDataCenter - { - - public var key:String; - public var targetedShortcut:String; - public var alt:Boolean; - public var ctrl:Boolean; - public var shift:Boolean; - public var disabled:Boolean; - - public function Bind(sKey:String=null, targetedShortcut:String="", bAlt:Boolean=false, bCtrl:Boolean=false, bShift:Boolean=false) - { - if (sKey) + import com.ankamagames.jerakine.interfaces.IDataCenter; + import com.ankamagames.jerakine.data.I18n; + + public class Bind extends Object implements IDataCenter + { + + public function Bind(param1:String = null, param2:String = "", param3:Boolean = false, param4:Boolean = false, param5:Boolean = false) + { + super(); + if(param1) + { + this.targetedShortcut = param2; + this.key = param1; + this.alt = param3; + this.ctrl = param4; + this.shift = param5; + this.disabled = false; + } + } + + public var key:String; + + public var targetedShortcut:String; + + public var alt:Boolean; + + public var ctrl:Boolean; + + public var shift:Boolean; + + public var disabled:Boolean; + + public function toString() : String + { + var _loc2_:String = null; + var _loc1_:* = ""; + if(this.key != null) + { + _loc1_ = this.alt?"Alt+":""; + _loc1_ = _loc1_ + (this.ctrl?"Ctrl+":""); + _loc1_ = _loc1_ + (this.shift?I18n.getUiText("ui.keyboard.shift") + "+":""); + if(this.key.charAt(0) == "(" && this.key.charAt(this.key.length - 1) == ")") { - this.targetedShortcut = targetedShortcut; - this.key = sKey; - this.alt = bAlt; - this.ctrl = bCtrl; - this.shift = bShift; - this.disabled = false; - }; - } - - [NoReplaceInFakeClass] - public function toString():String - { - var keyStr:String; - var textValue:String = ""; - if (this.key != null) + _loc2_ = this.key.substr(1,this.key.length - 2); + } + else { - textValue = ((this.alt) ? "Alt+" : ""); - textValue = (textValue + ((this.ctrl) ? "Ctrl+" : "")); - textValue = (textValue + ((this.shift) ? (I18n.getUiText("ui.keyboard.shift") + "+") : "")); - if ((((this.key.charAt(0) == "(")) && ((this.key.charAt((this.key.length - 1)) == ")")))) - { - keyStr = this.key.substr(1, (this.key.length - 2)); - } - else - { - keyStr = this.key; - }; - if (I18n.hasUiText(("ui.keyboard." + keyStr.toLowerCase()))) - { - textValue = (textValue + I18n.getUiText(("ui.keyboard." + keyStr.toLowerCase()))); - } - else - { - textValue = (textValue + ((this.shift) ? keyStr.toLowerCase() : keyStr)); - }; - }; - return (textValue); - } - - [NoReplaceInFakeClass] - public function equals(s:Bind):Boolean - { - return (((((((((s) && ((((((s.key == null)) && ((this.key == null)))) || (((((!((this.key == null))) && (!((s.key == null))))) && ((s.key.toLocaleUpperCase() == this.key.toLocaleUpperCase())))))))) && ((s.alt == this.alt)))) && ((s.ctrl == this.ctrl)))) && ((s.shift == this.shift)))); - } - - [NoReplaceInFakeClass] - public function reset():void - { - this.key = null; - this.alt = false; - this.ctrl = false; - this.shift = false; - } - - [NoReplaceInFakeClass] - public function copy():Bind - { - var b:Bind = new Bind(this.key, this.targetedShortcut, this.alt, this.ctrl, this.shift); - b.disabled = this.disabled; - return (b); - } - - - } -}//package com.ankamagames.berilia.types.shortcut - + _loc2_ = this.key; + } + if(I18n.hasUiText("ui.keyboard." + _loc2_.toLowerCase())) + { + _loc1_ = _loc1_ + I18n.getUiText("ui.keyboard." + _loc2_.toLowerCase()); + } + else + { + _loc1_ = _loc1_ + (this.shift?_loc2_.toLowerCase():_loc2_); + } + } + return _loc1_; + } + + public function equals(param1:Bind) : Boolean + { + return (param1 && (param1.key == null && this.key == null || !(this.key == null) && !(param1.key == null) && param1.key.toLocaleUpperCase() == this.key.toLocaleUpperCase()) && param1.alt == this.alt) && param1.ctrl == this.ctrl && param1.shift == this.shift; + } + + public function reset() : void + { + this.key = null; + this.alt = false; + this.ctrl = false; + this.shift = false; + } + + public function copy() : Bind + { + var _loc1_:Bind = new Bind(this.key,this.targetedShortcut,this.alt,this.ctrl,this.shift); + _loc1_.disabled = this.disabled; + return _loc1_; + } + } +} diff --git a/com/ankamagames/berilia/types/shortcut/LocalizedKeyboard.as b/com/ankamagames/berilia/types/shortcut/LocalizedKeyboard.as index 2a93068dc..ea1b7aea1 100644 --- a/com/ankamagames/berilia/types/shortcut/LocalizedKeyboard.as +++ b/com/ankamagames/berilia/types/shortcut/LocalizedKeyboard.as @@ -1,37 +1,37 @@ -package com.ankamagames.berilia.types.shortcut +package com.ankamagames.berilia.types.shortcut { - import com.ankamagames.jerakine.types.Uri; - - public class LocalizedKeyboard - { - - private var _uri:Uri; - private var _locale:String; - private var _description:String; - - public function LocalizedKeyboard(uri:Uri, locale:String, description:String) - { - this._uri = uri; - this._locale = locale; - this._description = description; - } - - public function get uri():Uri - { - return (this._uri); - } - - public function get locale():String - { - return (this._locale); - } - - public function get description():String - { - return (this._description); - } - - - } -}//package com.ankamagames.berilia.types.shortcut - + import com.ankamagames.jerakine.types.Uri; + + public class LocalizedKeyboard extends Object + { + + public function LocalizedKeyboard(param1:Uri, param2:String, param3:String) + { + super(); + this._uri = param1; + this._locale = param2; + this._description = param3; + } + + private var _uri:Uri; + + private var _locale:String; + + private var _description:String; + + public function get uri() : Uri + { + return this._uri; + } + + public function get locale() : String + { + return this._locale; + } + + public function get description() : String + { + return this._description; + } + } +} diff --git a/com/ankamagames/berilia/types/shortcut/Shortcut.as b/com/ankamagames/berilia/types/shortcut/Shortcut.as index af628a5b5..efdae51ff 100644 --- a/com/ankamagames/berilia/types/shortcut/Shortcut.as +++ b/com/ankamagames/berilia/types/shortcut/Shortcut.as @@ -1,251 +1,263 @@ -package com.ankamagames.berilia.types.shortcut +package com.ankamagames.berilia.types.shortcut { - import com.ankamagames.jerakine.interfaces.IDataCenter; - import com.ankamagames.jerakine.types.DataStoreType; - import com.ankamagames.jerakine.types.enums.DataStoreEnum; - import com.ankamagames.berilia.utils.errors.BeriliaError; - import com.ankamagames.berilia.managers.BindsManager; - import flash.utils.Dictionary; - import com.ankamagames.jerakine.managers.StoreDataManager; - - public class Shortcut implements IDataCenter - { - - private static var _shortcuts:Array = new Array(); - private static var _idCount:uint = 0; - private static var _datastoreType:DataStoreType = new DataStoreType("Module_Ankama_Config", true, DataStoreEnum.LOCATION_LOCAL, DataStoreEnum.BIND_CHARACTER); - - private var _name:String; - private var _description:String; - private var _tooltipContent:String; - private var _textfieldEnabled:Boolean; - private var _bindable:Boolean; - private var _category:ShortcutCategory; - private var _unicID:uint = 0; - private var _visible:Boolean; - private var _disable:Boolean; - private var _required:Boolean; - private var _holdKeys:Boolean; - public var defaultBind:Bind; - - public function Shortcut(name:String, textfieldEnabled:Boolean=false, description:String=null, category:ShortcutCategory=null, bindable:Boolean=true, pVisible:Boolean=true, pRequired:Boolean=false, pHoldKeys:Boolean=false, tooltipContent:String=null) - { - if (_shortcuts[name]) - { - throw (new BeriliaError((("Shortcut name [" + name) + "] is already use"))); - }; - _shortcuts[name] = this; - this._name = name; - this._description = description; - this._textfieldEnabled = textfieldEnabled; - this._category = category; + import com.ankamagames.jerakine.interfaces.IDataCenter; + import com.ankamagames.jerakine.types.DataStoreType; + import com.ankamagames.berilia.managers.BindsManager; + import flash.utils.Dictionary; + import com.ankamagames.jerakine.managers.StoreDataManager; + import com.ankamagames.jerakine.types.enums.DataStoreEnum; + import com.ankamagames.berilia.utils.errors.BeriliaError; + + public class Shortcut extends Object implements IDataCenter + { + + public function Shortcut(param1:String, param2:Boolean = false, param3:String = null, param4:ShortcutCategory = null, param5:Boolean = true, param6:Boolean = true, param7:Boolean = false, param8:Boolean = false, param9:String = null) + { + super(); + if(_shortcuts[param1]) + { + throw new BeriliaError("Shortcut name [" + param1 + "] is already use"); + } + else + { + _shortcuts[param1] = this; + this._name = param1; + this._description = param3; + this._textfieldEnabled = param2; + this._category = param4; this._unicID = _idCount++; - this._bindable = bindable; - this._visible = pVisible; - this._required = pRequired; - this._holdKeys = pHoldKeys; - this._tooltipContent = tooltipContent; + this._bindable = param5; + this._visible = param6; + this._required = param7; + this._holdKeys = param8; + this._tooltipContent = param9; this._disable = false; BindsManager.getInstance().newShortcut(this); - } - - public static function reset():void - { - BindsManager.destroy(); - _shortcuts = []; - _idCount = 0; - } - - public static function loadSavedData():void - { - var sc:Shortcut; - var newData:Dictionary; - var s:Shortcut; - var copy:Array; - var lastCat:String; - var i:uint; - var len:int; - var a:Array; - var copy2:Array; - var len3:int; - var catIndex:int; - var _local_13:int; - var _local_14:int; - var _local_15:int; - var disabled:Boolean; - var savedData:Object = StoreDataManager.getInstance().getData(_datastoreType, "openShortcutsCategory"); - if (savedData) + return; + } + } + + private static var _shortcuts:Array = new Array(); + + private static var _idCount:uint = 0; + + private static var _datastoreType:DataStoreType = new DataStoreType("Module_Ankama_Config",true,DataStoreEnum.LOCATION_LOCAL,DataStoreEnum.BIND_CHARACTER); + + public static function reset() : void + { + BindsManager.destroy(); + _shortcuts = []; + _idCount = 0; + } + + public static function loadSavedData() : void + { + var _loc2_:Shortcut = null; + var _loc3_:Dictionary = null; + var _loc4_:Shortcut = null; + var _loc5_:Array = null; + var _loc6_:String = null; + var _loc7_:uint = 0; + var _loc8_:* = 0; + var _loc9_:Array = null; + var _loc10_:Array = null; + var _loc11_:* = 0; + var _loc12_:* = 0; + var _loc13_:* = 0; + var _loc14_:* = 0; + var _loc15_:* = 0; + var _loc16_:* = false; + var _loc1_:Object = StoreDataManager.getInstance().getData(_datastoreType,"openShortcutsCategory"); + if(_loc1_) + { + if(_loc1_ is Array) { - if ((savedData is Array)) - { - newData = new Dictionary(); - copy = new Array(); - for each (s in _shortcuts) - { - if (s.visible) - { - copy.push(s); - }; - }; - copy.sortOn("unicID", Array.NUMERIC); - i = 0; - len = copy.length; - a = (savedData as Array); - copy2 = new Array(); - i = 0; - while (i < len) - { - s = copy[i]; - if (s.category.name != lastCat) - { - catIndex = copy2.indexOf(s.category.name); - if (catIndex == -1) - { - copy2.push(s.category.name); - copy2.push(s); - lastCat = s.category.name; - } - else - { - _local_13 = 0; - _local_14 = catIndex; - _local_15 = copy2.length; - while (++_local_14 < _local_15) - { - if (!((copy2[_local_14] is String))) - { - _local_13++; - } - else - { - break; - }; - }; - copy2.splice(((catIndex + _local_13) + 1), 0, s); - }; - } - else + _loc3_ = new Dictionary(); + _loc5_ = new Array(); + for each(_loc4_ in _shortcuts) + { + if(_loc4_.visible) + { + _loc5_.push(_loc4_); + } + } + _loc5_.sortOn("unicID",Array.NUMERIC); + _loc7_ = 0; + _loc8_ = _loc5_.length; + _loc9_ = _loc1_ as Array; + _loc10_ = new Array(); + _loc7_ = 0; + while(_loc7_ < _loc8_) + { + _loc4_ = _loc5_[_loc7_]; + if(_loc4_.category.name != _loc6_) + { + _loc12_ = _loc10_.indexOf(_loc4_.category.name); + if(_loc12_ == -1) + { + _loc10_.push(_loc4_.category.name); + _loc10_.push(_loc4_); + _loc6_ = _loc4_.category.name; + } + else + { + _loc13_ = 0; + _loc14_ = _loc12_; + _loc15_ = _loc10_.length; + while(++_loc14_ < _loc15_) { - copy2.push(s); - }; - i++; - }; - len3 = copy2.length; - i = 0; - while (i < len3) - { - if ((copy2[i] is String)) - { - if (a[i] != undefined) - { - newData[copy2[i]] = a[i]; - } - else - { - newData[copy2[i]] = true; - }; - }; - i++; - }; - savedData = newData; - StoreDataManager.getInstance().setData(_datastoreType, "openShortcutsCategory", savedData); - }; - for each (sc in _shortcuts) - { - if (sc.visible) - { - if (savedData[sc.category.name] != undefined) - { - disabled = !(savedData[sc.category.name]); + if(!(_loc10_[_loc14_] is String)) + { + _loc13_++; + continue; + } + break; } - else - { - savedData[sc.category.name] = true; - disabled = false; - }; - sc.disable = disabled; - }; - }; - }; - } - - public static function getShortcutByName(name:String):Shortcut - { - return (_shortcuts[name]); - } - - public static function getShortcuts():Array - { - return (_shortcuts); - } - - - public function get unicID():uint - { - return (this._unicID); - } - - public function get name():String - { - return (this._name); - } - - public function get description():String - { - return (this._description); - } - - public function get tooltipContent():String - { - return (this._tooltipContent); - } - - public function get textfieldEnabled():Boolean - { - return (this._textfieldEnabled); - } - - public function get bindable():Boolean - { - return (this._bindable); - } - - public function get category():ShortcutCategory - { - return (this._category); - } - - public function get visible():Boolean - { - return (this._visible); - } - - public function set visible(value:Boolean):void - { - this._visible = value; - } - - public function get required():Boolean - { - return (this._required); - } - - public function get holdKeys():Boolean - { - return (this._holdKeys); - } - - public function get disable():Boolean - { - return (this._disable); - } - - public function set disable(value:Boolean):void - { - this._disable = value; - } - - - } -}//package com.ankamagames.berilia.types.shortcut - + _loc10_.splice(_loc12_ + _loc13_ + 1,0,_loc4_); + } + } + else + { + _loc10_.push(_loc4_); + } + _loc7_++; + } + _loc11_ = _loc10_.length; + _loc7_ = 0; + while(_loc7_ < _loc11_) + { + if(_loc10_[_loc7_] is String) + { + if(_loc9_[_loc7_] != undefined) + { + _loc3_[_loc10_[_loc7_]] = _loc9_[_loc7_]; + } + else + { + _loc3_[_loc10_[_loc7_]] = true; + } + } + _loc7_++; + } + _loc1_ = _loc3_; + StoreDataManager.getInstance().setData(_datastoreType,"openShortcutsCategory",_loc1_); + } + for each(_loc2_ in _shortcuts) + { + if(_loc2_.visible) + { + if(_loc1_[_loc2_.category.name] != undefined) + { + _loc16_ = !_loc1_[_loc2_.category.name]; + } + else + { + _loc1_[_loc2_.category.name] = true; + _loc16_ = false; + } + _loc2_.disable = _loc16_; + } + } + } + } + + public static function getShortcutByName(param1:String) : Shortcut + { + return _shortcuts[param1]; + } + + public static function getShortcuts() : Array + { + return _shortcuts; + } + + private var _name:String; + + private var _description:String; + + private var _tooltipContent:String; + + private var _textfieldEnabled:Boolean; + + private var _bindable:Boolean; + + private var _category:ShortcutCategory; + + private var _unicID:uint = 0; + + private var _visible:Boolean; + + private var _disable:Boolean; + + private var _required:Boolean; + + private var _holdKeys:Boolean; + + public var defaultBind:Bind; + + public function get unicID() : uint + { + return this._unicID; + } + + public function get name() : String + { + return this._name; + } + + public function get description() : String + { + return this._description; + } + + public function get tooltipContent() : String + { + return this._tooltipContent; + } + + public function get textfieldEnabled() : Boolean + { + return this._textfieldEnabled; + } + + public function get bindable() : Boolean + { + return this._bindable; + } + + public function get category() : ShortcutCategory + { + return this._category; + } + + public function get visible() : Boolean + { + return this._visible; + } + + public function set visible(param1:Boolean) : void + { + this._visible = param1; + } + + public function get required() : Boolean + { + return this._required; + } + + public function get holdKeys() : Boolean + { + return this._holdKeys; + } + + public function get disable() : Boolean + { + return this._disable; + } + + public function set disable(param1:Boolean) : void + { + this._disable = param1; + } + } +} diff --git a/com/ankamagames/berilia/types/shortcut/ShortcutCategory.as b/com/ankamagames/berilia/types/shortcut/ShortcutCategory.as index 7f5f1fa6e..efd73d0b3 100644 --- a/com/ankamagames/berilia/types/shortcut/ShortcutCategory.as +++ b/com/ankamagames/berilia/types/shortcut/ShortcutCategory.as @@ -1,54 +1,50 @@ -package com.ankamagames.berilia.types.shortcut +package com.ankamagames.berilia.types.shortcut { - public class ShortcutCategory - { - - private static var _caterogies:Array = new Array(); - - private var _name:String; - private var _description:String; - - public function ShortcutCategory(name:String, description:String) - { - _caterogies[name] = this; - this._name = name; - this._description = description; - } - - public static function create(name:String, description:String):ShortcutCategory - { - var sc:ShortcutCategory = _caterogies[name]; - if (!(sc)) - { - sc = new (ShortcutCategory)(name, description); - } - else - { - if (!(_caterogies[name].description)) - { - _caterogies[name]._description = description; - }; - }; - return (sc); - } - - - public function get name():String - { - return (this._name); - } - - public function get description():String - { - return (this._description); - } - - public function toString():String - { - return (this._name); - } - - - } -}//package com.ankamagames.berilia.types.shortcut - + public class ShortcutCategory extends Object + { + + public function ShortcutCategory(param1:String, param2:String) + { + super(); + _caterogies[param1] = this; + this._name = param1; + this._description = param2; + } + + private static var _caterogies:Array = new Array(); + + public static function create(param1:String, param2:String) : ShortcutCategory + { + var _loc3_:ShortcutCategory = _caterogies[param1]; + if(!_loc3_) + { + _loc3_ = new ShortcutCategory(param1,param2); + } + else if(!_caterogies[param1].description) + { + _caterogies[param1]._description = param2; + } + + return _loc3_; + } + + private var _name:String; + + private var _description:String; + + public function get name() : String + { + return this._name; + } + + public function get description() : String + { + return this._description; + } + + public function toString() : String + { + return this._name; + } + } +} diff --git a/com/ankamagames/berilia/types/template/TemplateParam.as b/com/ankamagames/berilia/types/template/TemplateParam.as index 5e4a66bd4..c84c92871 100644 --- a/com/ankamagames/berilia/types/template/TemplateParam.as +++ b/com/ankamagames/berilia/types/template/TemplateParam.as @@ -1,18 +1,19 @@ -package com.ankamagames.berilia.types.template +package com.ankamagames.berilia.types.template { - public class TemplateParam - { - - public var name:String; - public var value:String; - public var defaultValue:String; - - public function TemplateParam(sName:String, sValue:String=null) - { - this.name = sName; - this.value = sValue; - } - - } -}//package com.ankamagames.berilia.types.template - + public class TemplateParam extends Object + { + + public function TemplateParam(param1:String, param2:String = null) + { + super(); + this.name = param1; + this.value = param2; + } + + public var name:String; + + public var value:String; + + public var defaultValue:String; + } +} diff --git a/com/ankamagames/berilia/types/template/TemplateVar.as b/com/ankamagames/berilia/types/template/TemplateVar.as index 8719c1166..09b0ab413 100644 --- a/com/ankamagames/berilia/types/template/TemplateVar.as +++ b/com/ankamagames/berilia/types/template/TemplateVar.as @@ -1,24 +1,23 @@ -package com.ankamagames.berilia.types.template +package com.ankamagames.berilia.types.template { - public class TemplateVar - { - - public var name:String; - public var value:String; - - public function TemplateVar(varName:String) - { - this.name = varName; - } - - public function clone():TemplateVar - { - var tmp:TemplateVar = new TemplateVar(this.name); - tmp.value = this.value; - return (tmp); - } - - - } -}//package com.ankamagames.berilia.types.template - + public class TemplateVar extends Object + { + + public function TemplateVar(param1:String) + { + super(); + this.name = param1; + } + + public var name:String; + + public var value:String; + + public function clone() : TemplateVar + { + var _loc1_:TemplateVar = new TemplateVar(this.name); + _loc1_.value = this.value; + return _loc1_; + } + } +} diff --git a/com/ankamagames/berilia/types/template/XmlTemplate.as b/com/ankamagames/berilia/types/template/XmlTemplate.as index 66aef3aa1..401febab9 100644 --- a/com/ankamagames/berilia/types/template/XmlTemplate.as +++ b/com/ankamagames/berilia/types/template/XmlTemplate.as @@ -1,210 +1,212 @@ -package com.ankamagames.berilia.types.template +package com.ankamagames.berilia.types.template { - import com.ankamagames.jerakine.logger.Logger; - import com.ankamagames.jerakine.logger.Log; - import flash.utils.getQualifiedClassName; - import flash.xml.XMLDocument; - import com.ankamagames.jerakine.eval.Evaluator; - import flash.xml.XMLNode; - import com.ankamagames.berilia.enums.XmlTagsEnum; - import com.ankamagames.berilia.enums.XmlAttributesEnum; - - public class XmlTemplate - { - - protected static const _log:Logger = Log.getLogger(getQualifiedClassName(XmlTemplate)); - - private var _aTemplateParams:Array; - private var _sXml:String; - private var _xDoc:XMLDocument; - private var _aVariablesStack:Array; - private var _filename:String; - - public function XmlTemplate(sXml:String=null, sFilename:String=null) - { - this._aVariablesStack = new Array(); - super(); - this._filename = sFilename; - if (sXml != null) + import com.ankamagames.jerakine.logger.Logger; + import com.ankamagames.jerakine.logger.Log; + import flash.utils.getQualifiedClassName; + import flash.xml.XMLDocument; + import flash.xml.XMLNode; + import com.ankamagames.jerakine.eval.Evaluator; + import com.ankamagames.berilia.enums.XmlTagsEnum; + import com.ankamagames.berilia.enums.XmlAttributesEnum; + + public class XmlTemplate extends Object + { + + public function XmlTemplate(param1:String = null, param2:String = null) + { + this._aVariablesStack = new Array(); + super(); + this._filename = param2; + if(param1 != null) + { + this.xml = param1; + } + } + + protected static const _log:Logger = Log.getLogger(getQualifiedClassName(XmlTemplate)); + + private var _aTemplateParams:Array; + + private var _sXml:String; + + private var _xDoc:XMLDocument; + + private var _aVariablesStack:Array; + + private var _filename:String; + + public function get xml() : String + { + return this._sXml; + } + + public function set xml(param1:String) : void + { + this._sXml = param1; + this.parseTemplate(); + } + + public function get filename() : String + { + return this._filename; + } + + public function set filename(param1:String) : void + { + this._filename = param1; + } + + public function get templateParams() : Array + { + return this._aTemplateParams; + } + + public function get variablesStack() : Array + { + return this._aVariablesStack; + } + + public function makeTemplate(param1:Array) : XMLNode + { + var _loc4_:String = null; + var _loc6_:Array = null; + var _loc7_:TemplateVar = null; + var _loc8_:uint = 0; + var _loc2_:Evaluator = new Evaluator(); + var _loc3_:String = this._xDoc.toString(); + var _loc5_:Array = []; + for(_loc4_ in this._aTemplateParams) + { + _loc5_[_loc4_] = this._aTemplateParams[_loc4_]; + } + for(_loc4_ in param1) + { + if(!this._aTemplateParams[_loc4_]) { - this.xml = sXml; - }; - } - - public function get xml():String - { - return (this._sXml); - } - - public function set xml(sXml:String):void - { - this._sXml = sXml; - this.parseTemplate(); - } - - public function get filename():String - { - return (this._filename); - } - - public function set filename(s:String):void - { - this._filename = s; - } - - public function get templateParams():Array - { - return (this._aTemplateParams); - } - - public function get variablesStack():Array - { - return (this._aVariablesStack); - } - - public function makeTemplate(aVar:Array):XMLNode - { - var key:String; - var aVariables:Array; - var variable:TemplateVar; - var step:uint; - var evaluator:Evaluator = new Evaluator(); - var newXml:String = this._xDoc.toString(); - var localVar:Array = []; - for (key in this._aTemplateParams) + _log.error("Template " + this._filename + ", param " + _loc4_ + " is not defined"); + delete param1[_loc4_]; + true; + } + else { - localVar[key] = this._aTemplateParams[key]; - }; - for (key in aVar) + _loc5_[_loc4_] = param1[_loc4_]; + } + } + _loc3_ = this.replaceParam(_loc3_,_loc5_,"#"); + _loc6_ = new Array(); + _loc8_ = 0; + while(_loc8_ < this._aVariablesStack.length) + { + _loc7_ = this._aVariablesStack[_loc8_].clone(); + _loc7_.value = _loc2_.eval(this.replaceParam(this.replaceParam(_loc7_.value,_loc5_,"#"),_loc6_,"$")); + _loc6_[_loc7_.name] = _loc7_; + _loc8_++; + } + _loc3_ = this.replaceParam(_loc3_,_loc6_,"$"); + var _loc9_:XMLDocument = new XMLDocument(); + _loc9_.parseXML(_loc3_); + return _loc9_; + } + + private function parseTemplate() : void + { + this._xDoc = new XMLDocument(); + this._aTemplateParams = new Array(); + this._xDoc.ignoreWhite = true; + this._xDoc.parseXML(this._sXml); + if(this._xDoc.firstChild.nodeName + ".xml" != this._filename) + { + _log.error("Wrong root node name in " + this._filename + ", found " + this._xDoc.firstChild.nodeName + ", waiting for " + this._filename.replace(".xml","")); + return; + } + this.matchDynamicsParts(this._xDoc.firstChild); + } + + private function matchDynamicsParts(param1:XMLNode) : void + { + var _loc2_:XMLNode = null; + var _loc3_:TemplateVar = null; + var _loc4_:TemplateParam = null; + var _loc5_:uint = 0; + for(;_loc5_ < param1.childNodes.length;_loc5_++) + { + _loc2_ = param1.childNodes[_loc5_]; + if(_loc2_.nodeName == XmlTagsEnum.TAG_VAR) { - if (!(this._aTemplateParams[key])) - { - _log.error((((("Template " + this._filename) + ", param ") + key) + " is not defined")); - delete aVar[key]; - } - else - { - localVar[key] = aVar[key]; - }; - }; - newXml = this.replaceParam(newXml, localVar, "#"); - aVariables = new Array(); - step = 0; - while (step < this._aVariablesStack.length) + if(_loc2_.attributes[XmlAttributesEnum.ATTRIBUTE_NAME]) + { + _loc3_ = new TemplateVar(_loc2_.attributes[XmlAttributesEnum.ATTRIBUTE_NAME]); + _loc3_.value = _loc2_.firstChild.toString().replace(new RegExp("'","g"),"\'"); + this._aVariablesStack.push(_loc3_); + _loc2_.removeNode(); + _loc5_--; + continue; + } + _log.warn(_loc2_.nodeName + " must have [" + XmlAttributesEnum.ATTRIBUTE_NAME + "] attribute"); + } + if(_loc2_.nodeName == XmlTagsEnum.TAG_PARAM) { - variable = this._aVariablesStack[step].clone(); - variable.value = evaluator.eval(this.replaceParam(this.replaceParam(variable.value, localVar, "#"), aVariables, "$")); - aVariables[variable.name] = variable; - step++; - }; - newXml = this.replaceParam(newXml, aVariables, "$"); - var newDoc:XMLDocument = new XMLDocument(); - newDoc.parseXML(newXml); - return (newDoc); - } - - private function parseTemplate():void - { - this._xDoc = new XMLDocument(); - this._aTemplateParams = new Array(); - this._xDoc.ignoreWhite = true; - this._xDoc.parseXML(this._sXml); - if ((this._xDoc.firstChild.nodeName + ".xml") != this._filename) + if(_loc2_.attributes[XmlAttributesEnum.ATTRIBUTE_NAME]) + { + _loc4_ = new TemplateParam(_loc2_.attributes[XmlAttributesEnum.ATTRIBUTE_NAME]); + this._aTemplateParams[_loc4_.name] = _loc4_; + if(_loc2_.hasChildNodes()) + { + _loc4_.defaultValue = _loc2_.firstChild.toString(); + } + else + { + _loc4_.defaultValue = ""; + } + _loc2_.removeNode(); + _loc5_--; + } + else + { + _log.warn(_loc2_.nodeName + " must have [" + XmlAttributesEnum.ATTRIBUTE_NAME + "] attribute"); + } + } + } + } + + private function replaceParam(param1:String, param2:Array, param3:String, param4:uint = 1) : String + { + var _loc5_:String = null; + var _loc7_:String = null; + var _loc8_:uint = 0; + if(!param1) + { + return param1; + } + var _loc6_:Array = new Array(); + for(_loc7_ in param2) + { + _loc6_.push(_loc7_); + } + _loc6_.sort(Array.DESCENDING); + _loc8_ = 0; + while(_loc8_ < _loc6_.length) + { + _loc7_ = _loc6_[_loc8_]; + if(param2[_loc7_] != null) { - _log.error(((((("Wrong root node name in " + this._filename) + ", found ") + this._xDoc.firstChild.nodeName) + ", waiting for ") + this._filename.replace(".xml", ""))); - return; - }; - this.matchDynamicsParts(this._xDoc.firstChild); - } - - private function matchDynamicsParts(node:XMLNode):void - { - var currNode:XMLNode; - var variable:TemplateVar; - var param:TemplateParam; - var i:uint; - for (;i < node.childNodes.length;i++) - { - currNode = node.childNodes[i]; - if (currNode.nodeName == XmlTagsEnum.TAG_VAR) - { - if (currNode.attributes[XmlAttributesEnum.ATTRIBUTE_NAME]) - { - variable = new TemplateVar(currNode.attributes[XmlAttributesEnum.ATTRIBUTE_NAME]); - variable.value = currNode.firstChild.toString().replace(/'/g, "'"); - this._aVariablesStack.push(variable); - currNode.removeNode(); - i--; - continue; - }; - _log.warn((((currNode.nodeName + " must have [") + XmlAttributesEnum.ATTRIBUTE_NAME) + "] attribute")); - }; - if (currNode.nodeName == XmlTagsEnum.TAG_PARAM) - { - if (currNode.attributes[XmlAttributesEnum.ATTRIBUTE_NAME]) - { - param = new TemplateParam(currNode.attributes[XmlAttributesEnum.ATTRIBUTE_NAME]); - this._aTemplateParams[param.name] = param; - if (currNode.hasChildNodes()) - { - param.defaultValue = currNode.firstChild.toString(); - } - else - { - param.defaultValue = ""; - }; - currNode.removeNode(); - i--; - } - else - { - _log.warn((((currNode.nodeName + " must have [") + XmlAttributesEnum.ATTRIBUTE_NAME) + "] attribute")); - }; - }; - }; - } - - private function replaceParam(txt:String, aVars:Array, prefix:String, recur:uint=1):String - { - var value:String; - var key:String; - var i:uint; - if (!(txt)) - { - return (txt); - }; - var sortedParam:Array = new Array(); - for (key in aVars) - { - sortedParam.push(key); - }; - sortedParam.sort(Array.DESCENDING); - i = 0; - while (i < sortedParam.length) - { - key = sortedParam[i]; - if (aVars[key] != null) - { - value = aVars[key].value; - if (((!(value)) && ((aVars[key] is TemplateParam)))) - { - value = aVars[key].defaultValue; - }; - if (value == null) - { - _log.warn((("No value for " + prefix) + key)); - } - else - { - txt = txt.split((prefix + key)).join(value); - }; - }; - i++; - }; - return (txt); - } - - - } -}//package com.ankamagames.berilia.types.template - + _loc5_ = param2[_loc7_].value; + if(!_loc5_ && param2[_loc7_] is TemplateParam) + { + _loc5_ = param2[_loc7_].defaultValue; + } + if(_loc5_ == null) + { + _log.warn("No value for " + param3 + _loc7_); + } + else + { + var param1:String = param1.split(param3 + _loc7_).join(_loc5_); + } + } + _loc8_++; + } + return param1; + } + } +} diff --git a/com/ankamagames/berilia/types/tooltip/EmptyTooltip.as b/com/ankamagames/berilia/types/tooltip/EmptyTooltip.as index c0e5315de..cbb7f29b4 100644 --- a/com/ankamagames/berilia/types/tooltip/EmptyTooltip.as +++ b/com/ankamagames/berilia/types/tooltip/EmptyTooltip.as @@ -1,13 +1,11 @@ -package com.ankamagames.berilia.types.tooltip +package com.ankamagames.berilia.types.tooltip { - public class EmptyTooltip extends Tooltip - { - - public function EmptyTooltip() - { - super(null, null); - } - - } -}//package com.ankamagames.berilia.types.tooltip - + public class EmptyTooltip extends Tooltip + { + + public function EmptyTooltip() + { + super(null,null); + } + } +} diff --git a/com/ankamagames/berilia/types/tooltip/Tooltip.as b/com/ankamagames/berilia/types/tooltip/Tooltip.as index b3edc37b7..76df1943e 100644 --- a/com/ankamagames/berilia/types/tooltip/Tooltip.as +++ b/com/ankamagames/berilia/types/tooltip/Tooltip.as @@ -1,134 +1,144 @@ -package com.ankamagames.berilia.types.tooltip +package com.ankamagames.berilia.types.tooltip { - import flash.utils.Dictionary; - import com.ankamagames.jerakine.logger.Logger; - import com.ankamagames.berilia.types.graphic.UiRootContainer; - import com.ankamagames.jerakine.logger.Log; - import flash.utils.getQualifiedClassName; - import flash.events.Event; - import com.ankamagames.berilia.types.data.ChunkData; - import com.ankamagames.jerakine.types.Uri; - import com.ankamagames.jerakine.types.Callback; - - public class Tooltip - { - - public static var MEMORY_LOG:Dictionary = new Dictionary(true); - - protected var _log:Logger; - private var _mainblock:TooltipBlock; - private var _blocks:Array; - private var _loadedblock:uint = 0; - private var _mainblockLoaded:Boolean = false; - private var _callbacks:Array; - private var _content:String = ""; - private var _useSeparator:Boolean = true; - public var uiModuleName:String; - public var scriptClass:Class; - public var makerName:String; - public var display:UiRootContainer; - public var mustBeHidden:Boolean = true; - public var strata:int = 4; - - public function Tooltip(base:Uri, container:Uri, separator:Uri=null) - { - this._log = Log.getLogger(getQualifiedClassName(Tooltip)); - this._callbacks = new Array(); - super(); - if ((((base == null)) && ((container == null)))) + import flash.utils.Dictionary; + import com.ankamagames.jerakine.logger.Logger; + import com.ankamagames.berilia.types.graphic.UiRootContainer; + import flash.events.Event; + import com.ankamagames.jerakine.types.Callback; + import com.ankamagames.jerakine.types.Uri; + import com.ankamagames.jerakine.logger.Log; + import flash.utils.getQualifiedClassName; + import com.ankamagames.berilia.types.data.ChunkData; + + public class Tooltip extends Object + { + + public function Tooltip(param1:Uri, param2:Uri, param3:Uri = null) + { + this._log = Log.getLogger(getQualifiedClassName(Tooltip)); + this._callbacks = new Array(); + super(); + if(param1 == null && param2 == null) + { + return; + } + this._blocks = new Array(); + this._mainblock = new TooltipBlock(); + this._mainblock.addEventListener(Event.COMPLETE,this.onMainChunkLoaded); + if(!param3) + { + this._useSeparator = false; + this._mainblock.initChunk([new ChunkData("main",param1),new ChunkData("container",param2)]); + } + else + { + this._mainblock.initChunk([new ChunkData("main",param1),new ChunkData("separator",param3),new ChunkData("container",param2)]); + } + this._mainblock.init(); + MEMORY_LOG[this] = 1; + } + + public static var MEMORY_LOG:Dictionary = new Dictionary(true); + + protected var _log:Logger; + + private var _mainblock:TooltipBlock; + + private var _blocks:Array; + + private var _loadedblock:uint = 0; + + private var _mainblockLoaded:Boolean = false; + + private var _callbacks:Array; + + private var _content:String = ""; + + private var _useSeparator:Boolean = true; + + public var uiModuleName:String; + + public var scriptClass:Class; + + public var makerName:String; + + public var display:UiRootContainer; + + public var mustBeHidden:Boolean = true; + + public var strata:int = 4; + + public function get mainBlock() : TooltipBlock + { + return this._mainblock; + } + + public function addBlock(param1:TooltipBlock) : void + { + this._blocks.push(param1); + param1.addEventListener(Event.COMPLETE,this.onChunkReady); + param1.init(); + } + + public function get content() : String + { + return this._content; + } + + public function askTooltip(param1:Callback) : void + { + this._callbacks.push(param1); + this.processCallback(); + } + + public function update(param1:String) : void + { + this.processCallback(); + } + + private function onMainChunkLoaded(param1:Event) : void + { + this._mainblockLoaded = true; + this.processCallback(); + } + + private function processCallback() : void + { + if((this._mainblockLoaded) && this._loadedblock == this._blocks.length) + { + this.makeTooltip(); + while(this._callbacks.length) { - return; - }; - this._blocks = new Array(); - this._mainblock = new TooltipBlock(); - this._mainblock.addEventListener(Event.COMPLETE, this.onMainChunkLoaded); - if (!(separator)) - { - this._useSeparator = false; - this._mainblock.initChunk([new ChunkData("main", base), new ChunkData("container", container)]); + Callback(this._callbacks.pop()).exec(); } - else - { - this._mainblock.initChunk([new ChunkData("main", base), new ChunkData("separator", separator), new ChunkData("container", container)]); - }; - this._mainblock.init(); - MEMORY_LOG[this] = 1; - } - - public function get mainBlock():TooltipBlock - { - return (this._mainblock); - } - - public function addBlock(block:TooltipBlock):void - { - this._blocks.push(block); - block.addEventListener(Event.COMPLETE, this.onChunkReady); - block.init(); - } - - public function get content():String - { - return (this._content); - } - - public function askTooltip(callback:Callback):void - { - this._callbacks.push(callback); - this.processCallback(); - } - - public function update(txt:String):void - { - this.processCallback(); - } - - private function onMainChunkLoaded(e:Event):void - { - this._mainblockLoaded = true; - this.processCallback(); - } - - private function processCallback():void - { - if (((this._mainblockLoaded) && ((this._loadedblock == this._blocks.length)))) - { - this.makeTooltip(); - while (this._callbacks.length) - { - Callback(this._callbacks.pop()).exec(); - }; - }; - } - - private function makeTooltip():void - { - var block:TooltipBlock; - var result:Array = new Array(); - for each (block in this._blocks) + } + } + + private function makeTooltip() : void + { + var _loc2_:TooltipBlock = null; + var _loc1_:Array = new Array(); + for each(_loc2_ in this._blocks) + { + if((_loc2_.content) && (_loc2_.content.length)) { - if (((block.content) && (block.content.length))) - { - result.push(this._mainblock.getChunk("container").processContent({"content":block.content})); - }; - }; - if (this._useSeparator) - { - this._content = this._mainblock.getChunk("main").processContent({"content":result.join(this._mainblock.getChunk("separator").processContent(null))}); + _loc1_.push(this._mainblock.getChunk("container").processContent({"content":_loc2_.content})); } - else - { - this._content = this._mainblock.getChunk("main").processContent({"content":result.join("")}); - }; - } - - private function onChunkReady(e:Event):void - { - this._loadedblock++; - this.processCallback(); - } - - - } -}//package com.ankamagames.berilia.types.tooltip - + } + if(this._useSeparator) + { + this._content = this._mainblock.getChunk("main").processContent({"content":_loc1_.join(this._mainblock.getChunk("separator").processContent(null))}); + } + else + { + this._content = this._mainblock.getChunk("main").processContent({"content":_loc1_.join("")}); + } + } + + private function onChunkReady(param1:Event) : void + { + this._loadedblock++; + this.processCallback(); + } + } +} diff --git a/com/ankamagames/berilia/types/tooltip/TooltipBlock.as b/com/ankamagames/berilia/types/tooltip/TooltipBlock.as index dd41561ae..82d925584 100644 --- a/com/ankamagames/berilia/types/tooltip/TooltipBlock.as +++ b/com/ankamagames/berilia/types/tooltip/TooltipBlock.as @@ -1,148 +1,153 @@ -package com.ankamagames.berilia.types.tooltip +package com.ankamagames.berilia.types.tooltip { - import flash.events.EventDispatcher; - import flash.utils.Dictionary; - import com.ankamagames.jerakine.newCache.impl.Cache; - import com.ankamagames.jerakine.newCache.garbage.LruGarbageCollector; - import flash.utils.getQualifiedClassName; - import com.ankamagames.jerakine.logger.Logger; - import com.ankamagames.jerakine.resources.loaders.IResourceLoader; - import com.ankamagames.jerakine.logger.Log; - import com.ankamagames.jerakine.resources.loaders.ResourceLoaderFactory; - import com.ankamagames.jerakine.resources.loaders.ResourceLoaderType; - import com.ankamagames.jerakine.resources.events.ResourceLoadedEvent; - import com.ankamagames.jerakine.resources.events.ResourceErrorEvent; - import com.ankamagames.berilia.types.data.ChunkData; - import flash.events.Event; - - public class TooltipBlock extends EventDispatcher - { - - private static const _chunckCache:Dictionary = new Dictionary(); - private static const _cache:Cache = Cache.create(50, new LruGarbageCollector(), getQualifiedClassName(TooltipBlock)); - - protected var _log:Logger; - private var _loader:IResourceLoader; - private var _loadedChunk:uint = 0; - private var _totalChunk:uint = 0; - private var _chunksUri:Array; - private var chunks:Array; - public var onAllChunkLoadedCallback:Function; - public var contentGetter:Function; - - public function TooltipBlock() - { - this._log = Log.getLogger(getQualifiedClassName(TooltipBlock)); - this.chunks = new Array(); - super(); - this._loader = ResourceLoaderFactory.getLoader(ResourceLoaderType.PARALLEL_LOADER); - this._loader.addEventListener(ResourceLoadedEvent.LOADED, this.onLoaded); - this._loader.addEventListener(ResourceErrorEvent.ERROR, this.onLoadError); - } - - public function get loadedChunk():uint - { - return (this._loadedChunk); - } - - public function get totalChunk():uint - { - return (this._totalChunk); - } - - public function initChunk(chunksList:Array):void - { - var chunk:ChunkData; - var chunkCache:String; - this._chunksUri = chunksList; - this._totalChunk = chunksList.length; - this._loadedChunk = 0; - var i:uint; - while (i < this._totalChunk) - { - chunk = chunksList[i]; - chunkCache = _chunckCache[chunk.uri.path]; - if (chunkCache) - { - this.chunks[chunk.name] = chunkCache; - this._chunksUri.splice(i, 1); - i--; - this._totalChunk--; - } - else - { - chunk.uri.tag = chunk.name; - }; - i++; - }; - } - - public function init():void - { - var i:uint; - this._totalChunk = this._chunksUri.length; - if (this._totalChunk) + import flash.events.EventDispatcher; + import flash.utils.Dictionary; + import com.ankamagames.jerakine.newCache.impl.Cache; + import com.ankamagames.jerakine.newCache.garbage.LruGarbageCollector; + import flash.utils.getQualifiedClassName; + import com.ankamagames.jerakine.logger.Logger; + import com.ankamagames.jerakine.resources.loaders.IResourceLoader; + import com.ankamagames.berilia.types.data.ChunkData; + import flash.events.Event; + import com.ankamagames.jerakine.resources.events.ResourceLoadedEvent; + import com.ankamagames.jerakine.resources.events.ResourceErrorEvent; + import com.ankamagames.jerakine.logger.Log; + import com.ankamagames.jerakine.resources.loaders.ResourceLoaderFactory; + import com.ankamagames.jerakine.resources.loaders.ResourceLoaderType; + + public class TooltipBlock extends EventDispatcher + { + + public function TooltipBlock() + { + this._log = Log.getLogger(getQualifiedClassName(TooltipBlock)); + this.chunks = new Array(); + super(); + this._loader = ResourceLoaderFactory.getLoader(ResourceLoaderType.PARALLEL_LOADER); + this._loader.addEventListener(ResourceLoadedEvent.LOADED,this.onLoaded); + this._loader.addEventListener(ResourceErrorEvent.ERROR,this.onLoadError); + } + + private static const _chunckCache:Dictionary = new Dictionary(); + + private static const _cache:Cache = Cache.create(50,new LruGarbageCollector(),getQualifiedClassName(TooltipBlock)); + + protected var _log:Logger; + + private var _loader:IResourceLoader; + + private var _loadedChunk:uint = 0; + + private var _totalChunk:uint = 0; + + private var _chunksUri:Array; + + private var chunks:Array; + + public var onAllChunkLoadedCallback:Function; + + public var contentGetter:Function; + + public function get loadedChunk() : uint + { + return this._loadedChunk; + } + + public function get totalChunk() : uint + { + return this._totalChunk; + } + + public function initChunk(param1:Array) : void + { + var _loc2_:ChunkData = null; + var _loc4_:String = null; + this._chunksUri = param1; + this._totalChunk = param1.length; + this._loadedChunk = 0; + var _loc3_:uint = 0; + while(_loc3_ < this._totalChunk) + { + _loc2_ = param1[_loc3_]; + _loc4_ = _chunckCache[_loc2_.uri.path]; + if(_loc4_) { - this._loadedChunk = 0; - i = 0; - while (i < this._totalChunk) - { - this._loader.load(ChunkData(this._chunksUri[i]).uri); - i++; - }; + this.chunks[_loc2_.name] = _loc4_; + this._chunksUri.splice(_loc3_,1); + _loc3_--; + this._totalChunk--; } else { - this.onAllChunkLoaded(); - }; - } - - public function getChunk(name:String):TooltipChunk - { - var data:String = this.chunks[name]; - return (new TooltipChunk(data)); - } - - public function get content():String - { - if (this.contentGetter != null) - { - return (this.contentGetter()); - }; - return ("[Abstract tooltip]"); - } - - protected function onAllChunkLoaded():void - { - if (this.onAllChunkLoadedCallback != null) - { - this.onAllChunkLoadedCallback(); - }; - dispatchEvent(new Event(Event.COMPLETE)); - } - - private function onLoaded(e:ResourceLoadedEvent):void - { - this._loadedChunk++; - _chunckCache[e.uri.path] = e.resource; - this.chunks[e.uri.tag] = e.resource; - if (this._loadedChunk == this._totalChunk) - { - this.onAllChunkLoaded(); - }; - } - - private function onLoadError(e:ResourceErrorEvent):void - { - this._loadedChunk++; - if (this._loadedChunk == this._totalChunk) + _loc2_.uri.tag = _loc2_.name; + } + _loc3_++; + } + } + + public function init() : void + { + var _loc1_:uint = 0; + this._totalChunk = this._chunksUri.length; + if(this._totalChunk) + { + this._loadedChunk = 0; + _loc1_ = 0; + while(_loc1_ < this._totalChunk) { - this.onAllChunkLoaded(); - }; - this.chunks[e.uri.tag] = new TooltipChunk((("[loading error on " + e.uri.tag) + "]")); - } - - - } -}//package com.ankamagames.berilia.types.tooltip - + this._loader.load(ChunkData(this._chunksUri[_loc1_]).uri); + _loc1_++; + } + } + else + { + this.onAllChunkLoaded(); + } + } + + public function getChunk(param1:String) : TooltipChunk + { + var _loc2_:String = this.chunks[param1]; + return new TooltipChunk(_loc2_); + } + + public function get content() : String + { + if(this.contentGetter != null) + { + return this.contentGetter(); + } + return "[Abstract tooltip]"; + } + + protected function onAllChunkLoaded() : void + { + if(this.onAllChunkLoadedCallback != null) + { + this.onAllChunkLoadedCallback(); + } + dispatchEvent(new Event(Event.COMPLETE)); + } + + private function onLoaded(param1:ResourceLoadedEvent) : void + { + this._loadedChunk++; + _chunckCache[param1.uri.path] = param1.resource; + this.chunks[param1.uri.tag] = param1.resource; + if(this._loadedChunk == this._totalChunk) + { + this.onAllChunkLoaded(); + } + } + + private function onLoadError(param1:ResourceErrorEvent) : void + { + this._loadedChunk++; + if(this._loadedChunk == this._totalChunk) + { + this.onAllChunkLoaded(); + } + this.chunks[param1.uri.tag] = new TooltipChunk("[loading error on " + param1.uri.tag + "]"); + } + } +} diff --git a/com/ankamagames/berilia/types/tooltip/TooltipChunk.as b/com/ankamagames/berilia/types/tooltip/TooltipChunk.as index 8f09f0a6a..2cdc4a7a2 100644 --- a/com/ankamagames/berilia/types/tooltip/TooltipChunk.as +++ b/com/ankamagames/berilia/types/tooltip/TooltipChunk.as @@ -1,34 +1,32 @@ -package com.ankamagames.berilia.types.tooltip +package com.ankamagames.berilia.types.tooltip { - import flash.events.EventDispatcher; - - public class TooltipChunk extends EventDispatcher - { - - private var _content:String; - - public function TooltipChunk(content:String) - { - this._content = content; - } - - public function processContent(params:Object):String - { - var i:String; - var content:String = this._content; - for (i in params) - { - content = content.split(("#" + i)).join(params[i]); - }; - return (content); - } - - public function get content():String - { - return (this._content); - } - - - } -}//package com.ankamagames.berilia.types.tooltip - + import flash.events.EventDispatcher; + + public class TooltipChunk extends EventDispatcher + { + + public function TooltipChunk(param1:String) + { + super(); + this._content = param1; + } + + private var _content:String; + + public function processContent(param1:Object) : String + { + var _loc3_:String = null; + var _loc2_:String = this._content; + for(_loc3_ in param1) + { + _loc2_ = _loc2_.split("#" + _loc3_).join(param1[_loc3_]); + } + return _loc2_; + } + + public function get content() : String + { + return this._content; + } + } +} diff --git a/com/ankamagames/berilia/types/tooltip/TooltipPlacer.as b/com/ankamagames/berilia/types/tooltip/TooltipPlacer.as index efd268b3a..f200fff95 100644 --- a/com/ankamagames/berilia/types/tooltip/TooltipPlacer.as +++ b/com/ankamagames/berilia/types/tooltip/TooltipPlacer.as @@ -1,591 +1,589 @@ -package com.ankamagames.berilia.types.tooltip +package com.ankamagames.berilia.types.tooltip { - import com.ankamagames.jerakine.logger.Logger; - import com.ankamagames.jerakine.logger.Log; - import flash.utils.getQualifiedClassName; - import __AS3__.vec.Vector; - import flash.utils.Dictionary; - import com.ankamagames.berilia.types.LocationEnum; - import flash.geom.Point; - import com.ankamagames.jerakine.utils.display.Rectangle2; - import flash.geom.Rectangle; - import com.ankamagames.jerakine.utils.display.StageShareManager; - import flash.display.DisplayObject; - import com.ankamagames.jerakine.interfaces.IRectangle; - import com.ankamagames.berilia.managers.TooltipManager; - import com.ankamagames.berilia.types.graphic.UiRootContainer; - import com.ankamagames.berilia.types.event.UiRenderEvent; - import flash.events.Event; - import __AS3__.vec.*; - - public class TooltipPlacer - { - - protected static var _log:Logger = Log.getLogger(getQualifiedClassName(TooltipPlacer)); - private static var _tooltips:Vector. = new Vector.(0); - private static var _tooltipsRows:Dictionary = new Dictionary(); - private static var _tooltipsToWait:Vector. = new Vector.(0); - private static const _anchors:Array = []; - private static var _init:Boolean; - - - private static function init():void - { - var pt1:uint; - var pt2:uint; - if (_init) + import com.ankamagames.jerakine.logger.Logger; + import flash.utils.Dictionary; + import com.ankamagames.berilia.types.LocationEnum; + import flash.display.DisplayObject; + import com.ankamagames.jerakine.interfaces.IRectangle; + import flash.geom.Point; + import com.ankamagames.jerakine.utils.display.Rectangle2; + import flash.geom.Rectangle; + import com.ankamagames.jerakine.utils.display.StageShareManager; + import com.ankamagames.berilia.types.graphic.UiRootContainer; + import com.ankamagames.berilia.managers.TooltipManager; + import flash.events.Event; + import com.ankamagames.berilia.types.event.UiRenderEvent; + import com.ankamagames.jerakine.logger.Log; + import flash.utils.getQualifiedClassName; + + public class TooltipPlacer extends Object + { + + public function TooltipPlacer() + { + super(); + } + + protected static var _log:Logger = Log.getLogger(getQualifiedClassName(TooltipPlacer)); + + private static var _tooltips:Vector. = new Vector.(0); + + private static var _tooltipsRows:Dictionary = new Dictionary(); + + private static var _tooltipsToWait:Vector. = new Vector.(0); + + private static const _anchors:Array = []; + + private static var _init:Boolean; + + private static function init() : void + { + var _loc2_:uint = 0; + var _loc3_:uint = 0; + if(_init) + { + return; + } + _init = true; + var _loc1_:Array = [LocationEnum.POINT_TOPLEFT,LocationEnum.POINT_TOP,LocationEnum.POINT_TOPRIGHT,LocationEnum.POINT_LEFT,LocationEnum.POINT_CENTER,LocationEnum.POINT_RIGHT,LocationEnum.POINT_BOTTOMLEFT,LocationEnum.POINT_BOTTOM,LocationEnum.POINT_BOTTOMRIGHT]; + for each(_loc2_ in _loc1_) + { + for each(_loc3_ in _loc1_) { - return; - }; - _init = true; - var config:Array = [LocationEnum.POINT_TOPLEFT, LocationEnum.POINT_TOP, LocationEnum.POINT_TOPRIGHT, LocationEnum.POINT_LEFT, LocationEnum.POINT_CENTER, LocationEnum.POINT_RIGHT, LocationEnum.POINT_BOTTOMLEFT, LocationEnum.POINT_BOTTOM, LocationEnum.POINT_BOTTOMRIGHT]; - for each (pt1 in config) + _anchors.push({ + "p1":_loc2_, + "p2":_loc3_ + }); + } + } + } + + private static function getAnchors() : Array + { + init(); + return _anchors.concat(); + } + + public static function place(param1:DisplayObject, param2:IRectangle, param3:uint = 6, param4:uint = 0, param5:int = 3, param6:Boolean = true) : void + { + var _loc14_:Point = null; + var _loc15_:Point = null; + var _loc16_:Rectangle2 = null; + var _loc17_:Point = null; + var _loc18_:Rectangle2 = null; + var _loc19_:* = 0; + var _loc20_:Object = null; + var _loc21_:Object = null; + var _loc22_:Object = null; + var _loc7_:* = false; + var _loc8_:Rectangle = param1.getBounds(param1); + var _loc9_:uint = param3; + var _loc10_:uint = param4; + var _loc11_:* = false; + var _loc12_:Array = getAnchors(); + var _loc13_:Array = new Array(); + while(!_loc7_) + { + _loc14_ = new Point(param2.x,param2.y); + _loc15_ = new Point(param1.x,param1.y); + _loc16_ = new Rectangle2(param1.x,param1.y,param1.width,param1.height); + processAnchor(_loc15_,_loc16_,param3); + processAnchor(_loc14_,param2,param4); + _loc17_ = makeOffset(param3,param5); + _loc14_.x = _loc14_.x - (_loc15_.x - _loc17_.x + _loc8_.left); + _loc14_.y = _loc14_.y - (_loc15_.y - _loc17_.y); + _loc18_ = new Rectangle2(_loc14_.x,_loc14_.y,_loc16_.width,_loc16_.height); + if(param6) { - for each (pt2 in config) - { - _anchors.push({ - "p1":pt1, - "p2":pt2 - }); - }; - }; - } - - private static function getAnchors():Array - { - init(); - return (_anchors.concat()); - } - - public static function place(tooltip:DisplayObject, target:IRectangle, point:uint=6, relativePoint:uint=0, offset:int=3, alwaysDisplayed:Boolean=true):void - { - var pTarget:Point; - var pTooltip:Point; - var hackIRectangle:Rectangle2; - var offsetPt:Point; - var tooltipZone:Rectangle2; - var hitZoneSize:int; - var newPt:Object; - var smallerZone:Object; - var obj:Object; - var ok:Boolean; - var ttBounds:Rectangle = tooltip.getBounds(tooltip); - var truePoint:uint = point; - var trueRelativePoint:uint = relativePoint; - var lastTurn:Boolean; - var anchors:Array = getAnchors(); - var hitZones:Array = new Array(); - while (!(ok)) + if(_loc18_.y < 0) + { + _loc18_.y = 0; + } + if(_loc18_.x < 0) + { + _loc18_.x = 0; + } + if(_loc18_.y + _loc18_.height > StageShareManager.startHeight) + { + _loc18_.y = _loc18_.y - (_loc18_.height + _loc18_.y - StageShareManager.startHeight); + } + if(_loc18_.x + _loc18_.width > StageShareManager.startWidth) + { + _loc18_.x = _loc18_.x - (_loc18_.width + _loc18_.x - StageShareManager.startWidth); + } + } + if(!_loc11_) { - pTarget = new Point(target.x, target.y); - pTooltip = new Point(tooltip.x, tooltip.y); - hackIRectangle = new Rectangle2(tooltip.x, tooltip.y, tooltip.width, tooltip.height); - processAnchor(pTooltip, hackIRectangle, point); - processAnchor(pTarget, target, relativePoint); - offsetPt = makeOffset(point, offset); - pTarget.x = (pTarget.x - ((pTooltip.x - offsetPt.x) + ttBounds.left)); - pTarget.y = (pTarget.y - (pTooltip.y - offsetPt.y)); - tooltipZone = new Rectangle2(pTarget.x, pTarget.y, hackIRectangle.width, hackIRectangle.height); - if (alwaysDisplayed) - { - if (tooltipZone.y < 0) - { - tooltipZone.y = 0; - }; - if (tooltipZone.x < 0) - { - tooltipZone.x = 0; - }; - if ((tooltipZone.y + tooltipZone.height) > StageShareManager.startHeight) - { - tooltipZone.y = (tooltipZone.y - ((tooltipZone.height + tooltipZone.y) - StageShareManager.startHeight)); - }; - if ((tooltipZone.x + tooltipZone.width) > StageShareManager.startWidth) - { - tooltipZone.x = (tooltipZone.x - ((tooltipZone.width + tooltipZone.x) - StageShareManager.startWidth)); - }; - }; - if (!(lastTurn)) - { - hitZoneSize = hitTest(tooltipZone, target); - ok = (hitZoneSize == 0); - if (!(ok)) - { - newPt = anchors.shift(); - if (!(newPt)) - { - smallerZone = { - "size":(target.width * target.height), - "point":{ - "p1":truePoint, - "p2":trueRelativePoint - } - }; - for each (obj in hitZones) - { - if (smallerZone.size > obj.size) - { - smallerZone = obj; - }; - }; - lastTurn = true; - point = smallerZone.point.p1; - relativePoint = smallerZone.point.p2; + _loc19_ = hitTest(_loc18_,param2); + _loc7_ = _loc19_ == 0; + if(!_loc7_) + { + _loc20_ = _loc12_.shift(); + if(!_loc20_) + { + _loc21_ = { + "size":param2.width * param2.height, + "point":{ + "p1":_loc9_, + "p2":_loc10_ } - else + }; + for each(_loc22_ in _loc13_) + { + if(_loc21_.size > _loc22_.size) { - hitZones.push({ - "size":hitZoneSize, - "point":{ - "p1":point, - "p2":relativePoint - } - }); - point = newPt.p1; - relativePoint = newPt.p2; - }; - }; - } - else - { - ok = true; - }; - }; - tooltip.x = tooltipZone.x; - tooltip.y = tooltipZone.y; - } - - public static function placeWithArrow(tooltip:DisplayObject, target:IRectangle):Object - { - var pTooltip:Point = new Point(tooltip.x, tooltip.y); - var info:Object = { - "bottomFlip":false, - "leftFlip":false - }; - pTooltip.x = ((target.x + (target.width / 2)) + 5); - pTooltip.y = (target.y - tooltip.height); - if ((pTooltip.x + tooltip.width) > StageShareManager.startWidth) - { - info.leftFlip = true; - pTooltip.x = (pTooltip.x - (tooltip.width + 10)); - }; - if (pTooltip.y < 0) - { - info.bottomFlip = true; - pTooltip.y = (target.y + target.height); - }; - tooltip.x = pTooltip.x; - tooltip.y = pTooltip.y; - return (info); - } - - public static function waitBeforeOrder(pTooltipId:String):void - { - if (_tooltipsToWait.indexOf(pTooltipId) == -1) - { - _tooltipsToWait.push(pTooltipId); - }; - } - - public static function addTooltipPosition(pTooltip:UiRootContainer, pTarget:IRectangle, pCellId:uint):void - { - var i:int; - var nbTooltips:int = _tooltips.length; - var exists:Boolean; - var tooltipName:String = TooltipManager.getTooltipName(pTooltip); - if (!(tooltipName)) - { - tooltipName = pTooltip.customUnicName; - }; - i = 0; - while (i < nbTooltips) - { - if (_tooltips[i].tooltip == pTooltip) - { - exists = true; - _tooltips.splice(i, 1, new TooltipPosition(pTooltip, pTarget, pCellId)); - break; - }; - i++; - }; - if (!(exists)) - { - _tooltips.push(new TooltipPosition(pTooltip, pTarget, pCellId)); - }; - var tIndex:int = _tooltipsToWait.indexOf(tooltipName); - if (tIndex != -1) - { - _tooltipsToWait.splice(tIndex, 1); - }; - if (_tooltipsToWait.length == 0) - { - checkRender(); - }; - } - - public static function checkRender(pEvent:Event=null):void - { - var tp:TooltipPosition; - if (pEvent) + _loc21_ = _loc22_; + } + } + _loc11_ = true; + var param3:uint = _loc21_.point.p1; + var param4:uint = _loc21_.point.p2; + } + else + { + _loc13_.push({ + "size":_loc19_, + "point":{ + "p1":param3, + "p2":param4 + } + }); + param3 = _loc20_.p1; + param4 = _loc20_.p2; + } + } + } + else { - pEvent.currentTarget.removeEventListener(UiRenderEvent.UIRenderComplete, checkRender); - }; - for each (tp in _tooltips) + _loc7_ = true; + } + } + param1.x = _loc18_.x; + param1.y = _loc18_.y; + } + + public static function placeWithArrow(param1:DisplayObject, param2:IRectangle) : Object + { + var _loc3_:Point = new Point(param1.x,param1.y); + var _loc4_:Object = { + "bottomFlip":false, + "leftFlip":false + }; + _loc3_.x = param2.x + param2.width / 2 + 5; + _loc3_.y = param2.y - param1.height; + if(_loc3_.x + param1.width > StageShareManager.startWidth) + { + _loc4_.leftFlip = true; + _loc3_.x = _loc3_.x - (param1.width + 10); + } + if(_loc3_.y < 0) + { + _loc4_.bottomFlip = true; + _loc3_.y = param2.y + param2.height; + } + param1.x = _loc3_.x; + param1.y = _loc3_.y; + return _loc4_; + } + + public static function waitBeforeOrder(param1:String) : void + { + if(_tooltipsToWait.indexOf(param1) == -1) + { + _tooltipsToWait.push(param1); + } + } + + public static function addTooltipPosition(param1:UiRootContainer, param2:IRectangle, param3:uint) : void + { + var _loc4_:* = 0; + var _loc5_:int = _tooltips.length; + var _loc6_:* = false; + var _loc7_:String = TooltipManager.getTooltipName(param1); + if(!_loc7_) + { + _loc7_ = param1.customUnicName; + } + _loc4_ = 0; + while(_loc4_ < _loc5_) + { + if(_tooltips[_loc4_].tooltip == param1) { - if (!(tp.tooltip.ready)) - { - tp.tooltip.addEventListener(UiRenderEvent.UIRenderComplete, checkRender); - return; - }; - }; - orderTooltips(); - } - - public static function removeTooltipPosition(pTooltip:UiRootContainer):void - { - var tp:TooltipPosition; - var tIndexWait:int; - var tIndex:int = -1; - for each (tp in _tooltips) + _loc6_ = true; + _tooltips.splice(_loc4_,1,new TooltipPosition(param1,param2,param3)); + break; + } + _loc4_++; + } + if(!_loc6_) + { + _tooltips.push(new TooltipPosition(param1,param2,param3)); + } + var _loc8_:int = _tooltipsToWait.indexOf(_loc7_); + if(_loc8_ != -1) + { + _tooltipsToWait.splice(_loc8_,1); + } + if(_tooltipsToWait.length == 0) + { + checkRender(); + } + } + + public static function checkRender(param1:Event = null) : void + { + var _loc2_:TooltipPosition = null; + if(param1) + { + param1.currentTarget.removeEventListener(UiRenderEvent.UIRenderComplete,checkRender); + } + for each(_loc2_ in _tooltips) + { + if(!_loc2_.tooltip.ready) { - if (tp.tooltip == pTooltip) - { - tIndex = _tooltips.indexOf(tp); - break; - }; - }; - if (tIndex != -1) + _loc2_.tooltip.addEventListener(UiRenderEvent.UIRenderComplete,checkRender); + return; + } + } + orderTooltips(); + } + + public static function removeTooltipPosition(param1:UiRootContainer) : void + { + var _loc2_:TooltipPosition = null; + var _loc5_:* = 0; + var _loc3_:* = -1; + for each(_loc2_ in _tooltips) + { + if(_loc2_.tooltip == param1) { - _tooltips.splice(tIndex, 1); - }; - var uiName:String = TooltipManager.getTooltipName(pTooltip); - tIndexWait = _tooltipsToWait.indexOf(uiName); - if (tIndexWait != -1) + _loc3_ = _tooltips.indexOf(_loc2_); + break; + } + } + if(_loc3_ != -1) + { + _tooltips.splice(_loc3_,1); + } + var _loc4_:String = TooltipManager.getTooltipName(param1); + _loc5_ = _tooltipsToWait.indexOf(_loc4_); + if(_loc5_ != -1) + { + _tooltipsToWait.splice(_loc5_,1); + } + } + + public static function removeTooltipPositionByName(param1:String) : void + { + var _loc2_:TooltipPosition = null; + var _loc4_:* = 0; + var _loc3_:* = -1; + for each(_loc2_ in _tooltips) + { + if(_loc2_.tooltip.customUnicName == param1) { - _tooltipsToWait.splice(tIndexWait, 1); - }; - } - - public static function removeTooltipPositionByName(pTooltipName:String):void - { - var tp:TooltipPosition; - var tIndexWait:int; - var tIndex:int = -1; - for each (tp in _tooltips) + _loc3_ = _tooltips.indexOf(_loc2_); + break; + } + } + if(_loc3_ != -1) + { + _tooltips.splice(_loc3_,1); + } + _loc4_ = _tooltipsToWait.indexOf(param1); + if(_loc4_ != -1) + { + _tooltipsToWait.splice(_loc4_,1); + } + } + + private static function orderTooltips() : void + { + var _loc2_:* = 0; + var _loc3_:* = 0; + var _loc4_:TooltipPosition = null; + var _loc5_:Vector. = null; + var _loc9_:* = NaN; + var _loc10_:* = NaN; + var _loc11_:* = 0; + var _loc12_:* = 0; + var _loc13_:* = 0; + var _loc14_:* = false; + var _loc15_:* = NaN; + var _loc16_:* = false; + var _loc17_:* = NaN; + var _loc18_:* = false; + var _loc19_:Object = null; + var _loc1_:int = _tooltips.length; + var _loc6_:Number = 0; + var _loc7_:Number = 0; + var _loc8_:Number = 0; + _tooltips.sort(compareVerticalPos); + _loc2_ = _loc1_ - 1; + while(_loc2_ >= 0) + { + _loc12_ = _tooltips[_loc2_].mapRow; + if(!_tooltipsRows[_loc12_]) { - if (tp.tooltip.customUnicName == pTooltipName) - { - tIndex = _tooltips.indexOf(tp); - break; - }; - }; - if (tIndex != -1) + _tooltipsRows[_loc12_] = new Vector.(0); + } + _loc5_ = isTooltipSuperposed(_tooltips[_loc2_]); + _loc16_ = false; + for each(_loc4_ in _loc5_) { - _tooltips.splice(tIndex, 1); - }; - tIndexWait = _tooltipsToWait.indexOf(pTooltipName); - if (tIndexWait != -1) + if(_loc4_.mapRow == _loc12_ && !(_loc4_.tooltip.customUnicName == _tooltips[_loc2_].tooltip.customUnicName)) + { + _loc16_ = true; + break; + } + } + if(_loc16_) { - _tooltipsToWait.splice(tIndexWait, 1); - }; - } - - private static function orderTooltips():void - { - var i:int; - var j:int; - var ttp:TooltipPosition; - var ttps:Vector.; - var centerX:Number; - var rowWidth:Number; - var rowLen:int; - var currentTooltipRow:int; - var ttpRow:int; - var ok:Boolean; - var newY:Number; - var addToRow:Boolean; - var prevX:Number; - var offScreenX:Boolean; - var row:Object; - var len:int = _tooltips.length; - var minX:Number = 0; - var minTooltipY:Number = 0; - var maxX:Number = 0; - _tooltips.sort(compareVerticalPos); - i = (len - 1); - while (i >= 0) + _tooltipsRows[_loc12_].push(_tooltips[_loc2_]); + } + if(_loc2_ + 1 < _loc1_) { - currentTooltipRow = _tooltips[i].mapRow; - if (!(_tooltipsRows[currentTooltipRow])) - { - _tooltipsRows[currentTooltipRow] = new Vector.(0); - }; - ttps = isTooltipSuperposed(_tooltips[i]); - addToRow = false; - for each (ttp in ttps) - { - if ((((ttp.mapRow == currentTooltipRow)) && (!((ttp.tooltip.customUnicName == _tooltips[i].tooltip.customUnicName))))) - { - addToRow = true; + _loc11_ = _tooltipsRows[_loc12_].length; + if(_loc11_ > 1) + { + _loc10_ = 0; + _loc6_ = 0; + _loc8_ = 0; + _loc7_ = 0; + for each(_loc4_ in _tooltipsRows[_loc12_]) + { + _loc7_ = _loc7_ == 0?_loc4_.tooltip.y:_loc4_.tooltip.y < _loc7_?_loc4_.tooltip.y:_loc7_; + } + _loc3_ = _loc2_ + 1; + while(_loc3_ < _loc1_) + { + if(!(_tooltips[_loc3_].mapRow == _loc12_) && _loc7_ > _tooltips[_loc3_].tooltip.y - _tooltips[_loc2_].tooltip.height - 2) + { + _loc7_ = _tooltips[_loc3_].tooltip.y - _tooltips[_loc2_].tooltip.height - 2; break; - }; - }; - if (addToRow) - { - _tooltipsRows[currentTooltipRow].push(_tooltips[i]); - }; - if ((i + 1) < len) - { - rowLen = _tooltipsRows[currentTooltipRow].length; - if (rowLen > 1) - { - rowWidth = 0; - minX = 0; - maxX = 0; - minTooltipY = 0; - for each (ttp in _tooltipsRows[currentTooltipRow]) - { - minTooltipY = (((minTooltipY == 0)) ? ttp.tooltip.y : (((ttp.tooltip.y < minTooltipY)) ? ttp.tooltip.y : minTooltipY)); - }; - j = (i + 1); - while (j < len) - { - if (((!((_tooltips[j].mapRow == currentTooltipRow))) && ((minTooltipY > ((_tooltips[j].tooltip.y - _tooltips[i].tooltip.height) - 2))))) - { - minTooltipY = ((_tooltips[j].tooltip.y - _tooltips[i].tooltip.height) - 2); - break; - }; - j++; - }; - for each (ttp in _tooltipsRows[currentTooltipRow]) + } + _loc3_++; + } + for each(_loc4_ in _tooltipsRows[_loc12_]) + { + _loc4_.tooltip.y = _loc7_; + } + _loc6_ = _loc8_ = _tooltips[_loc2_].target.x; + for each(_loc4_ in _tooltipsRows[_loc12_]) + { + if(_loc4_.target.x < _loc6_) + { + _loc6_ = _loc4_.target.x; + } + else if(_loc4_.target.x > _loc8_) + { + _loc8_ = _loc4_.target.x; + } + + _loc10_ = _loc10_ + _loc4_.tooltip.width; + } + _tooltipsRows[_loc12_].sort(compareHorizontalPos); + _loc11_ = _tooltipsRows[_loc12_].length; + if(_loc11_ > 0) + { + _loc10_ = _loc10_ + 2 * (_loc11_ - 1); + _loc9_ = _loc8_ - (_loc8_ - _loc6_) / 2; + _tooltipsRows[_loc12_][0].tooltip.x = _loc9_ + 43 - _loc10_ / 2; + _loc3_ = 1; + while(_loc3_ < _loc11_) + { + _tooltipsRows[_loc12_][_loc3_].tooltip.x = _tooltipsRows[_loc12_][_loc3_ - 1].tooltip.x + _tooltipsRows[_loc12_][_loc3_ - 1].tooltip.width + 2; + _loc3_++; + } + } + } + else + { + _loc14_ = false; + while(!_loc14_) + { + _loc3_ = _loc2_ + 1; + while(_loc3_ < _loc1_) + { + _loc14_ = true; + if(hitTest(_tooltips[_loc2_].rect,_tooltips[_loc3_].rect) != 0) { - ttp.tooltip.y = minTooltipY; - }; - maxX = _tooltips[i].target.x; - minX = maxX; - for each (ttp in _tooltipsRows[currentTooltipRow]) - { - if (ttp.target.x < minX) - { - minX = ttp.target.x; - } - else - { - if (ttp.target.x > maxX) - { - maxX = ttp.target.x; - }; - }; - rowWidth = (rowWidth + ttp.tooltip.width); - }; - _tooltipsRows[currentTooltipRow].sort(compareHorizontalPos); - rowLen = _tooltipsRows[currentTooltipRow].length; - if (rowLen > 0) - { - rowWidth = (rowWidth + (2 * (rowLen - 1))); - centerX = (maxX - ((maxX - minX) / 2)); - _tooltipsRows[currentTooltipRow][0].tooltip.x = ((centerX + 43) - (rowWidth / 2)); - j = 1; - while (j < rowLen) - { - _tooltipsRows[currentTooltipRow][j].tooltip.x = ((_tooltipsRows[currentTooltipRow][(j - 1)].tooltip.x + _tooltipsRows[currentTooltipRow][(j - 1)].tooltip.width) + 2); - j++; - }; - }; - } - else - { - ok = false; - while (!(ok)) - { - j = (i + 1); - while (j < len) - { - ok = true; - if (hitTest(_tooltips[i].rect, _tooltips[j].rect) != 0) - { - newY = ((_tooltips[j].tooltip.y - _tooltips[i].tooltip.height) - 2); - if (newY < 0) - { - _tooltips[i].tooltip.y = 0; - ttp = _tooltips[j]; - prevX = _tooltips[i].tooltip.x; - if (_tooltips[i].originalX < ttp.originalX) - { - _tooltips[i].tooltip.x = ((ttp.tooltip.x - _tooltips[i].tooltip.width) - 2); - } - else - { - _tooltips[i].tooltip.x = ((ttp.tooltip.x + ttp.tooltip.width) + 2); - }; - offScreenX = (((_tooltips[i].tooltip.x < 0)) || ((((_tooltips[i].tooltip.x + _tooltips[i].tooltip.width) + 2) > StageShareManager.stage.stageWidth))); - if (((offScreenX) || (isTooltipSuperposed(_tooltips[i])))) - { - _tooltips[i].tooltip.x = prevX; - _tooltips[i].tooltip.y = newY; - }; - } - else - { - _tooltips[i].tooltip.y = newY; - }; - ok = false; - break; - }; - j++; - }; - }; - }; - }; - i--; - }; - for (row in _tooltipsRows) - { - delete _tooltipsRows[row]; - }; - } - - private static function isTooltipSuperposed(pTooltipPosition:TooltipPosition):Vector. - { - var tp:TooltipPosition; - var ttpsInCollision:Vector.; - for each (tp in _tooltips) - { - if (((!((tp == pTooltipPosition))) && (!((hitTest(tp.rect, pTooltipPosition.rect) == 0))))) - { - if (!(ttpsInCollision)) - { - ttpsInCollision = new Vector.(0); - }; - ttpsInCollision.push(tp); - }; - }; - return (ttpsInCollision); - } - - private static function compareVerticalPos(pTooltipPosA:TooltipPosition, pTooltipPosB:TooltipPosition):int - { - var result:int; - if (pTooltipPosA.mapRow > pTooltipPosB.mapRow) - { - result = 1; + _loc15_ = _tooltips[_loc3_].tooltip.y - _tooltips[_loc2_].tooltip.height - 2; + if(_loc15_ < 0) + { + _tooltips[_loc2_].tooltip.y = 0; + _loc4_ = _tooltips[_loc3_]; + _loc17_ = _tooltips[_loc2_].tooltip.x; + if(_tooltips[_loc2_].originalX < _loc4_.originalX) + { + _tooltips[_loc2_].tooltip.x = _loc4_.tooltip.x - _tooltips[_loc2_].tooltip.width - 2; + } + else + { + _tooltips[_loc2_].tooltip.x = _loc4_.tooltip.x + _loc4_.tooltip.width + 2; + } + _loc18_ = _tooltips[_loc2_].tooltip.x < 0 || _tooltips[_loc2_].tooltip.x + _tooltips[_loc2_].tooltip.width + 2 > StageShareManager.stage.stageWidth; + if((_loc18_) || (isTooltipSuperposed(_tooltips[_loc2_]))) + { + _tooltips[_loc2_].tooltip.x = _loc17_; + _tooltips[_loc2_].tooltip.y = _loc15_; + } + } + else + { + _tooltips[_loc2_].tooltip.y = _loc15_; + } + _loc14_ = false; + break; + } + _loc3_++; + } + } + } } - else + _loc2_--; + } + for(_loc19_ in _tooltipsRows) + { + delete _tooltipsRows[_loc19_]; + true; + } + } + + private static function isTooltipSuperposed(param1:TooltipPosition) : Vector. + { + var _loc2_:TooltipPosition = null; + var _loc3_:Vector. = null; + for each(_loc2_ in _tooltips) + { + if(!(_loc2_ == param1) && !(hitTest(_loc2_.rect,param1.rect) == 0)) { - if (pTooltipPosA.mapRow < pTooltipPosB.mapRow) - { - result = -1; - } - else - { - result = 0; - }; - }; - return (result); - } - - private static function compareHorizontalPos(pTooltipPosA:TooltipPosition, pTooltipPosB:TooltipPosition):int - { - var result:int; - if (pTooltipPosA.tooltip.x > pTooltipPosB.tooltip.x) - { - result = 1; + if(!_loc3_) + { + _loc3_ = new Vector.(0); + } + _loc3_.push(_loc2_); } - else - { - if (pTooltipPosA.tooltip.x < pTooltipPosB.tooltip.x) - { - result = -1; - } - else - { - result = 0; - }; - }; - return (result); - } - - private static function hitTest(item:IRectangle, zone:IRectangle):int - { - var r1:Rectangle = new Rectangle(item.x, item.y, item.width, item.height); - var r2:Rectangle = new Rectangle(zone.x, zone.y, zone.width, zone.height); - var r3:Rectangle = r1.intersection(r2); - return ((r3.width * r3.height)); - } - - private static function processAnchor(p:Point, target:IRectangle, location:uint):Point - { - switch (location) - { - case LocationEnum.POINT_TOPLEFT: - break; - case LocationEnum.POINT_TOP: - p.x = (p.x + (target.width / 2)); - break; - case LocationEnum.POINT_TOPRIGHT: - p.x = (p.x + target.width); - break; - case LocationEnum.POINT_LEFT: - p.y = (p.y + (target.height / 2)); - break; - case LocationEnum.POINT_CENTER: - p.x = (p.x + (target.width / 2)); - p.y = (p.y + (target.height / 2)); - break; - case LocationEnum.POINT_RIGHT: - p.x = (p.x + target.width); - p.y = (p.y + (target.height / 2)); - break; - case LocationEnum.POINT_BOTTOMLEFT: - p.y = (p.y + target.height); - break; - case LocationEnum.POINT_BOTTOM: - p.x = (p.x + (target.width / 2)); - p.y = (p.y + target.height); - break; - case LocationEnum.POINT_BOTTOMRIGHT: - p.x = (p.x + target.width); - p.y = (p.y + target.height); - break; - }; - return (p); - } - - private static function makeOffset(point:uint, offset:uint):Point - { - var offsetPt:Point = new Point(); - switch (point) - { - case LocationEnum.POINT_TOPLEFT: - case LocationEnum.POINT_BOTTOMLEFT: - case LocationEnum.POINT_LEFT: - offsetPt.x = offset; - break; - case LocationEnum.POINT_TOP: - break; - case LocationEnum.POINT_BOTTOMRIGHT: - case LocationEnum.POINT_TOPRIGHT: - case LocationEnum.POINT_RIGHT: - offsetPt.x = -(offset); - break; - }; - switch (point) - { - case LocationEnum.POINT_TOPLEFT: - case LocationEnum.POINT_TOP: - case LocationEnum.POINT_TOPRIGHT: - offsetPt.y = offset; - break; - case LocationEnum.POINT_BOTTOMLEFT: - case LocationEnum.POINT_BOTTOMRIGHT: - case LocationEnum.POINT_BOTTOM: - offsetPt.y = -(offset); - break; - }; - return (offsetPt); - } - - - } -}//package com.ankamagames.berilia.types.tooltip - + } + return _loc3_; + } + + private static function compareVerticalPos(param1:TooltipPosition, param2:TooltipPosition) : int + { + var _loc3_:* = 0; + if(param1.mapRow > param2.mapRow) + { + _loc3_ = 1; + } + else if(param1.mapRow < param2.mapRow) + { + _loc3_ = -1; + } + else + { + _loc3_ = 0; + } + + return _loc3_; + } + + private static function compareHorizontalPos(param1:TooltipPosition, param2:TooltipPosition) : int + { + var _loc3_:* = 0; + if(param1.tooltip.x > param2.tooltip.x) + { + _loc3_ = 1; + } + else if(param1.tooltip.x < param2.tooltip.x) + { + _loc3_ = -1; + } + else + { + _loc3_ = 0; + } + + return _loc3_; + } + + private static function hitTest(param1:IRectangle, param2:IRectangle) : int + { + var _loc3_:Rectangle = new Rectangle(param1.x,param1.y,param1.width,param1.height); + var _loc4_:Rectangle = new Rectangle(param2.x,param2.y,param2.width,param2.height); + var _loc5_:Rectangle = _loc3_.intersection(_loc4_); + return _loc5_.width * _loc5_.height; + } + + private static function processAnchor(param1:Point, param2:IRectangle, param3:uint) : Point + { + switch(param3) + { + case LocationEnum.POINT_TOPLEFT: + break; + case LocationEnum.POINT_TOP: + param1.x = param1.x + param2.width / 2; + break; + case LocationEnum.POINT_TOPRIGHT: + param1.x = param1.x + param2.width; + break; + case LocationEnum.POINT_LEFT: + param1.y = param1.y + param2.height / 2; + break; + case LocationEnum.POINT_CENTER: + param1.x = param1.x + param2.width / 2; + param1.y = param1.y + param2.height / 2; + break; + case LocationEnum.POINT_RIGHT: + param1.x = param1.x + param2.width; + param1.y = param1.y + param2.height / 2; + break; + case LocationEnum.POINT_BOTTOMLEFT: + param1.y = param1.y + param2.height; + break; + case LocationEnum.POINT_BOTTOM: + param1.x = param1.x + param2.width / 2; + param1.y = param1.y + param2.height; + break; + case LocationEnum.POINT_BOTTOMRIGHT: + param1.x = param1.x + param2.width; + param1.y = param1.y + param2.height; + break; + } + return param1; + } + + private static function makeOffset(param1:uint, param2:uint) : Point + { + var _loc3_:Point = new Point(); + switch(param1) + { + case LocationEnum.POINT_TOPLEFT: + case LocationEnum.POINT_BOTTOMLEFT: + case LocationEnum.POINT_LEFT: + _loc3_.x = param2; + break; + case LocationEnum.POINT_TOP: + break; + case LocationEnum.POINT_BOTTOMRIGHT: + case LocationEnum.POINT_TOPRIGHT: + case LocationEnum.POINT_RIGHT: + _loc3_.x = -param2; + break; + } + switch(param1) + { + case LocationEnum.POINT_TOPLEFT: + case LocationEnum.POINT_TOP: + case LocationEnum.POINT_TOPRIGHT: + _loc3_.y = param2; + break; + case LocationEnum.POINT_BOTTOMLEFT: + case LocationEnum.POINT_BOTTOMRIGHT: + case LocationEnum.POINT_BOTTOM: + _loc3_.y = -param2; + break; + } + return _loc3_; + } + } +} diff --git a/com/ankamagames/berilia/types/tooltip/TooltipPosition.as b/com/ankamagames/berilia/types/tooltip/TooltipPosition.as index 30e9febd9..9d20dc8f5 100644 --- a/com/ankamagames/berilia/types/tooltip/TooltipPosition.as +++ b/com/ankamagames/berilia/types/tooltip/TooltipPosition.as @@ -1,74 +1,77 @@ -package com.ankamagames.berilia.types.tooltip +package com.ankamagames.berilia.types.tooltip { - import com.ankamagames.berilia.types.graphic.UiRootContainer; - import com.ankamagames.jerakine.interfaces.IRectangle; - import com.ankamagames.jerakine.utils.display.Rectangle2; - - public class TooltipPosition - { - - private var _tooltip:UiRootContainer; - private var _target:IRectangle; - private var _cellId:uint; - private var _rect:Rectangle2; - private var _originalX:Number; - private var _originalY:Number; - - public function TooltipPosition(pTooltip:UiRootContainer, pTarget:IRectangle, pCellId:uint) - { - this._tooltip = pTooltip; - this._target = pTarget; - this._cellId = pCellId; - this._rect = new Rectangle2(this._tooltip.x, this._tooltip.y, this._tooltip.width, this._tooltip.height); - this._originalX = this._tooltip.x; - this._originalY = this._tooltip.y; - } - - public function get tooltip():UiRootContainer - { - return (this._tooltip); - } - - public function get target():IRectangle - { - return (this._target); - } - - public function set target(pTarget:IRectangle):void - { - this._target = pTarget; - } - - public function get cellId():uint - { - return (this._cellId); - } - - public function get mapRow():int - { - return ((this._cellId / 14)); - } - - public function get rect():Rectangle2 - { - this._rect.y = this._tooltip.y; - this._rect.x = this._tooltip.x; - this._rect.width = this._tooltip.width; - this._rect.height = this._tooltip.height; - return (this._rect); - } - - public function get originalX():Number - { - return (this._originalX); - } - - public function get originalY():Number - { - return (this._originalY); - } - - - } -}//package com.ankamagames.berilia.types.tooltip - + import com.ankamagames.berilia.types.graphic.UiRootContainer; + import com.ankamagames.jerakine.interfaces.IRectangle; + import com.ankamagames.jerakine.utils.display.Rectangle2; + + public class TooltipPosition extends Object + { + + public function TooltipPosition(param1:UiRootContainer, param2:IRectangle, param3:uint) + { + super(); + this._tooltip = param1; + this._target = param2; + this._cellId = param3; + this._rect = new Rectangle2(this._tooltip.x,this._tooltip.y,this._tooltip.width,this._tooltip.height); + this._originalX = this._tooltip.x; + this._originalY = this._tooltip.y; + } + + private var _tooltip:UiRootContainer; + + private var _target:IRectangle; + + private var _cellId:uint; + + private var _rect:Rectangle2; + + private var _originalX:Number; + + private var _originalY:Number; + + public function get tooltip() : UiRootContainer + { + return this._tooltip; + } + + public function get target() : IRectangle + { + return this._target; + } + + public function set target(param1:IRectangle) : void + { + this._target = param1; + } + + public function get cellId() : uint + { + return this._cellId; + } + + public function get mapRow() : int + { + return this._cellId / 14; + } + + public function get rect() : Rectangle2 + { + this._rect.y = this._tooltip.y; + this._rect.x = this._tooltip.x; + this._rect.width = this._tooltip.width; + this._rect.height = this._tooltip.height; + return this._rect; + } + + public function get originalX() : Number + { + return this._originalX; + } + + public function get originalY() : Number + { + return this._originalY; + } + } +} diff --git a/com/ankamagames/berilia/types/tooltip/TooltipRectangle.as b/com/ankamagames/berilia/types/tooltip/TooltipRectangle.as index ac0de59b1..d3f962ae8 100644 --- a/com/ankamagames/berilia/types/tooltip/TooltipRectangle.as +++ b/com/ankamagames/berilia/types/tooltip/TooltipRectangle.as @@ -1,76 +1,77 @@ -package com.ankamagames.berilia.types.tooltip +package com.ankamagames.berilia.types.tooltip { - import com.ankamagames.jerakine.interfaces.IRectangle; - import com.ankamagames.jerakine.interfaces.IModuleUtil; - import flash.geom.Point; - - public class TooltipRectangle implements IRectangle, IModuleUtil - { - - private var _x:Number; - private var _y:Number; - private var _width:Number; - private var _height:Number; - - public function TooltipRectangle(x:Number, y:Number, width:Number, height:Number) - { - this.x = x; - this.y = y; - this.width = width; - this.height = height; - } - - public function get x():Number - { - return (this._x); - } - - public function get y():Number - { - return (this._y); - } - - public function get width():Number - { - return (this._width); - } - - public function get height():Number - { - return (this._height); - } - - public function set x(nValue:Number):void - { - this._x = nValue; - } - - public function set y(nValue:Number):void - { - this._y = nValue; - } - - public function set width(nValue:Number):void - { - this._width = nValue; - } - - public function set height(nValue:Number):void - { - this._height = nValue; - } - - public function localToGlobal(point:Point):Point - { - return (point); - } - - public function globalToLocal(point:Point):Point - { - return (point); - } - - - } -}//package com.ankamagames.berilia.types.tooltip - + import com.ankamagames.jerakine.interfaces.IRectangle; + import com.ankamagames.jerakine.interfaces.IModuleUtil; + import flash.geom.Point; + + public class TooltipRectangle extends Object implements IRectangle, IModuleUtil + { + + public function TooltipRectangle(param1:Number, param2:Number, param3:Number, param4:Number) + { + super(); + this.x = param1; + this.y = param2; + this.width = param3; + this.height = param4; + } + + private var _x:Number; + + private var _y:Number; + + private var _width:Number; + + private var _height:Number; + + public function get x() : Number + { + return this._x; + } + + public function get y() : Number + { + return this._y; + } + + public function get width() : Number + { + return this._width; + } + + public function get height() : Number + { + return this._height; + } + + public function set x(param1:Number) : void + { + this._x = param1; + } + + public function set y(param1:Number) : void + { + this._y = param1; + } + + public function set width(param1:Number) : void + { + this._width = param1; + } + + public function set height(param1:Number) : void + { + this._height = param1; + } + + public function localToGlobal(param1:Point) : Point + { + return param1; + } + + public function globalToLocal(param1:Point) : Point + { + return param1; + } + } +} diff --git a/com/ankamagames/berilia/types/uiDefinition/BasicElement.as b/com/ankamagames/berilia/types/uiDefinition/BasicElement.as index eb0badf4b..2e7695354 100644 --- a/com/ankamagames/berilia/types/uiDefinition/BasicElement.as +++ b/com/ankamagames/berilia/types/uiDefinition/BasicElement.as @@ -1,60 +1,69 @@ -package com.ankamagames.berilia.types.uiDefinition +package com.ankamagames.berilia.types.uiDefinition { - public class BasicElement - { - - public static var ID:uint = 10000; - - public var name:String; - public var strata:uint = 1; - public var size:SizeElement; - public var minSize:SizeElement; - public var maxSize:SizeElement; - public var anchors:Array; - public var event:Array; - public var properties:Array; - public var className:String; - public var cachedWidth:int = 2147483647; - public var cachedHeight:int = 2147483647; - public var cachedX:int = 2147483647; - public var cachedY:int = 2147483647; - - public function BasicElement() - { - this.event = new Array(); - this.properties = new Array(); - super(); - } - - public function setName(sName:String):void - { - this.name = sName; - this.properties["name"] = sName; - } - - public function copy(target:BasicElement):void - { - var key:String; - target.strata = this.strata; - target.size = this.size; - target.minSize = this.minSize; - target.maxSize = this.maxSize; - target.anchors = this.anchors; - target.event = this.event; - target.properties = []; - for (key in this.properties) - { - target.properties[key] = this.properties[key]; - }; - target.className = this.className; - target.cachedWidth = this.cachedWidth; - target.cachedHeight = this.cachedHeight; - target.cachedX = this.cachedX; - target.cachedY = this.cachedY; - target.setName(this.name); - } - - - } -}//package com.ankamagames.berilia.types.uiDefinition - + public class BasicElement extends Object + { + + public function BasicElement() + { + this.event = new Array(); + this.properties = new Array(); + super(); + } + + public static var ID:uint = 10000; + + public var name:String; + + public var strata:uint = 1; + + public var size:SizeElement; + + public var minSize:SizeElement; + + public var maxSize:SizeElement; + + public var anchors:Array; + + public var event:Array; + + public var properties:Array; + + public var className:String; + + public var cachedWidth:int = 2147483647; + + public var cachedHeight:int = 2147483647; + + public var cachedX:int = 2147483647; + + public var cachedY:int = 2147483647; + + public function setName(param1:String) : void + { + this.name = param1; + this.properties["name"] = param1; + } + + public function copy(param1:BasicElement) : void + { + var _loc2_:String = null; + param1.strata = this.strata; + param1.size = this.size; + param1.minSize = this.minSize; + param1.maxSize = this.maxSize; + param1.anchors = this.anchors; + param1.event = this.event; + param1.properties = []; + for(_loc2_ in this.properties) + { + param1.properties[_loc2_] = this.properties[_loc2_]; + } + param1.className = this.className; + param1.cachedWidth = this.cachedWidth; + param1.cachedHeight = this.cachedHeight; + param1.cachedX = this.cachedX; + param1.cachedY = this.cachedY; + param1.setName(this.name); + } + } +} diff --git a/com/ankamagames/berilia/types/uiDefinition/ButtonElement.as b/com/ankamagames/berilia/types/uiDefinition/ButtonElement.as index 41dfdc1be..2e1feb4fd 100644 --- a/com/ankamagames/berilia/types/uiDefinition/ButtonElement.as +++ b/com/ankamagames/berilia/types/uiDefinition/ButtonElement.as @@ -1,9 +1,11 @@ -package com.ankamagames.berilia.types.uiDefinition +package com.ankamagames.berilia.types.uiDefinition { - public class ButtonElement extends StateContainerElement - { - - - } -}//package com.ankamagames.berilia.types.uiDefinition - + public class ButtonElement extends StateContainerElement + { + + public function ButtonElement() + { + super(); + } + } +} diff --git a/com/ankamagames/berilia/types/uiDefinition/ComponentElement.as b/com/ankamagames/berilia/types/uiDefinition/ComponentElement.as index 0775fff80..79b00341c 100644 --- a/com/ankamagames/berilia/types/uiDefinition/ComponentElement.as +++ b/com/ankamagames/berilia/types/uiDefinition/ComponentElement.as @@ -1,17 +1,16 @@ -package com.ankamagames.berilia.types.uiDefinition +package com.ankamagames.berilia.types.uiDefinition { - import flash.utils.Dictionary; - - public class ComponentElement extends BasicElement - { - - public static var MEMORY_LOG:Dictionary = new Dictionary(true); - - public function ComponentElement() - { - MEMORY_LOG[this] = 1; - } - - } -}//package com.ankamagames.berilia.types.uiDefinition - + import flash.utils.Dictionary; + + public class ComponentElement extends BasicElement + { + + public function ComponentElement() + { + super(); + MEMORY_LOG[this] = 1; + } + + public static var MEMORY_LOG:Dictionary = new Dictionary(true); + } +} diff --git a/com/ankamagames/berilia/types/uiDefinition/ContainerElement.as b/com/ankamagames/berilia/types/uiDefinition/ContainerElement.as index 99434489f..b5f6ebb6e 100644 --- a/com/ankamagames/berilia/types/uiDefinition/ContainerElement.as +++ b/com/ankamagames/berilia/types/uiDefinition/ContainerElement.as @@ -1,16 +1,14 @@ -package com.ankamagames.berilia.types.uiDefinition +package com.ankamagames.berilia.types.uiDefinition { - public class ContainerElement extends BasicElement - { - - public var childs:Array; - - public function ContainerElement() - { - this.childs = new Array(); - super(); - } - - } -}//package com.ankamagames.berilia.types.uiDefinition - + public class ContainerElement extends BasicElement + { + + public function ContainerElement() + { + this.childs = new Array(); + super(); + } + + public var childs:Array; + } +} diff --git a/com/ankamagames/berilia/types/uiDefinition/GridElement.as b/com/ankamagames/berilia/types/uiDefinition/GridElement.as index 49b8b2c0e..b3cc0fcfb 100644 --- a/com/ankamagames/berilia/types/uiDefinition/GridElement.as +++ b/com/ankamagames/berilia/types/uiDefinition/GridElement.as @@ -1,17 +1,16 @@ -package com.ankamagames.berilia.types.uiDefinition +package com.ankamagames.berilia.types.uiDefinition { - import flash.utils.Dictionary; - - public class GridElement extends ContainerElement - { - - public static var MEMORY_LOG:Dictionary = new Dictionary(true); - - public function GridElement() - { - MEMORY_LOG[this] = 1; - } - - } -}//package com.ankamagames.berilia.types.uiDefinition - + import flash.utils.Dictionary; + + public class GridElement extends ContainerElement + { + + public function GridElement() + { + super(); + MEMORY_LOG[this] = 1; + } + + public static var MEMORY_LOG:Dictionary = new Dictionary(true); + } +} diff --git a/com/ankamagames/berilia/types/uiDefinition/LocationELement.as b/com/ankamagames/berilia/types/uiDefinition/LocationELement.as index 8a0857829..7c4997c70 100644 --- a/com/ankamagames/berilia/types/uiDefinition/LocationELement.as +++ b/com/ankamagames/berilia/types/uiDefinition/LocationELement.as @@ -1,37 +1,45 @@ -package com.ankamagames.berilia.types.uiDefinition +package com.ankamagames.berilia.types.uiDefinition { - import com.ankamagames.berilia.types.graphic.GraphicLocation; - - public class LocationELement - { - - public var point:uint; - public var relativePoint:uint; - public var relativeTo:String; - public var type:uint; - public var offsetX:Number; - public var offsetY:Number; - public var offsetXType:uint; - public var offsetYType:uint; - - - public function toGraphicLocation():GraphicLocation - { - var gl:GraphicLocation = new GraphicLocation(this.point, this.relativePoint, this.relativeTo); - gl.offsetXType = this.offsetXType; - gl.offsetYType = this.offsetYType; - if (!(isNaN(this.offsetX))) - { - gl.setOffsetX(this.offsetX); - }; - if (!(isNaN(this.offsetY))) - { - gl.setOffsetY(this.offsetY); - }; - return (gl); - } - - - } -}//package com.ankamagames.berilia.types.uiDefinition - + import com.ankamagames.berilia.types.graphic.GraphicLocation; + + public class LocationELement extends Object + { + + public function LocationELement() + { + super(); + } + + public var point:uint; + + public var relativePoint:uint; + + public var relativeTo:String; + + public var type:uint; + + public var offsetX:Number; + + public var offsetY:Number; + + public var offsetXType:uint; + + public var offsetYType:uint; + + public function toGraphicLocation() : GraphicLocation + { + var _loc1_:GraphicLocation = new GraphicLocation(this.point,this.relativePoint,this.relativeTo); + _loc1_.offsetXType = this.offsetXType; + _loc1_.offsetYType = this.offsetYType; + if(!isNaN(this.offsetX)) + { + _loc1_.setOffsetX(this.offsetX); + } + if(!isNaN(this.offsetY)) + { + _loc1_.setOffsetY(this.offsetY); + } + return _loc1_; + } + } +} diff --git a/com/ankamagames/berilia/types/uiDefinition/PropertyElement.as b/com/ankamagames/berilia/types/uiDefinition/PropertyElement.as index 40afb9683..6d48e1c3c 100644 --- a/com/ankamagames/berilia/types/uiDefinition/PropertyElement.as +++ b/com/ankamagames/berilia/types/uiDefinition/PropertyElement.as @@ -1,12 +1,15 @@ -package com.ankamagames.berilia.types.uiDefinition +package com.ankamagames.berilia.types.uiDefinition { - public class PropertyElement - { - - public var name:String; - public var value; - - - } -}//package com.ankamagames.berilia.types.uiDefinition - + public class PropertyElement extends Object + { + + public function PropertyElement() + { + super(); + } + + public var name:String; + + public var value; + } +} diff --git a/com/ankamagames/berilia/types/uiDefinition/ScrollContainerElement.as b/com/ankamagames/berilia/types/uiDefinition/ScrollContainerElement.as index 29b1de663..1a37fd075 100644 --- a/com/ankamagames/berilia/types/uiDefinition/ScrollContainerElement.as +++ b/com/ankamagames/berilia/types/uiDefinition/ScrollContainerElement.as @@ -1,9 +1,11 @@ -package com.ankamagames.berilia.types.uiDefinition +package com.ankamagames.berilia.types.uiDefinition { - public class ScrollContainerElement extends ContainerElement - { - - - } -}//package com.ankamagames.berilia.types.uiDefinition - + public class ScrollContainerElement extends ContainerElement + { + + public function ScrollContainerElement() + { + super(); + } + } +} diff --git a/com/ankamagames/berilia/types/uiDefinition/SizeElement.as b/com/ankamagames/berilia/types/uiDefinition/SizeElement.as index fe4a6327b..3569d66c5 100644 --- a/com/ankamagames/berilia/types/uiDefinition/SizeElement.as +++ b/com/ankamagames/berilia/types/uiDefinition/SizeElement.as @@ -1,38 +1,44 @@ -package com.ankamagames.berilia.types.uiDefinition +package com.ankamagames.berilia.types.uiDefinition { - import com.ankamagames.jerakine.logger.Logger; - import com.ankamagames.jerakine.logger.Log; - import flash.utils.getQualifiedClassName; - import com.ankamagames.berilia.types.graphic.GraphicSize; - - public class SizeElement - { - - public static const SIZE_PIXEL:uint = 0; - public static const SIZE_PRC:uint = 1; - protected static const _log:Logger = Log.getLogger(getQualifiedClassName(SizeElement)); - - public var xUnit:uint; - public var yUnit:uint; - public var x:Number; - public var y:Number; - - - public function toGraphicSize():GraphicSize - { - var graphicSize:GraphicSize = new GraphicSize(); - if (!(isNaN(this.xUnit))) - { - graphicSize.setX(this.x, this.xUnit); - }; - if (!(isNaN(this.yUnit))) - { - graphicSize.setY(this.y, this.yUnit); - }; - return (graphicSize); - } - - - } -}//package com.ankamagames.berilia.types.uiDefinition - + import com.ankamagames.jerakine.logger.Logger; + import com.ankamagames.jerakine.logger.Log; + import flash.utils.getQualifiedClassName; + import com.ankamagames.berilia.types.graphic.GraphicSize; + + public class SizeElement extends Object + { + + public function SizeElement() + { + super(); + } + + public static const SIZE_PIXEL:uint = 0; + + public static const SIZE_PRC:uint = 1; + + protected static const _log:Logger = Log.getLogger(getQualifiedClassName(SizeElement)); + + public var xUnit:uint; + + public var yUnit:uint; + + public var x:Number; + + public var y:Number; + + public function toGraphicSize() : GraphicSize + { + var _loc1_:GraphicSize = new GraphicSize(); + if(!isNaN(this.xUnit)) + { + _loc1_.setX(this.x,this.xUnit); + } + if(!isNaN(this.yUnit)) + { + _loc1_.setY(this.y,this.yUnit); + } + return _loc1_; + } + } +} diff --git a/com/ankamagames/berilia/types/uiDefinition/StateContainerElement.as b/com/ankamagames/berilia/types/uiDefinition/StateContainerElement.as index d44d12c35..5eddfb871 100644 --- a/com/ankamagames/berilia/types/uiDefinition/StateContainerElement.as +++ b/com/ankamagames/berilia/types/uiDefinition/StateContainerElement.as @@ -1,16 +1,14 @@ -package com.ankamagames.berilia.types.uiDefinition +package com.ankamagames.berilia.types.uiDefinition { - public class StateContainerElement extends ContainerElement - { - - public var stateChangingProperties:Array; - - public function StateContainerElement() - { - this.stateChangingProperties = new Array(); - super(); - } - - } -}//package com.ankamagames.berilia.types.uiDefinition - + public class StateContainerElement extends ContainerElement + { + + public function StateContainerElement() + { + this.stateChangingProperties = new Array(); + super(); + } + + public var stateChangingProperties:Array; + } +} diff --git a/com/ankamagames/berilia/types/uiDefinition/UiDefinition.as b/com/ankamagames/berilia/types/uiDefinition/UiDefinition.as index c3db91bcc..ba01f8039 100644 --- a/com/ankamagames/berilia/types/uiDefinition/UiDefinition.as +++ b/com/ankamagames/berilia/types/uiDefinition/UiDefinition.as @@ -1,35 +1,46 @@ -package com.ankamagames.berilia.types.uiDefinition +package com.ankamagames.berilia.types.uiDefinition { - import flash.utils.Dictionary; - - public class UiDefinition - { - - public static var MEMORY_LOG:Dictionary = new Dictionary(true); - - public var name:String; - public var debug:Boolean = false; - public var graphicTree:Array; - public var kernelEvents:Array; - public var shortcutsEvents:Array; - public var constants:Array; - public var className:String; - public var useCache:Boolean = true; - public var usePropertiesCache:Boolean = true; - public var modal:Boolean = false; - public var giveFocus:Boolean = true; - public var transmitFocus:Boolean = true; - public var scalable:Boolean = true; - - public function UiDefinition() - { - this.graphicTree = new Array(); - this.kernelEvents = new Array(); - this.shortcutsEvents = new Array(); - this.constants = new Array(); - MEMORY_LOG[this] = 1; - } - - } -}//package com.ankamagames.berilia.types.uiDefinition - + import flash.utils.Dictionary; + + public class UiDefinition extends Object + { + + public function UiDefinition() + { + super(); + this.graphicTree = new Array(); + this.kernelEvents = new Array(); + this.shortcutsEvents = new Array(); + this.constants = new Array(); + MEMORY_LOG[this] = 1; + } + + public static var MEMORY_LOG:Dictionary = new Dictionary(true); + + public var name:String; + + public var debug:Boolean = false; + + public var graphicTree:Array; + + public var kernelEvents:Array; + + public var shortcutsEvents:Array; + + public var constants:Array; + + public var className:String; + + public var useCache:Boolean = true; + + public var usePropertiesCache:Boolean = true; + + public var modal:Boolean = false; + + public var giveFocus:Boolean = true; + + public var transmitFocus:Boolean = true; + + public var scalable:Boolean = true; + } +} diff --git a/com/ankamagames/berilia/uiRender/UiRenderer.as b/com/ankamagames/berilia/uiRender/UiRenderer.as index cd738ef46..3c0f19cf3 100644 --- a/com/ankamagames/berilia/uiRender/UiRenderer.as +++ b/com/ankamagames/berilia/uiRender/UiRenderer.as @@ -1,587 +1,597 @@ -package com.ankamagames.berilia.uiRender +package com.ankamagames.berilia.uiRender { - import flash.events.EventDispatcher; - import flash.utils.Dictionary; - import com.ankamagames.jerakine.logger.Logger; - import com.ankamagames.jerakine.logger.Log; - import flash.utils.getQualifiedClassName; - import com.ankamagames.berilia.types.graphic.UiRootContainer; - import com.ankamagames.berilia.pools.PoolableXmlParsor; - import com.ankamagames.berilia.types.uiDefinition.UiDefinition; - import flash.utils.getTimer; - import com.ankamagames.berilia.pools.PoolsManager; - import flash.events.Event; - import flash.display.Sprite; - import com.ankamagames.berilia.types.event.UiRenderEvent; - import com.ankamagames.berilia.Berilia; - import com.ankamagames.jerakine.managers.LangManager; - import com.ankamagames.berilia.enums.StrataEnum; - import com.ankamagames.berilia.types.event.InstanceEvent; - import com.ankamagames.berilia.types.graphic.GraphicElement; - import com.ankamagames.berilia.types.graphic.GraphicContainer; - import com.ankamagames.berilia.types.uiDefinition.BasicElement; - import com.ankamagames.berilia.types.uiDefinition.StateContainerElement; - import com.ankamagames.berilia.types.uiDefinition.ContainerElement; - import com.ankamagames.berilia.types.uiDefinition.ComponentElement; - import com.ankamagames.berilia.types.graphic.GraphicLocation; - import com.ankamagames.berilia.types.uiDefinition.ButtonElement; - import com.ankamagames.berilia.types.graphic.StateContainer; - import com.ankamagames.berilia.types.uiDefinition.GridElement; - import com.ankamagames.berilia.types.uiDefinition.LocationELement; - import com.ankamagames.berilia.types.graphic.GraphicSize; - import com.ankamagames.berilia.managers.SecureCenter; - import com.ankamagames.berilia.managers.UIEventManager; - import com.ankamagames.berilia.components.ComboBox; - import com.ankamagames.berilia.components.Grid; - import com.ankamagames.berilia.FinalizableUIComponent; - import com.ankamagames.berilia.types.graphic.ButtonContainer; - import com.ankamagames.berilia.types.graphic.ScrollContainer; - import com.ankamagames.berilia.types.uiDefinition.ScrollContainerElement; - import flash.utils.getDefinitionByName; - import com.ankamagames.berilia.types.graphic.InternalComponentAccess; - import com.ankamagames.berilia.UIComponent; - import com.ankamagames.berilia.api.ApiBinder; - import com.ankamagames.berilia.managers.UiModuleManager; - import com.ankamagames.jerakine.utils.misc.DescribeTypeCache; - import com.ankamagames.berilia.types.listener.GenericListener; - import com.ankamagames.jerakine.utils.memory.WeakReference; - import com.ankamagames.berilia.managers.BindsManager; - import com.ankamagames.berilia.types.event.ParsorEvent; - - public class UiRenderer extends EventDispatcher - { - - public static var MEMORY_LOG:Dictionary = new Dictionary(true); - public static var MEMORY_LOG_2:Dictionary = new Dictionary(true); - protected static const _log:Logger = Log.getLogger(getQualifiedClassName(UiRenderer)); - public static var componentsPools:Array = new Array(); - - protected var _scUi:UiRootContainer; - private var _sName:String; - private var _xpParser:PoolableXmlParsor; - private var _uiDef:UiDefinition; - private var _xmlClassDef:XML; - private var _oProperties; - protected var _nTimeStamp:uint; - private var _scriptClass:Class; - private var _isXmlRender:Boolean; - private var _aFilnalizedLater:Array; - public var fromCache:Boolean = false; - public var parsingTime:uint = 0; - public var buildTime:uint = 0; - public var scriptTime:uint = 0; - - public function UiRenderer() - { - MEMORY_LOG[this] = 1; - } - - public function get uiDefinition():UiDefinition - { - return (this._uiDef); - } - - public function set script(scriptClass:Class):void - { - this._scriptClass = scriptClass; - } - - public function get script():Class - { - return (this._scriptClass); - } - - public function fileRender(sUrl:String, sName:String, scUi:UiRootContainer, oProperties:*=null):void - { + import flash.events.EventDispatcher; + import flash.utils.Dictionary; + import com.ankamagames.jerakine.logger.Logger; + import com.ankamagames.jerakine.logger.Log; + import flash.utils.getQualifiedClassName; + import com.ankamagames.berilia.types.graphic.UiRootContainer; + import com.ankamagames.berilia.pools.PoolableXmlParsor; + import com.ankamagames.berilia.types.uiDefinition.UiDefinition; + import flash.utils.getTimer; + import com.ankamagames.berilia.pools.PoolsManager; + import flash.events.Event; + import flash.display.Sprite; + import com.ankamagames.berilia.types.event.UiRenderEvent; + import com.ankamagames.berilia.Berilia; + import com.ankamagames.jerakine.managers.LangManager; + import com.ankamagames.berilia.enums.StrataEnum; + import com.ankamagames.berilia.types.graphic.GraphicContainer; + import com.ankamagames.berilia.types.event.InstanceEvent; + import com.ankamagames.berilia.types.graphic.GraphicElement; + import com.ankamagames.berilia.types.uiDefinition.BasicElement; + import com.ankamagames.berilia.types.uiDefinition.StateContainerElement; + import com.ankamagames.berilia.types.uiDefinition.ContainerElement; + import com.ankamagames.berilia.types.uiDefinition.ComponentElement; + import com.ankamagames.berilia.types.graphic.GraphicLocation; + import com.ankamagames.berilia.types.uiDefinition.ButtonElement; + import com.ankamagames.berilia.types.graphic.StateContainer; + import com.ankamagames.berilia.types.uiDefinition.GridElement; + import com.ankamagames.berilia.types.uiDefinition.LocationELement; + import com.ankamagames.berilia.types.graphic.GraphicSize; + import com.ankamagames.berilia.managers.SecureCenter; + import com.ankamagames.berilia.managers.UIEventManager; + import com.ankamagames.berilia.components.Grid; + import com.ankamagames.berilia.components.ComboBox; + import com.ankamagames.berilia.FinalizableUIComponent; + import com.ankamagames.berilia.types.graphic.ButtonContainer; + import com.ankamagames.berilia.types.graphic.ScrollContainer; + import flash.utils.getDefinitionByName; + import com.ankamagames.berilia.types.uiDefinition.ScrollContainerElement; + import com.ankamagames.berilia.types.graphic.InternalComponentAccess; + import com.ankamagames.berilia.UIComponent; + import com.ankamagames.berilia.api.ApiBinder; + import com.ankamagames.berilia.managers.UiModuleManager; + import com.ankamagames.jerakine.utils.misc.DescribeTypeCache; + import com.ankamagames.berilia.types.listener.GenericListener; + import com.ankamagames.jerakine.utils.memory.WeakReference; + import com.ankamagames.berilia.managers.BindsManager; + import com.ankamagames.berilia.types.event.ParsorEvent; + + public class UiRenderer extends EventDispatcher + { + + public function UiRenderer() + { + super(); + MEMORY_LOG[this] = 1; + } + + public static var MEMORY_LOG:Dictionary = new Dictionary(true); + + public static var MEMORY_LOG_2:Dictionary = new Dictionary(true); + + protected static const _log:Logger = Log.getLogger(getQualifiedClassName(UiRenderer)); + + public static var componentsPools:Array = new Array(); + + protected var _scUi:UiRootContainer; + + private var _sName:String; + + private var _xpParser:PoolableXmlParsor; + + private var _uiDef:UiDefinition; + + private var _xmlClassDef:XML; + + private var _oProperties; + + protected var _nTimeStamp:uint; + + private var _scriptClass:Class; + + private var _isXmlRender:Boolean; + + private var _aFilnalizedLater:Array; + + public function get uiDefinition() : UiDefinition + { + return this._uiDef; + } + + public var fromCache:Boolean = false; + + public var parsingTime:uint = 0; + + public var buildTime:uint = 0; + + public var scriptTime:uint = 0; + + public function set script(param1:Class) : void + { + this._scriptClass = param1; + } + + public function get script() : Class + { + return this._scriptClass; + } + + public function fileRender(param1:String, param2:String, param3:UiRootContainer, param4:* = null) : void + { + this._nTimeStamp = getTimer(); + this._oProperties = param4; + this._sName = param2; + this._scUi = param3; + this._isXmlRender = true; + this._xpParser = PoolsManager.getInstance().getXmlParsorPool().checkOut() as PoolableXmlParsor; + this._xpParser.rootPath = this._scUi.uiModule.rootPath; + this._xpParser.addEventListener(Event.COMPLETE,this.onParseComplete); + this._xpParser.processFile(param1); + } + + public function xmlRender(param1:String, param2:String, param3:UiRootContainer, param4:* = null) : void + { + this._nTimeStamp = getTimer(); + this._oProperties = param4; + this._sName = param2; + this._scUi = param3; + this._isXmlRender = true; + this._xpParser = PoolsManager.getInstance().getXmlParsorPool().checkOut() as PoolableXmlParsor; + this._xpParser.rootPath = this._scUi.uiModule.rootPath; + this._xpParser.addEventListener(Event.COMPLETE,this.onParseComplete); + this._xpParser.processXml(param1); + } + + public function uiRender(param1:UiDefinition, param2:String, param3:UiRootContainer, param4:* = null) : void + { + var _loc6_:String = null; + MEMORY_LOG_2[param4] = 1; + if(!this._nTimeStamp) + { this._nTimeStamp = getTimer(); - this._oProperties = oProperties; - this._sName = sName; - this._scUi = scUi; - this._isXmlRender = true; - this._xpParser = (PoolsManager.getInstance().getXmlParsorPool().checkOut() as PoolableXmlParsor); - this._xpParser.rootPath = this._scUi.uiModule.rootPath; - this._xpParser.addEventListener(Event.COMPLETE, this.onParseComplete); - this._xpParser.processFile(sUrl); - } - - public function xmlRender(sXml:String, sName:String, scUi:UiRootContainer, oProperties:*=null):void - { - this._nTimeStamp = getTimer(); - this._oProperties = oProperties; - this._sName = sName; - this._scUi = scUi; - this._isXmlRender = true; - this._xpParser = (PoolsManager.getInstance().getXmlParsorPool().checkOut() as PoolableXmlParsor); - this._xpParser.rootPath = this._scUi.uiModule.rootPath; - this._xpParser.addEventListener(Event.COMPLETE, this.onParseComplete); - this._xpParser.processXml(sXml); - } - - public function uiRender(uiDef:UiDefinition, sName:String, scUi:UiRootContainer, oProperties:*=null):void - { - var constKey:String; - MEMORY_LOG_2[oProperties] = 1; - if (!(this._nTimeStamp)) + } + if(param3.parent) + { + param3.tempHolder = new Sprite(); + param3.parent.addChildAt(param3.tempHolder,param3.parent.getChildIndex(param3)); + param3.parent.removeChild(param3); + } + if(!param1) + { + _log.error("Cannot render " + param2 + " : no UI definition"); + dispatchEvent(new UiRenderEvent(Event.COMPLETE,false,false,this._scUi,this)); + return; + } + this._oProperties = param4; + this._sName = param2; + this._scUi = param3; + this._uiDef = param1; + this._uiDef.name = param2; + this._aFilnalizedLater = new Array(); + if(this._uiDef.scalable) + { + param3.scaleX = Berilia.getInstance().scale; + param3.scaleY = Berilia.getInstance().scale; + } + this._scUi.scalable = this._uiDef.scalable; + var _loc5_:Array = []; + for(_loc6_ in this._uiDef.constants) + { + _loc5_[_loc6_] = LangManager.getInstance().replaceKey(this._uiDef.constants[_loc6_]); + } + this._scUi.constants = _loc5_; + this._scUi.disableRender = true; + this.makeScript(); + if(this._uiDef.modal) + { + this.makeModalContainer(); + } + param3.giveFocus = this._uiDef.giveFocus; + param3.transmitFocus = this._uiDef.transmitFocus; + this.makeChilds(param1.graphicTree,param3); + this.makeShortcuts(); + this.fillUiScriptVar(); + if(this._scUi.uiClass) + { + this._scUi.properties = this._oProperties; + } + this._scUi.disableRender = false; + param3.render(); + if(param3.strata == StrataEnum.STRATA_MEDIUM && (param3.giveFocus)) + { + Berilia.getInstance().giveFocus(param3); + } + this.finalizeContainer(); + this.buildTime = getTimer() - this._nTimeStamp; + this.scriptTime = getTimer(); + this.scriptTime = getTimer() - this.scriptTime; + param3.iAmFinalized(null); + if(!this._isXmlRender) + { + this.parsingTime = 0; + } + dispatchEvent(new UiRenderEvent(Event.COMPLETE,false,false,this._scUi,this)); + this._oProperties = null; + this._sName = null; + this._scUi = null; + this._uiDef = null; + } + + public function postInit(param1:UiRootContainer) : void + { + this._scUi = param1; + } + + public function makeChilds(param1:Array, param2:GraphicContainer, param3:Boolean = false) : void + { + var ie:InstanceEvent = null; + var ge:GraphicElement = null; + var gc:GraphicContainer = null; + var be:BasicElement = null; + var aa:Array = null; + var j:int = 0; + var lastChild:String = null; + var i:int = 0; + var anchorsList:Array = null; + var stateContainer:StateContainerElement = null; + var stateData:Array = null; + var cpt:Array = null; + var prop:String = null; + var gridElem:ContainerElement = null; + var container:ContainerElement = null; + var component:ComponentElement = null; + var num:int = 0; + var anc:GraphicLocation = null; + var aChild:Array = param1; + var gcContainer:GraphicContainer = param2; + var preprocessLocation:Boolean = param3; + var aChildLength:int = aChild.length; + i = 0; + while(i < aChildLength) + { + try { - this._nTimeStamp = getTimer(); - }; - if (scUi.parent) + be = aChild[i]; + } + catch(e:Error) { - scUi.tempHolder = new Sprite(); - scUi.parent.addChildAt(scUi.tempHolder, scUi.parent.getChildIndex(scUi)); - scUi.parent.removeChild(scUi); - }; - if (!(uiDef)) + _log.error("Render error in " + _sName + " with " + (gcContainer?gcContainer.name:"Unknow") + ", elem " + (aChild[i]?aChild[i].name:"Unknow")); + i++; + continue; + } + if(be is StateContainerElement || be is ButtonElement) { - _log.error((("Cannot render " + sName) + " : no UI definition")); - dispatchEvent(new UiRenderEvent(Event.COMPLETE, false, false, this._scUi, this)); - return; - }; - this._oProperties = oProperties; - this._sName = sName; - this._scUi = scUi; - this._uiDef = uiDef; - this._uiDef.name = sName; - this._aFilnalizedLater = new Array(); - if (this._uiDef.scalable) + if(be is ButtonElement) + { + stateContainer = ButtonElement(be); + } + else + { + stateContainer = StateContainerElement(be); + } + gc = gcContainer.getStrata(stateContainer.strata).addChild(this.makeContainer(stateContainer)) as StateContainer; + for each(stateData in stateContainer.stateChangingProperties) + { + for each(cpt in stateData) + { + for(prop in cpt) + { + cpt[prop] = LangManager.getInstance().replaceKey(cpt[prop]); + } + } + } + StateContainer(gc).changingStateData = stateContainer.stateChangingProperties; + this.makeChilds(stateContainer.childs,gc,preprocessLocation); + } + else if(be is GridElement) { - scUi.scaleX = Berilia.getInstance().scale; - scUi.scaleY = Berilia.getInstance().scale; - }; - this._scUi.scalable = this._uiDef.scalable; - var constants:Array = []; - for (constKey in this._uiDef.constants) + gridElem = ContainerElement(be); + gc = gcContainer.getStrata(gridElem.strata).addChild(this.makeContainer(gridElem)) as GraphicContainer; + } + else if(be is ContainerElement) { - constants[constKey] = LangManager.getInstance().replaceKey(this._uiDef.constants[constKey]); - }; - this._scUi.constants = constants; - this._scUi.disableRender = true; - this.makeScript(); - if (this._uiDef.modal) + container = ContainerElement(be); + gc = gcContainer.getStrata(container.strata).addChild(this.makeContainer(container)) as GraphicContainer; + if(container.name == "__modalContainer") + { + this._scUi.modalContainer = gc; + } + this.makeChilds(container.childs,gc,preprocessLocation); + } + else if(be is ComponentElement) { - this.makeModalContainer(); - }; - scUi.giveFocus = this._uiDef.giveFocus; - scUi.transmitFocus = this._uiDef.transmitFocus; - this.makeChilds(uiDef.graphicTree, scUi); - this.makeShortcuts(); - this.fillUiScriptVar(); - if (this._scUi.uiClass) + component = ComponentElement(be); + gc = gcContainer.getStrata(component.strata).addChild(this.makeComponent(component)) as GraphicContainer; + } + + + + aa = null; + anchorsList = be.anchors; + if(anchorsList) { - this._scUi.properties = this._oProperties; - }; - this._scUi.disableRender = false; - scUi.render(); - if ((((scUi.strata == StrataEnum.STRATA_MEDIUM)) && (scUi.giveFocus))) + aa = new Array(); + num = anchorsList.length; + j = 0; + while(j < num) + { + aa.push(LocationELement(anchorsList[j]).toGraphicLocation()); + j++; + } + } + ge = new GraphicElement(gc,aa,be.name); + if(!be.name) { - Berilia.getInstance().giveFocus(scUi); - }; - this.finalizeContainer(); - this.buildTime = (getTimer() - this._nTimeStamp); - this.scriptTime = getTimer(); - this.scriptTime = (getTimer() - this.scriptTime); - scUi.iAmFinalized(null); - if (!(this._isXmlRender)) + be.name = "elem_" + BasicElement.ID++; + } + ge.name = be.name; + this._scUi.registerId(be.name,ge); + if(be.anchors) { - this.parsingTime = 0; - }; - dispatchEvent(new UiRenderEvent(Event.COMPLETE, false, false, this._scUi, this)); - this._oProperties = null; - this._sName = null; - this._scUi = null; - this._uiDef = null; - } - - public function postInit(ui:UiRootContainer):void - { - this._scUi = ui; - } - - public function makeChilds(aChild:Array, gcContainer:GraphicContainer, preprocessLocation:Boolean=false):void - { - var ie:InstanceEvent; - var ge:GraphicElement; - var gc:GraphicContainer; - var be:BasicElement; - var aa:Array; - var j:int; - var lastChild:String; - var i:int; - var anchorsList:Array; - var stateContainer:StateContainerElement; - var stateData:Array; - var cpt:Array; - var prop:String; - var gridElem:ContainerElement; - var container:ContainerElement; - var component:ComponentElement; - var num:int; - var anc:GraphicLocation; - var aChildLength:int = aChild.length; - i = 0; - for (;i < aChildLength;(i = (i + 1))) + for each(anc in ge.locations) + { + if(anc.getRelativeTo() == GraphicLocation.REF_LAST) + { + if(lastChild) + { + anc.setRelativeTo(lastChild); + } + else + { + anc.setRelativeTo(GraphicLocation.REF_PARENT); + anc.setRelativePoint("TOPLEFT"); + } + } + } + this._scUi.addDynamicElement(ge); + } + else { - try - { - be = aChild[i]; - } - catch(e:Error) - { - _log.error(((((("Render error in " + _sName) + " with ") + ((gcContainer) ? gcContainer.name : "Unknow")) + ", elem ") + ((aChild[i]) ? aChild[i].name : "Unknow"))); - continue; - }; - if ((((be is StateContainerElement)) || ((be is ButtonElement)))) - { - if ((be is ButtonElement)) - { - stateContainer = ButtonElement(be); - } - else - { - stateContainer = StateContainerElement(be); - }; - gc = (gcContainer.getStrata(stateContainer.strata).addChild(this.makeContainer(stateContainer)) as StateContainer); - for each (stateData in stateContainer.stateChangingProperties) - { - for each (cpt in stateData) - { - for (prop in cpt) - { - cpt[prop] = LangManager.getInstance().replaceKey(cpt[prop]); - }; - }; - }; - StateContainer(gc).changingStateData = stateContainer.stateChangingProperties; - this.makeChilds(stateContainer.childs, gc, preprocessLocation); - } - else - { - if ((be is GridElement)) - { - gridElem = ContainerElement(be); - gc = (gcContainer.getStrata(gridElem.strata).addChild(this.makeContainer(gridElem)) as GraphicContainer); - } - else - { - if ((be is ContainerElement)) - { - container = ContainerElement(be); - gc = (gcContainer.getStrata(container.strata).addChild(this.makeContainer(container)) as GraphicContainer); - if (container.name == "__modalContainer") - { - this._scUi.modalContainer = gc; - }; - this.makeChilds(container.childs, gc, preprocessLocation); - } - else - { - if ((be is ComponentElement)) - { - component = ComponentElement(be); - gc = (gcContainer.getStrata(component.strata).addChild(this.makeComponent(component)) as GraphicContainer); - }; - }; - }; - }; - aa = null; - anchorsList = be.anchors; - if (anchorsList) - { - aa = new Array(); - num = anchorsList.length; - j = 0; - while (j < num) - { - aa.push(LocationELement(anchorsList[j]).toGraphicLocation()); - j = (j + 1); - }; - }; - ge = new GraphicElement(gc, aa, be.name); - if (!(be.name)) - { - be.name = ("elem_" + BasicElement.ID++); - }; - ge.name = be.name; - this._scUi.registerId(be.name, ge); - if (be.anchors) - { - for each (anc in ge.locations) - { - if (anc.getRelativeTo() == GraphicLocation.REF_LAST) - { - if (lastChild) - { - anc.setRelativeTo(lastChild); - } - else - { - anc.setRelativeTo(GraphicLocation.REF_PARENT); - anc.setRelativePoint("TOPLEFT"); - }; - }; - }; - this._scUi.addDynamicElement(ge); - } - else - { - gc.x = 0; - gc.y = 0; - }; - lastChild = be.name; - if (be.size) - { - if ((((((be.size.xUnit == GraphicSize.SIZE_PRC)) && (!(isNaN(be.size.x))))) || ((((be.size.yUnit == GraphicSize.SIZE_PRC)) && (!(isNaN(be.size.y))))))) - { - ge.size = be.size.toGraphicSize(); - this._scUi.addDynamicSizeElement(ge); - }; - if ((((be.size.xUnit == GraphicSize.SIZE_PIXEL)) && (!(isNaN(be.size.x))))) - { - gc.width = be.size.x; - }; - if ((((be.size.yUnit == GraphicSize.SIZE_PIXEL)) && (!(isNaN(be.size.y))))) - { - gc.height = be.size.y; - }; - }; - if (be.minSize) - { - gc.minSize = be.minSize.toGraphicSize(); - }; - if (be.maxSize) - { - gc.maxSize = be.maxSize.toGraphicSize(); - }; - if (be.event.length) - { - SecureCenter.secure(gc, this._scUi.uiModule.trusted); - ie = new InstanceEvent(gc, this._scUi.uiClass); - j = 0; - while (j < be.event.length) - { - ie.events[be.event[j]] = be.event[j]; - j = (j + 1); - }; - UIEventManager.getInstance().registerInstance(ie); - }; - if (be.properties["bgColor"] != null) - { - gc.bgColor = parseInt(LangManager.getInstance().replaceKey(be.properties["bgColor"])); - } - else - { - if (((this._uiDef) && (this._uiDef.debug))) - { - gc.bgColor = Math.round((Math.random() * 0xFFFFFF)); - }; - }; - if ((((gc is Grid)) || ((gc is ComboBox)))) - { - this.makeChilds(Object(gc).renderModificator(Object(be).childs, SecureCenter.ACCESS_KEY), gc, preprocessLocation); - }; - if ((gc is FinalizableUIComponent)) - { - this._scUi.addFinalizeElement((gc as FinalizableUIComponent)); - if (((((be.size) && ((((be.size.xUnit == GraphicSize.SIZE_PRC)) || ((be.size.yUnit == GraphicSize.SIZE_PRC)))))) || (((be.anchors) && ((be.anchors.length == 2)))))) - { - this._aFilnalizedLater.push(gc); - } - else - { - var _local_5 = gc; - (_local_5["finalize"]()); - }; - }; - if (preprocessLocation) - { - this._scUi.processLocation(ge); - }; - }; - } - - private function makeContainer(ce:ContainerElement):Sprite - { - var container:GraphicContainer; - var sProperty:String; - switch (true) + gc.x = 0; + gc.y = 0; + } + lastChild = be.name; + if(be.size) { - case (ce is ButtonElement): - container = new ButtonContainer(); - break; - case (ce is StateContainerElement): - container = new StateContainer(); - break; - case (ce is ScrollContainerElement): - container = new ScrollContainer(); - this._scUi.addPostFinalizeComponent((container as FinalizableUIComponent)); - break; - case (ce is GridElement): - container = new ((getDefinitionByName(ce.className) as Class))(); - break; - case (ce is ContainerElement): - container = new GraphicContainer(); - break; - }; - for (sProperty in ce.properties) + if(be.size.xUnit == GraphicSize.SIZE_PRC && !isNaN(be.size.x) || be.size.yUnit == GraphicSize.SIZE_PRC && !isNaN(be.size.y)) + { + ge.size = be.size.toGraphicSize(); + this._scUi.addDynamicSizeElement(ge); + } + if(be.size.xUnit == GraphicSize.SIZE_PIXEL && !isNaN(be.size.x)) + { + gc.width = be.size.x; + } + if(be.size.yUnit == GraphicSize.SIZE_PIXEL && !isNaN(be.size.y)) + { + gc.height = be.size.y; + } + } + if(be.minSize) { - if ((ce.properties[sProperty] is String)) - { - container[sProperty] = LangManager.getInstance().replaceKey(ce.properties[sProperty]); - } - else - { - container[sProperty] = ce.properties[sProperty]; - }; - }; - InternalComponentAccess.setProperty(container, "_uiRootContainer", this._scUi); - return ((container as Sprite)); - } - - private function makeComponent(ce:ComponentElement):Sprite - { - var uiComponent:UIComponent; - var sProperty:String; - var cComponent:Class = (getDefinitionByName(ce.className) as Class); - uiComponent = (new (cComponent)() as UIComponent); - InternalComponentAccess.setProperty(uiComponent, "_uiRootContainer", this._scUi); - for (sProperty in ce.properties) + gc.minSize = be.minSize.toGraphicSize(); + } + if(be.maxSize) { - if ((ce.properties[sProperty] is String)) - { - uiComponent[sProperty] = LangManager.getInstance().replaceKey(ce.properties[sProperty]); - } - else - { - uiComponent[sProperty] = ce.properties[sProperty]; - }; - }; - return ((uiComponent as Sprite)); - } - - private function makeScript():void - { - if (this._scriptClass) + gc.maxSize = be.maxSize.toGraphicSize(); + } + if(be.event.length) { - this._scUi.uiClass = new (this._scriptClass)(); - ApiBinder.addApiData("currentUi", this._scUi); - ApiBinder.initApi(this._scUi.uiClass, this._scUi.uiModule, UiModuleManager.getInstance().sharedDefinition); - this._xmlClassDef = DescribeTypeCache.typeDescription(this._scUi.uiClass); + SecureCenter.secure(gc,this._scUi.uiModule.trusted); + ie = new InstanceEvent(gc,this._scUi.uiClass); + j = 0; + while(j < be.event.length) + { + ie.events[be.event[j]] = be.event[j]; + j++; + } + UIEventManager.getInstance().registerInstance(ie); } - else + if(be.properties["bgColor"] != null) { - _log.warn(((("[Warning] " + this._scriptClass) + " wasn't found for ") + this._scUi.name)); - }; - } - - private function fillUiScriptVar():void - { - var sVariable:String; - var xmlVar:XMLList; - var variable:XML; - var i:String; - var st:String; - if (!(this._xmlClassDef)) + gc.bgColor = parseInt(LangManager.getInstance().replaceKey(be.properties["bgColor"])); + } + else if((this._uiDef) && (this._uiDef.debug)) { - return; - }; - this._xmlClassDef = DescribeTypeCache.typeDescription(this._scUi.uiClass); - var variables:Array = new Array(); - for each (variable in this._xmlClassDef..variable) + gc.bgColor = Math.round(Math.random() * 16777215); + } + + if(gc is Grid || gc is ComboBox) { - variables[variable.@name.toString()] = true; - }; - for (i in this._scUi.getElements()) + this.makeChilds(Object(gc).renderModificator(Object(be).childs,SecureCenter.ACCESS_KEY),gc,preprocessLocation); + } + if(gc is FinalizableUIComponent) + { + this._scUi.addFinalizeElement(gc as FinalizableUIComponent); + if((be.size) && (be.size.xUnit == GraphicSize.SIZE_PRC || be.size.yUnit == GraphicSize.SIZE_PRC) || (be.anchors) && (be.anchors.length == 2)) + { + this._aFilnalizedLater.push(gc); + } + else + { + gc["finalize"](); + } + } + if(preprocessLocation) + { + this._scUi.processLocation(ge); + } + i++; + } + } + + private function makeContainer(param1:ContainerElement) : Sprite + { + var _loc2_:GraphicContainer = null; + var _loc3_:String = null; + switch(true) + { + case param1 is ButtonElement: + _loc2_ = new ButtonContainer(); + break; + case param1 is StateContainerElement: + _loc2_ = new StateContainer(); + break; + case param1 is ScrollContainerElement: + _loc2_ = new ScrollContainer(); + this._scUi.addPostFinalizeComponent(_loc2_ as FinalizableUIComponent); + break; + case param1 is GridElement: + _loc2_ = new (getDefinitionByName(param1.className) as Class)(); + break; + case param1 is ContainerElement: + _loc2_ = new GraphicContainer(); + break; + } + for(_loc3_ in param1.properties) + { + if(param1.properties[_loc3_] is String) + { + _loc2_[_loc3_] = LangManager.getInstance().replaceKey(param1.properties[_loc3_]); + } + else + { + _loc2_[_loc3_] = param1.properties[_loc3_]; + } + } + InternalComponentAccess.setProperty(_loc2_,"_uiRootContainer",this._scUi); + return _loc2_ as Sprite; + } + + private function makeComponent(param1:ComponentElement) : Sprite + { + var _loc3_:UIComponent = null; + var _loc4_:String = null; + var _loc2_:Class = getDefinitionByName(param1.className) as Class; + _loc3_ = new _loc2_() as UIComponent; + InternalComponentAccess.setProperty(_loc3_,"_uiRootContainer",this._scUi); + for(_loc4_ in param1.properties) + { + if(param1.properties[_loc4_] is String) { - sVariable = this._scUi.getElements()[i].name; - if (variables[sVariable]) - { - try - { - this._scUi.uiClass[sVariable] = SecureCenter.secure(this._scUi.getElements()[i], this._scUi.uiModule.trusted); - } - catch(e:Error) - { - if (e.getStackTrace()) - { - st = e.getStackTrace(); - } - else - { - st = "no stack trace available"; - }; - _log.error(((((sVariable + "in ") + _scUi.name) + " cannot be set (wrong type) ") + st)); - }; - }; - }; - } - - private function makeShortcuts():void - { - var sShortcutName:String; - var listener:GenericListener; + _loc3_[_loc4_] = LangManager.getInstance().replaceKey(param1.properties[_loc4_]); + } + else + { + _loc3_[_loc4_] = param1.properties[_loc4_]; + } + } + return _loc3_ as Sprite; + } + + private function makeScript() : void + { + if(this._scriptClass) + { + this._scUi.uiClass = new this._scriptClass(); + ApiBinder.addApiData("currentUi",this._scUi); + ApiBinder.initApi(this._scUi.uiClass,this._scUi.uiModule,UiModuleManager.getInstance().sharedDefinition); + this._xmlClassDef = DescribeTypeCache.typeDescription(this._scUi.uiClass); + } + else + { + _log.warn("[Warning] " + this._scriptClass + " wasn\'t found for " + this._scUi.name); + } + } + + private function fillUiScriptVar() : void + { + var sVariable:String = null; + var xmlVar:XMLList = null; + var variable:XML = null; + var i:String = null; + var st:String = null; + if(!this._xmlClassDef) + { return; - } - - private function finalizeContainer():void - { - var i:uint; - while (i < this._aFilnalizedLater.length) + } + this._xmlClassDef = DescribeTypeCache.typeDescription(this._scUi.uiClass); + var variables:Array = new Array(); + for each(variable in this._xmlClassDef..variable) + { + variables[variable.@name.toString()] = true; + } + for(i in this._scUi.getElements()) + { + sVariable = this._scUi.getElements()[i].name; + if(variables[sVariable]) { - this._aFilnalizedLater[i].finalize(); - i++; - }; - this._aFilnalizedLater = new Array(); - } - - private function makeModalContainer():void - { - var fct:Function; - var listener:GenericListener; - if (this._scUi.uiClass != null) + try + { + this._scUi.uiClass[sVariable] = SecureCenter.secure(this._scUi.getElements()[i],this._scUi.uiModule.trusted); + } + catch(e:Error) + { + if(e.getStackTrace()) + { + st = e.getStackTrace(); + } + else + { + st = "no stack trace available"; + } + _log.error(sVariable + "in " + _scUi.name + " cannot be set (wrong type) " + st); + continue; + } + } + } + } + + private function makeShortcuts() : void + { + var _loc1_:String = null; + var _loc2_:GenericListener = null; + } + + private function finalizeContainer() : void + { + var _loc1_:uint = 0; + while(_loc1_ < this._aFilnalizedLater.length) + { + this._aFilnalizedLater[_loc1_].finalize(); + _loc1_++; + } + this._aFilnalizedLater = new Array(); + } + + private function makeModalContainer() : void + { + var fct:Function = null; + var listener:GenericListener = null; + if(this._scUi.uiClass != null) + { + if(this._scUi.uiClass.hasOwnProperty("onShortcut")) { - if (this._scUi.uiClass.hasOwnProperty("onShortcut")) - { - fct = this._scUi.uiClass["onShortcut"]; - } - else - { - fct = function (... args):Boolean - { - return (true); - }; - }; - listener = new GenericListener("ALL", this._scUi.name, fct, this._scUi.depth, GenericListener.LISTENER_TYPE_UI, new WeakReference(this._scUi)); - BindsManager.getInstance().registerEvent(listener); - }; - this._scUi.modal = true; - if (((this._uiDef.graphicTree) && ((this._uiDef.graphicTree[0].name == "__modalContainer")))) + fct = this._scUi.uiClass["onShortcut"]; + } + else { - return; - }; - var modalContainer:ContainerElement = new ContainerElement(); - var size:GraphicSize = new GraphicSize(); - size.setX(1, GraphicSize.SIZE_PRC); - size.setY(1, GraphicSize.SIZE_PRC); - modalContainer.name = "__modalContainer"; - modalContainer.size = size.toSizeElement(); - modalContainer.properties["alpha"] = 0.3; - modalContainer.properties["bgColor"] = 0; - modalContainer.properties["mouseEnabled"] = true; - modalContainer.strata = StrataEnum.STRATA_LOW; - this._uiDef.graphicTree.unshift(modalContainer); - } - - private function onParseComplete(e:ParsorEvent):void - { - this.parsingTime = (getTimer() - this._nTimeStamp); - this._nTimeStamp = (this.parsingTime + this._nTimeStamp); - this._xpParser.removeEventListener(Event.COMPLETE, this.onParseComplete); - PoolsManager.getInstance().getXmlParsorPool().checkIn(this._xpParser); - this.uiRender(e.uiDefinition, this._sName, this._scUi, this._oProperties); - this._isXmlRender = false; - } - - - } -}//package com.ankamagames.berilia.uiRender - + fct = function(... rest):Boolean + { + return true; + }; + } + listener = new GenericListener("ALL",this._scUi.name,fct,this._scUi.depth,GenericListener.LISTENER_TYPE_UI,new WeakReference(this._scUi)); + BindsManager.getInstance().registerEvent(listener); + } + this._scUi.modal = true; + if((this._uiDef.graphicTree) && this._uiDef.graphicTree[0].name == "__modalContainer") + { + return; + } + var modalContainer:ContainerElement = new ContainerElement(); + var size:GraphicSize = new GraphicSize(); + size.setX(1,GraphicSize.SIZE_PRC); + size.setY(1,GraphicSize.SIZE_PRC); + modalContainer.name = "__modalContainer"; + modalContainer.size = size.toSizeElement(); + modalContainer.properties["alpha"] = 0.3; + modalContainer.properties["bgColor"] = 0; + modalContainer.properties["mouseEnabled"] = true; + modalContainer.strata = StrataEnum.STRATA_LOW; + this._uiDef.graphicTree.unshift(modalContainer); + } + + private function onParseComplete(param1:ParsorEvent) : void + { + this.parsingTime = getTimer() - this._nTimeStamp; + this._nTimeStamp = this.parsingTime + this._nTimeStamp; + this._xpParser.removeEventListener(Event.COMPLETE,this.onParseComplete); + PoolsManager.getInstance().getXmlParsorPool().checkIn(this._xpParser); + this.uiRender(param1.uiDefinition,this._sName,this._scUi,this._oProperties); + this._isXmlRender = false; + } + } +} diff --git a/com/ankamagames/berilia/uiRender/XmlParsor.as b/com/ankamagames/berilia/uiRender/XmlParsor.as index 078724977..50596d5f4 100644 --- a/com/ankamagames/berilia/uiRender/XmlParsor.as +++ b/com/ankamagames/berilia/uiRender/XmlParsor.as @@ -1,1174 +1,1169 @@ -package com.ankamagames.berilia.uiRender +package com.ankamagames.berilia.uiRender { - import flash.events.EventDispatcher; - import com.ankamagames.berilia.utils.ComponentList; - import com.ankamagames.berilia.utils.GridItemList; - import com.ankamagames.jerakine.logger.Logger; - import com.ankamagames.jerakine.logger.Log; - import flash.utils.getQualifiedClassName; - import flash.xml.XMLDocument; - import com.ankamagames.jerakine.resources.loaders.IResourceLoader; - import com.ankamagames.jerakine.resources.loaders.ResourceLoaderFactory; - import com.ankamagames.jerakine.resources.loaders.ResourceLoaderType; - import com.ankamagames.jerakine.utils.misc.DescribeTypeCache; - import com.ankamagames.jerakine.resources.events.ResourceLoadedEvent; - import com.ankamagames.jerakine.resources.events.ResourceErrorEvent; - import com.ankamagames.jerakine.types.Uri; - import com.ankamagames.berilia.types.event.ParsorEvent; - import com.ankamagames.berilia.types.event.PreProcessEndEvent; - import flash.xml.XMLNode; - import com.ankamagames.berilia.types.uiDefinition.UiDefinition; - import com.ankamagames.berilia.enums.XmlAttributesEnum; - import com.ankamagames.berilia.enums.XmlTagsEnum; - import com.ankamagames.jerakine.managers.LangManager; - import com.ankamagames.berilia.types.uiDefinition.ContainerElement; - import com.ankamagames.berilia.types.graphic.GraphicContainer; - import com.ankamagames.berilia.types.uiDefinition.ScrollContainerElement; - import com.ankamagames.berilia.types.graphic.ScrollContainer; - import com.ankamagames.berilia.types.uiDefinition.GridElement; - import com.ankamagames.berilia.components.Grid; - import com.ankamagames.berilia.components.ComboBox; - import com.ankamagames.berilia.components.InputComboBox; - import com.ankamagames.berilia.components.Tree; - import com.ankamagames.berilia.types.uiDefinition.StateContainerElement; - import com.ankamagames.berilia.types.graphic.StateContainer; - import com.ankamagames.berilia.types.uiDefinition.ButtonElement; - import com.ankamagames.berilia.types.graphic.ButtonContainer; - import com.ankamagames.berilia.types.uiDefinition.ComponentElement; - import flash.utils.getDefinitionByName; - import flash.system.ApplicationDomain; - import com.ankamagames.berilia.types.uiDefinition.BasicElement; - import com.ankamagames.berilia.enums.StatesEnum; - import com.ankamagames.berilia.types.graphic.GraphicSize; - import com.ankamagames.berilia.types.graphic.GraphicLocation; - import com.ankamagames.berilia.enums.LocationTypeEnum; - import com.ankamagames.berilia.managers.BindsManager; - import com.ankamagames.berilia.enums.EventEnums; - import com.ankamagames.berilia.enums.StrataEnum; - import com.ankamagames.jerakine.utils.misc.Levenshtein; - import flash.events.Event; - import com.ankamagames.berilia.types.event.ParsingErrorEvent; - - public class XmlParsor extends EventDispatcher - { - - private static var _classDescCache:Object = new Object(); - - protected const _componentList:ComponentList = null; - protected const _GridItemList:GridItemList = null; - protected const _log:Logger = Log.getLogger(getQualifiedClassName(XmlParsor)); - - private var _xmlDoc:XMLDocument; - private var _sUrl:String; - protected var _aName:Array; - private var _loader:IResourceLoader; - private var _describeType:Function; - public var rootPath:String; - - public function XmlParsor() - { - this._loader = ResourceLoaderFactory.getLoader(ResourceLoaderType.PARALLEL_LOADER); - this._describeType = DescribeTypeCache.typeDescription; - super(); - this._loader.addEventListener(ResourceLoadedEvent.LOADED, this.onXmlLoadComplete); - this._loader.addEventListener(ResourceErrorEvent.ERROR, this.onXmlLoadError); - } - - public function get url():String - { - return (this._sUrl); - } - - public function get xmlDocString():String - { - return (((this._xmlDoc) ? this._xmlDoc.toString() : null)); - } - - public function processFile(sUrl:String):void - { - this._sUrl = sUrl; - this._loader.load(new Uri(this._sUrl)); - } - - public function processXml(sXml:String):void - { - var errorLog:String; - var i:uint; - var regOpenTagAdv:RegExp; - var regOpenTag:RegExp; - var tmp:Array; - var openTag:Array; - var tag:String; - var regCloseTag:RegExp; - var closeTag:Array; - this._xmlDoc = new XMLDocument(); - this._xmlDoc.ignoreWhite = true; - try + import flash.events.EventDispatcher; + import com.ankamagames.berilia.utils.ComponentList; + import com.ankamagames.berilia.utils.GridItemList; + import com.ankamagames.jerakine.logger.Logger; + import flash.xml.XMLDocument; + import com.ankamagames.jerakine.resources.loaders.IResourceLoader; + import com.ankamagames.jerakine.types.Uri; + import com.ankamagames.berilia.types.event.ParsorEvent; + import com.ankamagames.berilia.types.event.PreProcessEndEvent; + import com.ankamagames.berilia.types.uiDefinition.UiDefinition; + import flash.xml.XMLNode; + import com.ankamagames.berilia.enums.XmlAttributesEnum; + import com.ankamagames.berilia.enums.XmlTagsEnum; + import com.ankamagames.jerakine.managers.LangManager; + import com.ankamagames.berilia.types.uiDefinition.BasicElement; + import com.ankamagames.berilia.types.uiDefinition.ContainerElement; + import flash.utils.getQualifiedClassName; + import com.ankamagames.berilia.types.graphic.GraphicContainer; + import com.ankamagames.berilia.types.uiDefinition.ScrollContainerElement; + import com.ankamagames.berilia.types.graphic.ScrollContainer; + import com.ankamagames.berilia.types.uiDefinition.GridElement; + import com.ankamagames.berilia.components.Grid; + import com.ankamagames.berilia.components.ComboBox; + import com.ankamagames.berilia.components.InputComboBox; + import com.ankamagames.berilia.components.Tree; + import com.ankamagames.berilia.types.uiDefinition.StateContainerElement; + import com.ankamagames.berilia.types.graphic.StateContainer; + import com.ankamagames.berilia.types.uiDefinition.ButtonElement; + import com.ankamagames.berilia.types.graphic.ButtonContainer; + import com.ankamagames.berilia.types.uiDefinition.ComponentElement; + import flash.utils.getDefinitionByName; + import flash.system.ApplicationDomain; + import com.ankamagames.berilia.enums.StatesEnum; + import com.ankamagames.berilia.types.graphic.GraphicSize; + import com.ankamagames.berilia.types.graphic.GraphicLocation; + import com.ankamagames.berilia.enums.LocationTypeEnum; + import com.ankamagames.berilia.managers.BindsManager; + import com.ankamagames.berilia.enums.EventEnums; + import com.ankamagames.berilia.enums.StrataEnum; + import com.ankamagames.jerakine.utils.misc.Levenshtein; + import flash.events.Event; + import com.ankamagames.jerakine.resources.events.ResourceLoadedEvent; + import com.ankamagames.jerakine.resources.events.ResourceErrorEvent; + import com.ankamagames.berilia.types.event.ParsingErrorEvent; + import com.ankamagames.jerakine.logger.Log; + import com.ankamagames.jerakine.resources.loaders.ResourceLoaderFactory; + import com.ankamagames.jerakine.resources.loaders.ResourceLoaderType; + import com.ankamagames.jerakine.utils.misc.DescribeTypeCache; + + public class XmlParsor extends EventDispatcher + { + + public function XmlParsor() + { + this._loader = ResourceLoaderFactory.getLoader(ResourceLoaderType.PARALLEL_LOADER); + this._describeType = DescribeTypeCache.typeDescription; + super(); + this._loader.addEventListener(ResourceLoadedEvent.LOADED,this.onXmlLoadComplete); + this._loader.addEventListener(ResourceErrorEvent.ERROR,this.onXmlLoadError); + } + + private static var _classDescCache:Object = new Object(); + + protected const _componentList:ComponentList = null; + + protected const _GridItemList:GridItemList = null; + + protected const _log:Logger = Log.getLogger(getQualifiedClassName(XmlParsor)); + + private var _xmlDoc:XMLDocument; + + private var _sUrl:String; + + protected var _aName:Array; + + private var _loader:IResourceLoader; + + private var _describeType:Function; + + public var rootPath:String; + + public function get url() : String + { + return this._sUrl; + } + + public function get xmlDocString() : String + { + return this._xmlDoc?this._xmlDoc.toString():null; + } + + public function processFile(param1:String) : void + { + this._sUrl = param1; + this._loader.load(new Uri(this._sUrl)); + } + + public function processXml(param1:String) : void + { + var errorLog:String = null; + var i:uint = 0; + var regOpenTagAdv:RegExp = null; + var regOpenTag:RegExp = null; + var tmp:Array = null; + var openTag:Array = null; + var tag:String = null; + var regCloseTag:RegExp = null; + var closeTag:Array = null; + var sXml:String = param1; + this._xmlDoc = new XMLDocument(); + this._xmlDoc.ignoreWhite = true; + try + { + this._xmlDoc.parseXML(sXml.toString()); + } + catch(e:Error) + { + if(sXml) { - this._xmlDoc.parseXML(sXml.toString()); + regOpenTagAdv = new RegExp("<\\w+[^>]*","g"); + regOpenTag = new RegExp("<\\w+","g"); + tmp = sXml.match(regOpenTagAdv); + openTag = new Array(); + i = 0; + while(i < tmp.length) + { + if(tmp[i].substr(tmp[i].length - 1) != "/") + { + tag = tmp[i].match(regOpenTag)[0]; + if(!openTag[tag]) + { + openTag[tag] = 0; + } + openTag[tag]++; + } + i++; + } + regCloseTag = new RegExp("<\\/\\w+","g"); + tmp = sXml.match(regCloseTag); + closeTag = new Array(); + i = 0; + while(i < tmp.length) + { + tag = "<" + tmp[i].substr(2); + if(!closeTag[tag]) + { + closeTag[tag] = 0; + } + closeTag[tag]++; + i++; + } } - catch(e:Error) + errorLog = ""; + for(tag in openTag) { - if (sXml) - { - regOpenTagAdv = /<\w+[^>]*/g; - regOpenTag = /<\w+/g; - tmp = sXml.match(regOpenTagAdv); - openTag = new Array(); - i = 0; - while (i < tmp.length) - { - if (tmp[i].substr((tmp[i].length - 1)) != "/") - { - tag = tmp[i].match(regOpenTag)[0]; - if (!(openTag[tag])) - { - openTag[tag] = 0; - }; - var _local_4 = openTag; - var _local_5 = tag; - var _local_6 = (_local_4[_local_5] + 1); - _local_4[_local_5] = _local_6; - }; - i++; - }; - regCloseTag = /<\/\w+/g; - tmp = sXml.match(regCloseTag); - closeTag = new Array(); - i = 0; - while (i < tmp.length) - { - tag = ("<" + tmp[i].substr(2)); - if (!(closeTag[tag])) - { - closeTag[tag] = 0; - }; - _local_4 = closeTag; - _local_5 = tag; - _local_6 = (_local_4[_local_5] + 1); - _local_4[_local_5] = _local_6; - i++; - }; - }; - errorLog = ""; - for (tag in openTag) - { - if (((!(closeTag[tag])) || (!((closeTag[tag] == openTag[tag]))))) - { - errorLog = (errorLog + (("\n - " + tag) + " have no closing tag")); - }; - }; - for (tag in closeTag) - { - if (((!(openTag[tag])) || (!((openTag[tag] == closeTag[tag]))))) - { - errorLog = (errorLog + (("\n - is lonely closing tag")); - }; - }; - _log.error(((("Error when parsing " + _sUrl) + ", misformatted xml") + ((errorLog.length) ? (" : " + errorLog) : ""))); - dispatchEvent(new ParsorEvent(null, true)); - }; - this._aName = new Array(); - this.preProccessXml(); - } - - private function preProccessXml():void - { - var tmp:XmlPreProcessor = new XmlPreProcessor(this._xmlDoc); - tmp.addEventListener(PreProcessEndEvent.PRE_PROCESS_END, this.onPreProcessCompleted); - tmp.processTemplate(); - } - - private function mainProcess():void - { - if (((this._xmlDoc) && (this._xmlDoc.firstChild))) - { - dispatchEvent(new ParsorEvent(this.parseMainNode(this._xmlDoc.firstChild), false)); + if(!closeTag[tag] || !(closeTag[tag] == openTag[tag])) + { + errorLog = errorLog + ("\n - " + tag + " have no closing tag"); + } } - else - { - dispatchEvent(new ParsorEvent(null, true)); - }; - } - - protected function parseMainNode(mainNodes:XMLNode):UiDefinition - { - var xnNode:XMLNode; - var i:int; - var ui:UiDefinition = new UiDefinition(); - var aNodes:Array = mainNodes.childNodes; - if (!(aNodes.length)) - { - return (null); - }; - var mainNodesAttributes:Object = mainNodes.attributes; - var attributesDebug:String = mainNodesAttributes[XmlAttributesEnum.ATTRIBUTE_DEBUG]; - var attributesUseCache:String = mainNodesAttributes[XmlAttributesEnum.ATTRIBUTE_USECACHE]; - var attributesUsePropertiesCache:String = mainNodesAttributes[XmlAttributesEnum.ATTRIBUTE_USEPROPERTIESCACHE]; - var attributesModal:String = mainNodesAttributes[XmlAttributesEnum.ATTRIBUTE_MODAL]; - var attributesScalable:String = mainNodesAttributes[XmlAttributesEnum.ATTRIBUTE_SCALABLE]; - var attributesFocus:String = mainNodesAttributes[XmlAttributesEnum.ATTRIBUTE_FOCUS]; - var attributesTransmitFocus:String = mainNodesAttributes[XmlAttributesEnum.ATTRIBUTE_TRANSMITFOCUS]; - if (attributesDebug) - { - ui.debug = (attributesDebug == "true"); - }; - if (attributesUseCache) + for(tag in closeTag) { - ui.useCache = (attributesUseCache == "true"); - }; - if (attributesUsePropertiesCache) - { - ui.usePropertiesCache = (attributesUsePropertiesCache == "true"); - }; - if (attributesModal) - { - ui.modal = (attributesModal == "true"); - }; - if (attributesScalable) - { - ui.scalable = (attributesScalable == "true"); - }; - if (attributesFocus) - { - ui.giveFocus = (attributesFocus == "true"); - }; - if (attributesTransmitFocus) - { - ui.transmitFocus = (attributesTransmitFocus == "true"); - }; - var numNodes:int = aNodes.length; - i = 0; - while (i < numNodes) + if(!openTag[tag] || !(openTag[tag] == closeTag[tag])) + { + errorLog = errorLog + ("\n - is lonely closing tag"); + } + } + _log.error("Error when parsing " + _sUrl + ", misformatted xml" + (errorLog.length?" : " + errorLog:"")); + dispatchEvent(new ParsorEvent(null,true)); + } + this._aName = new Array(); + this.preProccessXml(); + } + + private function preProccessXml() : void + { + var _loc1_:XmlPreProcessor = new XmlPreProcessor(this._xmlDoc); + _loc1_.addEventListener(PreProcessEndEvent.PRE_PROCESS_END,this.onPreProcessCompleted); + _loc1_.processTemplate(); + } + + private function mainProcess() : void + { + if((this._xmlDoc) && (this._xmlDoc.firstChild)) + { + dispatchEvent(new ParsorEvent(this.parseMainNode(this._xmlDoc.firstChild),false)); + } + else + { + dispatchEvent(new ParsorEvent(null,true)); + } + } + + protected function parseMainNode(param1:XMLNode) : UiDefinition + { + var _loc12_:XMLNode = null; + var _loc14_:* = 0; + var _loc2_:UiDefinition = new UiDefinition(); + var _loc3_:Array = param1.childNodes; + if(!_loc3_.length) + { + return null; + } + var _loc4_:Object = param1.attributes; + var _loc5_:String = _loc4_[XmlAttributesEnum.ATTRIBUTE_DEBUG]; + var _loc6_:String = _loc4_[XmlAttributesEnum.ATTRIBUTE_USECACHE]; + var _loc7_:String = _loc4_[XmlAttributesEnum.ATTRIBUTE_USEPROPERTIESCACHE]; + var _loc8_:String = _loc4_[XmlAttributesEnum.ATTRIBUTE_MODAL]; + var _loc9_:String = _loc4_[XmlAttributesEnum.ATTRIBUTE_SCALABLE]; + var _loc10_:String = _loc4_[XmlAttributesEnum.ATTRIBUTE_FOCUS]; + var _loc11_:String = _loc4_[XmlAttributesEnum.ATTRIBUTE_TRANSMITFOCUS]; + if(_loc5_) + { + _loc2_.debug = _loc5_ == "true"; + } + if(_loc6_) + { + _loc2_.useCache = _loc6_ == "true"; + } + if(_loc7_) + { + _loc2_.usePropertiesCache = _loc7_ == "true"; + } + if(_loc8_) + { + _loc2_.modal = _loc8_ == "true"; + } + if(_loc9_) + { + _loc2_.scalable = _loc9_ == "true"; + } + if(_loc10_) + { + _loc2_.giveFocus = _loc10_ == "true"; + } + if(_loc11_) + { + _loc2_.transmitFocus = _loc11_ == "true"; + } + var _loc13_:int = _loc3_.length; + _loc14_ = 0; + while(_loc14_ < _loc13_) + { + _loc12_ = _loc3_[_loc14_]; + switch(_loc12_.nodeName) { - xnNode = aNodes[i]; - switch (xnNode.nodeName) - { - case XmlTagsEnum.TAG_CONSTANTS: - this.parseConstants(xnNode, ui.constants); - break; - case XmlTagsEnum.TAG_CONTAINER: - case XmlTagsEnum.TAG_SCROLLCONTAINER: - case XmlTagsEnum.TAG_STATECONTAINER: - case XmlTagsEnum.TAG_BUTTON: - ui.graphicTree.push(this.parseGraphicElement(xnNode)); - break; - case XmlTagsEnum.TAG_SHORTCUTS: - ui.shortcutsEvents = this.parseShortcutsEvent(xnNode); - break; - default: - this._log.warn(((((("[" + this._sUrl) + "] ") + xnNode.nodeName) + " is not allowed or unknown. ") + this.suggest(xnNode.nodeName, [XmlTagsEnum.TAG_CONTAINER, XmlTagsEnum.TAG_STATECONTAINER, XmlTagsEnum.TAG_BUTTON, XmlTagsEnum.TAG_SHORTCUTS]))); - }; - i = (i + 1); - }; - this.cleanLocalConstants(ui.constants); - return (ui); - } - - private function cleanLocalConstants(constants:Array):void - { - var constant:String; - for (constant in constants) + case XmlTagsEnum.TAG_CONSTANTS: + this.parseConstants(_loc12_,_loc2_.constants); + break; + case XmlTagsEnum.TAG_CONTAINER: + case XmlTagsEnum.TAG_SCROLLCONTAINER: + case XmlTagsEnum.TAG_STATECONTAINER: + case XmlTagsEnum.TAG_BUTTON: + _loc2_.graphicTree.push(this.parseGraphicElement(_loc12_)); + break; + case XmlTagsEnum.TAG_SHORTCUTS: + _loc2_.shortcutsEvents = this.parseShortcutsEvent(_loc12_); + break; + default: + this._log.warn("[" + this._sUrl + "] " + _loc12_.nodeName + " is not allowed or unknown. " + this.suggest(_loc12_.nodeName,[XmlTagsEnum.TAG_CONTAINER,XmlTagsEnum.TAG_STATECONTAINER,XmlTagsEnum.TAG_BUTTON,XmlTagsEnum.TAG_SHORTCUTS])); + } + _loc14_ = _loc14_ + 1; + } + this.cleanLocalConstants(_loc2_.constants); + return _loc2_; + } + + private function cleanLocalConstants(param1:Array) : void + { + var _loc2_:String = null; + for(_loc2_ in param1) + { + LangManager.getInstance().deleteEntry("local." + _loc2_); + } + } + + protected function parseConstants(param1:XMLNode, param2:Array) : void + { + var _loc3_:XMLNode = null; + var _loc6_:* = 0; + var _loc7_:String = null; + var _loc8_:String = null; + var _loc9_:String = null; + var _loc10_:String = null; + var _loc4_:Array = param1.childNodes; + var _loc5_:int = _loc4_.length; + _loc6_ = 0; + while(_loc6_ < _loc5_) + { + _loc3_ = _loc4_[_loc6_]; + _loc8_ = _loc3_.nodeName; + if(_loc8_ != XmlTagsEnum.TAG_CONSTANT) { - LangManager.getInstance().deleteEntry(("local." + constant)); - }; - } - - protected function parseConstants(xnNode:XMLNode, constants:Array):void - { - var xnCurrentNode:XMLNode; - var i:int; - var value:String; - var nodeName:String; - var nameAttribute:String; - var typeAttribute:String; - var xnNodeChildNodes:Array = xnNode.childNodes; - var xnNodechildNodesLength:int = xnNodeChildNodes.length; - i = 0; - while (i < xnNodechildNodesLength) + this._log.error(_loc8_ + " found, wrong node name, waiting for " + XmlTagsEnum.TAG_CONSTANT + " in " + this._sUrl); + } + else { - xnCurrentNode = xnNodeChildNodes[i]; - nodeName = xnCurrentNode.nodeName; - if (nodeName != XmlTagsEnum.TAG_CONSTANT) - { - this._log.error(((((nodeName + " found, wrong node name, waiting for ") + XmlTagsEnum.TAG_CONSTANT) + " in ") + this._sUrl)); - } - else - { - nameAttribute = xnCurrentNode.attributes["name"]; - if (!(nameAttribute)) - { - this._log.error(("Constant name's not found in " + this._sUrl)); - } - else - { - value = LangManager.getInstance().replaceKey(xnCurrentNode.attributes["value"]); - typeAttribute = xnCurrentNode.attributes["type"]; - if (typeAttribute) - { - typeAttribute = typeAttribute.toUpperCase(); - if (typeAttribute == "STRING") - { - constants[nameAttribute] = value; - } - else - { - if (typeAttribute == "NUMBER") - { - constants[nameAttribute] = Number(value); - } - else - { - if ((((typeAttribute == "UINT")) || ((typeAttribute == "INT")))) - { - constants[nameAttribute] = int(value); - } - else - { - if (typeAttribute == "BOOLEAN") - { - constants[nameAttribute] = (value == "true"); - } - else - { - if (typeAttribute == "ARRAY") - { - constants[nameAttribute] = value.split(","); - }; - }; - }; - }; - }; - } - else - { - constants[nameAttribute] = value; - }; - LangManager.getInstance().setEntry(("local." + nameAttribute), value); - }; - }; - i = (i + 1); - }; - } - - protected function parseGraphicElement(xnNode:XMLNode, parentNode:XMLNode=null, be:BasicElement=null):BasicElement - { - var xnCurrentNode:XMLNode; - var i:int; - var j:String; - var _local_9:Class; - var _local_10:*; - var _local_11:Object; - var xmlStr:String; - var contentstr:String; - var _local_14:Class; - var xmlStr2:String; - var xnNodeChildNodes:Array = xnNode.childNodes; - var xnNodeChildNodesLength:int = xnNodeChildNodes.length; - if (!(parentNode)) + _loc9_ = _loc3_.attributes["name"]; + if(!_loc9_) + { + this._log.error("Constant name\'s not found in " + this._sUrl); + } + else + { + _loc7_ = LangManager.getInstance().replaceKey(_loc3_.attributes["value"]); + _loc10_ = _loc3_.attributes["type"]; + if(_loc10_) + { + _loc10_ = _loc10_.toUpperCase(); + if(_loc10_ == "STRING") + { + param2[_loc9_] = _loc7_; + } + else if(_loc10_ == "NUMBER") + { + param2[_loc9_] = Number(_loc7_); + } + else if(_loc10_ == "UINT" || _loc10_ == "INT") + { + param2[_loc9_] = int(_loc7_); + } + else if(_loc10_ == "BOOLEAN") + { + param2[_loc9_] = _loc7_ == "true"; + } + else if(_loc10_ == "ARRAY") + { + param2[_loc9_] = _loc7_.split(","); + } + + + + + } + else + { + param2[_loc9_] = _loc7_; + } + LangManager.getInstance().setEntry("local." + _loc9_,_loc7_); + } + } + _loc6_ = _loc6_ + 1; + } + } + + protected function parseGraphicElement(param1:XMLNode, param2:XMLNode = null, param3:BasicElement = null) : BasicElement + { + var _loc4_:XMLNode = null; + var _loc7_:* = 0; + var _loc8_:String = null; + var _loc9_:Class = null; + var _loc10_:* = undefined; + var _loc11_:Object = null; + var _loc12_:String = null; + var _loc13_:String = null; + var _loc14_:Class = null; + var _loc15_:String = null; + var _loc5_:Array = param1.childNodes; + var _loc6_:int = _loc5_.length; + if(!param2) + { + var param2:XMLNode = param1; + } + if(!param3) + { + switch(param2.nodeName) { - parentNode = xnNode; - }; - if (!(be)) + case XmlTagsEnum.TAG_CONTAINER: + var param3:BasicElement = new ContainerElement(); + param3.className = getQualifiedClassName(GraphicContainer); + break; + case XmlTagsEnum.TAG_SCROLLCONTAINER: + param3 = new ScrollContainerElement(); + param3.className = getQualifiedClassName(ScrollContainer); + break; + case XmlTagsEnum.TAG_GRID: + param3 = new GridElement(); + param3.className = getQualifiedClassName(Grid); + break; + case XmlTagsEnum.TAG_COMBOBOX: + param3 = new GridElement(); + param3.className = getQualifiedClassName(ComboBox); + break; + case XmlTagsEnum.TAG_INPUTCOMBOBOX: + param3 = new GridElement(); + param3.className = getQualifiedClassName(InputComboBox); + break; + case XmlTagsEnum.TAG_TREE: + param3 = new GridElement(); + param3.className = getQualifiedClassName(Tree); + break; + case XmlTagsEnum.TAG_STATECONTAINER: + param3 = new StateContainerElement(); + param3.className = getQualifiedClassName(StateContainer); + break; + case XmlTagsEnum.TAG_BUTTON: + param3 = new ButtonElement(); + param3.className = getQualifiedClassName(ButtonContainer); + break; + default: + param3 = new ComponentElement(); + ComponentElement(param3).className = "com.ankamagames.berilia.components::" + param2.nodeName; + } + } + for(var _loc18_ in param2.attributes) + { + switch(_loc8_) { - switch (parentNode.nodeName) - { - case XmlTagsEnum.TAG_CONTAINER: - be = new ContainerElement(); - be.className = getQualifiedClassName(GraphicContainer); - break; - case XmlTagsEnum.TAG_SCROLLCONTAINER: - be = new ScrollContainerElement(); - be.className = getQualifiedClassName(ScrollContainer); - break; - case XmlTagsEnum.TAG_GRID: - be = new GridElement(); - be.className = getQualifiedClassName(Grid); - break; - case XmlTagsEnum.TAG_COMBOBOX: - be = new GridElement(); - be.className = getQualifiedClassName(ComboBox); - break; - case XmlTagsEnum.TAG_INPUTCOMBOBOX: - be = new GridElement(); - be.className = getQualifiedClassName(InputComboBox); - break; - case XmlTagsEnum.TAG_TREE: - be = new GridElement(); - be.className = getQualifiedClassName(Tree); - break; - case XmlTagsEnum.TAG_STATECONTAINER: - be = new StateContainerElement(); - be.className = getQualifiedClassName(StateContainer); - break; - case XmlTagsEnum.TAG_BUTTON: - be = new ButtonElement(); - be.className = getQualifiedClassName(ButtonContainer); - break; - default: - be = new ComponentElement(); - ComponentElement(be).className = ("com.ankamagames.berilia.components::" + parentNode.nodeName); - }; - }; - for (j in parentNode.attributes) + case XmlAttributesEnum.ATTRIBUTE_NAME: + param3.setName(param2.attributes[_loc8_]); + this._aName[param2.attributes[_loc8_]] = param3; + continue; + case XmlAttributesEnum.ATTRIBUTE_VISIBLE: + param3.properties["visible"] = Boolean(param2.attributes[_loc8_]); + continue; + case XmlAttributesEnum.ATTRIBUTE_STRATA: + param3.strata = this.getStrataNum(param2.attributes[_loc8_]); + continue; + default: + this._log.warn("[" + this._sUrl + "] Unknown attribute \'" + _loc8_ + "\' in " + XmlTagsEnum.TAG_CONTAINER + " tag"); + continue; + } + } + _loc7_ = 0; + while(_loc7_ < _loc6_) + { + _loc4_ = _loc5_[_loc7_]; + switch(_loc4_.nodeName) { - switch (j) - { - case XmlAttributesEnum.ATTRIBUTE_NAME: - be.setName(parentNode.attributes[j]); - this._aName[parentNode.attributes[j]] = be; + case XmlTagsEnum.TAG_ANCHORS: + param3.anchors = this.parseAnchors(_loc4_); + break; + case XmlTagsEnum.TAG_SIZE: + param3.size = this.parseSize(_loc4_,true).toSizeElement(); + break; + case XmlTagsEnum.TAG_EVENTS: + param3.event = this.parseEvent(_loc4_); + break; + case XmlTagsEnum.TAG_MINIMALSIZE: + param3.minSize = this.parseSize(_loc4_,false).toSizeElement(); + break; + case XmlTagsEnum.TAG_MAXIMALSIZE: + param3.maxSize = this.parseSize(_loc4_,false).toSizeElement(); + break; + case XmlTagsEnum.TAG_SCROLLCONTAINER: + case XmlTagsEnum.TAG_CONTAINER: + case XmlTagsEnum.TAG_GRID: + case XmlTagsEnum.TAG_COMBOBOX: + case XmlTagsEnum.TAG_INPUTCOMBOBOX: + case XmlTagsEnum.TAG_TREE: + switch(param2.nodeName) + { + case XmlTagsEnum.TAG_CONTAINER: + case XmlTagsEnum.TAG_BUTTON: + case XmlTagsEnum.TAG_STATECONTAINER: + case XmlTagsEnum.TAG_SCROLLCONTAINER: + case XmlTagsEnum.TAG_COMBOBOX: + case XmlTagsEnum.TAG_INPUTCOMBOBOX: + case XmlTagsEnum.TAG_TREE: + case XmlTagsEnum.TAG_GRID: + ContainerElement(param3).childs.push(this.parseGraphicElement(_loc4_)); break; - case XmlAttributesEnum.ATTRIBUTE_VISIBLE: - be.properties["visible"] = Boolean(parentNode.attributes[j]); + default: + this._log.warn("[" + this._sUrl + "] " + param2.nodeName + " cannot contains " + _loc4_.nodeName); + } + break; + case XmlTagsEnum.TAG_STATECONTAINER: + case XmlTagsEnum.TAG_BUTTON: + switch(param2.nodeName) + { + case XmlTagsEnum.TAG_CONTAINER: + case XmlTagsEnum.TAG_STATECONTAINER: + case XmlTagsEnum.TAG_SCROLLCONTAINER: + case XmlTagsEnum.TAG_GRID: + case XmlTagsEnum.TAG_COMBOBOX: + case XmlTagsEnum.TAG_INPUTCOMBOBOX: + case XmlTagsEnum.TAG_TREE: + ContainerElement(param3).childs.push(this.parseStateContainer(_loc4_,_loc4_.nodeName)); break; - case XmlAttributesEnum.ATTRIBUTE_STRATA: - be.strata = this.getStrataNum(parentNode.attributes[j]); + default: + this._log.warn("[" + this._sUrl + "] " + param2.nodeName + " cannot contains Button"); + } + break; + default: + switch(param2.nodeName) + { + case XmlTagsEnum.TAG_CONTAINER: + _loc9_ = GraphicContainer; break; - default: - this._log.warn((((((("[" + this._sUrl) + "] Unknown attribute '") + j) + "' in ") + XmlTagsEnum.TAG_CONTAINER) + " tag")); - }; - }; - i = 0; - while (i < xnNodeChildNodesLength) - { - xnCurrentNode = xnNodeChildNodes[i]; - switch (xnCurrentNode.nodeName) - { - case XmlTagsEnum.TAG_ANCHORS: - be.anchors = this.parseAnchors(xnCurrentNode); + case XmlTagsEnum.TAG_BUTTON: + _loc9_ = ButtonContainer; break; - case XmlTagsEnum.TAG_SIZE: - be.size = this.parseSize(xnCurrentNode, true).toSizeElement(); + case XmlTagsEnum.TAG_STATECONTAINER: + _loc9_ = StateContainer; break; - case XmlTagsEnum.TAG_EVENTS: - be.event = this.parseEvent(xnCurrentNode); + case XmlTagsEnum.TAG_SCROLLCONTAINER: + _loc9_ = ScrollContainer; break; - case XmlTagsEnum.TAG_MINIMALSIZE: - be.minSize = this.parseSize(xnCurrentNode, false).toSizeElement(); + case XmlTagsEnum.TAG_GRID: + _loc9_ = Grid; break; - case XmlTagsEnum.TAG_MAXIMALSIZE: - be.maxSize = this.parseSize(xnCurrentNode, false).toSizeElement(); + case XmlTagsEnum.TAG_COMBOBOX: + _loc9_ = ComboBox; break; - case XmlTagsEnum.TAG_SCROLLCONTAINER: - case XmlTagsEnum.TAG_CONTAINER: - case XmlTagsEnum.TAG_GRID: - case XmlTagsEnum.TAG_COMBOBOX: - case XmlTagsEnum.TAG_INPUTCOMBOBOX: - case XmlTagsEnum.TAG_TREE: - switch (parentNode.nodeName) - { - case XmlTagsEnum.TAG_CONTAINER: - case XmlTagsEnum.TAG_BUTTON: - case XmlTagsEnum.TAG_STATECONTAINER: - case XmlTagsEnum.TAG_SCROLLCONTAINER: - case XmlTagsEnum.TAG_COMBOBOX: - case XmlTagsEnum.TAG_INPUTCOMBOBOX: - case XmlTagsEnum.TAG_TREE: - case XmlTagsEnum.TAG_GRID: - ContainerElement(be).childs.push(this.parseGraphicElement(xnCurrentNode)); - break; - default: - this._log.warn(((((("[" + this._sUrl) + "] ") + parentNode.nodeName) + " cannot contains ") + xnCurrentNode.nodeName)); - }; + case XmlTagsEnum.TAG_INPUTCOMBOBOX: + _loc9_ = InputComboBox; break; - case XmlTagsEnum.TAG_STATECONTAINER: - case XmlTagsEnum.TAG_BUTTON: - switch (parentNode.nodeName) - { - case XmlTagsEnum.TAG_CONTAINER: - case XmlTagsEnum.TAG_STATECONTAINER: - case XmlTagsEnum.TAG_SCROLLCONTAINER: - case XmlTagsEnum.TAG_GRID: - case XmlTagsEnum.TAG_COMBOBOX: - case XmlTagsEnum.TAG_INPUTCOMBOBOX: - case XmlTagsEnum.TAG_TREE: - ContainerElement(be).childs.push(this.parseStateContainer(xnCurrentNode, xnCurrentNode.nodeName)); - break; - default: - this._log.warn((((("[" + this._sUrl) + "] ") + parentNode.nodeName) + " cannot contains Button")); - }; + case XmlTagsEnum.TAG_TREE: + _loc9_ = Tree; break; - default: - switch (parentNode.nodeName) + } + _loc11_ = this.getClassDesc(_loc9_); + if(_loc11_[_loc4_.nodeName]) + { + if(_loc4_.firstChild) + { + _loc12_ = _loc4_.toString(); + _loc13_ = _loc12_.substr(_loc4_.nodeName.length + 2,_loc12_.length - _loc4_.nodeName.length * 2 - 5); + _loc10_ = LangManager.getInstance().replaceKey(_loc13_); + switch(_loc11_[_loc4_.nodeName]) { - case XmlTagsEnum.TAG_CONTAINER: - _local_9 = GraphicContainer; - break; - case XmlTagsEnum.TAG_BUTTON: - _local_9 = ButtonContainer; - break; - case XmlTagsEnum.TAG_STATECONTAINER: - _local_9 = StateContainer; - break; - case XmlTagsEnum.TAG_SCROLLCONTAINER: - _local_9 = ScrollContainer; - break; - case XmlTagsEnum.TAG_GRID: - _local_9 = Grid; - break; - case XmlTagsEnum.TAG_COMBOBOX: - _local_9 = ComboBox; - break; - case XmlTagsEnum.TAG_INPUTCOMBOBOX: - _local_9 = InputComboBox; - break; - case XmlTagsEnum.TAG_TREE: - _local_9 = Tree; - break; - }; - _local_11 = this.getClassDesc(_local_9); - if (_local_11[xnCurrentNode.nodeName]) - { - if (xnCurrentNode.firstChild) - { - xmlStr = xnCurrentNode.toString(); - contentstr = xmlStr.substr((xnCurrentNode.nodeName.length + 2), ((xmlStr.length - (xnCurrentNode.nodeName.length * 2)) - 5)); - _local_10 = LangManager.getInstance().replaceKey(contentstr); - switch (_local_11[xnCurrentNode.nodeName]) - { - case "Boolean": - _local_10 = !((_local_10 == "false")); - break; - default: - if ((((_local_10.charAt(0) == "[")) && ((_local_10.charAt((_local_10.length - 1)) == "]")))) - { - break; - }; - _local_14 = (getDefinitionByName(_local_11[xnCurrentNode.nodeName]) as Class); - _local_10 = new (_local_14)(_local_10); - }; - ContainerElement(be).properties[xnCurrentNode.nodeName] = _local_10; - }; + case "Boolean": + _loc10_ = !(_loc10_ == "false"); + break; + default: + if(_loc10_.charAt(0) == "[" && _loc10_.charAt(_loc10_.length - 1) == "]") + { + break; + } + _loc14_ = getDefinitionByName(_loc11_[_loc4_.nodeName]) as Class; + _loc10_ = new _loc14_(_loc10_); + break; } - else - { - switch (parentNode.nodeName) - { - case XmlTagsEnum.TAG_CONTAINER: - case XmlTagsEnum.TAG_BUTTON: - case XmlTagsEnum.TAG_STATECONTAINER: - case XmlTagsEnum.TAG_SCROLLCONTAINER: - case XmlTagsEnum.TAG_GRID: - case XmlTagsEnum.TAG_COMBOBOX: - case XmlTagsEnum.TAG_INPUTCOMBOBOX: - case XmlTagsEnum.TAG_TREE: - if (ApplicationDomain.currentDomain.hasDefinition(("com.ankamagames.berilia.components." + xnCurrentNode.nodeName))) - { - ContainerElement(be).childs.push(this.parseGraphicElement(xnCurrentNode)); - } - else - { - this._log.warn(((((("[" + this._sUrl) + "] ") + xnCurrentNode.nodeName) + " is unknown component / property on ") + parentNode.nodeName)); - }; - break; - default: - if (xnCurrentNode.firstChild != null) - { - xmlStr2 = xnCurrentNode.toString(); - be.properties[xnCurrentNode.nodeName] = xmlStr2.substr((xnCurrentNode.nodeName.length + 2), ((xmlStr2.length - (xnCurrentNode.nodeName.length * 2)) - 5)); - }; - }; - }; - }; - i = (i + 1); - }; - if ((be is ComponentElement)) - { - this.cleanComponentProperty(ComponentElement(be)); - }; - return (be); - } - - protected function parseStateContainer(xnNode:XMLNode, elementType:String) - { - var xnCurrentNode:XMLNode; - var i:int; - var stateContainerElement:StateContainerElement; - var stateConst:*; - var _local_9:String; - var _local_10:Array; - var xnNodeChildNodes:Array = xnNode.childNodes; - var xnNodeChildNodesLength:int = xnNodeChildNodes.length; - if (elementType == XmlTagsEnum.TAG_BUTTON) - { - stateContainerElement = new ButtonElement(); - }; - if (elementType == XmlTagsEnum.TAG_STATECONTAINER) - { - stateContainerElement = new StateContainerElement(); - }; - stateContainerElement.className = getQualifiedClassName(ButtonContainer); - i = 0; - while (i < xnNodeChildNodesLength) + ContainerElement(param3).properties[_loc4_.nodeName] = _loc10_; + } + } + else + { + switch(param2.nodeName) + { + case XmlTagsEnum.TAG_CONTAINER: + case XmlTagsEnum.TAG_BUTTON: + case XmlTagsEnum.TAG_STATECONTAINER: + case XmlTagsEnum.TAG_SCROLLCONTAINER: + case XmlTagsEnum.TAG_GRID: + case XmlTagsEnum.TAG_COMBOBOX: + case XmlTagsEnum.TAG_INPUTCOMBOBOX: + case XmlTagsEnum.TAG_TREE: + if(ApplicationDomain.currentDomain.hasDefinition("com.ankamagames.berilia.components." + _loc4_.nodeName)) + { + ContainerElement(param3).childs.push(this.parseGraphicElement(_loc4_)); + } + else + { + this._log.warn("[" + this._sUrl + "] " + _loc4_.nodeName + " is unknown component / property on " + param2.nodeName); + } + break; + default: + if(_loc4_.firstChild != null) + { + _loc15_ = _loc4_.toString(); + param3.properties[_loc4_.nodeName] = _loc15_.substr(_loc4_.nodeName.length + 2,_loc15_.length - _loc4_.nodeName.length * 2 - 5); + } + } + } + } + _loc7_ = _loc7_ + 1; + } + if(param3 is ComponentElement) + { + this.cleanComponentProperty(ComponentElement(param3)); + } + return param3; + } + + protected function parseStateContainer(param1:XMLNode, param2:String) : * + { + var _loc3_:XMLNode = null; + var _loc6_:* = 0; + var _loc7_:StateContainerElement = null; + var _loc8_:* = undefined; + var _loc9_:String = null; + var _loc10_:Array = null; + var _loc4_:Array = param1.childNodes; + var _loc5_:int = _loc4_.length; + if(param2 == XmlTagsEnum.TAG_BUTTON) + { + _loc7_ = new ButtonElement(); + } + if(param2 == XmlTagsEnum.TAG_STATECONTAINER) + { + _loc7_ = new StateContainerElement(); + } + _loc7_.className = getQualifiedClassName(ButtonContainer); + _loc6_ = 0; + while(_loc6_ < _loc5_) + { + _loc3_ = _loc4_[_loc6_]; + switch(_loc3_.nodeName) { - xnCurrentNode = xnNodeChildNodes[i]; - switch (xnCurrentNode.nodeName) - { - case XmlTagsEnum.TAG_COMMON: - this.parseGraphicElement(xnCurrentNode, xnNode, stateContainerElement); - break; - case XmlTagsEnum.TAG_STATE: - _local_9 = xnCurrentNode.attributes[XmlAttributesEnum.ATTRIBUTE_TYPE]; - if (_local_9) + case XmlTagsEnum.TAG_COMMON: + this.parseGraphicElement(_loc3_,param1,_loc7_); + break; + case XmlTagsEnum.TAG_STATE: + _loc9_ = _loc3_.attributes[XmlAttributesEnum.ATTRIBUTE_TYPE]; + if(_loc9_) + { + if(param2 == XmlTagsEnum.TAG_STATECONTAINER) + { + _loc8_ = _loc9_; + } + else + { + _loc8_ = 9999; + switch(_loc9_) { - if (elementType == XmlTagsEnum.TAG_STATECONTAINER) - { - stateConst = _local_9; - } - else - { - stateConst = 9999; - switch (_local_9) - { - case StatesEnum.STATE_CLICKED_STRING: - stateConst = StatesEnum.STATE_CLICKED; - break; - case StatesEnum.STATE_OVER_STRING: - stateConst = StatesEnum.STATE_OVER; - break; - case StatesEnum.STATE_DISABLED_STRING: - stateConst = StatesEnum.STATE_DISABLED; - break; - case StatesEnum.STATE_SELECTED_STRING: - stateConst = StatesEnum.STATE_SELECTED; - break; - case StatesEnum.STATE_SELECTED_OVER_STRING: - stateConst = StatesEnum.STATE_SELECTED_OVER; - break; - case StatesEnum.STATE_SELECTED_CLICKED_STRING: - stateConst = StatesEnum.STATE_SELECTED_CLICKED; - break; - default: - _local_10 = new Array(StatesEnum.STATE_CLICKED_STRING, StatesEnum.STATE_OVER_STRING, StatesEnum.STATE_SELECTED_STRING, StatesEnum.STATE_SELECTED_OVER_STRING, StatesEnum.STATE_SELECTED_CLICKED_STRING, StatesEnum.STATE_DISABLED_STRING); - this._log.warn(((_local_9 + " is not a valid state") + this.suggest(_local_9, _local_10))); - }; - }; - if (stateConst != 9999) - { - if (!(stateContainerElement.stateChangingProperties[stateConst])) - { - stateContainerElement.stateChangingProperties[stateConst] = new Array(); - }; - this.parseSetProperties(xnCurrentNode, stateContainerElement.stateChangingProperties[stateConst]); - }; + case StatesEnum.STATE_CLICKED_STRING: + _loc8_ = StatesEnum.STATE_CLICKED; + break; + case StatesEnum.STATE_OVER_STRING: + _loc8_ = StatesEnum.STATE_OVER; + break; + case StatesEnum.STATE_DISABLED_STRING: + _loc8_ = StatesEnum.STATE_DISABLED; + break; + case StatesEnum.STATE_SELECTED_STRING: + _loc8_ = StatesEnum.STATE_SELECTED; + break; + case StatesEnum.STATE_SELECTED_OVER_STRING: + _loc8_ = StatesEnum.STATE_SELECTED_OVER; + break; + case StatesEnum.STATE_SELECTED_CLICKED_STRING: + _loc8_ = StatesEnum.STATE_SELECTED_CLICKED; + break; + default: + _loc10_ = new Array(StatesEnum.STATE_CLICKED_STRING,StatesEnum.STATE_OVER_STRING,StatesEnum.STATE_SELECTED_STRING,StatesEnum.STATE_SELECTED_OVER_STRING,StatesEnum.STATE_SELECTED_CLICKED_STRING,StatesEnum.STATE_DISABLED_STRING); + this._log.warn(_loc9_ + " is not a valid state" + this.suggest(_loc9_,_loc10_)); } - else - { - this._log.warn((((XmlTagsEnum.TAG_STATE + " must have attribute [") + XmlAttributesEnum.ATTRIBUTE_TYPE) + "]")); - }; - break; - default: - this._log.warn((((elementType + " does not allow ") + xnCurrentNode.nodeName) + this.suggest(xnCurrentNode.nodeName, [XmlTagsEnum.TAG_COMMON, XmlTagsEnum.TAG_STATE]))); - }; - i = (i + 1); - }; - return (stateContainerElement); - } - - protected function parseSetProperties(xnNode:XMLNode, item:Object):void - { - var xnCurrentNode:XMLNode; - var i:int; - var target:String; - var aProperties:Array; - var propertyNode:XMLNode; - var xnCurrentNodeChildNodes:Array; - var xnCurrentNodeChildNodesLength:int; - var j:int; - var xnNodeChildNodes:Array = xnNode.childNodes; - var xnNodeChildNodesLength:int = xnNodeChildNodes.length; - i = 0; - while (i < xnNodeChildNodesLength) - { - xnCurrentNode = xnNodeChildNodes[i]; - if (xnCurrentNode.nodeName == XmlTagsEnum.TAG_SETPROPERTY) - { - target = xnCurrentNode.attributes[XmlAttributesEnum.ATTRIBUTE_TARGET]; - if (target) - { - if (this._aName[target]) + } + if(_loc8_ != 9999) + { + if(!_loc7_.stateChangingProperties[_loc8_]) { - if (!(item[target])) - { - item[target] = new Array(); - }; - aProperties = item[target]; - xnCurrentNodeChildNodes = xnCurrentNode.childNodes; - xnCurrentNodeChildNodesLength = xnCurrentNodeChildNodes.length; - j = 0; - while (j < xnCurrentNodeChildNodesLength) - { - propertyNode = xnCurrentNodeChildNodes[j]; - aProperties[propertyNode.nodeName] = LangManager.getInstance().replaceKey(propertyNode.firstChild.toString()); - j = (j + 1); - }; - this.cleanComponentProperty(this._aName[target], aProperties); + _loc7_.stateChangingProperties[_loc8_] = new Array(); } - else - { - this._log.warn(((('Unknown reference to "' + target) + '" in ') + XmlTagsEnum.TAG_SETPROPERTY)); - }; - } - else - { - this._log.warn("Cannot set button properties, not yet implemented"); - }; - } - else - { - this._log.warn((((((("Only " + XmlTagsEnum.TAG_SETPROPERTY) + " tags are authorized in ") + XmlTagsEnum.TAG_STATE) + " tags (found ") + xnCurrentNode.nodeName) + ")")); - }; - i = (i + 1); - }; - } - - private function cleanComponentProperty(be:BasicElement, properties:Array=null):Boolean - { - var val:*; - var clazz:Class; - var sProperty:String; - var key:String; - var _local_10:Array; - var _local_11:String; - if (!(properties)) - { - properties = be.properties; - }; - var cComponent:Class = (getDefinitionByName(be.className) as Class); - var classProp:Object = this.getClassDesc(cComponent); - var aNewProperties:Array = new Array(); - for (sProperty in properties) + this.parseSetProperties(_loc3_,_loc7_.stateChangingProperties[_loc8_]); + } + } + else + { + this._log.warn(XmlTagsEnum.TAG_STATE + " must have attribute [" + XmlAttributesEnum.ATTRIBUTE_TYPE + "]"); + } + break; + default: + this._log.warn(param2 + " does not allow " + _loc3_.nodeName + this.suggest(_loc3_.nodeName,[XmlTagsEnum.TAG_COMMON,XmlTagsEnum.TAG_STATE])); + } + _loc6_ = _loc6_ + 1; + } + return _loc7_; + } + + protected function parseSetProperties(param1:XMLNode, param2:Object) : void + { + var _loc3_:XMLNode = null; + var _loc6_:* = 0; + var _loc7_:String = null; + var _loc8_:Array = null; + var _loc9_:XMLNode = null; + var _loc10_:Array = null; + var _loc11_:* = 0; + var _loc12_:* = 0; + var _loc4_:Array = param1.childNodes; + var _loc5_:int = _loc4_.length; + _loc6_ = 0; + while(_loc6_ < _loc5_) + { + _loc3_ = _loc4_[_loc6_]; + if(_loc3_.nodeName == XmlTagsEnum.TAG_SETPROPERTY) { - if (classProp[sProperty]) - { - val = LangManager.getInstance().replaceKey(properties[sProperty]); - switch (classProp[sProperty]) - { - case "Boolean": - val = !((val == "false")); - break; - case getQualifiedClassName(Uri): - clazz = (getDefinitionByName(classProp[sProperty]) as Class); - val = new (clazz)(val); - break; - case "*": - break; - default: - if ((((val.charAt(0) == "[")) && ((val.charAt((val.length - 1)) == "]")))) - { - break; - }; - clazz = (getDefinitionByName(classProp[sProperty]) as Class); - val = new (clazz)(val); - }; - aNewProperties[sProperty] = val; - } - else - { - _local_10 = new Array(); - for (_local_11 in classProp) - { - _local_10.push(_local_11); - }; - this._log.warn(((((((("[" + this._sUrl) + "]") + sProperty) + " is unknown for ") + be.className) + " component") + this.suggest(sProperty, _local_10))); - }; - }; - for (key in aNewProperties) + _loc7_ = _loc3_.attributes[XmlAttributesEnum.ATTRIBUTE_TARGET]; + if(_loc7_) + { + if(this._aName[_loc7_]) + { + if(!param2[_loc7_]) + { + param2[_loc7_] = new Array(); + } + _loc8_ = param2[_loc7_]; + _loc10_ = _loc3_.childNodes; + _loc11_ = _loc10_.length; + _loc12_ = 0; + while(_loc12_ < _loc11_) + { + _loc9_ = _loc10_[_loc12_]; + _loc8_[_loc9_.nodeName] = LangManager.getInstance().replaceKey(_loc9_.firstChild.toString()); + _loc12_ = _loc12_ + 1; + } + this.cleanComponentProperty(this._aName[_loc7_],_loc8_); + } + else + { + this._log.warn("Unknown reference to \"" + _loc7_ + "\" in " + XmlTagsEnum.TAG_SETPROPERTY); + } + } + else + { + this._log.warn("Cannot set button properties, not yet implemented"); + } + } + else { - properties[key] = aNewProperties[key]; - }; - return (true); - } - - protected function getClassDesc(o:Object):Object - { - var acc:XML; - var v:XML; - var cn:String = getQualifiedClassName(o); - if (_classDescCache[cn]) + this._log.warn("Only " + XmlTagsEnum.TAG_SETPROPERTY + " tags are authorized in " + XmlTagsEnum.TAG_STATE + " tags (found " + _loc3_.nodeName + ")"); + } + _loc6_ = _loc6_ + 1; + } + } + + private function cleanComponentProperty(param1:BasicElement, param2:Array = null) : Boolean + { + var _loc6_:* = undefined; + var _loc7_:Class = null; + var _loc8_:String = null; + var _loc9_:String = null; + var _loc10_:Array = null; + var _loc11_:String = null; + if(!param2) + { + var param2:Array = param1.properties; + } + var _loc3_:Class = getDefinitionByName(param1.className) as Class; + var _loc4_:Object = this.getClassDesc(_loc3_); + var _loc5_:Array = new Array(); + for(_loc8_ in param2) + { + if(_loc4_[_loc8_]) { - return (_classDescCache[cn]); - }; - var xmlClassDef:XML = this._describeType(o); - var res:Object = new Object(); - for each (acc in xmlClassDef..accessor) + _loc6_ = LangManager.getInstance().replaceKey(param2[_loc8_]); + switch(_loc4_[_loc8_]) + { + case "Boolean": + _loc6_ = !(_loc6_ == "false"); + break; + case getQualifiedClassName(Uri): + _loc7_ = getDefinitionByName(_loc4_[_loc8_]) as Class; + _loc6_ = new _loc7_(_loc6_); + break; + case "*": + break; + default: + if(_loc6_.charAt(0) == "[" && _loc6_.charAt(_loc6_.length - 1) == "]") + { + break; + } + _loc7_ = getDefinitionByName(_loc4_[_loc8_]) as Class; + _loc6_ = new _loc7_(_loc6_); + break; + } + _loc5_[_loc8_] = _loc6_; + } + else { - res[acc.@name.toString()] = acc.@type.toString(); - }; - for each (v in xmlClassDef..variable) + _loc10_ = new Array(); + for(_loc11_ in _loc4_) + { + _loc10_.push(_loc11_); + } + this._log.warn("[" + this._sUrl + "]" + _loc8_ + " is unknown for " + param1.className + " component" + this.suggest(_loc8_,_loc10_)); + } + } + for(_loc9_ in _loc5_) + { + param2[_loc9_] = _loc5_[_loc9_]; + } + return true; + } + + protected function getClassDesc(param1:Object) : Object + { + var _loc5_:XML = null; + var _loc6_:XML = null; + var _loc2_:String = getQualifiedClassName(param1); + if(_classDescCache[_loc2_]) + { + return _classDescCache[_loc2_]; + } + var _loc3_:XML = this._describeType(param1); + var _loc4_:Object = new Object(); + for each(_loc5_ in _loc3_..accessor) + { + _loc4_[_loc5_.@name.toString()] = _loc5_.@type.toString(); + } + for each(_loc6_ in _loc3_..variable) + { + _loc4_[_loc6_.@name.toString()] = _loc6_.@type.toString(); + } + return _loc4_; + } + + protected function parseSize(param1:XMLNode, param2:Boolean) : GraphicSize + { + var _loc3_:XMLNode = null; + var _loc6_:* = 0; + var _loc8_:String = null; + var _loc9_:String = null; + if(param1.attributes.length) + { + this._log.warn("[" + this._sUrl + "]" + param1.nodeName + " cannot have attribut"); + } + var _loc4_:Array = param1.childNodes; + var _loc5_:int = _loc4_.length; + var _loc7_:GraphicSize = new GraphicSize(); + _loc6_ = 0; + while(_loc6_ < _loc5_) + { + _loc3_ = _loc4_[_loc6_]; + if(_loc3_.nodeName == XmlTagsEnum.TAG_RELDIMENSION) { - res[v.@name.toString()] = v.@type.toString(); - }; - return (res); - } - - protected function parseSize(xnNode:XMLNode, bAllowRelativeSize:Boolean):GraphicSize - { - var xnCurrentNode:XMLNode; - var k:int; - var posX:String; - var posY:String; - if (xnNode.attributes.length) + if(!param2) + { + this._log.warn("[" + this._sUrl + "]" + param1.nodeName + " does not allow relative size"); + } + else + { + _loc8_ = _loc3_.attributes["x"]; + if(_loc8_) + { + _loc7_.setX(Number(LangManager.getInstance().replaceKey(_loc8_)),GraphicSize.SIZE_PRC); + } + _loc9_ = _loc3_.attributes["y"]; + if(_loc9_) + { + _loc7_.setY(Number(LangManager.getInstance().replaceKey(_loc9_)),GraphicSize.SIZE_PRC); + } + } + } + if(_loc3_.nodeName == XmlTagsEnum.TAG_ABSDIMENSION) { - this._log.warn((((("[" + this._sUrl) + "]") + xnNode.nodeName) + " cannot have attribut")); - }; - var xnNodeChildNodes:Array = xnNode.childNodes; - var xnNodeChildNodesLength:int = xnNodeChildNodes.length; - var graphicSize:GraphicSize = new GraphicSize(); - k = 0; - while (k < xnNodeChildNodesLength) + _loc8_ = _loc3_.attributes["x"]; + if(_loc8_) + { + _loc7_.setX(int(LangManager.getInstance().replaceKey(_loc8_)),GraphicSize.SIZE_PIXEL); + } + _loc9_ = _loc3_.attributes["y"]; + if(_loc9_) + { + _loc7_.setY(int(LangManager.getInstance().replaceKey(_loc9_)),GraphicSize.SIZE_PIXEL); + } + } + _loc6_ = _loc6_ + 1; + } + return _loc7_; + } + + protected function parseAnchors(param1:XMLNode) : Array + { + var _loc2_:XMLNode = null; + var _loc5_:* = 0; + var _loc6_:* = 0; + var _loc7_:XMLNode = null; + var _loc9_:GraphicLocation = null; + var _loc10_:String = null; + var _loc11_:Array = null; + var _loc12_:* = 0; + if(param1.attributes.length) + { + this._log.warn("[" + this._sUrl + "]" + param1.nodeName + " cannot have attribut"); + } + var _loc3_:Array = param1.childNodes; + var _loc4_:int = _loc3_.length; + var _loc8_:Array = new Array(); + _loc5_ = 0; + while(_loc5_ < _loc4_) + { + _loc9_ = new GraphicLocation(); + _loc2_ = _loc3_[_loc5_]; + if(_loc2_.nodeName == XmlTagsEnum.TAG_ANCHOR) { - xnCurrentNode = xnNodeChildNodes[k]; - if (xnCurrentNode.nodeName == XmlTagsEnum.TAG_RELDIMENSION) - { - if (!(bAllowRelativeSize)) - { - this._log.warn((((("[" + this._sUrl) + "]") + xnNode.nodeName) + " does not allow relative size")); - } - else - { - posX = xnCurrentNode.attributes["x"]; - if (posX) + for(var _loc15_ in _loc2_.attributes) + { + switch(_loc10_) + { + case XmlAttributesEnum.ATTRIBUTE_POINT: + if(_loc8_.length != 0) { - graphicSize.setX(Number(LangManager.getInstance().replaceKey(posX)), GraphicSize.SIZE_PRC); - }; - posY = xnCurrentNode.attributes["y"]; - if (posY) + this._log.error("[" + this._sUrl + "] When using double anchors, you cannot define attribute POINT"); + } + else { - graphicSize.setY(Number(LangManager.getInstance().replaceKey(posY)), GraphicSize.SIZE_PRC); - }; - }; - }; - if (xnCurrentNode.nodeName == XmlTagsEnum.TAG_ABSDIMENSION) - { - posX = xnCurrentNode.attributes["x"]; - if (posX) - { - graphicSize.setX(int(LangManager.getInstance().replaceKey(posX)), GraphicSize.SIZE_PIXEL); - }; - posY = xnCurrentNode.attributes["y"]; - if (posY) - { - graphicSize.setY(int(LangManager.getInstance().replaceKey(posY)), GraphicSize.SIZE_PIXEL); - }; - }; - k = (k + 1); - }; - return (graphicSize); - } - - protected function parseAnchors(xnNode:XMLNode):Array - { - var xnCurrentNode:XMLNode; - var i:int; - var k:int; - var xnOffsetNode:XMLNode; - var glPoint:GraphicLocation; - var j:String; - var xnCurrentNodeChildNodes:Array; - var xnCurrentNodeChildNodesLength:int; - if (xnNode.attributes.length) - { - this._log.warn((((("[" + this._sUrl) + "]") + xnNode.nodeName) + " cannot have attribut")); - }; - var xnNodeChildNodes:Array = xnNode.childNodes; - var xnNodeChildNodesLength:int = xnNodeChildNodes.length; - var aResult:Array = new Array(); - i = 0; - while (i < xnNodeChildNodesLength) - { - glPoint = new GraphicLocation(); - xnCurrentNode = xnNodeChildNodes[i]; - if (xnCurrentNode.nodeName == XmlTagsEnum.TAG_ANCHOR) - { - for (j in xnCurrentNode.attributes) - { - switch (j) + _loc9_.setPoint(_loc2_.attributes[_loc10_]); + } + continue; + case XmlAttributesEnum.ATTRIBUTE_RELATIVEPOINT: + _loc9_.setRelativePoint(_loc2_.attributes[_loc10_]); + continue; + case XmlAttributesEnum.ATTRIBUTE_RELATIVETO: + _loc9_.setRelativeTo(_loc2_.attributes[_loc10_]); + continue; + default: + this._log.warn("[" + this._sUrl + "]" + param1.nodeName + " cannot have " + _loc10_ + " attribut"); + continue; + } + } + _loc11_ = _loc2_.childNodes; + _loc12_ = _loc11_.length; + _loc6_ = 0; + while(_loc6_ < _loc12_) + { + _loc7_ = _loc11_[_loc6_]; + switch(_loc7_.nodeName) + { + case XmlTagsEnum.TAG_OFFSET: + _loc7_ = _loc7_.firstChild; + break; + case XmlTagsEnum.TAG_RELDIMENSION: + if(_loc7_.attributes["x"] != null) { - case XmlAttributesEnum.ATTRIBUTE_POINT: - if (aResult.length != 0) - { - this._log.error((("[" + this._sUrl) + "] When using double anchors, you cannot define attribute POINT")); - } - else - { - glPoint.setPoint(xnCurrentNode.attributes[j]); - }; - break; - case XmlAttributesEnum.ATTRIBUTE_RELATIVEPOINT: - glPoint.setRelativePoint(xnCurrentNode.attributes[j]); - break; - case XmlAttributesEnum.ATTRIBUTE_RELATIVETO: - glPoint.setRelativeTo(xnCurrentNode.attributes[j]); - break; - default: - this._log.warn((((((("[" + this._sUrl) + "]") + xnNode.nodeName) + " cannot have ") + j) + " attribut")); - }; - }; - xnCurrentNodeChildNodes = xnCurrentNode.childNodes; - xnCurrentNodeChildNodesLength = xnCurrentNodeChildNodes.length; - k = 0; - while (k < xnCurrentNodeChildNodesLength) - { - xnOffsetNode = xnCurrentNodeChildNodes[k]; - switch (xnOffsetNode.nodeName) + _loc9_.offsetXType = LocationTypeEnum.LOCATION_TYPE_RELATIVE; + _loc9_.setOffsetX(_loc7_.attributes["x"]); + } + if(_loc7_.attributes["y"] != null) { - case XmlTagsEnum.TAG_OFFSET: - xnOffsetNode = xnOffsetNode.firstChild; - break; - case XmlTagsEnum.TAG_RELDIMENSION: - if (xnOffsetNode.attributes["x"] != null) - { - glPoint.offsetXType = LocationTypeEnum.LOCATION_TYPE_RELATIVE; - glPoint.setOffsetX(xnOffsetNode.attributes["x"]); - }; - if (xnOffsetNode.attributes["y"] != null) - { - glPoint.offsetYType = LocationTypeEnum.LOCATION_TYPE_RELATIVE; - glPoint.setOffsetY(xnOffsetNode.attributes["y"]); - }; - break; - case XmlTagsEnum.TAG_ABSDIMENSION: - if (xnOffsetNode.attributes["x"] != null) - { - glPoint.offsetXType = LocationTypeEnum.LOCATION_TYPE_ABSOLUTE; - glPoint.setOffsetX(xnOffsetNode.attributes["x"]); - }; - if (xnOffsetNode.attributes["y"] != null) - { - glPoint.offsetYType = LocationTypeEnum.LOCATION_TYPE_ABSOLUTE; - glPoint.setOffsetY(xnOffsetNode.attributes["y"]); - }; - break; - }; - k = (k + 1); - }; - aResult.push(glPoint.toLocationElement()); - } - else - { - this._log.warn((((((("[" + this._sUrl) + "] ") + xnNode.nodeName) + " does not allow ") + xnCurrentNode.nodeName) + " tag")); - }; - i = (i + 1); - }; - return (((aResult.length) ? aResult : null)); - } - - protected function parseShortcutsEvent(xnNode:XMLNode):Array - { - var xnCurrentNode:XMLNode; - var k:int; - var sShortcutName:String; - var xnNodeChildNodes:Array = xnNode.childNodes; - var xnNodeChildNodesLength:int = xnNodeChildNodes.length; - var aResult:Array = new Array(); - k = 0; - while (k < xnNodeChildNodesLength) - { - xnCurrentNode = xnNodeChildNodes[k]; - sShortcutName = xnCurrentNode.nodeName; - if (!(BindsManager.getInstance().isRegisteredName(sShortcutName))) - { - this._log.info((((("[" + this._sUrl) + "] Shortcut ") + sShortcutName) + " is not defined.")); - }; - aResult.push(sShortcutName); - k = (k + 1); - }; - return (aResult); - } - - private function parseEvent(xnNode:XMLNode):Array - { - var xnCurrentNode:XMLNode; - var k:int; - var sEventClass:String; - var _local_8:Array; - var xnNodeChildNodes:Array = xnNode.childNodes; - var xnNodeChildNodesLength:int = xnNodeChildNodes.length; - var aResult:Array = new Array(); - k = 0; - while (k < xnNodeChildNodesLength) - { - xnCurrentNode = xnNodeChildNodes[k]; - sEventClass = ""; - switch (xnCurrentNode.nodeName) - { - case EventEnums.EVENT_ONPRESS: - sEventClass = EventEnums.EVENT_ONPRESS_MSG; - break; - case EventEnums.EVENT_ONRELEASE: - sEventClass = EventEnums.EVENT_ONRELEASE_MSG; - break; - case EventEnums.EVENT_ONROLLOUT: - sEventClass = EventEnums.EVENT_ONROLLOUT_MSG; - break; - case EventEnums.EVENT_ONROLLOVER: - sEventClass = EventEnums.EVENT_ONROLLOVER_MSG; - break; - case EventEnums.EVENT_ONRELEASEOUTSIDE: - sEventClass = EventEnums.EVENT_ONRELEASEOUTSIDE_MSG; - break; - case EventEnums.EVENT_ONRIGHTCLICK: - sEventClass = EventEnums.EVENT_ONRIGHTCLICK_MSG; - break; - case EventEnums.EVENT_ONDOUBLECLICK: - sEventClass = EventEnums.EVENT_ONDOUBLECLICK_MSG; - break; - case EventEnums.EVENT_MIDDLECLICK: - sEventClass = EventEnums.EVENT_MIDDLECLICK_MSG; - break; - case EventEnums.EVENT_ONCOLORCHANGE: - sEventClass = EventEnums.EVENT_ONCOLORCHANGE_MSG; - break; - case EventEnums.EVENT_ONENTITYREADY: - sEventClass = EventEnums.EVENT_ONENTITYREADY_MSG; - break; - case EventEnums.EVENT_ONSELECTITEM: - sEventClass = EventEnums.EVENT_ONSELECTITEM_MSG; - break; - case EventEnums.EVENT_ONSELECTEMPTYITEM: - sEventClass = EventEnums.EVENT_ONSELECTEMPTYITEM_MSG; - break; - case EventEnums.EVENT_ONDROP: - sEventClass = EventEnums.EVENT_ONDROP_MSG; - break; - case EventEnums.EVENT_ONCREATETAB: - sEventClass = EventEnums.EVENT_ONCREATETAB_MSG; - break; - case EventEnums.EVENT_ONDELETETAB: - sEventClass = EventEnums.EVENT_ONDELETETAB_MSG; - break; - case EventEnums.EVENT_ONRENAMETAB: - sEventClass = EventEnums.EVENT_ONRENAMETAB_MSG; - break; - case EventEnums.EVENT_ONITEMROLLOVER: - sEventClass = EventEnums.EVENT_ONITEMROLLOVER_MSG; - break; - case EventEnums.EVENT_ONITEMROLLOUT: - sEventClass = EventEnums.EVENT_ONITEMROLLOUT_MSG; - break; - case EventEnums.EVENT_ONITEMRIGHTCLICK: - sEventClass = EventEnums.EVENT_ONITEMRIGHTCLICK_MSG; - break; - case EventEnums.EVENT_ONWHEEL: - sEventClass = EventEnums.EVENT_ONWHEEL_MSG; - break; - case EventEnums.EVENT_ONMOUSEUP: - sEventClass = EventEnums.EVENT_ONMOUSEUP_MSG; - break; - case EventEnums.EVENT_ONMAPELEMENTROLLOUT: - sEventClass = EventEnums.EVENT_ONMAPELEMENTROLLOUT_MSG; - break; - case EventEnums.EVENT_ONMAPELEMENTROLLOVER: - sEventClass = EventEnums.EVENT_ONMAPELEMENTROLLOVER_MSG; - break; - case EventEnums.EVENT_ONMAPELEMENTRIGHTCLICK: - sEventClass = EventEnums.EVENT_ONMAPELEMENTRIGHTCLICK_MSG; - break; - case EventEnums.EVENT_ONMAPMOVE: - sEventClass = EventEnums.EVENT_ONMAPMOVE_MSG; - break; - case EventEnums.EVENT_ONMAPROLLOVER: - sEventClass = EventEnums.EVENT_ONMAPROLLOVER_MSG; + _loc9_.offsetYType = LocationTypeEnum.LOCATION_TYPE_RELATIVE; + _loc9_.setOffsetY(_loc7_.attributes["y"]); + } break; - case EventEnums.EVENT_ONCOMPONENTREADY: - sEventClass = EventEnums.EVENT_ONCOMPONENTREADY_MSG; + case XmlTagsEnum.TAG_ABSDIMENSION: + if(_loc7_.attributes["x"] != null) + { + _loc9_.offsetXType = LocationTypeEnum.LOCATION_TYPE_ABSOLUTE; + _loc9_.setOffsetX(_loc7_.attributes["x"]); + } + if(_loc7_.attributes["y"] != null) + { + _loc9_.offsetYType = LocationTypeEnum.LOCATION_TYPE_ABSOLUTE; + _loc9_.setOffsetY(_loc7_.attributes["y"]); + } break; - default: - _local_8 = [EventEnums.EVENT_ONPRESS, EventEnums.EVENT_ONRELEASE, EventEnums.EVENT_ONROLLOUT, EventEnums.EVENT_ONROLLOVER, EventEnums.EVENT_ONRIGHTCLICK, EventEnums.EVENT_ONRELEASEOUTSIDE, EventEnums.EVENT_ONDOUBLECLICK, EventEnums.EVENT_ONCOLORCHANGE, EventEnums.EVENT_ONENTITYREADY, EventEnums.EVENT_ONSELECTITEM, EventEnums.EVENT_ONSELECTEMPTYITEM, EventEnums.EVENT_ONITEMROLLOVER, EventEnums.EVENT_ONITEMROLLOUT, EventEnums.EVENT_ONDROP, EventEnums.EVENT_ONWHEEL, EventEnums.EVENT_ONMOUSEUP, EventEnums.EVENT_ONMAPELEMENTROLLOUT, EventEnums.EVENT_ONMAPELEMENTROLLOVER, EventEnums.EVENT_ONMAPELEMENTRIGHTCLICK, EventEnums.EVENT_ONCREATETAB, EventEnums.EVENT_ONDELETETAB, EventEnums.EVENT_MIDDLECLICK]; - this._log.warn(((((("[" + this._sUrl) + "] ") + xnCurrentNode.nodeName) + " is an unknown event name") + this.suggest(xnCurrentNode.nodeName, _local_8))); - }; - if (!!(sEventClass.length)) - { - aResult.push(sEventClass); - }; - k = (k + 1); - }; - return (aResult); - } - - private function getStrataNum(sName:String):uint - { - var _local_2:Array; - if (sName == StrataEnum.STRATA_NAME_LOW) + } + _loc6_ = _loc6_ + 1; + } + _loc8_.push(_loc9_.toLocationElement()); + } + else { - return (StrataEnum.STRATA_LOW); - }; - if (sName == StrataEnum.STRATA_NAME_MEDIUM) + this._log.warn("[" + this._sUrl + "] " + param1.nodeName + " does not allow " + _loc2_.nodeName + " tag"); + } + _loc5_ = _loc5_ + 1; + } + return _loc8_.length?_loc8_:null; + } + + protected function parseShortcutsEvent(param1:XMLNode) : Array + { + var _loc2_:XMLNode = null; + var _loc5_:* = 0; + var _loc6_:String = null; + var _loc3_:Array = param1.childNodes; + var _loc4_:int = _loc3_.length; + var _loc7_:Array = new Array(); + _loc5_ = 0; + while(_loc5_ < _loc4_) + { + _loc2_ = _loc3_[_loc5_]; + _loc6_ = _loc2_.nodeName; + if(!BindsManager.getInstance().isRegisteredName(_loc6_)) { - return (StrataEnum.STRATA_MEDIUM); - }; - if (sName == StrataEnum.STRATA_NAME_HIGH) + this._log.info("[" + this._sUrl + "] Shortcut " + _loc6_ + " is not defined."); + } + _loc7_.push(_loc6_); + _loc5_ = _loc5_ + 1; + } + return _loc7_; + } + + private function parseEvent(param1:XMLNode) : Array + { + var _loc2_:XMLNode = null; + var _loc5_:* = 0; + var _loc6_:String = null; + var _loc8_:Array = null; + var _loc3_:Array = param1.childNodes; + var _loc4_:int = _loc3_.length; + var _loc7_:Array = new Array(); + _loc5_ = 0; + while(_loc5_ < _loc4_) + { + _loc2_ = _loc3_[_loc5_]; + _loc6_ = ""; + switch(_loc2_.nodeName) { - return (StrataEnum.STRATA_HIGH); - }; - if (sName == StrataEnum.STRATA_NAME_TOP) + case EventEnums.EVENT_ONPRESS: + _loc6_ = EventEnums.EVENT_ONPRESS_MSG; + break; + case EventEnums.EVENT_ONRELEASE: + _loc6_ = EventEnums.EVENT_ONRELEASE_MSG; + break; + case EventEnums.EVENT_ONROLLOUT: + _loc6_ = EventEnums.EVENT_ONROLLOUT_MSG; + break; + case EventEnums.EVENT_ONROLLOVER: + _loc6_ = EventEnums.EVENT_ONROLLOVER_MSG; + break; + case EventEnums.EVENT_ONRELEASEOUTSIDE: + _loc6_ = EventEnums.EVENT_ONRELEASEOUTSIDE_MSG; + break; + case EventEnums.EVENT_ONRIGHTCLICK: + _loc6_ = EventEnums.EVENT_ONRIGHTCLICK_MSG; + break; + case EventEnums.EVENT_ONDOUBLECLICK: + _loc6_ = EventEnums.EVENT_ONDOUBLECLICK_MSG; + break; + case EventEnums.EVENT_MIDDLECLICK: + _loc6_ = EventEnums.EVENT_MIDDLECLICK_MSG; + break; + case EventEnums.EVENT_ONCOLORCHANGE: + _loc6_ = EventEnums.EVENT_ONCOLORCHANGE_MSG; + break; + case EventEnums.EVENT_ONENTITYREADY: + _loc6_ = EventEnums.EVENT_ONENTITYREADY_MSG; + break; + case EventEnums.EVENT_ONSELECTITEM: + _loc6_ = EventEnums.EVENT_ONSELECTITEM_MSG; + break; + case EventEnums.EVENT_ONSELECTEMPTYITEM: + _loc6_ = EventEnums.EVENT_ONSELECTEMPTYITEM_MSG; + break; + case EventEnums.EVENT_ONDROP: + _loc6_ = EventEnums.EVENT_ONDROP_MSG; + break; + case EventEnums.EVENT_ONCREATETAB: + _loc6_ = EventEnums.EVENT_ONCREATETAB_MSG; + break; + case EventEnums.EVENT_ONDELETETAB: + _loc6_ = EventEnums.EVENT_ONDELETETAB_MSG; + break; + case EventEnums.EVENT_ONRENAMETAB: + _loc6_ = EventEnums.EVENT_ONRENAMETAB_MSG; + break; + case EventEnums.EVENT_ONITEMROLLOVER: + _loc6_ = EventEnums.EVENT_ONITEMROLLOVER_MSG; + break; + case EventEnums.EVENT_ONITEMROLLOUT: + _loc6_ = EventEnums.EVENT_ONITEMROLLOUT_MSG; + break; + case EventEnums.EVENT_ONITEMRIGHTCLICK: + _loc6_ = EventEnums.EVENT_ONITEMRIGHTCLICK_MSG; + break; + case EventEnums.EVENT_ONWHEEL: + _loc6_ = EventEnums.EVENT_ONWHEEL_MSG; + break; + case EventEnums.EVENT_ONMOUSEUP: + _loc6_ = EventEnums.EVENT_ONMOUSEUP_MSG; + break; + case EventEnums.EVENT_ONMAPELEMENTROLLOUT: + _loc6_ = EventEnums.EVENT_ONMAPELEMENTROLLOUT_MSG; + break; + case EventEnums.EVENT_ONMAPELEMENTROLLOVER: + _loc6_ = EventEnums.EVENT_ONMAPELEMENTROLLOVER_MSG; + break; + case EventEnums.EVENT_ONMAPELEMENTRIGHTCLICK: + _loc6_ = EventEnums.EVENT_ONMAPELEMENTRIGHTCLICK_MSG; + break; + case EventEnums.EVENT_ONMAPMOVE: + _loc6_ = EventEnums.EVENT_ONMAPMOVE_MSG; + break; + case EventEnums.EVENT_ONMAPROLLOVER: + _loc6_ = EventEnums.EVENT_ONMAPROLLOVER_MSG; + break; + case EventEnums.EVENT_ONCOMPONENTREADY: + _loc6_ = EventEnums.EVENT_ONCOMPONENTREADY_MSG; + break; + default: + _loc8_ = [EventEnums.EVENT_ONPRESS,EventEnums.EVENT_ONRELEASE,EventEnums.EVENT_ONROLLOUT,EventEnums.EVENT_ONROLLOVER,EventEnums.EVENT_ONRIGHTCLICK,EventEnums.EVENT_ONRELEASEOUTSIDE,EventEnums.EVENT_ONDOUBLECLICK,EventEnums.EVENT_ONCOLORCHANGE,EventEnums.EVENT_ONENTITYREADY,EventEnums.EVENT_ONSELECTITEM,EventEnums.EVENT_ONSELECTEMPTYITEM,EventEnums.EVENT_ONITEMROLLOVER,EventEnums.EVENT_ONITEMROLLOUT,EventEnums.EVENT_ONDROP,EventEnums.EVENT_ONWHEEL,EventEnums.EVENT_ONMOUSEUP,EventEnums.EVENT_ONMAPELEMENTROLLOUT,EventEnums.EVENT_ONMAPELEMENTROLLOVER,EventEnums.EVENT_ONMAPELEMENTRIGHTCLICK,EventEnums.EVENT_ONCREATETAB,EventEnums.EVENT_ONDELETETAB,EventEnums.EVENT_MIDDLECLICK]; + this._log.warn("[" + this._sUrl + "] " + _loc2_.nodeName + " is an unknown event name" + this.suggest(_loc2_.nodeName,_loc8_)); + } + if(_loc6_.length) { - return (StrataEnum.STRATA_TOP); - }; - if (sName == StrataEnum.STRATA_NAME_TOOLTIP) + _loc7_.push(_loc6_); + } + _loc5_ = _loc5_ + 1; + } + return _loc7_; + } + + private function getStrataNum(param1:String) : uint + { + var _loc2_:Array = null; + if(param1 == StrataEnum.STRATA_NAME_LOW) + { + return StrataEnum.STRATA_LOW; + } + if(param1 == StrataEnum.STRATA_NAME_MEDIUM) + { + return StrataEnum.STRATA_MEDIUM; + } + if(param1 == StrataEnum.STRATA_NAME_HIGH) + { + return StrataEnum.STRATA_HIGH; + } + if(param1 == StrataEnum.STRATA_NAME_TOP) + { + return StrataEnum.STRATA_TOP; + } + if(param1 == StrataEnum.STRATA_NAME_TOOLTIP) + { + return StrataEnum.STRATA_TOOLTIP; + } + _loc2_ = [StrataEnum.STRATA_NAME_LOW,StrataEnum.STRATA_NAME_MEDIUM,StrataEnum.STRATA_NAME_HIGH,StrataEnum.STRATA_NAME_TOP,StrataEnum.STRATA_NAME_TOOLTIP]; + this._log.warn("[" + this._sUrl + "] " + param1 + " is an unknown strata name" + this.suggest(param1,_loc2_)); + return StrataEnum.STRATA_MEDIUM; + } + + private function suggest(param1:String, param2:Array, param3:uint = 5, param4:uint = 3) : String + { + var _loc7_:* = NaN; + var _loc8_:* = 0; + var _loc5_:* = ""; + var _loc6_:Array = new Array(); + _loc8_ = 0; + while(_loc8_ < param2.length) + { + _loc7_ = Levenshtein.distance(param1.toUpperCase(),param2[_loc8_].toUpperCase()); + if(_loc7_ <= param3) { - return (StrataEnum.STRATA_TOOLTIP); - }; - _local_2 = [StrataEnum.STRATA_NAME_LOW, StrataEnum.STRATA_NAME_MEDIUM, StrataEnum.STRATA_NAME_HIGH, StrataEnum.STRATA_NAME_TOP, StrataEnum.STRATA_NAME_TOOLTIP]; - this._log.warn(((((("[" + this._sUrl) + "] ") + sName) + " is an unknown strata name") + this.suggest(sName, _local_2))); - return (StrataEnum.STRATA_MEDIUM); - } - - private function suggest(word:String, aPossibilities:Array, max:uint=5, suggestCount:uint=3):String - { - var value:Number; - var i:int; - var suggest:String = ""; - var res:Array = new Array(); - i = 0; - while (i < aPossibilities.length) + _loc6_.push({ + "dist":_loc7_, + "word":param2[_loc8_] + }); + } + _loc8_++; + } + if(_loc6_.length) + { + _loc5_ = " (did you mean "; + _loc6_.sortOn("dist",Array.NUMERIC); + _loc8_ = 0; + while(_loc8_ < _loc6_.length - 1 && _loc8_ < param4 - 1) { - value = Levenshtein.distance(word.toUpperCase(), aPossibilities[i].toUpperCase()); - if (value <= max) - { - res.push({ - "dist":value, - "word":aPossibilities[i] - }); - }; - i++; - }; - if (res.length) + _loc5_ = _loc5_ + ("\"" + _loc6_[_loc8_].word + "\"" + (_loc8_ < _loc6_.length - 1?", ":"")); + _loc8_++; + } + if(_loc6_[_loc8_]) { - suggest = " (did you mean "; - res.sortOn("dist", Array.NUMERIC); - i = 0; - while ((((i < (res.length - 1))) && ((i < (suggestCount - 1))))) - { - suggest = (suggest + ((('"' + res[i].word) + '"') + (((i < (res.length - 1))) ? ", " : ""))); - i++; - }; - if (res[i]) - { - suggest = (suggest + ((((i) ? "or " : "") + '"') + res[i].word)); - }; - suggest = (suggest + '" ?)'); - }; - return (suggest); - } - - private function onPreProcessCompleted(event:Event):void - { - this.mainProcess(); - } - - private function onXmlLoadComplete(e:ResourceLoadedEvent):void - { - this.processXml(e.resource); - } - - private function onXmlLoadError(e:ResourceErrorEvent):void - { - dispatchEvent(new ParsingErrorEvent(e.uri.toString(), e.errorMsg)); - } - - - } -}//package com.ankamagames.berilia.uiRender - + _loc5_ = _loc5_ + ((_loc8_?"or ":"") + "\"" + _loc6_[_loc8_].word); + } + _loc5_ = _loc5_ + "\" ?)"; + } + return _loc5_; + } + + private function onPreProcessCompleted(param1:Event) : void + { + this.mainProcess(); + } + + private function onXmlLoadComplete(param1:ResourceLoadedEvent) : void + { + this.processXml(param1.resource); + } + + private function onXmlLoadError(param1:ResourceErrorEvent) : void + { + dispatchEvent(new ParsingErrorEvent(param1.uri.toString(),param1.errorMsg)); + } + } +} diff --git a/com/ankamagames/berilia/uiRender/XmlPreProcessor.as b/com/ankamagames/berilia/uiRender/XmlPreProcessor.as index a87dbd6e2..41a648557 100644 --- a/com/ankamagames/berilia/uiRender/XmlPreProcessor.as +++ b/com/ankamagames/berilia/uiRender/XmlPreProcessor.as @@ -1,178 +1,175 @@ -package com.ankamagames.berilia.uiRender +package com.ankamagames.berilia.uiRender { - import flash.events.EventDispatcher; - import com.ankamagames.jerakine.logger.Logger; - import com.ankamagames.jerakine.logger.Log; - import flash.utils.getQualifiedClassName; - import flash.xml.XMLDocument; - import com.ankamagames.berilia.managers.TemplateManager; - import com.ankamagames.berilia.types.event.TemplateLoadedEvent; - import com.ankamagames.berilia.types.event.PreProcessEndEvent; - import flash.xml.XMLNode; - import com.ankamagames.berilia.enums.XmlTagsEnum; - import com.ankamagames.berilia.enums.XmlAttributesEnum; - import com.ankamagames.jerakine.managers.LangManager; - import com.ankamagames.berilia.types.template.TemplateParam; - - public class XmlPreProcessor extends EventDispatcher - { - - protected static const _log:Logger = Log.getLogger(getQualifiedClassName(XmlPreProcessor)); - - private var _xDoc:XMLDocument; - private var _bMustBeRendered:Boolean = true; - private var _aImportFile:Array; - - public function XmlPreProcessor(xDoc:XMLDocument) - { - this._xDoc = xDoc; - } - - public function get importedFiles():int - { - return (this._aImportFile.length); - } - - public function processTemplate():void - { - this._aImportFile = new Array(); - TemplateManager.getInstance().addEventListener(TemplateLoadedEvent.EVENT_TEMPLATE_LOADED, this.onTemplateLoaded); - this.matchImport(this._xDoc.firstChild); - if (!(this._aImportFile.length)) + import flash.events.EventDispatcher; + import com.ankamagames.jerakine.logger.Logger; + import com.ankamagames.jerakine.logger.Log; + import flash.utils.getQualifiedClassName; + import flash.xml.XMLDocument; + import com.ankamagames.berilia.managers.TemplateManager; + import com.ankamagames.berilia.types.event.TemplateLoadedEvent; + import com.ankamagames.berilia.types.event.PreProcessEndEvent; + import flash.xml.XMLNode; + import com.ankamagames.berilia.enums.XmlTagsEnum; + import com.ankamagames.berilia.enums.XmlAttributesEnum; + import com.ankamagames.jerakine.managers.LangManager; + import com.ankamagames.berilia.types.template.TemplateParam; + + public class XmlPreProcessor extends EventDispatcher + { + + public function XmlPreProcessor(param1:XMLDocument) + { + super(); + this._xDoc = param1; + } + + protected static const _log:Logger = Log.getLogger(getQualifiedClassName(XmlPreProcessor)); + + private var _xDoc:XMLDocument; + + private var _bMustBeRendered:Boolean = true; + + private var _aImportFile:Array; + + public function get importedFiles() : int + { + return this._aImportFile.length; + } + + public function processTemplate() : void + { + this._aImportFile = new Array(); + TemplateManager.getInstance().addEventListener(TemplateLoadedEvent.EVENT_TEMPLATE_LOADED,this.onTemplateLoaded); + this.matchImport(this._xDoc.firstChild); + if(!this._aImportFile.length) + { + dispatchEvent(new PreProcessEndEvent(this)); + TemplateManager.getInstance().removeEventListener(TemplateLoadedEvent.EVENT_TEMPLATE_LOADED,this.onTemplateLoaded); + return; + } + var _loc1_:uint = 0; + while(_loc1_ < this._aImportFile.length) + { + TemplateManager.getInstance().register(this._aImportFile[_loc1_]); + _loc1_++; + } + } + + private function matchImport(param1:XMLNode) : void + { + var _loc2_:XMLNode = null; + if(param1 == null) + { + return; + } + var _loc3_:uint = 0; + while(_loc3_ < param1.childNodes.length) + { + _loc2_ = param1.childNodes[_loc3_]; + if(_loc2_.nodeName == XmlTagsEnum.TAG_IMPORT) { - dispatchEvent(new PreProcessEndEvent(this)); - TemplateManager.getInstance().removeEventListener(TemplateLoadedEvent.EVENT_TEMPLATE_LOADED, this.onTemplateLoaded); - return; - }; - var i:uint; - while (i < this._aImportFile.length) + if(_loc2_.attributes[XmlAttributesEnum.ATTRIBUTE_URL] == null) + { + _log.warn("Attribute \'" + XmlAttributesEnum.ATTRIBUTE_URL + "\' is missing in " + XmlTagsEnum.TAG_IMPORT + " tag."); + } + else + { + this._aImportFile.push(LangManager.getInstance().replaceKey(_loc2_.attributes[XmlAttributesEnum.ATTRIBUTE_URL])); + } + _loc2_.removeNode(); + _loc3_--; + } + else if(_loc2_ != null) { - TemplateManager.getInstance().register(this._aImportFile[i]); - i++; - }; - } - - private function matchImport(node:XMLNode):void - { - var currNode:XMLNode; - if (node == null) + this.matchImport(_loc2_); + } + + _loc3_++; + } + } + + private function replaceTemplateCall(param1:XMLNode) : Boolean + { + var _loc2_:XMLNode = null; + var _loc3_:XMLNode = null; + var _loc4_:XMLNode = null; + var _loc5_:XMLNode = null; + var _loc7_:uint = 0; + var _loc8_:String = null; + var _loc9_:uint = 0; + var _loc10_:Array = null; + var _loc11_:String = null; + var _loc12_:Array = null; + var _loc14_:* = false; + var _loc15_:String = null; + var _loc16_:XMLNode = null; + var _loc6_:* = false; + var _loc13_:uint = 0; + while(_loc13_ < param1.childNodes.length) + { + _loc2_ = param1.childNodes[_loc13_]; + _loc14_ = false; + _loc7_ = 0; + while(_loc7_ < this._aImportFile.length) { - return; - }; - var i:uint; - while (i < node.childNodes.length) + _loc10_ = this._aImportFile[_loc7_].split("/"); + _loc11_ = _loc10_[_loc10_.length - 1]; + if(_loc11_.toUpperCase() == (_loc2_.nodeName + ".xml").toUpperCase()) + { + _loc12_ = new Array(); + for(_loc8_ in _loc2_.attributes) + { + _loc12_[_loc8_] = new TemplateParam(_loc8_,_loc2_.attributes[_loc8_]); + } + _loc9_ = 0; + while(_loc9_ < _loc2_.childNodes.length) + { + _loc3_ = _loc2_.childNodes[_loc9_]; + _loc15_ = ""; + for each(_loc16_ in _loc3_.childNodes) + { + _loc15_ = _loc15_ + _loc16_; + } + _loc12_[_loc3_.nodeName] = new TemplateParam(_loc3_.nodeName,_loc15_); + _loc9_++; + } + _loc4_ = TemplateManager.getInstance().getTemplate(_loc11_).makeTemplate(_loc12_); + _loc9_ = 0; + while(_loc9_ < _loc4_.firstChild.childNodes.length) + { + _loc5_ = _loc4_.firstChild.childNodes[_loc9_].cloneNode(true); + _loc2_.parentNode.insertBefore(_loc5_,_loc2_); + _loc9_++; + } + _loc2_.removeNode(); + _loc6_ = _loc14_ = true; + } + _loc7_++; + } + if(!_loc14_) { - currNode = node.childNodes[i]; - if (currNode.nodeName == XmlTagsEnum.TAG_IMPORT) - { - if (currNode.attributes[XmlAttributesEnum.ATTRIBUTE_URL] == null) - { - _log.warn((((("Attribute '" + XmlAttributesEnum.ATTRIBUTE_URL) + "' is missing in ") + XmlTagsEnum.TAG_IMPORT) + " tag.")); - } - else - { - this._aImportFile.push(LangManager.getInstance().replaceKey(currNode.attributes[XmlAttributesEnum.ATTRIBUTE_URL])); - }; - currNode.removeNode(); - i--; - } - else - { - if (currNode != null) - { - this.matchImport(currNode); - }; - }; - i++; - }; - } - - private function replaceTemplateCall(node:XMLNode):Boolean - { - var currNode:XMLNode; - var currVarNode:XMLNode; - var templateNode:XMLNode; - var insertedNode:XMLNode; - var j:uint; - var s:String; - var n:uint; - var aTmp:Array; - var sFileName:String; - var aTemplateVar:Array; - var replace:Boolean; - var content:String; - var varNode:XMLNode; - var bRes:Boolean; - var i:uint; - while (i < node.childNodes.length) + _loc6_ = (this.replaceTemplateCall(_loc2_)) || (_loc6_); + } + _loc13_++; + } + return _loc6_; + } + + private function onTemplateLoaded(param1:TemplateLoadedEvent) : void + { + if((TemplateManager.getInstance().areLoaded(this._aImportFile)) && (this._bMustBeRendered)) + { + this._bMustBeRendered = this.replaceTemplateCall(this._xDoc.firstChild); + if(this._bMustBeRendered) { - currNode = node.childNodes[i]; - replace = false; - j = 0; - while (j < this._aImportFile.length) - { - aTmp = this._aImportFile[j].split("/"); - sFileName = aTmp[(aTmp.length - 1)]; - if (sFileName.toUpperCase() == (currNode.nodeName + ".xml").toUpperCase()) - { - aTemplateVar = new Array(); - for (s in currNode.attributes) - { - aTemplateVar[s] = new TemplateParam(s, currNode.attributes[s]); - }; - n = 0; - while (n < currNode.childNodes.length) - { - currVarNode = currNode.childNodes[n]; - content = ""; - for each (varNode in currVarNode.childNodes) - { - content = (content + varNode); - }; - aTemplateVar[currVarNode.nodeName] = new TemplateParam(currVarNode.nodeName, content); - n++; - }; - templateNode = TemplateManager.getInstance().getTemplate(sFileName).makeTemplate(aTemplateVar); - n = 0; - while (n < templateNode.firstChild.childNodes.length) - { - insertedNode = templateNode.firstChild.childNodes[n].cloneNode(true); - currNode.parentNode.insertBefore(insertedNode, currNode); - n++; - }; - currNode.removeNode(); - replace = true; - bRes = replace; - }; - j++; - }; - if (!(replace)) - { - bRes = ((this.replaceTemplateCall(currNode)) || (bRes)); - }; - i++; - }; - return (bRes); - } - - private function onTemplateLoaded(e:TemplateLoadedEvent):void - { - if (((TemplateManager.getInstance().areLoaded(this._aImportFile)) && (this._bMustBeRendered))) + this.processTemplate(); + } + else { - this._bMustBeRendered = this.replaceTemplateCall(this._xDoc.firstChild); - if (this._bMustBeRendered) - { - this.processTemplate(); - } - else - { - dispatchEvent(new PreProcessEndEvent(this)); - TemplateManager.getInstance().removeEventListener(TemplateLoadedEvent.EVENT_TEMPLATE_LOADED, this.onTemplateLoaded); - }; - }; - } - - - } -}//package com.ankamagames.berilia.uiRender - + dispatchEvent(new PreProcessEndEvent(this)); + TemplateManager.getInstance().removeEventListener(TemplateLoadedEvent.EVENT_TEMPLATE_LOADED,this.onTemplateLoaded); + } + } + } + } +} diff --git a/com/ankamagames/berilia/utils/BeriliaHookList.as b/com/ankamagames/berilia/utils/BeriliaHookList.as index 688a27488..c3a1bd25f 100644 --- a/com/ankamagames/berilia/utils/BeriliaHookList.as +++ b/com/ankamagames/berilia/utils/BeriliaHookList.as @@ -1,37 +1,63 @@ -package com.ankamagames.berilia.utils +package com.ankamagames.berilia.utils { - import com.ankamagames.berilia.types.data.Hook; - - public class BeriliaHookList - { - - public static const MouseClick:Hook = new Hook("MouseClick", false); - public static const MouseMiddleClick:Hook = new Hook("MouseMiddleClick", false); - public static const MouseShiftClick:Hook = new Hook("MouseShiftClick", false); - public static const MouseCtrlClick:Hook = new Hook("MouseCtrlClick", false); - public static const MouseAltClick:Hook = new Hook("MouseAltClick", false); - public static const MouseCtrlDoubleClick:Hook = new Hook("MouseCtrlDoubleClick", false); - public static const MouseAltDoubleClick:Hook = new Hook("MouseAltDoubleClick", false); - public static const PostMouseClick:Hook = new Hook("PostMouseClick", false); - public static const KeyUp:Hook = new Hook("KeyUp", false); - public static const KeyDown:Hook = new Hook("KeyDown", false); - public static const FocusChange:Hook = new Hook("FocusChange", false); - public static const DropStart:Hook = new Hook("DropStart", false); - public static const DropEnd:Hook = new Hook("DropEnd", false); - public static const KeyboardShortcut:Hook = new Hook("KeyboardShortcut", true); - public static const ShortcutUpdate:Hook = new Hook("ShortcutUpdate", true); - public static const TextureLoadFailed:Hook = new Hook("TextureLoadFailed", false); - public static const SlotDropedOnBerilia:Hook = new Hook("SlotDropedOnBerilia", false); - public static const SlotDropedOnWorld:Hook = new Hook("SlotDropedOnWorld", false); - public static const SlotDropedNorBeriliaNorWorld:Hook = new Hook("SlotDropedNorBeriliaNorWorld", false); - public static const UiLoaded:Hook = new Hook("UiLoaded", false); - public static const ChatHyperlink:Hook = new Hook("ChatHyperlink", true); - public static const ChatRollOverLink:Hook = new Hook("ChatRollOverLink", true); - public static const UiUnloading:Hook = new Hook("UiUnloading", false); - public static const UiUnloaded:Hook = new Hook("UiUnloaded", false); - public static const WindowResize:Hook = new Hook("WindowResize", false); - - - } -}//package com.ankamagames.berilia.utils - + import com.ankamagames.berilia.types.data.Hook; + + public class BeriliaHookList extends Object + { + + public function BeriliaHookList() + { + super(); + } + + public static const MouseClick:Hook = new Hook("MouseClick",false); + + public static const MouseMiddleClick:Hook = new Hook("MouseMiddleClick",false); + + public static const MouseShiftClick:Hook = new Hook("MouseShiftClick",false); + + public static const MouseCtrlClick:Hook = new Hook("MouseCtrlClick",false); + + public static const MouseAltClick:Hook = new Hook("MouseAltClick",false); + + public static const MouseCtrlDoubleClick:Hook = new Hook("MouseCtrlDoubleClick",false); + + public static const MouseAltDoubleClick:Hook = new Hook("MouseAltDoubleClick",false); + + public static const PostMouseClick:Hook = new Hook("PostMouseClick",false); + + public static const KeyUp:Hook = new Hook("KeyUp",false); + + public static const KeyDown:Hook = new Hook("KeyDown",false); + + public static const FocusChange:Hook = new Hook("FocusChange",false); + + public static const DropStart:Hook = new Hook("DropStart",false); + + public static const DropEnd:Hook = new Hook("DropEnd",false); + + public static const KeyboardShortcut:Hook = new Hook("KeyboardShortcut",true); + + public static const ShortcutUpdate:Hook = new Hook("ShortcutUpdate",true); + + public static const TextureLoadFailed:Hook = new Hook("TextureLoadFailed",false); + + public static const SlotDropedOnBerilia:Hook = new Hook("SlotDropedOnBerilia",false); + + public static const SlotDropedOnWorld:Hook = new Hook("SlotDropedOnWorld",false); + + public static const SlotDropedNorBeriliaNorWorld:Hook = new Hook("SlotDropedNorBeriliaNorWorld",false); + + public static const UiLoaded:Hook = new Hook("UiLoaded",false); + + public static const ChatHyperlink:Hook = new Hook("ChatHyperlink",true); + + public static const ChatRollOverLink:Hook = new Hook("ChatRollOverLink",true); + + public static const UiUnloading:Hook = new Hook("UiUnloading",false); + + public static const UiUnloaded:Hook = new Hook("UiUnloaded",false); + + public static const WindowResize:Hook = new Hook("WindowResize",false); + } +} diff --git a/com/ankamagames/berilia/utils/ComponentList.as b/com/ankamagames/berilia/utils/ComponentList.as index 3a0b0412c..fa60f3592 100644 --- a/com/ankamagames/berilia/utils/ComponentList.as +++ b/com/ankamagames/berilia/utils/ComponentList.as @@ -1,53 +1,75 @@ -package com.ankamagames.berilia.utils +package com.ankamagames.berilia.utils { - import com.ankamagames.berilia.components.CharacterWheel; - import com.ankamagames.berilia.components.ChatComponent; - import com.ankamagames.berilia.components.ColorPicker; - import com.ankamagames.berilia.components.ComboBox; - import com.ankamagames.berilia.components.EntityDisplayer; - import com.ankamagames.berilia.components.Grid; - import com.ankamagames.berilia.components.Input; - import com.ankamagames.berilia.components.InputComboBox; - import com.ankamagames.berilia.components.Label; - import com.ankamagames.berilia.components.LinkedLabel; - import com.ankamagames.berilia.components.MapViewer; - import com.ankamagames.berilia.components.ScrollBar; - import com.ankamagames.berilia.components.Slot; - import com.ankamagames.berilia.components.SpellZoneComponent; - import com.ankamagames.berilia.components.SwfApplication; - import com.ankamagames.berilia.components.TabSet; - import com.ankamagames.berilia.components.TextArea; - import com.ankamagames.berilia.components.Texture; - import com.ankamagames.berilia.components.Tree; - import com.ankamagames.berilia.components.VideoPlayer; - import com.ankamagames.berilia.components.WebBrowser; - - public class ComponentList - { - - public static const charaWheel:CharacterWheel = null; - public static const chatComponent:ChatComponent = null; - public static const colorPicker:ColorPicker = null; - public static const combobox:ComboBox = null; - public static const entityDisplayer:EntityDisplayer = null; - public static const newGrid:Grid = null; - public static const input:Input = null; - public static const inputComboBox:InputComboBox = null; - public static const label:Label = null; - public static const linkedLabel:LinkedLabel = null; - public static const mapViewer:MapViewer = null; - public static const scrollBar:ScrollBar = null; - public static const slot:Slot = null; - public static const spellZoneComponent:SpellZoneComponent = null; - public static const swfApplication:SwfApplication = null; - public static const tabSet:TabSet = null; - public static const textArea:TextArea = null; - public static const texture:Texture = null; - public static const tree:Tree = null; - public static const videoPlayer:VideoPlayer = null; - public static const webBrowser:WebBrowser = null; - - - } -}//package com.ankamagames.berilia.utils - + import com.ankamagames.berilia.components.CharacterWheel; + import com.ankamagames.berilia.components.ChatComponent; + import com.ankamagames.berilia.components.ColorPicker; + import com.ankamagames.berilia.components.ComboBox; + import com.ankamagames.berilia.components.EntityDisplayer; + import com.ankamagames.berilia.components.Grid; + import com.ankamagames.berilia.components.Input; + import com.ankamagames.berilia.components.InputComboBox; + import com.ankamagames.berilia.components.Label; + import com.ankamagames.berilia.components.LinkedLabel; + import com.ankamagames.berilia.components.MapViewer; + import com.ankamagames.berilia.components.ScrollBar; + import com.ankamagames.berilia.components.Slot; + import com.ankamagames.berilia.components.SpellZoneComponent; + import com.ankamagames.berilia.components.SwfApplication; + import com.ankamagames.berilia.components.TabSet; + import com.ankamagames.berilia.components.TextArea; + import com.ankamagames.berilia.components.Texture; + import com.ankamagames.berilia.components.Tree; + import com.ankamagames.berilia.components.VideoPlayer; + import com.ankamagames.berilia.components.WebBrowser; + + public class ComponentList extends Object + { + + public function ComponentList() + { + super(); + } + + public static const charaWheel:CharacterWheel = null; + + public static const chatComponent:ChatComponent = null; + + public static const colorPicker:ColorPicker = null; + + public static const combobox:ComboBox = null; + + public static const entityDisplayer:EntityDisplayer = null; + + public static const newGrid:Grid = null; + + public static const input:Input = null; + + public static const inputComboBox:InputComboBox = null; + + public static const label:Label = null; + + public static const linkedLabel:LinkedLabel = null; + + public static const mapViewer:MapViewer = null; + + public static const scrollBar:ScrollBar = null; + + public static const slot:Slot = null; + + public static const spellZoneComponent:SpellZoneComponent = null; + + public static const swfApplication:SwfApplication = null; + + public static const tabSet:TabSet = null; + + public static const textArea:TextArea = null; + + public static const texture:Texture = null; + + public static const tree:Tree = null; + + public static const videoPlayer:VideoPlayer = null; + + public static const webBrowser:WebBrowser = null; + } +} diff --git a/com/ankamagames/berilia/utils/EmbedIcons.as b/com/ankamagames/berilia/utils/EmbedIcons.as index e5af57081..796b160b8 100644 --- a/com/ankamagames/berilia/utils/EmbedIcons.as +++ b/com/ankamagames/berilia/utils/EmbedIcons.as @@ -1,13 +1,15 @@ -package com.ankamagames.berilia.utils +package com.ankamagames.berilia.utils { - import flash.display.BitmapData; - - public class EmbedIcons - { - - public static var SLOT_DEFAULT_ICON:BitmapData; - - - } -}//package com.ankamagames.berilia.utils - + import flash.display.BitmapData; + + public class EmbedIcons extends Object + { + + public function EmbedIcons() + { + super(); + } + + public static var SLOT_DEFAULT_ICON:BitmapData; + } +} diff --git a/com/ankamagames/berilia/utils/GridItemList.as b/com/ankamagames/berilia/utils/GridItemList.as index 20d5a9bfa..5efd7ca2b 100644 --- a/com/ankamagames/berilia/utils/GridItemList.as +++ b/com/ankamagames/berilia/utils/GridItemList.as @@ -1,23 +1,30 @@ -package com.ankamagames.berilia.utils +package com.ankamagames.berilia.utils { - import com.ankamagames.berilia.components.gridRenderer.XmlUiGridRenderer; - import com.ankamagames.berilia.components.gridRenderer.SlotGridRenderer; - import com.ankamagames.berilia.components.gridRenderer.LabelGridRenderer; - import com.ankamagames.berilia.components.gridRenderer.TreeGridRenderer; - import com.ankamagames.berilia.components.gridRenderer.EntityGridRenderer; - import com.ankamagames.berilia.components.gridRenderer.MultiGridRenderer; - - public class GridItemList - { - - public static const import_XmlUiGridRenderer:XmlUiGridRenderer = null; - public static const import_SlotGridRenderer:SlotGridRenderer = null; - public static const import_LabelGridRenderer:LabelGridRenderer = null; - public static const import_TreeGridRenderer:TreeGridRenderer = null; - public static const import_EntityGridRenderer:EntityGridRenderer = null; - public static const import_MultiGridRenderer:MultiGridRenderer = null; - - - } -}//package com.ankamagames.berilia.utils - + import com.ankamagames.berilia.components.gridRenderer.XmlUiGridRenderer; + import com.ankamagames.berilia.components.gridRenderer.SlotGridRenderer; + import com.ankamagames.berilia.components.gridRenderer.LabelGridRenderer; + import com.ankamagames.berilia.components.gridRenderer.TreeGridRenderer; + import com.ankamagames.berilia.components.gridRenderer.EntityGridRenderer; + import com.ankamagames.berilia.components.gridRenderer.MultiGridRenderer; + + public class GridItemList extends Object + { + + public function GridItemList() + { + super(); + } + + public static const import_XmlUiGridRenderer:XmlUiGridRenderer = null; + + public static const import_SlotGridRenderer:SlotGridRenderer = null; + + public static const import_LabelGridRenderer:LabelGridRenderer = null; + + public static const import_TreeGridRenderer:TreeGridRenderer = null; + + public static const import_EntityGridRenderer:EntityGridRenderer = null; + + public static const import_MultiGridRenderer:MultiGridRenderer = null; + } +} diff --git a/com/ankamagames/berilia/utils/ModFlashProtocol.as b/com/ankamagames/berilia/utils/ModFlashProtocol.as index 091528c57..edd5239e8 100644 --- a/com/ankamagames/berilia/utils/ModFlashProtocol.as +++ b/com/ankamagames/berilia/utils/ModFlashProtocol.as @@ -1,54 +1,56 @@ -package com.ankamagames.berilia.utils +package com.ankamagames.berilia.utils { - import com.ankamagames.jerakine.resources.protocols.impl.FileFlashProtocol; - import com.ankamagames.jerakine.resources.protocols.IProtocol; - import com.ankamagames.jerakine.types.Uri; - import com.ankamagames.jerakine.resources.IResourceObserver; - import com.ankamagames.berilia.managers.UiModuleManager; - import com.ankamagames.jerakine.resources.ResourceObserverWrapper; - import com.ankamagames.jerakine.newCache.ICache; - - public class ModFlashProtocol extends FileFlashProtocol implements IProtocol - { - - private var _uri:Uri; - private var _observer2:IResourceObserver; - - - override public function load(uri:Uri, observer:IResourceObserver, dispatchProgress:Boolean, cache:ICache, forcedAdapter:Class, singleFile:Boolean):void - { - var moduleName:String = uri.path.substr(0, uri.path.indexOf("/")); - var path:String = (UiModuleManager.getInstance().getModulePath(moduleName) + uri.path.substr(uri.path.indexOf("/"))); - var realUri:Uri = new Uri(path); - this._uri = uri; - this._observer2 = observer; - super.load(realUri, new ResourceObserverWrapper(this._onLoaded, this._onFailed, this._onProgress), dispatchProgress, cache, forcedAdapter, singleFile); - } - - override protected function loadDirectly(uri:Uri, observer:IResourceObserver, dispatchProgress:Boolean, forcedAdapter:Class):void - { - getAdapter(uri, forcedAdapter); - var moduleName:String = uri.path.substr(0, uri.path.indexOf("/")); - var path:String = (UiModuleManager.getInstance().getModulePath(moduleName) + uri.path.substr(uri.path.indexOf("/"))); - _adapter.loadDirectly(uri, extractPath(path), observer, dispatchProgress); - } - - private function _onLoaded(uri:Uri, resourceType:uint, resource:*):void - { - this._observer2.onLoaded(this._uri, resourceType, resource); - } - - private function _onFailed(uri:Uri, errorMsg:String, errorCode:uint):void - { - this._observer2.onFailed(this._uri, errorMsg, errorCode); - } - - private function _onProgress(uri:Uri, bytesLoaded:uint, bytesTotal:uint):void - { - this._observer2.onProgress(this._uri, bytesLoaded, bytesTotal); - } - - - } -}//package com.ankamagames.berilia.utils - + import com.ankamagames.jerakine.resources.protocols.impl.FileFlashProtocol; + import com.ankamagames.jerakine.resources.protocols.IProtocol; + import com.ankamagames.jerakine.types.Uri; + import com.ankamagames.jerakine.resources.IResourceObserver; + import com.ankamagames.jerakine.newCache.ICache; + import com.ankamagames.berilia.managers.UiModuleManager; + import com.ankamagames.jerakine.resources.ResourceObserverWrapper; + + public class ModFlashProtocol extends FileFlashProtocol implements IProtocol + { + + public function ModFlashProtocol() + { + super(); + } + + private var _uri:Uri; + + private var _observer2:IResourceObserver; + + override public function load(param1:Uri, param2:IResourceObserver, param3:Boolean, param4:ICache, param5:Class, param6:Boolean) : void + { + var _loc7_:String = param1.path.substr(0,param1.path.indexOf("/")); + var _loc8_:String = UiModuleManager.getInstance().getModulePath(_loc7_) + param1.path.substr(param1.path.indexOf("/")); + var _loc9_:Uri = new Uri(_loc8_); + this._uri = param1; + this._observer2 = param2; + super.load(_loc9_,new ResourceObserverWrapper(this._onLoaded,this._onFailed,this._onProgress),param3,param4,param5,param6); + } + + override protected function loadDirectly(param1:Uri, param2:IResourceObserver, param3:Boolean, param4:Class) : void + { + getAdapter(param1,param4); + var _loc5_:String = param1.path.substr(0,param1.path.indexOf("/")); + var _loc6_:String = UiModuleManager.getInstance().getModulePath(_loc5_) + param1.path.substr(param1.path.indexOf("/")); + _adapter.loadDirectly(param1,extractPath(_loc6_),param2,param3); + } + + private function _onLoaded(param1:Uri, param2:uint, param3:*) : void + { + this._observer2.onLoaded(this._uri,param2,param3); + } + + private function _onFailed(param1:Uri, param2:String, param3:uint) : void + { + this._observer2.onFailed(this._uri,param2,param3); + } + + private function _onProgress(param1:Uri, param2:uint, param3:uint) : void + { + this._observer2.onProgress(this._uri,param2,param3); + } + } +} diff --git a/com/ankamagames/berilia/utils/ModProtocol.as b/com/ankamagames/berilia/utils/ModProtocol.as index b9368cf53..effe78546 100644 --- a/com/ankamagames/berilia/utils/ModProtocol.as +++ b/com/ankamagames/berilia/utils/ModProtocol.as @@ -1,34 +1,35 @@ -package com.ankamagames.berilia.utils +package com.ankamagames.berilia.utils { - import com.ankamagames.jerakine.resources.protocols.impl.FileProtocol; - import com.ankamagames.jerakine.resources.protocols.IProtocol; - import com.ankamagames.berilia.managers.UiModuleManager; - import com.ankamagames.jerakine.types.Uri; - import com.ankamagames.jerakine.resources.IResourceObserver; - - public class ModProtocol extends FileProtocol implements IProtocol - { - - - override protected function loadDirectly(uri:Uri, observer:IResourceObserver, dispatchProgress:Boolean, forcedAdapter:Class):void - { - getAdapter(uri, forcedAdapter); - var moduleName:String = uri.path.substr(0, uri.path.indexOf("/")); - var path:String = UiModuleManager.getInstance().getModulePath(moduleName); - var addPath:String = uri.path.substr(uri.path.indexOf("/")); - if (((!((path.charAt((path.length - 1)) == "/"))) && (!((addPath.charAt(0) == "/"))))) - { - path = (path + "/"); - }; - if ((((path.charAt((path.length - 1)) == "/")) && ((addPath.charAt(0) == "/")))) - { - addPath = addPath.substr(1); - }; - path = (path + addPath); - _adapter.loadDirectly(uri, extractPath(path), observer, dispatchProgress); - } - - - } -}//package com.ankamagames.berilia.utils - + import com.ankamagames.jerakine.resources.protocols.impl.FileProtocol; + import com.ankamagames.jerakine.resources.protocols.IProtocol; + import com.ankamagames.jerakine.types.Uri; + import com.ankamagames.jerakine.resources.IResourceObserver; + import com.ankamagames.berilia.managers.UiModuleManager; + + public class ModProtocol extends FileProtocol implements IProtocol + { + + public function ModProtocol() + { + super(); + } + + override protected function loadDirectly(param1:Uri, param2:IResourceObserver, param3:Boolean, param4:Class) : void + { + getAdapter(param1,param4); + var _loc5_:String = param1.path.substr(0,param1.path.indexOf("/")); + var _loc6_:String = UiModuleManager.getInstance().getModulePath(_loc5_); + var _loc7_:String = param1.path.substr(param1.path.indexOf("/")); + if(!(_loc6_.charAt(_loc6_.length - 1) == "/") && !(_loc7_.charAt(0) == "/")) + { + _loc6_ = _loc6_ + "/"; + } + if(_loc6_.charAt(_loc6_.length - 1) == "/" && _loc7_.charAt(0) == "/") + { + _loc7_ = _loc7_.substr(1); + } + _loc6_ = _loc6_ + _loc7_; + _adapter.loadDirectly(param1,extractPath(_loc6_),param2,param3); + } + } +} diff --git a/com/ankamagames/berilia/utils/ModuleFileManager.as b/com/ankamagames/berilia/utils/ModuleFileManager.as index 4ef94845d..f0462c2ff 100644 --- a/com/ankamagames/berilia/utils/ModuleFileManager.as +++ b/com/ankamagames/berilia/utils/ModuleFileManager.as @@ -1,131 +1,134 @@ -package com.ankamagames.berilia.utils +package com.ankamagames.berilia.utils { - import flash.utils.Dictionary; - import com.ankamagames.jerakine.utils.errors.SingletonError; - import com.ankamagames.berilia.managers.UiModuleManager; - import com.ankamagames.berilia.types.data.UiModule; - import com.ankamagames.jerakine.types.Uri; - import flash.filesystem.File; - - public class ModuleFileManager - { - - public static const MAX_FILE_NUM:uint = 1000; - public static const MAX_FILE_SIZE:uint = Math.pow(2, 20); - private static var _self:ModuleFileManager; - - private var _moduleSizes:Dictionary; - private var _moduleFilesNum:Dictionary; - - public function ModuleFileManager() - { - this._moduleSizes = new Dictionary(); - this._moduleFilesNum = new Dictionary(); - super(); - if (_self) + import flash.utils.Dictionary; + import com.ankamagames.berilia.managers.UiModuleManager; + import com.ankamagames.berilia.types.data.UiModule; + import com.ankamagames.jerakine.types.Uri; + import flash.filesystem.File; + import com.ankamagames.jerakine.utils.errors.SingletonError; + + public class ModuleFileManager extends Object + { + + public function ModuleFileManager() + { + this._moduleSizes = new Dictionary(); + this._moduleFilesNum = new Dictionary(); + super(); + if(_self) + { + throw new SingletonError(); + } + else + { + return; + } + } + + public static const MAX_FILE_NUM:uint = 1000; + + public static const MAX_FILE_SIZE:uint = Math.pow(2,20); + + private static var _self:ModuleFileManager; + + public static function getInstance() : ModuleFileManager + { + if(!_self) + { + _self = new ModuleFileManager(); + } + return _self; + } + + private var _moduleSizes:Dictionary; + + private var _moduleFilesNum:Dictionary; + + public function initModuleFiles(param1:String) : void + { + if(this._moduleSizes[param1] != null) + { + return; + } + var _loc2_:UiModule = UiModuleManager.getInstance().getModule(param1); + var _loc3_:File = new Uri(_loc2_.storagePath).toFile(); + if(!_loc3_.exists) + { + _loc3_.createDirectory(); + } + this.updateFolderSize(_loc3_,param1); + } + + public function updateModuleSize(param1:String, param2:int) : void + { + this.initModuleFiles(param1); + this._moduleSizes[param1] = this._moduleSizes[param1] + param2; + } + + public function updateModuleFileNum(param1:String, param2:int) : void + { + this.initModuleFiles(param1); + this._moduleFilesNum[param1] = this._moduleFilesNum[param1] + param2; + } + + public function canCreateFiles(param1:String, param2:uint = 0) : Boolean + { + return this._moduleFilesNum[param1] < MAX_FILE_NUM; + } + + public function canAddSize(param1:String, param2:uint = 0) : Boolean + { + return this._moduleSizes[param1] < MAX_FILE_SIZE; + } + + public function getAvaibleSpace(param1:String) : uint + { + return Math.max(MAX_FILE_SIZE - this._moduleSizes[param1],0); + } + + public function getUsedSpace(param1:String) : uint + { + return this._moduleSizes[param1]; + } + + public function getMaxSpace(param1:String) : uint + { + return MAX_FILE_SIZE; + } + + public function getMaxFileCount(param1:String) : uint + { + return MAX_FILE_NUM; + } + + public function getUsedFileCount(param1:String) : uint + { + return this._moduleFilesNum[param1]; + } + + private function updateFolderSize(param1:File, param2:String) : void + { + var _loc5_:File = null; + if(this._moduleSizes[param2] == null) + { + this._moduleSizes[param2] = 0; + this._moduleFilesNum[param2] = 0; + } + var _loc3_:uint = 0; + var _loc4_:Array = param1.getDirectoryListing(); + for each(_loc5_ in _loc4_) + { + if(_loc5_.isDirectory) { - throw (new SingletonError()); - }; - } - - public static function getInstance():ModuleFileManager - { - if (!(_self)) + this.updateFolderSize(_loc5_,param2); + } + else { - _self = new (ModuleFileManager)(); - }; - return (_self); - } - - - public function initModuleFiles(moduleId:String):void - { - if (this._moduleSizes[moduleId] != null) - { - return; - }; - var module:UiModule = UiModuleManager.getInstance().getModule(moduleId); - var folder:File = new Uri(module.storagePath).toFile(); - if (!(folder.exists)) - { - folder.createDirectory(); - }; - this.updateFolderSize(folder, moduleId); - } - - public function updateModuleSize(moduleId:String, delta:int):void - { - this.initModuleFiles(moduleId); - this._moduleSizes[moduleId] = (this._moduleSizes[moduleId] + delta); - } - - public function updateModuleFileNum(moduleId:String, delta:int):void - { - this.initModuleFiles(moduleId); - this._moduleFilesNum[moduleId] = (this._moduleFilesNum[moduleId] + delta); - } - - public function canCreateFiles(moduleId:String, amount:uint=0):Boolean - { - return ((this._moduleFilesNum[moduleId] < MAX_FILE_NUM)); - } - - public function canAddSize(moduleId:String, amount:uint=0):Boolean - { - return ((this._moduleSizes[moduleId] < MAX_FILE_SIZE)); - } - - public function getAvaibleSpace(moduleId:String):uint - { - return (Math.max((MAX_FILE_SIZE - this._moduleSizes[moduleId]), 0)); - } - - public function getUsedSpace(moduleId:String):uint - { - return (this._moduleSizes[moduleId]); - } - - public function getMaxSpace(moduleId:String):uint - { - return (MAX_FILE_SIZE); - } - - public function getMaxFileCount(moduleId:String):uint - { - return (MAX_FILE_NUM); - } - - public function getUsedFileCount(moduleId:String):uint - { - return (this._moduleFilesNum[moduleId]); - } - - private function updateFolderSize(folder:File, moduleId:String):void - { - var file:File; - if (this._moduleSizes[moduleId] == null) - { - this._moduleSizes[moduleId] = 0; - this._moduleFilesNum[moduleId] = 0; - }; - var size:uint; - var files:Array = folder.getDirectoryListing(); - for each (file in files) - { - if (file.isDirectory) - { - this.updateFolderSize(file, moduleId); - } - else - { - size = (size + file.size); - }; - }; - this._moduleSizes[moduleId] = (this._moduleSizes[moduleId] + size); - this._moduleFilesNum[moduleId] = (this._moduleFilesNum[moduleId] + files.length); - } - - - } -}//package com.ankamagames.berilia.utils - + _loc3_ = _loc3_ + _loc5_.size; + } + } + this._moduleSizes[param2] = this._moduleSizes[param2] + _loc3_; + this._moduleFilesNum[param2] = this._moduleFilesNum[param2] + _loc4_.length; + } + } +} diff --git a/com/ankamagames/berilia/utils/ModuleInspector.as b/com/ankamagames/berilia/utils/ModuleInspector.as index 0910b8cc2..d3e4728db 100644 --- a/com/ankamagames/berilia/utils/ModuleInspector.as +++ b/com/ankamagames/berilia/utils/ModuleInspector.as @@ -1,194 +1,197 @@ -package com.ankamagames.berilia.utils +package com.ankamagames.berilia.utils { - import nochump.util.zip.ZipEntry; - import nochump.util.zip.ZipFile; - import flash.filesystem.File; - import flash.filesystem.FileStream; - import flash.utils.ByteArray; - import flash.filesystem.FileMode; - import com.ankamagames.jerakine.managers.StoreDataManager; - import com.ankamagames.berilia.BeriliaConstants; - import com.ankamagames.jerakine.utils.crypto.Signature; - import com.ankamagames.berilia.managers.UiModuleManager; - import flash.utils.Dictionary; - import by.blooddy.crypto.MD5; - import com.ankamagames.jerakine.resources.adapters.impl.SignedFileAdapter; - import org.as3commons.bytecode.tags.DoABCTag; - import org.as3commons.bytecode.abc.AbcFile; - import org.as3commons.bytecode.abc.ClassInfo; - import org.as3commons.bytecode.tags.FileAttributesTag; - import org.as3commons.bytecode.swf.SWFFileIO; - import org.as3commons.bytecode.swf.SWFFile; - - public class ModuleInspector - { - - public static const whiteList:Array = new Array("dm", "swf", "xml", "txt", "png", "jpg", "css"); - - - public static function checkArchiveValidity(archive:ZipFile):Boolean - { - var entry:ZipEntry; - var dotIndex:int; - var fileType:String; - var totalSize:int; - for each (entry in archive.entries) + import nochump.util.zip.ZipFile; + import nochump.util.zip.ZipEntry; + import flash.filesystem.File; + import flash.filesystem.FileStream; + import flash.utils.ByteArray; + import flash.filesystem.FileMode; + import com.ankamagames.jerakine.managers.StoreDataManager; + import com.ankamagames.berilia.BeriliaConstants; + import com.ankamagames.jerakine.utils.crypto.Signature; + import com.ankamagames.berilia.managers.UiModuleManager; + import flash.utils.Dictionary; + import by.blooddy.crypto.MD5; + import com.ankamagames.jerakine.resources.adapters.impl.SignedFileAdapter; + import org.as3commons.bytecode.tags.DoABCTag; + import org.as3commons.bytecode.abc.AbcFile; + import org.as3commons.bytecode.abc.ClassInfo; + import org.as3commons.bytecode.tags.FileAttributesTag; + import org.as3commons.bytecode.swf.SWFFileIO; + import org.as3commons.bytecode.swf.SWFFile; + + public class ModuleInspector extends Object + { + + public function ModuleInspector() + { + super(); + } + + public static const whiteList:Array = new Array("dm","swf","xml","txt","png","jpg","css"); + + public static function checkArchiveValidity(param1:ZipFile) : Boolean + { + var _loc3_:ZipEntry = null; + var _loc4_:* = 0; + var _loc5_:String = null; + var _loc2_:* = 0; + for each(_loc3_ in param1.entries) + { + _loc4_ = _loc3_.name.lastIndexOf("."); + _loc5_ = _loc3_.name.substring(_loc4_ + 1); + if(!_loc3_.isDirectory() && whiteList.indexOf(_loc5_) == -1) { - dotIndex = entry.name.lastIndexOf("."); - fileType = entry.name.substring((dotIndex + 1)); - if (((!(entry.isDirectory())) && ((whiteList.indexOf(fileType) == -1)))) - { - return (false); - }; - totalSize = (totalSize + entry.size); - }; - return ((((totalSize < ModuleFileManager.MAX_FILE_SIZE)) && ((archive.size < ModuleFileManager.MAX_FILE_NUM)))); - } - - public static function getDmFile(targetFile:File):XML - { - var entry:File; - var dmData:XML; - var rfs:FileStream; - var rawData:ByteArray = new ByteArray(); - if (targetFile.exists) - { - for each (entry in targetFile.getDirectoryListing()) - { - if (!(entry.isDirectory)) - { - if (entry.type == ".dm") - { - if (entry.name.lastIndexOf("/") != -1) - { - return (null); - }; - rfs = new FileStream(); - rfs.open(File(entry), FileMode.READ); - rfs.readBytes(rawData, 0, rfs.bytesAvailable); - rfs.close(); - dmData = new XML(rawData.readUTFBytes(rawData.bytesAvailable)); - return (dmData); - }; - }; - }; - }; - return (null); - } - - public static function getZipDmFile(targetFile:ZipFile):XML - { - var entry:ZipEntry; - var dmData:XML; - var dotIndex:int; - var fileType:String; - var rawData:ByteArray = new ByteArray(); - for each (entry in targetFile.entries) - { - if (!(entry.isDirectory())) - { - dotIndex = entry.name.lastIndexOf("."); - fileType = entry.name.substring((dotIndex + 1)); - if (fileType.toLowerCase() == "dm") - { - if (entry.name.lastIndexOf("/") != -1) - { - return (null); - }; - rawData = ZipFile(targetFile).getInput(entry); - dmData = new XML(rawData.readUTFBytes(rawData.bytesAvailable)); - return (dmData); - }; - }; - }; - return (null); - } - - public static function isModuleEnabled(moduleId:String, trusted:Boolean):Boolean - { - var enable:Boolean; - var state:* = StoreDataManager.getInstance().getData(BeriliaConstants.DATASTORE_MOD, moduleId); - if (state == null) + return false; + } + _loc2_ = _loc2_ + _loc3_.size; + } + return _loc2_ < ModuleFileManager.MAX_FILE_SIZE && param1.size < ModuleFileManager.MAX_FILE_NUM; + } + + public static function getDmFile(param1:File) : XML + { + var _loc2_:File = null; + var _loc4_:XML = null; + var _loc5_:FileStream = null; + var _loc3_:ByteArray = new ByteArray(); + if(param1.exists) + { + for each(_loc2_ in param1.getDirectoryListing()) { - enable = trusted; + if(!_loc2_.isDirectory) + { + if(_loc2_.type == ".dm") + { + if(_loc2_.name.lastIndexOf("/") != -1) + { + return null; + } + _loc5_ = new FileStream(); + _loc5_.open(File(_loc2_),FileMode.READ); + _loc5_.readBytes(_loc3_,0,_loc5_.bytesAvailable); + _loc5_.close(); + _loc4_ = new XML(_loc3_.readUTFBytes(_loc3_.bytesAvailable)); + return _loc4_; + } + } } - else + } + return null; + } + + public static function getZipDmFile(param1:ZipFile) : XML + { + var _loc2_:ZipEntry = null; + var _loc4_:XML = null; + var _loc5_:* = 0; + var _loc6_:String = null; + var _loc3_:ByteArray = new ByteArray(); + for each(_loc2_ in param1.entries) + { + if(!_loc2_.isDirectory()) { - enable = ((state) || (trusted)); - }; - return (enable); - } - - public static function checkIfModuleTrusted(filePath:String):Boolean - { - var fs:FileStream; - var swfContent:ByteArray; - var fooOutput:ByteArray; - var sig:Signature; - var scriptFile:File = new File(filePath); - var modulesHashs:Dictionary = UiModuleManager.getInstance().modulesHashs; - if (scriptFile.exists) + _loc5_ = _loc2_.name.lastIndexOf("."); + _loc6_ = _loc2_.name.substring(_loc5_ + 1); + if(_loc6_.toLowerCase() == "dm") + { + if(_loc2_.name.lastIndexOf("/") != -1) + { + return null; + } + _loc3_ = ZipFile(param1).getInput(_loc2_); + _loc4_ = new XML(_loc3_.readUTFBytes(_loc3_.bytesAvailable)); + return _loc4_; + } + } + } + return null; + } + + public static function isModuleEnabled(param1:String, param2:Boolean) : Boolean + { + var _loc4_:* = false; + var _loc3_:* = StoreDataManager.getInstance().getData(BeriliaConstants.DATASTORE_MOD,param1); + if(_loc3_ == null) + { + _loc4_ = param2; + } + else + { + _loc4_ = (_loc3_) || (param2); + } + return _loc4_; + } + + public static function checkIfModuleTrusted(param1:String) : Boolean + { + var _loc4_:FileStream = null; + var _loc5_:ByteArray = null; + var _loc6_:ByteArray = null; + var _loc7_:Signature = null; + var _loc2_:File = new File(param1); + var _loc3_:Dictionary = UiModuleManager.getInstance().modulesHashs; + if(_loc2_.exists) + { + _loc4_ = new FileStream(); + _loc4_.open(_loc2_,FileMode.READ); + _loc5_ = new ByteArray(); + _loc4_.readBytes(_loc5_); + _loc4_.close(); + if(_loc2_.type == ".swf") { - fs = new FileStream(); - fs.open(scriptFile, FileMode.READ); - swfContent = new ByteArray(); - fs.readBytes(swfContent); - fs.close(); - if (scriptFile.type == ".swf") - { - return ((MD5.hashBytes(swfContent) == modulesHashs[scriptFile.name])); - }; - if (scriptFile.type == ".swfs") - { - fooOutput = new ByteArray(); - sig = new Signature(SignedFileAdapter.defaultSignatureKey); - return (sig.verify(swfContent, fooOutput)); - }; - }; - return (false); - } - - public static function getScriptHookAndAction(swfContent:ByteArray):Object - { - var tag:DoABCTag; - var abcFile:AbcFile; - var infos:ClassInfo; - var attributesTag:FileAttributesTag; - var fileAttributesTags:Array; - var apiHookAction:* = new Object(); - var io:SWFFileIO = new SWFFileIO(); - var swfFile:SWFFile = io.read(swfContent); - apiHookAction.actions = new Array(); - apiHookAction.apis = new Array(); - apiHookAction.hooks = new Array(); - for each (tag in swfFile.getTagsByType(DoABCTag)) + return MD5.hashBytes(_loc5_) == _loc3_[_loc2_.name]; + } + if(_loc2_.type == ".swfs") { - abcFile = tag.abcFile; - for each (infos in abcFile.classInfo) - { - switch (infos.classMultiname.nameSpace.name) - { - case "d2hooks": - apiHookAction.hooks.push(infos.classMultiname.name); - break; - case "d2actions": - apiHookAction.actions.push(infos.classMultiname.name); - break; - case "d2api": - apiHookAction.apis.push(infos.classMultiname.name); - break; - }; - }; - }; - fileAttributesTags = swfFile.getTagsByType(FileAttributesTag); - for each (attributesTag in fileAttributesTags) + _loc6_ = new ByteArray(); + _loc7_ = new Signature(SignedFileAdapter.defaultSignatureKey); + return _loc7_.verify(_loc5_,_loc6_); + } + } + return false; + } + + public static function getScriptHookAndAction(param1:ByteArray) : Object + { + var _loc4_:DoABCTag = null; + var _loc5_:AbcFile = null; + var _loc6_:ClassInfo = null; + var _loc7_:FileAttributesTag = null; + var _loc9_:Array = null; + var _loc2_:* = new Object(); + var _loc3_:SWFFileIO = new SWFFileIO(); + var _loc8_:SWFFile = _loc3_.read(param1); + _loc2_.actions = new Array(); + _loc2_.apis = new Array(); + _loc2_.hooks = new Array(); + for each(_loc4_ in _loc8_.getTagsByType(DoABCTag)) + { + _loc5_ = _loc4_.abcFile; + for each(_loc6_ in _loc5_.classInfo) { - apiHookAction.useNetwork = attributesTag.useNetwork; - }; - return (apiHookAction); - } - - - } -}//package com.ankamagames.berilia.utils - + switch(_loc6_.classMultiname.nameSpace.name) + { + case "d2hooks": + _loc2_.hooks.push(_loc6_.classMultiname.name); + continue; + case "d2actions": + _loc2_.actions.push(_loc6_.classMultiname.name); + continue; + case "d2api": + _loc2_.apis.push(_loc6_.classMultiname.name); + continue; + default: + continue; + } + } + } + _loc9_ = _loc8_.getTagsByType(FileAttributesTag); + for each(_loc7_ in _loc9_) + { + _loc2_.useNetwork = _loc7_.useNetwork; + } + return _loc2_; + } + } +} diff --git a/com/ankamagames/berilia/utils/ModuleScriptAnalyzer.as b/com/ankamagames/berilia/utils/ModuleScriptAnalyzer.as index fe4a5c7c9..2dd937b43 100644 --- a/com/ankamagames/berilia/utils/ModuleScriptAnalyzer.as +++ b/com/ankamagames/berilia/utils/ModuleScriptAnalyzer.as @@ -1,163 +1,163 @@ -package com.ankamagames.berilia.utils +package com.ankamagames.berilia.utils { - import flash.utils.Dictionary; - import com.ankamagames.jerakine.resources.loaders.IResourceLoader; - import com.ankamagames.jerakine.types.Uri; - import com.ankamagames.jerakine.resources.loaders.ResourceLoaderFactory; - import com.ankamagames.jerakine.resources.loaders.ResourceLoaderType; - import com.ankamagames.berilia.managers.UiModuleManager; - import flash.system.ApplicationDomain; - import flash.filesystem.File; - import com.ankamagames.berilia.utils.web.HttpServer; - import com.ankamagames.jerakine.resources.events.ResourceLoadedEvent; - import com.ankamagames.jerakine.resources.events.ResourceErrorEvent; - import com.ankamagames.jerakine.resources.adapters.impl.AdvancedSwfAdapter; - import flash.utils.setTimeout; - import com.ankamagames.berilia.types.data.UiModule; - import com.ankamagames.jerakine.types.ASwf; - - public class ModuleScriptAnalyzer - { - - private static var _actionList:Dictionary; - private static var _apiList:Dictionary; - private static var _hookList:Dictionary; - - private var _loader:IResourceLoader; - private var _actions:Array; - private var _hooks:Array; - private var _apis:Array; - private var _readyFct:Function; - - public function ModuleScriptAnalyzer(target:UiModule, readyFct:Function, appDomain:ApplicationDomain=null, targetScriptLocation:String="") - { - var tmpList:Array; - var action:String; - var api:String; - var hook:String; - var uri:Uri; - var scriptUrl:String; - var mp:String; - this._loader = ResourceLoaderFactory.getLoader(ResourceLoaderType.SINGLE_LOADER); - this._actions = []; - this._hooks = []; - this._apis = []; - super(); - if (!(_actionList)) + import flash.utils.Dictionary; + import com.ankamagames.jerakine.resources.loaders.IResourceLoader; + import com.ankamagames.jerakine.resources.events.ResourceLoadedEvent; + import com.ankamagames.jerakine.types.ASwf; + import com.ankamagames.jerakine.resources.events.ResourceErrorEvent; + import flash.system.ApplicationDomain; + import com.ankamagames.berilia.types.data.UiModule; + import com.ankamagames.jerakine.types.Uri; + import com.ankamagames.jerakine.resources.loaders.ResourceLoaderFactory; + import com.ankamagames.jerakine.resources.loaders.ResourceLoaderType; + import com.ankamagames.berilia.managers.UiModuleManager; + import flash.filesystem.File; + import com.ankamagames.berilia.utils.web.HttpServer; + import com.ankamagames.jerakine.resources.adapters.impl.AdvancedSwfAdapter; + import flash.utils.setTimeout; + + public class ModuleScriptAnalyzer extends Object + { + + public function ModuleScriptAnalyzer(param1:UiModule, param2:Function, param3:ApplicationDomain = null, param4:String = "") + { + var _loc5_:Array = null; + var _loc6_:String = null; + var _loc7_:String = null; + var _loc8_:String = null; + var _loc9_:Uri = null; + var _loc10_:String = null; + var _loc11_:String = null; + this._loader = ResourceLoaderFactory.getLoader(ResourceLoaderType.SINGLE_LOADER); + this._actions = []; + this._hooks = []; + this._apis = []; + super(); + if(!_actionList) + { + _actionList = new Dictionary(); + _loc5_ = UiModuleManager.getInstance().sharedDefinitionInstance.getActionList(); + for each(_actionList[_loc6_] in _loc5_) { - _actionList = new Dictionary(); - tmpList = UiModuleManager.getInstance().sharedDefinitionInstance.getActionList(); - for each (action in tmpList) - { - _actionList[action] = action; - }; - _apiList = new Dictionary(); - tmpList = UiModuleManager.getInstance().sharedDefinitionInstance.getApiList(); - for each (api in tmpList) - { - _apiList[api] = api; - }; - _hookList = new Dictionary(); - tmpList = UiModuleManager.getInstance().sharedDefinitionInstance.getHookList(); - for each (hook in tmpList) - { - _hookList[hook] = hook; - }; - }; - this._readyFct = readyFct; - if (!(appDomain)) + } + _apiList = new Dictionary(); + _loc5_ = UiModuleManager.getInstance().sharedDefinitionInstance.getApiList(); + for each(_apiList[_loc7_] in _loc5_) + { + } + _hookList = new Dictionary(); + _loc5_ = UiModuleManager.getInstance().sharedDefinitionInstance.getHookList(); + for each(_hookList[_loc8_] in _loc5_) + { + } + } + this._readyFct = param2; + if(!param3) + { + if(param1) + { + _loc10_ = param1.script; + } + else + { + _loc10_ = param4; + } + if(ApplicationDomain.currentDomain.hasDefinition("flash.net.ServerSocket")) { - if (target) - { - scriptUrl = target.script; - } - else - { - scriptUrl = targetScriptLocation; - }; - if (ApplicationDomain.currentDomain.hasDefinition("flash.net.ServerSocket")) - { - mp = File.applicationDirectory.nativePath.split("\\").join("/"); - if (scriptUrl.indexOf(mp) != -1) - { - scriptUrl = scriptUrl.substr((scriptUrl.indexOf(mp) + mp.length)); - }; - scriptUrl = HttpServer.getInstance().getUrlTo(scriptUrl); - } - else - { - throw (new Error("Need Air 2 to analyze module script")); - }; - uri = new Uri(scriptUrl); - this._loader.addEventListener(ResourceLoadedEvent.LOADED, this.onSwfLoaded); - this._loader.addEventListener(ResourceErrorEvent.ERROR, this.onSwfFailed); - this._loader.load(uri, null, AdvancedSwfAdapter, true); + _loc11_ = File.applicationDirectory.nativePath.split("\\").join("/"); + if(_loc10_.indexOf(_loc11_) != -1) + { + _loc10_ = _loc10_.substr(_loc10_.indexOf(_loc11_) + _loc11_.length); + } + _loc10_ = HttpServer.getInstance().getUrlTo(_loc10_); + _loc9_ = new Uri(_loc10_); + this._loader.addEventListener(ResourceLoadedEvent.LOADED,this.onSwfLoaded); + this._loader.addEventListener(ResourceErrorEvent.ERROR,this.onSwfFailed); + this._loader.load(_loc9_,null,AdvancedSwfAdapter,true); } else { - this.process(appDomain); - setTimeout(readyFct, 1); - }; - } - - public function get actions():Array - { - return (this._actions); - } - - public function get hooks():Array - { - return (this._hooks); - } - - public function get apis():Array - { - return (this._apis); - } - - private function onSwfLoaded(e:ResourceLoadedEvent):void - { - var aswf:ASwf = e.resource; - this._loader.removeEventListener(ResourceLoadedEvent.LOADED, this.onSwfLoaded); - this._loader.removeEventListener(ResourceErrorEvent.ERROR, this.onSwfFailed); - this.process(aswf.applicationDomain); - this._readyFct(); - } - - private function process(appDomain:ApplicationDomain):void - { - var action:String; - var hook:String; - var api:String; - for each (action in _actionList) + throw new Error("Need Air 2 to analyze module script"); + } + } + else + { + this.process(param3); + setTimeout(param2,1); + } + } + + private static var _actionList:Dictionary; + + private static var _apiList:Dictionary; + + private static var _hookList:Dictionary; + + private var _loader:IResourceLoader; + + private var _actions:Array; + + private var _hooks:Array; + + private var _apis:Array; + + private var _readyFct:Function; + + public function get actions() : Array + { + return this._actions; + } + + public function get hooks() : Array + { + return this._hooks; + } + + public function get apis() : Array + { + return this._apis; + } + + private function onSwfLoaded(param1:ResourceLoadedEvent) : void + { + var _loc2_:ASwf = param1.resource; + this._loader.removeEventListener(ResourceLoadedEvent.LOADED,this.onSwfLoaded); + this._loader.removeEventListener(ResourceErrorEvent.ERROR,this.onSwfFailed); + this.process(_loc2_.applicationDomain); + this._readyFct(); + } + + private function process(param1:ApplicationDomain) : void + { + var _loc2_:String = null; + var _loc3_:String = null; + var _loc4_:String = null; + for each(_loc2_ in _actionList) + { + if(param1.hasDefinition("d2actions::" + _loc2_)) { - if (appDomain.hasDefinition(("d2actions::" + action))) - { - this._actions.push(action); - }; - }; - for each (hook in _hookList) + this._actions.push(_loc2_); + } + } + for each(_loc3_ in _hookList) + { + if(param1.hasDefinition("d2hooks::" + _loc3_)) { - if (appDomain.hasDefinition(("d2hooks::" + hook))) - { - this._hooks.push(hook); - }; - }; - for each (api in _apiList) + this._hooks.push(_loc3_); + } + } + for each(_loc4_ in _apiList) + { + if(param1.hasDefinition("d2api::" + _loc4_)) { - if (appDomain.hasDefinition(("d2api::" + api))) - { - this._apis.push(api); - }; - }; - } - - private function onSwfFailed(e:ResourceErrorEvent):void - { - this._readyFct(); - } - - - } -}//package com.ankamagames.berilia.utils - + this._apis.push(_loc4_); + } + } + } + + private function onSwfFailed(param1:ResourceErrorEvent) : void + { + this._readyFct(); + } + } +} diff --git a/com/ankamagames/berilia/utils/ThemeFlashProtocol.as b/com/ankamagames/berilia/utils/ThemeFlashProtocol.as index fae396f92..c4cfb1719 100644 --- a/com/ankamagames/berilia/utils/ThemeFlashProtocol.as +++ b/com/ankamagames/berilia/utils/ThemeFlashProtocol.as @@ -1,67 +1,69 @@ -package com.ankamagames.berilia.utils +package com.ankamagames.berilia.utils { - import com.ankamagames.jerakine.resources.protocols.impl.FileFlashProtocol; - import com.ankamagames.jerakine.resources.protocols.IProtocol; - import com.ankamagames.jerakine.types.Uri; - import com.ankamagames.jerakine.resources.IResourceObserver; - import com.ankamagames.jerakine.data.XmlConfig; - import com.ankamagames.jerakine.resources.ResourceObserverWrapper; - import com.ankamagames.jerakine.newCache.ICache; - - public class ThemeFlashProtocol extends FileFlashProtocol implements IProtocol - { - - private static var _themePath:String; - - private var _uri:Uri; - private var _observer2:IResourceObserver; - - - override public function load(uri:Uri, observer:IResourceObserver, dispatchProgress:Boolean, cache:ICache, forcedAdapter:Class, singleFile:Boolean):void - { - var path:String; - this._uri = uri; - this._observer2 = observer; - if (!(_themePath)) - { - _themePath = XmlConfig.getInstance().getEntry("config.ui.skin"); - }; - if (uri.protocol == "theme") - { - path = (_themePath + uri.path.replace("file://", "")); - } - else - { - path = uri.path.replace("file://", ""); - }; - var realUri:Uri = new Uri(path); - super.load(realUri, new ResourceObserverWrapper(this._onLoaded, this._onFailed, this._onProgress), dispatchProgress, cache, forcedAdapter, singleFile); - } - - override protected function loadDirectly(uri:Uri, observer:IResourceObserver, dispatchProgress:Boolean, forcedAdapter:Class):void - { - getAdapter(uri, forcedAdapter); - var path:String = uri.path; - trace(path); - _adapter.loadDirectly(uri, extractPath(path), observer, dispatchProgress); - } - - private function _onLoaded(uri:Uri, resourceType:uint, resource:*):void - { - this._observer2.onLoaded(this._uri, resourceType, resource); - } - - private function _onFailed(uri:Uri, errorMsg:String, errorCode:uint):void - { - this._observer2.onFailed(this._uri, errorMsg, errorCode); - } - - private function _onProgress(uri:Uri, bytesLoaded:uint, bytesTotal:uint):void - { - this._observer2.onProgress(this._uri, bytesLoaded, bytesTotal); - } - - - } -}//package com.ankamagames.berilia.utils - + import com.ankamagames.jerakine.resources.protocols.impl.FileFlashProtocol; + import com.ankamagames.jerakine.resources.protocols.IProtocol; + import com.ankamagames.jerakine.types.Uri; + import com.ankamagames.jerakine.resources.IResourceObserver; + import com.ankamagames.jerakine.newCache.ICache; + import com.ankamagames.jerakine.data.XmlConfig; + import com.ankamagames.jerakine.resources.ResourceObserverWrapper; + + public class ThemeFlashProtocol extends FileFlashProtocol implements IProtocol + { + + public function ThemeFlashProtocol() + { + super(); + } + + private static var _themePath:String; + + private var _uri:Uri; + + private var _observer2:IResourceObserver; + + override public function load(param1:Uri, param2:IResourceObserver, param3:Boolean, param4:ICache, param5:Class, param6:Boolean) : void + { + var _loc7_:String = null; + this._uri = param1; + this._observer2 = param2; + if(!_themePath) + { + _themePath = XmlConfig.getInstance().getEntry("config.ui.skin"); + } + if(param1.protocol == "theme") + { + _loc7_ = _themePath + param1.path.replace("file://",""); + } + else + { + _loc7_ = param1.path.replace("file://",""); + } + var _loc8_:Uri = new Uri(_loc7_); + super.load(_loc8_,new ResourceObserverWrapper(this._onLoaded,this._onFailed,this._onProgress),param3,param4,param5,param6); + } + + override protected function loadDirectly(param1:Uri, param2:IResourceObserver, param3:Boolean, param4:Class) : void + { + getAdapter(param1,param4); + var _loc5_:String = param1.path; + trace(_loc5_); + _adapter.loadDirectly(param1,extractPath(_loc5_),param2,param3); + } + + private function _onLoaded(param1:Uri, param2:uint, param3:*) : void + { + this._observer2.onLoaded(this._uri,param2,param3); + } + + private function _onFailed(param1:Uri, param2:String, param3:uint) : void + { + this._observer2.onFailed(this._uri,param2,param3); + } + + private function _onProgress(param1:Uri, param2:uint, param3:uint) : void + { + this._observer2.onProgress(this._uri,param2,param3); + } + } +} diff --git a/com/ankamagames/berilia/utils/ThemeProtocol.as b/com/ankamagames/berilia/utils/ThemeProtocol.as index 19f3bec42..d9f613dd1 100644 --- a/com/ankamagames/berilia/utils/ThemeProtocol.as +++ b/com/ankamagames/berilia/utils/ThemeProtocol.as @@ -1,37 +1,38 @@ -package com.ankamagames.berilia.utils +package com.ankamagames.berilia.utils { - import com.ankamagames.jerakine.resources.protocols.impl.FileProtocol; - import com.ankamagames.jerakine.resources.protocols.IProtocol; - import com.ankamagames.jerakine.data.XmlConfig; - import com.ankamagames.jerakine.types.Uri; - import com.ankamagames.jerakine.resources.IResourceObserver; - - public class ThemeProtocol extends FileProtocol implements IProtocol - { - - private static var _themePath:String; - - - override protected function loadDirectly(uri:Uri, observer:IResourceObserver, dispatchProgress:Boolean, forcedAdapter:Class):void - { - var path:String; - getAdapter(uri, forcedAdapter); - if (!(_themePath)) - { - _themePath = XmlConfig.getInstance().getEntry("config.ui.skin"); - }; - if (uri.protocol == "theme") - { - path = (_themePath + uri.path); - } - else - { - path = uri.path; - }; - _adapter.loadDirectly(uri, extractPath(path.split("file://").join("")), observer, dispatchProgress); - } - - - } -}//package com.ankamagames.berilia.utils - + import com.ankamagames.jerakine.resources.protocols.impl.FileProtocol; + import com.ankamagames.jerakine.resources.protocols.IProtocol; + import com.ankamagames.jerakine.types.Uri; + import com.ankamagames.jerakine.resources.IResourceObserver; + import com.ankamagames.jerakine.data.XmlConfig; + + public class ThemeProtocol extends FileProtocol implements IProtocol + { + + public function ThemeProtocol() + { + super(); + } + + private static var _themePath:String; + + override protected function loadDirectly(param1:Uri, param2:IResourceObserver, param3:Boolean, param4:Class) : void + { + var _loc5_:String = null; + getAdapter(param1,param4); + if(!_themePath) + { + _themePath = XmlConfig.getInstance().getEntry("config.ui.skin"); + } + if(param1.protocol == "theme") + { + _loc5_ = _themePath + param1.path; + } + else + { + _loc5_ = param1.path; + } + _adapter.loadDirectly(param1,extractPath(_loc5_.split("file://").join("")),param2,param3); + } + } +} diff --git a/com/ankamagames/berilia/utils/UiProperties.as b/com/ankamagames/berilia/utils/UiProperties.as index f93e33b55..b7f389ec0 100644 --- a/com/ankamagames/berilia/utils/UiProperties.as +++ b/com/ankamagames/berilia/utils/UiProperties.as @@ -1,9 +1,11 @@ -package com.ankamagames.berilia.utils +package com.ankamagames.berilia.utils { - public class UiProperties - { - - - } -}//package com.ankamagames.berilia.utils - + public class UiProperties extends Object + { + + public function UiProperties() + { + super(); + } + } +} diff --git a/com/ankamagames/berilia/utils/UriCacheFactory.as b/com/ankamagames/berilia/utils/UriCacheFactory.as index e1680f61a..af249c167 100644 --- a/com/ankamagames/berilia/utils/UriCacheFactory.as +++ b/com/ankamagames/berilia/utils/UriCacheFactory.as @@ -1,44 +1,46 @@ -package com.ankamagames.berilia.utils +package com.ankamagames.berilia.utils { - import com.ankamagames.jerakine.logger.Logger; - import com.ankamagames.jerakine.logger.Log; - import flash.utils.getQualifiedClassName; - import com.ankamagames.jerakine.newCache.ICache; - import com.ankamagames.jerakine.types.Uri; - - public class UriCacheFactory - { - - private static var _log:Logger = Log.getLogger(getQualifiedClassName(UriCacheFactory)); - private static var _aCache:Array = new Array(); - - - public static function init(path:String, cacheClass:ICache):ICache - { - _aCache[path] = cacheClass; - return (cacheClass); - } - - public static function getCacheFromUri(uri:Uri):ICache - { - var key:String; - var currentPath:String = uri.normalizedUri; - for (key in _aCache) + import com.ankamagames.jerakine.logger.Logger; + import com.ankamagames.jerakine.newCache.ICache; + import com.ankamagames.jerakine.types.Uri; + import com.ankamagames.jerakine.logger.Log; + import flash.utils.getQualifiedClassName; + + public class UriCacheFactory extends Object + { + + public function UriCacheFactory() + { + super(); + } + + private static var _log:Logger = Log.getLogger(getQualifiedClassName(UriCacheFactory)); + + private static var _aCache:Array = new Array(); + + public static function init(param1:String, param2:ICache) : ICache + { + _aCache[param1] = param2; + return param2; + } + + public static function getCacheFromUri(param1:Uri) : ICache + { + var _loc3_:String = null; + var _loc2_:String = param1.normalizedUri; + for(_loc3_ in _aCache) + { + if(_loc2_.indexOf(_loc3_) != -1) { - if (currentPath.indexOf(key) != -1) - { - return (_aCache[key]); - }; - }; - return (null); - } - - public static function get caches():Array - { - return (_aCache); - } - - - } -}//package com.ankamagames.berilia.utils - + return _aCache[_loc3_]; + } + } + return null; + } + + public static function get caches() : Array + { + return _aCache; + } + } +} diff --git a/com/ankamagames/berilia/utils/errors/ApiError.as b/com/ankamagames/berilia/utils/errors/ApiError.as index c3b4b4d20..5524860a3 100644 --- a/com/ankamagames/berilia/utils/errors/ApiError.as +++ b/com/ankamagames/berilia/utils/errors/ApiError.as @@ -1,13 +1,11 @@ -package com.ankamagames.berilia.utils.errors +package com.ankamagames.berilia.utils.errors { - public class ApiError extends Error - { - - public function ApiError(message:String="", id:int=0) - { - super(message, id); - } - - } -}//package com.ankamagames.berilia.utils.errors - + public class ApiError extends Error + { + + public function ApiError(param1:String = "", param2:int = 0) + { + super(param1,param2); + } + } +} diff --git a/com/ankamagames/berilia/utils/errors/BeriliaError.as b/com/ankamagames/berilia/utils/errors/BeriliaError.as index e8b9bd0dc..67eb242b2 100644 --- a/com/ankamagames/berilia/utils/errors/BeriliaError.as +++ b/com/ankamagames/berilia/utils/errors/BeriliaError.as @@ -1,13 +1,11 @@ -package com.ankamagames.berilia.utils.errors +package com.ankamagames.berilia.utils.errors { - public class BeriliaError extends Error - { - - public function BeriliaError(message:String="", id:uint=0) - { - super(message, id); - } - - } -}//package com.ankamagames.berilia.utils.errors - + public class BeriliaError extends Error + { + + public function BeriliaError(param1:String = "", param2:uint = 0) + { + super(param1,param2); + } + } +} diff --git a/com/ankamagames/berilia/utils/errors/BeriliaXmlParsingError.as b/com/ankamagames/berilia/utils/errors/BeriliaXmlParsingError.as index bb27d6b6f..f88e096b5 100644 --- a/com/ankamagames/berilia/utils/errors/BeriliaXmlParsingError.as +++ b/com/ankamagames/berilia/utils/errors/BeriliaXmlParsingError.as @@ -1,13 +1,11 @@ -package com.ankamagames.berilia.utils.errors +package com.ankamagames.berilia.utils.errors { - public class BeriliaXmlParsingError extends BeriliaError - { - - public function BeriliaXmlParsingError(message:String="", id:uint=0) - { - super(message, id); - } - - } -}//package com.ankamagames.berilia.utils.errors - + public class BeriliaXmlParsingError extends BeriliaError + { + + public function BeriliaXmlParsingError(param1:String = "", param2:uint = 0) + { + super(param1,param2); + } + } +} diff --git a/com/ankamagames/berilia/utils/errors/UntrustedApiCallError.as b/com/ankamagames/berilia/utils/errors/UntrustedApiCallError.as index 51b44ecfd..26a23ba87 100644 --- a/com/ankamagames/berilia/utils/errors/UntrustedApiCallError.as +++ b/com/ankamagames/berilia/utils/errors/UntrustedApiCallError.as @@ -1,13 +1,11 @@ -package com.ankamagames.berilia.utils.errors +package com.ankamagames.berilia.utils.errors { - public class UntrustedApiCallError extends Error - { - - public function UntrustedApiCallError(message:String="", id:int=0) - { - super(message, id); - } - - } -}//package com.ankamagames.berilia.utils.errors - + public class UntrustedApiCallError extends Error + { + + public function UntrustedApiCallError(param1:String = "", param2:int = 0) + { + super(param1,param2); + } + } +} diff --git a/com/ankamagames/berilia/utils/web/HttpResponder.as b/com/ankamagames/berilia/utils/web/HttpResponder.as index b9e36b630..fe7bcafd5 100644 --- a/com/ankamagames/berilia/utils/web/HttpResponder.as +++ b/com/ankamagames/berilia/utils/web/HttpResponder.as @@ -1,357 +1,365 @@ -package com.ankamagames.berilia.utils.web +package com.ankamagames.berilia.utils.web { - import flash.net.Socket; - import flash.utils.ByteArray; - import flash.filesystem.FileStream; - import flash.filesystem.File; - import flash.events.FileListEvent; - import flash.events.Event; - import flash.events.IOErrorEvent; - import flash.filesystem.FileMode; - - public class HttpResponder - { - - private static const HTTP_VERB_GET:String = "GET"; - private static const HTTP_VERB_HEAD:String = "HEAD"; - private static const HTTP_VERB_POST:String = "POST"; - - private const HEADER_SEPERATOR:String = "\n"; - private const HEADER_END_SEPERATOR:String = "\n\n"; - - private var _socket:Socket; - private var _responseBytes:ByteArray; - private var _contentBytes:ByteArray; - private var _stream:FileStream; - private var _mimeHeader:String; - private var _statusHeader:String; - private var _dateHeader:String; - private var _contentLengthHeader:String; - private var _includeContent:Boolean = true; - - public function HttpResponder(socket:Socket, httpVerb:String, relativeFilePath:String, serverRoot:String) - { - var fileToServe:File; - var hj:String; - var _local_8:Date; - super(); - this._socket = socket; - if (((!((httpVerb == HttpResponder.HTTP_VERB_GET))) && (!((httpVerb == HttpResponder.HTTP_VERB_HEAD))))) + import flash.net.Socket; + import flash.utils.ByteArray; + import flash.filesystem.FileStream; + import flash.events.Event; + import flash.events.IOErrorEvent; + import flash.filesystem.File; + import flash.events.FileListEvent; + import flash.filesystem.FileMode; + + public class HttpResponder extends Object + { + + public function HttpResponder(param1:Socket, param2:String, param3:String, param4:String) + { + var _loc6_:File = null; + var _loc7_:String = null; + var _loc8_:Date = null; + super(); + this._socket = param1; + if(!(param2 == HttpResponder.HTTP_VERB_GET) && !(param2 == HttpResponder.HTTP_VERB_HEAD)) + { + this.throw501(); + } + if(param2 == HttpResponder.HTTP_VERB_HEAD) + { + this._includeContent = false; + } + this._responseBytes = new ByteArray(); + if(param3.indexOf("?") != -1) + { + var param3:String = param3.substring(0,param3.indexOf("?")); + } + param3 = decodeURI(param3); + if(!(param3.indexOf("../") == -1) || !(param3.indexOf("..\\") == -1)) + { + this.throw403(); + } + param3 = param3.split("file://").join(""); + while(param3.charAt(0) == ".") + { + param3 = param3.substr(1); + } + while(param3.charAt(0) == "/") + { + param3 = param3.substr(1); + } + var _loc5_:File = new File(param4); + if(_loc5_.exists) + { + _loc7_ = File.applicationDirectory.nativePath; + _loc6_ = _loc5_.resolvePath(param3); + if(_loc6_.exists) { - this.throw501(); - }; - if (httpVerb == HttpResponder.HTTP_VERB_HEAD) - { - this._includeContent = false; - }; - this._responseBytes = new ByteArray(); - if (relativeFilePath.indexOf("?") != -1) - { - relativeFilePath = relativeFilePath.substring(0, relativeFilePath.indexOf("?")); - }; - relativeFilePath = decodeURI(relativeFilePath); - if (((!((relativeFilePath.indexOf("../") == -1))) || (!((relativeFilePath.indexOf("..\\") == -1))))) - { - this.throw403(); - }; - relativeFilePath = relativeFilePath.split("file://").join(""); - while (relativeFilePath.charAt(0) == ".") - { - relativeFilePath = relativeFilePath.substr(1); - }; - while (relativeFilePath.charAt(0) == "/") - { - relativeFilePath = relativeFilePath.substr(1); - }; - var rootDirectory:File = new File(serverRoot); - if (rootDirectory.exists) - { - hj = File.applicationDirectory.nativePath; - fileToServe = rootDirectory.resolvePath(relativeFilePath); - if (fileToServe.exists) - { - if (fileToServe.isDirectory) - { - this._dateHeader = ("Date: " + this.toRFC802(new Date())); - this._mimeHeader = "Content-Type: text/html"; - fileToServe.addEventListener(FileListEvent.DIRECTORY_LISTING, this.onDirectoryList); - fileToServe.getDirectoryListingAsync(); - } - else - { - _local_8 = fileToServe.modificationDate; - this._dateHeader = ("Date: " + this.toRFC802(_local_8)); - this._mimeHeader = this.getMimeHeader(fileToServe); - this._stream = new FileStream(); - this._stream.addEventListener(Event.COMPLETE, this.onFileReadDone); - this._stream.addEventListener(IOErrorEvent.IO_ERROR, this.onFileIoError); - this._stream.openAsync(fileToServe, FileMode.READ); - }; - } - else - { - this.throw404(); - }; + if(_loc6_.isDirectory) + { + this._dateHeader = "Date: " + this.toRFC802(new Date()); + this._mimeHeader = "Content-Type: text/html"; + _loc6_.addEventListener(FileListEvent.DIRECTORY_LISTING,this.onDirectoryList); + _loc6_.getDirectoryListingAsync(); + } + else + { + _loc8_ = _loc6_.modificationDate; + this._dateHeader = "Date: " + this.toRFC802(_loc8_); + this._mimeHeader = this.getMimeHeader(_loc6_); + this._stream = new FileStream(); + this._stream.addEventListener(Event.COMPLETE,this.onFileReadDone); + this._stream.addEventListener(IOErrorEvent.IO_ERROR,this.onFileIoError); + this._stream.openAsync(_loc6_,FileMode.READ); + } } else { - this.throw404(); - }; - } - - private function onFileIoError(e:Event):void - { - this._stream.removeEventListener(Event.COMPLETE, this.onFileReadDone); - this._stream.removeEventListener(IOErrorEvent.IO_ERROR, this.onFileIoError); - this._stream.close(); - this._dateHeader = null; + this.throw404(); + } + } + else + { this.throw404(); - } - - private function onFileReadDone(e:Event):void - { - this._stream.removeEventListener(Event.COMPLETE, this.onFileReadDone); - this._stream.removeEventListener(IOErrorEvent.IO_ERROR, this.onFileIoError); - this._contentBytes = new ByteArray(); - this._stream.readBytes(this._contentBytes, 0, this._stream.bytesAvailable); - this._stream.close(); - this._statusHeader = "HTTP/1.0 200 OK"; - this._contentBytes.position = 0; - this._contentLengthHeader = ("Content-Length: " + this._contentBytes.bytesAvailable); - this.sendResponse(); - } - - private function getRelativePath(f:File):String - { - var rootPath:String = new File(HttpServer.getInstance().rootPath).nativePath; - return (f.nativePath.substring((rootPath.length + 1)).split("\\").join("/")); - } - - private function getImg(f:File):String - { - var img:String = '')); - } - - private function onDirectoryList(e:FileListEvent):void - { - var f:File; - var isDir:Boolean; - this._statusHeader = "HTTP/1.0 200 OK"; - var html:String = (("Dofus Module Server

Index of /" + this.getRelativePath(File(e.target))) + "

    "); - html = (html + ""); - if (this.getRelativePath(File(e.target)) != "") - { - html = (html + (((("')); - }; - for each (f in e.files) - { - isDir = f.isDirectory; - html = (html + (((((((((((((((("" + "") + '") + "") + "") + "")); - }; - html = (html + "
    NameLast modifiedSize (octet)
    " + this.getImg(File(e.target).parent)) + '..--
    ") + this.getImg(f)) + "') + f.name) + ((isDir) ? "/" : "")) + "") + this.toRFC802(f.modificationDate)) + "") + ((isDir) ? "-" : f.size)) + "
    "); - this._contentBytes = new ByteArray(); - this._contentBytes.writeUTFBytes(html); - this._contentBytes.position = 0; - this._contentLengthHeader = ("Content-Length: " + this._contentBytes.bytesAvailable); - this.sendResponse(); - } - - private function sendResponse():void - { - this._responseBytes = new ByteArray(); - this._responseBytes.writeUTFBytes(this._statusHeader); + } + return _loc2_ + "\" />"; + } + + private function onDirectoryList(param1:FileListEvent) : void + { + var _loc3_:File = null; + var _loc4_:* = false; + this._statusHeader = "HTTP/1.0 200 OK"; + var _loc2_:* = "Dofus Module Server

    Index of /" + this.getRelativePath(File(param1.target)) + "

      "; + _loc2_ = _loc2_ + ""; + if(this.getRelativePath(File(param1.target)) != "") + { + _loc2_ = _loc2_ + (""); + } + for each(_loc3_ in param1.files) + { + _loc4_ = _loc3_.isDirectory; + _loc2_ = _loc2_ + ("" + "" + "" + "" + "" + ""); + } + _loc2_ = _loc2_ + "
      NameLast modifiedSize (octet)
      " + this.getImg(File(param1.target).parent) + "..--
      " + this.getImg(_loc3_) + "" + _loc3_.name + (_loc4_?"/":"") + "" + this.toRFC802(_loc3_.modificationDate) + "" + (_loc4_?"-":_loc3_.size) + "
      "; + this._contentBytes = new ByteArray(); + this._contentBytes.writeUTFBytes(_loc2_); + this._contentBytes.position = 0; + this._contentLengthHeader = "Content-Length: " + this._contentBytes.bytesAvailable; + this.sendResponse(); + } + + private function sendResponse() : void + { + this._responseBytes = new ByteArray(); + this._responseBytes.writeUTFBytes(this._statusHeader); + this._responseBytes.writeUTFBytes(this.HEADER_SEPERATOR); + if(this._dateHeader) + { + this._responseBytes.writeUTFBytes(this._dateHeader); this._responseBytes.writeUTFBytes(this.HEADER_SEPERATOR); - if (this._dateHeader) - { - this._responseBytes.writeUTFBytes(this._dateHeader); - this._responseBytes.writeUTFBytes(this.HEADER_SEPERATOR); - }; - this._responseBytes.writeUTFBytes(this._mimeHeader); - this._responseBytes.writeUTFBytes(this.HEADER_SEPERATOR); - if (this._includeContent) - { - this._responseBytes.writeUTFBytes(this._contentLengthHeader); - }; - this._responseBytes.writeUTFBytes(this.HEADER_END_SEPERATOR); - if (this._includeContent) - { - this._responseBytes.writeBytes(this._contentBytes); - }; - this._responseBytes.position = 0; - this._socket.writeBytes(this._responseBytes, 0, this._responseBytes.bytesAvailable); - this._socket.flush(); - } - - private function throw404():void - { - this._statusHeader = "HTTP/1.0 404 Not Found"; - this._mimeHeader = "Content-Type: text/html"; - var four0FourString:String = "404 Not Found404 Not Found"; - this._contentBytes = new ByteArray(); - this._contentBytes.writeUTFBytes(four0FourString); - this._contentBytes.position = 0; - this._contentLengthHeader = ("Content-Length: " + this._contentBytes.bytesAvailable); - this.sendResponse(); - } - - private function throw403():void - { - this._statusHeader = "HTTP/1.0 403 Forbidden"; - this._mimeHeader = "Content-Type: text/html"; - var four0FourString:String = "403 Forbidden403 Forbidden"; - this._contentBytes = new ByteArray(); - this._contentBytes.writeUTFBytes(four0FourString); - this._contentBytes.position = 0; - this._contentLengthHeader = ("Content-Length: " + this._contentBytes.bytesAvailable); - this.sendResponse(); - } - - private function throw501():void - { - this._statusHeader = "HTTP/1.0 501 Not Implemented"; - this._responseBytes = new ByteArray(); - this._responseBytes.writeUTFBytes(this._statusHeader); - this._responseBytes.writeUTFBytes(this.HEADER_END_SEPERATOR); - this._responseBytes.position = 0; - this._socket.writeBytes(this._responseBytes, 0, this._responseBytes.bytesAvailable); - } - - private function throw500():void - { - this._statusHeader = "HTTP/1.0 500 Internal Server Error"; - this._responseBytes = new ByteArray(); - this._responseBytes.writeUTFBytes(this._statusHeader); - this._responseBytes.writeUTFBytes(this.HEADER_END_SEPERATOR); - this._responseBytes.position = 0; - this._socket.writeBytes(this._responseBytes, 0, this._responseBytes.bytesAvailable); - } - - private function getMimeHeader(file:File):String - { - var extn:String = file.extension; - return (("Content-Type: " + MimeTypeHelper.getMimeType(extn))); - } - - private function toRFC802(date:Date):String - { - var output:String = ""; - switch (date.dayUTC) - { - case 0: - output = (output + "Sun"); - break; - case 1: - output = (output + "Mon"); - break; - case 2: - output = (output + "Tue"); - break; - case 3: - output = (output + "Wed"); - break; - case 4: - output = (output + "Thu"); - break; - case 5: - output = (output + "Fri"); - break; - case 6: - output = (output + "Sat"); - break; - }; - output = (output + ", "); - if (date.dateUTC < 10) - { - output = (output + "0"); - }; - output = (output + (date.dateUTC + " ")); - switch (date.month) - { - case 0: - output = (output + "Jan"); - break; - case 1: - output = (output + "Feb"); - break; - case 2: - output = (output + "Mar"); - break; - case 3: - output = (output + "Apr"); - break; - case 4: - output = (output + "May"); - break; - case 5: - output = (output + "Jun"); - break; - case 6: - output = (output + "Jul"); - break; - case 7: - output = (output + "Aug"); - break; - case 8: - output = (output + "Sep"); - break; - case 9: - output = (output + "Oct"); - break; - case 10: - output = (output + "Nov"); - break; - case 11: - output = (output + "Dec"); - break; - }; - output = (output + " "); - output = (output + (date.fullYearUTC + " ")); - if (date.hoursUTC < 10) - { - output = (output + "0"); - }; - output = (output + (date.hoursUTC + ":")); - if (date.minutesUTC < 10) - { - output = (output + "0"); - }; - output = (output + (date.minutesUTC + ":")); - if (date.seconds < 10) - { - output = (output + "0"); - }; - output = (output + (date.secondsUTC + " GMT")); - return (output); - } - - - } -}//package com.ankamagames.berilia.utils.web - + } + this._responseBytes.writeUTFBytes(this._mimeHeader); + this._responseBytes.writeUTFBytes(this.HEADER_SEPERATOR); + if(this._includeContent) + { + this._responseBytes.writeUTFBytes(this._contentLengthHeader); + } + this._responseBytes.writeUTFBytes(this.HEADER_END_SEPERATOR); + if(this._includeContent) + { + this._responseBytes.writeBytes(this._contentBytes); + } + this._responseBytes.position = 0; + this._socket.writeBytes(this._responseBytes,0,this._responseBytes.bytesAvailable); + this._socket.flush(); + } + + private function throw404() : void + { + this._statusHeader = "HTTP/1.0 404 Not Found"; + this._mimeHeader = "Content-Type: text/html"; + var _loc1_:* = "404 Not Found404 Not Found"; + this._contentBytes = new ByteArray(); + this._contentBytes.writeUTFBytes(_loc1_); + this._contentBytes.position = 0; + this._contentLengthHeader = "Content-Length: " + this._contentBytes.bytesAvailable; + this.sendResponse(); + } + + private function throw403() : void + { + this._statusHeader = "HTTP/1.0 403 Forbidden"; + this._mimeHeader = "Content-Type: text/html"; + var _loc1_:* = "403 Forbidden403 Forbidden"; + this._contentBytes = new ByteArray(); + this._contentBytes.writeUTFBytes(_loc1_); + this._contentBytes.position = 0; + this._contentLengthHeader = "Content-Length: " + this._contentBytes.bytesAvailable; + this.sendResponse(); + } + + private function throw501() : void + { + this._statusHeader = "HTTP/1.0 501 Not Implemented"; + this._responseBytes = new ByteArray(); + this._responseBytes.writeUTFBytes(this._statusHeader); + this._responseBytes.writeUTFBytes(this.HEADER_END_SEPERATOR); + this._responseBytes.position = 0; + this._socket.writeBytes(this._responseBytes,0,this._responseBytes.bytesAvailable); + } + + private function throw500() : void + { + this._statusHeader = "HTTP/1.0 500 Internal Server Error"; + this._responseBytes = new ByteArray(); + this._responseBytes.writeUTFBytes(this._statusHeader); + this._responseBytes.writeUTFBytes(this.HEADER_END_SEPERATOR); + this._responseBytes.position = 0; + this._socket.writeBytes(this._responseBytes,0,this._responseBytes.bytesAvailable); + } + + private function getMimeHeader(param1:File) : String + { + var _loc2_:String = param1.extension; + return "Content-Type: " + MimeTypeHelper.getMimeType(_loc2_); + } + + private function toRFC802(param1:Date) : String + { + var _loc2_:* = ""; + switch(param1.dayUTC) + { + case 0: + _loc2_ = _loc2_ + "Sun"; + break; + case 1: + _loc2_ = _loc2_ + "Mon"; + break; + case 2: + _loc2_ = _loc2_ + "Tue"; + break; + case 3: + _loc2_ = _loc2_ + "Wed"; + break; + case 4: + _loc2_ = _loc2_ + "Thu"; + break; + case 5: + _loc2_ = _loc2_ + "Fri"; + break; + case 6: + _loc2_ = _loc2_ + "Sat"; + break; + } + _loc2_ = _loc2_ + ", "; + if(param1.dateUTC < 10) + { + _loc2_ = _loc2_ + "0"; + } + _loc2_ = _loc2_ + (param1.dateUTC + " "); + switch(param1.month) + { + case 0: + _loc2_ = _loc2_ + "Jan"; + break; + case 1: + _loc2_ = _loc2_ + "Feb"; + break; + case 2: + _loc2_ = _loc2_ + "Mar"; + break; + case 3: + _loc2_ = _loc2_ + "Apr"; + break; + case 4: + _loc2_ = _loc2_ + "May"; + break; + case 5: + _loc2_ = _loc2_ + "Jun"; + break; + case 6: + _loc2_ = _loc2_ + "Jul"; + break; + case 7: + _loc2_ = _loc2_ + "Aug"; + break; + case 8: + _loc2_ = _loc2_ + "Sep"; + break; + case 9: + _loc2_ = _loc2_ + "Oct"; + break; + case 10: + _loc2_ = _loc2_ + "Nov"; + break; + case 11: + _loc2_ = _loc2_ + "Dec"; + break; + } + _loc2_ = _loc2_ + " "; + _loc2_ = _loc2_ + (param1.fullYearUTC + " "); + if(param1.hoursUTC < 10) + { + _loc2_ = _loc2_ + "0"; + } + _loc2_ = _loc2_ + (param1.hoursUTC + ":"); + if(param1.minutesUTC < 10) + { + _loc2_ = _loc2_ + "0"; + } + _loc2_ = _loc2_ + (param1.minutesUTC + ":"); + if(param1.seconds < 10) + { + _loc2_ = _loc2_ + "0"; + } + _loc2_ = _loc2_ + (param1.secondsUTC + " GMT"); + return _loc2_; + } + } +} diff --git a/com/ankamagames/berilia/utils/web/HttpServer.as b/com/ankamagames/berilia/utils/web/HttpServer.as index ecaead60c..0f82286a3 100644 --- a/com/ankamagames/berilia/utils/web/HttpServer.as +++ b/com/ankamagames/berilia/utils/web/HttpServer.as @@ -1,114 +1,121 @@ -package com.ankamagames.berilia.utils.web +package com.ankamagames.berilia.utils.web { - import flash.events.EventDispatcher; - import com.ankamagames.jerakine.logger.Logger; - import com.ankamagames.jerakine.logger.Log; - import flash.utils.getQualifiedClassName; - import com.ankamagames.jerakine.utils.errors.SingletonError; - import flash.utils.getDefinitionByName; - import flash.events.Event; - import flash.filesystem.File; - - public class HttpServer extends EventDispatcher - { - - private static var _self:HttpServer; - private static const _log:Logger = Log.getLogger(getQualifiedClassName(HttpServer)); - - private var _server:Object; - private var _sockets:Array; - private var _usedPort:uint; - private var _rootPath:String; - - public function HttpServer() - { - if (_self) + import flash.events.EventDispatcher; + import com.ankamagames.jerakine.logger.Logger; + import com.ankamagames.jerakine.logger.Log; + import flash.utils.getQualifiedClassName; + import flash.filesystem.File; + import flash.utils.getDefinitionByName; + import flash.events.Event; + import com.ankamagames.jerakine.utils.errors.SingletonError; + + public class HttpServer extends EventDispatcher + { + + public function HttpServer() + { + super(); + if(_self) + { + throw new SingletonError(); + } + else + { + return; + } + } + + private static var _self:HttpServer; + + private static const _log:Logger = Log.getLogger(getQualifiedClassName(HttpServer)); + + public static function getInstance() : HttpServer + { + if(!_self) + { + _self = new HttpServer(); + } + return _self; + } + + private var _server:Object; + + private var _sockets:Array; + + private var _usedPort:uint; + + private var _rootPath:String; + + public function get rootPath() : String + { + return this._rootPath; + } + + public function init(param1:File) : Boolean + { + var rootPath:File = param1; + this._rootPath = rootPath.nativePath; + if(this._usedPort) + { + return true; + } + this._sockets = new Array(); + this._server = new (getDefinitionByName("flash.net.ServerSocket") as Class)(); + this._server.addEventListener(Event.CONNECT,this.onConnect); + var tryCount:uint = 100; + var currentPort:uint = 1100; + while(tryCount) + { + try { - throw (new SingletonError()); - }; - } - - public static function getInstance():HttpServer - { - if (!(_self)) + this._server.bind(currentPort,"127.0.0.1"); + this._server.listen(); + this._usedPort = currentPort; + _log.warn("Listening on port " + currentPort + "...\n"); + return true; + } + catch(e:Error) { - _self = new (HttpServer)(); - }; - return (_self); - } - - - public function get rootPath():String - { - return (this._rootPath); - } - - public function init(rootPath:File):Boolean - { - this._rootPath = rootPath.nativePath; - if (this._usedPort) - { - return (true); - }; - this._sockets = new Array(); - this._server = new ((getDefinitionByName("flash.net.ServerSocket") as Class))(); - this._server.addEventListener(Event.CONNECT, this.onConnect); - var tryCount:uint = 100; - var currentPort:uint = 1100; - while (tryCount) - { - try - { - this._server.bind(currentPort, "127.0.0.1"); - this._server.listen(); - this._usedPort = currentPort; - _log.warn((("Listening on port " + currentPort) + "...\n")); - return (true); - } - catch(e:Error) - { - currentPort++; - tryCount--; - }; - }; - return (false); - } - - public function getUrlTo(target:String):String - { - return (((("http://localhost:" + this._usedPort) + "/") + target)); - } - - public function close():void - { - var httpSocket:HttpSocket; - for each (httpSocket in this._sockets) - { - httpSocket.tearDown(); - }; - if (((!((this._server == null))) && (this._server.bound))) - { - this._server.removeEventListener(Event.CONNECT, this.onConnect); - this._server.close(); - trace("Server closed"); - _log.warn("Server closed"); - }; - } - - private function onConnect(event:Event):void - { - var htppSocket:HttpSocket = new HttpSocket(Object(event).socket, this._rootPath); - htppSocket.addEventListener(Event.COMPLETE, this.onHttpSocketComplete); - this._sockets.push(htppSocket); - } - - private function onHttpSocketComplete(e:Event):void - { - var httpSocketToRemove:HttpSocket = (e.target as HttpSocket); - this._sockets.splice(this._sockets.indexOf(httpSocketToRemove), 1); - } - - - } -}//package com.ankamagames.berilia.utils.web - + currentPort++; + tryCount--; + continue; + } + } + return false; + } + + public function getUrlTo(param1:String) : String + { + return "http://localhost:" + this._usedPort + "/" + param1; + } + + public function close() : void + { + var _loc1_:HttpSocket = null; + for each(_loc1_ in this._sockets) + { + _loc1_.tearDown(); + } + if(!(this._server == null) && (this._server.bound)) + { + this._server.removeEventListener(Event.CONNECT,this.onConnect); + this._server.close(); + trace("Server closed"); + _log.warn("Server closed"); + } + } + + private function onConnect(param1:Event) : void + { + var _loc2_:HttpSocket = new HttpSocket(Object(param1).socket,this._rootPath); + _loc2_.addEventListener(Event.COMPLETE,this.onHttpSocketComplete); + this._sockets.push(_loc2_); + } + + private function onHttpSocketComplete(param1:Event) : void + { + var _loc2_:HttpSocket = param1.target as HttpSocket; + this._sockets.splice(this._sockets.indexOf(_loc2_),1); + } + } +} diff --git a/com/ankamagames/berilia/utils/web/HttpSocket.as b/com/ankamagames/berilia/utils/web/HttpSocket.as index 5cce566ee..28b0fd29f 100644 --- a/com/ankamagames/berilia/utils/web/HttpSocket.as +++ b/com/ankamagames/berilia/utils/web/HttpSocket.as @@ -1,93 +1,97 @@ -package com.ankamagames.berilia.utils.web +package com.ankamagames.berilia.utils.web { - import flash.events.EventDispatcher; - import flash.net.Socket; - import flash.utils.ByteArray; - import flash.events.ProgressEvent; - import flash.events.Event; - - [Event(name="complete", type="flash.events.Event")] - public class HttpSocket extends EventDispatcher - { - - private static const SEPERATOR:RegExp = new RegExp(/\r?\n\r?\n/); - private static const NL:RegExp = new RegExp(/\r?\n/); - - private var requestSocket:Socket; - private var requestBuffer:ByteArray; - private var _rootPath:String; - - public function HttpSocket(socket:Socket, rootPath:String) - { - this.requestSocket = socket; - this.requestBuffer = new ByteArray(); - this.requestSocket.addEventListener(ProgressEvent.SOCKET_DATA, this.onRequestSocketData); - this.requestSocket.addEventListener(Event.CLOSE, this.onRequestSocketClose); - this._rootPath = rootPath; - } - - public function get rootPath():String - { - return (this._rootPath); - } - - private function onRequestSocketData(e:ProgressEvent):void - { - var headerString:String; - var initialRequestSignature:String; - var initialRequestSignatureComponents:Array; - var method:String; - var serverAndPath:String; - var path:String; - var httpResponser:HttpResponder; - this.requestSocket.readBytes(this.requestBuffer, this.requestBuffer.length, this.requestSocket.bytesAvailable); - var bufferString:String = this.requestBuffer.toString(); - var headerCheck:Number = bufferString.search(SEPERATOR); - if (headerCheck != -1) - { - headerString = bufferString.substring(0, headerCheck); - initialRequestSignature = headerString.substring(0, headerString.search(NL)); - initialRequestSignatureComponents = initialRequestSignature.split(" "); - method = initialRequestSignatureComponents[0]; - serverAndPath = initialRequestSignatureComponents[1]; - serverAndPath = serverAndPath.replace(/^http(s)?:\/\//, ""); - path = serverAndPath.substring(serverAndPath.indexOf("/"), serverAndPath.length); - httpResponser = new HttpResponder(this.requestSocket, method, path, this._rootPath); - }; - } - - private function onRequestSocketClose(e:Event):void - { + import flash.events.EventDispatcher; + import flash.net.Socket; + import flash.utils.ByteArray; + import flash.events.ProgressEvent; + import flash.events.Event; + + public class HttpSocket extends EventDispatcher + { + + public function HttpSocket(param1:Socket, param2:String) + { + super(); + this.requestSocket = param1; + this.requestBuffer = new ByteArray(); + this.requestSocket.addEventListener(ProgressEvent.SOCKET_DATA,this.onRequestSocketData); + this.requestSocket.addEventListener(Event.CLOSE,this.onRequestSocketClose); + this._rootPath = param2; + } + + private static const SEPERATOR:RegExp = new RegExp(new RegExp("\\r?\\n\\r?\\n")); + + private static const NL:RegExp = new RegExp(new RegExp("\\r?\\n")); + + private var requestSocket:Socket; + + private var requestBuffer:ByteArray; + + private var _rootPath:String; + + public function get rootPath() : String + { + return this._rootPath; + } + + private function onRequestSocketData(param1:ProgressEvent) : void + { + var _loc4_:String = null; + var _loc5_:String = null; + var _loc6_:Array = null; + var _loc7_:String = null; + var _loc8_:String = null; + var _loc9_:String = null; + var _loc10_:HttpResponder = null; + this.requestSocket.readBytes(this.requestBuffer,this.requestBuffer.length,this.requestSocket.bytesAvailable); + var _loc2_:String = this.requestBuffer.toString(); + var _loc3_:Number = _loc2_.search(SEPERATOR); + if(_loc3_ != -1) + { + _loc4_ = _loc2_.substring(0,_loc3_); + _loc5_ = _loc4_.substring(0,_loc4_.search(NL)); + _loc6_ = _loc5_.split(" "); + _loc7_ = _loc6_[0]; + _loc8_ = _loc6_[1]; + _loc8_ = _loc8_.replace(new RegExp("^http(s)?:\\/\\/"),""); + _loc9_ = _loc8_.substring(_loc8_.indexOf("/"),_loc8_.length); + _loc10_ = new HttpResponder(this.requestSocket,_loc7_,_loc9_,this._rootPath); + } + if(_loc3_ != -1) + { + return; + } + } + + private function onRequestSocketClose(param1:Event) : void + { + this.done(); + } + + private function done() : void + { + this.tearDown(); + var _loc1_:Event = new Event(Event.COMPLETE); + this.dispatchEvent(_loc1_); + } + + private function testSocket(param1:Socket) : Boolean + { + if(!param1.connected) + { this.done(); - } - - private function done():void - { - this.tearDown(); - var completeEvent:Event = new Event(Event.COMPLETE); - this.dispatchEvent(completeEvent); - } - - private function testSocket(socket:Socket):Boolean - { - if (!(socket.connected)) - { - this.done(); - return (false); - }; - return (true); - } - - public function tearDown():void - { - if (((!((this.requestSocket == null))) && (this.requestSocket.connected))) - { - this.requestSocket.flush(); - this.requestSocket.close(); - }; - } - - - } -}//package com.ankamagames.berilia.utils.web - + return false; + } + return true; + } + + public function tearDown() : void + { + if(!(this.requestSocket == null) && (this.requestSocket.connected)) + { + this.requestSocket.flush(); + this.requestSocket.close(); + } + } + } +} diff --git a/com/ankamagames/berilia/utils/web/MimeTypeHelper.as b/com/ankamagames/berilia/utils/web/MimeTypeHelper.as index 04f49acfc..e4c63174a 100644 --- a/com/ankamagames/berilia/utils/web/MimeTypeHelper.as +++ b/com/ankamagames/berilia/utils/web/MimeTypeHelper.as @@ -1,9 +1,26 @@ -package com.ankamagames.berilia.utils.web +package com.ankamagames.berilia.utils.web { - public class MimeTypeHelper - { - - public static const mimetypeXml:XML = + public class MimeTypeHelper extends Object + { + + public function MimeTypeHelper() + { + super(); + } + + public static function getMimeType(param1:String) : String + { + var mimeNode:XML = null; + var fileExtension:String = param1; + mimeNode = MimeTypeHelper.mimetypeXml.mimeType.(attribute("fileExtension") == fileExtension)[0]; + if(mimeNode) + { + return mimeNode.@type; + } + return null; + } + + public static const mimetypeXml:XML = @@ -646,22 +663,6 @@ - - ; - - - public static function getMimeType(fileExtension:String):String - { - var mimeNode:XML; - mimeNode = MimeTypeHelper.mimetypeXml.mimeType.(attribute("fileExtension") == fileExtension)[0]; - if (mimeNode) - { - return (mimeNode.@type); - }; - return (null); - } - - - } -}//package com.ankamagames.berilia.utils.web - +; + } +} diff --git a/com/ankamagames/dofus/BuildInfos.as b/com/ankamagames/dofus/BuildInfos.as index c3b935c7d..f4ed582e9 100644 --- a/com/ankamagames/dofus/BuildInfos.as +++ b/com/ankamagames/dofus/BuildInfos.as @@ -1,18 +1,24 @@ -package com.ankamagames.dofus +package com.ankamagames.dofus { - import com.ankamagames.jerakine.types.Version; - import com.ankamagames.dofus.network.enums.BuildTypeEnum; - - public final class BuildInfos - { - - public static var BUILD_VERSION:Version = new Version(2, 26, 6); - public static var BUILD_TYPE:uint = BuildTypeEnum.BETA;//1 - public static var BUILD_REVISION:int = 91209; - public static var BUILD_PATCH:int = 0; - public static const BUILD_DATE:String = "Dec 15, 2014 - 10:32:14 CET"; - - - } -}//package com.ankamagames.dofus - + import com.ankamagames.jerakine.types.Version; + import com.ankamagames.dofus.network.enums.BuildTypeEnum; + + public final class BuildInfos extends Object + { + + public function BuildInfos() + { + super(); + } + + public static var BUILD_VERSION:Version = new Version(2,28,0); + + public static var BUILD_TYPE:uint = BuildTypeEnum.RELEASE; + + public static var BUILD_REVISION:int = 94161; + + public static var BUILD_PATCH:int = 0; + + public static const BUILD_DATE:String = "Apr 22, 2015 - 09:08:01 CEST"; + } +} diff --git a/com/ankamagames/dofus/Constants.as b/com/ankamagames/dofus/Constants.as index 8a7ead733..c112d7a1b 100644 --- a/com/ankamagames/dofus/Constants.as +++ b/com/ankamagames/dofus/Constants.as @@ -1,31 +1,49 @@ -package com.ankamagames.dofus +package com.ankamagames.dofus { - import com.ankamagames.jerakine.types.DataStoreType; - import com.ankamagames.jerakine.types.enums.DataStoreEnum; - import com.ankamagames.jerakine.cache.Cache; - - public class Constants - { - - public static const SIGNATURE_KEY_DATA:Class = Constants_SIGNATURE_KEY_DATA; - public static const LOG_UPLOAD_MODE:Boolean = false; - public static var EVENT_MODE:Boolean = true; - public static var EVENT_MODE_PARAM:String = ""; - public static var CHARACTER_CREATION_ALLOWED:Boolean = true; - public static var FORCE_MAXIMIZED_WINDOW:Boolean = true; - public static const DATASTORE_COMPUTER_OPTIONS:DataStoreType = new DataStoreType("Dofus_ComputerOptions", true, DataStoreEnum.LOCATION_LOCAL, DataStoreEnum.BIND_ACCOUNT); - public static const DATASTORE_LANG_VERSION:DataStoreType = new DataStoreType("lastLangVersion", true, DataStoreEnum.LOCATION_LOCAL, DataStoreEnum.BIND_ACCOUNT); - public static const DATASTORE_CONSOLE_CMD:DataStoreType = new DataStoreType("Dofus_ConsoleCmd", true, DataStoreEnum.LOCATION_LOCAL, DataStoreEnum.BIND_COMPUTER); - public static const DATASTORE_MODULE_DEBUG:DataStoreType = new DataStoreType("Dofus_ModuleDebug", true, DataStoreEnum.LOCATION_LOCAL, DataStoreEnum.BIND_COMPUTER); - public static const DATASTORE_TCHAT:DataStoreType = new DataStoreType("Dofus_Tchat", true, DataStoreEnum.LOCATION_LOCAL, DataStoreEnum.BIND_ACCOUNT); - public static const DATASTORE_TCHAT_PRIVATE:DataStoreType = new DataStoreType("Dofus_TchatPrivate", true, DataStoreEnum.LOCATION_LOCAL, DataStoreEnum.BIND_ACCOUNT); - public static const SCRIPT_CACHE:Cache = new Cache(Cache.CHECK_OBJECT_COUNT, 100, 80); - public static const PRE_GAME_MODULE:Array = new Array("Ankama_Connection"); - public static const COMMON_GAME_MODULE:Array = new Array("Ankama_Common", "Ankama_Config", "Ankama_Tooltips", "Ankama_Console", "Ankama_ContextMenu"); - public static const ADMIN_MODULE:Array = new Array("Ankama_Admin"); - public static const DETERMINIST_TACKLE:Boolean = true; - - - } -}//package com.ankamagames.dofus - + import com.ankamagames.jerakine.types.DataStoreType; + import com.ankamagames.jerakine.cache.Cache; + import com.ankamagames.jerakine.types.enums.DataStoreEnum; + + public class Constants extends Object + { + + public function Constants() + { + super(); + } + + public static const SIGNATURE_KEY_DATA:Class = Constants_SIGNATURE_KEY_DATA; + + public static const LOG_UPLOAD_MODE:Boolean = false; + + public static var EVENT_MODE:Boolean = true; + + public static var EVENT_MODE_PARAM:String = ""; + + public static var CHARACTER_CREATION_ALLOWED:Boolean = true; + + public static var FORCE_MAXIMIZED_WINDOW:Boolean = true; + + public static const DATASTORE_COMPUTER_OPTIONS:DataStoreType = new DataStoreType("Dofus_ComputerOptions",true,DataStoreEnum.LOCATION_LOCAL,DataStoreEnum.BIND_ACCOUNT); + + public static const DATASTORE_LANG_VERSION:DataStoreType = new DataStoreType("lastLangVersion",true,DataStoreEnum.LOCATION_LOCAL,DataStoreEnum.BIND_ACCOUNT); + + public static const DATASTORE_CONSOLE_CMD:DataStoreType = new DataStoreType("Dofus_ConsoleCmd",true,DataStoreEnum.LOCATION_LOCAL,DataStoreEnum.BIND_COMPUTER); + + public static const DATASTORE_MODULE_DEBUG:DataStoreType = new DataStoreType("Dofus_ModuleDebug",true,DataStoreEnum.LOCATION_LOCAL,DataStoreEnum.BIND_COMPUTER); + + public static const DATASTORE_TCHAT:DataStoreType = new DataStoreType("Dofus_Tchat",true,DataStoreEnum.LOCATION_LOCAL,DataStoreEnum.BIND_ACCOUNT); + + public static const DATASTORE_TCHAT_PRIVATE:DataStoreType = new DataStoreType("Dofus_TchatPrivate",true,DataStoreEnum.LOCATION_LOCAL,DataStoreEnum.BIND_ACCOUNT); + + public static const SCRIPT_CACHE:Cache = new Cache(Cache.CHECK_OBJECT_COUNT,100,80); + + public static const PRE_GAME_MODULE:Array = new Array("Ankama_Connection"); + + public static const COMMON_GAME_MODULE:Array = new Array("Ankama_Common","Ankama_Config","Ankama_Tooltips","Ankama_Console","Ankama_ContextMenu"); + + public static const ADMIN_MODULE:Array = new Array("Ankama_Admin"); + + public static const DETERMINIST_TACKLE:Boolean = true; + } +} diff --git a/com/ankamagames/dofus/Constants_SIGNATURE_KEY_DATA.as b/com/ankamagames/dofus/Constants_SIGNATURE_KEY_DATA.as index fca7596a6..08b15925b 100644 --- a/com/ankamagames/dofus/Constants_SIGNATURE_KEY_DATA.as +++ b/com/ankamagames/dofus/Constants_SIGNATURE_KEY_DATA.as @@ -1,12 +1,13 @@ -package com.ankamagames.dofus +package com.ankamagames.dofus { - import mx.core.ByteArrayAsset; - - [ExcludeClass] - public class Constants_SIGNATURE_KEY_DATA extends ByteArrayAsset - { - - - } -}//package com.ankamagames.dofus - + import mx.core.ByteArrayAsset; + + public class Constants_SIGNATURE_KEY_DATA extends ByteArrayAsset + { + + public function Constants_SIGNATURE_KEY_DATA() + { + super(); + } + } +} diff --git a/com/ankamagames/dofus/console/BasicConsoleInstructionRegistar.as b/com/ankamagames/dofus/console/BasicConsoleInstructionRegistar.as index a5cd70409..1b2988866 100644 --- a/com/ankamagames/dofus/console/BasicConsoleInstructionRegistar.as +++ b/com/ankamagames/dofus/console/BasicConsoleInstructionRegistar.as @@ -1,31 +1,32 @@ -package com.ankamagames.dofus.console +package com.ankamagames.dofus.console { - import com.ankamagames.jerakine.console.ConsoleInstructionRegistar; - import com.ankamagames.dofus.console.debug.VersionInstructionHandler; - import com.ankamagames.dofus.console.debug.DisplayMapInstructionHandler; - import com.ankamagames.dofus.console.debug.MiscInstructionHandler; - import com.ankamagames.dofus.console.debug.UiHandlerInstructionHandler; - import com.ankamagames.dofus.console.debug.ActionsInstructionHandler; - import com.ankamagames.dofus.console.debug.SoundInstructionHandler; - import com.ankamagames.dofus.console.debug.LuaInstructionHandler; - import com.ankamagames.jerakine.console.ConsoleHandler; - - public class BasicConsoleInstructionRegistar implements ConsoleInstructionRegistar - { - - - public function registerInstructions(console:ConsoleHandler):void - { - console.addHandler("version", new VersionInstructionHandler()); - console.addHandler("mapid", new DisplayMapInstructionHandler()); - console.addHandler(["savereplaylog"], new MiscInstructionHandler()); - console.addHandler(["uiinspector", "inspectuielement", "loadui", "unloadui", "clearuicache", "useuicache", "uilist", "reloadui", "modulelist"], new UiHandlerInstructionHandler()); - console.addHandler(["sendaction", "listactions", "sendhook"], new ActionsInstructionHandler()); - console.addHandler(["adduisoundelement"], new SoundInstructionHandler()); - console.addHandler(["lua", "luarecorder"], new LuaInstructionHandler()); - } - - - } -}//package com.ankamagames.dofus.console - + import com.ankamagames.jerakine.console.ConsoleInstructionRegistar; + import com.ankamagames.jerakine.console.ConsoleHandler; + import com.ankamagames.dofus.console.debug.VersionInstructionHandler; + import com.ankamagames.dofus.console.debug.DisplayMapInstructionHandler; + import com.ankamagames.dofus.console.debug.MiscInstructionHandler; + import com.ankamagames.dofus.console.debug.UiHandlerInstructionHandler; + import com.ankamagames.dofus.console.debug.ActionsInstructionHandler; + import com.ankamagames.dofus.console.debug.SoundInstructionHandler; + import com.ankamagames.dofus.console.debug.LuaInstructionHandler; + + public class BasicConsoleInstructionRegistar extends Object implements ConsoleInstructionRegistar + { + + public function BasicConsoleInstructionRegistar() + { + super(); + } + + public function registerInstructions(param1:ConsoleHandler) : void + { + param1.addHandler("version",new VersionInstructionHandler()); + param1.addHandler("mapid",new DisplayMapInstructionHandler()); + param1.addHandler(["savereplaylog"],new MiscInstructionHandler()); + param1.addHandler(["uiinspector","inspectuielement","loadui","unloadui","clearuicache","useuicache","uilist","reloadui","modulelist"],new UiHandlerInstructionHandler()); + param1.addHandler(["sendaction","listactions","sendhook"],new ActionsInstructionHandler()); + param1.addHandler(["adduisoundelement"],new SoundInstructionHandler()); + param1.addHandler(["lua","luarecorder"],new LuaInstructionHandler()); + } + } +} diff --git a/com/ankamagames/dofus/console/ChatConsoleInstructionRegistrar.as b/com/ankamagames/dofus/console/ChatConsoleInstructionRegistrar.as index 3d71bade5..891b7529a 100644 --- a/com/ankamagames/dofus/console/ChatConsoleInstructionRegistrar.as +++ b/com/ankamagames/dofus/console/ChatConsoleInstructionRegistrar.as @@ -1,52 +1,53 @@ -package com.ankamagames.dofus.console +package com.ankamagames.dofus.console { - import com.ankamagames.jerakine.console.ConsoleInstructionRegistar; - import com.ankamagames.dofus.datacenter.communication.Emoticon; - import com.ankamagames.dofus.console.chat.InfoInstructionHandler; - import com.ankamagames.dofus.console.common.LatencyInstructionHandler; - import com.ankamagames.dofus.console.chat.SocialInstructionHandler; - import com.ankamagames.dofus.console.chat.MessagingInstructionHandler; - import com.ankamagames.dofus.console.chat.FightInstructionHandler; - import com.ankamagames.dofus.console.chat.EmoteInstructionHandler; - import com.ankamagames.dofus.console.chat.OptionsInstructionHandler; - import com.ankamagames.dofus.BuildInfos; - import com.ankamagames.dofus.network.enums.BuildTypeEnum; - import com.ankamagames.dofus.console.debug.MiscInstructionHandler; - import com.ankamagames.jerakine.data.I18n; - import com.ankamagames.dofus.console.chat.StatusInstructionHandler; - import com.ankamagames.jerakine.console.ConsoleHandler; - - public class ChatConsoleInstructionRegistrar implements ConsoleInstructionRegistar - { - - - public function registerInstructions(console:ConsoleHandler):void - { - var emote:*; - var emoteShortcuts:Array = new Array(); - for each (emote in Emoticon.getEmoticons()) - { - emoteShortcuts.push(emote.shortcut); - }; - console.addHandler(["whois", "version", "about", "whoami", "mapid", "cellid", "time"], new InfoInstructionHandler()); - console.addHandler(["aping", "ping"], new LatencyInstructionHandler()); - console.addHandler(["f", "ignore", "invite"], new SocialInstructionHandler()); - console.addHandler(["w", "whisper", "msg", "t", "g", "p", "a", "r", "b", "m"], new MessagingInstructionHandler()); - console.addHandler(["s", "spectator", "list", "players", "kick"], new FightInstructionHandler()); - console.addHandler(emoteShortcuts, new EmoteInstructionHandler()); - console.addHandler(["tab", "clear"], new OptionsInstructionHandler()); - if (BuildInfos.BUILD_TYPE != BuildTypeEnum.RELEASE) - { - console.addHandler(["savereplaylog", "sd", "shieldmax", "shieldmed", "shieldmin"], new MiscInstructionHandler()); - } - else - { - console.addHandler(["savereplaylog", "shieldmax", "shieldmed", "shieldmin"], new MiscInstructionHandler()); - }; - console.addHandler(["away", I18n.getUiText("ui.chat.status.away").toLocaleLowerCase(), I18n.getUiText("ui.chat.status.solo").toLocaleLowerCase(), I18n.getUiText("ui.chat.status.private").toLocaleLowerCase(), I18n.getUiText("ui.chat.status.availiable").toLocaleLowerCase(), "release"], new StatusInstructionHandler()); - } - - - } -}//package com.ankamagames.dofus.console - + import com.ankamagames.jerakine.console.ConsoleInstructionRegistar; + import com.ankamagames.jerakine.console.ConsoleHandler; + import com.ankamagames.dofus.datacenter.communication.Emoticon; + import com.ankamagames.dofus.console.chat.InfoInstructionHandler; + import com.ankamagames.dofus.console.common.LatencyInstructionHandler; + import com.ankamagames.dofus.console.chat.SocialInstructionHandler; + import com.ankamagames.dofus.console.chat.MessagingInstructionHandler; + import com.ankamagames.dofus.console.chat.FightInstructionHandler; + import com.ankamagames.dofus.console.chat.EmoteInstructionHandler; + import com.ankamagames.dofus.console.chat.OptionsInstructionHandler; + import com.ankamagames.dofus.BuildInfos; + import com.ankamagames.dofus.network.enums.BuildTypeEnum; + import com.ankamagames.dofus.console.debug.MiscInstructionHandler; + import com.ankamagames.jerakine.data.I18n; + import com.ankamagames.dofus.console.chat.StatusInstructionHandler; + + public class ChatConsoleInstructionRegistrar extends Object implements ConsoleInstructionRegistar + { + + public function ChatConsoleInstructionRegistrar() + { + super(); + } + + public function registerInstructions(param1:ConsoleHandler) : void + { + var _loc3_:* = undefined; + var _loc2_:Array = new Array(); + for each(_loc3_ in Emoticon.getEmoticons()) + { + _loc2_.push(_loc3_.shortcut); + } + param1.addHandler(["whois","version","about","whoami","mapid","cellid","time"],new InfoInstructionHandler()); + param1.addHandler(["aping","ping"],new LatencyInstructionHandler()); + param1.addHandler(["f","ignore","invite"],new SocialInstructionHandler()); + param1.addHandler(["w","whisper","msg","t","g","p","a","r","b","m"],new MessagingInstructionHandler()); + param1.addHandler(["s","spectator","list","players","kick"],new FightInstructionHandler()); + param1.addHandler(_loc2_,new EmoteInstructionHandler()); + param1.addHandler(["tab","clear"],new OptionsInstructionHandler()); + if(BuildInfos.BUILD_TYPE != BuildTypeEnum.RELEASE) + { + param1.addHandler(["savereplaylog","sd","shieldmax","shieldmed","shieldmin"],new MiscInstructionHandler()); + } + else + { + param1.addHandler(["savereplaylog","shieldmax","shieldmed","shieldmin"],new MiscInstructionHandler()); + } + param1.addHandler(["away",I18n.getUiText("ui.chat.status.away").toLocaleLowerCase(),I18n.getUiText("ui.chat.status.solo").toLocaleLowerCase(),I18n.getUiText("ui.chat.status.private").toLocaleLowerCase(),I18n.getUiText("ui.chat.status.availiable").toLocaleLowerCase(),"release"],new StatusInstructionHandler()); + } + } +} diff --git a/com/ankamagames/dofus/console/DebugConsoleInstructionRegistar.as b/com/ankamagames/dofus/console/DebugConsoleInstructionRegistar.as index e4dc3cc43..65c1e6c65 100644 --- a/com/ankamagames/dofus/console/DebugConsoleInstructionRegistar.as +++ b/com/ankamagames/dofus/console/DebugConsoleInstructionRegistar.as @@ -1,73 +1,74 @@ -package com.ankamagames.dofus.console +package com.ankamagames.dofus.console { - import com.ankamagames.jerakine.console.ConsoleInstructionRegistar; - import com.ankamagames.dofus.console.debug.VersionInstructionHandler; - import com.ankamagames.dofus.console.debug.CryptoInstructionHandler; - import com.ankamagames.dofus.console.debug.DisplayMapInstructionHandler; - import com.ankamagames.dofus.console.debug.ClearSceneInstructionHandler; - import com.ankamagames.dofus.console.debug.UiHandlerInstructionHandler; - import com.ankamagames.dofus.console.debug.DtdInstructionHandler; - import com.ankamagames.dofus.console.debug.ClearTextureCacheInstructionHandler; - import com.ankamagames.dofus.console.debug.ConnectionInstructionHandler; - import com.ankamagames.dofus.console.debug.PanicInstructionHandler; - import com.ankamagames.dofus.console.debug.FullScreenInstructionHandler; - import com.ankamagames.dofus.console.debug.ResetInstructionHandler; - import com.ankamagames.dofus.console.debug.EnterFrameInstructionHandler; - import com.ankamagames.dofus.console.debug.MiscInstructionHandler; - import com.ankamagames.dofus.console.debug.TiphonInstructionHandler; - import com.ankamagames.dofus.console.debug.InventoryInstructionHandler; - import com.ankamagames.dofus.console.debug.UtilInstructionHandler; - import com.ankamagames.dofus.console.debug.FontInstructionHandler; - import com.ankamagames.dofus.console.common.LatencyInstructionHandler; - import com.ankamagames.dofus.console.debug.FrameInstructionHandler; - import com.ankamagames.dofus.console.debug.BenchmarkInstructionHandler; - import com.ankamagames.dofus.console.debug.ActionsInstructionHandler; - import com.ankamagames.dofus.console.debug.IAInstructionHandler; - import com.ankamagames.dofus.console.debug.FightInstructionHandler; - import com.ankamagames.dofus.console.debug.SoundInstructionHandler; - import com.ankamagames.dofus.console.debug.LivingObjectInstructionHandler; - import com.ankamagames.dofus.console.debug.UpdaterInstructionHandler; - import com.ankamagames.dofus.console.debug.SystemInstructionHandler; - import com.ankamagames.dofus.console.debug.LuaInstructionHandler; - import com.ankamagames.jerakine.console.ConsoleHandler; - - public class DebugConsoleInstructionRegistar implements ConsoleInstructionRegistar - { - - - public function registerInstructions(console:ConsoleHandler):void - { - console.addHandler("version", new VersionInstructionHandler()); - console.addHandler(["crc32", "md5", "antibot"], new CryptoInstructionHandler()); - console.addHandler(["displaymap", "displaymapdebug", "getmapcoord", "getmapid", "testatouin", "mapid", "showcellid", "playerjump", "showtransitions", "groundcache"], new DisplayMapInstructionHandler()); - console.addHandler(["clearscene", "clearentities", "countentities"], new ClearSceneInstructionHandler()); - console.addHandler(["inspector", "uiinspector", "inspectuielement", "inspectuielementsos", "modulelist", "loadui", "unloadui", "clearuicache", "setuiscale", "useuicache", "uilist", "reloadui", "fps", "getmoduleinfo", "chatoutput"], new UiHandlerInstructionHandler()); - console.addHandler(["dtd", "componentdtd", "shortcutsdtd", "kerneleventdtd"], new DtdInstructionHandler()); - console.addHandler("cleartexturecache", new ClearTextureCacheInstructionHandler()); - console.addHandler(["connectionstatus", "inspecttraffic", "inspectlowtraffic"], new ConnectionInstructionHandler()); - console.addHandler(["panic", "throw"], new PanicInstructionHandler()); - console.addHandler("fullscreen", new FullScreenInstructionHandler()); - console.addHandler("reset", new ResetInstructionHandler()); - console.addHandler("enterframecount", new EnterFrameInstructionHandler()); - console.addHandler(["savereplaylog", "parallelsequenceteststart", "log", "i18nsize", "newdofus", "clear", "config", "clearwebcache", "geteventmodeparams", "setquality", "lowdefskin", "copylog", "synchrosequence", "throw", "debugmouseover", "idletime", "setmonsterspeed"], new MiscInstructionHandler()); - console.addHandler(["additem", "looklike"], new TiphonInstructionHandler()); - console.addHandler(["listinventory", "searchitem", "makeinventory"], new InventoryInstructionHandler()); - console.addHandler(["enablelogs", "info", "search", "searchmonster", "searchspell", "enablereport", "savereport", "loadpacket", "reccordpacket"], new UtilInstructionHandler()); - console.addHandler("jptest", new FontInstructionHandler()); - console.addHandler(["aping", "ping"], new LatencyInstructionHandler()); - console.addHandler(["framelist", "framepriority"], new FrameInstructionHandler()); - console.addHandler(["addmovingcharacter", "setanimation", "setdirection", "memorylog", "bot-spectator", "bot-fight", "tiphon-error", "fpsmanager", "tacticmode"], new BenchmarkInstructionHandler()); - console.addHandler(["sendaction", "listactions", "sendhook"], new ActionsInstructionHandler()); - console.addHandler(["debuglos", "calculatepath", "tracepath", "debugcellsinline"], new IAInstructionHandler()); - console.addHandler(["setspellscriptparam", "setspellscript"], new FightInstructionHandler()); - console.addHandler(["playmusic", "stopmusic", "playambiance", "stopambiance", "addsoundinplaylist", "stopplaylist", "playplaylist", "activesounds", "adduisoundelement"], new SoundInstructionHandler()); - console.addHandler(["floodlivingobject"], new LivingObjectInstructionHandler()); - console.addHandler(["partdebug", "partlist", "partinfo", "updaterspeed", "downloadpart"], new UpdaterInstructionHandler()); - console.addHandler(["getuid"], new SystemInstructionHandler()); - console.addHandler(["lua", "luarecorder"], new LuaInstructionHandler()); - } - - - } -}//package com.ankamagames.dofus.console - + import com.ankamagames.jerakine.console.ConsoleInstructionRegistar; + import com.ankamagames.jerakine.console.ConsoleHandler; + import com.ankamagames.dofus.console.debug.VersionInstructionHandler; + import com.ankamagames.dofus.console.debug.CryptoInstructionHandler; + import com.ankamagames.dofus.console.debug.DisplayMapInstructionHandler; + import com.ankamagames.dofus.console.debug.ClearSceneInstructionHandler; + import com.ankamagames.dofus.console.debug.UiHandlerInstructionHandler; + import com.ankamagames.dofus.console.debug.DtdInstructionHandler; + import com.ankamagames.dofus.console.debug.ClearTextureCacheInstructionHandler; + import com.ankamagames.dofus.console.debug.ConnectionInstructionHandler; + import com.ankamagames.dofus.console.debug.PanicInstructionHandler; + import com.ankamagames.dofus.console.debug.FullScreenInstructionHandler; + import com.ankamagames.dofus.console.debug.ResetInstructionHandler; + import com.ankamagames.dofus.console.debug.EnterFrameInstructionHandler; + import com.ankamagames.dofus.console.debug.MiscInstructionHandler; + import com.ankamagames.dofus.console.debug.TiphonInstructionHandler; + import com.ankamagames.dofus.console.debug.InventoryInstructionHandler; + import com.ankamagames.dofus.console.debug.UtilInstructionHandler; + import com.ankamagames.dofus.console.debug.FontInstructionHandler; + import com.ankamagames.dofus.console.common.LatencyInstructionHandler; + import com.ankamagames.dofus.console.debug.FrameInstructionHandler; + import com.ankamagames.dofus.console.debug.BenchmarkInstructionHandler; + import com.ankamagames.dofus.console.debug.ActionsInstructionHandler; + import com.ankamagames.dofus.console.debug.IAInstructionHandler; + import com.ankamagames.dofus.console.debug.FightInstructionHandler; + import com.ankamagames.dofus.console.debug.SoundInstructionHandler; + import com.ankamagames.dofus.console.debug.LivingObjectInstructionHandler; + import com.ankamagames.dofus.console.debug.UpdaterInstructionHandler; + import com.ankamagames.dofus.console.debug.SystemInstructionHandler; + import com.ankamagames.dofus.console.debug.LuaInstructionHandler; + + public class DebugConsoleInstructionRegistar extends Object implements ConsoleInstructionRegistar + { + + public function DebugConsoleInstructionRegistar() + { + super(); + } + + public function registerInstructions(param1:ConsoleHandler) : void + { + param1.addHandler("version",new VersionInstructionHandler()); + param1.addHandler(["crc32","md5","antibot"],new CryptoInstructionHandler()); + param1.addHandler(["displaymap","displaymapdebug","getmapcoord","getmapid","testatouin","mapid","showcellid","playerjump","showtransitions","groundcache"],new DisplayMapInstructionHandler()); + param1.addHandler(["clearscene","clearentities","countentities"],new ClearSceneInstructionHandler()); + param1.addHandler(["inspector","uiinspector","inspectuielement","inspectuielementsos","modulelist","loadui","unloadui","clearuicache","setuiscale","useuicache","uilist","reloadui","fps","getmoduleinfo","chatoutput"],new UiHandlerInstructionHandler()); + param1.addHandler(["dtd","componentdtd","shortcutsdtd","kerneleventdtd"],new DtdInstructionHandler()); + param1.addHandler("cleartexturecache",new ClearTextureCacheInstructionHandler()); + param1.addHandler(["connectionstatus","inspecttraffic","inspectlowtraffic"],new ConnectionInstructionHandler()); + param1.addHandler(["panic","throw"],new PanicInstructionHandler()); + param1.addHandler("fullscreen",new FullScreenInstructionHandler()); + param1.addHandler("reset",new ResetInstructionHandler()); + param1.addHandler("enterframecount",new EnterFrameInstructionHandler()); + param1.addHandler(["savereplaylog","parallelsequenceteststart","log","i18nsize","newdofus","clear","config","clearwebcache","geteventmodeparams","setquality","lowdefskin","copylog","synchrosequence","throw","debugmouseover","idletime","setmonsterspeed"],new MiscInstructionHandler()); + param1.addHandler(["additem","looklike"],new TiphonInstructionHandler()); + param1.addHandler(["listinventory","searchitem","makeinventory"],new InventoryInstructionHandler()); + param1.addHandler(["enablelogs","info","search","searchmonster","searchspell","enablereport","savereport","loadpacket","reccordpacket"],new UtilInstructionHandler()); + param1.addHandler("jptest",new FontInstructionHandler()); + param1.addHandler(["aping","ping"],new LatencyInstructionHandler()); + param1.addHandler(["framelist","framepriority"],new FrameInstructionHandler()); + param1.addHandler(["addmovingcharacter","setanimation","setdirection","memorylog","bot-spectator","bot-fight","tiphon-error","fpsmanager","tacticmode"],new BenchmarkInstructionHandler()); + param1.addHandler(["sendaction","listactions","sendhook"],new ActionsInstructionHandler()); + param1.addHandler(["debuglos","calculatepath","tracepath","debugcellsinline"],new IAInstructionHandler()); + param1.addHandler(["setspellscriptparam","setspellscript"],new FightInstructionHandler()); + param1.addHandler(["playmusic","stopmusic","playambiance","stopambiance","addsoundinplaylist","stopplaylist","playplaylist","activesounds","adduisoundelement","clearsoundcache"],new SoundInstructionHandler()); + param1.addHandler(["floodlivingobject"],new LivingObjectInstructionHandler()); + param1.addHandler(["partdebug","partlist","partinfo","updaterspeed","downloadpart"],new UpdaterInstructionHandler()); + param1.addHandler(["getuid"],new SystemInstructionHandler()); + param1.addHandler(["lua","luarecorder"],new LuaInstructionHandler()); + } + } +} diff --git a/com/ankamagames/dofus/console/chat/EmoteInstructionHandler.as b/com/ankamagames/dofus/console/chat/EmoteInstructionHandler.as index 361be1931..93b1c1cf1 100644 --- a/com/ankamagames/dofus/console/chat/EmoteInstructionHandler.as +++ b/com/ankamagames/dofus/console/chat/EmoteInstructionHandler.as @@ -1,60 +1,61 @@ -package com.ankamagames.dofus.console.chat +package com.ankamagames.dofus.console.chat { - import com.ankamagames.jerakine.console.ConsoleInstructionHandler; - import com.ankamagames.dofus.logic.game.roleplay.actions.EmotePlayRequestAction; - import com.ankamagames.dofus.logic.game.common.managers.PlayedCharacterManager; - import com.ankamagames.dofus.kernel.Kernel; - import com.ankamagames.dofus.logic.game.roleplay.frames.RoleplayEntitiesFrame; - import com.ankamagames.dofus.logic.game.common.frames.AbstractEntitiesFrame; - import com.ankamagames.dofus.network.enums.PlayerLifeStatusEnum; - import com.ankamagames.jerakine.console.ConsoleHandler; - import com.ankamagames.dofus.datacenter.communication.Emoticon; - - public class EmoteInstructionHandler implements ConsoleInstructionHandler - { - - - public function handle(console:ConsoleHandler, cmd:String, args:Array):void - { - var epra:EmotePlayRequestAction; - var emoteId:uint = this.getEmoteId(cmd); - var playerManager:PlayedCharacterManager = PlayedCharacterManager.getInstance(); - var entFrame:AbstractEntitiesFrame = (Kernel.getWorker().getFrame(RoleplayEntitiesFrame) as AbstractEntitiesFrame); - if ((((((emoteId > 0)) && ((playerManager.state == PlayerLifeStatusEnum.STATUS_ALIVE_AND_KICKING)))) && (((((((playerManager.isRidding) || (playerManager.isPetsMounting))) || ((playerManager.infos.entityLook.bonesId == 1)))) || (((entFrame) && (entFrame.creaturesMode))))))) + import com.ankamagames.jerakine.console.ConsoleInstructionHandler; + import com.ankamagames.jerakine.console.ConsoleHandler; + import com.ankamagames.dofus.logic.game.roleplay.actions.EmotePlayRequestAction; + import com.ankamagames.dofus.logic.game.common.managers.PlayedCharacterManager; + import com.ankamagames.dofus.kernel.Kernel; + import com.ankamagames.dofus.logic.game.roleplay.frames.RoleplayEntitiesFrame; + import com.ankamagames.dofus.logic.game.common.frames.AbstractEntitiesFrame; + import com.ankamagames.dofus.network.enums.PlayerLifeStatusEnum; + import com.ankamagames.dofus.datacenter.communication.Emoticon; + + public class EmoteInstructionHandler extends Object implements ConsoleInstructionHandler + { + + public function EmoteInstructionHandler() + { + super(); + } + + public function handle(param1:ConsoleHandler, param2:String, param3:Array) : void + { + var _loc7_:EmotePlayRequestAction = null; + var _loc4_:uint = this.getEmoteId(param2); + var _loc5_:PlayedCharacterManager = PlayedCharacterManager.getInstance(); + var _loc6_:AbstractEntitiesFrame = Kernel.getWorker().getFrame(RoleplayEntitiesFrame) as AbstractEntitiesFrame; + if(_loc4_ > 0 && _loc5_.state == PlayerLifeStatusEnum.STATUS_ALIVE_AND_KICKING && ((_loc5_.isRidding || _loc5_.isPetsMounting || _loc5_.infos.entityLook.bonesId == 1) || (_loc6_ && _loc6_.creaturesMode))) + { + _loc7_ = EmotePlayRequestAction.create(_loc4_); + Kernel.getWorker().process(_loc7_); + } + } + + public function getHelp(param1:String) : String + { + return null; + } + + private function getEmoteId(param1:String) : uint + { + var _loc2_:Emoticon = null; + for each(_loc2_ in Emoticon.getEmoticons()) + { + if(_loc2_.shortcut == param1) { - epra = EmotePlayRequestAction.create(emoteId); - Kernel.getWorker().process(epra); - }; - } - - public function getHelp(cmd:String):String - { - return (null); - } - - private function getEmoteId(cmd:String):uint - { - var emote:Emoticon; - for each (emote in Emoticon.getEmoticons()) + return _loc2_.id; + } + if(_loc2_.defaultAnim == param1) { - if (emote.shortcut == cmd) - { - return (emote.id); - }; - if (emote.defaultAnim == cmd) - { - return (emote.id); - }; - }; - return (0); - } - - public function getParamPossibilities(cmd:String, paramIndex:uint=0, currentParams:Array=null):Array - { - return ([]); - } - - - } -}//package com.ankamagames.dofus.console.chat - + return _loc2_.id; + } + } + return 0; + } + + public function getParamPossibilities(param1:String, param2:uint = 0, param3:Array = null) : Array + { + return []; + } + } +} diff --git a/com/ankamagames/dofus/console/chat/FightInstructionHandler.as b/com/ankamagames/dofus/console/chat/FightInstructionHandler.as index 4973b7ac3..a906c64a3 100644 --- a/com/ankamagames/dofus/console/chat/FightInstructionHandler.as +++ b/com/ankamagames/dofus/console/chat/FightInstructionHandler.as @@ -1,120 +1,121 @@ -package com.ankamagames.dofus.console.chat +package com.ankamagames.dofus.console.chat { - import com.ankamagames.jerakine.console.ConsoleInstructionHandler; - import com.ankamagames.dofus.network.messages.game.context.fight.GameFightOptionToggleMessage; - import com.ankamagames.dofus.network.messages.game.context.GameContextKickMessage; - import com.ankamagames.dofus.logic.game.common.managers.PlayedCharacterManager; - import com.ankamagames.dofus.network.enums.FightOptionsEnum; - import com.ankamagames.dofus.kernel.net.ConnectionsHandler; - import com.ankamagames.dofus.logic.game.fight.frames.FightContextFrame; - import com.ankamagames.jerakine.console.ConsoleHandler; - import com.ankamagames.dofus.kernel.Kernel; - import __AS3__.vec.Vector; - import com.ankamagames.jerakine.data.I18n; - - public class FightInstructionHandler implements ConsoleInstructionHandler - { - - - public function handle(console:ConsoleHandler, cmd:String, args:Array):void - { - var _local_4:String; - var option:uint; - var gfotmsg:GameFightOptionToggleMessage; - var fighterId:int; - var gckmsg:GameContextKickMessage; - switch (cmd) + import com.ankamagames.jerakine.console.ConsoleInstructionHandler; + import com.ankamagames.jerakine.console.ConsoleHandler; + import com.ankamagames.dofus.network.messages.game.context.fight.GameFightOptionToggleMessage; + import com.ankamagames.dofus.network.messages.game.context.GameContextKickMessage; + import com.ankamagames.dofus.logic.game.common.managers.PlayedCharacterManager; + import com.ankamagames.dofus.network.enums.FightOptionsEnum; + import com.ankamagames.dofus.kernel.net.ConnectionsHandler; + import com.ankamagames.dofus.logic.game.fight.frames.FightContextFrame; + import com.ankamagames.dofus.kernel.Kernel; + import com.ankamagames.jerakine.data.I18n; + + public class FightInstructionHandler extends Object implements ConsoleInstructionHandler + { + + public function FightInstructionHandler() + { + super(); + } + + public function handle(param1:ConsoleHandler, param2:String, param3:Array) : void + { + var _loc4_:String = null; + var _loc5_:uint = 0; + var _loc6_:GameFightOptionToggleMessage = null; + var _loc7_:* = 0; + var _loc8_:GameContextKickMessage = null; + switch(param2) + { + case "s": + case "spectator": + if(PlayedCharacterManager.getInstance().isFighting) + { + _loc5_ = FightOptionsEnum.FIGHT_OPTION_SET_SECRET; + _loc6_ = new GameFightOptionToggleMessage(); + _loc6_.initGameFightOptionToggleMessage(_loc5_); + ConnectionsHandler.getConnection().send(_loc6_); + } + break; + case "list": + this.listFighters(param1); + break; + case "players": + this.listFighters(param1); + break; + case "kick": + if(param3.length != 2) + { + return; + } + _loc4_ = param3[1]; + if(FightContextFrame.preFightIsActive) + { + _loc7_ = this.getFighterId(_loc4_); + if(_loc7_ != 0) + { + _loc8_ = new GameContextKickMessage(); + _loc8_.initGameContextKickMessage(1); + ConnectionsHandler.getConnection().send(_loc8_); + } + } + break; + } + } + + private function getFighterId(param1:String) : int + { + var _loc4_:* = 0; + var _loc2_:FightContextFrame = Kernel.getWorker().getFrame(FightContextFrame) as FightContextFrame; + var _loc3_:Vector. = _loc2_.battleFrame.fightersList; + for each(_loc4_ in _loc3_) + { + if(_loc2_.getFighterName(_loc4_) == param1) { - case "s": - case "spectator": - if (PlayedCharacterManager.getInstance().isFighting) - { - option = FightOptionsEnum.FIGHT_OPTION_SET_SECRET; - gfotmsg = new GameFightOptionToggleMessage(); - gfotmsg.initGameFightOptionToggleMessage(option); - ConnectionsHandler.getConnection().send(gfotmsg); - }; - return; - case "list": - this.listFighters(console); - return; - case "players": - this.listFighters(console); - return; - case "kick": - if (args.length != 2) - { - return; - }; - _local_4 = args[1]; - if (FightContextFrame.preFightIsActive) - { - fighterId = this.getFighterId(_local_4); - if (fighterId != 0) - { - gckmsg = new GameContextKickMessage(); - gckmsg.initGameContextKickMessage(1); - ConnectionsHandler.getConnection().send(gckmsg); - }; - }; - return; - }; - } - - private function getFighterId(name:String):int - { - var fighterId:int; - var fightFrame:FightContextFrame = (Kernel.getWorker().getFrame(FightContextFrame) as FightContextFrame); - var fighters:Vector. = fightFrame.battleFrame.fightersList; - for each (fighterId in fighters) + return _loc4_; + } + } + return 0; + } + + private function listFighters(param1:ConsoleHandler) : void + { + var _loc2_:FightContextFrame = null; + var _loc3_:Vector. = null; + var _loc4_:* = 0; + if(PlayedCharacterManager.getInstance().isFighting) + { + _loc2_ = Kernel.getWorker().getFrame(FightContextFrame) as FightContextFrame; + _loc3_ = _loc2_.battleFrame.fightersList; + for each(_loc4_ in _loc3_) { - if (fightFrame.getFighterName(fighterId) == name) - { - return (fighterId); - }; - }; - return (0); - } - - private function listFighters(console:ConsoleHandler):void - { - var fightFrame:FightContextFrame; - var fighters:Vector.; - var fighterId:int; - if (PlayedCharacterManager.getInstance().isFighting) - { - fightFrame = (Kernel.getWorker().getFrame(FightContextFrame) as FightContextFrame); - fighters = fightFrame.battleFrame.fightersList; - for each (fighterId in fighters) - { - console.output(fightFrame.getFighterName(fighterId)); - }; - }; - } - - public function getHelp(cmd:String):String - { - switch (cmd) - { - case "s": - case "spectator": - return (I18n.getUiText("ui.chat.console.help.spectator")); - case "list": - return (I18n.getUiText("ui.chat.console.help.list")); - case "players": - return (I18n.getUiText("ui.chat.console.help.list")); - case "kick": - return (I18n.getUiText("ui.chat.console.help.kick")); - }; - return (I18n.getUiText("ui.chat.console.noHelp", [cmd])); - } - - public function getParamPossibilities(cmd:String, paramIndex:uint=0, currentParams:Array=null):Array - { - return ([]); - } - - - } -}//package com.ankamagames.dofus.console.chat - + param1.output(_loc2_.getFighterName(_loc4_)); + } + } + } + + public function getHelp(param1:String) : String + { + switch(param1) + { + case "s": + case "spectator": + return I18n.getUiText("ui.chat.console.help.spectator"); + case "list": + return I18n.getUiText("ui.chat.console.help.list"); + case "players": + return I18n.getUiText("ui.chat.console.help.list"); + case "kick": + return I18n.getUiText("ui.chat.console.help.kick"); + default: + return I18n.getUiText("ui.chat.console.noHelp",[param1]); + } + } + + public function getParamPossibilities(param1:String, param2:uint = 0, param3:Array = null) : Array + { + return []; + } + } +} diff --git a/com/ankamagames/dofus/console/chat/InfoInstructionHandler.as b/com/ankamagames/dofus/console/chat/InfoInstructionHandler.as index 6977c408d..93524e347 100644 --- a/com/ankamagames/dofus/console/chat/InfoInstructionHandler.as +++ b/com/ankamagames/dofus/console/chat/InfoInstructionHandler.as @@ -1,107 +1,109 @@ -package com.ankamagames.dofus.console.chat +package com.ankamagames.dofus.console.chat { - import com.ankamagames.jerakine.console.ConsoleInstructionHandler; - import com.ankamagames.dofus.network.messages.game.basic.BasicWhoAmIRequestMessage; - import com.ankamagames.dofus.network.messages.game.basic.BasicWhoIsRequestMessage; - import com.ankamagames.dofus.network.ProtocolConstantsEnum; - import com.ankamagames.dofus.kernel.net.ConnectionsHandler; - import com.ankamagames.atouin.managers.MapDisplayManager; - import com.ankamagames.jerakine.data.I18n; - import com.ankamagames.dofus.logic.game.common.managers.PlayedCharacterManager; - import com.ankamagames.atouin.managers.EntitiesManager; - import com.ankamagames.dofus.logic.game.common.managers.TimeManager; - import com.ankamagames.jerakine.console.ConsoleHandler; - import com.ankamagames.dofus.BuildInfos; - import flash.system.Capabilities; - - public class InfoInstructionHandler implements ConsoleInstructionHandler - { - - - public function handle(console:ConsoleHandler, cmd:String, args:Array):void - { - var _local_4:String; - var _local_5:BasicWhoAmIRequestMessage; - var _local_6:String; - var _local_7:String; - var _local_8:String; - var _local_9:Date; - var bwrm:BasicWhoIsRequestMessage; - switch (cmd) - { - case "whois": - if (args.length == 0) - { - return; - }; - _local_4 = args.shift(); - if ((((_local_4.length >= 1)) && ((_local_4.length <= ProtocolConstantsEnum.MAX_PLAYER_OR_ACCOUNT_NAME_LEN)))) - { - bwrm = new BasicWhoIsRequestMessage(); - bwrm.initBasicWhoIsRequestMessage(true, _local_4); - ConnectionsHandler.getConnection().send(bwrm); - }; - return; - case "version": - console.output(this.getVersion()); - return; - case "about": - console.output(this.getVersion()); - return; - case "whoami": - _local_5 = new BasicWhoAmIRequestMessage(); - _local_5.initBasicWhoAmIRequestMessage(true); - ConnectionsHandler.getConnection().send(_local_5); - return; - case "mapid": - _local_6 = ((MapDisplayManager.getInstance().currentMapPoint.x + "/") + MapDisplayManager.getInstance().currentMapPoint.y); - _local_7 = MapDisplayManager.getInstance().currentMapPoint.mapId.toString(); - console.output(I18n.getUiText("ui.chat.console.currentMap", [((((PlayedCharacterManager.getInstance().currentMap.outdoorX + "/") + PlayedCharacterManager.getInstance().currentMap.outdoorY) + ", ") + _local_6), _local_7])); - return; - case "cellid": - _local_8 = EntitiesManager.getInstance().getEntity(PlayedCharacterManager.getInstance().id).position.cellId.toString(); - console.output(I18n.getUiText("ui.console.chat.currentCell", [_local_8])); - return; - case "time": - _local_9 = new Date(); - console.output(((TimeManager.getInstance().formatDateIG(0) + " - ") + TimeManager.getInstance().formatClock(0, false))); - return; - }; - } - - private function getVersion():String - { - return (((((((((("----------------------------------------------\n" + "DOFUS CLIENT v ") + BuildInfos.BUILD_VERSION) + "\n") + "(c) ANKAMA GAMES (") + BuildInfos.BUILD_DATE) + ") \n") + "Flash player ") + Capabilities.version) + "\n----------------------------------------------")); - } - - public function getHelp(cmd:String):String - { - switch (cmd) - { - case "version": - return (I18n.getUiText("ui.chat.console.help.version")); - case "about": - return (I18n.getUiText("ui.chat.console.help.version")); - case "whois": - return (I18n.getUiText("ui.chat.console.help.whois")); - case "whoami": - return (I18n.getUiText("ui.chat.console.help.whoami")); - case "cellid": - return (I18n.getUiText("ui.chat.console.help.cellid")); - case "mapid": - return (I18n.getUiText("ui.chat.console.help.mapid")); - case "time": - return (I18n.getUiText("ui.chat.console.help.time")); - }; - return (I18n.getUiText("ui.chat.console.noHelp", [cmd])); - } - - public function getParamPossibilities(cmd:String, paramIndex:uint=0, currentParams:Array=null):Array - { - return ([]); - } - - - } -}//package com.ankamagames.dofus.console.chat - + import com.ankamagames.jerakine.console.ConsoleInstructionHandler; + import com.ankamagames.jerakine.console.ConsoleHandler; + import com.ankamagames.dofus.network.messages.game.basic.BasicWhoAmIRequestMessage; + import com.ankamagames.dofus.network.messages.game.basic.BasicWhoIsRequestMessage; + import com.ankamagames.dofus.network.ProtocolConstantsEnum; + import com.ankamagames.dofus.kernel.net.ConnectionsHandler; + import com.ankamagames.atouin.managers.MapDisplayManager; + import com.ankamagames.jerakine.data.I18n; + import com.ankamagames.dofus.logic.game.common.managers.PlayedCharacterManager; + import com.ankamagames.atouin.managers.EntitiesManager; + import com.ankamagames.dofus.logic.game.common.managers.TimeManager; + import com.ankamagames.dofus.BuildInfos; + import flash.system.Capabilities; + + public class InfoInstructionHandler extends Object implements ConsoleInstructionHandler + { + + public function InfoInstructionHandler() + { + super(); + } + + public function handle(param1:ConsoleHandler, param2:String, param3:Array) : void + { + var _loc4_:String = null; + var _loc5_:BasicWhoAmIRequestMessage = null; + var _loc6_:String = null; + var _loc7_:String = null; + var _loc8_:String = null; + var _loc9_:Date = null; + var _loc10_:BasicWhoIsRequestMessage = null; + switch(param2) + { + case "whois": + if(param3.length == 0) + { + return; + } + _loc4_ = param3.shift(); + if(_loc4_.length >= 1 && _loc4_.length <= ProtocolConstantsEnum.MAX_PLAYER_OR_ACCOUNT_NAME_LEN) + { + _loc10_ = new BasicWhoIsRequestMessage(); + _loc10_.initBasicWhoIsRequestMessage(true,_loc4_); + ConnectionsHandler.getConnection().send(_loc10_); + } + break; + case "version": + param1.output(this.getVersion()); + break; + case "about": + param1.output(this.getVersion()); + break; + case "whoami": + _loc5_ = new BasicWhoAmIRequestMessage(); + _loc5_.initBasicWhoAmIRequestMessage(true); + ConnectionsHandler.getConnection().send(_loc5_); + break; + case "mapid": + _loc6_ = MapDisplayManager.getInstance().currentMapPoint.x + "/" + MapDisplayManager.getInstance().currentMapPoint.y; + _loc7_ = MapDisplayManager.getInstance().currentMapPoint.mapId.toString(); + param1.output(I18n.getUiText("ui.chat.console.currentMap",[PlayedCharacterManager.getInstance().currentMap.outdoorX + "/" + PlayedCharacterManager.getInstance().currentMap.outdoorY + ", " + _loc6_,_loc7_])); + break; + case "cellid": + _loc8_ = EntitiesManager.getInstance().getEntity(PlayedCharacterManager.getInstance().id).position.cellId.toString(); + param1.output(I18n.getUiText("ui.console.chat.currentCell",[_loc8_])); + break; + case "time": + _loc9_ = new Date(); + param1.output(TimeManager.getInstance().formatDateIG(0) + " - " + TimeManager.getInstance().formatClock(0,false)); + break; + } + } + + private function getVersion() : String + { + return "----------------------------------------------\n" + "DOFUS CLIENT v " + BuildInfos.BUILD_VERSION + "\n" + "(c) ANKAMA GAMES (" + BuildInfos.BUILD_DATE + ") \n" + "Flash player " + Capabilities.version + "\n----------------------------------------------"; + } + + public function getHelp(param1:String) : String + { + switch(param1) + { + case "version": + return I18n.getUiText("ui.chat.console.help.version"); + case "about": + return I18n.getUiText("ui.chat.console.help.version"); + case "whois": + return I18n.getUiText("ui.chat.console.help.whois"); + case "whoami": + return I18n.getUiText("ui.chat.console.help.whoami"); + case "cellid": + return I18n.getUiText("ui.chat.console.help.cellid"); + case "mapid": + return I18n.getUiText("ui.chat.console.help.mapid"); + case "time": + return I18n.getUiText("ui.chat.console.help.time"); + default: + return I18n.getUiText("ui.chat.console.noHelp",[param1]); + } + } + + public function getParamPossibilities(param1:String, param2:uint = 0, param3:Array = null) : Array + { + return []; + } + } +} diff --git a/com/ankamagames/dofus/console/chat/MessagingInstructionHandler.as b/com/ankamagames/dofus/console/chat/MessagingInstructionHandler.as index 822cbf3c4..47e6e9f96 100644 --- a/com/ankamagames/dofus/console/chat/MessagingInstructionHandler.as +++ b/com/ankamagames/dofus/console/chat/MessagingInstructionHandler.as @@ -1,54 +1,56 @@ -package com.ankamagames.dofus.console.chat +package com.ankamagames.dofus.console.chat { - import com.ankamagames.jerakine.console.ConsoleInstructionHandler; - import com.ankamagames.jerakine.console.ConsoleHandler; - import com.ankamagames.jerakine.data.I18n; - - public class MessagingInstructionHandler implements ConsoleInstructionHandler - { - - - public function handle(console:ConsoleHandler, cmd:String, args:Array):void - { - switch (cmd) - { - }; - } - - public function getHelp(cmd:String):String - { - switch (cmd) - { - case "w": - return (I18n.getUiText("ui.chat.console.help.whisper")); - case "whisper": - return (I18n.getUiText("ui.chat.console.help.whisper")); - case "msg": - return (I18n.getUiText("ui.chat.console.help.whisper")); - case "t": - return (I18n.getUiText("ui.chat.console.help.teammessage")); - case "g": - return (I18n.getUiText("ui.chat.console.help.guildmessage")); - case "p": - return (I18n.getUiText("ui.chat.console.help.groupmessage")); - case "a": - return (I18n.getUiText("ui.chat.console.help.alliancemessage")); - case "r": - return (I18n.getUiText("ui.chat.console.help.aroundguildmessage")); - case "b": - return (I18n.getUiText("ui.chat.console.help.sellbuymessage")); - case "m": - return (I18n.getUiText("ui.chat.console.help.meetmessage")); - }; - return (I18n.getUiText("ui.chat.console.noHelp", [cmd])); - } - - public function getParamPossibilities(cmd:String, paramIndex:uint=0, currentParams:Array=null):Array - { - return ([]); - } - - - } -}//package com.ankamagames.dofus.console.chat - + import com.ankamagames.jerakine.console.ConsoleInstructionHandler; + import com.ankamagames.jerakine.console.ConsoleHandler; + import com.ankamagames.jerakine.data.I18n; + + public class MessagingInstructionHandler extends Object implements ConsoleInstructionHandler + { + + public function MessagingInstructionHandler() + { + super(); + } + + public function handle(param1:ConsoleHandler, param2:String, param3:Array) : void + { + if(0) + { + } + } + + public function getHelp(param1:String) : String + { + switch(param1) + { + case "w": + return I18n.getUiText("ui.chat.console.help.whisper"); + case "whisper": + return I18n.getUiText("ui.chat.console.help.whisper"); + case "msg": + return I18n.getUiText("ui.chat.console.help.whisper"); + case "t": + return I18n.getUiText("ui.chat.console.help.teammessage"); + case "g": + return I18n.getUiText("ui.chat.console.help.guildmessage"); + case "p": + return I18n.getUiText("ui.chat.console.help.groupmessage"); + case "a": + return I18n.getUiText("ui.chat.console.help.alliancemessage"); + case "r": + return I18n.getUiText("ui.chat.console.help.aroundguildmessage"); + case "b": + return I18n.getUiText("ui.chat.console.help.sellbuymessage"); + case "m": + return I18n.getUiText("ui.chat.console.help.meetmessage"); + default: + return I18n.getUiText("ui.chat.console.noHelp",[param1]); + } + } + + public function getParamPossibilities(param1:String, param2:uint = 0, param3:Array = null) : Array + { + return []; + } + } +} diff --git a/com/ankamagames/dofus/console/chat/OptionsInstructionHandler.as b/com/ankamagames/dofus/console/chat/OptionsInstructionHandler.as index 7f401f76c..09a5e8587 100644 --- a/com/ankamagames/dofus/console/chat/OptionsInstructionHandler.as +++ b/com/ankamagames/dofus/console/chat/OptionsInstructionHandler.as @@ -1,51 +1,53 @@ -package com.ankamagames.dofus.console.chat +package com.ankamagames.dofus.console.chat { - import com.ankamagames.jerakine.console.ConsoleInstructionHandler; - import com.ankamagames.berilia.managers.KernelEventsManager; - import com.ankamagames.dofus.misc.lists.ChatHookList; - import com.ankamagames.jerakine.console.ConsoleHandler; - import com.ankamagames.jerakine.data.I18n; - - public class OptionsInstructionHandler implements ConsoleInstructionHandler - { - - - public function handle(console:ConsoleHandler, cmd:String, args:Array):void - { - switch (cmd) - { - case "tab": - if (((!(args[0])) || ((args[0] < 1)))) - { - console.output("Error : need a valid tab index."); - return; - }; - KernelEventsManager.getInstance().processCallback(ChatHookList.TabNameChange, args[0], args[1]); - return; - case "clear": - KernelEventsManager.getInstance().processCallback(ChatHookList.ClearChat); - return; - }; - } - - public function getHelp(cmd:String):String - { - switch (cmd) - { - case "tab": - return (I18n.getUiText("ui.chat.console.help.tab")); - case "clear": - return (I18n.getUiText("ui.chat.console.help.clear")); - }; - return (I18n.getUiText("ui.chat.console.noHelp", [cmd])); - } - - public function getParamPossibilities(cmd:String, paramIndex:uint=0, currentParams:Array=null):Array - { - return ([]); - } - - - } -}//package com.ankamagames.dofus.console.chat - + import com.ankamagames.jerakine.console.ConsoleInstructionHandler; + import com.ankamagames.jerakine.console.ConsoleHandler; + import com.ankamagames.berilia.managers.KernelEventsManager; + import com.ankamagames.dofus.misc.lists.ChatHookList; + import com.ankamagames.jerakine.data.I18n; + + public class OptionsInstructionHandler extends Object implements ConsoleInstructionHandler + { + + public function OptionsInstructionHandler() + { + super(); + } + + public function handle(param1:ConsoleHandler, param2:String, param3:Array) : void + { + switch(param2) + { + case "tab": + if(!param3[0] || param3[0] < 1) + { + param1.output("Error : need a valid tab index."); + return; + } + KernelEventsManager.getInstance().processCallback(ChatHookList.TabNameChange,param3[0],param3[1]); + break; + case "clear": + KernelEventsManager.getInstance().processCallback(ChatHookList.ClearChat); + break; + } + } + + public function getHelp(param1:String) : String + { + switch(param1) + { + case "tab": + return I18n.getUiText("ui.chat.console.help.tab"); + case "clear": + return I18n.getUiText("ui.chat.console.help.clear"); + default: + return I18n.getUiText("ui.chat.console.noHelp",[param1]); + } + } + + public function getParamPossibilities(param1:String, param2:uint = 0, param3:Array = null) : Array + { + return []; + } + } +} diff --git a/com/ankamagames/dofus/console/chat/SocialInstructionHandler.as b/com/ankamagames/dofus/console/chat/SocialInstructionHandler.as index 37d6a4285..b2621deca 100644 --- a/com/ankamagames/dofus/console/chat/SocialInstructionHandler.as +++ b/com/ankamagames/dofus/console/chat/SocialInstructionHandler.as @@ -1,118 +1,120 @@ -package com.ankamagames.dofus.console.chat +package com.ankamagames.dofus.console.chat { - import com.ankamagames.jerakine.console.ConsoleInstructionHandler; - import com.ankamagames.dofus.logic.game.common.actions.party.PartyInvitationAction; - import com.ankamagames.dofus.network.messages.game.friend.FriendAddRequestMessage; - import com.ankamagames.dofus.network.messages.game.friend.IgnoredAddRequestMessage; - import com.ankamagames.jerakine.data.I18n; - import com.ankamagames.dofus.logic.game.common.managers.PlayedCharacterManager; - import com.ankamagames.dofus.kernel.net.ConnectionsHandler; - import com.ankamagames.dofus.kernel.Kernel; - import com.ankamagames.jerakine.console.ConsoleHandler; - - public class SocialInstructionHandler implements ConsoleInstructionHandler - { - - - public function handle(console:ConsoleHandler, cmd:String, args:Array):void - { - var _local_4:String; - var _local_5:String; - var _local_6:String; - var _local_7:PartyInvitationAction; - var reason:String; - var farmsg:FriendAddRequestMessage; - var iarmsg:IgnoredAddRequestMessage; - switch (cmd) - { - case "f": - if (args.length != 2) - { - return; - }; - _local_4 = (args[0] as String); - _local_5 = (args[1] as String); - if ((((_local_5.length < 2)) || ((_local_5.length > 20)))) - { - reason = I18n.getUiText("ui.social.friend.addFailureNotFound"); - console.output(reason); - return; - }; - if (_local_5 != PlayedCharacterManager.getInstance().infos.name) - { - if ((((_local_4 == "a")) || ((_local_4 == "+")))) - { - farmsg = new FriendAddRequestMessage(); - farmsg.initFriendAddRequestMessage(_local_5); - ConnectionsHandler.getConnection().send(farmsg); - }; - } - else - { - console.output(I18n.getUiText("ui.social.friend.addFailureEgocentric")); - }; - return; - case "ignore": - if (args.length != 2) - { - return; - }; - _local_4 = (args[0] as String); - _local_5 = (args[1] as String); - if ((((_local_5.length < 2)) || ((_local_5.length > 20)))) - { - reason = I18n.getUiText("ui.social.friend.addFailureNotFound"); - console.output(reason); - return; - }; - if (_local_5 == PlayedCharacterManager.getInstance().infos.name) - { - console.output(I18n.getUiText("ui.social.friend.addFailureEgocentric")); - return; - }; - if ((((_local_4 == "a")) || ((_local_4 == "+")))) - { - iarmsg = new IgnoredAddRequestMessage(); - iarmsg.initIgnoredAddRequestMessage(_local_5); - ConnectionsHandler.getConnection().send(iarmsg); - }; - return; - case "invite": - if (args.length != 1) - { - return; - }; - _local_6 = (args[0] as String); - if ((((((_local_6 == "")) || ((_local_6.length < 2)))) || ((_local_6.length > 19)))) - { - return; - }; - _local_7 = PartyInvitationAction.create(_local_6); - Kernel.getWorker().process(_local_7); - return; - }; - } - - public function getHelp(cmd:String):String - { - switch (cmd) - { - case "f": - return (I18n.getUiText("ui.chat.console.help.friendhelp")); - case "ignore": - return (I18n.getUiText("ui.chat.console.help.enemyhelp")); - case "invite": - return (I18n.getUiText("ui.chat.console.help.invite")); - }; - return (I18n.getUiText("ui.chat.console.noHelp", [cmd])); - } - - public function getParamPossibilities(cmd:String, paramIndex:uint=0, currentParams:Array=null):Array - { - return ([]); - } - - - } -}//package com.ankamagames.dofus.console.chat - + import com.ankamagames.jerakine.console.ConsoleInstructionHandler; + import com.ankamagames.jerakine.console.ConsoleHandler; + import com.ankamagames.dofus.logic.game.common.actions.party.PartyInvitationAction; + import com.ankamagames.dofus.network.messages.game.friend.FriendAddRequestMessage; + import com.ankamagames.dofus.network.messages.game.friend.IgnoredAddRequestMessage; + import com.ankamagames.jerakine.data.I18n; + import com.ankamagames.dofus.logic.game.common.managers.PlayedCharacterManager; + import com.ankamagames.dofus.kernel.net.ConnectionsHandler; + import com.ankamagames.dofus.kernel.Kernel; + + public class SocialInstructionHandler extends Object implements ConsoleInstructionHandler + { + + public function SocialInstructionHandler() + { + super(); + } + + public function handle(param1:ConsoleHandler, param2:String, param3:Array) : void + { + var _loc4_:String = null; + var _loc5_:String = null; + var _loc6_:String = null; + var _loc7_:PartyInvitationAction = null; + var _loc8_:String = null; + var _loc9_:FriendAddRequestMessage = null; + var _loc10_:IgnoredAddRequestMessage = null; + switch(param2) + { + case "f": + if(param3.length != 2) + { + return; + } + _loc4_ = param3[0] as String; + _loc5_ = param3[1] as String; + if(_loc5_.length < 2 || _loc5_.length > 20) + { + _loc8_ = I18n.getUiText("ui.social.friend.addFailureNotFound"); + param1.output(_loc8_); + return; + } + if(_loc5_ != PlayedCharacterManager.getInstance().infos.name) + { + if(_loc4_ == "a" || _loc4_ == "+") + { + _loc9_ = new FriendAddRequestMessage(); + _loc9_.initFriendAddRequestMessage(_loc5_); + ConnectionsHandler.getConnection().send(_loc9_); + } + } + else + { + param1.output(I18n.getUiText("ui.social.friend.addFailureEgocentric")); + } + break; + case "ignore": + if(param3.length != 2) + { + return; + } + _loc4_ = param3[0] as String; + _loc5_ = param3[1] as String; + if(_loc5_.length < 2 || _loc5_.length > 20) + { + _loc8_ = I18n.getUiText("ui.social.friend.addFailureNotFound"); + param1.output(_loc8_); + return; + } + if(_loc5_ == PlayedCharacterManager.getInstance().infos.name) + { + param1.output(I18n.getUiText("ui.social.friend.addFailureEgocentric")); + return; + } + if(_loc4_ == "a" || _loc4_ == "+") + { + _loc10_ = new IgnoredAddRequestMessage(); + _loc10_.initIgnoredAddRequestMessage(_loc5_); + ConnectionsHandler.getConnection().send(_loc10_); + } + break; + case "invite": + if(param3.length != 1) + { + return; + } + _loc6_ = param3[0] as String; + if(_loc6_ == "" || _loc6_.length < 2 || _loc6_.length > 19) + { + return; + } + _loc7_ = PartyInvitationAction.create(_loc6_); + Kernel.getWorker().process(_loc7_); + break; + } + } + + public function getHelp(param1:String) : String + { + switch(param1) + { + case "f": + return I18n.getUiText("ui.chat.console.help.friendhelp"); + case "ignore": + return I18n.getUiText("ui.chat.console.help.enemyhelp"); + case "invite": + return I18n.getUiText("ui.chat.console.help.invite"); + default: + return I18n.getUiText("ui.chat.console.noHelp",[param1]); + } + } + + public function getParamPossibilities(param1:String, param2:uint = 0, param3:Array = null) : Array + { + return []; + } + } +} diff --git a/com/ankamagames/dofus/console/chat/StatusInstructionHandler.as b/com/ankamagames/dofus/console/chat/StatusInstructionHandler.as index fe7778a64..923753f1f 100644 --- a/com/ankamagames/dofus/console/chat/StatusInstructionHandler.as +++ b/com/ankamagames/dofus/console/chat/StatusInstructionHandler.as @@ -1,101 +1,103 @@ -package com.ankamagames.dofus.console.chat +package com.ankamagames.dofus.console.chat { - import com.ankamagames.jerakine.console.ConsoleInstructionHandler; - import com.ankamagames.dofus.network.types.game.character.status.PlayerStatus; - import com.ankamagames.dofus.network.messages.game.context.roleplay.death.GameRolePlayFreeSoulRequestMessage; - import com.ankamagames.dofus.network.messages.game.character.status.PlayerStatusUpdateRequestMessage; - import com.ankamagames.dofus.network.types.game.character.status.PlayerStatusExtended; - import com.ankamagames.dofus.network.enums.PlayerStatusEnum; - import com.ankamagames.berilia.managers.KernelEventsManager; - import com.ankamagames.dofus.misc.lists.SocialHookList; - import com.ankamagames.dofus.kernel.net.ConnectionsHandler; - import com.ankamagames.jerakine.data.I18n; - import com.ankamagames.jerakine.console.ConsoleHandler; - - public class StatusInstructionHandler implements ConsoleInstructionHandler - { - - - public function handle(console:ConsoleHandler, cmd:String, args:Array):void - { - var status:PlayerStatus; - var _local_6:GameRolePlayFreeSoulRequestMessage; - var message:String; - var s:String; - var psurmsg:PlayerStatusUpdateRequestMessage = new PlayerStatusUpdateRequestMessage(); - switch (cmd) - { - case "away": - case I18n.getUiText("ui.chat.status.away").toLocaleLowerCase(): - if (args.length > 0) - { - message = ""; - for each (s in args) - { - message = (message + (s + " ")); - }; - status = new PlayerStatusExtended(); - PlayerStatusExtended(status).initPlayerStatusExtended(PlayerStatusEnum.PLAYER_STATUS_AFK, message); - KernelEventsManager.getInstance().processCallback(SocialHookList.NewAwayMessage, message); - } - else - { - status = new PlayerStatus(); - status.initPlayerStatus(PlayerStatusEnum.PLAYER_STATUS_AFK); - }; - psurmsg.initPlayerStatusUpdateRequestMessage(status); - ConnectionsHandler.getConnection().send(psurmsg); - return; - case I18n.getUiText("ui.chat.status.solo").toLocaleLowerCase(): - status = new PlayerStatus(); - status.initPlayerStatus(PlayerStatusEnum.PLAYER_STATUS_SOLO); - psurmsg.initPlayerStatusUpdateRequestMessage(status); - ConnectionsHandler.getConnection().send(psurmsg); - return; - case I18n.getUiText("ui.chat.status.private").toLocaleLowerCase(): - status = new PlayerStatus(); - status.initPlayerStatus(PlayerStatusEnum.PLAYER_STATUS_PRIVATE); - psurmsg.initPlayerStatusUpdateRequestMessage(status); - ConnectionsHandler.getConnection().send(psurmsg); - return; - case I18n.getUiText("ui.chat.status.availiable").toLocaleLowerCase(): - status = new PlayerStatus(); - status.initPlayerStatus(PlayerStatusEnum.PLAYER_STATUS_AVAILABLE); - psurmsg.initPlayerStatusUpdateRequestMessage(status); - ConnectionsHandler.getConnection().send(psurmsg); - return; - case "release": - _local_6 = new GameRolePlayFreeSoulRequestMessage(); - ConnectionsHandler.getConnection().send(_local_6); - return; - }; - } - - public function getHelp(cmd:String):String - { - switch (cmd) - { - case "away": - case I18n.getUiText("ui.chat.status.away").toLocaleLowerCase(): - return (((("- /" + I18n.getUiText("ui.chat.status.away".toLocaleLowerCase())) + I18n.getUiText("ui.common.colon")) + I18n.getUiText("ui.chat.status.awaytooltip"))); - case I18n.getUiText("ui.chat.status.solo").toLocaleLowerCase(): - return (((("- /" + I18n.getUiText("ui.chat.status.solo").toLocaleLowerCase()) + I18n.getUiText("ui.common.colon")) + I18n.getUiText("ui.chat.status.solotooltip"))); - case I18n.getUiText("ui.chat.status.private").toLocaleLowerCase(): - return (((("- /" + I18n.getUiText("ui.chat.status.private").toLocaleLowerCase()) + I18n.getUiText("ui.common.colon")) + I18n.getUiText("ui.chat.status.privatetooltip"))); - case I18n.getUiText("ui.chat.status.availiable").toLocaleLowerCase(): - return (((("- /" + I18n.getUiText("ui.chat.status.availiable").toLocaleLowerCase()) + I18n.getUiText("ui.common.colon")) + I18n.getUiText("ui.chat.status.availiabletooltip"))); - case "release": - return (I18n.getUiText("ui.common.freeSoul")); - }; - return (I18n.getUiText("ui.chat.console.noHelp", [cmd])); - } - - public function getParamPossibilities(cmd:String, paramIndex:uint=0, currentParams:Array=null):Array - { - return ([]); - } - - - } -}//package com.ankamagames.dofus.console.chat - + import com.ankamagames.jerakine.console.ConsoleInstructionHandler; + import com.ankamagames.jerakine.console.ConsoleHandler; + import com.ankamagames.dofus.network.types.game.character.status.PlayerStatus; + import com.ankamagames.dofus.network.messages.game.context.roleplay.death.GameRolePlayFreeSoulRequestMessage; + import com.ankamagames.dofus.network.messages.game.character.status.PlayerStatusUpdateRequestMessage; + import com.ankamagames.dofus.network.types.game.character.status.PlayerStatusExtended; + import com.ankamagames.dofus.network.enums.PlayerStatusEnum; + import com.ankamagames.berilia.managers.KernelEventsManager; + import com.ankamagames.dofus.misc.lists.SocialHookList; + import com.ankamagames.dofus.kernel.net.ConnectionsHandler; + import com.ankamagames.jerakine.data.I18n; + + public class StatusInstructionHandler extends Object implements ConsoleInstructionHandler + { + + public function StatusInstructionHandler() + { + super(); + } + + public function handle(param1:ConsoleHandler, param2:String, param3:Array) : void + { + var _loc4_:PlayerStatus = null; + var _loc6_:GameRolePlayFreeSoulRequestMessage = null; + var _loc7_:String = null; + var _loc8_:String = null; + var _loc5_:PlayerStatusUpdateRequestMessage = new PlayerStatusUpdateRequestMessage(); + switch(param2) + { + case "away": + case I18n.getUiText("ui.chat.status.away").toLocaleLowerCase(): + if(param3.length > 0) + { + _loc7_ = ""; + for each(_loc8_ in param3) + { + _loc7_ = _loc7_ + (_loc8_ + " "); + } + _loc4_ = new PlayerStatusExtended(); + PlayerStatusExtended(_loc4_).initPlayerStatusExtended(PlayerStatusEnum.PLAYER_STATUS_AFK,_loc7_); + KernelEventsManager.getInstance().processCallback(SocialHookList.NewAwayMessage,_loc7_); + } + else + { + _loc4_ = new PlayerStatus(); + _loc4_.initPlayerStatus(PlayerStatusEnum.PLAYER_STATUS_AFK); + } + _loc5_.initPlayerStatusUpdateRequestMessage(_loc4_); + ConnectionsHandler.getConnection().send(_loc5_); + break; + case I18n.getUiText("ui.chat.status.solo").toLocaleLowerCase(): + _loc4_ = new PlayerStatus(); + _loc4_.initPlayerStatus(PlayerStatusEnum.PLAYER_STATUS_SOLO); + _loc5_.initPlayerStatusUpdateRequestMessage(_loc4_); + ConnectionsHandler.getConnection().send(_loc5_); + break; + case I18n.getUiText("ui.chat.status.private").toLocaleLowerCase(): + _loc4_ = new PlayerStatus(); + _loc4_.initPlayerStatus(PlayerStatusEnum.PLAYER_STATUS_PRIVATE); + _loc5_.initPlayerStatusUpdateRequestMessage(_loc4_); + ConnectionsHandler.getConnection().send(_loc5_); + break; + case I18n.getUiText("ui.chat.status.availiable").toLocaleLowerCase(): + _loc4_ = new PlayerStatus(); + _loc4_.initPlayerStatus(PlayerStatusEnum.PLAYER_STATUS_AVAILABLE); + _loc5_.initPlayerStatusUpdateRequestMessage(_loc4_); + ConnectionsHandler.getConnection().send(_loc5_); + break; + case "release": + _loc6_ = new GameRolePlayFreeSoulRequestMessage(); + ConnectionsHandler.getConnection().send(_loc6_); + break; + } + } + + public function getHelp(param1:String) : String + { + switch(param1) + { + case "away": + case I18n.getUiText("ui.chat.status.away").toLocaleLowerCase(): + return "- /" + I18n.getUiText("ui.chat.status.away".toLocaleLowerCase()) + I18n.getUiText("ui.common.colon") + I18n.getUiText("ui.chat.status.awaytooltip"); + case I18n.getUiText("ui.chat.status.solo").toLocaleLowerCase(): + return "- /" + I18n.getUiText("ui.chat.status.solo").toLocaleLowerCase() + I18n.getUiText("ui.common.colon") + I18n.getUiText("ui.chat.status.solotooltip"); + case I18n.getUiText("ui.chat.status.private").toLocaleLowerCase(): + return "- /" + I18n.getUiText("ui.chat.status.private").toLocaleLowerCase() + I18n.getUiText("ui.common.colon") + I18n.getUiText("ui.chat.status.privatetooltip"); + case I18n.getUiText("ui.chat.status.availiable").toLocaleLowerCase(): + return "- /" + I18n.getUiText("ui.chat.status.availiable").toLocaleLowerCase() + I18n.getUiText("ui.common.colon") + I18n.getUiText("ui.chat.status.availiabletooltip"); + case "release": + return I18n.getUiText("ui.common.freeSoul"); + default: + return I18n.getUiText("ui.chat.console.noHelp",[param1]); + } + } + + public function getParamPossibilities(param1:String, param2:uint = 0, param3:Array = null) : Array + { + return []; + } + } +} diff --git a/com/ankamagames/dofus/console/common/LatencyInstructionHandler.as b/com/ankamagames/dofus/console/common/LatencyInstructionHandler.as index 817cc49fe..8078d3a1a 100644 --- a/com/ankamagames/dofus/console/common/LatencyInstructionHandler.as +++ b/com/ankamagames/dofus/console/common/LatencyInstructionHandler.as @@ -1,62 +1,64 @@ -package com.ankamagames.dofus.console.common +package com.ankamagames.dofus.console.common { - import com.ankamagames.jerakine.console.ConsoleInstructionHandler; - import com.ankamagames.dofus.logic.common.frames.LatencyFrame; - import com.ankamagames.dofus.network.messages.common.basic.BasicPingMessage; - import com.ankamagames.jerakine.network.IServerConnection; - import com.ankamagames.dofus.kernel.Kernel; - import com.ankamagames.dofus.kernel.net.ConnectionsHandler; - import flash.utils.getTimer; - import com.ankamagames.jerakine.console.ConsoleHandler; - import com.ankamagames.jerakine.data.I18n; - - public class LatencyInstructionHandler implements ConsoleInstructionHandler - { - - - public function handle(console:ConsoleHandler, cmd:String, args:Array):void - { - var _local_4:LatencyFrame; - var _local_5:BasicPingMessage; - var _local_6:IServerConnection; - switch (cmd) - { - case "ping": - _local_4 = (Kernel.getWorker().getFrame(LatencyFrame) as LatencyFrame); - if (_local_4.pingRequested != 0) - { - return; - }; - _local_5 = new BasicPingMessage().initBasicPingMessage(); - ConnectionsHandler.getConnection().send(_local_5); - _local_4.pingRequested = getTimer(); - console.output("Ping..."); - return; - case "aping": - _local_6 = ConnectionsHandler.getConnection().mainConnection; - console.output((((((("Avg ping : " + _local_6.latencyAvg) + "ms for the last ") + _local_6.latencySamplesCount) + " packets (max : ") + _local_6.latencySamplesMax) + ")")); - return; - }; - } - - public function getHelp(cmd:String):String - { - switch (cmd) - { - case "ping": - return (I18n.getUiText("ui.chat.console.help.ping")); - case "aping": - return (I18n.getUiText("ui.chat.console.help.aping")); - }; - return (I18n.getUiText("ui.chat.console.noHelp", [cmd])); - } - - public function getParamPossibilities(cmd:String, paramIndex:uint=0, currentParams:Array=null):Array - { - return ([]); - } - - - } -}//package com.ankamagames.dofus.console.common - + import com.ankamagames.jerakine.console.ConsoleInstructionHandler; + import com.ankamagames.jerakine.console.ConsoleHandler; + import com.ankamagames.dofus.logic.common.frames.LatencyFrame; + import com.ankamagames.dofus.network.messages.common.basic.BasicPingMessage; + import com.ankamagames.jerakine.network.IServerConnection; + import com.ankamagames.dofus.kernel.Kernel; + import com.ankamagames.dofus.kernel.net.ConnectionsHandler; + import flash.utils.getTimer; + import com.ankamagames.jerakine.data.I18n; + + public class LatencyInstructionHandler extends Object implements ConsoleInstructionHandler + { + + public function LatencyInstructionHandler() + { + super(); + } + + public function handle(param1:ConsoleHandler, param2:String, param3:Array) : void + { + var _loc4_:LatencyFrame = null; + var _loc5_:BasicPingMessage = null; + var _loc6_:IServerConnection = null; + switch(param2) + { + case "ping": + _loc4_ = Kernel.getWorker().getFrame(LatencyFrame) as LatencyFrame; + if(_loc4_.pingRequested != 0) + { + break; + } + _loc5_ = new BasicPingMessage().initBasicPingMessage(); + ConnectionsHandler.getConnection().send(_loc5_); + _loc4_.pingRequested = getTimer(); + param1.output("Ping..."); + break; + case "aping": + _loc6_ = ConnectionsHandler.getConnection().mainConnection; + param1.output("Avg ping : " + _loc6_.latencyAvg + "ms for the last " + _loc6_.latencySamplesCount + " packets (max : " + _loc6_.latencySamplesMax + ")"); + break; + } + } + + public function getHelp(param1:String) : String + { + switch(param1) + { + case "ping": + return I18n.getUiText("ui.chat.console.help.ping"); + case "aping": + return I18n.getUiText("ui.chat.console.help.aping"); + default: + return I18n.getUiText("ui.chat.console.noHelp",[param1]); + } + } + + public function getParamPossibilities(param1:String, param2:uint = 0, param3:Array = null) : Array + { + return []; + } + } +} diff --git a/com/ankamagames/dofus/console/debug/ActionsInstructionHandler.as b/com/ankamagames/dofus/console/debug/ActionsInstructionHandler.as index 3f0c1fa88..179a30b4a 100644 --- a/com/ankamagames/dofus/console/debug/ActionsInstructionHandler.as +++ b/com/ankamagames/dofus/console/debug/ActionsInstructionHandler.as @@ -1,268 +1,271 @@ -package com.ankamagames.dofus.console.debug +package com.ankamagames.dofus.console.debug { - import com.ankamagames.jerakine.console.ConsoleInstructionHandler; - import com.ankamagames.jerakine.logger.Logger; - import com.ankamagames.jerakine.logger.Log; - import flash.utils.getQualifiedClassName; - import com.ankamagames.dofus.misc.utils.DofusApiAction; - import com.ankamagames.berilia.types.data.Hook; - import com.ankamagames.jerakine.handlers.messages.Action; - import flash.utils.describeType; - import com.ankamagames.jerakine.utils.misc.CallWithParameters; - import com.ankamagames.dofus.kernel.Kernel; - import com.ankamagames.berilia.utils.errors.ApiError; - import com.ankamagames.berilia.utils.errors.UntrustedApiCallError; - import com.ankamagames.berilia.managers.KernelEventsManager; - import com.ankamagames.jerakine.console.ConsoleHandler; - - public class ActionsInstructionHandler implements ConsoleInstructionHandler - { - - protected static const _log:Logger = Log.getLogger(getQualifiedClassName(ActionsInstructionHandler)); - - - public function handle(console:ConsoleHandler, cmd:String, args:Array):void - { - var actionName:String; - var apiAction:DofusApiAction; - var actionClass:Class; - var actionDesc:XML; - var neededParams:uint; - var maxParams:uint; - var paramsTypes:Array; - var params:Array; - var accessors:Array; - var longestAccessor:uint; - var hookName:String; - var hparams:Array; - var targetedHook:Hook; - var lookFor:String; - var actionsList:Array; - var foundCount:uint; - var param:* = undefined; - var action:Action; - var acc:* = undefined; - var accName:String; - var prop:String; - var padding:String; - var i:uint; - var a:String; - var aDesc:XML; - var aParams:Array; - var p:* = undefined; - switch (cmd) - { - case "sendaction": - if (args.length == 0) - { - console.output("You must specify an action to send."); - return; - }; - actionName = args[0]; - apiAction = DofusApiAction.getApiActionByName(actionName); - if (!(apiAction)) - { - console.output((("The action '" + actionName) + "' does not exists.")); - return; - }; - actionClass = apiAction.actionClass; - actionDesc = describeType(actionClass); - neededParams = 0; - maxParams = 0; - paramsTypes = []; - for each (param in actionDesc..method.(@name == "create").parameter) - { - if (param.@optional == "false") - { - neededParams++; - }; - paramsTypes.push(param.@type); - maxParams++; - }; - if ((((args.length < (neededParams + 1))) || ((args.length > (maxParams + 1))))) - { - console.output((((("This action needs at least " + neededParams) + " and a maximum of ") + maxParams) + " parameters.")); - console.output(("Parameters types : " + paramsTypes)); - return; - }; - args.shift(); - params = this.getParams(args, paramsTypes); - try - { - action = CallWithParameters.callR(apiAction.actionClass["create"], params); - if (!(action)) - { - throw (new Error()); - }; - } - catch(e:Error) - { - console.output("Unable to instanciate the action. Maybe some parameters were invalid ?"); - return; - }; - accessors = []; - longestAccessor = 0; - for each (acc in actionDesc..accessor) - { - accName = acc.@name; - if (accName == "prototype") - { - } - else - { - if (accName.length > longestAccessor) - { - longestAccessor = accName.length; - }; - accessors.push(accName); - }; - }; - accessors.sort(); - console.output((("Sending action " + apiAction.name) + ":")); - for each (prop in accessors) - { - padding = ""; - i = prop.length; - while (i < longestAccessor) - { - padding = (padding + " "); - i++; - }; - console.output(((((" " + padding) + prop) + " : ") + action[prop])); - }; - Kernel.getWorker().process(action); - return; - case "sendhook": - if (args.length == 0) - { - console.output("You must specify an hook to send."); - return; - }; - hookName = args[0]; - hparams = args.slice(1); - targetedHook = Hook.getHookByName(hookName); - if (!(targetedHook)) - { - throw (new ApiError((("Hook [" + hookName) + "] does not exist"))); - }; - if (targetedHook.nativeHook) - { - throw (new UntrustedApiCallError((("Hook " + hookName) + " is a native hook. Native hooks cannot be dispatch by module"))); - }; - CallWithParameters.call(KernelEventsManager.getInstance().processCallback, new Array(targetedHook).concat(hparams)); - return; - case "listactions": - lookFor = ""; - if (args.length > 0) - { - lookFor = args.join(" ").toLowerCase(); - console.output((("Registered actions matching '" + lookFor) + "':")); - } - else - { - console.output("Registered actions:"); - }; - actionsList = DofusApiAction.getApiActionsList(); - foundCount = 0; - for (a in actionsList) - { - if ((((lookFor.length > 0)) && ((a.toLowerCase().indexOf(lookFor) == -1)))) - { - } - else - { - console.output(((" " + a) + "")); - aDesc = describeType(actionsList[a].actionClass); - aParams = []; - for each (p in aDesc..method.(@name == "create").parameter) - { - aParams.push(p.@type); - }; - if (aParams.length > 0) - { - console.output((" " + aParams)); - }; - foundCount++; - }; - }; - if (foundCount == 0) - { - console.output(" No match."); - }; - return; - }; - } - - public function getHelp(cmd:String):String - { - switch (cmd) - { - case "sendaction": - return ("Send an actions to the worker."); - case "sendhook": - return ("Send a hook to the worker."); - case "listactions": - return ("List all valid actions."); - }; - return ((("Unknown command '" + cmd) + "'.")); - } - - private function getParams(data:Array, types:Array):Array - { - var iStr:String; - var i:uint; - var v:String; - var t:String; - var params:Array = []; - for (iStr in data) - { - i = parseInt(iStr); - v = data[i]; - t = types[i]; - params[i] = this.getParam(v, t); - }; - return (params); - } - - private function getParam(value:String, type:String) - { - switch (type) - { - case "String": - return (value); - case "Boolean": - return ((((value == "true")) || ((value == "1")))); - case "int": - case "uint": - return (parseInt(value)); - default: - _log.warn((("Unsupported parameter type '" + type) + "'.")); - return (value); - }; - } - - public function getParamPossibilities(cmd:String, paramIndex:uint=0, currentParams:Array=null):Array - { - var actionsList:Array; - var a:String; - var possibilities:Array = []; - switch (cmd) - { - case "sendaction": - if (paramIndex == 0) - { - actionsList = DofusApiAction.getApiActionsList(); - for (a in actionsList) - { - possibilities.push(a); - }; - }; - break; - }; - return (possibilities); - } - - - } -}//package com.ankamagames.dofus.console.debug - + import com.ankamagames.jerakine.console.ConsoleInstructionHandler; + import com.ankamagames.jerakine.logger.Logger; + import com.ankamagames.jerakine.logger.Log; + import flash.utils.getQualifiedClassName; + import com.ankamagames.jerakine.console.ConsoleHandler; + import com.ankamagames.dofus.misc.utils.DofusApiAction; + import com.ankamagames.berilia.types.data.Hook; + import com.ankamagames.jerakine.handlers.messages.Action; + import flash.utils.describeType; + import com.ankamagames.jerakine.utils.misc.CallWithParameters; + import com.ankamagames.dofus.kernel.Kernel; + import com.ankamagames.berilia.utils.errors.ApiError; + import com.ankamagames.berilia.utils.errors.UntrustedApiCallError; + import com.ankamagames.berilia.managers.KernelEventsManager; + + public class ActionsInstructionHandler extends Object implements ConsoleInstructionHandler + { + + public function ActionsInstructionHandler() + { + super(); + } + + protected static const _log:Logger = Log.getLogger(getQualifiedClassName(ActionsInstructionHandler)); + + public function handle(param1:ConsoleHandler, param2:String, param3:Array) : void + { + var actionName:String = null; + var apiAction:DofusApiAction = null; + var actionClass:Class = null; + var actionDesc:XML = null; + var neededParams:uint = 0; + var maxParams:uint = 0; + var paramsTypes:Array = null; + var params:Array = null; + var accessors:Array = null; + var longestAccessor:uint = 0; + var hookName:String = null; + var hparams:Array = null; + var targetedHook:Hook = null; + var lookFor:String = null; + var actionsList:Array = null; + var foundCount:uint = 0; + var param:* = undefined; + var action:Action = null; + var acc:* = undefined; + var accName:String = null; + var prop:String = null; + var padding:String = null; + var i:uint = 0; + var a:String = null; + var aDesc:XML = null; + var aParams:Array = null; + var p:* = undefined; + var console:ConsoleHandler = param1; + var cmd:String = param2; + var args:Array = param3; + switch(cmd) + { + case "sendaction": + if(args.length == 0) + { + console.output("You must specify an action to send."); + return; + } + actionName = args[0]; + apiAction = DofusApiAction.getApiActionByName(actionName); + if(!apiAction) + { + console.output("The action \'" + actionName + "\' does not exists."); + return; + } + actionClass = apiAction.actionClass; + actionDesc = describeType(actionClass); + neededParams = 0; + maxParams = 0; + paramsTypes = []; + for each(param in actionDesc..method.(@name == "create").parameter) + { + if(param.@optional == "false") + { + neededParams++; + } + paramsTypes.push(param.@type); + maxParams++; + } + if(args.length < neededParams + 1 || args.length > maxParams + 1) + { + console.output("This action needs at least " + neededParams + " and a maximum of " + maxParams + " parameters."); + console.output("Parameters types : " + paramsTypes); + return; + } + args.shift(); + params = this.getParams(args,paramsTypes); + try + { + action = CallWithParameters.callR(apiAction.actionClass["create"],params); + if(!action) + { + throw new Error(); + } + } + catch(e:Error) + { + console.output("Unable to instanciate the action. Maybe some parameters were invalid ?"); + return; + } + accessors = []; + longestAccessor = 0; + for each(acc in actionDesc..accessor) + { + accName = acc.@name; + if(accName != "prototype") + { + if(accName.length > longestAccessor) + { + longestAccessor = accName.length; + } + accessors.push(accName); + } + } + accessors.sort(); + console.output("Sending action " + apiAction.name + ":"); + for each(prop in accessors) + { + padding = ""; + i = prop.length; + while(i < longestAccessor) + { + padding = padding + " "; + i++; + } + console.output(" " + padding + prop + " : " + action[prop]); + } + Kernel.getWorker().process(action); + break; + case "sendhook": + if(args.length == 0) + { + console.output("You must specify an hook to send."); + return; + } + hookName = args[0]; + hparams = args.slice(1); + targetedHook = Hook.getHookByName(hookName); + if(!targetedHook) + { + throw new ApiError("Hook [" + hookName + "] does not exist"); + } + else if(targetedHook.nativeHook) + { + throw new UntrustedApiCallError("Hook " + hookName + " is a native hook. Native hooks cannot be dispatch by module"); + } + else + { + CallWithParameters.call(KernelEventsManager.getInstance().processCallback,new Array(targetedHook).concat(hparams)); + break; + } + + case "listactions": + lookFor = ""; + if(args.length > 0) + { + lookFor = args.join(" ").toLowerCase(); + console.output("Registered actions matching \'" + lookFor + "\':"); + } + else + { + console.output("Registered actions:"); + } + actionsList = DofusApiAction.getApiActionsList(); + foundCount = 0; + for(a in actionsList) + { + if(!(lookFor.length > 0 && a.toLowerCase().indexOf(lookFor) == -1)) + { + console.output(" " + a + ""); + aDesc = describeType(actionsList[a].actionClass); + aParams = []; + for each(p in aDesc..method.(@name == "create").parameter) + { + aParams.push(p.@type); + } + if(aParams.length > 0) + { + console.output(" " + aParams); + } + foundCount++; + } + } + if(foundCount == 0) + { + console.output(" No match."); + } + break; + } + } + + public function getHelp(param1:String) : String + { + switch(param1) + { + case "sendaction": + return "Send an actions to the worker."; + case "sendhook": + return "Send a hook to the worker."; + case "listactions": + return "List all valid actions."; + default: + return "Unknown command \'" + param1 + "\'."; + } + } + + private function getParams(param1:Array, param2:Array) : Array + { + var _loc4_:String = null; + var _loc5_:uint = 0; + var _loc6_:String = null; + var _loc7_:String = null; + var _loc3_:Array = []; + for(_loc4_ in param1) + { + _loc5_ = parseInt(_loc4_); + _loc6_ = param1[_loc5_]; + _loc7_ = param2[_loc5_]; + _loc3_[_loc5_] = this.getParam(_loc6_,_loc7_); + } + return _loc3_; + } + + private function getParam(param1:String, param2:String) : * + { + switch(param2) + { + case "String": + return param1; + case "Boolean": + return param1 == "true" || param1 == "1"; + case "int": + case "uint": + return parseInt(param1); + default: + _log.warn("Unsupported parameter type \'" + param2 + "\'."); + return param1; + } + } + + public function getParamPossibilities(param1:String, param2:uint = 0, param3:Array = null) : Array + { + var _loc5_:Array = null; + var _loc6_:String = null; + var _loc4_:Array = []; + switch(param1) + { + case "sendaction": + if(param2 == 0) + { + _loc5_ = DofusApiAction.getApiActionsList(); + for(_loc6_ in _loc5_) + { + _loc4_.push(_loc6_); + } + } + break; + } + return _loc4_; + } + } +} diff --git a/com/ankamagames/dofus/console/debug/BenchmarkInstructionHandler.as b/com/ankamagames/dofus/console/debug/BenchmarkInstructionHandler.as index 233856355..50989f3b6 100644 --- a/com/ankamagames/dofus/console/debug/BenchmarkInstructionHandler.as +++ b/com/ankamagames/dofus/console/debug/BenchmarkInstructionHandler.as @@ -1,277 +1,259 @@ -package com.ankamagames.dofus.console.debug +package com.ankamagames.dofus.console.debug { - import com.ankamagames.jerakine.console.ConsoleInstructionHandler; - import com.ankamagames.jerakine.logger.Logger; - import com.ankamagames.jerakine.logger.Log; - import flash.utils.getQualifiedClassName; - import com.ankamagames.jerakine.entities.interfaces.IAnimated; - import com.ankamagames.dofus.misc.utils.frames.LuaScriptRecorderFrame; - import com.ankamagames.jerakine.utils.benchmark.monitoring.FpsManager; - import com.ankamagames.dofus.types.entities.BenchmarkCharacter; - import com.ankamagames.dofus.logic.common.frames.DebugBotFrame; - import com.ankamagames.tiphon.types.look.TiphonEntityLook; - import com.ankamagames.jerakine.types.positions.MapPoint; - import com.ankamagames.dofus.misc.BenchmarkMovementBehavior; - import com.ankamagames.dofus.logic.game.common.misc.DofusEntities; - import com.ankamagames.dofus.logic.game.common.managers.PlayedCharacterManager; - import com.ankamagames.dofus.kernel.Kernel; - import com.ankamagames.tiphon.engine.TiphonDebugManager; - import com.ankamagames.dofus.logic.common.frames.FightBotFrame; - import com.ankamagames.jerakine.utils.display.StageShareManager; - import com.ankamagames.dofus.logic.game.fight.managers.TacticModeManager; - import com.ankamagames.jerakine.console.ConsoleHandler; - import com.ankamagames.tiphon.display.TiphonSprite; - - public class BenchmarkInstructionHandler implements ConsoleInstructionHandler - { - - private static var id:uint = 50000; - - protected var _log:Logger; - - public function BenchmarkInstructionHandler() - { - this._log = Log.getLogger(getQualifiedClassName(BenchmarkInstructionHandler)); - super(); - } - - public function handle(console:ConsoleHandler, cmd:String, args:Array):void - { - var _local_4:IAnimated; - var _local_5:LuaScriptRecorderFrame; - var _local_6:IAnimated; - var _local_7:FpsManager; - var _local_8:String; - var _local_9:Boolean; - var _local_10:int; - var _local_11:Boolean; - var _local_12:Boolean; - var _local_13:Boolean; - var _local_14:Boolean; - var _local_15:Boolean; - var _local_16:Boolean; - var rpCharEntity:BenchmarkCharacter; - var _local_18:DebugBotFrame; - var _local_19:int; - var time:int; - var _local_21:Boolean; - var arg:String; - var valueTab:Array; - var cmdValue:String; - switch (cmd) - { - case "addmovingcharacter": - if (args.length > 0) - { - rpCharEntity = new BenchmarkCharacter(id++, TiphonEntityLook.fromString(args[0])); - rpCharEntity.position = MapPoint.fromCellId(int((Math.random() * 300))); - rpCharEntity.display(); - rpCharEntity.move(BenchmarkMovementBehavior.getRandomPath(rpCharEntity)); - }; - return; - case "setanimation": - _local_4 = (DofusEntities.getEntity(PlayedCharacterManager.getInstance().id) as IAnimated); - _local_5 = (Kernel.getWorker().getFrame(LuaScriptRecorderFrame) as LuaScriptRecorderFrame); - if (Kernel.getWorker().getFrame(LuaScriptRecorderFrame)) - { - _local_5.createLine("player", "setAnimation", args[0], true); - }; - _local_4.setAnimation(args[0]); - return; - case "setdirection": - _local_6 = (DofusEntities.getEntity(PlayedCharacterManager.getInstance().id) as IAnimated); - _local_6.setDirection(args[0]); - return; - case "tiphon-error": - TiphonDebugManager.disable(); - return; - case "bot-spectator": - if (Kernel.getWorker().contains(DebugBotFrame)) - { - Kernel.getWorker().removeFrame(DebugBotFrame.getInstance()); - console.output((("Arret du bot-spectator, " + DebugBotFrame.getInstance().fightCount) + " combat(s) vu")); - } - else - { - _local_18 = DebugBotFrame.getInstance(); - _local_19 = args.indexOf("debugchat"); - if (_local_19 != -1) - { - time = 500; - if (args.length > (_local_19 + 1)) - { - time = args[(_local_19 + 1)]; - }; - _local_18.enableChatMessagesBot(true, time); - }; - Kernel.getWorker().addFrame(_local_18); - console.output("Démarrage du bot-spectator "); - }; - return; - case "bot-fight": - if (Kernel.getWorker().contains(FightBotFrame)) - { - Kernel.getWorker().removeFrame(FightBotFrame.getInstance()); - console.output((("Arret du bot-fight, " + FightBotFrame.getInstance().fightCount) + " combat(s) effectué")); - } - else - { - Kernel.getWorker().addFrame(FightBotFrame.getInstance()); - console.output("Démarrage du bot-fight "); - }; - return; - case "fpsmanager": - _local_7 = FpsManager.getInstance(); - if (StageShareManager.stage.contains(_local_7)) - { - _local_7.hide(); - } - else - { - _local_21 = !((args.indexOf("external") == -1)); - if (_local_21) - { - console.output("Fps Manager External"); - }; - _local_7.display(_local_21); - }; - return; - case "tacticmode": - TacticModeManager.getInstance().hide(); - _local_9 = false; - _local_10 = 0; - _local_11 = false; - _local_12 = false; - _local_13 = false; - _local_14 = false; - _local_15 = true; - _local_16 = true; - for each (arg in args) - { - valueTab = arg.split("="); - if (valueTab == null) - { - } - else - { - cmdValue = valueTab[1]; - if (((!((arg.search("fightzone") == -1))) && ((valueTab.length > 1)))) - { - _local_11 = (((cmdValue.toLowerCase() == "true")) ? true : false); - } - else - { - if (((!((arg.search("clearcache") == -1))) && ((valueTab.length > 1)))) - { - _local_9 = (((cmdValue.toLowerCase() == "true")) ? false : true); - } - else - { - if (((!((arg.search("mode") == -1))) && ((valueTab.length > 1)))) - { - _local_10 = (((cmdValue.toLowerCase() == "rp")) ? 1 : 0); - } - else - { - if (((!((arg.search("interactivecells") == -1))) && ((valueTab.length > 1)))) - { - _local_12 = (((cmdValue.toLowerCase() == "true")) ? true : false); - } - else - { - if (((!((arg.search("scalezone") == -1))) && ((valueTab.length > 1)))) - { - _local_14 = (((cmdValue.toLowerCase() == "true")) ? true : false); - } - else - { - if (((!((arg.search("show") == -1))) && ((valueTab.length > 1)))) - { - _local_13 = (((cmdValue.toLowerCase() == "true")) ? true : false); - } - else - { - if (((!((arg.search("flattencells") == -1))) && ((valueTab.length > 1)))) - { - _local_15 = (((cmdValue.toLowerCase() == "true")) ? true : false); - } - else - { - if (((!((arg.search("blocLDV") == -1))) && ((valueTab.length > 1)))) - { - _local_16 = (((cmdValue.toLowerCase() == "true")) ? true : false); - }; - }; - }; - }; - }; - }; - }; - }; - }; - }; - if (_local_13) - { - TacticModeManager.getInstance().setDebugMode(_local_11, _local_9, _local_10, _local_12, _local_14, _local_15, _local_16); - TacticModeManager.getInstance().show(PlayedCharacterManager.getInstance().currentMap, true); - _local_8 = "Activation"; - } - else - { - _local_8 = "Désactivation"; - }; - _local_8 = (_local_8 + " du mode tactique."); - console.output(_local_8); - return; - }; - } - - public function getHelp(cmd:String):String - { - switch (cmd) - { - case "addmovingcharacter": - return ("Add a new mobile character on scene."); - case "fpsmanager": - return ("Displays the performance of the client. (external)"); - case "bot-spectator": - return (("Start/Stop the auto join fight spectator bot" + "\n debugchat")); - case "tiphon-error": - return ("Désactive l'affichage des erreurs du moteur d'animation."); - case "tacticmode": - return (((((((("Active/Désactive le mode tactique" + "\n show=[true|false]") + "\n clearcache=[true|false]") + "\n mode=[fight|RP]") + "\n interactivecells=[true|false] ") + "\n fightzone=[true|false]") + "\n scalezone=[true|false]") + "\n flattencells=[true|false]")); - }; - return ("Unknow command"); - } - - public function getParamPossibilities(cmd:String, paramIndex:uint=0, currentParams:Array=null):Array - { - var _local_4:TiphonSprite; - var _local_5:Array; - var _local_6:Array; - var anim:String; - switch (cmd) - { - case "tacticmode": - return (["show", "clearcache", "mode", "interactivecells", "fightzone", "scalezone", "flattencells"]); - case "setanimation": - _local_4 = (DofusEntities.getEntity(PlayedCharacterManager.getInstance().id) as TiphonSprite); - _local_5 = _local_4.animationList; - _local_6 = []; - for each (anim in _local_5) - { - if (anim.indexOf("Anim") != -1) - { - _local_6.push(anim); - }; - }; - _local_6.sort(); - return (_local_6); - }; - return ([]); - } - - - } -}//package com.ankamagames.dofus.console.debug - + import com.ankamagames.jerakine.console.ConsoleInstructionHandler; + import com.ankamagames.jerakine.logger.Logger; + import com.ankamagames.jerakine.console.ConsoleHandler; + import com.ankamagames.jerakine.entities.interfaces.IAnimated; + import com.ankamagames.dofus.misc.utils.frames.LuaScriptRecorderFrame; + import com.ankamagames.jerakine.utils.benchmark.monitoring.FpsManager; + import com.ankamagames.dofus.types.entities.BenchmarkCharacter; + import com.ankamagames.dofus.logic.common.frames.DebugBotFrame; + import com.ankamagames.tiphon.types.look.TiphonEntityLook; + import com.ankamagames.jerakine.types.positions.MapPoint; + import com.ankamagames.dofus.misc.BenchmarkMovementBehavior; + import com.ankamagames.dofus.logic.game.common.misc.DofusEntities; + import com.ankamagames.dofus.logic.game.common.managers.PlayedCharacterManager; + import com.ankamagames.dofus.kernel.Kernel; + import com.ankamagames.tiphon.engine.TiphonDebugManager; + import com.ankamagames.dofus.logic.common.frames.FightBotFrame; + import com.ankamagames.jerakine.utils.display.StageShareManager; + import com.ankamagames.dofus.logic.game.fight.managers.TacticModeManager; + import com.ankamagames.tiphon.display.TiphonSprite; + import com.ankamagames.jerakine.logger.Log; + import flash.utils.getQualifiedClassName; + + public class BenchmarkInstructionHandler extends Object implements ConsoleInstructionHandler + { + + public function BenchmarkInstructionHandler() + { + this._log = Log.getLogger(getQualifiedClassName(BenchmarkInstructionHandler)); + super(); + } + + private static var id:uint = 50000; + + protected var _log:Logger; + + public function handle(param1:ConsoleHandler, param2:String, param3:Array) : void + { + var _loc4_:IAnimated = null; + var _loc5_:LuaScriptRecorderFrame = null; + var _loc6_:IAnimated = null; + var _loc7_:FpsManager = null; + var _loc8_:String = null; + var _loc9_:* = false; + var _loc10_:* = 0; + var _loc11_:* = false; + var _loc12_:* = false; + var _loc13_:* = false; + var _loc14_:* = false; + var _loc15_:* = false; + var _loc16_:* = false; + var _loc17_:BenchmarkCharacter = null; + var _loc18_:DebugBotFrame = null; + var _loc19_:* = 0; + var _loc20_:* = 0; + var _loc21_:* = false; + var _loc22_:String = null; + var _loc23_:Array = null; + var _loc24_:String = null; + switch(param2) + { + case "addmovingcharacter": + if(param3.length > 0) + { + _loc17_ = new BenchmarkCharacter(id++,TiphonEntityLook.fromString(param3[0])); + _loc17_.position = MapPoint.fromCellId(int(Math.random() * 300)); + _loc17_.display(); + _loc17_.move(BenchmarkMovementBehavior.getRandomPath(_loc17_)); + } + break; + case "setanimation": + _loc4_ = DofusEntities.getEntity(PlayedCharacterManager.getInstance().id) as IAnimated; + _loc5_ = Kernel.getWorker().getFrame(LuaScriptRecorderFrame) as LuaScriptRecorderFrame; + if(Kernel.getWorker().getFrame(LuaScriptRecorderFrame)) + { + _loc5_.createLine("player","setAnimation",param3[0],true); + } + _loc4_.setAnimation(param3[0]); + break; + case "setdirection": + _loc6_ = DofusEntities.getEntity(PlayedCharacterManager.getInstance().id) as IAnimated; + _loc6_.setDirection(param3[0]); + break; + case "tiphon-error": + TiphonDebugManager.disable(); + break; + case "bot-spectator": + if(Kernel.getWorker().contains(DebugBotFrame)) + { + Kernel.getWorker().removeFrame(DebugBotFrame.getInstance()); + param1.output("Arret du bot-spectator, " + DebugBotFrame.getInstance().fightCount + " combat(s) vu"); + } + else + { + _loc18_ = DebugBotFrame.getInstance(); + _loc19_ = param3.indexOf("debugchat"); + if(_loc19_ != -1) + { + _loc20_ = 500; + if(param3.length > _loc19_ + 1) + { + _loc20_ = param3[_loc19_ + 1]; + } + _loc18_.enableChatMessagesBot(true,_loc20_); + } + Kernel.getWorker().addFrame(_loc18_); + param1.output("Démarrage du bot-spectator "); + } + break; + case "bot-fight": + if(Kernel.getWorker().contains(FightBotFrame)) + { + Kernel.getWorker().removeFrame(FightBotFrame.getInstance()); + param1.output("Arret du bot-fight, " + FightBotFrame.getInstance().fightCount + " combat(s) effectué"); + } + else + { + Kernel.getWorker().addFrame(FightBotFrame.getInstance()); + param1.output("Démarrage du bot-fight "); + } + break; + case "fpsmanager": + _loc7_ = FpsManager.getInstance(); + if(StageShareManager.stage.contains(_loc7_)) + { + _loc7_.hide(); + } + else + { + _loc21_ = !(param3.indexOf("external") == -1); + if(_loc21_) + { + param1.output("Fps Manager External"); + } + _loc7_.display(_loc21_); + } + break; + case "tacticmode": + TacticModeManager.getInstance().hide(); + _loc9_ = false; + _loc10_ = 0; + _loc11_ = false; + _loc12_ = false; + _loc13_ = false; + _loc14_ = false; + _loc15_ = true; + _loc16_ = true; + for each(_loc22_ in param3) + { + _loc23_ = _loc22_.split("="); + if(_loc23_ != null) + { + _loc24_ = _loc23_[1]; + if(!(_loc22_.search("fightzone") == -1) && _loc23_.length > 1) + { + _loc11_ = _loc24_.toLowerCase() == "true"?true:false; + } + else if(!(_loc22_.search("clearcache") == -1) && _loc23_.length > 1) + { + _loc9_ = _loc24_.toLowerCase() == "true"?false:true; + } + else if(!(_loc22_.search("mode") == -1) && _loc23_.length > 1) + { + _loc10_ = _loc24_.toLowerCase() == "rp"?1:0; + } + else if(!(_loc22_.search("interactivecells") == -1) && _loc23_.length > 1) + { + _loc12_ = _loc24_.toLowerCase() == "true"?true:false; + } + else if(!(_loc22_.search("scalezone") == -1) && _loc23_.length > 1) + { + _loc14_ = _loc24_.toLowerCase() == "true"?true:false; + } + else if(!(_loc22_.search("show") == -1) && _loc23_.length > 1) + { + _loc13_ = _loc24_.toLowerCase() == "true"?true:false; + } + else if(!(_loc22_.search("flattencells") == -1) && _loc23_.length > 1) + { + _loc15_ = _loc24_.toLowerCase() == "true"?true:false; + } + else if(!(_loc22_.search("blocLDV") == -1) && _loc23_.length > 1) + { + _loc16_ = _loc24_.toLowerCase() == "true"?true:false; + } + + + + + + + + } + } + if(_loc13_) + { + TacticModeManager.getInstance().setDebugMode(_loc11_,_loc9_,_loc10_,_loc12_,_loc14_,_loc15_,_loc16_); + TacticModeManager.getInstance().show(PlayedCharacterManager.getInstance().currentMap,true); + _loc8_ = "Activation"; + } + else + { + _loc8_ = "Désactivation"; + } + _loc8_ = _loc8_ + " du mode tactique."; + param1.output(_loc8_); + break; + } + } + + public function getHelp(param1:String) : String + { + switch(param1) + { + case "addmovingcharacter": + return "Add a new mobile character on scene."; + case "fpsmanager": + return "Displays the performance of the client. (external)"; + case "bot-spectator": + return "Start/Stop the auto join fight spectator bot" + "\n debugchat"; + case "tiphon-error": + return "Désactive l\'affichage des erreurs du moteur d\'animation."; + case "tacticmode": + return "Active/Désactive le mode tactique" + "\n show=[true|false]" + "\n clearcache=[true|false]" + "\n mode=[fight|RP]" + "\n interactivecells=[true|false] " + "\n fightzone=[true|false]" + "\n scalezone=[true|false]" + "\n flattencells=[true|false]"; + default: + return "Unknow command"; + } + } + + public function getParamPossibilities(param1:String, param2:uint = 0, param3:Array = null) : Array + { + var _loc4_:TiphonSprite = null; + var _loc5_:Array = null; + var _loc6_:Array = null; + var _loc7_:String = null; + switch(param1) + { + case "tacticmode": + return ["show","clearcache","mode","interactivecells","fightzone","scalezone","flattencells"]; + case "setanimation": + _loc4_ = DofusEntities.getEntity(PlayedCharacterManager.getInstance().id) as TiphonSprite; + _loc5_ = _loc4_.animationList; + _loc6_ = []; + for each(_loc7_ in _loc5_) + { + if(_loc7_.indexOf("Anim") != -1) + { + _loc6_.push(_loc7_); + } + } + _loc6_.sort(); + return _loc6_; + default: + return []; + } + } + } +} diff --git a/com/ankamagames/dofus/console/debug/ClearSceneInstructionHandler.as b/com/ankamagames/dofus/console/debug/ClearSceneInstructionHandler.as index 17799ce39..f4e762d1f 100644 --- a/com/ankamagames/dofus/console/debug/ClearSceneInstructionHandler.as +++ b/com/ankamagames/dofus/console/debug/ClearSceneInstructionHandler.as @@ -1,119 +1,121 @@ -package com.ankamagames.dofus.console.debug +package com.ankamagames.dofus.console.debug { - import com.ankamagames.jerakine.console.ConsoleInstructionHandler; - import flash.display.DisplayObjectContainer; - import com.ankamagames.dofus.logic.game.roleplay.frames.RoleplayEntitiesFrame; - import com.ankamagames.atouin.managers.EntitiesManager; - import com.ankamagames.atouin.Atouin; - import com.ankamagames.dofus.logic.game.common.managers.PlayedCharacterManager; - import flash.system.System; - import flash.utils.setTimeout; - import com.ankamagames.tiphon.display.TiphonSprite; - import com.ankamagames.dofus.kernel.Kernel; - import com.ankamagames.jerakine.console.ConsoleHandler; - import flash.utils.Dictionary; - - public class ClearSceneInstructionHandler implements ConsoleInstructionHandler - { - - - public function handle(console:ConsoleHandler, cmd:String, args:Array):void - { - var _local_4:DisplayObjectContainer; - var _local_5:uint; - var _local_6:uint; - var _local_7:uint; - var _local_8:uint; - var _local_9:Array; - var _local_10:RoleplayEntitiesFrame; - var o:*; - var entity:*; - switch (cmd) - { - case "clearscene": - if (args.length > 0) - { - console.output("No arguments needed."); - }; - _local_4 = Dofus.getInstance().getWorldContainer(); - while (_local_4.numChildren > 0) - { - _local_4.removeChildAt(0); - }; - console.output("Scene cleared."); - return; - case "clearentities": - _local_5 = 0; - for each (o in EntitiesManager.getInstance().entities) - { - _local_5++; - }; - console.output((("EntitiesManager : " + _local_5) + " entities")); - Atouin.getInstance().clearEntities(); - Atouin.getInstance().display(PlayedCharacterManager.getInstance().currentMap); - System.gc(); - setTimeout(this.asynchInfo, 2000, console); - return; - case "countentities": - _local_6 = 0; - _local_7 = 0; - _local_8 = 0; - _local_9 = EntitiesManager.getInstance().entities; - for each (entity in _local_9) - { - _local_6++; - if ((entity is TiphonSprite)) - { - if (entity.id >= 0) - { - _local_7++; - } - else - { - _local_8++; - }; - }; - }; - console.output((((((_local_6 + " entities : ") + _local_7) + " characters, ") + _local_8) + " monsters & npc.")); - _local_10 = (Kernel.getWorker().getFrame(RoleplayEntitiesFrame) as RoleplayEntitiesFrame); - if (_local_10) - { - console.output(((((("Switch to creature mode : " + _local_10.entitiesNumber) + " of ") + _local_10.creaturesLimit) + " -> ") + _local_10.creaturesMode)); - }; - return; - }; - } - - private function asynchInfo(console:ConsoleHandler):void - { - var sprite:*; - var ts:Dictionary = TiphonSprite.MEMORY_LOG; - for (sprite in ts) - { - console.output(((sprite + " : ") + TiphonSprite(sprite).look)); - }; - } - - public function getHelp(cmd:String):String - { - switch (cmd) - { - case "clearscene": - return ("Clear the World Scene."); - case "clearentities": - return ("Clear all entities from the scene."); - case "countentities": - return ("Count all entities from the scene."); - }; - return ((("No help for command '" + cmd) + "'")); - } - - public function getParamPossibilities(cmd:String, paramIndex:uint=0, currentParams:Array=null):Array - { - return ([]); - } - - - } -}//package com.ankamagames.dofus.console.debug - + import com.ankamagames.jerakine.console.ConsoleInstructionHandler; + import com.ankamagames.jerakine.console.ConsoleHandler; + import flash.display.DisplayObjectContainer; + import com.ankamagames.dofus.logic.game.roleplay.frames.RoleplayEntitiesFrame; + import com.ankamagames.atouin.managers.EntitiesManager; + import com.ankamagames.atouin.Atouin; + import com.ankamagames.dofus.logic.game.common.managers.PlayedCharacterManager; + import flash.system.System; + import flash.utils.setTimeout; + import com.ankamagames.tiphon.display.TiphonSprite; + import com.ankamagames.dofus.kernel.Kernel; + import flash.utils.Dictionary; + + public class ClearSceneInstructionHandler extends Object implements ConsoleInstructionHandler + { + + public function ClearSceneInstructionHandler() + { + super(); + } + + public function handle(param1:ConsoleHandler, param2:String, param3:Array) : void + { + var _loc4_:DisplayObjectContainer = null; + var _loc5_:uint = 0; + var _loc6_:uint = 0; + var _loc7_:uint = 0; + var _loc8_:uint = 0; + var _loc9_:Array = null; + var _loc10_:RoleplayEntitiesFrame = null; + var _loc11_:* = undefined; + var _loc12_:* = undefined; + switch(param2) + { + case "clearscene": + if(param3.length > 0) + { + param1.output("No arguments needed."); + } + _loc4_ = Dofus.getInstance().getWorldContainer(); + while(_loc4_.numChildren > 0) + { + _loc4_.removeChildAt(0); + } + param1.output("Scene cleared."); + break; + case "clearentities": + _loc5_ = 0; + for each(_loc11_ in EntitiesManager.getInstance().entities) + { + _loc5_++; + } + param1.output("EntitiesManager : " + _loc5_ + " entities"); + Atouin.getInstance().clearEntities(); + Atouin.getInstance().display(PlayedCharacterManager.getInstance().currentMap); + System.gc(); + setTimeout(this.asynchInfo,2000,param1); + break; + case "countentities": + _loc6_ = 0; + _loc7_ = 0; + _loc8_ = 0; + _loc9_ = EntitiesManager.getInstance().entities; + for each(_loc12_ in _loc9_) + { + _loc6_++; + if(_loc12_ is TiphonSprite) + { + if(_loc12_.id >= 0) + { + _loc7_++; + } + else + { + _loc8_++; + } + } + } + param1.output(_loc6_ + " entities : " + _loc7_ + " characters, " + _loc8_ + " monsters & npc."); + _loc10_ = Kernel.getWorker().getFrame(RoleplayEntitiesFrame) as RoleplayEntitiesFrame; + if(_loc10_) + { + param1.output("Switch to creature mode : " + _loc10_.entitiesNumber + " of " + _loc10_.creaturesLimit + " -> " + _loc10_.creaturesMode); + } + break; + } + } + + private function asynchInfo(param1:ConsoleHandler) : void + { + var _loc3_:* = undefined; + var _loc2_:Dictionary = TiphonSprite.MEMORY_LOG; + for(_loc3_ in _loc2_) + { + param1.output(_loc3_ + " : " + TiphonSprite(_loc3_).look); + } + } + + public function getHelp(param1:String) : String + { + switch(param1) + { + case "clearscene": + return "Clear the World Scene."; + case "clearentities": + return "Clear all entities from the scene."; + case "countentities": + return "Count all entities from the scene."; + default: + return "No help for command \'" + param1 + "\'"; + } + } + + public function getParamPossibilities(param1:String, param2:uint = 0, param3:Array = null) : Array + { + return []; + } + } +} diff --git a/com/ankamagames/dofus/console/debug/ClearTextureCacheInstructionHandler.as b/com/ankamagames/dofus/console/debug/ClearTextureCacheInstructionHandler.as index e6128f0a0..68bf2f5ee 100644 --- a/com/ankamagames/dofus/console/debug/ClearTextureCacheInstructionHandler.as +++ b/com/ankamagames/dofus/console/debug/ClearTextureCacheInstructionHandler.as @@ -1,44 +1,46 @@ -package com.ankamagames.dofus.console.debug +package com.ankamagames.dofus.console.debug { - import com.ankamagames.jerakine.console.ConsoleInstructionHandler; - import com.ankamagames.berilia.Berilia; - import com.ankamagames.jerakine.console.ConsoleHandler; - - public class ClearTextureCacheInstructionHandler implements ConsoleInstructionHandler - { - - - public function handle(console:ConsoleHandler, cmd:String, args:Array):void - { - switch (cmd) - { - case "cleartexturecache": - if (args.length > 0) - { - console.output("No arguments needed."); - }; - Berilia.getInstance().cache.clear(); - console.output("Texture cache cleared."); - return; - }; - } - - public function getHelp(cmd:String):String - { - switch (cmd) - { - case "cleartexturecache": - return ("Empty the textures cache."); - }; - return ((("No help for command '" + cmd) + "'")); - } - - public function getParamPossibilities(cmd:String, paramIndex:uint=0, currentParams:Array=null):Array - { - return ([]); - } - - - } -}//package com.ankamagames.dofus.console.debug - + import com.ankamagames.jerakine.console.ConsoleInstructionHandler; + import com.ankamagames.jerakine.console.ConsoleHandler; + import com.ankamagames.berilia.Berilia; + + public class ClearTextureCacheInstructionHandler extends Object implements ConsoleInstructionHandler + { + + public function ClearTextureCacheInstructionHandler() + { + super(); + } + + public function handle(param1:ConsoleHandler, param2:String, param3:Array) : void + { + switch(param2) + { + case "cleartexturecache": + if(param3.length > 0) + { + param1.output("No arguments needed."); + } + Berilia.getInstance().cache.clear(); + param1.output("Texture cache cleared."); + break; + } + } + + public function getHelp(param1:String) : String + { + switch(param1) + { + case "cleartexturecache": + return "Empty the textures cache."; + default: + return "No help for command \'" + param1 + "\'"; + } + } + + public function getParamPossibilities(param1:String, param2:uint = 0, param3:Array = null) : Array + { + return []; + } + } +} diff --git a/com/ankamagames/dofus/console/debug/ConnectionInstructionHandler.as b/com/ankamagames/dofus/console/debug/ConnectionInstructionHandler.as index 2189a0b0c..113eb6dac 100644 --- a/com/ankamagames/dofus/console/debug/ConnectionInstructionHandler.as +++ b/com/ankamagames/dofus/console/debug/ConnectionInstructionHandler.as @@ -1,52 +1,54 @@ -package com.ankamagames.dofus.console.debug +package com.ankamagames.dofus.console.debug { - import com.ankamagames.jerakine.console.ConsoleInstructionHandler; - import com.ankamagames.dofus.kernel.net.ConnectionsHandler; - import com.ankamagames.jerakine.network.ServerConnection; - import com.ankamagames.jerakine.console.ConsoleHandler; - - public class ConnectionInstructionHandler implements ConsoleInstructionHandler - { - - - public function handle(console:ConsoleHandler, cmd:String, args:Array):void - { - switch (cmd) - { - case "connectionstatus": - console.output(("" + ((ConnectionsHandler.getConnection()) ? ConnectionsHandler.getConnection() : "There is currently no connection."))); - return; - case "inspecttraffic": - ServerConnection.DEBUG_VERBOSE = !(ServerConnection.DEBUG_VERBOSE); - console.output(("Inspect traffic is " + ((ServerConnection.DEBUG_VERBOSE) ? "ON" : "OFF"))); - return; - case "inspectlowtraffic": - ServerConnection.DEBUG_LOW_LEVEL_VERBOSE = !(ServerConnection.DEBUG_LOW_LEVEL_VERBOSE); - console.output(("Inspect low traffic is " + ((ServerConnection.DEBUG_LOW_LEVEL_VERBOSE) ? "ON" : "OFF"))); - return; - }; - } - - public function getHelp(cmd:String):String - { - switch (cmd) - { - case "connectionstatus": - return ("Print the status of the current connection (if any)."); - case "inspecttraffic": - return ("Show detailled informations about network activities."); - case "inspectlowtraffic": - return ("Show detailled informations about network message parsing."); - }; - return ((("No help for command '" + cmd) + "'")); - } - - public function getParamPossibilities(cmd:String, paramIndex:uint=0, currentParams:Array=null):Array - { - return ([]); - } - - - } -}//package com.ankamagames.dofus.console.debug - + import com.ankamagames.jerakine.console.ConsoleInstructionHandler; + import com.ankamagames.jerakine.console.ConsoleHandler; + import com.ankamagames.dofus.kernel.net.ConnectionsHandler; + import com.ankamagames.jerakine.network.ServerConnection; + + public class ConnectionInstructionHandler extends Object implements ConsoleInstructionHandler + { + + public function ConnectionInstructionHandler() + { + super(); + } + + public function handle(param1:ConsoleHandler, param2:String, param3:Array) : void + { + switch(param2) + { + case "connectionstatus": + param1.output("" + (ConnectionsHandler.getConnection()?ConnectionsHandler.getConnection():"There is currently no connection.")); + break; + case "inspecttraffic": + ServerConnection.DEBUG_VERBOSE = !ServerConnection.DEBUG_VERBOSE; + param1.output("Inspect traffic is " + (ServerConnection.DEBUG_VERBOSE?"ON":"OFF")); + break; + case "inspectlowtraffic": + ServerConnection.DEBUG_LOW_LEVEL_VERBOSE = !ServerConnection.DEBUG_LOW_LEVEL_VERBOSE; + param1.output("Inspect low traffic is " + (ServerConnection.DEBUG_LOW_LEVEL_VERBOSE?"ON":"OFF")); + break; + } + } + + public function getHelp(param1:String) : String + { + switch(param1) + { + case "connectionstatus": + return "Print the status of the current connection (if any)."; + case "inspecttraffic": + return "Show detailled informations about network activities."; + case "inspectlowtraffic": + return "Show detailled informations about network message parsing."; + default: + return "No help for command \'" + param1 + "\'"; + } + } + + public function getParamPossibilities(param1:String, param2:uint = 0, param3:Array = null) : Array + { + return []; + } + } +} diff --git a/com/ankamagames/dofus/console/debug/CryptoInstructionHandler.as b/com/ankamagames/dofus/console/debug/CryptoInstructionHandler.as index a6c12c7a3..26aab4e28 100644 --- a/com/ankamagames/dofus/console/debug/CryptoInstructionHandler.as +++ b/com/ankamagames/dofus/console/debug/CryptoInstructionHandler.as @@ -1,52 +1,54 @@ -package com.ankamagames.dofus.console.debug +package com.ankamagames.dofus.console.debug { - import com.ankamagames.jerakine.console.ConsoleInstructionHandler; - import com.ankamagames.jerakine.utils.crypto.CRC32; - import flash.utils.ByteArray; - import by.blooddy.crypto.MD5; - import com.ankamagames.jerakine.console.ConsoleHandler; - - public class CryptoInstructionHandler implements ConsoleInstructionHandler - { - - - public function handle(console:ConsoleHandler, cmd:String, args:Array):void - { - var _local_4:CRC32; - var _local_5:ByteArray; - switch (cmd) - { - case "crc32": - _local_4 = new CRC32(); - _local_5 = new ByteArray(); - _local_5.writeUTFBytes(args.join(" ")); - _local_4.update(_local_5); - console.output(("CRC32 checksum : " + _local_4.getValue().toString(16))); - return; - case "md5": - console.output(("MD5 hash : " + MD5.hash(args.join(" ")))); - return; - }; - } - - public function getHelp(cmd:String):String - { - switch (cmd) - { - case "crc32": - return ("Calculate the CRC32 checksum of a given string."); - case "md5": - return ("Calculate the MD5 hash of a given string."); - }; - return ((("No help for command '" + cmd) + "'")); - } - - public function getParamPossibilities(cmd:String, paramIndex:uint=0, currentParams:Array=null):Array - { - return ([]); - } - - - } -}//package com.ankamagames.dofus.console.debug - + import com.ankamagames.jerakine.console.ConsoleInstructionHandler; + import com.ankamagames.jerakine.console.ConsoleHandler; + import com.ankamagames.jerakine.utils.crypto.CRC32; + import flash.utils.ByteArray; + import by.blooddy.crypto.MD5; + + public class CryptoInstructionHandler extends Object implements ConsoleInstructionHandler + { + + public function CryptoInstructionHandler() + { + super(); + } + + public function handle(param1:ConsoleHandler, param2:String, param3:Array) : void + { + var _loc4_:CRC32 = null; + var _loc5_:ByteArray = null; + switch(param2) + { + case "crc32": + _loc4_ = new CRC32(); + _loc5_ = new ByteArray(); + _loc5_.writeUTFBytes(param3.join(" ")); + _loc4_.update(_loc5_); + param1.output("CRC32 checksum : " + _loc4_.getValue().toString(16)); + break; + case "md5": + param1.output("MD5 hash : " + MD5.hash(param3.join(" "))); + break; + } + } + + public function getHelp(param1:String) : String + { + switch(param1) + { + case "crc32": + return "Calculate the CRC32 checksum of a given string."; + case "md5": + return "Calculate the MD5 hash of a given string."; + default: + return "No help for command \'" + param1 + "\'"; + } + } + + public function getParamPossibilities(param1:String, param2:uint = 0, param3:Array = null) : Array + { + return []; + } + } +} diff --git a/com/ankamagames/dofus/console/debug/DisplayMapInstructionHandler.as b/com/ankamagames/dofus/console/debug/DisplayMapInstructionHandler.as index 9c3809e2b..756139540 100644 --- a/com/ankamagames/dofus/console/debug/DisplayMapInstructionHandler.as +++ b/com/ankamagames/dofus/console/debug/DisplayMapInstructionHandler.as @@ -1,168 +1,164 @@ -package com.ankamagames.dofus.console.debug +package com.ankamagames.dofus.console.debug { - import com.ankamagames.jerakine.console.ConsoleInstructionHandler; - import com.ankamagames.jerakine.logger.Logger; - import com.ankamagames.jerakine.logger.Log; - import flash.utils.getQualifiedClassName; - import com.ankamagames.jerakine.console.ConsoleHandler; - import flash.utils.ByteArray; - import com.ankamagames.jerakine.types.positions.WorldPoint; - import com.hurlant.util.Hex; - import com.ankamagames.atouin.managers.MapDisplayManager; - import com.ankamagames.atouin.utils.map.getWorldPointFromMapId; - import com.ankamagames.atouin.utils.map.getMapIdFromCoord; - import com.ankamagames.atouin.Atouin; - import com.ankamagames.dofus.internalDatacenter.world.WorldPointWrapper; - import com.ankamagames.atouin.managers.InteractiveCellManager; - import com.ankamagames.atouin.types.DebugToolTip; - import com.ankamagames.atouin.managers.SelectionManager; - - public class DisplayMapInstructionHandler implements ConsoleInstructionHandler - { - - protected static const _log:Logger = Log.getLogger(getQualifiedClassName(DisplayMapInstructionHandler)); - - private var _console:ConsoleHandler; - - - public function handle(console:ConsoleHandler, cmd:String, args:Array):void - { - var _local_4:ByteArray; - var _local_5:WorldPoint; - var _local_6:String; - var _local_7:int; - this._console = console; - switch (cmd) - { - case "displaymapdebug": - case "displaymap": - if (!(args[0])) - { - console.output("Error : need mapId or map location as first parameter"); - return; - }; - _local_4 = (((args.length > 1)) ? Hex.toArray(Hex.fromString(args[1])) : null); - if (_local_4) - { - _local_4.position = 0; - }; - if (args[0].indexOf(",") == -1) - { - MapDisplayManager.getInstance().display(getWorldPointFromMapId(args[0]), false, _local_4); - } - else - { - MapDisplayManager.getInstance().display(WorldPoint.fromCoords(0, args[0].split(",")[0], args[0].split(",")[1]), false, _local_4); - }; - return; - case "getmapcoord": - console.output((((((((("Map world point for " + args[0]) + " : ") + getWorldPointFromMapId(int(args[0])).x) + "/") + getWorldPointFromMapId(int(args[0])).y) + " (world : ") + WorldPoint.fromMapId(int(args[0])).worldId) + ")")); - return; - case "getmapid": - console.output(("Map id : " + getMapIdFromCoord(int(args[0]), parseInt(args[1]), parseInt(args[2])))); - return; - case "testatouin": - Atouin.getInstance().display(new WorldPoint()); - return; - case "mapid": - _local_5 = MapDisplayManager.getInstance().currentMapPoint; - if ((_local_5 is WorldPointWrapper)) - { - _local_6 = ((((((((("Current map : " + _local_5.x) + "/") + _local_5.y) + " (relative : ") + WorldPointWrapper(_local_5).outdoorX) + "/") + WorldPointWrapper(_local_5).outdoorY) + "), map id : ") + _local_5.mapId); - } - else - { - _local_6 = ((((("Current map : " + _local_5.x) + "/") + _local_5.y) + ", map id : ") + _local_5.mapId); - }; - console.output(_local_6); - return; - case "showcellid": - Atouin.getInstance().options.showCellIdOnOver = !(Atouin.getInstance().options.showCellIdOnOver); - console.output(("showCellIdOnOver : " + Atouin.getInstance().options.showCellIdOnOver)); - InteractiveCellManager.getInstance().setInteraction(true, Atouin.getInstance().options.showCellIdOnOver, Atouin.getInstance().options.showCellIdOnOver); - if (!(Atouin.getInstance().options.showCellIdOnOver)) - { - if (DebugToolTip.getInstance().parent) - { - DebugToolTip.getInstance().parent.removeChild(DebugToolTip.getInstance()); - }; - SelectionManager.getInstance().getSelection("infoOverCell").remove(); - }; - return; - case "playerjump": - Atouin.getInstance().options.virtualPlayerJump = !(Atouin.getInstance().options.virtualPlayerJump); - console.output(("playerJump : " + Atouin.getInstance().options.virtualPlayerJump)); - return; - case "showtransitions": - Atouin.getInstance().options.showTransitions = !(Atouin.getInstance().options.showTransitions); - return; - case "groundcache": - if (args.length) - { - _local_7 = int(args[0]); - Atouin.getInstance().options.groundCacheMode = _local_7; - } - else - { - _local_7 = Atouin.getInstance().options.groundCacheMode; - }; - if (_local_7 == 0) - { - console.output("Ground cache : disabled"); - } - else - { - if (_local_7 == 1) - { - console.output("Ground cache : High"); - } - else - { - if (_local_7 == 2) - { - console.output("Ground cache : Medium"); - } - else - { - if (_local_7 == 3) - { - console.output("Ground cache : Low"); - }; - }; - }; - }; - return; - }; - } - - public function getHelp(cmd:String):String - { - switch (cmd) - { - case "displaymapdebug": - return ("Display a given map with debug filters activated. These filters apply a different color on every map layers."); - case "displaymap": - return ("Display a given map."); - case "getmapcoord": - return ("Get the world point for a given map id."); - case "getmapid": - return ("Get the map id for a given world point."); - case "showtransitions": - return ("Toggle map transitions highlighting"); - case "groundcache": - return ("Set ground cache.\n
    • 0 --> Disabled
    • 1 --> High
    • 2 --> Medium
    • 3 --> Low
    • "); - case "mapid": - return ("Get the current map id."); - }; - return ((("No help for command '" + cmd) + "'")); - } - - public function getParamPossibilities(cmd:String, paramIndex:uint=0, currentParams:Array=null):Array - { - return ([]); - } - - - } -}//package com.ankamagames.dofus.console.debug - + import com.ankamagames.jerakine.console.ConsoleInstructionHandler; + import com.ankamagames.jerakine.logger.Logger; + import com.ankamagames.jerakine.logger.Log; + import flash.utils.getQualifiedClassName; + import com.ankamagames.jerakine.console.ConsoleHandler; + import flash.utils.ByteArray; + import com.ankamagames.jerakine.types.positions.WorldPoint; + import com.hurlant.util.Hex; + import com.ankamagames.atouin.managers.MapDisplayManager; + import com.ankamagames.atouin.utils.map.getWorldPointFromMapId; + import com.ankamagames.atouin.utils.map.getMapIdFromCoord; + import com.ankamagames.atouin.Atouin; + import com.ankamagames.dofus.internalDatacenter.world.WorldPointWrapper; + import com.ankamagames.atouin.managers.InteractiveCellManager; + import com.ankamagames.atouin.types.DebugToolTip; + import com.ankamagames.atouin.managers.SelectionManager; + + public class DisplayMapInstructionHandler extends Object implements ConsoleInstructionHandler + { + + public function DisplayMapInstructionHandler() + { + super(); + } + + protected static const _log:Logger = Log.getLogger(getQualifiedClassName(DisplayMapInstructionHandler)); + + private var _console:ConsoleHandler; + + public function handle(param1:ConsoleHandler, param2:String, param3:Array) : void + { + var _loc4_:ByteArray = null; + var _loc5_:WorldPoint = null; + var _loc6_:String = null; + var _loc7_:* = 0; + this._console = param1; + switch(param2) + { + case "displaymapdebug": + case "displaymap": + if(!param3[0]) + { + param1.output("Error : need mapId or map location as first parameter"); + return; + } + _loc4_ = param3.length > 1?Hex.toArray(Hex.fromString(param3[1])):null; + if(_loc4_) + { + _loc4_.position = 0; + } + if(param3[0].indexOf(",") == -1) + { + MapDisplayManager.getInstance().display(getWorldPointFromMapId(param3[0]),false,_loc4_); + } + else + { + MapDisplayManager.getInstance().display(WorldPoint.fromCoords(0,param3[0].split(",")[0],param3[0].split(",")[1]),false,_loc4_); + } + break; + case "getmapcoord": + param1.output("Map world point for " + param3[0] + " : " + getWorldPointFromMapId(int(param3[0])).x + "/" + getWorldPointFromMapId(int(param3[0])).y + " (world : " + WorldPoint.fromMapId(int(param3[0])).worldId + ")"); + break; + case "getmapid": + param1.output("Map id : " + getMapIdFromCoord(int(param3[0]),parseInt(param3[1]),parseInt(param3[2]))); + break; + case "testatouin": + Atouin.getInstance().display(new WorldPoint()); + break; + case "mapid": + _loc5_ = MapDisplayManager.getInstance().currentMapPoint; + if(_loc5_ is WorldPointWrapper) + { + _loc6_ = "Current map : " + _loc5_.x + "/" + _loc5_.y + " (relative : " + WorldPointWrapper(_loc5_).outdoorX + "/" + WorldPointWrapper(_loc5_).outdoorY + "), map id : " + _loc5_.mapId; + } + else + { + _loc6_ = "Current map : " + _loc5_.x + "/" + _loc5_.y + ", map id : " + _loc5_.mapId; + } + param1.output(_loc6_); + break; + case "showcellid": + Atouin.getInstance().options.showCellIdOnOver = !Atouin.getInstance().options.showCellIdOnOver; + param1.output("showCellIdOnOver : " + Atouin.getInstance().options.showCellIdOnOver); + InteractiveCellManager.getInstance().setInteraction(true,Atouin.getInstance().options.showCellIdOnOver,Atouin.getInstance().options.showCellIdOnOver); + if(!Atouin.getInstance().options.showCellIdOnOver) + { + if(DebugToolTip.getInstance().parent) + { + DebugToolTip.getInstance().parent.removeChild(DebugToolTip.getInstance()); + } + SelectionManager.getInstance().getSelection("infoOverCell").remove(); + } + break; + case "playerjump": + Atouin.getInstance().options.virtualPlayerJump = !Atouin.getInstance().options.virtualPlayerJump; + param1.output("playerJump : " + Atouin.getInstance().options.virtualPlayerJump); + break; + case "showtransitions": + Atouin.getInstance().options.showTransitions = !Atouin.getInstance().options.showTransitions; + break; + case "groundcache": + if(param3.length) + { + _loc7_ = int(param3[0]); + Atouin.getInstance().options.groundCacheMode = _loc7_; + } + else + { + _loc7_ = Atouin.getInstance().options.groundCacheMode; + } + if(_loc7_ == 0) + { + param1.output("Ground cache : disabled"); + } + else if(_loc7_ == 1) + { + param1.output("Ground cache : High"); + } + else if(_loc7_ == 2) + { + param1.output("Ground cache : Medium"); + } + else if(_loc7_ == 3) + { + param1.output("Ground cache : Low"); + } + + + + break; + } + } + + public function getHelp(param1:String) : String + { + switch(param1) + { + case "displaymapdebug": + return "Display a given map with debug filters activated. These filters apply a different color on every map layers."; + case "displaymap": + return "Display a given map."; + case "getmapcoord": + return "Get the world point for a given map id."; + case "getmapid": + return "Get the map id for a given world point."; + case "showtransitions": + return "Toggle map transitions highlighting"; + case "groundcache": + return "Set ground cache.\n
    • 0 --> Disabled
    • 1 --> High
    • 2 --> Medium
    • 3 --> Low
    • "; + case "mapid": + return "Get the current map id."; + default: + return "No help for command \'" + param1 + "\'"; + } + } + + public function getParamPossibilities(param1:String, param2:uint = 0, param3:Array = null) : Array + { + return []; + } + } +} diff --git a/com/ankamagames/dofus/console/debug/DtdInstructionHandler.as b/com/ankamagames/dofus/console/debug/DtdInstructionHandler.as index dd8b8c090..ea43429a8 100644 --- a/com/ankamagames/dofus/console/debug/DtdInstructionHandler.as +++ b/com/ankamagames/dofus/console/debug/DtdInstructionHandler.as @@ -1,260 +1,265 @@ -package com.ankamagames.dofus.console.debug +package com.ankamagames.dofus.console.debug { - import com.ankamagames.jerakine.console.ConsoleInstructionHandler; - import com.ankamagames.jerakine.logger.Logger; - import com.ankamagames.jerakine.logger.Log; - import flash.utils.getQualifiedClassName; - import com.ankamagames.jerakine.console.ConsoleHandler; - import flash.net.URLRequest; - import flash.net.URLLoader; - import flash.utils.describeType; - import flash.utils.getDefinitionByName; - import com.ankamagames.jerakine.managers.LangManager; - import flash.events.Event; - import flash.events.IOErrorEvent; - import flash.system.ApplicationDomain; - - public class DtdInstructionHandler implements ConsoleInstructionHandler - { - - protected static const _log:Logger = Log.getLogger(getQualifiedClassName(DtdInstructionHandler)); - public static const DONT_IGNORE:Array = new Array("alpha", "linkedTo"); - public static const IGNORE:Array = new Array("width", "height", "haveFocus"); - - private var _chCurrent:ConsoleHandler; - - - public function handle(console:ConsoleHandler, cmd:String, args:Array):void - { - var constants:XML; - var sBuffer:String; - var sClassName:String; - var aElement:Array; - var _local_8:XML; - var _local_9:String; - var _local_10:URLRequest; - var _local_11:URLLoader; - var _local_12:XML; - var _local_13:Array; - var _local_14:Array; - var _local_15:String; - var _local_16:String; - var _local_17:uint; - var _local_18:String; - var _local_19:String; - var j:uint; - var className:String; - var xmlDef:XML; - var bDontIgnore:Boolean; - var accessor:XML; - this._chCurrent = console; - switch (cmd) - { - case "kerneleventdtd": - _local_8 = describeType(getDefinitionByName("com.ankamagames.dofus.utils.KernelEventList")); - sBuffer = ""; - aElement = new Array(); - for each (constants in _local_8..constant) - { - sClassName = ("on" + constants..@type.split("::")[(constants..@type.split("::").length - 1)]); - sBuffer = (sBuffer + (("<!ELEMENT " + sClassName) + " EMPTY >\n")); - aElement.push(sClassName); - }; - sBuffer = (sBuffer + (("<!ELEMENT SystemEvents (" + aElement.join(" | ")) + ")* >")); - console.output(sBuffer); - return; - case "shortcutsdtd": - if (args[0] != null) - { - _local_9 = args[0]; - }; - if (!(_local_9)) - { - _local_10 = new URLRequest(LangManager.getInstance().getEntry("config.binds.file")); - } - else - { - _local_10 = new URLRequest((((LangManager.getInstance().getEntry("config.binds.path.root") + "bind_") + _local_9) + ".xml")); - }; - _log.error(_local_10.url); - _local_11 = new URLLoader(); - _local_11.addEventListener(Event.COMPLETE, this.onXmlLoadComplete); - _local_11.addEventListener(IOErrorEvent.IO_ERROR, this.onXmlLoadError); - _local_11.load(_local_10); - return; - case "componentdtd": - _local_12 = describeType(getDefinitionByName("com.ankamagames.berilia.utils.ComponentList")); - args = new Array(); - for each (constants in _local_12..constant) - { - args.push(constants..@type.split("::").join(".")); - }; - case "dtd": - _local_13 = new Array(); - _local_14 = new Array(); - sBuffer = ""; - _local_16 = ""; - j = 0; - while (j < args.length) - { - if (args[j].indexOf(".") == -1) + import com.ankamagames.jerakine.console.ConsoleInstructionHandler; + import com.ankamagames.jerakine.logger.Logger; + import com.ankamagames.jerakine.logger.Log; + import flash.utils.getQualifiedClassName; + import com.ankamagames.jerakine.console.ConsoleHandler; + import flash.net.URLRequest; + import flash.net.URLLoader; + import flash.utils.describeType; + import flash.utils.getDefinitionByName; + import com.ankamagames.jerakine.managers.LangManager; + import flash.events.Event; + import flash.events.IOErrorEvent; + import flash.system.ApplicationDomain; + + public class DtdInstructionHandler extends Object implements ConsoleInstructionHandler + { + + public function DtdInstructionHandler() + { + super(); + } + + protected static const _log:Logger = Log.getLogger(getQualifiedClassName(DtdInstructionHandler)); + + public static const DONT_IGNORE:Array = new Array("alpha","linkedTo"); + + public static const IGNORE:Array = new Array("width","height","haveFocus"); + + private var _chCurrent:ConsoleHandler; + + public function handle(param1:ConsoleHandler, param2:String, param3:Array) : void + { + var _loc4_:XML = null; + var _loc5_:String = null; + var _loc6_:String = null; + var _loc7_:Array = null; + var _loc8_:XML = null; + var _loc9_:String = null; + var _loc10_:URLRequest = null; + var _loc11_:URLLoader = null; + var _loc12_:XML = null; + var _loc13_:Array = null; + var _loc14_:Array = null; + var _loc15_:String = null; + var _loc16_:String = null; + var _loc17_:uint = 0; + var _loc18_:String = null; + var _loc19_:String = null; + var _loc20_:uint = 0; + var _loc21_:String = null; + var _loc22_:XML = null; + var _loc23_:* = false; + var _loc24_:XML = null; + this._chCurrent = param1; + switch(param2) + { + case "kerneleventdtd": + _loc8_ = describeType(getDefinitionByName("com.ankamagames.dofus.utils.KernelEventList")); + _loc5_ = ""; + _loc7_ = new Array(); + for each(_loc4_ in _loc8_..constant) + { + _loc6_ = "on" + _loc4_..@type.split("::")[_loc4_..@type.split("::").length - 1]; + _loc5_ = _loc5_ + ("<!ELEMENT " + _loc6_ + " EMPTY >\n"); + _loc7_.push(_loc6_); + } + _loc5_ = _loc5_ + ("<!ELEMENT SystemEvents (" + _loc7_.join(" | ") + ")* >"); + param1.output(_loc5_); + break; + case "shortcutsdtd": + if(param3[0] != null) + { + _loc9_ = param3[0]; + } + if(!_loc9_) + { + _loc10_ = new URLRequest(LangManager.getInstance().getEntry("config.binds.file")); + } + else + { + _loc10_ = new URLRequest(LangManager.getInstance().getEntry("config.binds.path.root") + "bind_" + _loc9_ + ".xml"); + } + _log.error(_loc10_.url); + _loc11_ = new URLLoader(); + _loc11_.addEventListener(Event.COMPLETE,this.onXmlLoadComplete); + _loc11_.addEventListener(IOErrorEvent.IO_ERROR,this.onXmlLoadError); + _loc11_.load(_loc10_); + break; + case "componentdtd": + _loc12_ = describeType(getDefinitionByName("com.ankamagames.berilia.utils.ComponentList")); + var param3:Array = new Array(); + for each(_loc4_ in _loc12_..constant) + { + param3.push(_loc4_..@type.split("::").join(".")); + } + case "dtd": + _loc13_ = new Array(); + _loc14_ = new Array(); + _loc5_ = ""; + _loc16_ = ""; + _loc20_ = 0; + while(_loc20_ < param3.length) + { + if(param3[_loc20_].indexOf(".") == -1) + { + _loc15_ = "com.ankamagames.berilia.components." + param3[_loc20_]; + } + else + { + _loc15_ = param3[_loc20_]; + } + if(ApplicationDomain.currentDomain.hasDefinition(_loc15_)) + { + _loc21_ = _loc15_.split(".")[_loc15_.split(".").length - 1]; + _loc22_ = describeType(getDefinitionByName(_loc15_)); + _loc7_ = new Array(); + for each(_loc24_ in _loc22_..accessor) + { + _loc23_ = !(_loc24_..@declaredBy.indexOf("ankamagames") == -1); + _loc17_ = 0; + while(_loc17_ < DONT_IGNORE.length) { - _local_15 = ("com.ankamagames.berilia.components." + args[j]); + if(DONT_IGNORE[_loc17_] == _loc24_..@name) + { + _loc23_ = true; + break; + } + _loc17_++; } - else + _loc17_ = 0; + while(_loc17_ < IGNORE.length) { - _local_15 = args[j]; - }; - if (ApplicationDomain.currentDomain.hasDefinition(_local_15)) - { - className = _local_15.split(".")[(_local_15.split(".").length - 1)]; - xmlDef = describeType(getDefinitionByName(_local_15)); - aElement = new Array(); - for each (accessor in xmlDef..accessor) - { - bDontIgnore = !((accessor..@declaredBy.indexOf("ankamagames") == -1)); - _local_17 = 0; - while (_local_17 < DONT_IGNORE.length) - { - if (DONT_IGNORE[_local_17] == accessor..@name) - { - bDontIgnore = true; - break; - }; - _local_17++; - }; - _local_17 = 0; - while (_local_17 < IGNORE.length) - { - if (IGNORE[_local_17] == accessor..@name) - { - bDontIgnore = false; - break; - }; - _local_17++; - }; - if (((bDontIgnore) && ((((((((((accessor..@type == "String")) || ((accessor..@type == "Boolean")))) || ((accessor..@type == "Number")))) || ((accessor..@type == "uint")))) || ((accessor..@type == "int")))))) - { - try - { - if (_local_14[accessor..@name] == null) - { - _local_14[accessor..@name] = { - "type":accessor..@type, - "ref":[className] - }; - } - else - { - _local_14[accessor..@name].ref.push(className); - }; - aElement[accessor..@name] = accessor..@type; - } - catch(e:Error) - { - }; - }; - }; - _local_13[className] = aElement; + if(IGNORE[_loc17_] == _loc24_..@name) + { + _loc23_ = false; + break; + } + _loc17_++; } - else - { - console.output((_local_15 + " cannot be found.")); - }; - j++; - }; - _local_16 = ""; - for (_local_18 in _local_14) - { - if (_local_14[_local_18].ref.length > 1) + if((_loc23_) && (_loc24_..@type == "String" || _loc24_..@type == "Boolean" || _loc24_..@type == "Number" || _loc24_..@type == "uint" || _loc24_..@type == "int")) { - _local_16 = (_local_16 + (((((("<!ELEMENT " + _local_18) + " (#PCDATA) ><!-- ") + _local_14[_local_18].type) + ", used by ") + _local_14[_local_18].ref.join(", ")) + " -->\n")); - }; - }; - if (_local_16.length) - { - sBuffer = (sBuffer + ("\n\n<!--======================= Common Elements =======================-->\n\n" + _local_16)); - }; - for (_local_18 in _local_13) - { - sBuffer = (sBuffer + (("\n\n<!--======================= " + _local_18) + " Elements =======================-->\n\n")); - aElement = new Array(); - for (_local_19 in _local_13[_local_18]) - { - if (isNaN(Number(_local_19))) - { - aElement.push((_local_19 + "?")); - }; - if (((!((_local_14[_local_19] == null))) && ((_local_14[_local_19].ref.length == 1)))) - { - sBuffer = (sBuffer + (((("<!ELEMENT " + _local_19) + " (#PCDATA) ><!-- ") + _local_13[_local_18][_local_19]) + " -->\n")); - }; - }; - aElement.push("Size?"); - aElement.push("Anchors?"); - aElement.push("Events?"); - sBuffer = (sBuffer + (((("<!ELEMENT " + _local_18) + " (") + aElement.join(" | ")) + ")* >\n")); - sBuffer = (sBuffer + (((("<!ATTLIST " + _local_18) + "\n") + "\t\tname CDATA #IMPLIED\n") + "\t\tstrata (LOW | MEDIUM | HIGH | TOP | TOOLTIP) #IMPLIED >")); - }; - console.output(sBuffer); - return; - }; - } - - public function getHelp(cmd:String):String - { - switch (cmd) - { - case "kernelEventdtd": - return ("Generate the Kernel Events DTD."); - case "componentdtd": - return ("Generate the Components DTD."); - case "shortcutsdtd": - return ("Generate the Shortcuts DTD."); - case "dtd": - return ("Generate a DTD for a given class or component."); - }; - return ((("No help for command '" + cmd) + "'")); - } - - public function getParamPossibilities(cmd:String, paramIndex:uint=0, currentParams:Array=null):Array - { - return ([]); - } - - private function parseShortcutXml(sXml:String):void - { - var shortcut:XML; - var xmlShortcuts:XML = XML(sXml); - var sBuffer:String = ""; - var aElement:Array = new Array(); - for each (shortcut in xmlShortcuts..bind) - { - sBuffer = (sBuffer + (("<!ELEMENT " + shortcut..@name) + " EMPTY >\n")); - aElement.push(shortcut..@name); - }; - sBuffer = (sBuffer + (("<!ELEMENT Shortcuts (" + aElement.join(" | ")) + ")* >")); - if (this._chCurrent != null) - { - this._chCurrent.output(sBuffer); - }; - } - - public function onXmlLoadComplete(event:Event):void - { - var loader:URLLoader = URLLoader(event.target); - this.parseShortcutXml(loader.data); - } - - public function onXmlLoadError(event:Event):void - { - if (this._chCurrent != null) - { - this._chCurrent.output("IO Error : KeyboardBind file cannot be found"); - }; - } - - - } -}//package com.ankamagames.dofus.console.debug - + try + { + if(_loc14_[_loc24_..@name] == null) + { + _loc14_[_loc24_..@name] = { + "type":_loc24_..@type, + "ref":[_loc21_] + }; + } + else + { + _loc14_[_loc24_..@name].ref.push(_loc21_); + } + _loc7_[_loc24_..@name] = _loc24_..@type; + } + catch(e:Error) + { + continue; + } + } + } + _loc13_[_loc21_] = _loc7_; + } + else + { + param1.output(_loc15_ + " cannot be found."); + } + _loc20_++; + } + _loc16_ = ""; + for(_loc18_ in _loc14_) + { + if(_loc14_[_loc18_].ref.length > 1) + { + _loc16_ = _loc16_ + ("<!ELEMENT " + _loc18_ + " (#PCDATA) ><!-- " + _loc14_[_loc18_].type + ", used by " + _loc14_[_loc18_].ref.join(", ") + " -->\n"); + } + } + if(_loc16_.length) + { + _loc5_ = _loc5_ + ("\n\n<!--======================= Common Elements =======================-->\n\n" + _loc16_); + } + for(_loc18_ in _loc13_) + { + _loc5_ = _loc5_ + ("\n\n<!--======================= " + _loc18_ + " Elements =======================-->\n\n"); + _loc7_ = new Array(); + for(_loc19_ in _loc13_[_loc18_]) + { + if(isNaN(Number(_loc19_))) + { + _loc7_.push(_loc19_ + "?"); + } + if(!(_loc14_[_loc19_] == null) && _loc14_[_loc19_].ref.length == 1) + { + _loc5_ = _loc5_ + ("<!ELEMENT " + _loc19_ + " (#PCDATA) ><!-- " + _loc13_[_loc18_][_loc19_] + " -->\n"); + } + } + _loc7_.push("Size?"); + _loc7_.push("Anchors?"); + _loc7_.push("Events?"); + _loc5_ = _loc5_ + ("<!ELEMENT " + _loc18_ + " (" + _loc7_.join(" | ") + ")* >\n"); + _loc5_ = _loc5_ + ("<!ATTLIST " + _loc18_ + "\n" + "\t\tname CDATA #IMPLIED\n" + "\t\tstrata (LOW | MEDIUM | HIGH | TOP | TOOLTIP) #IMPLIED >"); + } + param1.output(_loc5_); + break; + } + } + + public function getHelp(param1:String) : String + { + switch(param1) + { + case "kernelEventdtd": + return "Generate the Kernel Events DTD."; + case "componentdtd": + return "Generate the Components DTD."; + case "shortcutsdtd": + return "Generate the Shortcuts DTD."; + case "dtd": + return "Generate a DTD for a given class or component."; + default: + return "No help for command \'" + param1 + "\'"; + } + } + + public function getParamPossibilities(param1:String, param2:uint = 0, param3:Array = null) : Array + { + return []; + } + + private function parseShortcutXml(param1:String) : void + { + var _loc5_:XML = null; + var _loc2_:XML = XML(param1); + var _loc3_:* = ""; + var _loc4_:Array = new Array(); + for each(_loc5_ in _loc2_..bind) + { + _loc3_ = _loc3_ + ("<!ELEMENT " + _loc5_..@name + " EMPTY >\n"); + _loc4_.push(_loc5_..@name); + } + _loc3_ = _loc3_ + ("<!ELEMENT Shortcuts (" + _loc4_.join(" | ") + ")* >"); + if(this._chCurrent != null) + { + this._chCurrent.output(_loc3_); + } + } + + public function onXmlLoadComplete(param1:Event) : void + { + var _loc2_:URLLoader = URLLoader(param1.target); + this.parseShortcutXml(_loc2_.data); + } + + public function onXmlLoadError(param1:Event) : void + { + if(this._chCurrent != null) + { + this._chCurrent.output("IO Error : KeyboardBind file cannot be found"); + } + } + } +} diff --git a/com/ankamagames/dofus/console/debug/EnterFrameInstructionHandler.as b/com/ankamagames/dofus/console/debug/EnterFrameInstructionHandler.as index 682cd97ca..9de1a4308 100644 --- a/com/ankamagames/dofus/console/debug/EnterFrameInstructionHandler.as +++ b/com/ankamagames/dofus/console/debug/EnterFrameInstructionHandler.as @@ -1,60 +1,62 @@ -package com.ankamagames.dofus.console.debug +package com.ankamagames.dofus.console.debug { - import com.ankamagames.jerakine.console.ConsoleInstructionHandler; - import flash.utils.Dictionary; - import com.ankamagames.jerakine.utils.display.EnterFrameDispatcher; - import com.ankamagames.jerakine.console.ConsoleHandler; - - public class EnterFrameInstructionHandler implements ConsoleInstructionHandler - { - - - public function handle(console:ConsoleHandler, cmd:String, args:Array):void - { - var _local_4:Dictionary; - var _local_5:Dictionary; - var cefl:*; - var cname:String; - var refl:*; - var rname:String; - switch (cmd) - { - case "enterframecount": - console.output(("ENTER_FRAME listeners count : " + EnterFrameDispatcher.enterFrameListenerCount)); - console.output("Controled listeners :"); - _local_4 = EnterFrameDispatcher.controledEnterFrameListeners; - for (cefl in _local_4) - { - cname = _local_4[cefl]["name"]; - console.output((" - " + cname)); - }; - console.output("Real time listeners :"); - _local_5 = EnterFrameDispatcher.realTimeEnterFrameListeners; - for (refl in _local_5) - { - rname = _local_5[refl]; - console.output((" - " + rname)); - }; - return; - }; - } - - public function getHelp(cmd:String):String - { - switch (cmd) - { - case "enterframecount": - return ("Count the ENTER_FRAME listeners."); - }; - return ("Unknown command"); - } - - public function getParamPossibilities(cmd:String, paramIndex:uint=0, currentParams:Array=null):Array - { - return ([]); - } - - - } -}//package com.ankamagames.dofus.console.debug - + import com.ankamagames.jerakine.console.ConsoleInstructionHandler; + import com.ankamagames.jerakine.console.ConsoleHandler; + import flash.utils.Dictionary; + import com.ankamagames.jerakine.utils.display.EnterFrameDispatcher; + + public class EnterFrameInstructionHandler extends Object implements ConsoleInstructionHandler + { + + public function EnterFrameInstructionHandler() + { + super(); + } + + public function handle(param1:ConsoleHandler, param2:String, param3:Array) : void + { + var _loc4_:Dictionary = null; + var _loc5_:Dictionary = null; + var _loc6_:* = undefined; + var _loc7_:String = null; + var _loc8_:* = undefined; + var _loc9_:String = null; + switch(param2) + { + case "enterframecount": + param1.output("ENTER_FRAME listeners count : " + EnterFrameDispatcher.enterFrameListenerCount); + param1.output("Controled listeners :"); + _loc4_ = EnterFrameDispatcher.controledEnterFrameListeners; + for(_loc6_ in _loc4_) + { + _loc7_ = _loc4_[_loc6_]["name"]; + param1.output(" - " + _loc7_); + } + param1.output("Real time listeners :"); + _loc5_ = EnterFrameDispatcher.realTimeEnterFrameListeners; + for(_loc8_ in _loc5_) + { + _loc9_ = _loc5_[_loc8_]; + param1.output(" - " + _loc9_); + } + break; + } + } + + public function getHelp(param1:String) : String + { + switch(param1) + { + case "enterframecount": + return "Count the ENTER_FRAME listeners."; + default: + return "Unknown command"; + } + } + + public function getParamPossibilities(param1:String, param2:uint = 0, param3:Array = null) : Array + { + return []; + } + } +} diff --git a/com/ankamagames/dofus/console/debug/FightInstructionHandler.as b/com/ankamagames/dofus/console/debug/FightInstructionHandler.as index 28e9d47fc..5d2c65e35 100644 --- a/com/ankamagames/dofus/console/debug/FightInstructionHandler.as +++ b/com/ankamagames/dofus/console/debug/FightInstructionHandler.as @@ -1,85 +1,87 @@ -package com.ankamagames.dofus.console.debug +package com.ankamagames.dofus.console.debug { - import com.ankamagames.jerakine.console.ConsoleInstructionHandler; - import com.ankamagames.dofus.datacenter.spells.Spell; - import com.ankamagames.jerakine.console.ConsoleHandler; - - public class FightInstructionHandler implements ConsoleInstructionHandler - { - - - public function handle(console:ConsoleHandler, cmd:String, args:Array):void - { - var spell:Spell; - var spell2:Spell; - switch (cmd) - { - case "setspellscript": - if ((((args.length == 2)) || ((args.length == 3)))) - { - spell = Spell.getSpellById(parseInt(args[0])); - if (!(spell)) - { - console.output((("Spell " + args[0]) + " doesn't exist")); - } - else - { - spell.scriptId = parseInt(args[1]); - if (args.length == 3) - { - spell.scriptIdCritical = parseInt(args[2]); - }; - }; - } - else - { - console.output("Param count error : #1 Spell id, #2 script id, #3 script id (critical hit)"); - }; - return; - case "setspellscriptparam": - if ((((args.length == 2)) || ((args.length == 3)))) - { - spell2 = Spell.getSpellById(parseInt(args[0])); - if (!(spell2)) - { - console.output((("Spell " + args[0]) + " doesn't exist")); - } - else - { - spell2.scriptParams = args[1]; - if (args.length == 3) - { - spell2.scriptParamsCritical = args[2]; - }; - spell2.useParamCache = false; - }; - } - else - { - console.output("Param count error : #1 Spell id, #2 script string parametters, #3 script string parameters (critical hit)"); - }; - return; - }; - } - - public function getHelp(cmd:String):String - { - switch (cmd) - { - case "setspellscriptparam": - return ("Change script parametters for given spell"); - case "setspellscript": - return ("Change script id used for given spell"); - }; - return ("Unknown command"); - } - - public function getParamPossibilities(cmd:String, paramIndex:uint=0, currentParams:Array=null):Array - { - return ([]); - } - - - } -}//package com.ankamagames.dofus.console.debug - + import com.ankamagames.jerakine.console.ConsoleInstructionHandler; + import com.ankamagames.jerakine.console.ConsoleHandler; + import com.ankamagames.dofus.datacenter.spells.Spell; + + public class FightInstructionHandler extends Object implements ConsoleInstructionHandler + { + + public function FightInstructionHandler() + { + super(); + } + + public function handle(param1:ConsoleHandler, param2:String, param3:Array) : void + { + var _loc4_:Spell = null; + var _loc5_:Spell = null; + switch(param2) + { + case "setspellscript": + if(param3.length == 2 || param3.length == 3) + { + _loc4_ = Spell.getSpellById(parseInt(param3[0])); + if(!_loc4_) + { + param1.output("Spell " + param3[0] + " doesn\'t exist"); + } + else + { + _loc4_.scriptId = parseInt(param3[1]); + if(param3.length == 3) + { + _loc4_.scriptIdCritical = parseInt(param3[2]); + } + } + } + else + { + param1.output("Param count error : #1 Spell id, #2 script id, #3 script id (critical hit)"); + } + break; + case "setspellscriptparam": + if(param3.length == 2 || param3.length == 3) + { + _loc5_ = Spell.getSpellById(parseInt(param3[0])); + if(!_loc5_) + { + param1.output("Spell " + param3[0] + " doesn\'t exist"); + } + else + { + _loc5_.scriptParams = param3[1]; + if(param3.length == 3) + { + _loc5_.scriptParamsCritical = param3[2]; + } + _loc5_.useParamCache = false; + } + } + else + { + param1.output("Param count error : #1 Spell id, #2 script string parametters, #3 script string parameters (critical hit)"); + } + break; + } + } + + public function getHelp(param1:String) : String + { + switch(param1) + { + case "setspellscriptparam": + return "Change script parametters for given spell"; + case "setspellscript": + return "Change script id used for given spell"; + default: + return "Unknown command"; + } + } + + public function getParamPossibilities(param1:String, param2:uint = 0, param3:Array = null) : Array + { + return []; + } + } +} diff --git a/com/ankamagames/dofus/console/debug/FontInstructionHandler.as b/com/ankamagames/dofus/console/debug/FontInstructionHandler.as index 7d6d8e71e..12ce3f486 100644 --- a/com/ankamagames/dofus/console/debug/FontInstructionHandler.as +++ b/com/ankamagames/dofus/console/debug/FontInstructionHandler.as @@ -1,62 +1,61 @@ -package com.ankamagames.dofus.console.debug +package com.ankamagames.dofus.console.debug { - import com.ankamagames.jerakine.console.ConsoleInstructionHandler; - import flash.utils.Timer; - import flash.events.TimerEvent; - import com.ankamagames.jerakine.console.ConsoleHandler; - import com.ankamagames.dofus.network.messages.game.chat.ChatClientMultiMessage; - import com.ankamagames.dofus.kernel.net.ConnectionsHandler; - - public class FontInstructionHandler implements ConsoleInstructionHandler - { - - private var characters:String; - private var length:int; - - public function FontInstructionHandler() - { - this.characters = (((((((((((((((((((((((((((("!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{|}~¥、。〃〄々〆〇〈〉《》「」『』【】〒〓〔〕〖〗〘" + "〙〚〛〜〝〞〟ぁあぃいぅうぇえぉおかがきぎくぐけげこごさざしじすずせぜそぞただちぢっつづてでとどなにぬねのはばぱひびぴふぶぷへべぺほぼぽまみむめもゃやゅゆょよら") + "りるれろゎわゐゑをんゔゕゖゝゞァアィイゥウェエォオカガキギクグケゲコゴサザシジスズセゼソゾタダチヂッツヅテデトドナニヌネノハバパヒビピフブプヘベペホボポマミムメ") + "モャヤュユョヨラリルレロヮワヰヱヲンヴヵヶヷヸヹヺ・ーヽヾ一丁七万丈三上下不与且世丘丙両並中丸丹主久乏乗乙九乱乳乾了予争事二互五井亜亡交享京亭人仁今介仏仕他付仙") + "代令以仮仰仲件任企伏伐休会伝伯伴伸伺似但位低住佐体何余作佳併使例侍供依価侮侯侵便係促俊俗保信修俳俵俸倉個倍倒候借倣値倫倹偉偏停健側偵偶偽傍傑傘備催債傷傾働像僕僚") + "僧儀億儒償優元兄充兆先光克免児党入全八公六共兵具典兼内円冊再冒冗写冠冬冷准凍凝凡処凶凸凹出刀刃分切刈刊刑列初判別利到制刷券刺刻則削前剖剛剣剤副剰割創劇力功加劣助") + "努励労効劾勅勇勉動勘務勝募勢勤勧勲勺匁包化北匠匹区医匿十千升午半卑卒卓協南単博占印危即却卵卸厄厘厚原厳去参又及友双反収叔取受叙口古句叫召可台史右号司各合吉同名后") + "吏吐向君吟否含吸吹呈呉告周味呼命和咲哀品員哲唆唇唐唯唱商問啓善喚喜喝喪喫営嗣嘆嘱器噴嚇囚四回因団困囲図固国圏園土圧在地坂均坊坑坪垂型垣埋城域執培基堀堂堅堕堤堪報") + "場塀塁塊塑塔塗塚塩塾境墓増墜墨墳墾壁壇壊壌士壮声壱売変夏夕外多夜夢大天太夫央失奇奉奏契奔奥奨奪奮女奴好如妃妄妊妙妥妨妹妻姉始姓委姫姻姿威娘娠娯婆婚婦婿媒嫁嫌嫡嬢") + "子孔字存孝季孤学孫宅宇守安完宗官宙定宜宝実客宣室宮宰害宴宵家容宿寂寄密富寒寛寝察寡寧審寮寸寺対寿封専射将尉尊尋導小少尚就尺尼尽尾尿局居屈届屋展属層履屯山岐岩岬岳") + "岸峠峡峰島崇崎崩川州巡巣工左巧巨差己巻市布帆希帝帥師席帯帰帳常帽幅幕幣干平年幸幹幻幼幽幾庁広床序底店府度座庫庭庶康庸廃廉廊延廷建弁弊式弐弓弔引弟弦弧弱張強弾当形") + "彩彫彰影役彼往征径待律後徐徒従得御復循微徳徴徹心必忌忍志忘忙応忠快念怒怖思怠急性怪恋恐恒恥恨恩恭息恵悔悟悠患悦悩悪悲悼情惑惜惨惰想愁愉意愚愛感慈態慌慎慕慢慣慨慮") + "慰慶憂憎憤憩憲憶憾懇懐懲懸成我戒戦戯戸戻房所扇扉手才打払扱扶批承技抄把抑投抗折抜択披抱抵抹押抽担拍拐拒拓拘拙招拝拠拡括拷拾持指挑挙挟振挿捕捜捨据掃授掌排掘掛採探") + "接控推措掲描提揚換握揮援揺損搬搭携搾摂摘摩撃撤撮撲擁操擦擬支改攻放政故敏救敗教敢散敬数整敵敷文斉斎斗料斜斤斥断新方施旅旋族旗既日旧旨早旬昆昇明易昔星映春昨昭是昼") + "時晩普景晴晶暁暇暑暖暗暦暫暮暴曇曜曲更書曹替最月有服朕朗望朝期木未末本札朱朴机朽 杉材村束条来杯東松板析林枚果枝枠枢枯架柄某染柔柱柳査栄栓校株核根格栽桃案桑桜桟梅") + "械棄棋棒棚棟森棺植検業極楼楽概構様槽標模権横樹橋機欄欠次欧欲欺款歌歓止正武歩歯歳歴死殉殊残殖殴段殺殻殿母毎毒比毛氏民気水氷永汁求汗汚江池決汽沈沖没沢河沸油治沼沿") + "況泉泊泌法泡波泣泥注泰泳洋洗洞津洪活派流浄浅浜浦浪浮浴海浸消涙涯液涼淑淡深混添清渇済渉渋渓減渡渦温測港湖湯湾湿満源準溝溶滅滋滑滝滞滴漁漂漆漏演漠漢漫漬漸潔潜潟潤") + "潮澄激濁濃濫濯瀬火灯灰災炉炊炎炭点為烈無焦然焼煙照煩煮熟熱燃燥爆爵父片版牛牧物牲特犠犬犯状狂狩独狭猛猟猫献猶猿獄獣獲玄率玉王珍珠班現球理琴環璽瓶甘甚生産用田由甲") + "申男町画界畑畔留畜畝略番異畳疎疑疫疲疾病症痘痛痢痴療癒癖発登白百的皆皇皮皿盆益盗盛盟監盤目盲直相盾省看県真眠眺眼着睡督瞬矛矢知短矯石砂研砕砲破硝硫硬碁碑確磁磨礁") + "礎示礼社祈祉祖祝神祥票祭禁禅禍福秀私秋科秒秘租秩称移程税稚種稲稼稿穀穂積穏穫穴究空突窃窒窓窮窯立竜章童端競竹笑笛符第筆等筋筒答策箇算管箱節範築篤簡簿籍米粉粋粒粗") + "粘粛粧精糖糧糸系糾紀約紅紋納純紙級紛素紡索紫累細紳紹紺終組経結絞絡給統絵絶絹継続維綱網綿緊総緑緒線締編緩緯練縁縄縛縦縫縮績繁繊織繕繭繰缶罪置罰署罷羅羊美群義羽翁") + "翌習翻翼老考者耐耕耗耳聖聞聴職肉肌肖肝肢肥肩肪肯育肺胃胆背胎胞胴胸能脂脅脈脚脱脳脹腐腕腰腸腹膚膜膨臓臣臨自臭至致興舌舎舗舞舟航般舶船艇艦良色芋芝花芳芸芽苗若苦英") + "茂茎茶草荒荘荷菊菌菓菜華落葉著葬蒸蓄蔵薄薦薪薫薬藩藻虐虚虜虞虫蚊蚕蛇蛍蛮融血衆行術街衛衝衡衣表衰衷袋被裁裂装裏裕補裸製複褐褒襟襲西要覆覇見規視覚覧親観角解触言訂") + "計討訓託記訟訪設許訳訴診証詐詔評詞詠試詩詰話該詳誇誉誌認誓誕誘語誠誤説読課調談請論諭諮諸諾謀謁謄謙講謝謡謹識譜警議譲護谷豆豊豚象豪貝貞負財貢貧貨販貫責貯貴買貸費") + "貿賀賃賄資賊賓賛賜賞賠賢賦質購贈赤赦走赴起超越趣足距跡路跳践踊踏躍身車軌軍軒軟転軸軽較載輝輩輪輸轄辛辞辱農辺込迅迎近返迫迭述迷追退送逃逆透逐逓途通逝速造連逮週進") + "逸遂遅遇遊運遍過道達違遠遣適遭遮遵遷選遺避還邦邪邸郊郎郡部郭郵郷都酌配酒酔酢酪酬酵酷酸醜醸釈里重野量金針釣鈍鈴鉄鉛鉢鉱銀銃銅銑銘銭鋭鋳鋼錘錠錬錯録鍛鎖鎮鏡鐘鑑長") + "門閉開閑間関閣閥閲闘防阻附降限陛院陣除陥陪陰陳陵陶陸険陽隅隆隊階随隔際障隠隣隷隻雄雅集雇雌雑離難雨雪雰雲零雷電需震霊霜霧露青静非面革靴音韻響頂項順預頑頒領頭頻頼") + "題額顔顕願類顧風飛食飢飯飲飼飽飾養餓館首香馬駄駅駆駐騎騒験騰驚骨髄高髪鬼魂魅魔魚鮮鯨鳥鳴鶏麗麦麻黄黒黙鼓鼻齢!"#$%&'()*+,-./0123456789:;<=>?@") + "ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~¥"); - this.length = this.characters.length; - super(); - } - - public function handle(console:ConsoleHandler, cmd:String, args:Array):void - { - var _local_4:Timer; - switch (cmd) - { - case "jptest": - _local_4 = new Timer(500, (this.length / 10)); - _local_4.addEventListener(TimerEvent.TIMER, this.testCharacter); - _local_4.start(); - return; - }; - } - - private function testCharacter(event:TimerEvent):void - { - var char:String = this.characters.substr((10 * Timer(event.target).currentCount), 10); - var ccmm:ChatClientMultiMessage = new ChatClientMultiMessage(); - ccmm.initChatAbstractClientMessage(char); - ConnectionsHandler.getConnection().send(ccmm); - } - - public function getHelp(cmd:String):String - { - switch (cmd) - { - case "jptest": - return ("test japanese characters set"); - }; - return ("Unknown command"); - } - - public function getParamPossibilities(cmd:String, paramIndex:uint=0, currentParams:Array=null):Array - { - return ([]); - } - - - } -}//package com.ankamagames.dofus.console.debug - + import com.ankamagames.jerakine.console.ConsoleInstructionHandler; + import com.ankamagames.jerakine.console.ConsoleHandler; + import flash.utils.Timer; + import flash.events.TimerEvent; + import com.ankamagames.dofus.network.messages.game.chat.ChatClientMultiMessage; + import com.ankamagames.dofus.kernel.net.ConnectionsHandler; + + public class FontInstructionHandler extends Object implements ConsoleInstructionHandler + { + + public function FontInstructionHandler() + { + this.characters = "!\"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{|}~¥、。〃〄々〆〇〈〉《》「」『』【】〒〓〔〕〖〗〘" + "〙〚〛〜〝〞〟ぁあぃいぅうぇえぉおかがきぎくぐけげこごさざしじすずせぜそぞただちぢっつづてでとどなにぬねのはばぱひびぴふぶぷへべぺほぼぽまみむめもゃやゅゆょよら" + "りるれろゎわゐゑをんゔゕゖゝゞァアィイゥウェエォオカガキギクグケゲコゴサザシジスズセゼソゾタダチヂッツヅテデトドナニヌネノハバパヒビピフブプヘベペホボポマミムメ" + "モャヤュユョヨラリルレロヮワヰヱヲンヴヵヶヷヸヹヺ・ーヽヾ一丁七万丈三上下不与且世丘丙両並中丸丹主久乏乗乙九乱乳乾了予争事二互五井亜亡交享京亭人仁今介仏仕他付仙" + "代令以仮仰仲件任企伏伐休会伝伯伴伸伺似但位低住佐体何余作佳併使例侍供依価侮侯侵便係促俊俗保信修俳俵俸倉個倍倒候借倣値倫倹偉偏停健側偵偶偽傍傑傘備催債傷傾働像僕僚" + "僧儀億儒償優元兄充兆先光克免児党入全八公六共兵具典兼内円冊再冒冗写冠冬冷准凍凝凡処凶凸凹出刀刃分切刈刊刑列初判別利到制刷券刺刻則削前剖剛剣剤副剰割創劇力功加劣助" + "努励労効劾勅勇勉動勘務勝募勢勤勧勲勺匁包化北匠匹区医匿十千升午半卑卒卓協南単博占印危即却卵卸厄厘厚原厳去参又及友双反収叔取受叙口古句叫召可台史右号司各合吉同名后" + "吏吐向君吟否含吸吹呈呉告周味呼命和咲哀品員哲唆唇唐唯唱商問啓善喚喜喝喪喫営嗣嘆嘱器噴嚇囚四回因団困囲図固国圏園土圧在地坂均坊坑坪垂型垣埋城域執培基堀堂堅堕堤堪報" + "場塀塁塊塑塔塗塚塩塾境墓増墜墨墳墾壁壇壊壌士壮声壱売変夏夕外多夜夢大天太夫央失奇奉奏契奔奥奨奪奮女奴好如妃妄妊妙妥妨妹妻姉始姓委姫姻姿威娘娠娯婆婚婦婿媒嫁嫌嫡嬢" + "子孔字存孝季孤学孫宅宇守安完宗官宙定宜宝実客宣室宮宰害宴宵家容宿寂寄密富寒寛寝察寡寧審寮寸寺対寿封専射将尉尊尋導小少尚就尺尼尽尾尿局居屈届屋展属層履屯山岐岩岬岳" + "岸峠峡峰島崇崎崩川州巡巣工左巧巨差己巻市布帆希帝帥師席帯帰帳常帽幅幕幣干平年幸幹幻幼幽幾庁広床序底店府度座庫庭庶康庸廃廉廊延廷建弁弊式弐弓弔引弟弦弧弱張強弾当形" + "彩彫彰影役彼往征径待律後徐徒従得御復循微徳徴徹心必忌忍志忘忙応忠快念怒怖思怠急性怪恋恐恒恥恨恩恭息恵悔悟悠患悦悩悪悲悼情惑惜惨惰想愁愉意愚愛感慈態慌慎慕慢慣慨慮" + "慰慶憂憎憤憩憲憶憾懇懐懲懸成我戒戦戯戸戻房所扇扉手才打払扱扶批承技抄把抑投抗折抜択披抱抵抹押抽担拍拐拒拓拘拙招拝拠拡括拷拾持指挑挙挟振挿捕捜捨据掃授掌排掘掛採探" + "接控推措掲描提揚換握揮援揺損搬搭携搾摂摘摩撃撤撮撲擁操擦擬支改攻放政故敏救敗教敢散敬数整敵敷文斉斎斗料斜斤斥断新方施旅旋族旗既日旧旨早旬昆昇明易昔星映春昨昭是昼" + "時晩普景晴晶暁暇暑暖暗暦暫暮暴曇曜曲更書曹替最月有服朕朗望朝期木未末本札朱朴机朽 杉材村束条来杯東松板析林枚果枝枠枢枯架柄某染柔柱柳査栄栓校株核根格栽桃案桑桜桟梅" + "械棄棋棒棚棟森棺植検業極楼楽概構様槽標模権横樹橋機欄欠次欧欲欺款歌歓止正武歩歯歳歴死殉殊残殖殴段殺殻殿母毎毒比毛氏民気水氷永汁求汗汚江池決汽沈沖没沢河沸油治沼沿" + "況泉泊泌法泡波泣泥注泰泳洋洗洞津洪活派流浄浅浜浦浪浮浴海浸消涙涯液涼淑淡深混添清渇済渉渋渓減渡渦温測港湖湯湾湿満源準溝溶滅滋滑滝滞滴漁漂漆漏演漠漢漫漬漸潔潜潟潤" + "潮澄激濁濃濫濯瀬火灯灰災炉炊炎炭点為烈無焦然焼煙照煩煮熟熱燃燥爆爵父片版牛牧物牲特犠犬犯状狂狩独狭猛猟猫献猶猿獄獣獲玄率玉王珍珠班現球理琴環璽瓶甘甚生産用田由甲" + "申男町画界畑畔留畜畝略番異畳疎疑疫疲疾病症痘痛痢痴療癒癖発登白百的皆皇皮皿盆益盗盛盟監盤目盲直相盾省看県真眠眺眼着睡督瞬矛矢知短矯石砂研砕砲破硝硫硬碁碑確磁磨礁" + "礎示礼社祈祉祖祝神祥票祭禁禅禍福秀私秋科秒秘租秩称移程税稚種稲稼稿穀穂積穏穫穴究空突窃窒窓窮窯立竜章童端競竹笑笛符第筆等筋筒答策箇算管箱節範築篤簡簿籍米粉粋粒粗" + "粘粛粧精糖糧糸系糾紀約紅紋納純紙級紛素紡索紫累細紳紹紺終組経結絞絡給統絵絶絹継続維綱網綿緊総緑緒線締編緩緯練縁縄縛縦縫縮績繁繊織繕繭繰缶罪置罰署罷羅羊美群義羽翁" + "翌習翻翼老考者耐耕耗耳聖聞聴職肉肌肖肝肢肥肩肪肯育肺胃胆背胎胞胴胸能脂脅脈脚脱脳脹腐腕腰腸腹膚膜膨臓臣臨自臭至致興舌舎舗舞舟航般舶船艇艦良色芋芝花芳芸芽苗若苦英" + "茂茎茶草荒荘荷菊菌菓菜華落葉著葬蒸蓄蔵薄薦薪薫薬藩藻虐虚虜虞虫蚊蚕蛇蛍蛮融血衆行術街衛衝衡衣表衰衷袋被裁裂装裏裕補裸製複褐褒襟襲西要覆覇見規視覚覧親観角解触言訂" + "計討訓託記訟訪設許訳訴診証詐詔評詞詠試詩詰話該詳誇誉誌認誓誕誘語誠誤説読課調談請論諭諮諸諾謀謁謄謙講謝謡謹識譜警議譲護谷豆豊豚象豪貝貞負財貢貧貨販貫責貯貴買貸費" + "貿賀賃賄資賊賓賛賜賞賠賢賦質購贈赤赦走赴起超越趣足距跡路跳践踊踏躍身車軌軍軒軟転軸軽較載輝輩輪輸轄辛辞辱農辺込迅迎近返迫迭述迷追退送逃逆透逐逓途通逝速造連逮週進" + "逸遂遅遇遊運遍過道達違遠遣適遭遮遵遷選遺避還邦邪邸郊郎郡部郭郵郷都酌配酒酔酢酪酬酵酷酸醜醸釈里重野量金針釣鈍鈴鉄鉛鉢鉱銀銃銅銑銘銭鋭鋳鋼錘錠錬錯録鍛鎖鎮鏡鐘鑑長" + "門閉開閑間関閣閥閲闘防阻附降限陛院陣除陥陪陰陳陵陶陸険陽隅隆隊階随隔際障隠隣隷隻雄雅集雇雌雑離難雨雪雰雲零雷電需震霊霜霧露青静非面革靴音韻響頂項順預頑頒領頭頻頼" + "題額顔顕願類顧風飛食飢飯飲飼飽飾養餓館首香馬駄駅駆駐騎騒験騰驚骨髄高髪鬼魂魅魔魚鮮鯨鳥鳴鶏麗麦麻黄黒黙鼓鼻齢!"#$%&'()*+,-./0123456789:;<=>?@" + "ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~¥"; + this.length = this.characters.length; + super(); + } + + private var characters:String; + + private var length:int; + + public function handle(param1:ConsoleHandler, param2:String, param3:Array) : void + { + var _loc4_:Timer = null; + switch(param2) + { + case "jptest": + _loc4_ = new Timer(500,this.length / 10); + _loc4_.addEventListener(TimerEvent.TIMER,this.testCharacter); + _loc4_.start(); + break; + } + } + + private function testCharacter(param1:TimerEvent) : void + { + var _loc2_:String = this.characters.substr(10 * Timer(param1.target).currentCount,10); + var _loc3_:ChatClientMultiMessage = new ChatClientMultiMessage(); + _loc3_.initChatAbstractClientMessage(_loc2_); + ConnectionsHandler.getConnection().send(_loc3_); + } + + public function getHelp(param1:String) : String + { + switch(param1) + { + case "jptest": + return "test japanese characters set"; + default: + return "Unknown command"; + } + } + + public function getParamPossibilities(param1:String, param2:uint = 0, param3:Array = null) : Array + { + return []; + } + } +} diff --git a/com/ankamagames/dofus/console/debug/FrameInstructionHandler.as b/com/ankamagames/dofus/console/debug/FrameInstructionHandler.as index 7173b066e..51fa0d4ec 100644 --- a/com/ankamagames/dofus/console/debug/FrameInstructionHandler.as +++ b/com/ankamagames/dofus/console/debug/FrameInstructionHandler.as @@ -1,88 +1,93 @@ -package com.ankamagames.dofus.console.debug +package com.ankamagames.dofus.console.debug { - import com.ankamagames.jerakine.console.ConsoleInstructionHandler; - import com.ankamagames.jerakine.messages.Frame; - import com.ankamagames.dofus.kernel.Kernel; - import flash.utils.getQualifiedClassName; - import com.ankamagames.jerakine.types.enums.Priority; - import com.ankamagames.jerakine.utils.misc.StringUtils; - import com.ankamagames.jerakine.console.ConsoleHandler; - - public class FrameInstructionHandler implements ConsoleInstructionHandler - { - - - public function handle(console:ConsoleHandler, cmd:String, args:Array):void - { - var fl:Array; - var priority:int; - var f:Frame; - var className:String; - var split:Array; - switch (cmd) - { - case "framelist": - fl = []; - for each (f in Kernel.getWorker().framesList) - { - className = getQualifiedClassName(f); - split = className.split("::"); - fl.push([split[(split.length - 1)], Priority.toString(f.priority)]); - }; - console.output(StringUtils.formatArray(fl, ["Class", "Priority"])); - return; - case "framepriority": - if (args.length != 2) - { - console.output("You must specify a frame and a priority to set."); - return; - }; - priority = Priority.fromString(args[1]); - if (priority == 666) - { - console.output((args[1] + " : invalid priority (available priority are LOG, ULTIMATE_HIGHEST_DEPTH_OF_DOOM, HIGHEST, HIGH, NORMAL, LOW and LOWEST")); - return; - }; - for each (f in Kernel.getWorker().framesList) - { - className = getQualifiedClassName(f); - split = className.split("::"); - if (split[(split.length - 1)] == args[0]) - { - try - { - f["priority"] = priority; - } - catch(e:Error) - { - console.output(("Priority set not available for frame " + args[0])); - }; - return; - }; - }; - console.output((args[0] + " : frame not found")); - return; - }; - } - - public function getHelp(cmd:String):String - { - switch (cmd) - { - case "framelist": - return ("list all enabled frame"); - case "framepriority": - return ("overwrite a frame priority"); - }; - return ((("Unknown command '" + cmd) + "'.")); - } - - public function getParamPossibilities(cmd:String, paramIndex:uint=0, currentParams:Array=null):Array - { - return ([]); - } - - - } -}//package com.ankamagames.dofus.console.debug - + import com.ankamagames.jerakine.console.ConsoleInstructionHandler; + import com.ankamagames.jerakine.console.ConsoleHandler; + import com.ankamagames.jerakine.messages.Frame; + import com.ankamagames.dofus.kernel.Kernel; + import flash.utils.getQualifiedClassName; + import com.ankamagames.jerakine.types.enums.Priority; + import com.ankamagames.jerakine.utils.misc.StringUtils; + + public class FrameInstructionHandler extends Object implements ConsoleInstructionHandler + { + + public function FrameInstructionHandler() + { + super(); + } + + public function handle(param1:ConsoleHandler, param2:String, param3:Array) : void + { + var fl:Array = null; + var priority:int = 0; + var f:Frame = null; + var className:String = null; + var split:Array = null; + var console:ConsoleHandler = param1; + var cmd:String = param2; + var args:Array = param3; + switch(cmd) + { + case "framelist": + fl = []; + for each(f in Kernel.getWorker().framesList) + { + className = getQualifiedClassName(f); + split = className.split("::"); + fl.push([split[split.length - 1],Priority.toString(f.priority)]); + } + console.output(StringUtils.formatArray(fl,["Class","Priority"])); + break; + case "framepriority": + if(args.length != 2) + { + console.output("You must specify a frame and a priority to set."); + return; + } + priority = Priority.fromString(args[1]); + if(priority == 666) + { + console.output(args[1] + " : invalid priority (available priority are LOG, ULTIMATE_HIGHEST_DEPTH_OF_DOOM, HIGHEST, HIGH, NORMAL, LOW and LOWEST"); + return; + } + for each(f in Kernel.getWorker().framesList) + { + className = getQualifiedClassName(f); + split = className.split("::"); + if(split[split.length - 1] == args[0]) + { + try + { + f["priority"] = priority; + } + catch(e:Error) + { + console.output("Priority set not available for frame " + args[0]); + } + return; + } + } + console.output(args[0] + " : frame not found"); + return; + } + } + + public function getHelp(param1:String) : String + { + switch(param1) + { + case "framelist": + return "list all enabled frame"; + case "framepriority": + return "overwrite a frame priority"; + default: + return "Unknown command \'" + param1 + "\'."; + } + } + + public function getParamPossibilities(param1:String, param2:uint = 0, param3:Array = null) : Array + { + return []; + } + } +} diff --git a/com/ankamagames/dofus/console/debug/FullScreenInstructionHandler.as b/com/ankamagames/dofus/console/debug/FullScreenInstructionHandler.as index affcc9991..5da0638ae 100644 --- a/com/ankamagames/dofus/console/debug/FullScreenInstructionHandler.as +++ b/com/ankamagames/dofus/console/debug/FullScreenInstructionHandler.as @@ -1,70 +1,70 @@ -package com.ankamagames.dofus.console.debug +package com.ankamagames.dofus.console.debug { - import com.ankamagames.jerakine.console.ConsoleInstructionHandler; - import com.ankamagames.jerakine.utils.system.AirScanner; - import com.ankamagames.jerakine.utils.display.StageShareManager; - import flash.display.StageDisplayState; - import flash.geom.Rectangle; - import com.ankamagames.jerakine.console.ConsoleHandler; - - public class FullScreenInstructionHandler implements ConsoleInstructionHandler - { - - - public function handle(console:ConsoleHandler, cmd:String, args:Array):void - { - var resX:uint; - var resY:uint; - switch (cmd) - { - case "fullscreen": - if (args.length == 0) - { - if (AirScanner.hasAir()) - { - if (StageShareManager.stage.displayState == StageDisplayState["FULL_SCREEN_INTERACTIVE"]) - { - StageShareManager.stage.displayState = StageDisplayState["NORMAL"]; - } - else - { - console.output("Resolution needed."); - }; - }; - } - else - { - if (args.length == 2) - { - if (AirScanner.hasAir()) - { - resX = uint(args[0]); - resY = uint(args[1]); - StageShareManager.stage.fullScreenSourceRect = new Rectangle(0, 0, resX, resY); - StageShareManager.stage.displayState = StageDisplayState["FULL_SCREEN_INTERACTIVE"]; - }; - }; - }; - return; - }; - } - - public function getHelp(cmd:String):String - { - switch (cmd) - { - case "fullscreen": - return ("Toggle the full-screen display mode."); - }; - return ("Unknown command"); - } - - public function getParamPossibilities(cmd:String, paramIndex:uint=0, currentParams:Array=null):Array - { - return ([]); - } - - - } -}//package com.ankamagames.dofus.console.debug - + import com.ankamagames.jerakine.console.ConsoleInstructionHandler; + import com.ankamagames.jerakine.console.ConsoleHandler; + import com.ankamagames.jerakine.utils.system.AirScanner; + import com.ankamagames.jerakine.utils.display.StageShareManager; + import flash.display.StageDisplayState; + import flash.geom.Rectangle; + + public class FullScreenInstructionHandler extends Object implements ConsoleInstructionHandler + { + + public function FullScreenInstructionHandler() + { + super(); + } + + public function handle(param1:ConsoleHandler, param2:String, param3:Array) : void + { + var _loc4_:uint = 0; + var _loc5_:uint = 0; + switch(param2) + { + case "fullscreen": + if(param3.length == 0) + { + if(AirScanner.hasAir()) + { + if(StageShareManager.stage.displayState == StageDisplayState["FULL_SCREEN_INTERACTIVE"]) + { + StageShareManager.stage.displayState = StageDisplayState["NORMAL"]; + } + else + { + param1.output("Resolution needed."); + } + } + } + else if(param3.length == 2) + { + if(AirScanner.hasAir()) + { + _loc4_ = uint(param3[0]); + _loc5_ = uint(param3[1]); + StageShareManager.stage.fullScreenSourceRect = new Rectangle(0,0,_loc4_,_loc5_); + StageShareManager.stage.displayState = StageDisplayState["FULL_SCREEN_INTERACTIVE"]; + } + } + + break; + } + } + + public function getHelp(param1:String) : String + { + switch(param1) + { + case "fullscreen": + return "Toggle the full-screen display mode."; + default: + return "Unknown command"; + } + } + + public function getParamPossibilities(param1:String, param2:uint = 0, param3:Array = null) : Array + { + return []; + } + } +} diff --git a/com/ankamagames/dofus/console/debug/IAInstructionHandler.as b/com/ankamagames/dofus/console/debug/IAInstructionHandler.as index 0cc16c4e8..a4538a0e4 100644 --- a/com/ankamagames/dofus/console/debug/IAInstructionHandler.as +++ b/com/ankamagames/dofus/console/debug/IAInstructionHandler.as @@ -1,192 +1,186 @@ -package com.ankamagames.dofus.console.debug +package com.ankamagames.dofus.console.debug { - import com.ankamagames.jerakine.console.ConsoleInstructionHandler; - import com.ankamagames.atouin.types.Selection; - import com.ankamagames.jerakine.types.positions.MapPoint; - import com.ankamagames.jerakine.types.zones.Lozenge; - import __AS3__.vec.Vector; - import com.ankamagames.atouin.utils.DataMapProvider; - import com.ankamagames.jerakine.map.IDataMapProvider; - import com.ankamagames.atouin.managers.SelectionManager; - import com.ankamagames.atouin.renderers.ZoneDARenderer; - import com.ankamagames.jerakine.types.Color; - import com.ankamagames.jerakine.types.zones.Custom; - import com.ankamagames.jerakine.map.LosDetector; - import com.ankamagames.jerakine.pathfinding.Pathfinding; - import com.ankamagames.jerakine.utils.display.Dofus1Line; - import com.ankamagames.jerakine.utils.display.Dofus2Line; - import com.ankamagames.jerakine.console.ConsoleHandler; - import __AS3__.vec.*; - - public class IAInstructionHandler implements ConsoleInstructionHandler - { - - - public function handle(console:ConsoleHandler, cmd:String, args:Array):void - { - var s:Selection; - var cell:uint; - var cellPoint:MapPoint; - var range:uint; - var cellsSelection:Selection; - var lozenge:Lozenge; - var cells:Vector.; - var start:uint; - var end:uint; - var endPoint:MapPoint; - var _local_15:MapPoint; - var _local_16:Vector.; - var _local_17:Selection; - var fromCell:uint; - var fromPoint:MapPoint; - var toCell:uint; - var toPoint:MapPoint; - var cellsInLine:*; - var i:int; - var map:IDataMapProvider = DataMapProvider.getInstance(); - switch (cmd) - { - case "debuglos": - if (args.length != 2) - { - s = SelectionManager.getInstance().getSelection("CellsFreeForLOS"); - if (s) - { - s.remove(); - console.output("Selection cleared"); - } - else - { - console.output("Arguments needed : cell and range"); - }; - } - else - { - if (args.length == 2) - { - cell = uint(args[0]); - cellPoint = MapPoint.fromCellId(cell); - range = uint(args[1]); - cellsSelection = new Selection(); - lozenge = new Lozenge(0, range, map); - cells = lozenge.getCells(cell); - cellsSelection.renderer = new ZoneDARenderer(); - cellsSelection.color = new Color(0x6600); - cellsSelection.zone = new Custom(LosDetector.getCell(map, cells, cellPoint)); - SelectionManager.getInstance().addSelection(cellsSelection, "CellsFreeForLOS"); - SelectionManager.getInstance().update("CellsFreeForLOS"); - }; - }; - return; - case "calculatepath": - case "tracepath": - if (args.length != 2) - { - s = SelectionManager.getInstance().getSelection("CellsForPath"); - if (s) - { - s.remove(); - console.output("Selection cleared"); - } - else - { - console.output("Arguments needed : start and end of the path"); - }; - } - else - { - if (args.length == 2) - { - start = uint(args[0]); - end = uint(args[1]); - endPoint = MapPoint.fromCellId(end); - if ((((((map.height == 0)) || ((map.width == 0)))) || (!(map.pointMov(endPoint.x, endPoint.y, true))))) - { - console.output("Problem with the map or the end."); - } - else - { - _local_15 = MapPoint.fromCellId(start); - _local_16 = Pathfinding.findPath(map, _local_15, endPoint).getCells(); - if (cmd == "calculatepath") - { - console.output(("Path: " + _local_16.join(","))); - return; - }; - _local_17 = new Selection(); - _local_17.renderer = new ZoneDARenderer(); - _local_17.color = new Color(0x6600); - _local_17.zone = new Custom(_local_16); - SelectionManager.getInstance().addSelection(_local_17, "CellsForPath"); - SelectionManager.getInstance().update("CellsForPath"); - }; - }; - }; - return; - case "debugcellsinline": - if (args.length != 2) - { - s = SelectionManager.getInstance().getSelection("CellsFreeForLOS"); - if (s) - { - s.remove(); - console.output("Selection cleared"); - } - else - { - console.output("Arguments needed : cell and cell"); - }; - } - else - { - if (args.length == 2) - { - fromCell = uint(args[0]); - fromPoint = MapPoint.fromCellId(fromCell); - toCell = uint(args[1]); - toPoint = MapPoint.fromCellId(toCell); - cellsInLine = ((Dofus1Line.useDofus2Line) ? Dofus2Line.getLine(fromPoint.cellId, toPoint.cellId) : Dofus1Line.getLine(fromPoint.x, fromPoint.y, 0, toPoint.x, toPoint.y, 0)); - cellsSelection = new Selection(); - cells = new Vector.(); - i = 0; - while (i < cellsInLine.length) - { - cells.push(MapPoint.fromCoords(cellsInLine[i].x, cellsInLine[i].y).cellId); - i++; - }; - cellsSelection.renderer = new ZoneDARenderer(); - cellsSelection.color = new Color(0x6600); - cellsSelection.zone = new Custom(cells); - SelectionManager.getInstance().addSelection(cellsSelection, "CellsFreeForLOS"); - SelectionManager.getInstance().update("CellsFreeForLOS"); - }; - }; - return; - }; - } - - public function getHelp(cmd:String):String - { - switch (cmd) - { - case "debuglos": - return ("Display all cells which have LOS with the given cell. No argument will clear the selection if any."); - case "calculatepath": - return ("List all cells of the path between two cellIds."); - case "tracepath": - return ("Display all cells of the path between two cellIds. No argument will clear the selection if any."); - case "debugcellsinline": - return ("Display all cells of line between two cellIds. No argument will clear the selection if any."); - }; - return ("Unknown command"); - } - - public function getParamPossibilities(cmd:String, paramIndex:uint=0, currentParams:Array=null):Array - { - return ([]); - } - - - } -}//package com.ankamagames.dofus.console.debug - + import com.ankamagames.jerakine.console.ConsoleInstructionHandler; + import com.ankamagames.jerakine.console.ConsoleHandler; + import com.ankamagames.atouin.types.Selection; + import com.ankamagames.jerakine.types.positions.MapPoint; + import com.ankamagames.jerakine.types.zones.Lozenge; + import com.ankamagames.atouin.utils.DataMapProvider; + import com.ankamagames.jerakine.map.IDataMapProvider; + import com.ankamagames.atouin.managers.SelectionManager; + import com.ankamagames.atouin.renderers.ZoneDARenderer; + import com.ankamagames.jerakine.types.Color; + import com.ankamagames.jerakine.types.zones.Custom; + import com.ankamagames.jerakine.map.LosDetector; + import com.ankamagames.jerakine.pathfinding.Pathfinding; + import com.ankamagames.jerakine.utils.display.Dofus1Line; + import com.ankamagames.jerakine.utils.display.Dofus2Line; + + public class IAInstructionHandler extends Object implements ConsoleInstructionHandler + { + + public function IAInstructionHandler() + { + super(); + } + + public function handle(param1:ConsoleHandler, param2:String, param3:Array) : void + { + var _loc5_:Selection = null; + var _loc6_:uint = 0; + var _loc7_:MapPoint = null; + var _loc8_:uint = 0; + var _loc9_:Selection = null; + var _loc10_:Lozenge = null; + var _loc11_:Vector. = null; + var _loc12_:uint = 0; + var _loc13_:uint = 0; + var _loc14_:MapPoint = null; + var _loc15_:MapPoint = null; + var _loc16_:Vector. = null; + var _loc17_:Selection = null; + var _loc18_:uint = 0; + var _loc19_:MapPoint = null; + var _loc20_:uint = 0; + var _loc21_:MapPoint = null; + var _loc22_:* = undefined; + var _loc23_:* = 0; + var _loc4_:IDataMapProvider = DataMapProvider.getInstance(); + switch(param2) + { + case "debuglos": + if(param3.length != 2) + { + _loc5_ = SelectionManager.getInstance().getSelection("CellsFreeForLOS"); + if(_loc5_) + { + _loc5_.remove(); + param1.output("Selection cleared"); + } + else + { + param1.output("Arguments needed : cell and range"); + } + } + else if(param3.length == 2) + { + _loc6_ = uint(param3[0]); + _loc7_ = MapPoint.fromCellId(_loc6_); + _loc8_ = uint(param3[1]); + _loc9_ = new Selection(); + _loc10_ = new Lozenge(0,_loc8_,_loc4_); + _loc11_ = _loc10_.getCells(_loc6_); + _loc9_.renderer = new ZoneDARenderer(); + _loc9_.color = new Color(26112); + _loc9_.zone = new Custom(LosDetector.getCell(_loc4_,_loc11_,_loc7_)); + SelectionManager.getInstance().addSelection(_loc9_,"CellsFreeForLOS"); + SelectionManager.getInstance().update("CellsFreeForLOS"); + } + + break; + case "calculatepath": + case "tracepath": + if(param3.length != 2) + { + _loc5_ = SelectionManager.getInstance().getSelection("CellsForPath"); + if(_loc5_) + { + _loc5_.remove(); + param1.output("Selection cleared"); + } + else + { + param1.output("Arguments needed : start and end of the path"); + } + } + else if(param3.length == 2) + { + _loc12_ = uint(param3[0]); + _loc13_ = uint(param3[1]); + _loc14_ = MapPoint.fromCellId(_loc13_); + if(_loc4_.height == 0 || _loc4_.width == 0 || !_loc4_.pointMov(_loc14_.x,_loc14_.y,true)) + { + param1.output("Problem with the map or the end."); + } + else + { + _loc15_ = MapPoint.fromCellId(_loc12_); + _loc16_ = Pathfinding.findPath(_loc4_,_loc15_,_loc14_).getCells(); + if(param2 == "calculatepath") + { + param1.output("Path: " + _loc16_.join(",")); + break; + } + _loc17_ = new Selection(); + _loc17_.renderer = new ZoneDARenderer(); + _loc17_.color = new Color(26112); + _loc17_.zone = new Custom(_loc16_); + SelectionManager.getInstance().addSelection(_loc17_,"CellsForPath"); + SelectionManager.getInstance().update("CellsForPath"); + } + } + + break; + case "debugcellsinline": + if(param3.length != 2) + { + _loc5_ = SelectionManager.getInstance().getSelection("CellsFreeForLOS"); + if(_loc5_) + { + _loc5_.remove(); + param1.output("Selection cleared"); + } + else + { + param1.output("Arguments needed : cell and cell"); + } + } + else if(param3.length == 2) + { + _loc18_ = uint(param3[0]); + _loc19_ = MapPoint.fromCellId(_loc18_); + _loc20_ = uint(param3[1]); + _loc21_ = MapPoint.fromCellId(_loc20_); + _loc22_ = Dofus1Line.useDofus2Line?Dofus2Line.getLine(_loc19_.cellId,_loc21_.cellId):Dofus1Line.getLine(_loc19_.x,_loc19_.y,0,_loc21_.x,_loc21_.y,0); + _loc9_ = new Selection(); + _loc11_ = new Vector.(); + _loc23_ = 0; + while(_loc23_ < _loc22_.length) + { + _loc11_.push(MapPoint.fromCoords(_loc22_[_loc23_].x,_loc22_[_loc23_].y).cellId); + _loc23_++; + } + _loc9_.renderer = new ZoneDARenderer(); + _loc9_.color = new Color(26112); + _loc9_.zone = new Custom(_loc11_); + SelectionManager.getInstance().addSelection(_loc9_,"CellsFreeForLOS"); + SelectionManager.getInstance().update("CellsFreeForLOS"); + } + + break; + } + } + + public function getHelp(param1:String) : String + { + switch(param1) + { + case "debuglos": + return "Display all cells which have LOS with the given cell. No argument will clear the selection if any."; + case "calculatepath": + return "List all cells of the path between two cellIds."; + case "tracepath": + return "Display all cells of the path between two cellIds. No argument will clear the selection if any."; + case "debugcellsinline": + return "Display all cells of line between two cellIds. No argument will clear the selection if any."; + default: + return "Unknown command"; + } + } + + public function getParamPossibilities(param1:String, param2:uint = 0, param3:Array = null) : Array + { + return []; + } + } +} diff --git a/com/ankamagames/dofus/console/debug/InventoryInstructionHandler.as b/com/ankamagames/dofus/console/debug/InventoryInstructionHandler.as index a662da06b..0eb8c6230 100644 --- a/com/ankamagames/dofus/console/debug/InventoryInstructionHandler.as +++ b/com/ankamagames/dofus/console/debug/InventoryInstructionHandler.as @@ -1,111 +1,115 @@ -package com.ankamagames.dofus.console.debug +package com.ankamagames.dofus.console.debug { - import com.ankamagames.jerakine.console.ConsoleInstructionHandler; - import com.ankamagames.jerakine.logger.Logger; - import com.ankamagames.jerakine.logger.Log; - import flash.utils.getQualifiedClassName; - import __AS3__.vec.Vector; - import com.ankamagames.dofus.internalDatacenter.items.ItemWrapper; - import com.ankamagames.dofus.datacenter.items.Item; - import com.ankamagames.dofus.network.messages.authorized.AdminQuietCommandMessage; - import com.ankamagames.dofus.logic.game.common.managers.InventoryManager; - import com.ankamagames.jerakine.utils.misc.Chrono; - import com.ankamagames.jerakine.utils.misc.StringUtils; - import com.ankamagames.dofus.misc.utils.GameDataQuery; - import com.ankamagames.dofus.kernel.net.ConnectionsHandler; - import com.ankamagames.jerakine.console.ConsoleHandler; - - public class InventoryInstructionHandler implements ConsoleInstructionHandler - { - - protected static const _log:Logger = Log.getLogger(getQualifiedClassName(InventoryInstructionHandler)); - - - public function handle(console:ConsoleHandler, cmd:String, args:Array):void - { - var _local_4:Array; - var _local_5:String; - var _local_6:Vector.; - var _local_7:Vector.; - var _local_8:Array; - var _local_9:uint; - var item:ItemWrapper; - var currentItem:Item; - var currentItem2:Item; - var aqcmsg:AdminQuietCommandMessage; - switch (cmd) - { - case "listinventory": - for each (item in InventoryManager.getInstance().realInventory) - { - console.output(((((((("[UID: " + item.objectUID) + ", ID:") + item.objectGID) + "] ") + item.quantity) + " x ") + item["name"])); - }; - return; - case "searchitem": - if (args.length < 1) - { - console.output((cmd + " need an argument to search for")); - return; - }; - Chrono.start("Général"); - _local_4 = new Array(); - _local_5 = StringUtils.noAccent(args.join(" ").toLowerCase()); - Chrono.start("Query"); - _local_6 = GameDataQuery.queryString(Item, "name", _local_5); - Chrono.stop(); - Chrono.start("Instance"); - _local_7 = GameDataQuery.returnInstance(Item, _local_6); - Chrono.stop(); - Chrono.start("Add"); - for each (currentItem in _local_7) - { - _local_4.push((((("\t" + currentItem.name) + " ( id : ") + currentItem.id) + " )")); - }; - Chrono.stop(); - Chrono.stop(); - _log.debug((("sur " + _local_7.length) + " iterations")); - _local_4.sort(Array.CASEINSENSITIVE); - console.output(_local_4.join("\n")); - console.output((("\tRESULT : " + _local_4.length) + " items founded")); - return; - case "makeinventory": - _local_8 = Item.getItems(); - _local_9 = parseInt(args[0], 10); - for each (currentItem2 in _local_8) - { - if (!!(currentItem2)) - { - if (!(_local_9)) break; - aqcmsg = new AdminQuietCommandMessage(); - aqcmsg.initAdminQuietCommandMessage(((("item * " + currentItem2.id) + " ") + Math.ceil((Math.random() * 10)))); - ConnectionsHandler.getConnection().send(aqcmsg); - _local_9--; - }; - }; - return; - }; - } - - public function getHelp(cmd:String):String - { - switch (cmd) - { - case "listinventory": - return ("List player inventory content."); - case "searchitem": - return ("Search item name/id, param : [part of searched item name]"); - case "makeinventory": - return ("Create an inventory"); - }; - return ((("Unknown command '" + cmd) + "'.")); - } - - public function getParamPossibilities(cmd:String, paramIndex:uint=0, currentParams:Array=null):Array - { - return ([]); - } - - - } -}//package com.ankamagames.dofus.console.debug - + import com.ankamagames.jerakine.console.ConsoleInstructionHandler; + import com.ankamagames.jerakine.logger.Logger; + import com.ankamagames.jerakine.logger.Log; + import flash.utils.getQualifiedClassName; + import com.ankamagames.jerakine.console.ConsoleHandler; + import com.ankamagames.dofus.internalDatacenter.items.ItemWrapper; + import com.ankamagames.dofus.datacenter.items.Item; + import com.ankamagames.dofus.network.messages.authorized.AdminQuietCommandMessage; + import com.ankamagames.dofus.logic.game.common.managers.InventoryManager; + import com.ankamagames.jerakine.utils.misc.Chrono; + import com.ankamagames.jerakine.utils.misc.StringUtils; + import com.ankamagames.dofus.misc.utils.GameDataQuery; + import com.ankamagames.dofus.kernel.net.ConnectionsHandler; + + public class InventoryInstructionHandler extends Object implements ConsoleInstructionHandler + { + + public function InventoryInstructionHandler() + { + super(); + } + + protected static const _log:Logger = Log.getLogger(getQualifiedClassName(InventoryInstructionHandler)); + + public function handle(param1:ConsoleHandler, param2:String, param3:Array) : void + { + var _loc4_:Array = null; + var _loc5_:String = null; + var _loc6_:Vector. = null; + var _loc7_:Vector. = null; + var _loc8_:Array = null; + var _loc9_:uint = 0; + var _loc10_:ItemWrapper = null; + var _loc11_:Item = null; + var _loc12_:Item = null; + var _loc13_:AdminQuietCommandMessage = null; + switch(param2) + { + case "listinventory": + for each(_loc10_ in InventoryManager.getInstance().realInventory) + { + param1.output("[UID: " + _loc10_.objectUID + ", ID:" + _loc10_.objectGID + "] " + _loc10_.quantity + " x " + _loc10_["name"]); + } + break; + case "searchitem": + if(param3.length < 1) + { + param1.output(param2 + " need an argument to search for"); + break; + } + Chrono.start("Général"); + _loc4_ = new Array(); + _loc5_ = StringUtils.noAccent(param3.join(" ").toLowerCase()); + Chrono.start("Query"); + _loc6_ = GameDataQuery.queryString(Item,"name",_loc5_); + Chrono.stop(); + Chrono.start("Instance"); + _loc7_ = GameDataQuery.returnInstance(Item,_loc6_); + Chrono.stop(); + Chrono.start("Add"); + for each(_loc11_ in _loc7_) + { + _loc4_.push("\t" + _loc11_.name + " ( id : " + _loc11_.id + " )"); + } + Chrono.stop(); + Chrono.stop(); + _log.debug("sur " + _loc7_.length + " iterations"); + _loc4_.sort(Array.CASEINSENSITIVE); + param1.output(_loc4_.join("\n")); + param1.output("\tRESULT : " + _loc4_.length + " items founded"); + break; + case "makeinventory": + _loc8_ = Item.getItems(); + _loc9_ = parseInt(param3[0],10); + for each(_loc12_ in _loc8_) + { + if(_loc12_) + { + if(!_loc9_) + { + break; + } + _loc13_ = new AdminQuietCommandMessage(); + _loc13_.initAdminQuietCommandMessage("item * " + _loc12_.id + " " + Math.ceil(Math.random() * 10)); + ConnectionsHandler.getConnection().send(_loc13_); + _loc9_--; + } + } + break; + } + } + + public function getHelp(param1:String) : String + { + switch(param1) + { + case "listinventory": + return "List player inventory content."; + case "searchitem": + return "Search item name/id, param : [part of searched item name]"; + case "makeinventory": + return "Create an inventory"; + default: + return "Unknown command \'" + param1 + "\'."; + } + } + + public function getParamPossibilities(param1:String, param2:uint = 0, param3:Array = null) : Array + { + return []; + } + } +} diff --git a/com/ankamagames/dofus/console/debug/LivingObjectInstructionHandler.as b/com/ankamagames/dofus/console/debug/LivingObjectInstructionHandler.as index 34772d8ce..1d8dabe02 100644 --- a/com/ankamagames/dofus/console/debug/LivingObjectInstructionHandler.as +++ b/com/ankamagames/dofus/console/debug/LivingObjectInstructionHandler.as @@ -1,51 +1,53 @@ -package com.ankamagames.dofus.console.debug +package com.ankamagames.dofus.console.debug { - import com.ankamagames.jerakine.console.ConsoleInstructionHandler; - import com.ankamagames.jerakine.logger.Logger; - import com.ankamagames.jerakine.logger.Log; - import flash.utils.getQualifiedClassName; - import com.ankamagames.dofus.logic.game.common.managers.SpeakingItemManager; - import com.ankamagames.jerakine.console.ConsoleHandler; - - public class LivingObjectInstructionHandler implements ConsoleInstructionHandler - { - - protected static const _log:Logger = Log.getLogger(getQualifiedClassName(InventoryInstructionHandler)); - - - public function handle(console:ConsoleHandler, cmd:String, args:Array):void - { - switch (cmd) - { - case "floodlivingobject": - if (SpeakingItemManager.getInstance().speakTimerMinuteDelay != SpeakingItemManager.MINUTE_DELAY) - { - SpeakingItemManager.getInstance().speakTimerMinuteDelay = SpeakingItemManager.MINUTE_DELAY; - } - else - { - SpeakingItemManager.getInstance().speakTimerMinuteDelay = 100; - }; - return; - }; - } - - public function getHelp(cmd:String):String - { - switch (cmd) - { - case "floodlivingobject": - return ("Make a flood of talk from living objects."); - }; - return ((("Unknown command '" + cmd) + "'.")); - } - - public function getParamPossibilities(cmd:String, paramIndex:uint=0, currentParams:Array=null):Array - { - return ([]); - } - - - } -}//package com.ankamagames.dofus.console.debug - + import com.ankamagames.jerakine.console.ConsoleInstructionHandler; + import com.ankamagames.jerakine.logger.Logger; + import com.ankamagames.jerakine.logger.Log; + import flash.utils.getQualifiedClassName; + import com.ankamagames.jerakine.console.ConsoleHandler; + import com.ankamagames.dofus.logic.game.common.managers.SpeakingItemManager; + + public class LivingObjectInstructionHandler extends Object implements ConsoleInstructionHandler + { + + public function LivingObjectInstructionHandler() + { + super(); + } + + protected static const _log:Logger = Log.getLogger(getQualifiedClassName(InventoryInstructionHandler)); + + public function handle(param1:ConsoleHandler, param2:String, param3:Array) : void + { + switch(param2) + { + case "floodlivingobject": + if(SpeakingItemManager.getInstance().speakTimerMinuteDelay != SpeakingItemManager.MINUTE_DELAY) + { + SpeakingItemManager.getInstance().speakTimerMinuteDelay = SpeakingItemManager.MINUTE_DELAY; + } + else + { + SpeakingItemManager.getInstance().speakTimerMinuteDelay = 100; + } + break; + } + } + + public function getHelp(param1:String) : String + { + switch(param1) + { + case "floodlivingobject": + return "Make a flood of talk from living objects."; + default: + return "Unknown command \'" + param1 + "\'."; + } + } + + public function getParamPossibilities(param1:String, param2:uint = 0, param3:Array = null) : Array + { + return []; + } + } +} diff --git a/com/ankamagames/dofus/console/debug/LuaInstructionHandler.as b/com/ankamagames/dofus/console/debug/LuaInstructionHandler.as index 7d9e7e5a2..2d0dde0fd 100644 --- a/com/ankamagames/dofus/console/debug/LuaInstructionHandler.as +++ b/com/ankamagames/dofus/console/debug/LuaInstructionHandler.as @@ -1,67 +1,69 @@ -package com.ankamagames.dofus.console.debug +package com.ankamagames.dofus.console.debug { - import com.ankamagames.jerakine.console.ConsoleInstructionHandler; - import com.ankamagames.jerakine.lua.LuaPlayer; - import com.ankamagames.jerakine.script.ScriptsManager; - import com.ankamagames.jerakine.lua.LuaPlayerEvent; - import com.ankamagames.dofus.console.moduleLUA.ConsoleLUA; - import com.ankamagames.jerakine.console.ConsoleHandler; - import com.ankamagames.jerakine.console.ConsolesManager; - - public class LuaInstructionHandler implements ConsoleInstructionHandler - { - - - public function handle(console:ConsoleHandler, cmd:String, args:Array):void - { - var luaPlayer:LuaPlayer; - switch (cmd) - { - case "lua": - if (((args) && (args[0]))) - { - luaPlayer = (ScriptsManager.getInstance().getPlayer(ScriptsManager.LUA_PLAYER) as LuaPlayer); - luaPlayer.addEventListener(LuaPlayerEvent.PLAY_SUCCESS, this.onScriptSuccess); - luaPlayer.addEventListener(LuaPlayerEvent.PLAY_ERROR, this.onScriptError); - luaPlayer.playFile(args[0]); - }; - return; - case "luarecorder": - ConsoleLUA.getInstance().toggleDisplay(); - return; - }; - } - - public function getHelp(cmd:String):String - { - switch (cmd) - { - case "lua": - return ("Loads and executes a lua script file."); - case "luarecorder": - return ("Open a separate window to record in game actions and generate a LUA script file."); - }; - return ((("Unknown command '" + cmd) + "'.")); - } - - public function getParamPossibilities(cmd:String, paramIndex:uint=0, currentParams:Array=null):Array - { - return (null); - } - - private function onScriptSuccess(pEvent:LuaPlayerEvent):void - { - pEvent.currentTarget.removeEventListener(LuaPlayerEvent.PLAY_SUCCESS, this.onScriptSuccess); - ConsolesManager.getConsole("debug").output("Script successfully executed."); - } - - private function onScriptError(pEvent:LuaPlayerEvent):void - { - pEvent.currentTarget.removeEventListener(LuaPlayerEvent.PLAY_ERROR, this.onScriptError); - ConsolesManager.getConsole("debug").output(("Script error.\n" + pEvent.stackTrace)); - } - - - } -}//package com.ankamagames.dofus.console.debug - + import com.ankamagames.jerakine.console.ConsoleInstructionHandler; + import com.ankamagames.jerakine.console.ConsoleHandler; + import com.ankamagames.jerakine.lua.LuaPlayer; + import com.ankamagames.jerakine.script.ScriptsManager; + import com.ankamagames.jerakine.lua.LuaPlayerEvent; + import com.ankamagames.dofus.console.moduleLUA.ConsoleLUA; + import com.ankamagames.jerakine.console.ConsolesManager; + + public class LuaInstructionHandler extends Object implements ConsoleInstructionHandler + { + + public function LuaInstructionHandler() + { + super(); + } + + public function handle(param1:ConsoleHandler, param2:String, param3:Array) : void + { + var _loc4_:LuaPlayer = null; + switch(param2) + { + case "lua": + if((param3) && (param3[0])) + { + _loc4_ = ScriptsManager.getInstance().getPlayer(ScriptsManager.LUA_PLAYER) as LuaPlayer; + _loc4_.addEventListener(LuaPlayerEvent.PLAY_SUCCESS,this.onScriptSuccess); + _loc4_.addEventListener(LuaPlayerEvent.PLAY_ERROR,this.onScriptError); + _loc4_.playFile(param3[0]); + } + break; + case "luarecorder": + ConsoleLUA.getInstance().toggleDisplay(); + break; + } + } + + public function getHelp(param1:String) : String + { + switch(param1) + { + case "lua": + return "Loads and executes a lua script file."; + case "luarecorder": + return "Open a separate window to record in game actions and generate a LUA script file."; + default: + return "Unknown command \'" + param1 + "\'."; + } + } + + public function getParamPossibilities(param1:String, param2:uint = 0, param3:Array = null) : Array + { + return null; + } + + private function onScriptSuccess(param1:LuaPlayerEvent) : void + { + param1.currentTarget.removeEventListener(LuaPlayerEvent.PLAY_SUCCESS,this.onScriptSuccess); + ConsolesManager.getConsole("debug").output("Script successfully executed."); + } + + private function onScriptError(param1:LuaPlayerEvent) : void + { + param1.currentTarget.removeEventListener(LuaPlayerEvent.PLAY_ERROR,this.onScriptError); + ConsolesManager.getConsole("debug").output("Script error.\n" + param1.stackTrace); + } + } +} diff --git a/com/ankamagames/dofus/console/debug/MiscInstructionHandler.as b/com/ankamagames/dofus/console/debug/MiscInstructionHandler.as index ce947df8a..a396a9df0 100644 --- a/com/ankamagames/dofus/console/debug/MiscInstructionHandler.as +++ b/com/ankamagames/dofus/console/debug/MiscInstructionHandler.as @@ -1,402 +1,396 @@ -package com.ankamagames.dofus.console.debug +package com.ankamagames.dofus.console.debug { - import com.ankamagames.jerakine.console.ConsoleInstructionHandler; - import com.ankamagames.dofus.logic.game.common.frames.SynchronisationFrame; - import com.ankamagames.jerakine.logger.Logger; - import com.ankamagames.jerakine.managers.OptionManager; - import flash.filesystem.File; - import com.ankamagames.dofus.datacenter.monsters.Monster; - import flash.filesystem.FileStream; - import flash.utils.ByteArray; - import com.ankamagames.tiphon.display.TiphonSprite; - import flash.display.DisplayObject; - import com.ankamagames.tiphon.types.look.TiphonEntityLook; - import com.ankamagames.jerakine.entities.interfaces.IEntity; - import com.ankamagames.jerakine.logger.Log; - import flash.utils.getQualifiedClassName; - import com.ankamagames.jerakine.logger.LogLogger; - import flash.desktop.NativeApplication; - import flash.events.Event; - import flash.events.InvokeEvent; - import com.ankamagames.jerakine.data.I18n; - import com.ankamagames.berilia.managers.KernelEventsManager; - import com.ankamagames.dofus.misc.lists.HookList; - import com.ankamagames.berilia.types.graphic.TimeoutHTMLLoader; - import com.ankamagames.jerakine.utils.crypto.Base64; - import com.ankamagames.jerakine.utils.display.StageShareManager; - import com.ankamagames.atouin.managers.EntitiesManager; - import com.ankamagames.jerakine.replay.LogFrame; - import flash.filesystem.FileMode; - import com.ankamagames.dofus.kernel.Kernel; - import flash.utils.setTimeout; - import com.ankamagames.dofus.logic.shield.ShieldSecureLevel; - import com.ankamagames.dofus.logic.shield.SecureModeManager; - import com.ankamagames.jerakine.handlers.HumanInputHandler; - import com.ankamagames.dofus.logic.game.common.managers.InactivityManager; - import com.ankamagames.dofus.types.entities.AnimatedCharacter; - import com.ankamagames.jerakine.console.ConsoleHandler; - import flash.display.StageQuality; - - public class MiscInstructionHandler implements ConsoleInstructionHandler - { - - private var _synchronisationFrameInstance:SynchronisationFrame; - - - public function handle(console:ConsoleHandler, cmd:String, args:Array):void - { - var log:Logger; - var size:uint; - var emptySince:uint; - var i:uint; - var s:String; - var managerName:String; - var manager:OptionManager; - var logFile:File; - var entitiesList:Array; - var level:uint; - var monster:Monster; - var val:* = undefined; - var prop:Array; - var name:String; - var p:Object; - var o:* = undefined; - var fsLog:FileStream; - var logContent:ByteArray; - var entity:TiphonSprite; - var tete:DisplayObject; - var oldValue:Number; - var monsterLook:TiphonEntityLook; - var changeCount:uint; - var sceneEntity:IEntity; - switch (cmd) - { - case "log": - log = Log.getLogger(getQualifiedClassName(MiscInstructionHandler)); - LogLogger.activeLog((((args[0] == "true")) || ((args[0] == "on")))); - console.output(("Log set to " + LogLogger.logIsActive())); - return; - case "newdofus": - NativeApplication.nativeApplication.dispatchEvent(new Event(InvokeEvent.INVOKE)); - return; - case "i18nsize": - size = 0; - emptySince = 0; - i = 1; - s = ""; - do - { - s = I18n.getText(i++); - if (s) - { - emptySince = 0; - size = (size + s.length); - } - else - { - emptySince++; - }; - } while (emptySince < 20); - console.output((((size + " characters in ") + (i - 1)) + " entries.")); - return; - case "clear": - KernelEventsManager.getInstance().processCallback(HookList.ConsoleClear); - return; - case "config": - if (!(args[0])) - { - console.output("Syntax : /config [