CombinedText
stringlengths
4
3.42M
package kabam.rotmg.errors.control { import com.company.util.CapabilitiesUtil; import flash.events.ErrorEvent; import kabam.rotmg.account.core.Account; import kabam.rotmg.appengine.api.AppEngineClient; import kabam.rotmg.application.api.ApplicationSetup; public class ReportErrorToAppEngineCommand { public function ReportErrorToAppEngineCommand() { super(); } [Inject] public var account:Account; [Inject] public var client:AppEngineClient; [Inject] public var setup:ApplicationSetup; [Inject] public var event:ErrorEvent; private var error:*; public function execute():void { this.event.preventDefault(); this.error = this.event["error"]; this.getMessage(); var output:Array = []; output.push("Build: " + this.setup.getBuildLabel()); output.push("message: " + this.getMessage()); output.push("stackTrace: " + this.getStackTrace()); output.push(CapabilitiesUtil.getHumanReadable()); this.client.setSendEncrypted(false); this.client.sendRequest("/clientError/add", { "text": output.join("\n"), "guid": this.account.getUserId() }); } private function getMessage():String { if (this.error is Error) { return this.error.message; } if (this.event != null) { return this.event.text; } if (this.error != null) { return this.error.toString(); } return "(empty)"; } private function getStackTrace():String { return this.error is Error ? Error(this.error).getStackTrace() : "(empty)"; } } }
//////////////////////////////////////////////////////////////////////////////// // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License // // No warranty of merchantability or fitness of any kind. // Use this software at your own risk. // //////////////////////////////////////////////////////////////////////////////// package actionScripts.plugin.settings.vo { import mx.core.IVisualElement; public interface ISetting { function get name():String; function get label():String; function get renderer():IVisualElement; function set stringValue(v:String):void; function get stringValue():String; function valueChanged():Boolean; function commitChanges():void; } }
// Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php package mvcexpress.extensions.scoped.core.traceObjects { import flash.display.DisplayObject; import mvcexpress.core.traceObjects.MvcTraceActions; import mvcexpress.core.traceObjects.TraceObj; /** * Class for mvcExpress tracing. (debug mode only) * @author Raimundas Banevicius (http://mvcexpress.org/) * @private * * @version 2.0.rc1 */ public class TraceProxyMap_scopeUnmap extends TraceObj { public var scopeName:String; public var injectClass:Class; public var name:String; public var dependencies:Vector.<Object>; public var view:DisplayObject; public function TraceProxyMap_scopeUnmap(moduleName:String, $scopeName:String, $injectClass:Class, $name:String) { super(MvcTraceActions.PROXYMAP_SCOPEUNMAP, moduleName); scopeName = $scopeName; injectClass = $injectClass; name = $name; } override public function toString():String { return "{$}¶¶¶¶- " + MvcTraceActions.PROXYMAP_SCOPEUNMAP + " > scopeName : " + scopeName + ", injectClass : " + injectClass + ", name : " + name + " {" + moduleName + "}"; } } }
package com.ek.duckstazy.particles { import com.ek.duckstazy.utils.XRandom; import com.ek.library.asset.AssetManager; import com.ek.library.utils.ColorUtil; import com.ek.library.utils.ParserUtil; import com.ek.library.utils.easing.Quadratic; import flash.display.MovieClip; import flash.geom.Point; /** * @author Elias Ku */ public class ParticleStyle implements IParticleStyle { private var _name:String; public var symbol:String; public var acceleration:Point = new Point(); public var accelerationRange:Point = new Point(); public var velocityFriction:Number = 1.0; public var velocityFrictionRange:Number = 0.0; public var rotationFriction:Number = 1.0; public var rotationFrictionRange:Number = 0.0; public var syncScale:Boolean = true; public var startScale:Point = new Point(1.0, 1.0); public var startScaleRange:Point = new Point(0.0, 0.0); public var endScale:Point = new Point(1.0, 1.0); public var endScaleRange:Point = new Point(0.0, 0.0); public var easeScaleX:Function; public var easeScaleY:Function; public var startAlpha:Number = 1.0; public var startAlphaRange:Number = 0.0; public var endAlpha:Number = 1.0; public var endAlphaRange:Number = 0.0; public var easeAlpha:Function; public var startColorRange:Array = new Array(); public var endColorRange:Array = new Array(); public var syncColors:Array = new Array(); public var easeColor:Function; public var lifeSpan:Number = 1.0; public var lifeSpanRange:Number = 0.0; public function ParticleStyle(name:String) { _name = name; } public function getName():String { return _name; } public function createParticle():IParticle { var p:Particle = new Particle(); var mc:MovieClip; var t:Number; p.setStyleName(_name); p.data = this; if(symbol) { mc = AssetManager.getMovieClip(symbol); if(mc) { mc.mouseChildren = false; mc.mouseEnabled = false; mc.stop(); p.content = mc; } /** COLORS **/ if(syncColors) { generateColors(p, XRandom.random(), XRandom.random()); } else { t = XRandom.random(); generateColors(p, t, t); } p.easeColor = easeColor; /** ALPHA **/ p.alpha = startAlpha + startAlphaRange*XRandom.random(); p.alphaDelta = (endAlpha + endAlphaRange*XRandom.random()) - p.alpha; p.alphaEase = easeAlpha; /** ACCELERATION **/ p.ax = acceleration.x + accelerationRange.x * XRandom.random(); p.ay = acceleration.y + accelerationRange.y * XRandom.random(); /** FRICTION **/ p.velocityFriction = velocityFriction + velocityFrictionRange * XRandom.random(); p.rotationFriction = rotationFriction + rotationFrictionRange * XRandom.random(); /** SCALE **/ if(syncScale) { t = XRandom.random(); p.scaleX = startScale.x + startScaleRange.x * t; p.scaleY = startScale.y + startScaleRange.y * t; p.scaleXDelta = (endScale.x + endScaleRange.x * t) - p.scaleX; p.scaleYDelta = (endScale.y + endScaleRange.y * t) - p.scaleY; } else { p.scaleX = startScale.x + startScaleRange.x * XRandom.random(); p.scaleY = startScale.y + startScaleRange.y * XRandom.random(); p.scaleXDelta = (endScale.x + endScaleRange.x * XRandom.random()) - p.scaleX; p.scaleYDelta = (endScale.y + endScaleRange.y * XRandom.random()) - p.scaleY; } p.scaleXEase = easeScaleX; p.scaleYEase = easeScaleY; /** LIFE SPAN **/ p.speed = 1.0 / (lifeSpan + lifeSpanRange * XRandom.random()); } return p; } private function generateColors(particle:Particle, start:Number, end:Number):void { const startColorLength:int = startColorRange.length; const endColorLength:int = endColorRange.length; var position:Number; var index:int; if(startColorLength > 0) { if(startColorLength > 1) { position = start*(startColorLength-1); index = int(position); particle.startColor = ColorUtil.lerpARGB(startColorRange[index], startColorRange[index+1], position-index); } else { particle.startColor = startColorRange[0]; } } else { particle.startColor = 0xffffffff; } if(endColorLength > 0) { if(endColorLength > 1) { position = end*(endColorLength-1); index = int(position); particle.endColor = ColorUtil.lerpARGB(endColorRange[index], endColorRange[index+1], position-index); } else { particle.endColor = endColorRange[0]; } } else { particle.endColor = 0xffffffff; } } public function parseXML(xml:XML):void { var p:Point = new Point(); var node:XML; var node2:XML; if(xml) { node = xml["symbol"][0]; if(node) { if(node.hasOwnProperty("@value")) { symbol = node.@value.toString(); } } node = xml["life-span"][0]; if(node) { if(node.hasOwnProperty("@value")) { lifeSpan = node.@value; } if(node.hasOwnProperty("@range")) { lifeSpanRange = node.@range; } } node = xml["acceleration"][0]; if(node) { if(node.hasOwnProperty("@value")) { ParserUtil.parsePoint(node.@value, "; ", acceleration); } if(node.hasOwnProperty("@range")) { ParserUtil.parsePoint(node.@range, "; ", accelerationRange); } } node = xml["scale"][0]; if(node) { if(node.hasOwnProperty("@sync")) { syncScale = ParserUtil.parseBoolean(node.@sync); } if(node.hasOwnProperty("@easeX")) { easeScaleX = getEaseFunction(node.@easeX); } if(node.hasOwnProperty("@easeY")) { easeScaleY = getEaseFunction(node.@easeY); } if(node.hasOwnProperty("@ease")) { easeScaleX = easeScaleY = getEaseFunction(node.@ease); } node2 = node["start"][0]; if(node2) { if(node2.hasOwnProperty("@value")) { ParserUtil.parsePoint(node2.@value, "; ", startScale); } if(node2.hasOwnProperty("@range")) { ParserUtil.parsePoint(node2.@range, "; ", startScaleRange); } } node2 = node["end"][0]; if(node2) { if(node2.hasOwnProperty("@value")) { ParserUtil.parsePoint(node2.@value, "; ", endScale); } if(node2.hasOwnProperty("@range")) { ParserUtil.parsePoint(node2.@range, "; ", endScaleRange); } } } node = xml["alpha"][0]; if(node) { if(node.hasOwnProperty("@ease")) { easeAlpha = getEaseFunction(node.@ease); } node2 = node["start"][0]; if(node2) { if(node2.hasOwnProperty("@value")) { startAlpha = node2.@value; } if(node2.hasOwnProperty("@range")) { startAlphaRange = node2.@range; } } node2 = node["end"][0]; if(node2) { if(node2.hasOwnProperty("@value")) { endAlpha = node2.@value; } if(node2.hasOwnProperty("@range")) { endAlphaRange = node2.@range; } } } node = xml["colors"][0]; if(node) { if(node.hasOwnProperty("@ease")) { easeColor = getEaseFunction(node.@ease); } node2 = node["start"][0]; if(node2) { if(node2.hasOwnProperty("@range")) { getColorRange(node2.@range, startColorRange); } } node2 = node["end"][0]; if(node2) { if(node2.hasOwnProperty("@range")) { getColorRange(node2.@range, endColorRange); } } } node = xml["friction"][0]; if(node) { node2 = node["velocity"][0]; if(node2) { if(node2.hasOwnProperty("@value")) { velocityFriction = node2.@value; } if(node2.hasOwnProperty("@range")) { velocityFrictionRange = node2.@range; } } node2 = node["rotation"][0]; if(node2) { if(node2.hasOwnProperty("@value")) { rotationFriction = node2.@value; } if(node2.hasOwnProperty("@range")) { rotationFrictionRange = node2.@range; } } } } } private function getEaseFunction(name:String):Function { return null; } private function getColorRange(string:String, out:Array):void { var args:Array = string.split("; "); var arg:String; out.length = 0; for each (arg in args) { out.push(parseInt(arg)); } } } }
package game.utils { import common.GameConstants; import com.utils.Dictionary; /** * ... * @dengcs */ public class TypeFetch{ public static function getCardVal(card:int):int { return Math.ceil(card/4); } public static function get_mode(cards:Vector.<int>):Dictionary { var len:int = cards.length - 1; var mode:Dictionary = new Dictionary(); for(var i:int = len; i >= 0; i--) { var card:int = getCardVal(cards[i]); var data:Array = mode.get(card); if(data == null) { data = new Array(); mode.set(card, data); } data.push(i); } return mode; } private static function loop_fetch(type:int, mode:Dictionary):Object { var retData:Object = null; switch(type) { case GameConstants.POKER_TYPE_3STRAIGHT2: { for(var i32:int=4; i32 >= 2; i32--) { retData = fetch_3straight2(mode, 0, i32); if(retData != null) { break; } } break; } case GameConstants.POKER_TYPE_3STRAIGHT1: { for(var i31:int=5; i31 >= 2; i31--) { retData = fetch_3straight1(mode, 0, i31); if(retData != null) { break; } } break; } case GameConstants.POKER_TYPE_3STRAIGHT: { for(var i3:int=6; i3 >= 2; i3--) { retData = fetch_3straight(mode, 0, i3); if(retData != null) { break; } } break; } case GameConstants.POKER_TYPE_2STRAIGHT: { for(var i2:int=10; i2 >= 3; i2--) { retData = fetch_2straight(mode, 0, i2); if(retData != null) { break; } } break; } case GameConstants.POKER_TYPE_1STRAIGHT: { for(var i:int=20; i >= 5; i--) { retData = fetch_1straight(mode, 0, i); if(retData != null) { break; } } break; } } return retData; } public static function auto_fetch(cards:Vector.<int>):Object { var retData:Object = null; var mode:Dictionary = get_mode(cards); var cardLen:int = cards.length; if(cardLen == 8) { retData = fetch_4with22(mode, 0); }else if(cardLen == 6) { retData = fetch_4with21(mode, 0); }else if(cardLen == 5) { retData = fetch_4with1(mode, 0); }else if(cardLen == 4) { retData = fetch_bomb(mode, 0); }else if(cardLen == 2) { retData = fetch_king(mode); } if(retData == null) { retData = loop_fetch(GameConstants.POKER_TYPE_3STRAIGHT2, mode); if(retData == null) { retData = loop_fetch(GameConstants.POKER_TYPE_3STRAIGHT1, mode); if(retData == null) { retData = loop_fetch(GameConstants.POKER_TYPE_3STRAIGHT, mode); if(retData == null) { retData = loop_fetch(GameConstants.POKER_TYPE_2STRAIGHT, mode); if(retData == null) { retData = loop_fetch(GameConstants.POKER_TYPE_1STRAIGHT, mode); if(retData == null) { retData = fetch_3with2(mode, 0); if(retData == null) { retData = fetch_3with1(mode, 0); if(retData == null) { retData = fetch_three(mode, 0); if(retData == null) { retData = fetch_two(mode, 0); if(retData == null) { retData = fetch_one(mode, cards, 0); if(retData == null) { retData = fetch_bomb(mode, 0); } } } } } } } } } } } return retData; } public static function fetch_type(cards:Vector.<int>, type:int, value:int = 0, count:int = 0):Object { var retData:Object = null; var mode:Dictionary = get_mode(cards); switch(type) { case GameConstants.POKER_TYPE_ONE: { retData = fetch_one(mode, cards, value); break; } case GameConstants.POKER_TYPE_TWO: { retData = fetch_two(mode, value); break; } case GameConstants.POKER_TYPE_THREE: { retData = fetch_three(mode, value); break; } case GameConstants.POKER_TYPE_BOMB: { retData = fetch_bomb(mode, value); if(retData == null) { retData = fetch_king(mode); } return retData; } case GameConstants.POKER_TYPE_KING: { return null; } case GameConstants.POKER_TYPE_1STRAIGHT: { retData = fetch_1straight(mode, value, count); break; } case GameConstants.POKER_TYPE_2STRAIGHT: { retData = fetch_2straight(mode, value, count); break; } case GameConstants.POKER_TYPE_3STRAIGHT: { retData = fetch_3straight(mode, value, count); break; } case GameConstants.POKER_TYPE_3STRAIGHT1: { retData = fetch_3straight1(mode, value, count); break; } case GameConstants.POKER_TYPE_3STRAIGHT2: { retData = fetch_3straight2(mode, value, count); break; } case GameConstants.POKER_TYPE_3WITH1: { retData = fetch_3with1(mode, value); break; } case GameConstants.POKER_TYPE_3WITH2: { retData = fetch_3with2(mode, value); break; } case GameConstants.POKER_TYPE_4WITH1: { retData = fetch_4with1(mode, value); break; } case GameConstants.POKER_TYPE_4WITH21: { retData = fetch_4with21(mode, value); break; } case GameConstants.POKER_TYPE_4WITH22: { retData = fetch_4with22(mode, value); break; } } if(retData == null) { retData = fetch_bomb(mode, 0); } if(retData == null) { retData = fetch_king(mode); } return retData; } public static function fetch_one(mode:Dictionary, cards:Vector.<int>, value:int):Object { var retData:Object = null; var indexes:Array = new Array(); var max_value:int = 0; var firstVal:int = 0; var secondVal:int = 0; var thirdVal:int = 0; for each(var card:int in mode.keys) { var modeVals:Array = mode.get(card); if(card > value) { if(modeVals.length == 1) { if(card < firstVal || firstVal == 0) { firstVal = card; } }else if(modeVals.length == 2) { if(card < secondVal || secondVal == 0) { secondVal = card; } }else if(modeVals.length == 3) { if(card < thirdVal || thirdVal == 0) { thirdVal = card; } } }else if(value == GameConstants.POKER_VALUE_JOKER) { var jokerIdx:int = modeVals[0]; var jokerVal:int = cards[jokerIdx]; // 类型判断时已经把大王的牌值加1了 if(jokerVal == GameConstants.JOKER_BIG_VALUE) { firstVal = card; } } } if(firstVal > 0) { max_value = firstVal; }else if(secondVal > 0) { max_value = secondVal; }else if(thirdVal > 0) { max_value = thirdVal; } if(max_value > 0) { indexes.push(mode.get(max_value)[0]) retData = new Object(); retData.indexes = indexes; retData.max_value = max_value; } return retData; } public static function fetch_two(mode:Dictionary, value:int):Object { var retData:Object = null; var indexes:Array = new Array(); var max_value:int = 0; var firstVal:int = 0; var secondVal:int = 0; for each(var card:int in mode.keys) { var modeVals:Array = mode.get(card); if(card > value) { if(modeVals.length == 2) { if((firstVal == 0 || card < firstVal) && card < GameConstants.POKER_VALUE_JOKER) { firstVal = card; } }else if(modeVals.length == 3) { if(card < secondVal || secondVal == 0) { secondVal = card; } } } } if(firstVal > 0) { max_value = firstVal; }else if(secondVal > 0) { max_value = secondVal; } if(max_value > 0) { indexes.push(mode.get(max_value)[0]); indexes.push(mode.get(max_value)[1]); retData = new Object(); retData.indexes = indexes; retData.max_value = max_value; } return retData; } public static function fetch_three(mode:Dictionary, value:int):Object { var retData:Object = null; var indexes:Array = new Array(); var max_value:int = 0; for each(var card:int in mode.keys) { var modeVals:Array = mode.get(card); if(card > value) { if(modeVals.length == 3) { if(card < max_value || max_value == 0) { max_value = card; } } } } if(max_value > 0) { indexes.push(mode.get(max_value)[0]); indexes.push(mode.get(max_value)[1]); indexes.push(mode.get(max_value)[2]); retData = new Object(); retData.indexes = indexes; retData.max_value = max_value; } return retData; } public static function fetch_bomb(mode:Dictionary, value:int):Object { var retData:Object = null; var indexes:Array = new Array(); var max_value:int = 0; for each(var card:int in mode.keys) { var modeVals:Array = mode.get(card); if(card > value) { if(modeVals.length == 4) { if(card < max_value || max_value == 0) { max_value = card; } } } } if(max_value > 0) { indexes.push(mode.get(max_value)[0]); indexes.push(mode.get(max_value)[1]); indexes.push(mode.get(max_value)[2]); indexes.push(mode.get(max_value)[3]); retData = new Object(); retData.indexes = indexes; retData.max_value = max_value; } return retData; } public static function fetch_king(mode:Dictionary):Object { var retData:Object = null; var indexes:Array = new Array(); var max_value:int = 0; for each(var card:int in mode.keys) { var modeVals:Array = mode.get(card); if(card == GameConstants.POKER_VALUE_JOKER) { if(modeVals.length == 2) { max_value = card; break; } } } if(max_value > 0) { indexes.push(mode.get(max_value)[0]); indexes.push(mode.get(max_value)[1]); retData = new Object(); retData.indexes = indexes; retData.max_value = max_value; } return retData; } public static function fetch_1straight(mode:Dictionary, value:int, count:int):Object { if(count < 5) { return null; } var retData:Object = null; var indexes:Array = new Array(); var max_value:int = 0; var straightCount:int = 0; var first_card:int = mode.keys[0]; for(var i:int = 0; i < mode.keys.length; i++) { var card:int = mode.keys[i]; if(card < GameConstants.POKER_VALUE_2) { if(first_card == card) { straightCount++; }else{ straightCount = 1; } first_card = card + 1; if(straightCount >= count) { if(card > value) { max_value = card; break; } } } } if(max_value > 0) { for(var k:int = count; k>0; k--) { indexes.push(mode.get(max_value - k + 1)[0]) } retData = new Object(); retData.indexes = indexes; retData.max_value = max_value; } return retData; } public static function fetch_2straight(mode:Dictionary, value:int, count:int):Object { if(count < 3) { return null; } var retData:Object = null; var indexes:Array = new Array(); var max_value:int = 0; var straightCount:int = 0; var first_card:int = mode.keys[0]; for(var i:int = 0; i < mode.keys.length; i++) { var card:int = mode.keys[i]; if(card < GameConstants.POKER_VALUE_2) { var length:int = mode.get(card).length; if(length == 2) { if(first_card == card) { straightCount++; }else{ straightCount = 1; } first_card = card + 1; if(straightCount >= count) { if(card > value) { max_value = card; break; } } } } } if(max_value > 0) { var cardVal:int = 0; for(var k:int = count; k>0; k--) { cardVal = max_value - k + 1; indexes.push(mode.get(cardVal)[0]); indexes.push(mode.get(cardVal)[1]); } retData = new Object(); retData.indexes = indexes; retData.max_value = max_value; } return retData; } public static function fetch_3straight(mode:Dictionary, value:int, count:int):Object { if(count < 2) { return null; } var retData:Object = null; var indexes:Array = new Array(); var max_value:int = 0; var straightCount:int = 0; var first_card:int = mode.keys[0]; for(var i:int = 0; i < mode.keys.length; i++) { var card:int = mode.keys[i]; if(card < GameConstants.POKER_VALUE_2) { var length:int = mode.get(card).length; if(length == 3) { if(first_card == card) { straightCount++; }else{ straightCount = 1; } first_card = card + 1; if(straightCount >= count) { if(card > value) { max_value = card; break; } } } } } if(max_value > 0) { var cardVal:int = 0; for(var k:int = count; k>0; k--) { cardVal = max_value - k + 1; indexes.push(mode.get(cardVal)[0]); indexes.push(mode.get(cardVal)[1]); indexes.push(mode.get(cardVal)[2]); } retData = new Object(); retData.indexes = indexes; retData.max_value = max_value; } return retData; } public static function fetch_3straight1(mode:Dictionary, value:int, count:int):Object { if(count < 2) { return null; } var attachMap:Dictionary = new Dictionary(); var attachNum:int = 0; var targetNum:int = 0; for each(var m:int in mode.keys) { var len:int = mode.get(m).length; if(len == 3) { targetNum++; } if(len < 3) { attachMap.set(m, mode.get(m)); attachNum += len } } if(targetNum < count) { return null; } if(attachNum < count) { return null; } var retData:Object = null; var indexes:Array = new Array(); var max_value:int = 0; var straightCount:int = 0; var first_card:int = mode.keys[0]; for each(var card:int in mode.keys) { if(count == 1 || card < GameConstants.POKER_VALUE_2) { var length:int = mode.get(card).length; if(length == 3) { if(first_card == card) { straightCount++; }else{ straightCount = 1; } first_card = card + 1; if(straightCount >= count) { if(card > value) { max_value = card; break; } } } } } if(max_value > 0) { var cardVal:int = 0; for(var k:int = count; k>0; k--) { cardVal = max_value - k + 1; indexes.push(mode.get(cardVal)[0]); indexes.push(mode.get(cardVal)[1]); indexes.push(mode.get(cardVal)[2]); } var attachCount:int = 0; for(var n:int = 1; n < 3; n++) { for each(var a:int in attachMap.keys) { if(attachCount >= count) { break; } if(attachMap.get(a).length == n) { for each(var b:int in attachMap.get(a)) { indexes.push(b); attachCount++; if(attachCount >= count) { break; } } } } } retData = new Object(); retData.indexes = indexes; retData.max_value = max_value; } return retData; } public static function fetch_3straight2(mode:Dictionary, value:int, count:int):Object { if(count < 2) { return null; } var attachMap:Dictionary = new Dictionary(); var attachNum:int = 0; var targetNum:int = 0; for each(var m:int in mode.keys) { var len:int = mode.get(m).length; if(len == 3) { targetNum++; } if(len == 2 && m != GameConstants.POKER_VALUE_JOKER) { attachMap.set(m, mode.get(m)); attachNum++; } } if(targetNum < count) { return null; } if(attachNum < count) { return null; } var retData:Object = null; var indexes:Array = new Array(); var max_value:int = 0; var straightCount:int = 0; var first_card:int = mode.keys[0]; for each(var card:int in mode.keys) { if(count == 1 || card < GameConstants.POKER_VALUE_2) { var length:int = mode.get(card).length; if(length == 3) { if(first_card == card) { straightCount++; }else{ straightCount = 1; } first_card = card + 1; if(straightCount >= count) { if(card > value) { max_value = card; break; } } } } } if(max_value > 0) { var cardVal:int = 0; for(var k:int = count; k>0; k--) { cardVal = max_value - k + 1; indexes.push(mode.get(cardVal)[0]); indexes.push(mode.get(cardVal)[1]); indexes.push(mode.get(cardVal)[2]); attachMap.remove(cardVal); } var attachCount:int = 0; for each(var a:int in attachMap.keys) { indexes.push(attachMap.get(a)[0]); indexes.push(attachMap.get(a)[1]); attachCount++; if(attachCount >= count) { break; } } retData = new Object(); retData.indexes = indexes; retData.max_value = max_value; } return retData; } public static function fetch_3with1(mode:Dictionary, value:int):Object { var attachMap:Dictionary = new Dictionary(); var targetMap:Dictionary = new Dictionary(); var attachNum:int = 0; var targetNum:int = 0; for each(var m:int in mode.keys) { var len:int = mode.get(m).length; if(len == 3) { targetMap.set(m, mode.get(m)); targetNum++; }else { attachMap.set(m, mode.get(m)); attachNum += len; } } if(targetNum < 1) { return null; } if(attachNum < 1) { return null; } var retData:Object = null; var indexes:Array = new Array(); var max_value:int = 0; for each(var card:int in targetMap.keys) { if(card > value) { max_value = card; break; } } if(max_value > 0) { indexes.push(targetMap.get(max_value)[0]); indexes.push(targetMap.get(max_value)[1]); indexes.push(targetMap.get(max_value)[2]); var attachCount:int = 0; for(var n:int = 1; n < 3; n++) { for each(var a:int in attachMap.keys) { if(attachCount > 0) { break; } if(attachMap.get(a).length == n) { for each(var b:int in attachMap.get(a)) { indexes.push(b); attachCount++; break; } } } } retData = new Object(); retData.indexes = indexes; retData.max_value = max_value; } return retData; } public static function fetch_3with2(mode:Dictionary, value:int):Object { var attachMap:Dictionary = new Dictionary(); var targetMap:Dictionary = new Dictionary(); var attachNum:int = 0; var targetNum:int = 0; for each(var m:int in mode.keys) { var len:int = mode.get(m).length; if(len == 3) { targetMap.set(m, mode.get(m)); targetNum++; }else if(len == 2 && m < GameConstants.POKER_VALUE_JOKER) { attachMap.set(m, mode.get(m)); attachNum += len; } } if(targetNum < 1) { return null; } if(attachNum < 1) { return null; } var retData:Object = null; var indexes:Array = new Array(); var max_value:int = 0; for each(var card:int in targetMap.keys) { if(card > value) { max_value = card; break; } } if(max_value > 0) { indexes.push(targetMap.get(max_value)[0]); indexes.push(targetMap.get(max_value)[1]); indexes.push(targetMap.get(max_value)[2]); indexes.push(attachMap.values[0][0]); indexes.push(attachMap.values[0][1]); retData = new Object(); retData.indexes = indexes; retData.max_value = max_value; } return retData; } public static function fetch_4with1(mode:Dictionary, value:int):Object { var attachMap:Dictionary = new Dictionary(); var targetMap:Dictionary = new Dictionary(); var attachNum:int = 0; var targetNum:int = 0; for each(var m:int in mode.keys) { var len:int = mode.get(m).length; if(len == 4) { targetMap.set(m, mode.get(m)); targetNum++; }else { attachMap.set(m, mode.get(m)); attachNum += len; } } if(targetNum < 1) { return null; } if(attachNum < 1) { return null; } var retData:Object = null; var indexes:Array = new Array(); var max_value:int = 0; for each(var card:int in targetMap.keys) { if(card > value) { max_value = card; break; } } if(max_value > 0) { indexes.push(targetMap.get(max_value)[0]); indexes.push(targetMap.get(max_value)[1]); indexes.push(targetMap.get(max_value)[2]); indexes.push(targetMap.get(max_value)[3]); var attachCount:int = 0; for(var n:int = 1; n < 4; n++) { for each(var a:int in attachMap.keys) { if(attachCount > 0) { break; } if(attachMap.get(a).length == n) { for each(var b:int in attachMap.get(a)) { indexes.push(b); attachCount++; break; } } } } retData = new Object(); retData.indexes = indexes; retData.max_value = max_value; } return retData; } public static function fetch_4with21(mode:Dictionary, value:int):Object { var attachMap:Dictionary = new Dictionary(); var targetMap:Dictionary = new Dictionary(); var attachNum:int = 0; var targetNum:int = 0; for each(var m:int in mode.keys) { var len:int = mode.get(m).length; if(len == 4) { targetMap.set(m, mode.get(m)); targetNum++; }else { attachMap.set(m, mode.get(m)); attachNum += len; } } if(targetNum < 1) { return null; } if(attachNum < 2) { return null; } var retData:Object = null; var indexes:Array = new Array(); var max_value:int = 0; for each(var card:int in targetMap.keys) { if(card > value) { max_value = card; break; } } if(max_value > 0) { indexes.push(targetMap.get(max_value)[0]); indexes.push(targetMap.get(max_value)[1]); indexes.push(targetMap.get(max_value)[2]); indexes.push(targetMap.get(max_value)[3]); var attachCount:int = 0; for(var n:int = 1; n < 4; n++) { for each(var a:int in attachMap.keys) { if(attachCount > 1) { break; } if(attachMap.get(a).length == n) { for each(var b:int in attachMap.get(a)) { indexes.push(b); attachCount++; if(attachCount > 1) { break; } } } } } retData = new Object(); retData.indexes = indexes; retData.max_value = max_value; } return retData; } public static function fetch_4with22(mode:Dictionary, value:int):Object { var attachMap:Dictionary = new Dictionary(); var targetMap:Dictionary = new Dictionary(); var attachNum:int = 0; var targetNum:int = 0; for each(var m:int in mode.keys) { var len:int = mode.get(m).length; if(len == 4) { targetMap.set(m, mode.get(m)); targetNum++; }else if(len > 1 && m != GameConstants.POKER_VALUE_JOKER) { attachMap.set(m, mode.get(m)); attachNum++; } } if(targetNum < 1) { return null; } if(attachNum < 2) { return null; } var retData:Object = null; var indexes:Array = new Array(); var max_value:int = 0; for each(var card:int in targetMap.keys) { if(card > value) { max_value = card; break; } } if(max_value > 0) { indexes.push(targetMap.get(max_value)[0]); indexes.push(targetMap.get(max_value)[1]); indexes.push(targetMap.get(max_value)[2]); indexes.push(targetMap.get(max_value)[3]); var attachCount:int = 0; for(var n:int = 2; n < 4; n++) { for each(var a:int in attachMap.keys) { if(attachCount > 1) { break; } if(attachMap.get(a).length == n) { indexes.push(attachMap.get(a)[0]); indexes.push(attachMap.get(a)[1]); attachCount++; if(attachCount > 1) { break; } } } } retData = new Object(); retData.indexes = indexes; retData.max_value = max_value; } return retData; } } }
// Copyright 2017-2018, Earthfiredrake // Released under the terms of the MIT License // https://github.com/Earthfiredrake/SWL-Cartographer // Minimal interface requirements for any notation types // Note: The current design does not permit entirely new notations as most // are expected to fit within one of the existing categories // Custom notations should implement one of the derived interfaces, // or extend an appropriate base class interface efd.Cartographer.inf.INotation { // GUI interaction hooks, to be called by notation gui initialization, prior to loading/rendering // Target will be the gui wrapper clip which is handling mouse events // At the moment Unhook is only used by Icons when the icon clip is being reused with new data // This causes an unhook call, followed by a hook call to the new datasource // Again this occurs before the icon is reloaded (if needed) and any modifier clips are applied // Can therefore be used as a slightly hacky place to get last minute state info before committing to a particular icon set // Would prefer to only do this in cases where that state can change during runtime though // Note: Unhook is not explicitly called when the gui element is destroyed, // Be wary of things which will not automatically clean up (ie: state changes to other objects) // Changes to the target and Signal connections (which use a weak reference system) should be safe public function HookEvents(target:MovieClip):Void; public function UnhookEvents(target:MovieClip):Void; // Data accessors // Annoying that properties can't be defined in interfaces public function GetXmlView():XMLNode; public function GetType():String; public function GetLayer():String; public function GetZoneID():Number; // TODO: Probably unhook this, having problems seeing a use case since collectible colour selection was placed at the Layer level // ... Nope Train paths? Alternate tinting? public function GetPenColour():Number; // Return undefined for layer defined colour public function GetName():String; public function GetNote():String; //TODO: Tooltips Merge Name/Note stuff into a tooltip data object // Gives each notation subtype ability to specify and display relevant data //public function GetTooltipData(); }
/* * Copyright 2009 Marek Brun * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package pl.brun.lib.service { import pl.brun.lib.events.EventPlus; import pl.brun.lib.IDisposable; import pl.brun.lib.Base; import flash.utils.Dictionary; /** * When there's some public property changed from one object in another * (for example AnimatedInertialNumber change some MovieClip 'x' property), * you never can be sure, if there's some other object, that already changing * that property of that object. * The solution in such conflict can be allowing only for the lastest "changer" * do the changing of property. * * Usage: * ObjectEachPropertyOneChangerService.forInstance(mc).setNewChanger(this, 'x'); * ObjectEachPropertyOneChangerService.forInstance(mc).setNewPropertyValue(this, 123, 'x'); * * or: * changeService = ObjectEachPropertyOneChangerService.forInstance(mc) * changeService.setNewChanger(this, 'x'); * changeService.setNewPropertyValue(this, 123, 'x'); * * @author Marek Brun */ public class ObjectEachPropertyOneChangerService extends Base { private static const servicedObjects:Dictionary = new Dictionary(true); private var propertyAndChanger:Dictionary; private var obj:Object; public function ObjectEachPropertyOneChangerService(access:Private, obj:Object) { this.obj = obj if (obj is IDisposable) { IDisposable(obj).addEventListener(EventPlus.BEFORE_DISPOSED, onObj_BeforeDisposed) } propertyAndChanger = new Dictionary(true); } private function onObj_BeforeDisposed(event:EventPlus):void { if (servicedObjects[obj]) delete servicedObjects[obj]; propertyAndChanger = null } public function setNewChanger(changer:Object, property:String):void { propertyAndChanger[property] = changer; } public function setNewPropertyValue(changer:Object, property:String, value:*):Boolean { if (propertyAndChanger[property] == changer) { obj[property] = value; return true; } return false; } public static function forInstance(obj:Object):ObjectEachPropertyOneChangerService { if (servicedObjects[obj]) { return servicedObjects[obj]; } servicedObjects[obj] = new ObjectEachPropertyOneChangerService(null, obj); return servicedObjects[obj]; } } } internal class Private { }
//////////////////////////////////////////////////////////////////////////////// // // Licensed to the Apache Software Foundation (ASF) under one or more // contributor license agreements. See the NOTICE file distributed with // this work for additional information regarding copyright ownership. // The ASF licenses this file to You under the Apache License, Version 2.0 // (the "License"); you may not use this file except in compliance with // the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // //////////////////////////////////////////////////////////////////////////////// package org.apache.royale.binding { import org.apache.royale.core.IBead; import org.apache.royale.core.IStrand; import org.apache.royale.events.Event; import org.apache.royale.events.IEventDispatcher; import org.apache.royale.core.IBinding; /** * The DataBindingBase class is the base class for custom data binding * implementations that can be cross-compiled. * * @langversion 3.0 * @playerversion Flash 10.2 * @playerversion AIR 2.6 * @productversion Royale 0.0 */ public class DataBindingBase implements IBead { /** * Constructor. * * @langversion 3.0 * @playerversion Flash 10.2 * @playerversion AIR 2.6 * @productversion Royale 0.0 */ public function DataBindingBase() { } protected var _strand:IStrand; protected var deferredBindings:Object; protected var initEventType:String = "initBindings"; private var _initialized:Boolean; /** * This method is a way to manually initialize the binding support at an earlier time than would * happen by default ( this is usually the timing of 'initBindings' but could vary according to the * timing of whatever initTypeEvent is for a particular sub-class) * This can be useful in some cases when porting legacy code that expects bindings to be active * at a certain alternate time, e.g. before mxml content is created and assigned, for example. * * This method will be dead-code-eliminated in js-release builds if not used in an application's code * * @royalesuppressexport */ public function initializeNow():void{ if (!_initialized) { IEventDispatcher(_strand).removeEventListener(initEventType, processBindings); processBindings(null); } } /** * @copy org.apache.royale.core.IBead#strand * * @langversion 3.0 * @playerversion Flash 10.2 * @playerversion AIR 2.6 * @productversion Royale 0.0 * @royaleignorecoercion org.apache.royale.events.IEventDispatcher */ public function set strand(value:IStrand):void { _strand = value; if (!_initialized) IEventDispatcher(_strand).addEventListener(initEventType, processBindings); } private var _ancestry:Array; protected function processBindings(event:Event):void{ if (!("_bindings" in _strand) || _initialized) return; _initialized = true; var bindingData:Array = _strand["_bindings"]; var first:int = 0; if (bindingData[0] is Array) { _ancestry = []; //process ancestor bindings processAncestors(bindingData[0] as Array, _ancestry); first = 1; } processBindingData(bindingData, first); } /** * * @param array the binding data to process * @param strongRefs, an array to push the ancestry items into, stored in the 'parent' DataBindingBase as a private var * * @royaleignorecoercion org.apache.royale.binding.DataBindingBase * @royaleignorecoercion Class */ private function processAncestors(array:Array, strongRefs:Array):void{ var first:int = 0; var inst:DataBindingBase; var bindingClass:Class = Object(this).constructor as Class; if (array[0] is Array) { //recurse into any more distant ancestors inst = new bindingClass() as DataBindingBase; inst._strand = _strand; strongRefs.push(inst); inst.processAncestors(array[0] as Array, strongRefs); first = 1; } inst = new bindingClass() as DataBindingBase; inst._strand = _strand; strongRefs.push(inst); inst.processBindingData(array, first) } protected function processBindingData(array:Array, first:int):void{ } /** * @royaleemitcoercion org.apache.royale.core.IStrand * @royaleignorecoercion org.apache.royale.core.IBead * @royaleignorecoercion org.apache.royale.events.IEventDispatcher */ protected function prepareCreatedBinding(binding:IBinding, bindingObject:Object, destinationObject:Object = null):void { if (!destinationObject) { if (bindingObject.destination[0] == 'this') destinationObject = _strand else destinationObject = _strand[bindingObject.destination[0]]; } var destination:IStrand = destinationObject as IStrand; if (destination) { destination.addBead(binding as IBead); } else { if (destinationObject) { binding.destination = destinationObject; _strand.addBead(binding as IBead); } else { if (!deferredBindings) { deferredBindings = {}; IEventDispatcher(_strand).addEventListener("valueChange", deferredBindingsHandler); } deferredBindings[bindingObject.destination[0]] = binding; } } } private function watcherChildrenRelevantToIndex(children:Object, index:int):Boolean{ var watchers:Array = children ? children.watchers : null; var hasValidWatcherChild:Boolean = false; if (watchers) { var l:uint = watchers.length; while (l--) { var watcher:Object = watchers[l]; if (typeof(watcher.bindings) == "number") { hasValidWatcherChild = (watcher.bindings == index); } else { hasValidWatcherChild = (watcher.bindings.indexOf(index) != -1); } if (!hasValidWatcherChild && watcher.children){ hasValidWatcherChild = watcherChildrenRelevantToIndex(watcher.children, index); } if (hasValidWatcherChild) break; } } return hasValidWatcherChild; } /** * @royaleignorecoercion Function * @royaleignorecoercion String */ protected function setupWatchers(gb:GenericBinding, index:int, watchers:Array, parentWatcher:WatcherBase):void { var foundWatcher:Boolean = false; var n:int = watchers.length; for (var i:int = 0; i < n; i++) { var watcher:Object = watchers[i]; var isValidWatcher:Boolean = false; if (typeof(watcher.bindings) == "number") { isValidWatcher = (watcher.bindings == index); } else { isValidWatcher = (watcher.bindings.indexOf(index) != -1); } if (isValidWatcher) { var hasWatcherChildren:Boolean = watcherChildrenRelevantToIndex(watcher.children, index); var type:String = watcher.type as String; var parentObj:Object = _strand; var processWatcher:Boolean = false; var pw:PropertyWatcher; switch (type) { case "static": { parentObj = watcher.parentObj; gb.staticRoot = parentObj; gb.isStatic = true; break; } case "property": { var getterFunction:Function = watcher.getterFunction; if (typeof(gb.source) === "function" && !hasWatcherChildren) { getterFunction = gb.source as Function; } pw = new PropertyWatcher(_strand, watcher.propertyName, watcher.eventNames, getterFunction); processWatcher = true; break; } case 'function': { pw = new PropertyWatcher(_strand, watcher.propertyName, watcher.eventNames, null); pw.funcProps = {}; pw.funcProps.functionName = watcher.functionName; pw.funcProps.paramFunction = watcher.paramFunction; processWatcher = true; break; } } if (processWatcher) { foundWatcher = true; watcher.watcher = pw; if (parentWatcher) { pw.parentChanged(parentWatcher.value); } else { pw.parentChanged(parentObj); } if (parentWatcher) { parentWatcher.addChild(pw); } if (!hasWatcherChildren || watcherChildIsXML(watcher)) { pw.addBinding(gb); } } if (hasWatcherChildren) { setupWatchers(gb, index, watcher.children.watchers, watcher.watcher); } } } if (!foundWatcher) { // might be a binding to a function that doesn't have change events // so just force an update via parentWatcher (if it is set, null if not) if (parentWatcher) { gb.valueChanged(parentWatcher.value, true); } else { gb.valueChanged(null, true); } } } private function watcherChildIsXML(watcher:Object):Boolean { return (watcher.children.watchers.length == 1 && watcher.children.watchers[0].type == "xml"); } protected function decodeWatcher(bindingData:Array):Object { var watcherMap:Object = {}; var watchers:Array = []; var n:int = bindingData.length; var index:int = 0; var watcherData:Object; while (index < n - 1) { var watcherIndex:int = bindingData[index++]; var type:int = bindingData[index++]; switch (type) { case 0: { watcherData = { type: "function" }; watcherData.functionName = bindingData[index++]; watcherData.paramFunction = bindingData[index++]; watcherData.eventNames = bindingData[index++]; watcherData.bindings = bindingData[index++]; break; } case 1: { watcherData = { type: "static" }; watcherData.propertyName = bindingData[index++]; watcherData.eventNames = bindingData[index++]; watcherData.bindings = bindingData[index++]; watcherData.getterFunction = bindingData[index++]; watcherData.parentObj = bindingData[index++]; watcherMap[watcherData.propertyName] = watcherData; break; } case 2: { watcherData = { type: "property" }; watcherData.propertyName = bindingData[index++]; watcherData.eventNames = bindingData[index++]; watcherData.bindings = bindingData[index++]; watcherData.getterFunction = bindingData[index++]; watcherMap[watcherData.propertyName] = watcherData; break; } case 3: { watcherData = { type: "xml" }; watcherData.propertyName = bindingData[index++]; watcherData.bindings = bindingData[index++]; watcherMap[watcherData.propertyName] = watcherData; break; } } watcherData.children = bindingData[index++]; if (watcherData.children != null) { watcherData.children = decodeWatcher(watcherData.children); } watcherData.index = watcherIndex; watchers.push(watcherData); } return { watchers: watchers, watcherMap: watcherMap }; } /** * @royaleignorecoercion org.apache.royale.core.IBinding */ protected function makeConstantBinding(binding:Object):void { var cb:ConstantBinding = new ConstantBinding(); cb.destinationPropertyName = binding.destination[1]; if (binding.source is String) { cb.sourcePropertyName = binding.source; } else { cb.sourceID = binding.source[0]; cb.sourcePropertyName = binding.source[1]; } cb.setDocument(_strand); prepareCreatedBinding(cb as IBinding, binding); } protected function makeGenericBinding(binding:Object, index:int, watchers:Object):void { var gb:GenericBinding = new GenericBinding(); gb.setDocument(_strand); gb.destinationData = binding.destination; gb.destinationFunction = binding.destFunc; gb.source = binding.source; if (watchers.watchers.length) { setupWatchers(gb, index, watchers.watchers, null); } else { // should be a constant expression. // the value doesn't matter as GenericBinding // should get the value from the source gb.valueChanged(null, true); } } /** */ private function deferredBindingsHandler(event:Event):void { for (var p:String in deferredBindings) { if (_strand[p] != null) { var destination:IStrand = _strand[p] as IStrand; if (destination) { destination.addBead(deferredBindings[p]); } else { var destObject:Object = _strand[p]; if (destObject) { deferredBindings[p].destination = destObject; _strand.addBead(deferredBindings[p]); } else { trace("unexpected condition in deferredBindingsHandler"); } } delete deferredBindings[p]; } } } } }
package eldhelm.util { /** * ... * @author Andrey Glavchev */ public class CallTimer { private static var timer:EldTimer = new EldTimer; //[Inline] public static function callOnFrame(frame:int, callback:Function, params:Array = null):void { timer.callOnFrame(frame, callback, params); } //[Inline] public static function callEveryFrame(callback:Function, params:Array = null):void { timer.callEveryFrame(callback, params); } //[Inline] public static function callOnInterval(seconds:Number, callback:Function, params:Array = null):int { return timer.callOnInterval(seconds, callback, params); } //[Inline] public static function remove(func:Function):void { timer.remove(func); } //[Inline] public static function invalidateFrame():void { timer.invalidateFrame(); } //[Inline] public static function enable():void { timer.enable(); } //[Inline] public static function disable():void { timer.disable(); } //[Inline] public static function pause():void { timer.pause(); } //[Inline] public static function resume():void { timer.resume(); } //[Inline] public static function removeAllPaused():void { timer.removeAllPaused(); } //[Inline] public static function removeAll():void { timer.removeAll(); } //[Inline] public static function get currentTick():int { return timer.currentTick; } } }
private function main_showOutlinerDrawer():void { miscComponentsContainer.removeChild(outlinerWrapper); _drawer.panel = outlinerWrapper; } private var _drawer:DrawerContainer = null; public function main_openDrawer():void { if(_drawer) return; _drawer = new DrawerContainer(); _drawer.percentHeight = 95; _drawer.width = 0; main_changeWinWidth(main_curWidth() + _drawer.availableWidth); wideContainer.addChild(_drawer); main_showOutlinerDrawer(); var timer:Timer = new Timer(100, 1); timer.addEventListener(TimerEvent.TIMER, main_revealDrawer); timer.start(); } private function main_revealDrawer(event:TimerEvent):void { var resize:Resize = new Resize(_drawer); resize.widthFrom = 0; resize.widthTo = main_curContainerWidth() - main_curWidth(); resize.play(); } private function main_onAppMoved(event:NativeWindowBoundsEvent):void { if(_drawer) { var availableWidth:int = _drawer.availableWidth; if(-1 < availableWidth) { main_changeWinWidth(main_curWidth() + availableWidth); _drawer.width = availableWidth; } } // _drawer.adjustPlacement(event.afterBounds); }
/** * Created by max.rozdobudko@gmail.com on 25.11.2019. */ package screens.issue3 { import feathersx.mvvc.NavigationController; import feathersx.mvvc.ViewController; import starling.animation.Transitions; import utils.Tweens; public class MainController extends NavigationController { { ViewController.dismissTransition = function dismissTransition(presenting: ViewController, presented: ViewController, complete: Function): void { Tweens.shared.tweenWithEase(presented.view, 0.4, {alpha: 0.0}, Transitions.EASE_IN, complete); }; } public function MainController(rootViewController: ViewController) { super(rootViewController); } } }
package kabam.rotmg.game.view { import com.company.assembleegameclient.game.GameSprite; import com.company.assembleegameclient.ui.panels.Panel; import flash.filters.DropShadowFilter; import kabam.rotmg.text.view.TextFieldDisplayConcrete; import kabam.rotmg.text.view.stringBuilder.LineBuilder; public class TextPanel extends Panel { public function TextPanel(param1:GameSprite) { super(param1); this.initTextfield(); } private var textField:TextFieldDisplayConcrete; private var virtualWidth:Number; private var virtualHeight:Number; public function init(param1:String):void { this.textField.setStringBuilder(new LineBuilder().setParams(param1)); this.textField.setAutoSize("center").setVerticalAlign("middle"); this.textField.x = 94; this.textField.y = 42; } private function initTextfield():void { this.textField = new TextFieldDisplayConcrete().setSize(16).setColor(16777215); this.textField.setBold(true); this.textField.setStringBuilder(new LineBuilder().setParams("TextPanel.giftChestIsEmpty")); this.textField.filters = [new DropShadowFilter(0, 0, 0)]; addChild(this.textField); } } }
package view.image.common { import flash.display.*; import flash.events.Event; import flash.events.MouseEvent; import mx.core.UIComponent; import view.image.BaseLoadImage; /** * WeaponCardImage表示クラス * */ public class WeaponCardImage extends BaseLoadImage { private static const URL:String = "/public/image/card_weapon/"; private var _frame:int; /** * コンストラクタ * */ public function WeaponCardImage(url:String, frame:int = 0) { _frame = frame; // log.writeLog(log.LV_INFO, this, "url", URL+url); super(URL+url); } public override function init():void { // log.writeLog(log.LV_INFO, this, "item part frame", _frame); _root.gotoAndStop(_frame); _root.cacheAsBitmap = true; } // public function mouseOff():void // { // waitComplete(mouseEnabledAllOff); // } // private function mouseEnabledAllOff():void // { // _loader.mouseChildren = false; // _loader.mouseEnabled = false; // _root.enabled = false; // _root.mouseEnabled = false; // _root.mouseChildren = false; // } } }
//////////////////////////////////////////////////////////////////////////////// // // Licensed to the Apache Software Foundation (ASF) under one or more // contributor license agreements. See the NOTICE file distributed with // this work for additional information regarding copyright ownership. // The ASF licenses this file to You under the Apache License, Version 2.0 // (the "License"); you may not use this file except in compliance with // the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // //////////////////////////////////////////////////////////////////////////////// import mx.controls.Alert; import mx.controls.Button; import mx.containers.Panel; import mx.graphics.SolidColor; import spark.primitives.*; import spark.effects.Animate; import spark.effects.animation.SimpleMotionPath; import spark.effects.animation.MotionPath; import mx.controls.Alert; import mx.geom.TransformOffsets; import spark.components.Button; import spark.components.Group; import spark.components.DataGroup; import mx.flash.UIMovieClip; import comps.*; /* * Returns true if two numbers are basically equal within the threshold */ public function roughlyEqual(number1:Number, number2:Number, threshold:Number = 0.001):Boolean { // TODO: This method hasn't been tested at all yet. if (Math.abs(number1 - number2) < threshold) return true; return false; } /* * This method is an alternative to using AssertError in Mustella. * * You should use the Mustella's AssertError when it works for you, * but if it fails to catch RTEs then use this method as a fallback * as it seems to catch more errors. * * There are some RTEs that either method won't catch depending * on when they are thrown in the component life cycle. * * Usage: * * You can define an inline function like this: * <AssertMethodValue method="value=application.assertError(function():void { *CODE_THAT_THROWS_ERROR* })" value="Error: Some Error" /> * or, pass in the name of a function you have already written: * <AssertMethodValue method="value=application.assertError(myErrorThrowingFunctionName)" value="Error: Some Error" /> */ public function assertError(func:Function):String { try { func.call(); } catch (e:Error) { return e.toString(); } return "no error"; } /* * Returns a Halo Button */ public function createHaloButton(str:String = 'halo button', width:int = 80, height:int = 20):mx.controls.Button { var myButton:mx.controls.Button = new mx.controls.Button(); myButton.label = str; myButton.width = width; myButton.height = height; return myButton; } /* * Returns a Spark Button */ public function createSparkButton(str:String, width:int = 80, height:int = 20):spark.components.Button { var myButton:spark.components.Button = new spark.components.Button(); myButton.label = str; myButton.width = width; myButton.height = height; return myButton; } /* * Returns a Group with a "stretch" Rect in it */ public function createGroup(width:int = 50, height:int = 50, color:int = 0x000055):Group { var myGroup:Group = new Group(); myGroup.width = width; myGroup.height = height; var myRect:Rect = new Rect(); myRect.top = 0; myRect.left = 0; myRect.right = 0; myRect.bottom = 0; var myFill:SolidColor = new SolidColor(); myFill.color = color; myRect.fill = myFill; myGroup.addElement(myRect); return myGroup; } /* * Returns a halo Panel */ public function createPanel(title:String = "halo panel", width:int = 50, height:int = 50):mx.containers.Panel { var myPanel:mx.containers.Panel = new mx.containers.Panel(); myPanel.title = title; myPanel.width = width; myPanel.height = height; return myPanel; } /* * Animate target.property from start to end values */ public function animateProperty(target:Object, property:String, start:*, end:*, duration:Number = 1000):void { var anim:Animate = new Animate(); anim.motionPaths = new Vector.<MotionPath>(); anim.duration = duration; anim.motionPaths.push(new SimpleMotionPath(property, start, end)); anim.play([target]); } /* * Transform a UIMovieClip */ public function transformClip(myClip:UIMovieClip):void { var newMatrix:Matrix = myClip.transform.matrix; newMatrix.rotate(45 * (Math.PI / 180)); myClip.transform.matrix = newMatrix; }
package System.Diagnostics { /** * Provides a set of methods and properties that help debug your code. */ public class Debug { // Fields //--------------------------------------------- /** * Prefixes all logged lines with a string. The prefix will be written within wrapping brackets. * @example This value may be set so callers can be identified within the log file. * A sensible value would be your project's name, for example "Immersive Logging". * The log line would be written as `[Immersive Logging] Hello World!`. * By default, a log line will be written as `[Library] Hello World!`. */ public static var Prefix:String = "Library"; /** * Enables or disables logging. */ public static var Enabled:Boolean = true; // Methods //--------------------------------------------- /** * Writes information about the debug to the `F4SE.log` file. * The F4SE log files will be written to `...\<Documents>\My Games\Fallout4\F4SE\`. * Logging from Scaleform must be enabled by adding bEnableGFXLog=1 to the [Interface] section of your F4SE.ini. * Create the file `Fallout 4\Data\F4SE\F4SE.ini` if it does not exist. * @param prefix - Prefixes the log line with a string. The prefix will be written within wrapping brackets. * If no `line` parameter is given, the `prefix` parameter will behave as `line` does. * @param line - The log line to write. The `line` parameter will be written as-is. * @param rest - Any number of additional parameters may also be provided. Each additional parameter will * be converted to String and appended to the log line. The `rest` parameters will be written as-is. * @see https://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/package.html#trace() * @see https://www.creationkit.com/fallout4/index.php?title=Category:F4SE#Logging */ public static function WriteLine(prefix:Object, line:Object="", ... rest):void { if (!Enabled) { return; } if (rest != null) { for (var index:uint = 0; index < rest.length; index++) { line += " "+rest[index]; } } if (Prefix != null) { trace("["+Prefix+"]"+prefix+" "+line); } else { trace(prefix+" "+line); } } } }
/* * HumboldtJSDOM * http://humboldtjs.com/ * * Copyright (c) 2012 Daniël Haveman * Licensed under the MIT license * http://humboldtjs.com/license.html */ package dom.domobjects { /** * http://www.whatwg.org/specs/web-apps/current-work/#2dcontext */ public class CanvasRenderingContext2D { public var globalAlpha:Number = 1.0; public var globalCompositeOperation:String = "source-over"; public var strokeStyle:*; public var fillStyle:*; /** * Line width (default is 1) */ public var lineWidth:Number = 1.0; /** * Must be one of "butt", "round", "square" (default is "butt") */ public var lineCap:String = "butt"; /** * Must be one of "round", "bevel", "miter" (default is "miter") */ public var lineJoin:String = "miter"; /** * Limit of the miter length (default is 10) */ public var miterLimit:Number = 10; public var shadowOffsetX:Number = 0; public var shadowOffsetY:Number = 0; public var shadowBlur:Number = 0; /** * Font definition string (default "10px sans-serif") */ public var font:String = "10px sans-serif"; /** * Must be one of "start", "end", "left", "right", "center" (default is "start") */ public var textAlign:String = "start"; /** * Must be one of "top", "hanging", "middle", "alphabetic", "ideographic", "bottom" (default is "alphabetic") */ public var textBaseline:String = "alphabetic"; /** * Color to use for the shadow (default transparent black) */ public var shadowColor:String = ""; public function get canvas():HTMLCanvasElement { return null; } public function CanvasRenderingContext2D() {} /** * Save the current transformation matrix */ public function save():void {} /** * Restore the previously saved transformation matrix */ public function restore():void {} /** * Scale the transformation matrix * * @param x The amount to scale the matrix in the horizontal direction * @param y The amount to scale the matrix in the vertical direction */ public function scale(x:Number, y:Number):void {} /** * Rotate the transformation matrix * * @param angle The angle to rotate the matrix */ public function rotate(angle:Number):void {} /** * Translate the transformation matrix * * @param x The amount to translate the matrix in the horizontal direction * @param y The amount to translate the matrix in the vertical direction */ public function translate(x:Number, y:Number):void {} /** * Transform the transformation matrix * * @param a * @param b * @param c * @param d * @param e * @param f */ public function transform(a:Number, b:Number, c:Number, d:Number, e:Number, f:Number):void {} /** * Set the transformation matrix to the given transform * * @param a * @param b * @param c * @param d * @param e * @param f */ public function setTransform(a:Number, b:Number, c:Number, d:Number, e:Number, f:Number):void {} /** * Create a linear gradient between two points * * @param x0 The x position of the start point of the gradient * @param y0 The y position of the start point of the gradient * @param x1 The x position of the end point of the gradient * @param y1 The y position of the end point of the gradient */ public function createLinearGradient(x0:Number, y0:Number, x1:Number, y1:Number):CanvasGradient { return null; } /** * Create a linear gradient between two points * * @param x0 The x position of the start point of the gradient * @param y0 The y position of the start point of the gradient * @param r0 The radius of the start point of the gradient * @param x1 The x position of the end point of the gradient * @param y1 The y position of the end point of the gradient * @param r1 The radius of the end point of the gradient */ public function createRadialGradient(x0:Number, y0:Number, r0:Number, x1:Number, y1:Number, r1:Number):CanvasGradient { return null; } /** * Create a pattern * * @param image An image to use as a pattern. Must be either an HTMLImageElement, HTMLCanvasElement or HTMLVideoElement * @param repetition A string indicating how this pattern should be repeated */ public function createPattern(image:HTMLElement, repetition:String):CanvasPattern { return null; } /** * Clear an area of the image * * @param x The x position of the rectangle to be cleared * @param y The y position of the rectangle to be cleared * @param w The width of the rectangle to be cleared * @param h The height of the rectangle to be cleared */ public function clearRect(x:Number, y:Number, w:Number, h:Number):void {} /** * Fill an area of the image * * @param x The x position of the rectangle to be filled * @param y The y position of the rectangle to be filled * @param w The width of the rectangle to be filled * @param h The height of the rectangle to be filled */ public function fillRect(x:Number, y:Number, w:Number, h:Number):void {} /** * Stroke an area of the image * * @param x The x position of the rectangle to be stroked * @param y The y position of the rectangle to be stroked * @param w The width of the rectangle to be stroked * @param h The height of the rectangle to be stroked */ public function strokeRect(x:Number, y:Number, w:Number, h:Number):void {} public function beginPath():void {} public function closePath():void {} public function moveTo(x:Number, y:Number):void {} public function lineTo(x:Number, y:Number):void {} public function quadraticCurveTo(cpx:Number, cpy:Number, x:Number, y:Number):void {} public function bezierCurveTo(cp1x:Number, cp1y:Number, cp2x:Number, cp2y:Number, x:Number, y:Number):void {} public function arcTo(x1:Number, y1:Number, x2:Number, y2:Number, radius:Number):void {} public function rect(x:Number, y:Number, w:Number, h:Number):void {} public function arc(x:Number, y:Number, radius:Number, startAngle:Number, endAngle:Number, anticlockwise:Boolean = false):void {} public function fill():void {} public function stroke():void {} public function clip():void {} public function isPointInPath(x:Number, y:Number):Boolean { return false; } public function drawFocusRing(element:HTMLElement, xCaret:Number, yCaret:Number, canDrawCustom:Boolean = false):Boolean { return false; } public function fillText(text:String, x:Number, y:Number, maxWidth:Number = 0):void {} public function strokeText(text:String, x:Number, y:Number, maxWidth:Number = 0):void {} public function measureText(text:String):TextMetrics { return null; } /** * @param image Must be HTMLImageElement, HTMLCanvasElement or HTMLVideoElement * @param x2 If defined then all parameters become required * @param y2 If defined then all parameters become required * @param w2 If defined then all parameters become required * @param h2 If defined then all parameters become required */ public function drawImage(image:HTMLElement, x1:Number, y1:Number, w1:Number = 0, h1:Number = 0, x2:Number = 0, y2:Number = 0, w2:Number = 0, h2:Number = 0):void {} /** * Create a new ImageData. Has two forms: * * Either: * @param sw The width of the ImageData * @param sh The height of the ImageData * * Or: * @param image The ImageData to clone */ public function createImageData(...rest):ImageData { return null; } public function getImageData(x:Number, y:Number, w:Number, h:Number):ImageData { return null; } public function putImageData(image:ImageData, x:Number, y:Number, dirtyX:Number = 0, dirtyY:Number = 0, dirtyWidth:Number = 0, dirtyHeight:Number = 0):void {} } }
package com.mapfile.vo { /** * 地图信息类 * @author 王明凡 */ public class MapVO { //地图信息 public var info:MInfoVO; //序列化文件路径 public var serializablePath:String; //地图文件路径 public var mapPath:String; //路点数组(RoadVO) public var roadArr:Array; //场景对象索引(自动递增,唯一索引,ID同步) public var objectIndex:int; //objects显示对象集合(Objects) public var objectsArr:Array; //swf的Loader对象集合 public var SWFLoaderArr:Array; //swf的Byte字节数组集合(打开场景时候,需要将map文件原有的swf字节数组写入当前编辑状态) public var SWFByteArr:Array; /** * 地图信息以及材质对象垃圾清理 */ public function clear():void { info=null; clearRoadArr(); clearObjectsArr(); //这两个数组已经被清理过了 SWFLoaderArr=null; SWFByteArr=null; } /** * 清理路点数组 */ public function clearRoadArr():void { if(roadArr) { for(var y:int=0;y<roadArr.length;y++) { for(var x:int=0;x<roadArr[0].length;x++) { var oj:Object=roadArr[y][x]; oj.index=null; oj.point=null; if(oj.shape) oj.shape.graphics.clear(); oj.shape=null; oj=null; } } var len:int=roadArr.length; for(var y2:int=0;y2<len;y2++) { var xRoadArr:Array=roadArr[0] as Array; xRoadArr.splice(0,xRoadArr.length); xRoadArr=null; roadArr.splice(0,1); } } roadArr=null; } /** * 清理objects显示对象集合 */ public function clearObjectsArr():void { if(objectsArr) { var len:int=objectsArr.length; for(var i:int=0;i<len;i++) { var oj:Object=objectsArr[0]; oj.clear(); oj=null; objectsArr.splice(0,1); } } objectsArr=null; } } }
package brfv4.utils { import flash.geom.Point; public class BRFv4PointUtils { public static function setPoint(v : Vector.<Number>, i : int, p : Point) : void { p.x = v[i * 2]; p.y = v[i * 2 + 1]; } public static function applyMovementVector(p : Point, p0 : Point, pmv : Point, f : Number) : void { p.x = p0.x + pmv.x * f; p.y = p0.y + pmv.y * f; } public static function interpolatePoint(p : Point, p0 : Point, p1 : Point, f : Number) : void { p.x = p0.x + f * (p1.x - p0.x); p.y = p0.y + f * (p1.y - p0.y); } public static function getAveragePoint(p : Point, ar : Vector.<Point>) : void { p.x = 0.0; p.y = 0.0; for(var i : int = 0, l : int = ar.length; i < l; i++) { p.x += ar[i].x; p.y += ar[i].y; } p.x /= l; p.y /= l; } public static function calcMovementVector(p : Point, p0 : Point, p1 : Point, f : Number) : void { p.x = f * (p1.x - p0.x); p.y = f * (p1.y - p0.y); } public static function calcMovementVectorOrthogonalCW(p : Point, p0 : Point, p1 : Point, f : Number) : void { BRFv4PointUtils.calcMovementVector(p, p0, p1, f); var x : Number = p.x; var y : Number = p.y; p.x = -y; p.y = x; } public static function calcMovementVectorOrthogonalCCW(p : Point, p0 : Point, p1 : Point, f : Number) : void { BRFv4PointUtils.calcMovementVector(p, p0, p1, f); var x : Number = p.x; var y : Number = p.y; p.x = y; p.y = -x; } public static function calcIntersectionPoint(p : Point, pk0 : Point, pk1 : Point, pg0 : Point, pg1 : Point) : void { //y1 = m1 * x1 + t1 ... y2 = m2 * x2 + t1 //m1 * x + t1 = m2 * x + t2 //m1 * x - m2 * x = (t2 - t1) //x * (m1 - m2) = (t2 - t1) var dx1 : Number = (pk1.x - pk0.x); if(dx1 == 0) dx1 = 0.01; var dy1 : Number = (pk1.y - pk0.y); if(dy1 == 0) dy1 = 0.01; var dx2 : Number = (pg1.x - pg0.x); if(dx2 == 0) dx2 = 0.01; var dy2 : Number = (pg1.y - pg0.y); if(dy2 == 0) dy2 = 0.01; var m1 : Number = dy1 / dx1; var t1 : Number = pk1.y - m1 * pk1.x; var m2 : Number = dy2 / dx2; var t2 : Number = pg1.y - m2 * pg1.x; var m1m2 : Number = (m1 - m2); if(m1m2 == 0) m1m2 = 0.01; var t2t1 : Number = (t2 - t1); if(t2t1 == 0) t2t1 = 0.01; var px : Number = t2t1 / m1m2; var py : Number = m1 * px + t1; p.x = px; p.y = py; } public static function calcDistance(p0 : Point, p1 : Point) : Number { return Math.sqrt( (p1.x - p0.x) * (p1.x - p0.x) + (p1.y - p0.y) * (p1.y - p0.y)); } public static function calcAngle(p0 : Point, p1 : Point) : Number { return Math.atan2((p1.y - p0.y), (p1.x - p0.x)); } public static function toDegree(x : Number) : Number { return x * 180.0 / Math.PI; } public static function toRadian(x : Number) : Number { return x * Math.PI / 180.0; } } }
package com.rails2u.layout { public class LayoutError extends Error { public function LayoutError(s:String = '', id:int = 0) { super(s, id); } } }
UIElement@ browserWindow; Window@ browserFilterWindow; ListView@ browserDirList; ListView@ browserFileList; LineEdit@ browserSearch; BrowserFile@ browserDragFile; Node@ browserDragNode; Component@ browserDragComponent; View3D@ resourceBrowserPreview; Scene@ resourcePreviewScene; Node@ resourcePreviewNode; Node@ resourcePreviewCameraNode; Node@ resourcePreviewLightNode; Light@ resourcePreviewLight; int browserSearchSortMode = 0; BrowserDir@ rootDir; Array<BrowserFile@> browserFiles; Dictionary browserDirs; Array<int> activeResourceTypeFilters; Array<int> activeResourceDirFilters; Array<BrowserFile@> browserFilesToScan; const uint BROWSER_WORKER_ITEMS_PER_TICK = 10; const uint BROWSER_SEARCH_LIMIT = 50; const int BROWSER_SORT_MODE_ALPHA = 1; const int BROWSER_SORT_MODE_SEARCH = 2; const int RESOURCE_TYPE_UNUSABLE = -2; const int RESOURCE_TYPE_UNKNOWN = -1; const int RESOURCE_TYPE_NOTSET = 0; const int RESOURCE_TYPE_SCENE = 1; const int RESOURCE_TYPE_SCRIPTFILE = 2; const int RESOURCE_TYPE_MODEL = 3; const int RESOURCE_TYPE_MATERIAL = 4; const int RESOURCE_TYPE_ANIMATION = 5; const int RESOURCE_TYPE_IMAGE = 6; const int RESOURCE_TYPE_SOUND = 7; const int RESOURCE_TYPE_TEXTURE = 8; const int RESOURCE_TYPE_FONT = 9; const int RESOURCE_TYPE_PREFAB = 10; const int RESOURCE_TYPE_TECHNIQUE = 11; const int RESOURCE_TYPE_PARTICLEEFFECT = 12; const int RESOURCE_TYPE_UIELEMENT = 13; const int RESOURCE_TYPE_UIELEMENTS = 14; const int RESOURCE_TYPE_ANIMATION_SETTINGS = 15; const int RESOURCE_TYPE_RENDERPATH = 16; const int RESOURCE_TYPE_TEXTURE_ATLAS = 17; const int RESOURCE_TYPE_2D_PARTICLE_EFFECT = 18; const int RESOURCE_TYPE_TEXTURE_3D = 19; const int RESOURCE_TYPE_CUBEMAP = 20; const int RESOURCE_TYPE_PARTICLEEMITTER = 21; const int RESOURCE_TYPE_2D_ANIMATION_SET = 22; const int RESOURCE_TYPE_GENERIC_XML = 23; const int RESOURCE_TYPE_GENERIC_JSON = 24; // any resource type > 0 is valid const int NUMBER_OF_VALID_RESOURCE_TYPES = 24; const StringHash XML_TYPE_SCENE("scene"); const StringHash XML_TYPE_NODE("node"); const StringHash XML_TYPE_MATERIAL("material"); const StringHash XML_TYPE_TECHNIQUE("technique"); const StringHash XML_TYPE_PARTICLEEFFECT("particleeffect"); const StringHash XML_TYPE_PARTICLEEMITTER("particleemitter"); const StringHash XML_TYPE_TEXTURE("texture"); const StringHash XML_TYPE_ELEMENT("element"); const StringHash XML_TYPE_ELEMENTS("elements"); const StringHash XML_TYPE_ANIMATION_SETTINGS("animation"); const StringHash XML_TYPE_RENDERPATH("renderpath"); const StringHash XML_TYPE_TEXTURE_ATLAS("TextureAtlas"); const StringHash XML_TYPE_2D_PARTICLE_EFFECT("particleEmitterConfig"); const StringHash XML_TYPE_TEXTURE_3D("texture3d"); const StringHash XML_TYPE_CUBEMAP("cubemap"); const StringHash XML_TYPE_SPRITER_DATA("spriter_data"); const StringHash XML_TYPE_GENERIC("xml"); const StringHash JSON_TYPE_SCENE("scene"); const StringHash JSON_TYPE_NODE("node"); const StringHash JSON_TYPE_MATERIAL("material"); const StringHash JSON_TYPE_TECHNIQUE("technique"); const StringHash JSON_TYPE_PARTICLEEFFECT("particleeffect"); const StringHash JSON_TYPE_PARTICLEEMITTER("particleemitter"); const StringHash JSON_TYPE_TEXTURE("texture"); const StringHash JSON_TYPE_ELEMENT("element"); const StringHash JSON_TYPE_ELEMENTS("elements"); const StringHash JSON_TYPE_ANIMATION_SETTINGS("animation"); const StringHash JSON_TYPE_RENDERPATH("renderpath"); const StringHash JSON_TYPE_TEXTURE_ATLAS("TextureAtlas"); const StringHash JSON_TYPE_2D_PARTICLE_EFFECT("particleEmitterConfig"); const StringHash JSON_TYPE_TEXTURE_3D("texture3d"); const StringHash JSON_TYPE_CUBEMAP("cubemap"); const StringHash JSON_TYPE_SPRITER_DATA("spriter_data"); const StringHash JSON_TYPE_GENERIC("json"); const StringHash BINARY_TYPE_SCENE("USCN"); const StringHash BINARY_TYPE_PACKAGE("UPAK"); const StringHash BINARY_TYPE_COMPRESSED_PACKAGE("ULZ4"); const StringHash BINARY_TYPE_ANGELSCRIPT("ASBC"); const StringHash BINARY_TYPE_MODEL("UMDL"); const StringHash BINARY_TYPE_MODEL2("UMD2"); const StringHash BINARY_TYPE_SHADER("USHD"); const StringHash BINARY_TYPE_ANIMATION("UANI"); const StringHash EXTENSION_TYPE_TTF(".ttf"); const StringHash EXTENSION_TYPE_OTF(".otf"); const StringHash EXTENSION_TYPE_OGG(".ogg"); const StringHash EXTENSION_TYPE_WAV(".wav"); const StringHash EXTENSION_TYPE_DDS(".dds"); const StringHash EXTENSION_TYPE_PNG(".png"); const StringHash EXTENSION_TYPE_JPG(".jpg"); const StringHash EXTENSION_TYPE_JPEG(".jpeg"); const StringHash EXTENSION_TYPE_HDR(".hdr"); const StringHash EXTENSION_TYPE_BMP(".bmp"); const StringHash EXTENSION_TYPE_TGA(".tga"); const StringHash EXTENSION_TYPE_KTX(".ktx"); const StringHash EXTENSION_TYPE_PVR(".pvr"); const StringHash EXTENSION_TYPE_OBJ(".obj"); const StringHash EXTENSION_TYPE_FBX(".fbx"); const StringHash EXTENSION_TYPE_COLLADA(".dae"); const StringHash EXTENSION_TYPE_BLEND(".blend"); const StringHash EXTENSION_TYPE_ANGELSCRIPT(".as"); const StringHash EXTENSION_TYPE_LUASCRIPT(".lua"); const StringHash EXTENSION_TYPE_HLSL(".hlsl"); const StringHash EXTENSION_TYPE_GLSL(".glsl"); const StringHash EXTENSION_TYPE_FRAGMENTSHADER(".frag"); const StringHash EXTENSION_TYPE_VERTEXSHADER(".vert"); const StringHash EXTENSION_TYPE_HTML(".html"); const StringHash TEXT_VAR_FILE_ID("browser_file_id"); const StringHash TEXT_VAR_DIR_ID("browser_dir_id"); const StringHash TEXT_VAR_RESOURCE_TYPE("resource_type"); const StringHash TEXT_VAR_RESOURCE_DIR_ID("resource_dir_id"); const int BROWSER_FILE_SOURCE_RESOURCE_DIR = 1; uint browserDirIndex = 1; uint browserFileIndex = 1; BrowserDir@ selectedBrowserDirectory; BrowserFile@ selectedBrowserFile; Text@ browserStatusMessage; Text@ browserResultsMessage; bool ignoreRefreshBrowserResults = false; String resourceDirsCache; void CreateResourceBrowser() { if (browserWindow !is null) return; CreateResourceBrowserUI(); InitResourceBrowserPreview(); RebuildResourceDatabase(); } void RebuildResourceDatabase() { if (browserWindow is null) return; String newResourceDirsCache = Join(cache.resourceDirs, ';'); ScanResourceDirectories(); if (newResourceDirsCache != resourceDirsCache) { resourceDirsCache = newResourceDirsCache; PopulateResourceDirFilters(); } PopulateBrowserDirectories(); PopulateResourceBrowserFilesByDirectory(rootDir); } void ScanResourceDirectories() { browserDirs.Clear(); browserFiles.Clear(); browserFilesToScan.Clear(); rootDir = BrowserDir(""); browserDirs.Set("", @rootDir); // collect all of the items and sort them afterwards for(uint i=0; i < cache.resourceDirs.length; ++i) { if (activeResourceDirFilters.Find(i) > -1) continue; ScanResourceDir(i); } } // used to stop ui from blocking while determining file types void DoResourceBrowserWork() { if (browserFilesToScan.length == 0) return; int counter = 0; bool updateBrowserUI = false; BrowserFile@ scanItem = browserFilesToScan[0]; while(counter < BROWSER_WORKER_ITEMS_PER_TICK) { scanItem.DetermainResourceType(); // next browserFilesToScan.Erase(0); if (browserFilesToScan.length > 0) @scanItem = browserFilesToScan[0]; else break; counter++; } if (browserFilesToScan.length > 0) browserStatusMessage.text = localization.Get("Files left to scan: " )+ browserFilesToScan.length; else browserStatusMessage.text = localization.Get("Scan complete"); } void CreateResourceBrowserUI() { browserWindow = LoadEditorUI("UI/EditorResourceBrowser.xml"); browserDirList = browserWindow.GetChild("DirectoryList", true); browserFileList = browserWindow.GetChild("FileList", true); browserSearch = browserWindow.GetChild("Search", true); browserStatusMessage = browserWindow.GetChild("StatusMessage", true); browserResultsMessage = browserWindow.GetChild("ResultsMessage", true); // browserWindow.visible = false; browserWindow.opacity = uiMaxOpacity; browserFilterWindow = LoadEditorUI("UI/EditorResourceFilterWindow.xml"); CreateResourceFilterUI(); HideResourceFilterWindow(); int height = Min(ui.root.height / 4, 300); browserWindow.SetSize(900, height); browserWindow.SetPosition(35, ui.root.height - height - 25); CloseContextMenu(); ui.root.AddChild(browserWindow); ui.root.AddChild(browserFilterWindow); SubscribeToEvent(browserWindow.GetChild("CloseButton", true), "Released", "HideResourceBrowserWindow"); SubscribeToEvent(browserWindow.GetChild("RescanButton", true), "Released", "HandleRescanResourceBrowserClick"); SubscribeToEvent(browserWindow.GetChild("FilterButton", true), "Released", "ToggleResourceFilterWindow"); SubscribeToEvent(browserDirList, "SelectionChanged", "HandleResourceBrowserDirListSelectionChange"); SubscribeToEvent(browserSearch, "TextChanged", "HandleResourceBrowserSearchTextChange"); SubscribeToEvent(browserFileList, "ItemClicked", "HandleBrowserFileClick"); SubscribeToEvent(browserFileList, "SelectionChanged", "HandleResourceBrowserFileListSelectionChange"); SubscribeToEvent(cache, "FileChanged", "HandleFileChanged"); } void CreateResourceFilterUI() { UIElement@ options = browserFilterWindow.GetChild("TypeOptions", true); CheckBox@ toggleAllTypes = browserFilterWindow.GetChild("ToggleAllTypes", true); CheckBox@ toggleAllResourceDirs = browserFilterWindow.GetChild("ToggleAllResourceDirs", true); SubscribeToEvent(toggleAllTypes, "Toggled", "HandleResourceTypeFilterToggleAllTypesToggled"); SubscribeToEvent(toggleAllResourceDirs, "Toggled", "HandleResourceDirFilterToggleAllTypesToggled"); SubscribeToEvent(browserFilterWindow.GetChild("CloseButton", true), "Released", "HideResourceFilterWindow"); int columns = 2; UIElement@ col1 = browserFilterWindow.GetChild("TypeFilterColumn1", true); UIElement@ col2 = browserFilterWindow.GetChild("TypeFilterColumn2", true); // use array to get sort of items Array<ResourceType@> sorted; for (int i=1; i <= NUMBER_OF_VALID_RESOURCE_TYPES; ++i) sorted.Push(ResourceType(i, ResourceTypeName(i))); // 2 unknown types are reserved for the top, the rest are alphabetized sorted.Sort(); sorted.Insert(0, ResourceType(RESOURCE_TYPE_UNKNOWN, ResourceTypeName(RESOURCE_TYPE_UNKNOWN)) ); sorted.Insert(0, ResourceType(RESOURCE_TYPE_UNUSABLE, ResourceTypeName(RESOURCE_TYPE_UNUSABLE)) ); uint halfColumns = uint( Ceil( float(sorted.length) / float(columns) ) ); for (uint i = 0; i < sorted.length; ++i) { ResourceType@ type = sorted[i]; UIElement@ resourceTypeHolder = UIElement(); if (i < halfColumns) col1.AddChild(resourceTypeHolder); else col2.AddChild(resourceTypeHolder); resourceTypeHolder.layoutMode = LM_HORIZONTAL; resourceTypeHolder.layoutSpacing = 4; Text@ label = Text(); label.style = "EditorAttributeText"; label.text = type.name; CheckBox@ checkbox = CheckBox(); checkbox.name = type.id; checkbox.SetStyleAuto(); checkbox.vars[TEXT_VAR_RESOURCE_TYPE] = i; checkbox.checked = true; SubscribeToEvent(checkbox, "Toggled", "HandleResourceTypeFilterToggled"); resourceTypeHolder.AddChild(checkbox); resourceTypeHolder.AddChild(label); } } void CreateDirList(BrowserDir@ dir, UIElement@ parentUI = null) { Text@ dirText = Text(); browserDirList.InsertItem(browserDirList.numItems, dirText, parentUI); dirText.style = "FileSelectorListText"; dirText.text = dir.resourceKey.empty ? localization.Get("Root") : dir.name; dirText.name = dir.resourceKey; dirText.vars[TEXT_VAR_DIR_ID] = dir.resourceKey; // Sort directories alphetically browserSearchSortMode = BROWSER_SORT_MODE_ALPHA; dir.children.Sort(); for(uint i=0; i<dir.children.length; ++i) CreateDirList(dir.children[i], dirText); } void CreateFileList(BrowserFile@ file) { Text@ fileText = Text(); fileText.style = "FileSelectorListText"; fileText.layoutMode = LM_HORIZONTAL; browserFileList.InsertItem(browserFileList.numItems, fileText); file.browserFileListRow = fileText; InitializeBrowserFileListRow(fileText, file); } void InitializeBrowserFileListRow(Text@ fileText, BrowserFile@ file) { fileText.RemoveAllChildren(); VariantMap params = VariantMap(); fileText.vars[TEXT_VAR_FILE_ID] = file.id; fileText.vars[TEXT_VAR_RESOURCE_TYPE] = file.resourceType; if (file.resourceType > 0) fileText.dragDropMode = DD_SOURCE; { Text@ text = Text(); fileText.AddChild(text); text.style = "FileSelectorListText"; text.text = file.fullname; text.name = file.resourceKey; } { Text@ text = Text(); fileText.AddChild(text); text.style = "FileSelectorListText"; text.text = file.ResourceTypeName(); } if (file.resourceType == RESOURCE_TYPE_MATERIAL || file.resourceType == RESOURCE_TYPE_MODEL || file.resourceType == RESOURCE_TYPE_PARTICLEEFFECT || file.resourceType == RESOURCE_TYPE_PREFAB ) { SubscribeToEvent(fileText, "DragBegin", "HandleBrowserFileDragBegin"); SubscribeToEvent(fileText, "DragEnd", "HandleBrowserFileDragEnd"); } } void InitResourceBrowserPreview() { resourcePreviewScene = Scene("PreviewScene"); resourcePreviewScene.CreateComponent("Octree"); /*PhysicsWorld@ physicsWorld = resourcePreviewScene.CreateComponent("PhysicsWorld"); physicsWorld.enabled = false; physicsWorld.gravity = Vector3(0.0, 0.0, 0.0);*/ Node@ zoneNode = resourcePreviewScene.CreateChild("Zone"); Zone@ zone = zoneNode.CreateComponent("Zone"); zone.boundingBox = BoundingBox(-1000, 1000); zone.ambientColor = Color(0.15, 0.15, 0.15); zone.fogColor = Color(0, 0, 0); zone.fogStart = 10.0; zone.fogEnd = 100.0; resourcePreviewCameraNode = resourcePreviewScene.CreateChild("PreviewCamera"); resourcePreviewCameraNode.position = Vector3(0, 0, -1.5); Camera@ camera = resourcePreviewCameraNode.CreateComponent("Camera"); camera.nearClip = 0.1f; camera.farClip = 100.0f; resourcePreviewLightNode = resourcePreviewScene.CreateChild("PreviewLight"); resourcePreviewLightNode.direction = Vector3(0.5, -0.5, 0.5); resourcePreviewLight = resourcePreviewLightNode.CreateComponent("Light"); resourcePreviewLight.lightType = LIGHT_DIRECTIONAL; resourcePreviewLight.specularIntensity = 0.5; resourceBrowserPreview = browserWindow.GetChild("ResourceBrowserPreview", true); resourceBrowserPreview.SetFixedHeight(200); resourceBrowserPreview.SetFixedWidth(266); resourceBrowserPreview.SetView(resourcePreviewScene, camera); resourceBrowserPreview.autoUpdate = false; resourcePreviewNode = resourcePreviewScene.CreateChild("PreviewNodeContainer"); SubscribeToEvent(resourceBrowserPreview, "DragMove", "RotateResourceBrowserPreview"); RefreshBrowserPreview(); } // Opens a contextual menu based on what resource item was actioned void HandleBrowserFileClick(StringHash eventType, VariantMap& eventData) { if (eventData["Button"].GetInt() != MOUSEB_RIGHT) return; UIElement@ uiElement = eventData["Item"].GetPtr(); BrowserFile@ file = GetBrowserFileFromUIElement(uiElement); if (file is null) return; Array<UIElement@> actions; if (file.resourceType == RESOURCE_TYPE_MATERIAL) { actions.Push(CreateBrowserFileActionMenu("Edit", "HandleBrowserEditResource", file)); } else if (file.resourceType == RESOURCE_TYPE_MODEL) { actions.Push(CreateBrowserFileActionMenu("Instance Animated Model", "HandleBrowserInstantiateAnimatedModel", file)); actions.Push(CreateBrowserFileActionMenu("Instance Static Model", "HandleBrowserInstantiateStaticModel", file)); } else if (file.resourceType == RESOURCE_TYPE_PREFAB) { actions.Push(CreateBrowserFileActionMenu("Instance Prefab", "HandleBrowserInstantiatePrefab", file)); actions.Push(CreateBrowserFileActionMenu("Instance in Spawner", "HandleBrowserInstantiateInSpawnEditor", file)); } else if (file.fileType == EXTENSION_TYPE_OBJ || file.fileType == EXTENSION_TYPE_COLLADA || file.fileType == EXTENSION_TYPE_FBX || file.fileType == EXTENSION_TYPE_BLEND) { actions.Push(CreateBrowserFileActionMenu("Import Model", "HandleBrowserImportModel", file)); actions.Push(CreateBrowserFileActionMenu("Import Scene", "HandleBrowserImportScene", file)); } else if (file.resourceType == RESOURCE_TYPE_UIELEMENT) { actions.Push(CreateBrowserFileActionMenu("Open UI Layout", "HandleBrowserOpenUILayout", file)); } else if (file.resourceType == RESOURCE_TYPE_SCENE) { actions.Push(CreateBrowserFileActionMenu("Load Scene", "HandleBrowserLoadScene", file)); } else if (file.resourceType == RESOURCE_TYPE_SCRIPTFILE) { actions.Push(CreateBrowserFileActionMenu("Execute Script", "HandleBrowserRunScript", file)); } else if (file.resourceType == RESOURCE_TYPE_PARTICLEEFFECT) { actions.Push(CreateBrowserFileActionMenu("Edit", "HandleBrowserEditResource", file)); } actions.Push(CreateBrowserFileActionMenu("Open", "HandleBrowserOpenResource", file)); ActivateContextMenu(actions); } BrowserDir@ GetBrowserDir(String path) { BrowserDir@ browserDir; browserDirs.Get(path, @browserDir); return browserDir; } // Makes sure the entire directory tree exists and new dir is linked to parent BrowserDir@ InitBrowserDir(String path) { BrowserDir@ browserDir; if (browserDirs.Get(path, @browserDir)) return browserDir; Array<String> parts = path.Split('/'); Array<String> finishedParts; if (parts.length > 0) { BrowserDir@ parent = rootDir; for( uint i = 0; i < parts.length; ++i ) { finishedParts.Push(parts[i]); String currentPath = Join(finishedParts, "/"); if (!browserDirs.Get(currentPath, @browserDir)) { browserDir = BrowserDir(currentPath); browserDirs.Set(currentPath, @browserDir); parent.children.Push(browserDir); } @parent = browserDir; } return browserDir; } return null; } void ScanResourceDir(uint resourceDirIndex) { String resourceDir = cache.resourceDirs[resourceDirIndex]; ScanResourceDirFiles("", resourceDirIndex); Array<String> dirs = fileSystem.ScanDir(resourceDir, "*", SCAN_DIRS, true); for (uint i=0; i < dirs.length; ++i) { String path = dirs[i]; if (path.EndsWith(".")) continue; InitBrowserDir(path); ScanResourceDirFiles(path, resourceDirIndex); } } void ScanResourceDirFiles(String path, uint resourceDirIndex) { String fullPath = cache.resourceDirs[resourceDirIndex] + path; if (!fileSystem.DirExists(fullPath)) return; BrowserDir@ dir = GetBrowserDir(path); if (dir is null) return; // get files in directory Array<String> dirFiles = fileSystem.ScanDir(fullPath, "*.*", SCAN_FILES, false); // add new files for (uint x=0; x < dirFiles.length; x++) { String filename = dirFiles[x]; BrowserFile@ browserFile = dir.AddFile(filename, resourceDirIndex, BROWSER_FILE_SOURCE_RESOURCE_DIR); browserFiles.Push(browserFile); browserFilesToScan.Push(browserFile); } } bool ToggleResourceBrowserWindow() { if (browserWindow.visible == false) ShowResourceBrowserWindow(); else HideResourceBrowserWindow(); return true; } void ShowResourceBrowserWindow() { browserWindow.visible = true; browserWindow.BringToFront(); ui.focusElement = browserSearch; } void HideResourceBrowserWindow() { browserWindow.visible = false; } void ToggleResourceFilterWindow() { if (browserFilterWindow.visible) HideResourceFilterWindow(); else ShowResourceFilterWindow(); } void HideResourceFilterWindow() { browserFilterWindow.visible = false; } void ShowResourceFilterWindow() { int x = browserWindow.position.x + browserWindow.width - browserFilterWindow.width; int y = browserWindow.position.y - browserFilterWindow.height - 1; browserFilterWindow.position = IntVector2(x,y); browserFilterWindow.visible = true; browserFilterWindow.BringToFront(); } void PopulateResourceDirFilters() { UIElement@ resourceDirs = browserFilterWindow.GetChild("DirFilters", true); resourceDirs.RemoveAllChildren(); activeResourceDirFilters.Clear(); for (uint i=0; i < cache.resourceDirs.length; ++i) { UIElement@ resourceDirHolder = UIElement(); resourceDirs.AddChild(resourceDirHolder); resourceDirHolder.layoutMode = LM_HORIZONTAL; resourceDirHolder.layoutSpacing = 4; resourceDirHolder.SetFixedHeight(16); Text@ label = Text(); label.style = "EditorAttributeText"; label.text = cache.resourceDirs[i].Replaced(fileSystem.programDir, ""); CheckBox@ checkbox = CheckBox(); checkbox.name = i; checkbox.SetStyleAuto(); checkbox.vars[TEXT_VAR_RESOURCE_DIR_ID] = i; checkbox.checked = true; SubscribeToEvent(checkbox, "Toggled", "HandleResourceDirFilterToggled"); resourceDirHolder.AddChild(checkbox); resourceDirHolder.AddChild(label); } } void PopulateBrowserDirectories() { browserDirList.RemoveAllItems(); CreateDirList(rootDir); browserDirList.selection = 0; } void PopulateResourceBrowserFilesByDirectory(BrowserDir@ dir) { @selectedBrowserDirectory = dir; browserFileList.RemoveAllItems(); if (dir is null) return; Array<BrowserFile@> files; for(uint x=0; x < dir.files.length; x++) { BrowserFile@ file = dir.files[x]; if (activeResourceTypeFilters.Find(file.resourceType) == -1) files.Push(file); } // Sort alphetically browserSearchSortMode = BROWSER_SORT_MODE_ALPHA; files.Sort(); PopulateResourceBrowserResults(files); browserResultsMessage.text = localization.Get("Showing files: ") + files.length; } void PopulateResourceBrowserBySearch() { String query = browserSearch.text; Array<int> scores; Array<BrowserFile@> scored; Array<BrowserFile@> filtered; { BrowserFile@ file; for(uint x=0; x < browserFiles.length; x++) { @file = browserFiles[x]; file.sortScore = -1; if (activeResourceTypeFilters.Find(file.resourceType) > -1) continue; if (activeResourceDirFilters.Find(file.resourceSourceIndex) > -1) continue; int find = file.fullname.Find(query, 0, false); if (find > -1) { int fudge = query.length - file.fullname.length; int score = find * int(Abs(fudge*2)) + int(Abs(fudge)); file.sortScore = score; scored.Push(file); scores.Push(score); } } } // cut this down for a faster sort if (scored.length > BROWSER_SEARCH_LIMIT) { scores.Sort(); int scoreThreshold = scores[BROWSER_SEARCH_LIMIT]; BrowserFile@ file; for(uint x=0;x<scored.length;x++) { file = scored[x]; if (file.sortScore <= scoreThreshold) filtered.Push(file); } } else filtered = scored; browserSearchSortMode = BROWSER_SORT_MODE_ALPHA; filtered.Sort(); PopulateResourceBrowserResults(filtered); browserResultsMessage.text = "Showing top " + filtered.length + " of " + scored.length + " results"; } void PopulateResourceBrowserResults(Array<BrowserFile@>@ files) { browserFileList.RemoveAllItems(); for(uint i=0; i < files.length; ++i) CreateFileList(files[i]); } void RefreshBrowserResults() { if (browserSearch.text.empty) { browserDirList.visible = true; PopulateResourceBrowserFilesByDirectory(selectedBrowserDirectory); } else { browserDirList.visible = false; PopulateResourceBrowserBySearch(); } } void HandleResourceTypeFilterToggleAllTypesToggled(StringHash eventType, VariantMap& eventData) { CheckBox@ checkbox = eventData["Element"].GetPtr(); UIElement@ filterHolder = browserFilterWindow.GetChild("TypeFilters", true); Array<UIElement@> children = filterHolder.GetChildren(true); ignoreRefreshBrowserResults = true; for(uint i=0; i < children.length; ++i) { CheckBox@ filter = children[i]; if (filter !is null) filter.checked = checkbox.checked; } ignoreRefreshBrowserResults = false; RefreshBrowserResults(); } void HandleResourceTypeFilterToggled(StringHash eventType, VariantMap& eventData) { CheckBox@ checkbox = eventData["Element"].GetPtr(); if (!checkbox.vars.Contains(TEXT_VAR_RESOURCE_TYPE)) return; int resourceType = checkbox.GetVar(TEXT_VAR_RESOURCE_TYPE).GetInt(); int find = activeResourceTypeFilters.Find(resourceType); if (checkbox.checked && find != -1) activeResourceTypeFilters.Erase(find); else if (!checkbox.checked && find == -1) activeResourceTypeFilters.Push(resourceType); if (ignoreRefreshBrowserResults == false) RefreshBrowserResults(); } void HandleResourceDirFilterToggleAllTypesToggled(StringHash eventType, VariantMap& eventData) { CheckBox@ checkbox = eventData["Element"].GetPtr(); UIElement@ filterHolder = browserFilterWindow.GetChild("DirFilters", true); Array<UIElement@> children = filterHolder.GetChildren(true); ignoreRefreshBrowserResults = true; for(uint i=0; i < children.length; ++i) { CheckBox@ filter = children[i]; if (filter !is null) filter.checked = checkbox.checked; } ignoreRefreshBrowserResults = false; RebuildResourceDatabase(); } void HandleResourceDirFilterToggled(StringHash eventType, VariantMap& eventData) { CheckBox@ checkbox = eventData["Element"].GetPtr(); if (!checkbox.vars.Contains(TEXT_VAR_RESOURCE_DIR_ID)) return; int resourceDir = checkbox.GetVar(TEXT_VAR_RESOURCE_DIR_ID).GetInt(); int find = activeResourceDirFilters.Find(resourceDir); if (checkbox.checked && find != -1) activeResourceDirFilters.Erase(find); else if (!checkbox.checked && find == -1) activeResourceDirFilters.Push(resourceDir); if (ignoreRefreshBrowserResults == false) RebuildResourceDatabase(); } void HandleRescanResourceBrowserClick(StringHash eventType, VariantMap& eventData) { RebuildResourceDatabase(); } void HandleResourceBrowserDirListSelectionChange(StringHash eventType, VariantMap& eventData) { if (browserDirList.selection == M_MAX_UNSIGNED) return; UIElement@ uiElement = browserDirList.GetItems()[browserDirList.selection]; BrowserDir@ dir = GetBrowserDir(uiElement.vars[TEXT_VAR_DIR_ID].GetString()); if (dir is null) return; PopulateResourceBrowserFilesByDirectory(dir); } void HandleResourceBrowserFileListSelectionChange(StringHash eventType, VariantMap& eventData) { if (browserFileList.selection == M_MAX_UNSIGNED) return; UIElement@ uiElement = browserFileList.GetItems()[browserFileList.selection]; BrowserFile@ file = GetBrowserFileFromUIElement(uiElement); if (file is null) return; if (resourcePreviewNode !is null) resourcePreviewNode.Remove(); resourcePreviewNode = resourcePreviewScene.CreateChild("PreviewNodeContainer"); CreateResourcePreview(file.GetFullPath(), resourcePreviewNode); if (resourcePreviewNode !is null) { Array<BoundingBox> boxes; Array<Component@> staticModels = resourcePreviewNode.GetComponents("StaticModel", true); Array<Component@> animatedModels = resourcePreviewNode.GetComponents("AnimatedModel", true); for (uint i = 0; i < staticModels.length; ++i) boxes.Push(cast<StaticModel>(staticModels[i]).worldBoundingBox); for (uint i = 0; i < animatedModels.length; ++i) boxes.Push(cast<AnimatedModel>(animatedModels[i]).worldBoundingBox); if (boxes.length > 0) { Vector3 camPosition = Vector3(0.0, 0.0, -1.2); BoundingBox biggestBox = boxes[0]; for (uint i = 1; i < boxes.length; ++i) { if (boxes[i].size.length > biggestBox.size.length) biggestBox = boxes[i]; } resourcePreviewCameraNode.position = biggestBox.center + camPosition * biggestBox.size.length; } resourcePreviewScene.AddChild(resourcePreviewNode); RefreshBrowserPreview(); } } void HandleResourceBrowserSearchTextChange(StringHash eventType, VariantMap& eventData) { RefreshBrowserResults(); } BrowserFile@ GetBrowserFileFromId(uint id) { if (id == 0) return null; BrowserFile@ file; for(uint i=0; i<browserFiles.length; ++i) { @file = @browserFiles[i]; if (file.id == id) return file; } return null; } BrowserFile@ GetBrowserFileFromUIElement(UIElement@ element) { if (element is null || !element.vars.Contains(TEXT_VAR_FILE_ID)) return null; return GetBrowserFileFromId(element.vars[TEXT_VAR_FILE_ID].GetUInt()); } BrowserFile@ GetBrowserFileFromPath(String path) { for (uint i=0; i < browserFiles.length; ++i) { BrowserFile@ file = browserFiles[i]; if (path == file.GetFullPath()) return file; } return null; } void HandleBrowserEditResource(StringHash eventType, VariantMap& eventData) { UIElement@ element = eventData["Element"].GetPtr(); BrowserFile@ file = GetBrowserFileFromUIElement(element); if (file is null) return; if (file.resourceType == RESOURCE_TYPE_MATERIAL) { Material@ material = cache.GetResource("Material", file.resourceKey); if (material !is null) EditMaterial(material); } if (file.resourceType == RESOURCE_TYPE_PARTICLEEFFECT) { ParticleEffect@ particleEffect = cache.GetResource("ParticleEffect", file.resourceKey); if (particleEffect !is null) EditParticleEffect(particleEffect); } } void HandleBrowserOpenResource(StringHash eventType, VariantMap& eventData) { UIElement@ element = eventData["Element"].GetPtr(); BrowserFile@ file = GetBrowserFileFromUIElement(element); if (file !is null) OpenResource(file.resourceKey); } void HandleBrowserImportScene(StringHash eventType, VariantMap& eventData) { UIElement@ element = eventData["Element"].GetPtr(); BrowserFile@ file = GetBrowserFileFromUIElement(element); if (file !is null) ImportScene(file.GetFullPath()); } void HandleBrowserImportModel(StringHash eventType, VariantMap& eventData) { UIElement@ element = eventData["Element"].GetPtr(); BrowserFile@ file = GetBrowserFileFromUIElement(element); if (file !is null) ImportModel(file.GetFullPath()); } void HandleBrowserOpenUILayout(StringHash eventType, VariantMap& eventData) { UIElement@ element = eventData["Element"].GetPtr(); BrowserFile@ file = GetBrowserFileFromUIElement(element); if (file !is null) OpenUILayout(file.GetFullPath()); } void HandleBrowserInstantiateStaticModel(StringHash eventType, VariantMap& eventData) { UIElement@ element = eventData["Element"].GetPtr(); BrowserFile@ file = GetBrowserFileFromUIElement(element); if (file !is null) CreateModelWithStaticModel(file.resourceKey, editNode); } void HandleBrowserInstantiateAnimatedModel(StringHash eventType, VariantMap& eventData) { UIElement@ element = eventData["Element"].GetPtr(); BrowserFile@ file = GetBrowserFileFromUIElement(element); if (file !is null) CreateModelWithAnimatedModel(file.resourceKey, editNode); } void HandleBrowserInstantiatePrefab(StringHash eventType, VariantMap& eventData) { UIElement@ element = eventData["Element"].GetPtr(); BrowserFile@ file = GetBrowserFileFromUIElement(element); if (file !is null) LoadNode(file.GetFullPath()); } void HandleBrowserInstantiateInSpawnEditor(StringHash eventType, VariantMap& eventData) { UIElement@ element = eventData["Element"].GetPtr(); BrowserFile@ file = GetBrowserFileFromUIElement(element); if (file !is null) { spawnedObjectsNames.Resize(1); spawnedObjectsNames[0] = VerifySpawnedObjectFile(file.GetPath()); RefreshPickedObjects(); ShowSpawnEditor(); } } void HandleBrowserLoadScene(StringHash eventType, VariantMap& eventData) { UIElement@ element = eventData["Element"].GetPtr(); BrowserFile@ file = GetBrowserFileFromUIElement(element); if (file !is null) LoadScene(file.GetFullPath()); } void HandleBrowserRunScript(StringHash eventType, VariantMap& eventData) { UIElement@ element = eventData["Element"].GetPtr(); BrowserFile@ file = GetBrowserFileFromUIElement(element); if (file !is null) ExecuteScript(ExtractFileName(eventData)); } void HandleBrowserFileDragBegin(StringHash eventType, VariantMap& eventData) { UIElement@ uiElement = eventData["Element"].GetPtr(); @browserDragFile = GetBrowserFileFromUIElement(uiElement); } void HandleBrowserFileDragEnd(StringHash eventType, VariantMap& eventData) { if (@browserDragFile is null) return; UIElement@ element = ui.GetElementAt(ui.cursor.screenPosition); if (element !is null) return; if (browserDragFile.resourceType == RESOURCE_TYPE_MATERIAL) { StaticModel@ model = cast<StaticModel>(GetDrawableAtMousePostion()); if (model !is null) { AssignMaterial(model, browserDragFile.resourceKey); } } else if (browserDragFile.resourceType == RESOURCE_TYPE_PREFAB) { LoadNode(browserDragFile.GetFullPath(), null, true); } else if (browserDragFile.resourceType == RESOURCE_TYPE_MODEL) { Node@ createdNode = CreateNode(REPLICATED, true); Model@ model = cache.GetResource("Model", browserDragFile.resourceKey); if (model.skeleton.numBones > 0) { AnimatedModel@ am = createdNode.CreateComponent("AnimatedModel"); am.model = model; } else { StaticModel@ sm = createdNode.CreateComponent("StaticModel"); sm.model = model; } AdjustNodePositionByAABB(createdNode); } browserDragFile = null; browserDragComponent = null; browserDragNode = null; } void HandleFileChanged(StringHash eventType, VariantMap& eventData) { String filename = eventData["FileName"].GetString(); BrowserFile@ file = GetBrowserFileFromPath(filename); if (file is null) { // TODO: new file logic when watchers are supported return; } else { file.FileChanged(); } } Menu@ CreateBrowserFileActionMenu(String text, String handler, BrowserFile@ browserFile = null) { Menu@ menu = CreateContextMenuItem(text, handler); if (browserFile !is null) menu.vars[TEXT_VAR_FILE_ID] = browserFile.id; return menu; } int GetResourceType(String path) { StringHash fileType; return GetResourceType(path, fileType); } int GetResourceType(String path, StringHash &out fileType, bool useCache = false) { if (GetExtensionType(path, fileType) || GetBinaryType(path, fileType, useCache) || GetXmlType(path, fileType, useCache)) return GetResourceType(fileType); return RESOURCE_TYPE_UNKNOWN; } int GetResourceType(StringHash fileType) { // Binary filetypes if (fileType == BINARY_TYPE_SCENE) return RESOURCE_TYPE_SCENE; else if (fileType == BINARY_TYPE_PACKAGE) return RESOURCE_TYPE_UNUSABLE; else if (fileType == BINARY_TYPE_COMPRESSED_PACKAGE) return RESOURCE_TYPE_UNUSABLE; else if (fileType == BINARY_TYPE_ANGELSCRIPT) return RESOURCE_TYPE_SCRIPTFILE; else if (fileType == BINARY_TYPE_MODEL || fileType == BINARY_TYPE_MODEL2) return RESOURCE_TYPE_MODEL; else if (fileType == BINARY_TYPE_SHADER) return RESOURCE_TYPE_UNUSABLE; else if (fileType == BINARY_TYPE_ANIMATION) return RESOURCE_TYPE_ANIMATION; // XML filetypes else if (fileType == XML_TYPE_SCENE) return RESOURCE_TYPE_SCENE; else if (fileType == XML_TYPE_NODE) return RESOURCE_TYPE_PREFAB; else if(fileType == XML_TYPE_MATERIAL) return RESOURCE_TYPE_MATERIAL; else if(fileType == XML_TYPE_TECHNIQUE) return RESOURCE_TYPE_TECHNIQUE; else if(fileType == XML_TYPE_PARTICLEEFFECT) return RESOURCE_TYPE_PARTICLEEFFECT; else if(fileType == XML_TYPE_PARTICLEEMITTER) return RESOURCE_TYPE_PARTICLEEMITTER; else if(fileType == XML_TYPE_TEXTURE) return RESOURCE_TYPE_TEXTURE; else if(fileType == XML_TYPE_ELEMENT) return RESOURCE_TYPE_UIELEMENT; else if(fileType == XML_TYPE_ELEMENTS) return RESOURCE_TYPE_UIELEMENTS; else if (fileType == XML_TYPE_ANIMATION_SETTINGS) return RESOURCE_TYPE_ANIMATION_SETTINGS; else if (fileType == XML_TYPE_RENDERPATH) return RESOURCE_TYPE_RENDERPATH; else if (fileType == XML_TYPE_TEXTURE_ATLAS) return RESOURCE_TYPE_TEXTURE_ATLAS; else if (fileType == XML_TYPE_2D_PARTICLE_EFFECT) return RESOURCE_TYPE_2D_PARTICLE_EFFECT; else if (fileType == XML_TYPE_TEXTURE_3D) return RESOURCE_TYPE_TEXTURE_3D; else if (fileType == XML_TYPE_CUBEMAP) return RESOURCE_TYPE_CUBEMAP; else if (fileType == XML_TYPE_SPRITER_DATA) return RESOURCE_TYPE_2D_ANIMATION_SET; else if (fileType == XML_TYPE_GENERIC) return RESOURCE_TYPE_GENERIC_XML; // JSON filetypes else if (fileType == JSON_TYPE_SCENE) return RESOURCE_TYPE_SCENE; else if (fileType == JSON_TYPE_NODE) return RESOURCE_TYPE_PREFAB; else if(fileType == JSON_TYPE_MATERIAL) return RESOURCE_TYPE_MATERIAL; else if(fileType == JSON_TYPE_TECHNIQUE) return RESOURCE_TYPE_TECHNIQUE; else if(fileType == JSON_TYPE_PARTICLEEFFECT) return RESOURCE_TYPE_PARTICLEEFFECT; else if(fileType == JSON_TYPE_PARTICLEEMITTER) return RESOURCE_TYPE_PARTICLEEMITTER; else if(fileType == JSON_TYPE_TEXTURE) return RESOURCE_TYPE_TEXTURE; else if(fileType == JSON_TYPE_ELEMENT) return RESOURCE_TYPE_UIELEMENT; else if(fileType == JSON_TYPE_ELEMENTS) return RESOURCE_TYPE_UIELEMENTS; else if (fileType == JSON_TYPE_ANIMATION_SETTINGS) return RESOURCE_TYPE_ANIMATION_SETTINGS; else if (fileType == JSON_TYPE_RENDERPATH) return RESOURCE_TYPE_RENDERPATH; else if (fileType == JSON_TYPE_TEXTURE_ATLAS) return RESOURCE_TYPE_TEXTURE_ATLAS; else if (fileType == JSON_TYPE_2D_PARTICLE_EFFECT) return RESOURCE_TYPE_2D_PARTICLE_EFFECT; else if (fileType == JSON_TYPE_TEXTURE_3D) return RESOURCE_TYPE_TEXTURE_3D; else if (fileType == JSON_TYPE_CUBEMAP) return RESOURCE_TYPE_CUBEMAP; else if (fileType == JSON_TYPE_SPRITER_DATA) return RESOURCE_TYPE_2D_ANIMATION_SET; else if (fileType == JSON_TYPE_GENERIC) return RESOURCE_TYPE_GENERIC_JSON; // Extension filetypes else if (fileType == EXTENSION_TYPE_TTF) return RESOURCE_TYPE_FONT; else if (fileType == EXTENSION_TYPE_OTF) return RESOURCE_TYPE_FONT; else if (fileType == EXTENSION_TYPE_OGG) return RESOURCE_TYPE_SOUND; else if(fileType == EXTENSION_TYPE_WAV) return RESOURCE_TYPE_SOUND; else if(fileType == EXTENSION_TYPE_DDS) return RESOURCE_TYPE_IMAGE; else if(fileType == EXTENSION_TYPE_PNG) return RESOURCE_TYPE_IMAGE; else if(fileType == EXTENSION_TYPE_JPG) return RESOURCE_TYPE_IMAGE; else if(fileType == EXTENSION_TYPE_JPEG) return RESOURCE_TYPE_IMAGE; else if(fileType == EXTENSION_TYPE_HDR) return RESOURCE_TYPE_IMAGE; else if(fileType == EXTENSION_TYPE_BMP) return RESOURCE_TYPE_IMAGE; else if(fileType == EXTENSION_TYPE_TGA) return RESOURCE_TYPE_IMAGE; else if(fileType == EXTENSION_TYPE_KTX) return RESOURCE_TYPE_IMAGE; else if(fileType == EXTENSION_TYPE_PVR) return RESOURCE_TYPE_IMAGE; else if(fileType == EXTENSION_TYPE_OBJ) return RESOURCE_TYPE_UNUSABLE; else if(fileType == EXTENSION_TYPE_FBX) return RESOURCE_TYPE_UNUSABLE; else if(fileType == EXTENSION_TYPE_COLLADA) return RESOURCE_TYPE_UNUSABLE; else if(fileType == EXTENSION_TYPE_BLEND) return RESOURCE_TYPE_UNUSABLE; else if(fileType == EXTENSION_TYPE_ANGELSCRIPT) return RESOURCE_TYPE_SCRIPTFILE; else if(fileType == EXTENSION_TYPE_LUASCRIPT) return RESOURCE_TYPE_SCRIPTFILE; else if(fileType == EXTENSION_TYPE_HLSL) return RESOURCE_TYPE_UNUSABLE; else if(fileType == EXTENSION_TYPE_GLSL) return RESOURCE_TYPE_UNUSABLE; else if(fileType == EXTENSION_TYPE_FRAGMENTSHADER) return RESOURCE_TYPE_UNUSABLE; else if(fileType == EXTENSION_TYPE_VERTEXSHADER) return RESOURCE_TYPE_UNUSABLE; else if(fileType == EXTENSION_TYPE_HTML) return RESOURCE_TYPE_UNUSABLE; return RESOURCE_TYPE_UNKNOWN; } bool GetExtensionType(String path, StringHash &out fileType) { StringHash type = StringHash(GetExtension(path)); if (type == EXTENSION_TYPE_TTF) fileType = EXTENSION_TYPE_TTF; else if (type == EXTENSION_TYPE_OTF) fileType = EXTENSION_TYPE_OTF; else if (type == EXTENSION_TYPE_OGG) fileType = EXTENSION_TYPE_OGG; else if(type == EXTENSION_TYPE_WAV) fileType = EXTENSION_TYPE_WAV; else if(type == EXTENSION_TYPE_DDS) fileType = EXTENSION_TYPE_DDS; else if(type == EXTENSION_TYPE_PNG) fileType = EXTENSION_TYPE_PNG; else if(type == EXTENSION_TYPE_JPG) fileType = EXTENSION_TYPE_JPG; else if(type == EXTENSION_TYPE_JPEG) fileType = EXTENSION_TYPE_JPEG; else if(type == EXTENSION_TYPE_HDR) fileType = EXTENSION_TYPE_HDR; else if(type == EXTENSION_TYPE_BMP) fileType = EXTENSION_TYPE_BMP; else if(type == EXTENSION_TYPE_TGA) fileType = EXTENSION_TYPE_TGA; else if(type == EXTENSION_TYPE_KTX) fileType = EXTENSION_TYPE_KTX; else if(type == EXTENSION_TYPE_PVR) fileType = EXTENSION_TYPE_PVR; else if(type == EXTENSION_TYPE_OBJ) fileType = EXTENSION_TYPE_OBJ; else if(type == EXTENSION_TYPE_FBX) fileType = EXTENSION_TYPE_FBX; else if(type == EXTENSION_TYPE_COLLADA) fileType = EXTENSION_TYPE_COLLADA; else if(type == EXTENSION_TYPE_BLEND) fileType = EXTENSION_TYPE_BLEND; else if(type == EXTENSION_TYPE_ANGELSCRIPT) fileType = EXTENSION_TYPE_ANGELSCRIPT; else if(type == EXTENSION_TYPE_LUASCRIPT) fileType = EXTENSION_TYPE_LUASCRIPT; else if(type == EXTENSION_TYPE_HLSL) fileType = EXTENSION_TYPE_HLSL; else if(type == EXTENSION_TYPE_GLSL) fileType = EXTENSION_TYPE_GLSL; else if(type == EXTENSION_TYPE_FRAGMENTSHADER) fileType = EXTENSION_TYPE_FRAGMENTSHADER; else if(type == EXTENSION_TYPE_VERTEXSHADER) fileType = EXTENSION_TYPE_VERTEXSHADER; else if(type == EXTENSION_TYPE_HTML) fileType = EXTENSION_TYPE_HTML; else return false; return true; } bool GetBinaryType(String path, StringHash &out fileType, bool useCache = false) { StringHash type; if (useCache) { File@ file = cache.GetFile(path); if (file is null) return false; if (file.size == 0) return false; type = StringHash(file.ReadFileID()); } else { File@ file = File(); if (!file.Open(path)) return false; if (file.size == 0) return false; type = StringHash(file.ReadFileID()); } if (type == BINARY_TYPE_SCENE) fileType = BINARY_TYPE_SCENE; else if (type == BINARY_TYPE_PACKAGE) fileType = BINARY_TYPE_PACKAGE; else if (type == BINARY_TYPE_COMPRESSED_PACKAGE) fileType = BINARY_TYPE_COMPRESSED_PACKAGE; else if (type == BINARY_TYPE_ANGELSCRIPT) fileType = BINARY_TYPE_ANGELSCRIPT; else if (type == BINARY_TYPE_MODEL || type == BINARY_TYPE_MODEL2) fileType = BINARY_TYPE_MODEL; else if (type == BINARY_TYPE_SHADER) fileType = BINARY_TYPE_SHADER; else if (type == BINARY_TYPE_ANIMATION) fileType = BINARY_TYPE_ANIMATION; else return false; return true; } bool GetXmlType(String path, StringHash &out fileType, bool useCache = false) { if (GetFileName(path).length == 0) return false; // .gitignore etc. String extension = GetExtension(path); if (extension == ".txt" || extension == ".json" || extension == ".icns" || extension == ".atlas") return false; String name; if (useCache) { XMLFile@ xml = cache.GetResource("XMLFile", path); if (xml is null) return false; name = xml.root.name; } else { File@ file = File(); if (!file.Open(path)) return false; if (file.size == 0) return false; XMLFile@ xml = XMLFile(); if (xml.Load(file)) name = xml.root.name; else return false; } bool found = false; if (!name.empty) { found = true; StringHash type = StringHash(name); if (type == XML_TYPE_SCENE) fileType = XML_TYPE_SCENE; else if (type == XML_TYPE_NODE) fileType = XML_TYPE_NODE; else if(type == XML_TYPE_MATERIAL) fileType = XML_TYPE_MATERIAL; else if(type == XML_TYPE_TECHNIQUE) fileType = XML_TYPE_TECHNIQUE; else if(type == XML_TYPE_PARTICLEEFFECT) fileType = XML_TYPE_PARTICLEEFFECT; else if(type == XML_TYPE_PARTICLEEMITTER) fileType = XML_TYPE_PARTICLEEMITTER; else if(type == XML_TYPE_TEXTURE) fileType = XML_TYPE_TEXTURE; else if(type == XML_TYPE_ELEMENT) fileType = XML_TYPE_ELEMENT; else if(type == XML_TYPE_ELEMENTS) fileType = XML_TYPE_ELEMENTS; else if (type == XML_TYPE_ANIMATION_SETTINGS) fileType = XML_TYPE_ANIMATION_SETTINGS; else if (type == XML_TYPE_RENDERPATH) fileType = XML_TYPE_RENDERPATH; else if (type == XML_TYPE_TEXTURE_ATLAS) fileType = XML_TYPE_TEXTURE_ATLAS; else if (type == XML_TYPE_2D_PARTICLE_EFFECT) fileType = XML_TYPE_2D_PARTICLE_EFFECT; else if (type == XML_TYPE_TEXTURE_3D) fileType = XML_TYPE_TEXTURE_3D; else if (type == XML_TYPE_CUBEMAP) fileType = XML_TYPE_CUBEMAP; else if (type == XML_TYPE_SPRITER_DATA) fileType = XML_TYPE_SPRITER_DATA; else fileType = XML_TYPE_GENERIC; } return found; } String ResourceTypeName(int resourceType) { if (resourceType == RESOURCE_TYPE_UNUSABLE) return "Unusable"; else if (resourceType == RESOURCE_TYPE_UNKNOWN) return "Unknown"; else if (resourceType == RESOURCE_TYPE_NOTSET) return "Uninitialized"; else if (resourceType == RESOURCE_TYPE_SCENE) return "Scene"; else if (resourceType == RESOURCE_TYPE_SCRIPTFILE) return "Script File"; else if (resourceType == RESOURCE_TYPE_MODEL) return "Model"; else if (resourceType == RESOURCE_TYPE_MATERIAL) return "Material"; else if (resourceType == RESOURCE_TYPE_ANIMATION) return "Animation"; else if (resourceType == RESOURCE_TYPE_IMAGE) return "Image"; else if (resourceType == RESOURCE_TYPE_SOUND) return "Sound"; else if (resourceType == RESOURCE_TYPE_TEXTURE) return "Texture"; else if (resourceType == RESOURCE_TYPE_FONT) return "Font"; else if (resourceType == RESOURCE_TYPE_PREFAB) return "Prefab"; else if (resourceType == RESOURCE_TYPE_TECHNIQUE) return "Render Technique"; else if (resourceType == RESOURCE_TYPE_PARTICLEEFFECT) return "Particle Effect"; else if (resourceType == RESOURCE_TYPE_PARTICLEEMITTER) return "Particle Emitter"; else if (resourceType == RESOURCE_TYPE_UIELEMENT) return "UI Element"; else if (resourceType == RESOURCE_TYPE_UIELEMENTS) return "UI Elements"; else if (resourceType == RESOURCE_TYPE_ANIMATION_SETTINGS) return "Animation Settings"; else if (resourceType == RESOURCE_TYPE_RENDERPATH) return "Render Path"; else if (resourceType == RESOURCE_TYPE_TEXTURE_ATLAS) return "Texture Atlas"; else if (resourceType == RESOURCE_TYPE_2D_PARTICLE_EFFECT) return "2D Particle Effect"; else if (resourceType == RESOURCE_TYPE_TEXTURE_3D) return "Texture 3D"; else if (resourceType == RESOURCE_TYPE_CUBEMAP) return "Cubemap"; else if (resourceType == RESOURCE_TYPE_2D_ANIMATION_SET) return "2D Animation Set"; else return ""; } class BrowserDir { uint id; String resourceKey; String name; Array<BrowserDir@> children; Array<BrowserFile@> files; BrowserDir(String path_) { resourceKey = path_; String parent = GetParentPath(path_); name = path_; name.Replace(parent, ""); id = browserDirIndex++; } int opCmp(BrowserDir@ b) { return name.opCmp(b.name); } BrowserFile@ AddFile(String name, uint resourceSourceIndex, uint sourceType) { String path = resourceKey.length > 0 ? (resourceKey + "/" + name) : name; BrowserFile@ file = BrowserFile(path, resourceSourceIndex, sourceType); files.Push(file); return file; } } class BrowserFile { uint id; uint resourceSourceIndex; String resourceKey; String name; String fullname; String extension; StringHash fileType; int resourceType = 0; int sourceType = 0; int sortScore = 0; WeakHandle browserFileListRow; BrowserFile(String path_, uint resourceSourceIndex_, int sourceType_) { sourceType = sourceType_; resourceSourceIndex = resourceSourceIndex_; resourceKey = path_; name = GetFileName(path_); extension = GetExtension(path_); fullname = GetFileNameAndExtension(path_); id = browserFileIndex++; } int opCmp(BrowserFile@ b) { if (browserSearchSortMode == 1) return fullname.opCmp(b.fullname); else return sortScore - b.sortScore; } String GetResourceSource() { if (sourceType == BROWSER_FILE_SOURCE_RESOURCE_DIR) return cache.resourceDirs[resourceSourceIndex]; else return "Unknown"; } String GetFullPath() { return String(cache.resourceDirs[resourceSourceIndex] + resourceKey); } String GetPath() { return resourceKey; } void DetermainResourceType() { resourceType = GetResourceType(GetFullPath(), fileType, false); Text@ browserFileListRow_ = browserFileListRow.Get(); if (browserFileListRow_ !is null) { InitializeBrowserFileListRow(browserFileListRow_, this); } } String ResourceTypeName() { return ::ResourceTypeName(resourceType); } void FileChanged() { if (!fileSystem.FileExists(GetFullPath())) { } else { } } } void CreateResourcePreview(String path, Node@ previewNode) { resourceBrowserPreview.autoUpdate = false; int resourceType = GetResourceType(path); if (resourceType > 0) { File file; file.Open(path); if (resourceType == RESOURCE_TYPE_MODEL) { Model@ model = Model(); if (model.Load(file)) { StaticModel@ staticModel = previewNode.CreateComponent("StaticModel"); staticModel.model = model; return; } } else if (resourceType == RESOURCE_TYPE_MATERIAL) { Material@ material = Material(); if (material.Load(file)) { StaticModel@ staticModel = previewNode.CreateComponent("StaticModel"); staticModel.model = cache.GetResource("Model", "Models/Sphere.mdl"); staticModel.material = material; return; } } else if (resourceType == RESOURCE_TYPE_IMAGE) { Image@ image = Image(); if (image.Load(file)) { StaticModel@ staticModel = previewNode.CreateComponent("StaticModel"); staticModel.model = cache.GetResource("Model", "Models/Editor/ImagePlane.mdl"); Material@ material = cache.GetResource("Material", "Materials/Editor/TexturedUnlit.xml"); Texture2D@ texture = Texture2D(); texture.SetData(@image, true); material.textures[0] = texture; staticModel.material = material; return; } } else if (resourceType == RESOURCE_TYPE_PREFAB) { if (GetExtension(path) == ".xml") { XMLFile xmlFile; if(xmlFile.Load(file)) if(previewNode.LoadXML(xmlFile.root) && (previewNode.GetComponents("StaticModel", true).length > 0 || previewNode.GetComponents("AnimatedModel", true).length > 0)) { return; } } else if(previewNode.Load(file) && (previewNode.GetComponents("StaticModel", true).length > 0 || previewNode.GetComponents("AnimatedModel", true).length > 0)) return; previewNode.RemoveAllChildren(); previewNode.RemoveAllComponents(); } else if (resourceType == RESOURCE_TYPE_PARTICLEEFFECT) { ParticleEffect@ particleEffect = ParticleEffect(); if (particleEffect.Load(file)) { ParticleEmitter@ particleEmitter = previewNode.CreateComponent("ParticleEmitter"); particleEmitter.effect = particleEffect; particleEffect.activeTime = 0.0; particleEmitter.Reset(); resourceBrowserPreview.autoUpdate = true; return; } } } StaticModel@ staticModel = previewNode.CreateComponent("StaticModel"); staticModel.model = cache.GetResource("Model", "Models/Editor/ImagePlane.mdl"); Material@ material = cache.GetResource("Material", "Materials/Editor/TexturedUnlit.xml"); Texture2D@ texture = Texture2D(); Image@ noPreviewImage = cache.GetResource("Image", "Textures/Editor/NoPreviewAvailable.png"); texture.SetData(noPreviewImage, false); material.textures[0] = texture; staticModel.material = material; return; } void RotateResourceBrowserPreview(StringHash eventType, VariantMap& eventData) { int elemX = eventData["ElementX"].GetInt(); int elemY = eventData["ElementY"].GetInt(); if (resourceBrowserPreview.height > 0 && resourceBrowserPreview.width > 0) { float yaw = ((resourceBrowserPreview.height / 2) - elemY) * (90.0 / resourceBrowserPreview.height); float pitch = ((resourceBrowserPreview.width / 2) - elemX) * (90.0 / resourceBrowserPreview.width); resourcePreviewNode.rotation = resourcePreviewNode.rotation.Slerp(Quaternion(yaw, pitch, 0), 0.1); RefreshBrowserPreview(); } } void RefreshBrowserPreview() { resourceBrowserPreview.QueueUpdate(); } class ResourceType { int id; String name; ResourceType(int id_, String name_) { id = id_; name = name_; } int opCmp(ResourceType@ b) { return name.opCmp(b.name); } }
package cmodule.lua_wrapper { public const _io_popen:int = regFunc(FSM_io_popen.start); }
package com.company.assembleegameclient.objects.particles { import com.company.assembleegameclient.objects.GameObject; import com.company.assembleegameclient.parameters.Parameters; import com.company.assembleegameclient.util.RandomUtil; import flash.geom.Point; import kabam.rotmg.messaging.impl.data.WorldPosData; public class LineEffect extends ParticleEffect { public function LineEffect(go:GameObject, end:WorldPosData, color:int) { super(); this.start_ = new Point(go.x_, go.y_); this.end_ = new Point(end.x_, end.y_); this.color_ = color; } public var start_:Point; public var end_:Point; public var color_:int; override public function update(time:int, dt:int):Boolean { var p:Point = null; var part:Particle = null; x_ = this.start_.x; y_ = this.start_.y; var NUM:int = 30; switch (Parameters.data.reduceParticles) { case 2: NUM = 30; break; case 1: NUM = 15; break; case 0: NUM = 4; } for (var i:int = 0; i < NUM; i++) { p = Point.interpolate(this.start_, this.end_, i / NUM); part = new SparkParticle(100, this.color_, 700, 0.5, RandomUtil.plusMinus(1), RandomUtil.plusMinus(1)); map_.addObj(part, p.x, p.y); } return false; } } }
package SJ.Game.jewel { import SJ.Common.Constants.ConstBag; import SJ.Common.Constants.ConstJewel; import SJ.Common.Constants.ConstTextFormat; import SJ.Game.data.config.CJDataOfItemProperty; import SJ.Game.data.json.Json_item_setting; import SJ.Game.event.CJEventDispatcher; import SJ.Game.formation.CJItemTurnPageBase; import SJ.Game.lang.CJLang; import engine_starling.SApplication; import engine_starling.display.SAnimate; import engine_starling.display.SImage; import engine_starling.display.SLayer; import engine_starling.utils.AssetManagerUtil; import feathers.controls.Label; import flash.text.TextFormat; import flash.text.TextFormatAlign; import lib.engine.utils.functions.Assert; import starling.core.Starling; import starling.events.Event; import starling.textures.Texture; /** * @author sangxu * 2013-05-30 * 宝石镶嵌,装备孔 */ public class CJJewelHole extends SLayer { /** controls */ /** 物品框图片 */ private var _imageFrame:SImage; /** 物品图片 */ private var _imageGoods:SImage; /** 宝石名 */ private var _labName:Label; /** 道具id */ private var _itemid:String = ""; private var _status:uint; /** 道具图片相对背景框图片偏移量 */ private var _spaceXGood:int = 7; private var _spaceYGood:int = 8; /** 框图片宽高 */ private var _frameImgWidth:int = ConstJewel.JEWEL_INLAY_HOLE_WIDTH; private var _frameImgHeight:int = ConstJewel.JEWEL_INLAY_HOLE_HEIGHT; /** 道具图片宽高 */ private var _goodImgWidth:int = 44; private var _goodImgHeight:int = 44; // /** 索引 */ // private var _index:int = 0; /** 是否可选中 */ private var _canSelect:Boolean = false; private var _index:int; /** 动画 - 宝石特效 */ private var _animBaoshi:SAnimate; /** 动画 - 开孔 */ private var _animOpen:SAnimate; public function CJJewelHole(holeIndex:int) { super(); var textureUnlock:Texture = SApplication.assets.getTexture("common_baoshidi"); _init(ConstBag.FrameCreateStateLocked); this._index = holeIndex; } /** * _status为ConstBag.FrameCreateStateUnlock时,创建解锁物品框,否则创建加锁物品框 */ public function get status():uint { return _status; } public function set status(value:uint):void { _status = value; } /** * 物品图片 * */ public function get imageGoods():SImage { return _imageGoods; } public function set imageGoods(value:SImage):void { _imageGoods = value; } /** * 道具id * @return * */ public function get itemId():String { return _itemid; } public function set itemId(value:String):void { _itemid = value; } // /** // * 索引 // * @return // * // */ // public function get index():int // { // return _index; // } // public function set index(value:int):void // { // _index = value; // } public function set canSelect(value:Boolean):void { this._canSelect = value; } public function get canSelect():Boolean { return this._canSelect; } /** * 获取孔索引 * @return * */ public function get index():int { return this._index; } /** * 清除道具id * */ public function clearItemId():void { _itemid = ""; } private function _init(status:uint):void { switch(status) { case ConstBag.FrameCreateStateUnlock: this._imageFrame = new SImage(SApplication.assets.getTexture("common_baoshidi")); break; case ConstBag.FrameCreateStateLocked: this._imageFrame = new SImage(SApplication.assets.getTexture("common_baoshidijiasuo")); break; default: this._imageFrame = new SImage(SApplication.assets.getTexture("common_baoshidi")); } _status = status; this._imageFrame.width = _frameImgWidth; this._imageFrame.height = _frameImgHeight; addChildAt(_imageFrame, 0); var tfName:TextFormat = new TextFormat(ConstTextFormat.FONT_FAMILY_HEITI, 7, 0xffffff, null, null, null, null, null, TextFormatAlign.CENTER); _labName = new Label(); _labName.textRendererProperties.textFormat = tfName; _labName.text = ""; _labName.height = 9; _labName.width = _frameImgWidth; _labName.x = -2; _labName.y = 42; _labName.visible = false; this.addChild(_labName); } /** * 改变装备孔的锁定或者解锁状态 * */ public function updateFrame():void { switch(_status) { case ConstBag.FrameCreateStateUnlock: this._imageFrame.texture = SApplication.assets.getTexture("common_baoshidi"); break; case ConstBag.FrameCreateStateLocked: this._imageFrame.texture = SApplication.assets.getTexture("common_baoshidijiasuo"); this.setHoleGoodsItem(""); this.clearItemName(); this.removeAnimBaoshi(); break; default: this._imageFrame.texture = SApplication.assets.getTexture("common_baoshidi"); } } /** * 为装备孔设置物品 * */ public function setHoleGoodsItem(imgName : String):void { if (this._imageGoods == null) { if (imgName != "") { this._imageGoods = new SImage(SApplication.assets.getTexture(imgName)); this._imageGoods.x = this._imageFrame.x + this._spaceXGood; this._imageGoods.y = this._imageFrame.y + this._spaceYGood; this._imageGoods.width = this._goodImgWidth; this._imageGoods.height = this._goodImgHeight; this.addChildAt(this._imageGoods, 1); this._setAnimBaoshi(); } } else { if (imgName != "") { this._imageGoods.texture = SApplication.assets.getTexture(imgName); this._setAnimBaoshi(); } else { this.removeChild(this._imageGoods); this._imageGoods = null; this.removeAnimBaoshi(); } } } /** * 添加宝石特效 * */ private function _setAnimBaoshi():void { if (this._animBaoshi != null) { return; } var animObject:Object = AssetManagerUtil.o.getObject("anim_baoshixiangqian"); this._animBaoshi = SAnimate.SAnimateFromAnimJsonObject(animObject); // this._animBaoshi.addEventListener(Event.COMPLETE, _onAimComplete); this._animBaoshi.x = 0; this._animBaoshi.y = 0; this.addChildAt(this._animBaoshi, this.getChildIndex(this._imageGoods)); Starling.juggler.add(_animBaoshi); this._animBaoshi.gotoAndPlay(); this._animBaoshi.currentFrame = int(Math.random() * 6); } /** * 开孔 * */ public function openHole():void { status = ConstBag.FrameCreateStateUnlock; setHoleGoodsItem(""); itemId = ""; updateFrame(); _playAnimOpen(); } /** * 播放开孔动画 * */ private function _playAnimOpen():void { var animObject:Object = AssetManagerUtil.o.getObject("anim_xiangqiankaikong"); _animOpen = SAnimate.SAnimateFromAnimJsonObject(animObject); _animOpen.x = 0; _animOpen.y = 0; _animOpen.width = this.width; _animOpen.height = this.height; _animOpen.addEventListener(Event.COMPLETE, _animOpenComplete); addChild(this._animOpen); Starling.juggler.add(_animOpen); this._animOpen.gotoAndPlay(); } /** * 开孔动画播放结束 * @param e * */ private function _animOpenComplete(e:Event):void { if(e.target is SAnimate) { _animOpen.removeEventListener(Event.COMPLETE,_animOpenComplete); _animOpen.removeFromParent(); _animOpen.removeFromJuggler(); _animOpen = null; } } /** * 移除宝石特效 * */ private function removeAnimBaoshi():void { if (this._animBaoshi != null) { this._animBaoshi.removeFromParent(true); this._animBaoshi.removeFromJuggler(); this._animBaoshi = null; } } /** * 根据道具模板id设置图片 * 调用此方法前需加载道具模板资源:ConstResource.sResItemSetting * @param itemTmplId * */ public function setHoleGoodsByTmplId(itemTmplId:int):void { var tmplData:Json_item_setting = CJDataOfItemProperty.o.getTemplate(itemTmplId); Assert(tmplData != null, "Item template is null, id is:" + itemTmplId); // 设置道具图片 this.setHoleGoodsItem(tmplData.picture); // 设置道具名 this.setItemName(CJLang(tmplData.itemname)); } /** * 设置道具名 * @param itemName * */ public function setItemName(itemName:String):void { if (itemName != null) { this._labName.text = itemName; this._labName.visible = true; } else { this._labName.text = ""; this._labName.visible = false; } } /** * 清除道具名 * */ public function clearItemName():void { if (this._labName != null) { this._labName.text = ""; this._labName.visible = false; } } } }
package { import app_magic.controller.App_c; import app_magic.view.view_data.View_type; import flash.desktop.NativeApplication; import flash.display.MovieClip; import flash.events.Event; import flash.display.Sprite; import flash.display.StageAlign; import flash.display.StageScaleMode; import flash.ui.Multitouch; import flash.ui.MultitouchInputMode; import pl.k_puchalski.ZAF_UTILS; /** * ... * @author Zafan */ [SWF(backgroundColor="0x000000")] public class Magic_launcher extends MovieClip { private var _app_c:App_c; private static var _instance:Magic_launcher; public function Magic_launcher():void { _instance = this; stage.scaleMode = StageScaleMode.NO_SCALE; stage.align = StageAlign.TOP_LEFT; stage.addEventListener(Event.DEACTIVATE, deactivate); _app_c = new App_c(this); stage.addEventListener(Event.ACTIVATE, activate); Multitouch.inputMode = MultitouchInputMode.TOUCH_POINT; _app_c.$change_state(View_type.START_V); } public function activate(e:Event):void { } private function deactivate(e:Event):void { // NativeApplication.nativeApplication.exit(); } static public function get instance():Magic_launcher { return _instance; } } }
/** * Copyright 2010 The original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.as3commons.collections.utils { import org.as3commons.collections.framework.IComparator; /** * Null comparator. * * <p>This comparator is being used as the default comparator for sorted collections * if no comparator has been specified else.</p> * * <p>Using this comparator results in an insertion order.</p> * * @author Jens Struwe 14.05.2011 * @see org.as3commons.collections.framework.IComparator IComparator interface - Description of the comparator features. */ public class NullComparator implements IComparator { /** * Compares two items and returns 0. * * @param item1 The first item. * @param item1 The second item. * @return <code>0</code>. */ public function compare(item1 : *, item2 : *) : int { return 0; } } }
package kabam.rotmg.account.core.signals { import org.osflash.signals.Signal; public class OpenAccountInfoSignal extends Signal { public function OpenAccountInfoSignal() { super(); } } }
package org.leui.components { import flash.display.DisplayObject; import flash.display.Graphics; import flash.display.Shape; import flash.events.MouseEvent; import org.leui.events.LEvent; import org.leui.utils.LGeom; import org.leui.utils.UiConst; import org.leui.vos.MenuItemVO; /** * 菜单项 *@author swellee */ public class LMenuItem extends LButton { private var itemIcon:DisplayObject; private var _vo:MenuItemVO; public function LMenuItem(menuItemVo:MenuItemVO) { super(menuItemVo.text); this._vo=menuItemVo; this.style=menuItemVo.style; this.data=menuItemVo.data; } override protected function addEvents():void { super.addEvents(); addEventListener(MouseEvent.CLICK,checkMouseClick); } override protected function removeEvents():void { super.removeEvents(); removeEventListener(MouseEvent.CLICK,checkMouseClick); } /** * 菜单项VO * @return * */ public function get vo():MenuItemVO { return _vo; } /** * 是否链接有子级菜单 */ public function get hasSubMenu():Boolean { return _vo&&_vo.subMenuItemVos&&_vo.subMenuItemVos.length>0; } override protected function onMouseOverHandler(event:MouseEvent):void { super.onMouseOverHandler(event); this.dispatchEvent(new LEvent(LEvent.MOUSE_OVER_MENU_ITEM)); } /** * 设置图标 * @param icon * @param offX * */ public function setIcon():void { var icon:DisplayObject=_vo.icon; var offX:int=_vo.iconOffX; if(icon&&itemIcon!=icon) { if(itemIcon&&itemIcon.parent) { itemIcon.parent.removeChild(itemIcon); } itemIcon=icon; itemIcon.x=offX; addChild(itemIcon); } //submenu tag if(hasSubMenu) { var tag:Shape=new Shape(); var g:Graphics=tag.graphics; g.clear(); g.lineStyle(2,UiConst.MENU_ITEM_SUB_TAG_COLOR); g.moveTo(width-14,7); g.lineTo(width-10,height/2); g.lineTo(width-14,height-7); g.endFill(); addChild(tag); } } protected function checkMouseClick(event:MouseEvent):void { //有子级菜单时,屏蔽点击 if(hasSubMenu)event.stopImmediatePropagation(); } override public function setWH(width:int=-1, height:int=-1):void { super.setWH(width,height); setIcon(); } override public function set data(val:*):void { super.data=val; if(_vo)_vo.data=val; } override protected function render():void { super.render(); if(itemIcon) LGeom.centerInCoordY(itemIcon,this); } override public function dispose():void { _vo=null; itemIcon=null; super.dispose(); } } }
package org.papervision3d.materials.special { import org.papervision3d.core.geom.renderables.Vertex3D; import org.papervision3d.core.math.Matrix3D; import org.papervision3d.core.math.Number3D; import org.papervision3d.core.proto.MaterialObject3D; import org.papervision3d.core.render.data.RenderSessionData; import org.papervision3d.objects.DisplayObject3D; import org.papervision3d.objects.special.VectorShape3D; import org.papervision3d.objects.special.commands.CurveTo; import org.papervision3d.objects.special.commands.LineTo; import org.papervision3d.objects.special.commands.MoveTo; import flash.display.Graphics; /** * @author Mark Barcinski */ public class Letter3DMaterial extends VectorShapeMaterial { public var scaleStroke:Boolean = true; private static var viewVector:Number3D = new Number3D(); private static var normalVector:Number3D = new Number3D(); public function Letter3DMaterial(fillColor:uint = 0xFF00FF , fillAlpha : Number = 1) { this.fillColor = fillColor; this.fillAlpha = fillAlpha; } override public function drawShape(vectorShape : VectorShape3D, graphics : Graphics, renderSessionData : RenderSessionData) : void { if(oneSide) { var camera:DisplayObject3D = renderSessionData.camera; var world:Matrix3D = vectorShape.world; viewVector.x = camera.x - world.n14; viewVector.y = camera.y - world.n24; viewVector.z = camera.z - world.n34; viewVector.normalize(); normalVector.x = world.n13; normalVector.y = world.n23; normalVector.z = world.n33; var dot:Number = Number3D.dot( normalVector, viewVector ); if( dot > 0 ) return; } if(fillAlpha > 0)graphics.beginFill(fillColor, fillAlpha); if(lineAlpha == 0 || lineThickness == 0 || scaleStroke == true) graphics.lineStyle(); else graphics.lineStyle(lineThickness, lineColor, lineAlpha); // for (var i:int=0; i<vectorShape.graphicsCommands.length; i++) { // IVectorShape(vectorShape.graphicsCommands[i]).draw(graphics); // } // // graphics.endFill(); super.drawShape(vectorShape, graphics, renderSessionData); if(lineAlpha == 0 || lineThickness == 0 || scaleStroke == false)return; var prevVertex : Vertex3D; for ( var i:int =0; i<vectorShape.graphicsCommands.length; i++) { // IVectorShape(vectorShape.graphicsCommands[i]).draw(graphics); if(vectorShape.graphicsCommands[i] is MoveTo ) prevVertex = MoveTo(vectorShape.graphicsCommands[i]).vertex; if(vectorShape.graphicsCommands[i] is LineTo ){ LineTo(vectorShape.graphicsCommands[i]).drawScaledStroke( prevVertex , graphics, renderSessionData , this); prevVertex = LineTo(vectorShape.graphicsCommands[i]).vertex; } if(vectorShape.graphicsCommands[i] is CurveTo ) { CurveTo(vectorShape.graphicsCommands[i]).drawScaledStroke( prevVertex , graphics, renderSessionData , this); prevVertex = CurveTo(vectorShape.graphicsCommands[i]).anchor; } } } } }
package view.scene.edit { import flash.display.*; import flash.filters.*; import flash.events.Event; import flash.events.MouseEvent; import flash.events.EventDispatcher; import flash.geom.*; import mx.core.UIComponent; import mx.controls.Text; import mx.controls.Label; import org.libspark.thread.Thread; import org.libspark.thread.utils.SerialExecutor; import org.libspark.thread.utils.ParallelExecutor; import org.libspark.thread.threads.between.BeTweenAS3Thread; import model.*; import model.events.*; import view.image.common.WeaponCardImage; import view.scene.common.WeaponCardClip; import view.ClousureThread; import view.scene.BaseScene; import view.image.requirements.CombineResultImage; import view.image.requirements.CombineResultMarkImage; import view.utils.RemoveChild; /** * 合成結果表示クラス * */ public class CombineResult extends BaseScene { CONFIG::LOCALE_JP private static const _TRANS_RESTRICTION:String = "専用武器"; CONFIG::LOCALE_EN private static const _TRANS_RESTRICTION:String = "Exclusive weapon"; CONFIG::LOCALE_TCN private static const _TRANS_RESTRICTION:String = "專用武器"; CONFIG::LOCALE_SCN private static const _TRANS_RESTRICTION:String = "专用武器"; CONFIG::LOCALE_KR private static const _TRANS_RESTRICTION:String = "専用武器"; CONFIG::LOCALE_FR private static const _TRANS_RESTRICTION:String = "Arme spéciale"; CONFIG::LOCALE_ID private static const _TRANS_RESTRICTION:String = "専用武器"; CONFIG::LOCALE_TH private static const _TRANS_RESTRICTION:String = "専用武器"; CONFIG::LOCALE_JP private static const _TRANS_CHANGE_TITLE:String = "ParameterUp!!"; CONFIG::LOCALE_JP private static const _TRANS_CHANGE_EXPL:String = "__TXT__になりました!"; CONFIG::LOCALE_JP private static const _TRANS_CHANGE_PARAM:String = "\n全合成パラメータが__PRM__上昇しました!"; CONFIG::LOCALE_JP private static const _TRANS_CHANGE_PRM_MAX:String = "\n合成パラメータの最大値が__PRM__上昇しました!"; CONFIG::LOCALE_JP private static const _TRANS_LVUP_TITLE:String = "LevelUp!!"; CONFIG::LOCALE_JP private static const _TRANS_LVUP_LEVEL:String = "武器Lvが__LV__上がりました!"; CONFIG::LOCALE_JP private static const _TRANS_LVUP_PARAM:String = "\n合成パラメータの最大値が__PRM__上昇しました!"; CONFIG::LOCALE_JP private static const _TRANS_LVUP_PSV_NUM:String = "\n追加パッシブスキル数が__NUM__上昇しました!"; CONFIG::LOCALE_EN private static const _TRANS_CHANGE_TITLE:String = "Parameter Up!!"; CONFIG::LOCALE_EN private static const _TRANS_CHANGE_EXPL:String = "Modified into __TXT__"; CONFIG::LOCALE_EN private static const _TRANS_CHANGE_PARAM:String = "\nAll crafting attributes increased by __PRM__!"; CONFIG::LOCALE_EN private static const _TRANS_CHANGE_PRM_MAX:String = "\nThe max crafting attributes increased by __PRM__!"; CONFIG::LOCALE_EN private static const _TRANS_LVUP_TITLE:String = "Level Up!!"; CONFIG::LOCALE_EN private static const _TRANS_LVUP_LEVEL:String = "Weapon Lv increased by __LV__!"; CONFIG::LOCALE_EN private static const _TRANS_LVUP_PARAM:String = "\nThe max crafting attributes increased by __PRM__!"; CONFIG::LOCALE_EN private static const _TRANS_LVUP_PSV_NUM:String = "\nPassive abilities increased by __NUM__!"; CONFIG::LOCALE_TCN private static const _TRANS_CHANGE_TITLE:String = "Parameter Up!!"; CONFIG::LOCALE_TCN private static const _TRANS_CHANGE_EXPL:String = "變成__TXT__了!"; CONFIG::LOCALE_TCN private static const _TRANS_CHANGE_PARAM:String = "\n全合成參數提昇了__PRM__!"; CONFIG::LOCALE_TCN private static const _TRANS_CHANGE_PRM_MAX:String = "\n合成參數的最大值提昇了__PRM__!"; CONFIG::LOCALE_TCN private static const _TRANS_LVUP_TITLE:String = "Level Up!!"; CONFIG::LOCALE_TCN private static const _TRANS_LVUP_LEVEL:String = "武器Lv提昇了__LV__!"; CONFIG::LOCALE_TCN private static const _TRANS_LVUP_PARAM:String = "\n合成參數的最大值提昇了__PRM__!"; CONFIG::LOCALE_TCN private static const _TRANS_LVUP_PSV_NUM:String = "\n追加被動技能數提昇了__NUM__!"; CONFIG::LOCALE_SCN private static const _TRANS_CHANGE_TITLE:String = "Parameter Up!!"; CONFIG::LOCALE_SCN private static const _TRANS_CHANGE_EXPL:String = "变成__TXT__了!"; CONFIG::LOCALE_SCN private static const _TRANS_CHANGE_PARAM:String = "\n全合成参数提昇了__PRM__!"; CONFIG::LOCALE_SCN private static const _TRANS_CHANGE_PRM_MAX:String = "\n合成参数的最大值提昇了__PRM__!"; CONFIG::LOCALE_SCN private static const _TRANS_LVUP_TITLE:String = "Level Up!!"; CONFIG::LOCALE_SCN private static const _TRANS_LVUP_LEVEL:String = "武器Lv提昇了__LV__!"; CONFIG::LOCALE_SCN private static const _TRANS_LVUP_PARAM:String = "\n合成参数的最大值提昇了__PRM__!"; CONFIG::LOCALE_SCN private static const _TRANS_LVUP_PSV_NUM:String = "\n追加被动技能数提昇了__NUM__!"; CONFIG::LOCALE_KR private static const _TRANS_CHANGE_TITLE:String = "ParameterUp!!"; CONFIG::LOCALE_KR private static const _TRANS_CHANGE_EXPL:String = "__TXT__になりました!"; CONFIG::LOCALE_KR private static const _TRANS_CHANGE_PARAM:String = "\n全合成パラメータが__PRM__上昇しました!"; CONFIG::LOCALE_KR private static const _TRANS_CHANGE_PRM_MAX:String = "\n合成パラメータの最大値が__PRM__上昇しました!"; CONFIG::LOCALE_KR private static const _TRANS_LVUP_TITLE:String = "LevelUp!!"; CONFIG::LOCALE_KR private static const _TRANS_LVUP_LEVEL:String = "武器Lvが__LV__上がりました!"; CONFIG::LOCALE_KR private static const _TRANS_LVUP_PARAM:String = "\n合成パラメータの最大値が__PRM__上昇しました!"; CONFIG::LOCALE_KR private static const _TRANS_LVUP_PSV_NUM:String = "\n追加パッシブスキル数が__NUM__上昇しました!"; CONFIG::LOCALE_FR private static const _TRANS_CHANGE_TITLE:String = "Paramètres up!!"; CONFIG::LOCALE_FR private static const _TRANS_CHANGE_EXPL:String = "Est devenu __TXT__ !"; CONFIG::LOCALE_FR private static const _TRANS_CHANGE_PARAM:String = "\nVos paramètres combinés atteignent __PRM__ !"; CONFIG::LOCALE_FR private static const _TRANS_CHANGE_PRM_MAX:String = "\nLa valeur total de vos paramètres combinés atteignent __PRM__ !"; CONFIG::LOCALE_FR private static const _TRANS_LVUP_TITLE:String = "Level up !!"; CONFIG::LOCALE_FR private static const _TRANS_LVUP_LEVEL:String = "Votre ArmeLv est passé à __LV__ !"; CONFIG::LOCALE_FR private static const _TRANS_LVUP_PARAM:String = "\nLa valeur total de vos paramètres combinés atteignent __PRM__ !"; CONFIG::LOCALE_FR private static const _TRANS_LVUP_PSV_NUM:String = "\nVotre nombre de passive skills supplémentaires est monté à __NUM__ !"; CONFIG::LOCALE_ID private static const _TRANS_CHANGE_TITLE:String = "ParameterUp!!"; CONFIG::LOCALE_ID private static const _TRANS_CHANGE_EXPL:String = "__TXT__になりました!"; CONFIG::LOCALE_ID private static const _TRANS_CHANGE_PARAM:String = "\n全合成パラメータが__PRM__上昇しました!"; CONFIG::LOCALE_ID private static const _TRANS_CHANGE_PRM_MAX:String = "\n合成パラメータの最大値が__PRM__上昇しました!"; CONFIG::LOCALE_ID private static const _TRANS_LVUP_TITLE:String = "LevelUp!!"; CONFIG::LOCALE_ID private static const _TRANS_LVUP_LEVEL:String = "武器Lvが__LV__上がりました!"; CONFIG::LOCALE_ID private static const _TRANS_LVUP_PARAM:String = "\n合成パラメータの最大値が__PRM__上昇しました!"; CONFIG::LOCALE_ID private static const _TRANS_LVUP_PSV_NUM:String = "\n追加パッシブスキル数が__NUM__上昇しました!"; CONFIG::LOCALE_TH private static const _TRANS_CHANGE_TITLE:String = "ParameterUp!!"; CONFIG::LOCALE_TH private static const _TRANS_CHANGE_EXPL:String = "__TXT__になりました!"; CONFIG::LOCALE_TH private static const _TRANS_CHANGE_PARAM:String = "\n全合成パラメータが__PRM__上昇しました!"; CONFIG::LOCALE_TH private static const _TRANS_CHANGE_PRM_MAX:String = "\n合成パラメータの最大値が__PRM__上昇しました!"; CONFIG::LOCALE_TH private static const _TRANS_LVUP_TITLE:String = "LevelUp!!"; CONFIG::LOCALE_TH private static const _TRANS_LVUP_LEVEL:String = "武器Lvが__LV__上がりました!"; CONFIG::LOCALE_TH private static const _TRANS_LVUP_PARAM:String = "\n合成パラメータの最大値が__PRM__上昇しました!"; CONFIG::LOCALE_TH private static const _TRANS_LVUP_PSV_NUM:String = "\n追加パッシブスキル数が__NUM__上昇しました!"; private var _combine:Combine = Combine.instance; private var _container:UIComponent = new UIComponent(); private var _expContainer:UIComponent = new UIComponent(); private var _resultImage:CombineResultImage = new CombineResultImage(); private var _name:Label = new Label(); private var _restriction:Label = new Label(); // 結果画像 private var _weaponImage:WeaponCardImage; // ベースパラメータ private var _baseMax:Label = new Label(); private var _baseMaxMark:CombineResultMarkImage = new CombineResultMarkImage(); private var _newBaseSap:Label = new Label(); private var _newBaseSdp:Label = new Label(); private var _newBaseAap:Label = new Label(); private var _newBaseAdp:Label = new Label(); private var _newBaseParams:Array = [_newBaseSap,_newBaseSdp,_newBaseAap,_newBaseAdp]; private var _diffBaseSap:Label = new Label(); private var _diffBaseSdp:Label = new Label(); private var _diffBaseAap:Label = new Label(); private var _diffBaseAdp:Label = new Label(); private var _diffBaseParams:Array = [_diffBaseSap,_diffBaseSdp,_diffBaseAap,_diffBaseAdp]; private var _diffBaseParamMarks:Array = [new CombineResultMarkImage(),new CombineResultMarkImage(),new CombineResultMarkImage(),new CombineResultMarkImage()]; // モンスパラメータ private var _addMax:Label = new Label(); private var _newAddSap:Label = new Label(); private var _newAddSdp:Label = new Label(); private var _newAddAap:Label = new Label(); private var _newAddAdp:Label = new Label(); private var _newAddParams:Array = [_newAddSap,_newAddSdp,_newAddAap,_newAddAdp]; private var _diffAddSap:Label = new Label(); private var _diffAddSdp:Label = new Label(); private var _diffAddAap:Label = new Label(); private var _diffAddAdp:Label = new Label(); private var _diffAddParams:Array = [_diffAddSap,_diffAddSdp,_diffAddAap,_diffAddAdp]; private var _diffAddParamMarks:Array = [new CombineResultMarkImage(),new CombineResultMarkImage(),new CombineResultMarkImage(),new CombineResultMarkImage()]; private var _maxAddSap:Label = new Label(); private var _maxAddSdp:Label = new Label(); private var _maxAddAap:Label = new Label(); private var _maxAddAdp:Label = new Label(); private var _maxAddParams:Array = [_maxAddSap,_maxAddSdp,_maxAddAap,_maxAddAdp]; private var _maxDiffAddSap:Label = new Label(); private var _maxDiffAddSdp:Label = new Label(); private var _maxDiffAddAap:Label = new Label(); private var _maxDiffAddAdp:Label = new Label(); private var _maxDiffAddParams:Array = [_maxDiffAddSap,_maxDiffAddSdp,_maxDiffAddAap,_maxDiffAddAdp]; private var _maxDiffAddParamMarks:Array = [new CombineResultMarkImage(),new CombineResultMarkImage(),new CombineResultMarkImage(),new CombineResultMarkImage()]; // 合計パラ private var _totalSap:Label = new Label(); private var _totalSdp:Label = new Label(); private var _totalAap:Label = new Label(); private var _totalAdp:Label = new Label(); private var _totalParams:Array = [_totalSap,_totalSdp,_totalAap,_totalAdp]; // パッシブ private var _passiveName:Array = [new Label(),new Label(),new Label()]; private var _passiveCnt:Array = [new Label(),new Label(),new Label()]; private var _passiveCntUp:Array = [new Label(),new Label(),new Label()]; private var _passiveCntUpMarks:Array = [new CombineResultMarkImage(),new CombineResultMarkImage(),new CombineResultMarkImage()]; private var _passiveCaption:Array = [new Text(),new Text(),new Text()]; // レベル&EXP private var _resultExp:CombineResultExp = new CombineResultExp(); // CardClip private var _prevClip:WeaponCardClip; private var _newClip:WeaponCardClip; private const _NAME_X:int = 20; private const _NAME_Y:int = 60; private const _NAME_W:int = 350; private const _NAME_H:int = 70; private const _NAME_SIZE:int = 24; private const _REST_X:int = 350; private const _REST_Y:int = 75; private const _REST_W:int = 200; private const _REST_H:int = 40; private const _REST_SIZE:int = 12; private const _MAX_BASE_X:int = 75; private const _MAX_BASE_Y:int = 288; private const _BASE_NEW_X:int = 42; private const _BASE_NEW_Y:int = 174; private const _BASE_DIFF_X:int = 75; private const _BASE_DIFF_Y:int = _BASE_NEW_Y+8; private const _ADD_NEW_X:int = _BASE_DIFF_X+50; private const _ADD_NEW_Y:int = _BASE_DIFF_Y; private const _ADD_DIFF_X:int = _ADD_NEW_X+30; private const _ADD_DIFF_Y:int = _ADD_NEW_Y; private const _ADD_MAX_X:int = _ADD_DIFF_X+40; private const _ADD_MAX_Y:int = _ADD_NEW_Y; private const _ADD_MAX_DIFF_X:int = _ADD_MAX_X+30; private const _ADD_MAX_DIFF_Y:int = _ADD_NEW_Y; private const _TOTAL_X:int = _BASE_NEW_X+260; private const _TOTAL_Y:int = _BASE_NEW_Y; private const _PARA_BIG_SIZE:int = 32; private const _PARA_MIN_SIZE:int = 20; private const _BASE_Y_LIST:Array = [174,230,202,258]; private const _BASE_DIFF_Y_LIST:Array = [182,238,210,266]; private const _ADD_Y_LIST:Array = [182,238,210,266]; private const _ADD_DIFF_Y_LIST:Array = [182,238,210,266]; private const _ADD_MAX_Y_LIST:Array = [182,238,210,266]; private const _ADD_MAX_DIFF_Y_LIST:Array = [182,238,210,266]; private const _TOTAL_Y_LIST:Array = [174,230,202,258]; private const _PARAM_Y:int = 150; private const _PARAM_W:int = 100; private const _PARAM_H:int = 60; private const _PARAM_SIZE:int = 24; private const _PARAM_INTERVAL:int = 28; private const _PSV_NAME_X:int = 25; private const _PSV_NAME_W:int = 390; private const _PSV_NAME_H:int = 60; private const _PSV_NAME_SIZE:int = 16; private const _PSV_CNT_X:int = 344; private const _PSV_CNT_UP_X:int = 384; private const _PSV_Y:int = 367; private const _PSV_INTERVAL:int = 72; private const _PSV_CAPTION_X:int = 16; private const _PSV_CAPTION_Y:int = _PSV_Y + 29; private const _PSV_CAPTION_W:int = 530; private const _PSV_CAPTION_H:int = 60; private const _PSV_CAPTION_SIZE:int = 11; private const _MARK_X_INTERVAL:int = 65; private const _MARK_Y_INTERVAL:int = 5; private const _IMAGE_X:int = 481; private const _IMAGE_Y:int = 225; private const _CLIP_X:int = 580; private const _PREV_CLIP_Y:int = 38; private const _NEW_CLIP_Y:int = 304; /** * コンストラクタ * */ public function CombineResult() { super(); } public override function init():void { _container.addChild(_resultImage); allLabelInit(); Unlight.INS.topContainer.parent.addChild(_container); Unlight.INS.topContainer.parent.addChild(_expContainer); } private function allLabelInit():void { var _filter:Array = [new GlowFilter(0xFFFFFF, 1, 2, 2, 16, 1)]; var _revFilter:Array = [new GlowFilter(0x000000, 1, 2, 2, 16, 1)]; labelInit(_name,_NAME_X,_NAME_Y,_NAME_W,_NAME_H,"left",_NAME_SIZE,"ResultNameLabel",_filter); labelInit(_restriction,_REST_X,_REST_Y,_REST_W,_REST_H,"right",_REST_SIZE,"ResultNameLabel",_revFilter,"#FFFFFF"); labelInit(_baseMax,_MAX_BASE_X,_MAX_BASE_Y,_PARAM_W,_PARAM_H,"right",_PARA_MIN_SIZE,"ResultLabel"); markInit(_baseMaxMark,_MAX_BASE_X+_MARK_X_INTERVAL,_MAX_BASE_Y+_MARK_Y_INTERVAL); // labelInit(_addMax,_MAX_ADD_X,_MAX_ADD_Y,_PARAM_W,_PARAM_H,"right",_PARAM_SIZE,"ResultLabel"); var i:int; for ( i = 0; i < WeaponCard.PARAM_NUM; i++) { labelInit(_newBaseParams[i],_BASE_NEW_X,_BASE_Y_LIST[i],_PARAM_W,_PARAM_H,"right",_PARA_BIG_SIZE,"ResultLabel"); labelInit(_diffBaseParams[i],_BASE_DIFF_X,_BASE_DIFF_Y_LIST[i],_PARAM_W,_PARAM_H,"right",_PARA_MIN_SIZE,"ResultLabel"); markInit(_diffBaseParamMarks[i],_BASE_DIFF_X+_MARK_X_INTERVAL,_BASE_DIFF_Y_LIST[i]+_MARK_Y_INTERVAL); labelInit(_newAddParams[i],_ADD_NEW_X,_ADD_Y_LIST[i],_PARAM_W,_PARAM_H,"right",_PARA_MIN_SIZE,"ResultLabel"); labelInit(_diffAddParams[i],_ADD_DIFF_X,_ADD_DIFF_Y_LIST[i],_PARAM_W,_PARAM_H,"right",_PARA_MIN_SIZE,"ResultLabel"); markInit(_diffAddParamMarks[i],_ADD_DIFF_X+_MARK_X_INTERVAL,_ADD_DIFF_Y_LIST[i]+_MARK_Y_INTERVAL); labelInit(_maxAddParams[i],_ADD_MAX_X,_ADD_MAX_Y_LIST[i],_PARAM_W,_PARAM_H,"right",_PARA_MIN_SIZE,"ResultLabel"); labelInit(_maxDiffAddParams[i],_ADD_MAX_DIFF_X,_ADD_MAX_DIFF_Y_LIST[i],_PARAM_W,_PARAM_H,"right",_PARA_MIN_SIZE,"ResultLabel"); markInit(_maxDiffAddParamMarks[i],_ADD_MAX_DIFF_X+_MARK_X_INTERVAL,_ADD_MAX_DIFF_Y_LIST[i]+_MARK_Y_INTERVAL); labelInit(_totalParams[i],_TOTAL_X,_TOTAL_Y_LIST[i],_PARAM_W,_PARAM_H,"right",_PARA_BIG_SIZE,"ResultLabel"); } for (i = 0; i < _passiveName.length; i++) { labelInit(_passiveName[i],_PSV_NAME_X,_PSV_Y+i*_PSV_INTERVAL,_PSV_NAME_W,_PSV_NAME_H,"left",_PSV_NAME_SIZE,"ResultNameLabel",_revFilter,"#FFFFFF"); labelInit(_passiveCnt[i],_PSV_CNT_X,_PSV_Y+i*_PSV_INTERVAL,_PARAM_W,_PARAM_H,"right",_PARAM_SIZE,"ResultLabel"); labelInit(_passiveCntUp[i],_PSV_CNT_UP_X,_PSV_Y+i*_PSV_INTERVAL,_PARAM_W,_PARAM_H,"right",_PARAM_SIZE,"ResultLabel"); markInit(_passiveCntUpMarks[i],_PSV_CNT_UP_X+_MARK_X_INTERVAL,_PSV_Y+i*_PSV_INTERVAL+_MARK_Y_INTERVAL); textInit(_passiveCaption[i],_PSV_CAPTION_X,_PSV_CAPTION_Y+i*_PSV_INTERVAL,_PSV_CAPTION_W,_PSV_CAPTION_H,"left",_PSV_CAPTION_SIZE,"CharaCardFeatInfoLabel"); } } private function labelInit(l:Label,x:int,y:int,w:int,h:int,align:String,size:int,style:String,filters:Array=null,color:String=""):void { l.x = x; l.y = y; l.width = w; l.height = h; if (style != "") { l.styleName = style; } if (filters) { l.filters = filters; } l.setStyle("textAlign",align); l.setStyle("fontSize",size); if (color != "") { l.setStyle("color",color); } l.mouseEnabled = false; l.mouseChildren = false; _container.addChild(l); } private function textInit(t:Text,x:int,y:int,w:int,h:int,align:String,size:int,style:String,filters:Array=null):void { t.x = x; t.y = y; t.width = w; t.height = h; if (style != "") { t.styleName = style; } if (filters) { t.filters = filters; } t.setStyle("textAlign",align); t.setStyle("fontSize",size); t.mouseEnabled = false; t.mouseChildren = false; _container.addChild(t); } private function markInit(mark:CombineResultMarkImage,x:int,y:int):void { mark.x = x; mark.y = y; mark.visible = false; mark.mouseEnabled = false; mark.mouseChildren = false; _container.addChild(mark); } // 後始末処理 public override function final():void { RemoveChild.all(_container); RemoveChild.apply(_container); RemoveChild.all(_expContainer); RemoveChild.apply(_expContainer); } // 表示設定 public function setLabel():void { var wc:WeaponCard = WeaponCard(WeaponCardInventory.getInventory(Combine.instance.resultCardInvId).card); _name.text = wc.name; if (Const.CHARA_GROUP_NAME.hasOwnProperty(wc.restriction[0])) { _restriction.text = Const.CHARA_GROUP_NAME[wc.restriction[0]] + _TRANS_RESTRICTION; } else if (wc.restriction[0].split("|")[0] != "") { var names:Array = []; var name_tmp:String = ""; wc.restriction.forEach(function(item:*, index:int, ary:Array):void{ name_tmp = Const.CHARACTOR_NAME[item].replace(/\s*\(.+\)$/, ""); if (names.indexOf(name_tmp) < 0) { names.push(name_tmp); } }); _restriction.text = names.join() + _TRANS_RESTRICTION; } else { _restriction.text = ""; } weaponImageInit(wc.image); _baseMax.text = wc.baseMax.toString(); markCheck(_baseMaxMark,_combine.prevBaseMax,wc.baseMax); _addMax.text = wc.addMax.toString(); var i:int; var diff:int; for ( i = 0; i < WeaponCard.PARAM_NUM; i++) { _newBaseParams[i].text = wc.getBaseParamIdx(i).toString(); diff = Math.abs(wc.getBaseParamIdx(i) - _combine.getPrevBaseParamIdx(i)); _diffBaseParams[i].text = (diff > 0) ? diff.toString() : ""; markCheck(_diffBaseParamMarks[i],_combine.getPrevBaseParamIdx(i),wc.getBaseParamIdx(i)); _newAddParams[i].text = wc.getAddParamIdx(i); diff = Math.abs(wc.getAddParamIdx(i) - _combine.getPrevAddParamIdx(i)); _diffAddParams[i].text = (diff > 0) ? diff.toString() : ""; markCheck(_diffAddParamMarks[i],_combine.getPrevAddParamIdx(i),wc.getAddParamIdx(i)); _maxAddParams[i].text = wc.addMaxParam; diff = Math.abs(wc.addMaxParam - _combine.prevAddMax); _maxDiffAddParams[i].text = (diff > 0) ? diff.toString() : ""; markCheck(_maxDiffAddParamMarks[i],_combine.prevAddMax,wc.addMaxParam); _totalParams[i].text = wc.getBaseParamIdx(i) + wc.getAddParamIdx(i); } _resultExp.setLabel(); var weaponPassiveNum:int = wc.weaponPassiveNum; var passiveList:Array = []; var passiveNum:int = wc.passiveNum; var prevPassiveSkills:Vector.<Object> = _combine.prevPassiveSkills; // スロット枠を先に設定 for (i = 0; i < CombineResultImage.SKILL_SLOT_NUM; i++) { if (i < weaponPassiveNum) { _resultImage.uniqSkillSlotShow(); } else if (i < wc.passiveNumMax + weaponPassiveNum) { _resultImage.skillSlotShow(i); } } for (i = 0; i < wc.passiveId.length; i++) { var prevUseCnt:int = 0; for (var j:int =0; j < prevPassiveSkills.length; j++) { if (wc.passiveId[i] == prevPassiveSkills[j]["id"]) { prevUseCnt = prevPassiveSkills[j]["cnt"]; //break; } } var passive:PassiveSkill = PassiveSkill.ID(wc.passiveId[i]); var newUseCnt:int = 0; if (i < weaponPassiveNum) { newUseCnt = 0; } else { var psvIdx:int = i - weaponPassiveNum; newUseCnt = (wc.getUseCnt(psvIdx)>0) ? wc.getUseCnt(psvIdx) : 0; } passiveList.push({"name":passive.name,"caption":passive.caption,"newCnt":newUseCnt,"prevCnt":prevUseCnt}); } for (i = 0; i < _passiveName.length; i++) { if (passiveList[i]) { _passiveName[i].text = passiveList[i]["name"]; if (i < weaponPassiveNum) { _passiveCnt[i].text = Const.OVER_HP_STR; _passiveCntUp[i].text = ""; } else { if (passiveList[i]["newCnt"] > 0) { _passiveCnt[i].text = passiveList[i]["newCnt"]; var cntUp:int = Math.abs(passiveList[i]["newCnt"] - passiveList[i]["prevCnt"]); _passiveCntUp[i].text = (cntUp > 0) ? cntUp.toString() : ""; markCheck(_passiveCntUpMarks[i],passiveList[i]["prevCnt"],passiveList[i]["newCnt"],true); } else { _passiveCnt[i].text = ""; _passiveCntUp[i].text = ""; } } _passiveCaption[i].text = passiveList[i]["caption"].slice(getCaptionStartIndex(passiveList[i]["caption"])).replace(/\|/, "\n"); } else { _passiveName[i].text = ""; _passiveCnt[i].text = ""; _passiveCntUp[i].text = ""; _passiveCaption[i].text = ""; } } _prevClip = new WeaponCardClip(_combine.prevWeaponCard); _prevClip.x = _CLIP_X; _prevClip.y = _PREV_CLIP_Y; _newClip = new WeaponCardClip(wc); _newClip.x = _CLIP_X; _newClip.y = _NEW_CLIP_Y; } // キャプション本文の開始インデックスを返す private function getCaptionStartIndex(s:String):int { if (s.charAt(0) != "[") return 0; var cnt:int = 0; for (var i:int = 0; i < s.length; i++) { if (s.charAt(i) == "[") { cnt += 1; } else if (s.charAt(i) == "]") { cnt -= 1; if (cnt == 0 && i < s.length - 1) return i + 1; } } return 0; } private function markCheck(mark:CombineResultMarkImage,prevParam:int,newParam:int,isPassive:Boolean=false):void { var diff:int = newParam - prevParam; mark.visible = true; if (isPassive) { if (diff > 0) { mark.type = CombineResultMarkImage.MARK_TYPE_PLUS; } else { mark.visible = false; } } else { if (diff > 0) { mark.type = CombineResultMarkImage.MARK_TYPE_UP; } else if (diff < 0) { mark.type = CombineResultMarkImage.MARK_TYPE_DOWN; } else { mark.visible = false; } } } private function weaponImageInit(image:String):void { log.writeLog(log.LV_DEBUG, this, "imageinitialize", image); if (_weaponImage) { _weaponImage.getHideThread().start(); _weaponImage = null; } _weaponImage = new WeaponCardImage(image); _weaponImage.x = _IMAGE_X; _weaponImage.y = _IMAGE_Y; _weaponImage.getShowThread(_container).start(); } // リセット private function resetAll():void { log.writeLog (log.LV_DEBUG,this,"resetAll"); _name.text = ""; _restriction.text = ""; if (_weaponImage) { _weaponImage.getHideThread().start(); _weaponImage = null; } _baseMax.text = ""; _baseMaxMark.visible = false; _addMax.text = ""; var i:int; for ( i = 0; i < WeaponCard.PARAM_NUM; i++) { _newBaseParams[i].text = ""; _diffBaseParams[i].text = ""; _diffBaseParamMarks[i].visible = false; _newAddParams[i].text = ""; _diffAddParams[i].text = ""; _diffAddParamMarks[i].visible = false; _maxAddParams[i].text = ""; _maxDiffAddParams[i].text = ""; _maxDiffAddParamMarks[i].visible = false; _totalParams[i].text = ""; } for (i = 0; i < _passiveName.length; i++) { _passiveName[i].text = ""; _passiveCnt[i].text = ""; _passiveCntUp[i].text = ""; _passiveCntUpMarks[i].visible = false; _passiveCaption[i].text = ""; } _resultImage.skillSlotAllHide(); if (_prevClip) { _prevClip.getHideThread().start(); _prevClip = null; } if (_newClip) { _newClip.getHideThread().start(); _newClip = null; } } private function levelUpAndChangePrm(wc:WeaponCard):void { log.writeLog(log.LV_FATAL, this, "levelUpAndChangePrm"); var title:String = _TRANS_LVUP_TITLE + "&" + _TRANS_CHANGE_TITLE; var text:String = _TRANS_LVUP_LEVEL.replace("__LV__",(wc.level - _combine.prevLevel).toString()); text += "\n" + _TRANS_CHANGE_EXPL.replace("__TXT__",_restriction.text); text += _TRANS_LVUP_PARAM.replace("__PRM__",((wc.level - _combine.prevLevel)+WeaponCard.RESTRICTION_SET_ADD_PARAM).toString()); text += _TRANS_CHANGE_PARAM.replace("__PRM__",WeaponCard.RESTRICTION_SET_ADD_PARAM.toString()); // パッシブセット数が変化 if (wc.passiveNumMax > _combine.prevPassiveNumMax) { text += _TRANS_LVUP_PSV_NUM.replace("__NUM__",(wc.passiveNumMax - _combine.prevPassiveNumMax).toString()); } Alerter.showWithSize(text,title,0x4,null,clickHandler,150,500); } private function levelUp(wc:WeaponCard):void { log.writeLog(log.LV_FATAL, this, "levelUp"); var title:String = _TRANS_LVUP_TITLE; var text:String = _TRANS_LVUP_LEVEL.replace("__LV__",(wc.level - _combine.prevLevel).toString()); text += _TRANS_LVUP_PARAM.replace("__PRM__",(wc.level - _combine.prevLevel).toString()); // パッシブセット数が変化 if (wc.passiveNumMax > _combine.prevPassiveNumMax) { text += _TRANS_LVUP_PSV_NUM.replace("__NUM__",(wc.passiveNumMax - _combine.prevPassiveNumMax).toString()); } Alerter.showWithSize(text,title,0x4,null,clickHandler,150,500); } private function changeParam(wc:WeaponCard):void { log.writeLog(log.LV_FATAL, this, "changeParam"); var title:String = _TRANS_CHANGE_TITLE; var text:String = _TRANS_CHANGE_EXPL.replace("__TXT__",_restriction.text); text += _TRANS_CHANGE_PARAM.replace("__PRM__",WeaponCard.RESTRICTION_SET_ADD_PARAM.toString()); text += _TRANS_CHANGE_PRM_MAX.replace("__PRM__",WeaponCard.RESTRICTION_SET_ADD_PARAM.toString()); Alerter.showWithSize(text,title,0x4,null,clickHandler,150,500); } private function clickHandler(e:Event):void { _resultExp.hideLvUpImage(); setMouse(true); } private function getLevelUpThread():Thread { var wc:WeaponCard = WeaponCard(WeaponCardInventory.getInventory(Combine.instance.resultCardInvId).card); var sExec:SerialExecutor = new SerialExecutor(); if ((!_combine.prevIsCharaSpecial && wc.isCharaSpecial) && wc.level > _combine.prevLevel) { sExec.addThread(new ClousureThread(levelUpAndChangePrm,[wc])); } else if (wc.level > _combine.prevLevel) { sExec.addThread(new ClousureThread(levelUp,[wc])); } else if (!_combine.prevIsCharaSpecial && wc.isCharaSpecial) { sExec.addThread(new ClousureThread(changeParam,[wc])); } else { sExec.addThread(new ClousureThread(setMouse,[true])); } return sExec; } // 表示処理 public function show():Thread { setLabel(); var sExec:SerialExecutor = new SerialExecutor(); var pExec:ParallelExecutor = new ParallelExecutor(); pExec.addThread(_prevClip.getShowThread(_container)); pExec.addThread(_newClip.getShowThread(_container)); sExec.addThread(pExec); sExec.addThread(new BeTweenAS3Thread(_container, {alpha:1.0}, {alpha:0.0}, 0.5 / Unlight.SPEED, BeTweenAS3Thread.EASE_OUT_SINE)); sExec.addThread(_resultExp.getShowThread(_expContainer)); sExec.addThread(_resultExp.getMoveThread()); sExec.addThread(getLevelUpThread()); return sExec; } // 非表示処理 public function hide():void { _resultExp.getHideThread().start(); mouseEnabled = false; resetAll(); _container.alpha = 0.0; _container.visible = false; } // okButton public function get okBtn():SimpleButton { return _resultImage.ok; } public override function set alpha(a:Number):void { _container.alpha = a; } public override function set visible(f:Boolean):void { _container.visible = f; } private function setMouse(f:Boolean):void { mouseEnabled = f; } public override function set mouseEnabled(f:Boolean):void { _container.mouseEnabled = f; _container.mouseChildren = f; } } }
package net.psykosoft.psykopaint2.paint.signals { import org.osflash.signals.Signal; public class RequestPaintRootViewRemovalSignal extends Signal { public function RequestPaintRootViewRemovalSignal() { super(); } } }
// Urho3D editor hierarchy window handling const int ITEM_NONE = 0; const int ITEM_NODE = 1; const int ITEM_COMPONENT = 2; const int ITEM_UI_ELEMENT = 3; const uint NO_ITEM = M_MAX_UNSIGNED; const StringHash SCENE_TYPE("Scene"); const StringHash NODE_TYPE("Node"); const StringHash STATICMODEL_TYPE("StaticModel"); const StringHash ANIMATEDMODEL_TYPE("AnimatedModel"); const StringHash STATICMODELGROUP_TYPE("StaticModelGroup"); const StringHash SPLINEPATH_TYPE("SplinePath"); const StringHash CONSTRAINT_TYPE("Constraint"); const String NO_CHANGE(uint8(0)); const StringHash TYPE_VAR("Type"); const StringHash NODE_ID_VAR("NodeID"); const StringHash COMPONENT_ID_VAR("ComponentID"); const StringHash UI_ELEMENT_ID_VAR("UIElementID"); const StringHash DRAGDROPCONTENT_VAR("DragDropContent"); const StringHash[] ID_VARS = { StringHash(""), NODE_ID_VAR, COMPONENT_ID_VAR, UI_ELEMENT_ID_VAR }; Color nodeTextColor(1.0f, 1.0f, 1.0f); Color componentTextColor(0.7f, 1.0f, 0.7f); Window@ hierarchyWindow; ListView@ hierarchyList; bool showID = true; // UIElement does not have unique ID, so use a running number to generate a new ID each time an item is inserted into hierarchy list const uint UI_ELEMENT_BASE_ID = 1; uint uiElementNextID = UI_ELEMENT_BASE_ID; bool showInternalUIElement = false; bool showTemporaryObject = false; Array<uint> hierarchyUpdateSelections; Variant GetUIElementID(UIElement@ element) { Variant elementID = element.GetVar(UI_ELEMENT_ID_VAR); if (elementID.empty) { // Generate new ID elementID = uiElementNextID++; // Store the generated ID element.vars[UI_ELEMENT_ID_VAR] = elementID; } return elementID; } UIElement@ GetUIElementByID(const Variant&in id) { return id == UI_ELEMENT_BASE_ID ? editorUIElement : editorUIElement.GetChild(UI_ELEMENT_ID_VAR, id, true); } void CreateHierarchyWindow() { if (hierarchyWindow !is null) return; hierarchyWindow = LoadEditorUI("UI/EditorHierarchyWindow.xml"); hierarchyList = hierarchyWindow.GetChild("HierarchyList"); ui.root.AddChild(hierarchyWindow); int height = Min(ui.root.height - 60, 500); hierarchyWindow.SetSize(300, height); hierarchyWindow.SetPosition(35, 100); hierarchyWindow.opacity = uiMaxOpacity; hierarchyWindow.BringToFront(); UpdateHierarchyItem(editorScene); // Set selection to happen on click end, so that we can drag nodes to the inspector without resetting the inspector view hierarchyList.selectOnClickEnd = true; // Set drag & drop target mode on the node list background, which is used to parent nodes back to the root node hierarchyList.contentElement.dragDropMode = DD_TARGET; hierarchyList.scrollPanel.dragDropMode = DD_TARGET; SubscribeToEvent(hierarchyWindow.GetChild("CloseButton", true), "Released", "HideHierarchyWindow"); SubscribeToEvent(hierarchyWindow.GetChild("ExpandButton", true), "Released", "ExpandCollapseHierarchy"); SubscribeToEvent(hierarchyWindow.GetChild("CollapseButton", true), "Released", "ExpandCollapseHierarchy"); SubscribeToEvent(hierarchyWindow.GetChild("ResetButton", true), "Released", "CollapseHierarchy"); SubscribeToEvent(hierarchyWindow.GetChild("ShowID", true), "Toggled", "HandleShowID"); SubscribeToEvent(hierarchyList, "SelectionChanged", "HandleHierarchyListSelectionChange"); SubscribeToEvent(hierarchyList, "ItemDoubleClicked", "HandleHierarchyListDoubleClick"); SubscribeToEvent(hierarchyList, "ItemClicked", "HandleHierarchyItemClick"); SubscribeToEvent("DragDropTest", "HandleDragDropTest"); SubscribeToEvent("DragDropFinish", "HandleDragDropFinish"); SubscribeToEvent(editorScene, "NodeAdded", "HandleNodeAdded"); SubscribeToEvent(editorScene, "NodeRemoved", "HandleNodeRemoved"); SubscribeToEvent(editorScene, "ComponentAdded", "HandleComponentAdded"); SubscribeToEvent(editorScene, "ComponentRemoved", "HandleComponentRemoved"); SubscribeToEvent(editorScene, "NodeNameChanged", "HandleNodeNameChanged"); SubscribeToEvent(editorScene, "NodeEnabledChanged", "HandleNodeEnabledChanged"); SubscribeToEvent(editorScene, "ComponentEnabledChanged", "HandleComponentEnabledChanged"); SubscribeToEvent("TemporaryChanged", "HandleTemporaryChanged"); } bool ToggleHierarchyWindow() { if (hierarchyWindow.visible == false) ShowHierarchyWindow(); else HideHierarchyWindow(); return true; } void ShowHierarchyWindow() { hierarchyWindow.visible = true; hierarchyWindow.BringToFront(); } void HideHierarchyWindow() { hierarchyWindow.visible = false; } void ExpandCollapseHierarchy(StringHash eventType, VariantMap& eventData) { Button@ button = eventData["Element"].GetPtr(); bool enable = button.name == "ExpandButton"; CheckBox@ checkBox = hierarchyWindow.GetChild("AllCheckBox", true); bool all = checkBox.checked; checkBox.checked = false; // Auto-reset Array<uint> selections = hierarchyList.selections; for (uint i = 0; i < selections.length; ++i) hierarchyList.Expand(selections[i], enable, all); } void EnableExpandCollapseButtons(bool enable) { String[] buttons = { "ExpandButton", "CollapseButton", "AllCheckBox" }; for (uint i = 0; i < buttons.length; ++i) { UIElement@ element = hierarchyWindow.GetChild(buttons[i], true); element.enabled = enable; element.children[0].color = enable ? normalTextColor : nonEditableTextColor; } } void UpdateHierarchyItem(Serializable@ serializable, bool clear = false) { if (clear) { // Remove the current selection before updating the list item (in turn trigger an update on the attribute editor) hierarchyList.ClearSelection(); // Clear copybuffer when whole window refreshed sceneCopyBuffer.Clear(); uiElementCopyBuffer.Clear(); } // In case of item's parent is not found in the hierarchy list then the item will be inserted at the list root level Serializable@ parent; switch (GetType(serializable)) { case ITEM_NODE: parent = cast<Node>(serializable).parent; break; case ITEM_COMPONENT: parent = cast<Component>(serializable).node; break; case ITEM_UI_ELEMENT: parent = cast<UIElement>(serializable).parent; break; default: break; } UIElement@ parentItem = hierarchyList.items[GetListIndex(parent)]; UpdateHierarchyItem(GetListIndex(serializable), serializable, parentItem); } uint UpdateHierarchyItem(uint itemIndex, Serializable@ serializable, UIElement@ parentItem) { // Whenever we're updating, disable layout update to optimize speed hierarchyList.contentElement.DisableLayoutUpdate(); if (serializable is null) { hierarchyList.RemoveItem(itemIndex); hierarchyList.contentElement.EnableLayoutUpdate(); hierarchyList.contentElement.UpdateLayout(); return itemIndex; } int itemType = GetType(serializable); Variant id = GetID(serializable, itemType); // Remove old item if exists if (itemIndex < hierarchyList.numItems && MatchID(hierarchyList.items[itemIndex], id, itemType)) hierarchyList.RemoveItem(itemIndex); Text@ text = Text(); hierarchyList.InsertItem(itemIndex, text, parentItem); text.style = "FileSelectorListText"; if (serializable.type == SCENE_TYPE || serializable is editorUIElement) // The root node (scene) and editor's root UIElement cannot be moved by drag and drop text.dragDropMode = DD_TARGET; else // Internal UIElement is not able to participate in drag and drop action text.dragDropMode = itemType == ITEM_UI_ELEMENT && cast<UIElement>(serializable).internal ? DD_DISABLED : DD_SOURCE_AND_TARGET; // Advance the index for the child items if (itemIndex == M_MAX_UNSIGNED) itemIndex = hierarchyList.numItems; else ++itemIndex; String iconType = serializable.typeName; if (serializable is editorUIElement) iconType = "Root" + iconType; IconizeUIElement(text, iconType); SetID(text, serializable, itemType); switch (itemType) { case ITEM_NODE: { Node@ node = cast<Node>(serializable); text.text = GetNodeTitle(node); text.color = nodeTextColor; SetIconEnabledColor(text, node.enabled); // Update components first for (uint i = 0; i < node.numComponents; ++i) { Component@ component = node.components[i]; if (showTemporaryObject || !component.temporary) AddComponentItem(itemIndex++, component, text); } // Then update child nodes recursively for (uint i = 0; i < node.numChildren; ++i) { Node@ childNode = node.children[i]; if (showTemporaryObject || !childNode.temporary) itemIndex = UpdateHierarchyItem(itemIndex, childNode, text); } break; } case ITEM_COMPONENT: { Component@ component = cast<Component>(serializable); text.text = GetComponentTitle(component); text.color = componentTextColor; SetIconEnabledColor(text, component.enabledEffective); break; } case ITEM_UI_ELEMENT: { UIElement@ element = cast<UIElement>(serializable); text.text = GetUIElementTitle(element); SetIconEnabledColor(text, element.visible); // Update child elements recursively for (uint i = 0; i < element.numChildren; ++i) { UIElement@ childElement = element.children[i]; if ((showInternalUIElement || !childElement.internal) && (showTemporaryObject || !childElement.temporary)) itemIndex = UpdateHierarchyItem(itemIndex, childElement, text); } break; } default: break; } // Re-enable layout update (and do manual layout) now hierarchyList.contentElement.EnableLayoutUpdate(); hierarchyList.contentElement.UpdateLayout(); return itemIndex; } void UpdateHierarchyItemText(uint itemIndex, bool iconEnabled, const String&in textTitle = NO_CHANGE) { Text@ text = hierarchyList.items[itemIndex]; if (text is null) return; SetIconEnabledColor(text, iconEnabled); if (textTitle != NO_CHANGE) text.text = textTitle; } void AddComponentItem(uint compItemIndex, Component@ component, UIElement@ parentItem) { Text@ text = Text(); hierarchyList.InsertItem(compItemIndex, text, parentItem); text.style = "FileSelectorListText"; text.vars[TYPE_VAR] = ITEM_COMPONENT; text.vars[NODE_ID_VAR] = component.node.id; text.vars[COMPONENT_ID_VAR] = component.id; text.text = GetComponentTitle(component); text.color = componentTextColor; text.dragDropMode = DD_SOURCE_AND_TARGET; IconizeUIElement(text, component.typeName); SetIconEnabledColor(text, component.enabledEffective); } int GetType(Serializable@ serializable) { if (cast<Node>(serializable) !is null) return ITEM_NODE; else if (cast<Component>(serializable) !is null) return ITEM_COMPONENT; else if (cast<UIElement>(serializable) !is null) return ITEM_UI_ELEMENT; else return ITEM_NONE; } void SetID(Text@ text, Serializable@ serializable, int itemType = ITEM_NONE) { // If item type is not provided, auto detect it if (itemType == ITEM_NONE) itemType = GetType(serializable); text.vars[TYPE_VAR] = itemType; text.vars[ID_VARS[itemType]] = GetID(serializable, itemType); // Set node ID as drag and drop content for node ID editing if (itemType == ITEM_NODE) text.vars[DRAGDROPCONTENT_VAR] = String(text.vars[NODE_ID_VAR].GetUInt()); switch (itemType) { case ITEM_COMPONENT: text.vars[NODE_ID_VAR] = cast<Component>(serializable).node.id; break; case ITEM_UI_ELEMENT: // Subscribe to UI-element events SubscribeToEvent(serializable, "NameChanged", "HandleElementNameChanged"); SubscribeToEvent(serializable, "VisibleChanged", "HandleElementVisibilityChanged"); SubscribeToEvent(serializable, "Resized", "HandleElementAttributeChanged"); SubscribeToEvent(serializable, "Positioned", "HandleElementAttributeChanged"); break; default: break; } } uint GetID(Serializable@ serializable, int itemType = ITEM_NONE) { // If item type is not provided, auto detect it if (itemType == ITEM_NONE) itemType = GetType(serializable); switch (itemType) { case ITEM_NODE: return cast<Node>(serializable).id; case ITEM_COMPONENT: return cast<Component>(serializable).id; case ITEM_UI_ELEMENT: return GetUIElementID(cast<UIElement>(serializable)).GetUInt(); } return M_MAX_UNSIGNED; } bool MatchID(UIElement@ element, const Variant&in id, int itemType) { return element.GetVar(TYPE_VAR).GetInt() == itemType && element.GetVar(ID_VARS[itemType]) == id; } uint GetListIndex(Serializable@ serializable) { if (serializable is null) return NO_ITEM; int itemType = GetType(serializable); Variant id = GetID(serializable, itemType); uint numItems = hierarchyList.numItems; for (uint i = 0; i < numItems; ++i) { if (MatchID(hierarchyList.items[i], id, itemType)) return i; } return NO_ITEM; } UIElement@ GetListUIElement(uint index) { UIElement@ item = hierarchyList.items[index]; if (item is null) return null; // Get the text item's ID and use it to retrieve the actual UIElement the text item is associated to return GetUIElementByID(GetUIElementID(item)); } Node@ GetListNode(uint index) { UIElement@ item = hierarchyList.items[index]; if (item is null) return null; return editorScene.GetNode(item.vars[NODE_ID_VAR].GetUInt()); } Component@ GetListComponent(uint index) { UIElement@ item = hierarchyList.items[index]; return GetListComponent(item); } Component@ GetListComponent(UIElement@ item) { if (item is null) return null; if (item.vars[TYPE_VAR].GetInt() != ITEM_COMPONENT) return null; return editorScene.GetComponent(item.vars[COMPONENT_ID_VAR].GetUInt()); } uint GetComponentListIndex(Component@ component) { if (component is null) return NO_ITEM; uint numItems = hierarchyList.numItems; for (uint i = 0; i < numItems; ++i) { UIElement@ item = hierarchyList.items[i]; if (item.vars[TYPE_VAR].GetInt() == ITEM_COMPONENT && item.vars[COMPONENT_ID_VAR].GetUInt() == component.id) return i; } return NO_ITEM; } String GetUIElementTitle(UIElement@ element) { String ret; // Only top level UI-element has this variable String modifiedStr = element.GetVar(MODIFIED_VAR).GetBool() ? "*" : ""; ret = (element.name.empty ? element.typeName : element.name) + modifiedStr + " [" + GetUIElementID(element).ToString() + "]"; if (element.temporary) ret += " (Temp)"; return ret; } String GetNodeTitle(Node@ node) { String ret; if (node.name.empty) ret = node.typeName; else ret = node.name; if (showID) { if (node.id >= FIRST_LOCAL_ID) ret += " (Local " + String(node.id) + ")"; else ret += " (" + String(node.id) + ")"; if (node.temporary) ret += " (Temp)"; } return ret; } String GetComponentTitle(Component@ component) { String ret = component.typeName; if (showID) { if (component.id >= FIRST_LOCAL_ID) ret += " (Local)"; if (component.temporary) ret += " (Temp)"; } return ret; } void SelectNode(Node@ node, bool multiselect) { if (node is null && !multiselect) { hierarchyList.ClearSelection(); return; } lastSelectedNode = node; uint index = GetListIndex(node); uint numItems = hierarchyList.numItems; if (index < numItems) { // Expand the node chain now if (!multiselect || !hierarchyList.IsSelected(index)) { // Go in the parent chain up to make sure the chain is expanded Node@ current = node; do { hierarchyList.Expand(GetListIndex(current), true); current = current.parent; } while (current !is null); } // This causes an event to be sent, in response we set the node/component selections, and refresh editors if (!multiselect) hierarchyList.selection = index; else hierarchyList.ToggleSelection(index); } else if (!multiselect) hierarchyList.ClearSelection(); } void SelectComponent(Component@ component, bool multiselect) { if (component is null && !multiselect) { hierarchyList.ClearSelection(); return; } Node@ node = component.node; if (node is null && !multiselect) { hierarchyList.ClearSelection(); return; } uint nodeIndex = GetListIndex(node); uint componentIndex = GetComponentListIndex(component); uint numItems = hierarchyList.numItems; if (nodeIndex < numItems && componentIndex < numItems) { // Expand the node chain now if (!multiselect || !hierarchyList.IsSelected(componentIndex)) { // Go in the parent chain up to make sure the chain is expanded Node@ current = node; do { hierarchyList.Expand(GetListIndex(current), true); current = current.parent; } while (current !is null); } // This causes an event to be sent, in response we set the node/component selections, and refresh editors if (!multiselect) hierarchyList.selection = componentIndex; else hierarchyList.ToggleSelection(componentIndex); } else if (!multiselect) hierarchyList.ClearSelection(); } void SelectUIElement(UIElement@ element, bool multiselect) { uint index = GetListIndex(element); uint numItems = hierarchyList.numItems; if (index < numItems) { // Expand the node chain now if (!multiselect || !hierarchyList.IsSelected(index)) { // Go in the parent chain up to make sure the chain is expanded UIElement@ current = element; do { hierarchyList.Expand(GetListIndex(current), true); current = current.parent; } while (current !is null); } if (!multiselect) hierarchyList.selection = index; else hierarchyList.ToggleSelection(index); } else if (!multiselect) hierarchyList.ClearSelection(); } // Find the first selected StaticModel/AtimatedModel component or node with it Model@ FindFirstSelectedModel() { for (uint i = 0; i < selectedComponents.length; ++i) { // Get SM, but also works well for AnimatedModel StaticModel@ sm = cast<StaticModel>(selectedComponents[i]); if (sm !is null && sm.model !is null) return sm.model; } for (uint i = 0; i < selectedNodes.length; ++i) { for (uint j = 0; j < selectedNodes[i].numComponents; ++j) { StaticModel@ sm = cast<StaticModel>(selectedNodes[i].components[j]); if (sm !is null && sm.model !is null) return sm.model; } } return null; } void UpdateModelInfo(Model@ model) { if (model is null) { modelInfoText.text = ""; return; } String infoStr = "Model: " + model.name; infoStr += "\n Morphs: " + model.numMorphs; for (uint g = 0; g < model.numGeometries; ++g) { infoStr += "\n Geometry " + g + "\n Lods: " + model.numGeometryLodLevels[g]; } modelInfoText.text = infoStr; } void HandleHierarchyListSelectionChange() { if (inSelectionModify) return; ClearSceneSelection(); ClearUIElementSelection(); Array<uint> indices = hierarchyList.selections; // Enable Expand/Collapse button when there is selection EnableExpandCollapseButtons(indices.length > 0); for (uint i = 0; i < indices.length; ++i) { uint index = indices[i]; UIElement@ item = hierarchyList.items[index]; int type = item.vars[TYPE_VAR].GetInt(); if (type == ITEM_COMPONENT) { Component@ comp = GetListComponent(index); if (comp !is null) selectedComponents.Push(comp); } else if (type == ITEM_NODE) { Node@ node = GetListNode(index); if (node !is null) selectedNodes.Push(node); } else if (type == ITEM_UI_ELEMENT) { UIElement@ element = GetListUIElement(index); if (element !is null && element !is editorUIElement) selectedUIElements.Push(element); } } // If only one node/UIElement selected, use it for editing if (selectedNodes.length == 1) editNode = selectedNodes[0]; if (selectedUIElements.length == 1) editUIElement = selectedUIElements[0]; // If selection contains only components, and they have a common node, use it for editing if (selectedNodes.empty && !selectedComponents.empty) { Node@ commonNode; for (uint i = 0; i < selectedComponents.length; ++i) { if (i == 0) commonNode = selectedComponents[i].node; else { if (selectedComponents[i].node !is commonNode) commonNode = null; } } editNode = commonNode; } UpdateModelInfo(FindFirstSelectedModel()); // Now check if the component(s) can be edited. If many selected, must have same type or have same edit node if (!selectedComponents.empty) { if (editNode is null) { StringHash compType = selectedComponents[0].type; bool sameType = true; for (uint i = 1; i < selectedComponents.length; ++i) { if (selectedComponents[i].type != compType) { sameType = false; break; } } if (sameType) editComponents = selectedComponents; } else { editComponents = selectedComponents; numEditableComponentsPerNode = selectedComponents.length; } } // If just nodes selected, and no components, show as many matching components for editing as possible if (!selectedNodes.empty && selectedComponents.empty && selectedNodes[0].numComponents > 0) { uint count = 0; for (uint j = 0; j < selectedNodes[0].numComponents; ++j) { StringHash compType = selectedNodes[0].components[j].type; bool sameType = true; for (uint i = 1; i < selectedNodes.length; ++i) { if (selectedNodes[i].numComponents <= j || selectedNodes[i].components[j].type != compType) { sameType = false; break; } } if (sameType) { ++count; for (uint i = 0; i < selectedNodes.length; ++i) editComponents.Push(selectedNodes[i].components[j]); } } if (count > 1) numEditableComponentsPerNode = count; } if (selectedNodes.empty && editNode !is null) editNodes.Push(editNode); else { editNodes = selectedNodes; // Cannot multi-edit on scene and node(s) together as scene and node do not share identical attributes, // editing via gizmo does not make too much sense either if (editNodes.length > 1 && editNodes[0] is editorScene) editNodes.Erase(0); } if (selectedUIElements.empty && editUIElement !is null) editUIElements.Push(editUIElement); else editUIElements = selectedUIElements; PositionGizmo(); UpdateAttributeInspector(); UpdateCameraPreview(); } void HandleHierarchyListDoubleClick(StringHash eventType, VariantMap& eventData) { UIElement@ item = eventData["Item"].GetPtr(); int type = item.vars[TYPE_VAR].GetInt(); // Locate nodes from the scene by double-clicking if (type == ITEM_NODE) { Node@ node = editorScene.GetNode(item.vars[NODE_ID_VAR].GetUInt()); LocateNode(node); } bool isExpanded = hierarchyList.IsExpanded(hierarchyList.selection); if (!isExpanded && eventData["Button"].GetInt() == MOUSEB_LEFT) { isExpanded = !isExpanded; hierarchyList.Expand(hierarchyList.selection, isExpanded, false); } } void HandleHierarchyItemClick(StringHash eventType, VariantMap& eventData) { if (eventData["Button"].GetInt() != MOUSEB_RIGHT) return; UIElement@ uiElement = eventData["Item"].GetPtr(); int selectionIndex = eventData["Selection"].GetInt(); Array<UIElement@> actions; int type = uiElement.vars[TYPE_VAR].GetInt(); // Adds left clicked items to selection which is not normal listview behavior if (type == ITEM_COMPONENT || type == ITEM_NODE) { if (input.keyDown[KEY_LSHIFT]) hierarchyList.AddSelection(selectionIndex); else { hierarchyList.ClearSelection(); hierarchyList.AddSelection(selectionIndex); } } if (type == ITEM_COMPONENT) { Component@ targetComponent = editorScene.GetComponent(uiElement.vars[COMPONENT_ID_VAR].GetUInt()); if (targetComponent is null) return; actions.Push(CreateContextMenuItem("Copy", "HandleHierarchyContextCopy")); actions.Push(CreateContextMenuItem("Cut", "HandleHierarchyContextCut")); actions.Push(CreateContextMenuItem("Delete", "HandleHierarchyContextDelete")); actions.Push(CreateContextMenuItem("Paste", "HandleHierarchyContextPaste")); actions.Push(CreateContextMenuItem("Enable/disable", "HandleHierarchyContextEnableDisable")); /* actions.Push(CreateBrowserFileActionMenu("Edit", "HandleBrowserEditResource", file)); */ } else if (type == ITEM_NODE) { actions.Push(CreateContextMenuItem("Create Replicated Node", "HandleHierarchyContextCreateReplicatedNode")); actions.Push(CreateContextMenuItem("Create Local Node", "HandleHierarchyContextCreateLocalNode")); actions.Push(CreateContextMenuItem("Duplicate", "HandleHierarchyContextDuplicate")); actions.Push(CreateContextMenuItem("Copy", "HandleHierarchyContextCopy")); actions.Push(CreateContextMenuItem("Cut", "HandleHierarchyContextCut")); actions.Push(CreateContextMenuItem("Delete", "HandleHierarchyContextDelete")); actions.Push(CreateContextMenuItem("Paste", "HandleHierarchyContextPaste")); actions.Push(CreateContextMenuItem("Reset to default", "HandleHierarchyContextResetToDefault")); actions.Push(CreateContextMenuItem("Reset position", "HandleHierarchyContextResetPosition")); actions.Push(CreateContextMenuItem("Reset rotation", "HandleHierarchyContextResetRotation")); actions.Push(CreateContextMenuItem("Reset scale", "HandleHierarchyContextResetScale")); actions.Push(CreateContextMenuItem("Enable/disable", "HandleHierarchyContextEnableDisable")); actions.Push(CreateContextMenuItem("Unparent", "HandleHierarchyContextUnparent")); } else if (type == ITEM_UI_ELEMENT) { // close ui element actions.Push(CreateContextMenuItem("Close UI-Layout", "HandleHierarchyContextUIElementCloseUILayout")); actions.Push(CreateContextMenuItem("Close all UI-layouts", "HandleHierarchyContextUIElementCloseAllUILayouts")); } if (actions.length > 0) ActivateContextMenu(actions); } void HandleDragDropTest(StringHash eventType, VariantMap& eventData) { UIElement@ source = eventData["Source"].GetPtr(); UIElement@ target = eventData["Target"].GetPtr(); int itemType; eventData["Accept"] = TestDragDrop(source, target, itemType); } void HandleDragDropFinish(StringHash eventType, VariantMap& eventData) { UIElement@ source = eventData["Source"].GetPtr(); UIElement@ target = eventData["Target"].GetPtr(); int itemType = ITEM_NONE; bool accept = TestDragDrop(source, target, itemType); eventData["Accept"] = accept; if (!accept) return; // Resource browser if (source !is null && source.GetVar(TEXT_VAR_RESOURCE_TYPE).GetInt() > 0) { int type = source.GetVar(TEXT_VAR_RESOURCE_TYPE).GetInt(); BrowserFile@ browserFile = GetBrowserFileFromId(source.vars[TEXT_VAR_FILE_ID].GetUInt()); if (browserFile is null) return; Component@ createdComponent; if (itemType == ITEM_NODE) { Node@ targetNode = editorScene.GetNode(target.vars[NODE_ID_VAR].GetUInt()); if (targetNode is null) return; if (type == RESOURCE_TYPE_PREFAB) { LoadNode(browserFile.GetFullPath(), targetNode); } else if(type == RESOURCE_TYPE_SCRIPTFILE) { // TODO: not sure what to do here. lots of choices. } else if(type == RESOURCE_TYPE_MODEL) { CreateModelWithStaticModel(browserFile.resourceKey, targetNode); return; } else if (type == RESOURCE_TYPE_PARTICLEEFFECT) { if (browserFile.extension == "xml") { ParticleEffect@ effect = cache.GetResource("ParticleEffect", browserFile.resourceKey); if (effect is null) return; ParticleEmitter@ emitter = targetNode.CreateComponent("ParticleEmitter"); emitter.effect = effect; createdComponent = emitter; } } else if (type == RESOURCE_TYPE_2D_PARTICLE_EFFECT) { if (browserFile.extension == "xml") { Resource@ effect = cache.GetResource("ParticleEffect2D", browserFile.resourceKey); if (effect is null) return; ResourceRef effectRef; effectRef.type = effect.type; effectRef.name = effect.name; Component@ emitter = targetNode.CreateComponent("ParticleEmitter2D"); emitter.SetAttribute("Particle Effect", Variant(effectRef)); createdComponent = emitter; } } } else if (itemType == ITEM_COMPONENT) { Component@ targetComponent = editorScene.GetComponent(target.vars[COMPONENT_ID_VAR].GetUInt()); if (targetComponent is null) return; if (type == RESOURCE_TYPE_MATERIAL) { StaticModel@ model = cast<StaticModel>(targetComponent); if (model is null) return; AssignMaterial(model, browserFile.resourceKey); } else if (type == RESOURCE_TYPE_MODEL) { StaticModel@ staticModel = cast<StaticModel>(targetComponent); if (staticModel is null) return; AssignModel(staticModel, browserFile.resourceKey); } } else { LineEdit@ text = cast<LineEdit>(target); if (text is null) return; text.text = browserFile.resourceKey; VariantMap data(); data["Element"] = text; data["Text"] = text.text; text.SendEvent("TextFinished", data); } if (createdComponent !is null) { CreateLoadedComponent(createdComponent); } return; } if (itemType == ITEM_NODE) { Node@ targetNode = editorScene.GetNode(target.vars[NODE_ID_VAR].GetUInt()); Array<Node@> sourceNodes = GetMultipleSourceNodes(source); if (sourceNodes.length > 0) { if (input.qualifierDown[QUAL_CTRL] && sourceNodes.length == 1) SceneReorder(sourceNodes[0], targetNode); else { // If target is null, parent to scene if (targetNode is null) targetNode = editorScene; if (sourceNodes.length > 1) SceneChangeParent(sourceNodes[0], sourceNodes, targetNode); else SceneChangeParent(sourceNodes[0], targetNode); } // Focus the node at its new position in the list which in turn should trigger a refresh in attribute inspector FocusNode(sourceNodes[0]); } } else if (itemType == ITEM_UI_ELEMENT) { UIElement@ sourceElement = GetUIElementByID(source.vars[UI_ELEMENT_ID_VAR].GetUInt()); UIElement@ targetElement = GetUIElementByID(target.vars[UI_ELEMENT_ID_VAR].GetUInt()); // If target is null, cannot proceed if (targetElement is null) return; if (input.qualifierDown[QUAL_CTRL]) { if (!UIElementReorder(sourceElement, targetElement)) return; } else { if (!UIElementChangeParent(sourceElement, targetElement)) return; } // Focus the element at its new position in the list which in turn should trigger a refresh in attribute inspector FocusUIElement(sourceElement); } else if (itemType == ITEM_COMPONENT) { Component@ targetComponent = editorScene.GetComponent(target.vars[COMPONENT_ID_VAR].GetUInt()); Array<Node@> sourceNodes = GetMultipleSourceNodes(source); if (input.qualifierDown[QUAL_CTRL] && sourceNodes.length == 1) { // Reorder components within node Component@ sourceComponent = editorScene.GetComponent(source.vars[COMPONENT_ID_VAR].GetUInt()); SceneReorder(sourceComponent, targetComponent); } else { if (targetComponent !is null && sourceNodes.length > 0) { // Drag node to StaticModelGroup to make it an instance StaticModelGroup@ smg = cast<StaticModelGroup>(targetComponent); if (smg !is null) { // Save undo action EditAttributeAction action; uint attrIndex = GetAttributeIndex(smg, "Instance Nodes"); Variant oldIDs = smg.attributes[attrIndex]; for (uint i = 0; i < sourceNodes.length; ++i) smg.AddInstanceNode(sourceNodes[i]); action.Define(smg, attrIndex, oldIDs); SaveEditAction(action); SetSceneModified(); UpdateAttributeInspector(false); } // Drag node to SplinePath to make it a control point SplinePath@ spline = cast<SplinePath>(targetComponent); if (spline !is null) { // Save undo action EditAttributeAction action; uint attrIndex = GetAttributeIndex(spline, "Control Points"); Variant oldIDs = spline.attributes[attrIndex]; for (uint i = 0; i < sourceNodes.length; ++i) spline.AddControlPoint(sourceNodes[i]); action.Define(spline, attrIndex, oldIDs); SaveEditAction(action); SetSceneModified(); UpdateAttributeInspector(false); } // Drag a node to Constraint to make it the remote end of the constraint Constraint@ constraint = cast<Constraint>(targetComponent); RigidBody@ rigidBody = sourceNodes[0].GetComponent("RigidBody"); if (constraint !is null && rigidBody !is null) { // Save undo action EditAttributeAction action; uint attrIndex = GetAttributeIndex(constraint, "Other Body NodeID"); Variant oldID = constraint.attributes[attrIndex]; constraint.otherBody = rigidBody; action.Define(constraint, attrIndex, oldID); SaveEditAction(action); SetSceneModified(); UpdateAttributeInspector(false); } } } } } Array<Node@> GetMultipleSourceNodes(UIElement@ source) { Array<Node@> nodeList; Node@ node = editorScene.GetNode(source.vars[NODE_ID_VAR].GetUInt()); if (node !is null) nodeList.Push(node); // Handle additional selected children from a ListView if (source.parent !is null && source.parent.typeName == "HierarchyContainer") { ListView@ listView_ = cast<ListView>(source.parent.parent.parent); if (listView_ is null) return nodeList; bool sourceIsSelected = false; for (uint i = 0; i < listView_.selectedItems.length; ++i) { if (listView_.selectedItems[i] is source) { sourceIsSelected = true; break; } } if (sourceIsSelected) { for (uint i = 0; i < listView_.selectedItems.length; ++i) { UIElement@ item_ = listView_.selectedItems[i]; // The source item is already added if (item_ is source) continue; if (item_.vars[TYPE_VAR] == ITEM_NODE) { Node@ n = editorScene.GetNode(item_.vars[NODE_ID_VAR].GetUInt()); if (n !is null) nodeList.Push(n); } } } } return nodeList; } bool TestDragDrop(UIElement@ source, UIElement@ target, int& itemType) { int targetItemType = target.GetVar(TYPE_VAR).GetInt(); if (targetItemType == ITEM_NODE) { Node@ sourceNode; Node@ targetNode; Variant variant = source.GetVar(NODE_ID_VAR); if (!variant.empty) sourceNode = editorScene.GetNode(variant.GetUInt()); variant = target.GetVar(NODE_ID_VAR); if (!variant.empty) targetNode = editorScene.GetNode(variant.GetUInt()); Array<Node@> sourceNodes = GetMultipleSourceNodes(source); if (sourceNode !is null && targetNode !is null) { itemType = ITEM_NODE; // Ctrl pressed: reorder if (input.qualifierDown[QUAL_CTRL] && sourceNodes.length == 1) { // Must be within the same parent if (sourceNode.parent is null || sourceNode.parent !is targetNode.parent) return false; } // No ctrl: Reparent else { if (sourceNode.parent is targetNode) return false; if (targetNode.parent is sourceNode) return false; } } // Resource browser if (sourceNode is null && targetNode !is null) { itemType = ITEM_NODE; int type = source.GetVar(TEXT_VAR_RESOURCE_TYPE).GetInt(); return type == RESOURCE_TYPE_PREFAB || type == RESOURCE_TYPE_SCRIPTFILE || type == RESOURCE_TYPE_MODEL || type == RESOURCE_TYPE_PARTICLEEFFECT || type == RESOURCE_TYPE_2D_PARTICLE_EFFECT; } return true; } else if (targetItemType == ITEM_UI_ELEMENT) { UIElement@ sourceElement; UIElement@ targetElement; Variant variant = source.GetVar(UI_ELEMENT_ID_VAR); if (!variant.empty) sourceElement = GetUIElementByID(variant.GetUInt()); variant = target.GetVar(UI_ELEMENT_ID_VAR); if (!variant.empty) targetElement = GetUIElementByID(variant.GetUInt()); if (sourceElement !is null && targetElement !is null) { itemType = ITEM_UI_ELEMENT; // Ctrl pressed: reorder if (input.qualifierDown[QUAL_CTRL]) { // Must be within the same parent if (sourceElement.parent is null || sourceElement.parent !is targetElement.parent) return false; } // No ctrl: reparent else { if (sourceElement.parent is targetElement) return false; if (targetElement.parent is sourceElement) return false; } } return true; } else if (targetItemType == ITEM_COMPONENT) { Node@ sourceNode; Component@ sourceComponent; Component@ targetComponent; Variant variant = source.GetVar(NODE_ID_VAR); if (!variant.empty) sourceNode = editorScene.GetNode(variant.GetUInt()); variant = target.GetVar(COMPONENT_ID_VAR); if (!variant.empty) targetComponent = editorScene.GetComponent(variant.GetUInt()); variant = source.GetVar(COMPONENT_ID_VAR); if (!variant.empty) sourceComponent = editorScene.GetComponent(variant.GetUInt()); Array<Node@> sourceNodes = GetMultipleSourceNodes(source); itemType = ITEM_COMPONENT; if (input.qualifierDown[QUAL_CTRL] && sourceNodes.length == 1) { // Reorder components within node if (sourceComponent !is null && targetComponent !is null && sourceComponent.node is targetComponent.node) return true; } else { // Dragging of nodes to StaticModelGroup, SplinePath or Constraint if (sourceNode !is null && targetComponent !is null && (targetComponent.type == STATICMODELGROUP_TYPE || targetComponent.type == CONSTRAINT_TYPE || targetComponent.type == SPLINEPATH_TYPE)) return true; // Resource browser int type = source.GetVar(TEXT_VAR_RESOURCE_TYPE).GetInt(); if (targetComponent.type == STATICMODEL_TYPE || targetComponent.type == ANIMATEDMODEL_TYPE) return type == RESOURCE_TYPE_MATERIAL || type == RESOURCE_TYPE_MODEL; } return false; } else if (source.vars.Contains(TEXT_VAR_RESOURCE_TYPE)) // only testing resource browser ui elements { int type = source.GetVar(TEXT_VAR_RESOURCE_TYPE).GetInt(); // Test against resource pickers LineEdit@ lineEdit = cast<LineEdit>(target); if (lineEdit !is null) { StringHash resourceType = GetResourceTypeFromPickerLineEdit(lineEdit); if (resourceType == StringHash("Material") && type == RESOURCE_TYPE_MATERIAL) return true; else if (resourceType == StringHash("Model") && type == RESOURCE_TYPE_MODEL) return true; else if (resourceType == StringHash("Animation") && type == RESOURCE_TYPE_ANIMATION) return true; } } return true; } StringHash GetResourceTypeFromPickerLineEdit(UIElement@ lineEdit) { Array<Serializable@>@ targets = GetAttributeEditorTargets(lineEdit); if (!targets.empty) { resourcePickIndex = lineEdit.vars["Index"].GetUInt(); resourcePickSubIndex = lineEdit.vars["SubIndex"].GetUInt(); AttributeInfo info = targets[0].attributeInfos[resourcePickIndex]; StringHash resourceType; if (info.type == VAR_RESOURCEREF) return targets[0].attributes[resourcePickIndex].GetResourceRef().type; else if (info.type == VAR_RESOURCEREFLIST) return targets[0].attributes[resourcePickIndex].GetResourceRefList().type; else if (info.type == VAR_VARIANTVECTOR) return targets[0].attributes[resourcePickIndex].GetVariantVector()[resourcePickSubIndex].GetResourceRef().type; } return StringHash(); } void FocusNode(Node@ node) { uint index = GetListIndex(node); hierarchyList.selection = index; } void FocusComponent(Component@ component) { uint index = GetComponentListIndex(component); hierarchyList.selection = index; } void FocusUIElement(UIElement@ element) { uint index = GetListIndex(element); hierarchyList.selection = index; } void CreateBuiltinObject(const String& name) { Node@ newNode = editorScene.CreateChild(name, REPLICATED); // Set the new node a certain distance from the camera newNode.position = GetNewNodePosition(); StaticModel@ object = newNode.CreateComponent("StaticModel"); object.model = cache.GetResource("Model", "Models/" + name + ".mdl"); // Create an undo action for the create CreateNodeAction action; action.Define(newNode); SaveEditAction(action); SetSceneModified(); FocusNode(newNode); } bool CheckHierarchyWindowFocus() { // When we do edit operations based on key shortcuts, make sure the hierarchy list is focused return ui.focusElement is hierarchyList || ui.focusElement is null; } bool CheckForExistingGlobalComponent(Node@ node, const String&in typeName) { if (typeName != "Octree" && typeName != "PhysicsWorld" && typeName != "DebugRenderer") return false; else return node.HasComponent(typeName); } void HandleNodeAdded(StringHash eventType, VariantMap& eventData) { if (suppressSceneChanges) return; Node@ node = eventData["Node"].GetPtr(); if (showTemporaryObject || !node.temporary) UpdateHierarchyItem(node); } void HandleNodeRemoved(StringHash eventType, VariantMap& eventData) { if (suppressSceneChanges) return; Node@ node = eventData["Node"].GetPtr(); uint index = GetListIndex(node); UpdateHierarchyItem(index, null, null); } void HandleComponentAdded(StringHash eventType, VariantMap& eventData) { if (suppressSceneChanges) return; // Insert the newly added component at last component position but before the first child node position of the parent node Node@ node = eventData["Node"].GetPtr(); Component@ component = eventData["Component"].GetPtr(); if (showTemporaryObject || !component.temporary) { uint nodeIndex = GetListIndex(node); if (nodeIndex != NO_ITEM) { uint index = node.numChildren > 0 ? GetListIndex(node.children[0]) : M_MAX_UNSIGNED; UpdateHierarchyItem(index, component, hierarchyList.items[nodeIndex]); } } } void HandleComponentRemoved(StringHash eventType, VariantMap& eventData) { if (suppressSceneChanges) return; Component@ component = eventData["Component"].GetPtr(); uint index = GetComponentListIndex(component); if (index != NO_ITEM) hierarchyList.RemoveItem(index); } void HandleNodeNameChanged(StringHash eventType, VariantMap& eventData) { if (suppressSceneChanges) return; Node@ node = eventData["Node"].GetPtr(); UpdateHierarchyItemText(GetListIndex(node), node.enabled, GetNodeTitle(node)); } void HandleNodeEnabledChanged(StringHash eventType, VariantMap& eventData) { if (suppressSceneChanges) return; Node@ node = eventData["Node"].GetPtr(); UpdateHierarchyItemText(GetListIndex(node), node.enabled); attributesDirty = true; } void HandleComponentEnabledChanged(StringHash eventType, VariantMap& eventData) { if (suppressSceneChanges) return; Component@ component = eventData["Component"].GetPtr(); UpdateHierarchyItemText(GetComponentListIndex(component), component.enabledEffective); attributesDirty = true; } void HandleUIElementAdded(StringHash eventType, VariantMap& eventData) { if (suppressUIElementChanges) return; UIElement@ element = eventData["Element"].GetPtr(); if ((showInternalUIElement || !element.internal) && (showTemporaryObject || !element.temporary)) UpdateHierarchyItem(element); } void HandleUIElementRemoved(StringHash eventType, VariantMap& eventData) { if (suppressUIElementChanges) return; UIElement@ element = eventData["Element"].GetPtr(); UpdateHierarchyItem(GetListIndex(element), null, null); } void HandleElementNameChanged(StringHash eventType, VariantMap& eventData) { if (suppressUIElementChanges) return; UIElement@ element = eventData["Element"].GetPtr(); UpdateHierarchyItemText(GetListIndex(element), element.visible, GetUIElementTitle(element)); } void HandleElementVisibilityChanged(StringHash eventType, VariantMap& eventData) { if (suppressUIElementChanges) return; UIElement@ element = eventData["Element"].GetPtr(); UpdateHierarchyItemText(GetListIndex(element), element.visible); } void HandleElementAttributeChanged(StringHash eventType, VariantMap& eventData) { // Do not refresh the attribute inspector while the attribute is being edited via the attribute-editors if (suppressUIElementChanges || inEditAttribute) return; UIElement@ element = eventData["Element"].GetPtr(); for (uint i = 0; i < editUIElements.length; ++i) { if (editUIElements[i] is element) attributesDirty = true; } } void HandleTemporaryChanged(StringHash eventType, VariantMap& eventData) { if (suppressSceneChanges || suppressUIElementChanges) return; Serializable@ serializable = cast<Serializable>(GetEventSender()); Node@ node = cast<Node>(serializable); if (node !is null && node.scene is editorScene) { if (showTemporaryObject) UpdateHierarchyItemText(GetListIndex(node), node.enabled); else if (!node.temporary && GetListIndex(node) == NO_ITEM) UpdateHierarchyItem(node); else if (node.temporary) UpdateHierarchyItem(GetListIndex(node), null, null); return; } Component@ component = cast<Component>(serializable); if (component !is null && component.node !is null && component.node.scene is editorScene) { node = component.node; if (showTemporaryObject) UpdateHierarchyItemText(GetComponentListIndex(component), node.enabled); else if (!component.temporary && GetComponentListIndex(component) == NO_ITEM) { uint nodeIndex = GetListIndex(node); if (nodeIndex != NO_ITEM) { uint index = node.numChildren > 0 ? GetListIndex(node.children[0]) : M_MAX_UNSIGNED; UpdateHierarchyItem(index, component, hierarchyList.items[nodeIndex]); } } else if (component.temporary) { uint index = GetComponentListIndex(component); if (index != NO_ITEM) hierarchyList.RemoveItem(index); } return; } UIElement@ element = cast<UIElement>(serializable); if (element !is null) { if (showTemporaryObject) UpdateHierarchyItemText(GetListIndex(element), element.visible); else if (!element.temporary && GetListIndex(element) == NO_ITEM) UpdateHierarchyItem(element); else if (element.temporary) UpdateHierarchyItem(GetListIndex(element), null, null); return; } } // Hierarchy window edit functions bool Undo() { if (undoStackPos > 0) { --undoStackPos; // Undo commands in reverse order for (int i = int(undoStack[undoStackPos].actions.length - 1); i >= 0; --i) undoStack[undoStackPos].actions[i].Undo(); } return true; } bool Redo() { if (undoStackPos < undoStack.length) { // Redo commands in same order as stored for (uint i = 0; i < undoStack[undoStackPos].actions.length; ++i) undoStack[undoStackPos].actions[i].Redo(); ++undoStackPos; } return true; } bool Cut() { if (CheckHierarchyWindowFocus()) { bool ret = true; if (!selectedNodes.empty || !selectedComponents.empty) ret = ret && SceneCut(); // Not mutually exclusive if (!selectedUIElements.empty) ret = ret && UIElementCut(); return ret; } return false; } bool Duplicate() { if (CheckHierarchyWindowFocus()) { bool ret = true; if (!selectedNodes.empty || !selectedComponents.empty) ret = ret && (selectedNodes.empty || selectedComponents.empty ? SceneDuplicate() : false); // Node and component is mutually exclusive for copy action // Not mutually exclusive if (!selectedUIElements.empty) ret = ret && UIElementDuplicate(); return ret; } return false; } bool Copy() { if (CheckHierarchyWindowFocus()) { bool ret = true; if (!selectedNodes.empty || !selectedComponents.empty) ret = ret && (selectedNodes.empty || selectedComponents.empty ? SceneCopy() : false); // Node and component is mutually exclusive for copy action // Not mutually exclusive if (!selectedUIElements.empty) ret = ret && UIElementCopy(); return ret; } return false; } bool Paste() { if (CheckHierarchyWindowFocus()) { bool ret = true; if (editNode !is null && !sceneCopyBuffer.empty) ret = ret && ScenePaste(); // Not mutually exclusive if (editUIElement !is null && !uiElementCopyBuffer.empty) ret = ret && UIElementPaste(); return ret; } return false; } bool BlenderModeDelete() { if (ui.focusElement is null) { Array<UIElement@> actions; actions.Push(CreateContextMenuItem("Delete?", "HandleBlenderModeDelete")); actions.Push(CreateContextMenuItem("Cancel", "HandleEmpty")); if (actions.length > 0) { ActivateContextMenu(actions); return true; } } return false; } bool Delete() { if (CheckHierarchyWindowFocus()) { bool ret = true; if (!selectedNodes.empty || !selectedComponents.empty) ret = ret && SceneDelete(); // Not mutually exclusive if (!selectedUIElements.empty) ret = ret && UIElementDelete(); return ret; } return false; } bool SelectAll() { if (CheckHierarchyWindowFocus()) { if (!selectedNodes.empty || !selectedComponents.empty) return SceneSelectAll(); else if (!selectedUIElements.empty || hierarchyList.items[GetListIndex(editorUIElement)].selected) return UIElementSelectAll(); else return SceneSelectAll(); // If nothing is selected yet, fall back to scene select all } return false; } bool DeselectAll() { if (CheckHierarchyWindowFocus()) { BeginSelectionModify(); hierarchyList.ClearSelection(); EndSelectionModify(); return true; } return false; } bool ResetToDefault() { if (CheckHierarchyWindowFocus()) { bool ret = true; if (!selectedNodes.empty || !selectedComponents.empty) ret = ret && (selectedNodes.empty || selectedComponents.empty ? SceneResetToDefault() : false); // Node and component is mutually exclusive for reset-to-default action // Not mutually exclusive if (!selectedUIElements.empty) ret = ret && UIElementResetToDefault(); return ret; } return false; } void ClearEditActions() { undoStack.Clear(); undoStackPos = 0; } void SaveEditAction(EditAction@ action) { // Create a group with 1 action EditActionGroup group; group.actions.Push(action); SaveEditActionGroup(group); } void SaveEditActionGroup(EditActionGroup@ group) { if (group.actions.empty) return; // Truncate the stack first to current pos undoStack.Resize(undoStackPos); undoStack.Push(group); ++undoStackPos; // Limit maximum undo steps if (undoStack.length > MAX_UNDOSTACK_SIZE) { undoStack.Erase(0); --undoStackPos; } } void BeginSelectionModify() { // A large operation on selected nodes is about to begin. Disable intermediate selection updates inSelectionModify = true; // Cursor shape reverts back to normal automatically after the large operation is completed ui.cursor.shape = CS_BUSY; } void EndSelectionModify() { // The large operation on selected nodes has ended. Update node/component selection now inSelectionModify = false; HandleHierarchyListSelectionChange(); } void HandleHierarchyContextCreateReplicatedNode() { CreateNode(REPLICATED); } void HandleHierarchyContextCreateLocalNode() { CreateNode(LOCAL); } void HandleHierarchyContextDuplicate() { Duplicate(); } void HandleHierarchyContextCopy() { Copy(); } void HandleHierarchyContextCut() { Cut(); } void HandleHierarchyContextDelete() { Delete(); } void HandleBlenderModeDelete() { Delete(); } void HandleEmpty() { //just doing nothing } void HandleHierarchyContextPaste() { Paste(); } void HandleHierarchyContextResetToDefault() { ResetToDefault(); } void HandleHierarchyContextResetPosition() { SceneResetPosition(); } void HandleHierarchyContextResetRotation() { SceneResetRotation(); } void HandleHierarchyContextResetScale() { SceneResetScale(); } void HandleHierarchyContextEnableDisable() { SceneToggleEnable(); } void HandleHierarchyContextUnparent() { SceneUnparent(); } void HandleHierarchyContextUIElementCloseUILayout() { CloseUILayout(); } void HandleHierarchyContextUIElementCloseAllUILayouts() { CloseAllUILayouts(); } void CollapseHierarchy() { Array<uint> oldSelections = hierarchyList.selections; Array<uint> selections = {0}; hierarchyList.SetSelections(selections); for (uint i = 0; i < selections.length; ++i) hierarchyList.Expand(selections[i], false, true); // only scene's scope expand by default hierarchyList.Expand(0, true, false); hierarchyList.SetSelections(oldSelections); } void CollapseHierarchy(StringHash eventType, VariantMap& eventData) { CollapseHierarchy(); } void HandleShowID(StringHash eventType, VariantMap& eventData) { CheckBox@ checkBox = eventData["Element"].GetPtr(); showID = checkBox.checked; UpdateHierarchyItem(editorScene, false); CollapseHierarchy(); }
/* Copyright (c) 2012 Josh Tynjala Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package feathers.core { import flash.utils.Dictionary; import flash.utils.describeType; import flash.utils.getDefinitionByName; import starling.display.DisplayObject; import starling.display.DisplayObjectContainer; import starling.events.Event; /** * Watches a container on the display list. As new display objects are * added, if they match a specific type, they will be passed to initializer * functions to set properties, call methods, or otherwise modify them. * Useful for initializing skins and styles on UI controls. * * <p>If a display object matches multiple types that have initializers, and * <code>exactTypeMatching</code> is disabled, the initializers will be * executed in order following the inheritance chain.</p> */ public class DisplayListWatcher { /** * Constructor. */ public function DisplayListWatcher(root:DisplayObjectContainer) { this.root = root; this.root.addEventListener(Event.ADDED, addedHandler); } /** * The minimum base class required before the AddedWatcher will check * to see if a particular display object has any initializers. */ public var requiredBaseClass:Class = FeathersControl; /** * Determines if only the object added should be processed or if its * children should be processed recursively. */ public var processRecursively:Boolean = true; /** * The root of the display list that is watched for added children. */ protected var root:DisplayObjectContainer; private var _initializerNoNameTypeMap:Dictionary = new Dictionary(true); private var _initializerNameTypeMap:Dictionary = new Dictionary(true); private var _initializerSuperTypeMap:Dictionary = new Dictionary(true); private var _initializerSuperTypes:Vector.<Class> = new <Class>[]; /** * Sets the initializer for a specific class. */ public function setInitializerForClass(type:Class, initializer:Function, withName:String = null):void { if(!withName) { this._initializerNoNameTypeMap[type] = initializer; return; } var nameTable:Object = this._initializerNameTypeMap[type]; if(!nameTable) { this._initializerNameTypeMap[type] = nameTable = {}; } nameTable[withName] = initializer; } /** * Sets an initializer for a specific class and any subclasses. This * option can potentially hurt performance, so use sparingly. */ public function setInitializerForClassAndSubclasses(type:Class, initializer:Function):void { const index:int = this._initializerSuperTypes.indexOf(type); if(index < 0) { this._initializerSuperTypes.push(type); } this._initializerSuperTypeMap[type] = initializer; } /** * If an initializer exists for a specific class, it will be returned. */ public function getInitializerForClass(type:Class, withName:String = null):Function { if(!withName) { return this._initializerNoNameTypeMap[type] as Function; } const nameTable:Object = this._initializerNameTypeMap[type]; if(!nameTable) { return null; } return nameTable[withName] as Function; } /** * If an initializer exists for a specific class and its subclasses, the initializer will be returned. */ public function getInitializerForClassAndSubclasses(type:Class):Function { return this._initializerSuperTypeMap[type]; } /** * If an initializer exists for a specific class, it will be removed * completely. */ public function clearInitializerForClass(type:Class, withName:String = null):void { if(!withName) { delete this._initializerNoNameTypeMap[type]; return; } const nameTable:Object = this._initializerNameTypeMap[type]; if(!nameTable) { return; } delete nameTable[withName]; return; } /** * If an initializer exists for a specific class and its subclasses, the * initializer will be removed completely. */ public function clearInitializerForClassAndSubclasses(type:Class):void { delete this._initializerSuperTypeMap[type]; const index:int = this._initializerSuperTypes.indexOf(type); if(index >= 0) { this._initializerSuperTypes.splice(index, 1); } } /** * @private */ protected function processAllInitializers(target:DisplayObject):void { const superTypeCount:int = this._initializerSuperTypes.length; for(var i:int = 0; i < superTypeCount; i++) { var type:Class = this._initializerSuperTypes[i]; if(target is type) { this.applyAllStylesForTypeFromMaps(target, type, this._initializerSuperTypeMap); } } type = Object(target).constructor; this.applyAllStylesForTypeFromMaps(target, type, this._initializerNoNameTypeMap, this._initializerNameTypeMap); } /** * @private */ protected function applyAllStylesForTypeFromMaps(target:DisplayObject, type:Class, map:Dictionary, nameMap:Dictionary = null):void { var initializer:Function; if(nameMap) { const nameTable:Object = nameMap[type]; if(nameTable) { if(target is FeathersControl) { const uiControl:FeathersControl = FeathersControl(target); for(var name:String in nameTable) { if(uiControl.nameList.contains(name)) { initializer = nameTable[name] as Function; if(initializer != null) { initializer(target); return; } } } } } } initializer = map[type] as Function; if(initializer != null) { initializer(target); } } /** * @private */ protected function addObject(target:DisplayObject):void { const targetAsRequiredBaseClass:DisplayObject = DisplayObject(target as requiredBaseClass); if(targetAsRequiredBaseClass) { this.processAllInitializers(target); } if(this.processRecursively) { const targetAsContainer:DisplayObjectContainer = target as DisplayObjectContainer; if(targetAsContainer) { const childCount:int = targetAsContainer.numChildren; for(var i:int = 0; i < childCount; i++) { var child:DisplayObject = targetAsContainer.getChildAt(i); this.addObject(child); } } } } /** * @private */ protected function addedHandler(event:Event):void { this.addObject(event.target as DisplayObject); } } }
package org.yellcorp.lib.video.events { public class VideoCodecID { public static const SORENSON_H263:int = 2; public static const SCREEN_VIDEO:int = 3; public static const VP6:int = 4; public static const VP6_ALPHA:int = 5; } }
// This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. function stringConcat() { var hello:String = "hello "; var world:String = "world"; print(hello + world); } stringConcat();
package net.psykosoft.psykopaint2.core.views.navigation { import flash.display.MovieClip; import net.psykosoft.psykopaint2.base.ui.components.PsykoLabel; public class LoadingView extends MovieClip { public var label:PsykoLabel; public function LoadingView() { super(); label.text = "LOADING"; stop(); this.gotoAndStop(int(Math.random()*this.totalFrames+1)); } override public function set visible( value:Boolean ):void { this.gotoAndStop(int(Math.random()*this.totalFrames+1)); super.visible = value; } } }
/* * _________ __ __ * _/ / / /____ / /________ ____ ____ ___ * _/ / / __/ -_) __/ __/ _ `/ _ `/ _ \/ _ \ * _/________/ \__/\__/\__/_/ \_,_/\_, /\___/_//_/ * /___/ * * Tetragon : Game Engine for multi-platform ActionScript projects. * http://www.tetragonengine.com/ - Copyright (C) 2012 Sascha Balkau * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package tetragon.core.constants { /** * A class that provides constant values for horizontal alignment of objects */ public final class HAlign { /** Left alignment. */ public static const LEFT:String = "left"; /** Centered alignement. */ public static const CENTER:String = "center"; /** Right alignment. */ public static const RIGHT:String = "right"; /** * Indicates whether the given alignment string is valid. * * @param hAlign * @return true or false */ public static function isValid(hAlign:String):Boolean { return hAlign == LEFT || hAlign == CENTER || hAlign == RIGHT; } } }
package kabam.rotmg.assets { import mx.core.ByteArrayAsset; [Embed(source="EmbeddedData_archbishopObjectsMenCXML.xml", mimeType="application/octet-stream")] public class EmbeddedData_archbishopObjectsMenCXML extends ByteArrayAsset { public function EmbeddedData_archbishopObjectsMenCXML() { super(); } } }
package com.framework.controller { import flash.display.MovieClip; import flash.display.Sprite; import flash.events.Event; import flash.events.MouseEvent; import flash.events.TimerEvent; import flash.utils.Timer; /** * @author suminc7 var menu : MenuController = new MenuController(); menu.push(mc); menu.init(menuOver, menuOut, menuClick); menu.setMenu(0); function menuOver(menu : Sprite, i : int) : void { TweenMax.to(menu, .6, {alpha:1}); } function menuOut(menu : Sprite, i : int) : void { TweenMax.to(menu, .6, {alpha:0}); } function menuClick(menu : Sprite = null, a : int = -1) : void { } */ public class MenuController extends Sprite { private var menuArr : Array = new Array(); private var time : Timer; private var i : int = -1; private var a : int = -1; private var overFunc : Function; private var outFunc : Function; private var clickFunc : Function; private var isKeep : Boolean; private var t : Number; public function MenuController() { addEventListener(Event.ADDED_TO_STAGE, initAddStage); addEventListener(Event.REMOVED_FROM_STAGE, initRemoveStage); } private function initAddStage(event : Event) : void { removeEventListener(Event.ADDED_TO_STAGE, initAddStage); } public function init(overFunc : Function, outFunc : Function, clickFunc : Function, isKeep : Boolean = true, t : Number = 300) : void { this.overFunc = overFunc; this.outFunc = outFunc; this.clickFunc = clickFunc; this.isKeep = isKeep; this.t = t; initTimer(); initMenu(); } private function initMenu() : void { for (var i : int = 0;i < menuArr.length;i++) { var menu : MovieClip = menuArr[i] as MovieClip; menu.buttonMode = true; menu.stop(); menu.addEventListener(MouseEvent.MOUSE_OVER, menuOver); menu.addEventListener(MouseEvent.MOUSE_OUT, menuOut); menu.addEventListener(MouseEvent.CLICK, menuClick); } } private function menuOver(event : MouseEvent) : void { time.reset(); menuOutStart(i); i = menuArr.indexOf(event.currentTarget); menuOverStart(i); } private function menuOut(event : MouseEvent) : void { time.start(); } private function menuClick(event : MouseEvent) : void { menuOutStart(i); menuOutStart(a); a = i = menuArr.indexOf(event.currentTarget); menuOverStart(a); menuClickStart(a); } private function initTimer() : void { time = new Timer(t, 1); time.addEventListener(TimerEvent.TIMER_COMPLETE, timerComplete); } private function timerComplete(event : TimerEvent) : void { menuOutStart(i); menuOverStart(a); i = a; } private function menuOverStart(i : int) : void { if (i != -1) { overFunc.call(null, menuArr[i], i); } } private function menuOutStart(i : int) : void { if (isKeep) { if (a != this.i && i != -1) { outFunc.call(null, menuArr[i], i); } } else { if (i != -1) { outFunc.call(null, menuArr[i], i); } } } private function menuClickStart(a : int) : void { clickFunc.call(null, menuArr[a], a); } public function push(menu : Sprite) : void { menuArr.push(menu); } public function setMenu(a : int) : void { i = -1; menuOutStart(this.a); menuOverStart(a); this.a = a; } private function initRemoveStage(event : Event) : void { menuArr = null; time.removeEventListener(TimerEvent.TIMER_COMPLETE, timerComplete); time = null; removeEventListener(Event.REMOVED_FROM_STAGE, initRemoveStage); } } }
package laya.debug.view.nodeInfo.views { import laya.debug.tools.ClassTool; import laya.debug.tools.DisControlTool; import laya.debug.tools.MathTools; import laya.debug.tools.RenderAnalyser; import laya.debug.view.nodeInfo.DebugInfoLayer; import laya.debug.view.nodeInfo.NodeConsts; import laya.debug.view.nodeInfo.menus.NodeMenu; import laya.debug.view.nodeInfo.nodetree.Rank; import laya.display.Sprite; import laya.events.Event; import laya.ui.List; /** * ... * @author ww */ public class RenderCostRankView extends UIViewBase { public function RenderCostRankView() { super(); } private static var _I:RenderCostRankView; public static function get I():RenderCostRankView { if (!_I) _I = new RenderCostRankView(); return _I; } public var view:Rank; public static var filterDebugNodes:Boolean = true; override public function createPanel():void { view = new Rank(); view.top = view.bottom = view.left = view.right = 0; addChild(view); //DisControlTool.setDragingItem(view.bg, view); //view.itemList.on(DebugTool.getMenuShowEvent(), this, onRightClick); NodeMenu.I.setNodeListAction(view.itemList); view.closeBtn.on(Event.CLICK, this, close); view.freshBtn.on(Event.CLICK, this, fresh); view.itemList.scrollBar.hide = true; view.autoUpdate.on(Event.CHANGE, this, onAutoUpdateChange); //dis = view; dis = this; view.itemList.array = []; onAutoUpdateChange(); fresh(); Laya.timer.once(5000, this, fresh); } private function onRightClick():void { var list:List; list = view.itemList; if (list.selectedItem) { var tarNode:Sprite; tarNode = list.selectedItem.path; NodeMenu.I.objRightClick(tarNode); } } private function onAutoUpdateChange():void { autoUpdate = view.autoUpdate.selected; } private function set autoUpdate(v:Boolean):void { Laya.timer.clear(this, fresh); if (v) { fresh(); Laya.timer.loop(NodeConsts.RenderCostMaxTime, this, fresh); } } public function fresh():void { view.title.text = "渲染用时排行("+NodeConsts.RenderCostMaxTime+"ms)"; var nodeDic:Object; nodeDic = RenderAnalyser.I.nodeDic; var key:String; var tNode:Sprite; var tData:Object; var dataList:Array; dataList = []; for (key in nodeDic) { tNode = nodeDic[key]; if (filterDebugNodes && DisControlTool.isInTree(DebugInfoLayer.I, tNode)) continue; if (RenderAnalyser.I.getTime(tNode) <= 0) continue; tData = { }; tData.time = RenderAnalyser.I.getTime(tNode); if (filterDebugNodes && tNode == Laya.stage) { tData.time-= RenderAnalyser.I.getTime(DebugInfoLayer.I); } tData.path = tNode; tData.label = ClassTool.getNodeClassAndName(tNode) + ":" + tData.time; dataList.push(tData); } dataList.sort(MathTools.sortByKey("time", true, true)); view.itemList.array = dataList; } } }
/* PureMVC MultiCore - Copyright(c) 2006-08 Futurescale, Inc., Some rights reserved. Your reuse is governed by the Creative Commons Attribution 3.0 United States License */ package org.puremvc.as3.multicore.patterns.observer { import org.puremvc.as3.multicore.interfaces.*; import org.puremvc.as3.multicore.patterns.facade.Facade; /** * A Base <code>INotifier</code> implementation. * * <P> * <code>MacroCommand, Command, Mediator</code> and <code>Proxy</code> * all have a need to send <code>Notifications</code>. <P> * <P> * The <code>INotifier</code> interface provides a common method called * <code>sendNotification</code> that relieves implementation code of * the necessity to actually construct <code>Notifications</code>.</P> * * <P> * The <code>Notifier</code> class, which all of the above mentioned classes * extend, provides an initialized reference to the <code>Facade</code> * Multiton, which is required for the convienience method * for sending <code>Notifications</code>, but also eases implementation as these * classes have frequent <code>Facade</code> interactions and usually require * access to the facade anyway.</P> * * <P> * NOTE: In the MultiCore version of the framework, there is one caveat to * notifiers, they cannot send notifications or reach the facade until they * have a valid multitonKey. * * The multitonKey is set: * * on a Command when it is executed by the Controller * * on a Mediator is registered with the View * * on a Proxy is registered with the Model. * * @see org.puremvc.as3.multicore.patterns.proxy.Proxy Proxy * @see org.puremvc.as3.multicore.patterns.facade.Facade Facade * @see org.puremvc.as3.multicore.patterns.mediator.Mediator Mediator * @see org.puremvc.as3.multicore.patterns.command.MacroCommand MacroCommand * @see org.puremvc.as3.multicore.patterns.command.SimpleCommand SimpleCommand */ public class Notifier implements INotifier { /** * Create and send an <code>INotification</code>. * * <P> * Keeps us from having to construct new INotification * instances in our implementation code. * @param notificationName the name of the notiification to send * @param body the body of the notification (optional) * @param type the type of the notification (optional) */ public function sendNotification( notificationName:String, body:Object=null, type:String=null ):void { if (facade != null) facade.sendNotification( notificationName, body, type ); } /** * Initialize this INotifier instance. * <P> * This is how a Notifier gets its multitonKey. * Calls to sendNotification or to access the * facade will fail until after this method * has been called.</P> * * <P> * Mediators, Commands or Proxies may override * this method in order to send notifications * or access the Multiton Facade instance as * soon as possible. They CANNOT access the facade * in their constructors, since this method will not * yet have been called.</P> * * @param key the multitonKey for this INotifier to use */ public function initializeNotifier( key:String ):void { multitonKey = key; } // Return the Multiton Facade instance protected function get facade():IFacade { if ( multitonKey == null ) throw Error( MULTITON_MSG ); return Facade.getInstance( multitonKey ); } // The Multiton Key for this app protected var multitonKey : String; // Message Constants protected const MULTITON_MSG : String = "multitonKey for this Notifier not yet initialized!"; } }
package view.image.shop { import flash.display.*; import flash.events.Event; import view.image.BaseImage; /** * ShopItemButton表示クラス * */ public class ShopMaster extends BaseImage { // HP表示元SWF [Embed(source="../../../../data/image/shop/shopmaster00.swf")] private var _Source:Class; /** * コンストラクタ * */ public function ShopMaster() { super(); } override protected function swfinit(event: Event): void { super.swfinit(event); initializePos(); mouseEnabled = false; mouseChildren = false; } override protected function get Source():Class { return _Source; } public function initializePos():void { } } }
package com.syndrome.sanguo.guide.config { import com.syndrome.sanguo.battle.CombatConsole; import com.syndrome.sanguo.guide.GuideSystem; import com.syndrome.sanguo.guide.func.GuideFunction; import flash.events.Event; import flash.utils.getDefinitionByName; import net.IProtocolhandler; public class CommandAdapter implements ICommandAdapter { public function CommandAdapter() { } private var guideFunction:GuideFunction = new GuideFunction(); public function run(command:String, param:Object, guideSystem:GuideSystem):void { var fun:Function; if(guideFunction.hasOwnProperty(command)) //函数库中存在这个函数 { fun = guideFunction[command]; } else { try { var clazz:Class = getDefinitionByName( "com.syndrome.sanguo.battle.mediator." + command ) as Class; fun = (new clazz() as IProtocolhandler).handle; } catch(error:Error) { throw(new Error("无法解析命令"+command)); } } fun(param); var delayFun:Function = function(event:Event):void { event.stopImmediatePropagation(); CombatConsole.getInstance().removeEventListener(CombatConsole.WAITING , delayFun); if(guideSystem.auto) { guideSystem.doNext(); } } CombatConsole.getInstance().addEventListener(CombatConsole.WAITING , delayFun); } } }
/* Feathers Copyright 2012-2021 Bowler Hat LLC. All Rights Reserved. This program is free software. You can redistribute and/or modify it in accordance with the terms of the accompanying license agreement. */ package feathers.controls { import feathers.core.FeathersControl; import feathers.core.IFeathersControl; import feathers.core.IMeasureDisplayObject; import feathers.core.ITextRenderer; import feathers.core.IValidating; import feathers.core.PopUpManager; import feathers.core.PropertyProxy; import feathers.data.IListCollection; import feathers.events.FeathersEventType; import feathers.layout.HorizontalAlign; import feathers.layout.VerticalLayout; import feathers.skins.IStyleProvider; import feathers.text.FontStylesSet; import feathers.utils.display.getDisplayObjectDepthFromStage; import feathers.utils.skins.resetFluidChildDimensionsForMeasurement; import flash.events.KeyboardEvent; import flash.ui.Keyboard; import starling.core.Starling; import starling.display.DisplayObject; import starling.events.Event; import starling.text.TextFormat; [Exclude(name="layout",kind="property")] [Exclude(name="footer",kind="property")] [Exclude(name="footerFactory",kind="property")] [Exclude(name="footerProperties",kind="property")] [Exclude(name="customFooterStyleName",kind="style")] [Exclude(name="createFooter",kind="method")] /** * A style name to add to the alert's button group sub-component. * Typically used by a theme to provide different styles to different alerts. * * <p>In the following example, a custom button group style name is * passed to the alert:</p> * * <listing version="3.0"> * alert.customButtonGroupStyleName = "my-custom-button-group";</listing> * * <p>In your theme, you can target this sub-component style name to * provide different styles than the default:</p> * * <listing version="3.0"> * getStyleProviderForClass( ButtonGroup ).setFunctionForStyleName( "my-custom-button-group", setCustomButtonGroupStyles );</listing> * * @default null * * @see #DEFAULT_CHILD_STYLE_NAME_BUTTON_GROUP * @see feathers.core.FeathersControl#styleNameList * @see #buttonGroupFactory */ [Style(name="customButtonGroupStyleName",type="String")] /** * A style name to add to the alert's message text renderer * sub-component. Typically used by a theme to provide different styles * to different alerts. * * <p>In the following example, a custom message style name is passed * to the alert:</p> * * <listing version="3.0"> * alert.customMessageStyleName = "my-custom-button-group";</listing> * * <p>In your theme, you can target this sub-component style name to * provide different styles than the default:</p> * * <listing version="3.0"> * getStyleProviderForClass( BitmapFontTextRenderer ).setFunctionForStyleName( "my-custom-message", setCustomMessageStyles );</listing> * * @default null * * @see #DEFAULT_CHILD_STYLE_NAME_MESSAGE * @see feathers.core.FeathersControl#styleNameList * @see #messageFactory */ [Style(name="customMessageStyleName",type="String")] /** * The font styles used to display the alert's message text when the * alert is disabled. * * <p>These styles will only apply to the alert's message. The header's * title font styles should be set directly on the header. The button * font styles should be set directly on the buttons.</p> * * <p>In the following example, the disabled font styles are customized:</p> * * <listing version="3.0"> * alert.disabledFontStyles = new TextFormat( "Helvetica", 20, 0x999999 );</listing> * * <p>Note: The <code>starling.text.TextFormat</code> class defines a * number of common font styles, but the text renderer being used may * support a larger number of ways to be customized. Use the * <code>messageFactory</code> to set more advanced styles on the * text renderer.</p> * * @default null * * @see http://doc.starling-framework.org/current/starling/text/TextFormat.html starling.text.TextFormat * @see #style:fontStyles */ [Style(name="disabledFontStyles",type="starling.text.TextFormat")] /** * The font styles used to display the alert's message text. * * <p>These styles will only apply to the alert's message. The header's * title font styles should be set directly on the header. The button * font styles should be set directly on the buttons.</p> * * <p>In the following example, the font styles are customized:</p> * * <listing version="3.0"> * alert.fontStyles = new TextFormat( "Helvetica", 20, 0xcc0000 );</listing> * * <p>Note: The <code>starling.text.TextFormat</code> class defines a * number of common font styles, but the text renderer being used may * support a larger number of ways to be customized. Use the * <code>messageFactory</code> to set more advanced styles.</p> * * @default null * * @see http://doc.starling-framework.org/current/starling/text/TextFormat.html starling.text.TextFormat * @see #style:disabledFontStyles */ [Style(name="fontStyles",type="starling.text.TextFormat")] /** * The space, in pixels, between the alert's icon and its message text * renderer. * * <p>In the following example, the gap is set to 20 pixels:</p> * * <listing version="3.0"> * alert.gap = 20;</listing> * * @default 0 */ [Style(name="gap",type="Number")] /** * The alert's optional icon content to display next to the text. * * <p>In the following example, the icon is privated:</p> * * <listing version="3.0"> * alert.icon = new Image( texture );</listing> * * @default null */ [Style(name="icon",type="starling.display.DisplayObject")] /** * Dispatched when the alert is closed. The <code>data</code> property of * the event object will contain the item from the <code>ButtonGroup</code> * data provider for the button that is triggered. If no button is * triggered, then the <code>data</code> property will be <code>null</code>. * * <p>The properties of the event object have the following values:</p> * <table class="innertable"> * <tr><th>Property</th><th>Value</th></tr> * <tr><td><code>bubbles</code></td><td>false</td></tr> * <tr><td><code>currentTarget</code></td><td>The Object that defines the * event listener that handles the event. For example, if you use * <code>myButton.addEventListener()</code> to register an event listener, * myButton is the value of the <code>currentTarget</code>.</td></tr> * <tr><td><code>data</code></td><td>null</td></tr> * <tr><td><code>target</code></td><td>The Object that dispatched the event; * it is not always the Object listening for the event. Use the * <code>currentTarget</code> property to always access the Object * listening for the event.</td></tr> * </table> * * @eventType starling.events.Event.CLOSE */ [Event(name="close",type="starling.events.Event")] /** * Displays a message in a modal pop-up with a title and a set of buttons. * * <p>In general, an <code>Alert</code> isn't instantiated directly. * Instead, you will typically call the static function * <code>Alert.show()</code>. This is not required, but it result in less * code and no need to manually manage calls to the <code>PopUpManager</code>.</p> * * <p>In the following example, an alert is shown when a <code>Button</code> * is triggered:</p> * * <listing version="3.0"> * button.addEventListener( Event.TRIGGERED, button_triggeredHandler ); * * function button_triggeredHandler( event:Event ):void * { * var alert:Alert = Alert.show( "This is an alert!", "Hello World", new ArrayCollection( * [ * { label: "OK" } * ])); * }</listing> * * @see ../../../help/alert.html How to use the Feathers Alert component * * @productversion Feathers 1.2.0 */ public class Alert extends Panel { /** * The default value added to the <code>styleNameList</code> of the header. * * @see feathers.core.FeathersControl#styleNameList */ public static const DEFAULT_CHILD_STYLE_NAME_HEADER:String = "feathers-alert-header"; /** * The default value added to the <code>styleNameList</code> of the button group. * * @see feathers.core.FeathersControl#styleNameList */ public static const DEFAULT_CHILD_STYLE_NAME_BUTTON_GROUP:String = "feathers-alert-button-group"; /** * The default value added to the <code>styleNameList</code> of the * message text renderer. * * @see feathers.core.FeathersControl#styleNameList * @see ../../../help/text-renderers.html Introduction to Feathers text renderers */ public static const DEFAULT_CHILD_STYLE_NAME_MESSAGE:String = "feathers-alert-message"; /** * Returns a new <code>Alert</code> instance when <code>Alert.show()</code> * is called. If one wishes to skin the alert manually, a custom factory * may be provided. * * <p>This function is expected to have the following signature:</p> * * <pre>function():Alert</pre> * * <p>The following example shows how to create a custom alert factory:</p> * * <listing version="3.0"> * Alert.alertFactory = function():Alert * { * var alert:Alert = new Alert(); * //set properties here! * return alert; * };</listing> * * @see #show() */ public static var alertFactory:Function = defaultAlertFactory; /** * Creates overlays for modal alerts. When this property is * <code>null</code>, uses the <code>overlayFactory</code> defined by * <code>PopUpManager</code> instead. * * <p>Note: Specific, individual alerts may have custom overlays that * are different than the default by passing a different overlay factory * to <code>Alert.show()</code>.</p> * * <p>This function is expected to have the following signature:</p> * <pre>function():DisplayObject</pre> * * <p>The following example uses a semi-transparent <code>Quad</code> as * a custom overlay:</p> * * <listing version="3.0"> * Alert.overlayFactory = function():Quad * { * var quad:Quad = new Quad(10, 10, 0x000000); * quad.alpha = 0.75; * return quad; * };</listing> * * @default null * * @see feathers.core.PopUpManager#overlayFactory * @see #show() */ public static var overlayFactory:Function; /** * The default <code>IStyleProvider</code> for all <code>Alert</code> * components. * * @default null * * @see feathers.core.FeathersControl#styleProvider */ public static var globalStyleProvider:IStyleProvider; /** * The default factory that creates alerts when <code>Alert.show()</code> * is called. To use a different factory, you need to set * <code>Alert.alertFactory</code> to a <code>Function</code> * instance. * * @see #show() * @see #alertFactory */ public static function defaultAlertFactory():Alert { return new Alert(); } /** * Creates an alert, sets common properties, and adds it to the * <code>PopUpManager</code> with the specified modal and centering * options. * * <p>In the following example, an alert is shown when a * <code>Button</code> is triggered:</p> * * <listing version="3.0"> * button.addEventListener( Event.TRIGGERED, button_triggeredHandler ); * * function button_triggeredHandler( event:Event ):void * { * var alert:Alert = Alert.show( "This is an alert!", "Hello World", new ArrayCollection( * [ * { label: "OK" } * ]); * }</listing> */ public static function show(message:String, title:String = null, buttons:IListCollection = null, icon:DisplayObject = null, isModal:Boolean = true, isCentered:Boolean = true, customAlertFactory:Function = null, customOverlayFactory:Function = null):Alert { var factory:Function = customAlertFactory; if(factory == null) { factory = alertFactory != null ? alertFactory : defaultAlertFactory; } var alert:Alert = Alert(factory()); alert.title = title; alert.message = message; alert.buttonsDataProvider = buttons; alert.icon = icon; factory = customOverlayFactory; if(factory == null) { factory = overlayFactory; } PopUpManager.addPopUp(alert, isModal, isCentered, factory); return alert; } /** * @private */ protected static function defaultButtonGroupFactory():ButtonGroup { return new ButtonGroup(); } /** * Constructor. */ public function Alert() { super(); this.headerStyleName = DEFAULT_CHILD_STYLE_NAME_HEADER; this.footerStyleName = DEFAULT_CHILD_STYLE_NAME_BUTTON_GROUP; if(this._fontStylesSet === null) { this._fontStylesSet = new FontStylesSet(); this._fontStylesSet.addEventListener(Event.CHANGE, fontStyles_changeHandler); } this.buttonGroupFactory = defaultButtonGroupFactory; this.addEventListener(Event.ADDED_TO_STAGE, alert_addedToStageHandler); } /** * The value added to the <code>styleNameList</code> of the alert's * message text renderer. This variable is <code>protected</code> so * that sub-classes can customize the message style name in their * constructors instead of using the default style name defined by * <code>DEFAULT_CHILD_STYLE_NAME_MESSAGE</code>. * * @see feathers.core.FeathersControl#styleNameList */ protected var messageStyleName:String = DEFAULT_CHILD_STYLE_NAME_MESSAGE; /** * The header sub-component. * * <p>For internal use in subclasses.</p> */ protected var headerHeader:Header; /** * The button group sub-component. * * <p>For internal use in subclasses.</p> */ protected var buttonGroupFooter:ButtonGroup; /** * The message text renderer sub-component. * * <p>For internal use in subclasses.</p> */ protected var messageTextRenderer:ITextRenderer; /** * @private */ override protected function get defaultStyleProvider():IStyleProvider { return Alert.globalStyleProvider; } /** * @private */ protected var _message:String = null; /** * The alert's main text content. */ public function get message():String { return this._message; } /** * @private */ public function set message(value:String):void { if(this._message == value) { return; } this._message = value; this.invalidate(INVALIDATION_FLAG_DATA); } /** * @private */ protected var _icon:DisplayObject; /** * @private */ public function get icon():DisplayObject { return this._icon; } /** * @private */ public function set icon(value:DisplayObject):void { if(this.processStyleRestriction(arguments.callee)) { if(value !== null) { value.dispose(); } return; } if(this._icon === value) { return; } var oldDisplayListBypassEnabled:Boolean = this.displayListBypassEnabled; this.displayListBypassEnabled = false; if(this._icon) { this._icon.removeEventListener(FeathersEventType.RESIZE, icon_resizeHandler); this.removeChild(this._icon); } this._icon = value; if(this._icon) { this._icon.addEventListener(FeathersEventType.RESIZE, icon_resizeHandler); this.addChild(this._icon); } this.displayListBypassEnabled = oldDisplayListBypassEnabled; this.invalidate(INVALIDATION_FLAG_DATA); } /** * @private */ protected var _gap:Number = 0; /** * @private */ public function get gap():Number { return this._gap; } /** * @private */ public function set gap(value:Number):void { if(this.processStyleRestriction(arguments.callee)) { return; } if(this._gap == value) { return; } this._gap = value; this.invalidate(INVALIDATION_FLAG_LAYOUT); } /** * @private */ protected var _buttonsDataProvider:IListCollection = null; /** * The data provider of the alert's <code>ButtonGroup</code>. */ public function get buttonsDataProvider():IListCollection { return this._buttonsDataProvider; } /** * @private */ public function set buttonsDataProvider(value:IListCollection):void { if(this._buttonsDataProvider == value) { return; } this._buttonsDataProvider = value; this.invalidate(INVALIDATION_FLAG_STYLES); } /** * @private */ protected var _acceptButtonIndex:int; /** * The index of the button in the <code>buttonsDataProvider</code> to * trigger when <code>Keyboard.ENTER</code> is pressed. * * <p>In the following example, the <code>acceptButtonIndex</code> is * set to the first button in the data provider.</p> * * <listing version="3.0"> * var alert:Alert = Alert.show( "This is an alert!", "Hello World", new ArrayCollection( * [ * { label: "OK" } * ])); * alert.acceptButtonIndex = 0;</listing> * * @default -1 */ public function get acceptButtonIndex():int { return this._acceptButtonIndex; } /** * @private */ public function set acceptButtonIndex(value:int):void { this._acceptButtonIndex = value; } /** * @private */ protected var _cancelButtonIndex:int; /** * The index of the button in the <code>buttonsDataProvider</code> to * trigger when <code>Keyboard.ESCAPE</code> or * <code>Keyboard.BACK</code> is pressed. * * <p>In the following example, the <code>cancelButtonIndex</code> is * set to the second button in the data provider.</p> * * <listing version="3.0"> * var alert:Alert = Alert.show( "This is an alert!", "Hello World", new ArrayCollection( * [ * { label: "OK" }, * { label: "Cancel" }, * ])); * alert.cancelButtonIndex = 1;</listing> * * @default -1 */ public function get cancelButtonIndex():int { return this._cancelButtonIndex; } /** * @private */ public function set cancelButtonIndex(value:int):void { this._cancelButtonIndex = value; } /** * @private */ protected var _fontStylesSet:FontStylesSet; /** * @private */ public function get fontStyles():TextFormat { return this._fontStylesSet.format; } /** * @private */ public function set fontStyles(value:TextFormat):void { if(this.processStyleRestriction(arguments.callee)) { return; } var savedCallee:Function = arguments.callee; function changeHandler(event:Event):void { processStyleRestriction(savedCallee); } if(value !== null) { value.removeEventListener(Event.CHANGE, changeHandler); } this._fontStylesSet.format = value; if(value !== null) { value.addEventListener(Event.CHANGE, changeHandler); } } /** * @private */ public function get disabledFontStyles():TextFormat { return this._fontStylesSet.disabledFormat; } /** * @private */ public function set disabledFontStyles(value:TextFormat):void { if(this.processStyleRestriction(arguments.callee)) { return; } var savedCallee:Function = arguments.callee; function changeHandler(event:Event):void { processStyleRestriction(savedCallee); } if(value !== null) { value.removeEventListener(Event.CHANGE, changeHandler); } this._fontStylesSet.disabledFormat = value; if(value !== null) { value.addEventListener(Event.CHANGE, changeHandler); } } /** * @private */ protected var _messageFactory:Function; /** * A function used to instantiate the alert's message text renderer * sub-component. By default, the alert will use the global text * renderer factory, <code>FeathersControl.defaultTextRendererFactory()</code>, * to create the message text renderer. The message text renderer must * be an instance of <code>ITextRenderer</code>. This factory can be * used to change properties on the message text renderer when it is * first created. For instance, if you are skinning Feathers components * without a theme, you might use this factory to style the message text * renderer. * * <p>If you are not using a theme, the message factory can be used to * provide skin the message text renderer with appropriate text styles.</p> * * <p>The factory should have the following function signature:</p> * <pre>function():ITextRenderer</pre> * * <p>In the following example, a custom message factory is passed to * the alert:</p> * * <listing version="3.0"> * alert.messageFactory = function():ITextRenderer * { * var messageRenderer:TextFieldTextRenderer = new TextFieldTextRenderer(); * messageRenderer.textFormat = new TextFormat( "_sans", 12, 0xff0000 ); * return messageRenderer; * }</listing> * * @default null * * @see #message * @see feathers.core.ITextRenderer * @see feathers.core.FeathersControl#defaultTextRendererFactory */ public function get messageFactory():Function { return this._messageFactory; } /** * @private */ public function set messageFactory(value:Function):void { if(this._messageFactory == value) { return; } this._messageFactory = value; this.invalidate(INVALIDATION_FLAG_TEXT_RENDERER); } /** * @private */ protected var _messageProperties:PropertyProxy; /** * An object that stores properties for the alert's message text * renderer sub-component, and the properties will be passed down to the * text renderer when the alert validates. The available properties * depend on which <code>ITextRenderer</code> implementation is returned * by <code>messageFactory</code>. Refer to * <a href="../core/ITextRenderer.html"><code>feathers.core.ITextRenderer</code></a> * for a list of available text renderer implementations. * * <p>In the following example, some properties are set for the alert's * message text renderer (this example assumes that the message text * renderer is a <code>BitmapFontTextRenderer</code>):</p> * * <listing version="3.0"> * alert.messageProperties.textFormat = new BitmapFontTextFormat( bitmapFont ); * alert.messageProperties.wordWrap = true;</listing> * * <p>If the subcomponent has its own subcomponents, their properties * can be set too, using attribute <code>&#64;</code> notation. For example, * to set the skin on the thumb which is in a <code>SimpleScrollBar</code>, * which is in a <code>List</code>, you can use the following syntax:</p> * <pre>list.verticalScrollBarProperties.&#64;thumbProperties.defaultSkin = new Image(texture);</pre> * * <p>Setting properties in a <code>messageFactory</code> function instead * of using <code>messageProperties</code> will result in better * performance.</p> * * @default null * * @see #messageFactory * @see feathers.core.ITextRenderer */ public function get messageProperties():Object { if(!this._messageProperties) { this._messageProperties = new PropertyProxy(childProperties_onChange); } return this._messageProperties; } /** * @private */ public function set messageProperties(value:Object):void { if(this._messageProperties == value) { return; } if(value && !(value is PropertyProxy)) { value = PropertyProxy.fromObject(value); } if(this._messageProperties) { this._messageProperties.removeOnChangeCallback(childProperties_onChange); } this._messageProperties = PropertyProxy(value); if(this._messageProperties) { this._messageProperties.addOnChangeCallback(childProperties_onChange); } this.invalidate(INVALIDATION_FLAG_STYLES); } /** * @private */ protected var _customMessageStyleName:String; /** * @private */ public function get customMessageStyleName():String { return this._customMessageStyleName; } /** * @private */ public function set customMessageStyleName(value:String):void { if(this.processStyleRestriction(arguments.callee)) { return; } if(this._customMessageStyleName === value) { return; } this._customMessageStyleName = value; this.invalidate(INVALIDATION_FLAG_TEXT_RENDERER); } /** * A function used to generate the alerts's button group sub-component. * The button group must be an instance of <code>ButtonGroup</code>. * This factory can be used to change properties on the button group * when it is first created. For instance, if you are skinning Feathers * components without a theme, you might use this factory to set skins * and other styles on the button group. * * <p>The function should have the following signature:</p> * <pre>function():ButtonGroup</pre> * * <p>In the following example, a custom button group factory is * provided to the alert:</p> * * <listing version="3.0"> * alert.buttonGroupFactory = function():ButtonGroup * { * return new ButtonGroup(); * };</listing> * * @default null * * @see feathers.controls.ButtonGroup */ public function get buttonGroupFactory():Function { return super.footerFactory; } /** * @private */ public function set buttonGroupFactory(value:Function):void { super.footerFactory = value; } /** * @private */ public function get customButtonGroupStyleName():String { return super.customFooterStyleName; } /** * @private */ public function set customButtonGroupStyleName(value:String):void { super.customFooterStyleName = value; } /** * An object that stores properties for the alert's button group * sub-component, and the properties will be passed down to the button * group when the alert validates. For a list of available properties, * refer to <a href="ButtonGroup.html"><code>feathers.controls.ButtonGroup</code></a>. * * <p>If the subcomponent has its own subcomponents, their properties * can be set too, using attribute <code>&#64;</code> notation. For example, * to set the skin on the thumb which is in a <code>SimpleScrollBar</code>, * which is in a <code>List</code>, you can use the following syntax:</p> * <pre>list.verticalScrollBarProperties.&#64;thumbProperties.defaultSkin = new Image(texture);</pre> * * <p>Setting properties in a <code>buttonGroupFactory</code> function * instead of using <code>buttonGroupProperties</code> will result in better * performance.</p> * * <p>In the following example, the button group properties are customized:</p> * * <listing version="3.0"> * alert.buttonGroupProperties.gap = 20;</listing> * * @default null * * @see #buttonGroupFactory * @see feathers.controls.ButtonGroup */ public function get buttonGroupProperties():Object { return super.footerProperties; } /** * @private */ public function set buttonGroupProperties(value:Object):void { super.footerProperties = value; } /** * @private */ override public function dispose():void { if(this._fontStylesSet !== null) { this._fontStylesSet.dispose(); this._fontStylesSet = null; } super.dispose(); } /** * @private */ override protected function initialize():void { if(this._layout === null) { var layout:VerticalLayout = new VerticalLayout(); layout.horizontalAlign = HorizontalAlign.JUSTIFY; this.ignoreNextStyleRestriction(); this.layout = layout; } super.initialize(); } /** * @private */ override protected function draw():void { var dataInvalid:Boolean = this.isInvalid(INVALIDATION_FLAG_DATA); var stylesInvalid:Boolean = this.isInvalid(INVALIDATION_FLAG_STYLES); var stateInvalid:Boolean = this.isInvalid(INVALIDATION_FLAG_STATE); var textRendererInvalid:Boolean = this.isInvalid(INVALIDATION_FLAG_TEXT_RENDERER); if(textRendererInvalid) { this.createMessage(); } if(textRendererInvalid || dataInvalid) { this.messageTextRenderer.text = this._message; } if(textRendererInvalid || stylesInvalid) { this.refreshMessageStyles(); } super.draw(); if(this._icon !== null) { if(this._icon is IValidating) { IValidating(this._icon).validate(); } this._icon.x = this._paddingLeft; this._icon.y = this._topViewPortOffset + (this._viewPort.visibleHeight - this._icon.height) / 2; } } /** * @private */ override protected function autoSizeIfNeeded():Boolean { if(this._autoSizeMode === AutoSizeMode.STAGE) { //the implementation in a super class can handle this return super.autoSizeIfNeeded(); } var needsWidth:Boolean = this._explicitWidth !== this._explicitWidth; //isNaN var needsHeight:Boolean = this._explicitHeight !== this._explicitHeight; //isNaN var needsMinWidth:Boolean = this._explicitMinWidth !== this._explicitMinWidth; //isNaN var needsMinHeight:Boolean = this._explicitMinHeight !== this._explicitMinHeight; //isNaN if(!needsWidth && !needsHeight && !needsMinWidth && !needsMinHeight) { return false; } resetFluidChildDimensionsForMeasurement(this.currentBackgroundSkin, this._explicitWidth, this._explicitHeight, this._explicitMinWidth, this._explicitMinHeight, this._explicitMaxWidth, this._explicitMaxHeight, this._explicitBackgroundWidth, this._explicitBackgroundHeight, this._explicitBackgroundMinWidth, this._explicitBackgroundMinHeight, this._explicitBackgroundMaxWidth, this._explicitBackgroundMaxHeight); var measureBackground:IMeasureDisplayObject = this.currentBackgroundSkin as IMeasureDisplayObject; if(this.currentBackgroundSkin is IValidating) { IValidating(this.currentBackgroundSkin).validate(); } if(this._icon is IValidating) { IValidating(this._icon).validate(); } //we don't measure the header and footer here because they are //handled in calculateViewPortOffsets(), which is automatically //called by Scroller before autoSizeIfNeeded(). var newWidth:Number = this._explicitWidth; var newHeight:Number = this._explicitHeight; var newMinWidth:Number = this._explicitMinWidth; var newMinHeight:Number = this._explicitMinHeight; if(needsWidth) { if(this._measureViewPort) { newWidth = this._viewPort.visibleWidth; } else { newWidth = 0; } //we don't need to account for the icon and gap because it is //already included in the left offset newWidth += this._rightViewPortOffset + this._leftViewPortOffset; var headerWidth:Number = this.header.width + this._outerPaddingLeft + this._outerPaddingRight; if(headerWidth > newWidth) { newWidth = headerWidth; } if(this.footer !== null) { var footerWidth:Number = this.footer.width + this._outerPaddingLeft + this._outerPaddingRight; if(footerWidth > newWidth) { newWidth = footerWidth; } } if(this.currentBackgroundSkin !== null && this.currentBackgroundSkin.width > newWidth) { newWidth = this.currentBackgroundSkin.width; } } if(needsHeight) { if(this._measureViewPort) { newHeight = this._viewPort.visibleHeight; } else { newHeight = 0; } if(this._icon !== null) { var iconHeight:Number = this._icon.height; if(iconHeight === iconHeight && //!isNaN iconHeight > newHeight) { newHeight = iconHeight; } } newHeight += this._bottomViewPortOffset + this._topViewPortOffset; //we don't need to account for the header and footer because //they're already included in the top and bottom offsets if(this.currentBackgroundSkin !== null && this.currentBackgroundSkin.height > newHeight) { newHeight = this.currentBackgroundSkin.height; } } if(needsMinWidth) { if(this._measureViewPort) { newMinWidth = this._viewPort.minVisibleWidth; } else { newMinWidth = 0; } //we don't need to account for the icon and gap because it is //already included in the left offset newMinWidth += this._rightViewPortOffset + this._leftViewPortOffset; var headerMinWidth:Number = this.header.minWidth + this._outerPaddingLeft + this._outerPaddingRight; if(headerMinWidth > newMinWidth) { newMinWidth = headerMinWidth; } if(this.footer !== null) { var footerMinWidth:Number = this.footer.minWidth + this._outerPaddingLeft + this._outerPaddingRight; if(footerMinWidth > newMinWidth) { newMinWidth = footerMinWidth; } } if(this.currentBackgroundSkin !== null) { if(measureBackground !== null) { if(measureBackground.minWidth > newMinWidth) { newMinWidth = measureBackground.minWidth; } } else if(this._explicitBackgroundMinWidth > newMinWidth) { newMinWidth = this._explicitBackgroundMinWidth; } } } if(needsMinHeight) { if(this._measureViewPort) { newMinHeight = this._viewPort.minVisibleHeight; } else { newMinHeight = 0; } if(this._icon !== null) { iconHeight = this._icon.height; if(iconHeight === iconHeight && //!isNaN iconHeight > newMinHeight) { newMinHeight = iconHeight; } } newMinHeight += this._bottomViewPortOffset + this._topViewPortOffset; //we don't need to account for the header and footer because //they're already included in the top and bottom offsets if(this.currentBackgroundSkin !== null) { if(measureBackground !== null) { if(measureBackground.minHeight > newMinHeight) { newMinHeight = measureBackground.minHeight; } } else if(this._explicitBackgroundMinHeight > newMinHeight) { newMinHeight = this._explicitBackgroundMinHeight; } } } return this.saveMeasurements(newWidth, newHeight, newMinWidth, newMinHeight); } /** * Creates and adds the <code>header</code> sub-component and * removes the old instance, if one exists. * * <p>Meant for internal use, and subclasses may override this function * with a custom implementation.</p> * * @see #header * @see #headerFactory * @see #style:customHeaderStyleName */ override protected function createHeader():void { super.createHeader(); this.headerHeader = Header(this.header); } /** * Creates and adds the <code>buttonGroupFooter</code> sub-component and * removes the old instance, if one exists. * * <p>Meant for internal use, and subclasses may override this function * with a custom implementation.</p> * * @see #buttonGroupFooter * @see #buttonGroupFactory * @see #style:customButtonGroupStyleName */ protected function createButtonGroup():void { if(this.buttonGroupFooter) { this.buttonGroupFooter.removeEventListener(Event.TRIGGERED, buttonsFooter_triggeredHandler); } super.createFooter(); this.buttonGroupFooter = ButtonGroup(this.footer); this.buttonGroupFooter.addEventListener(Event.TRIGGERED, buttonsFooter_triggeredHandler); } /** * @private */ override protected function createFooter():void { this.createButtonGroup(); } /** * Creates and adds the <code>messageTextRenderer</code> sub-component and * removes the old instance, if one exists. * * <p>Meant for internal use, and subclasses may override this function * with a custom implementation.</p> * * @see #message * @see #messageTextRenderer * @see #messageFactory */ protected function createMessage():void { if(this.messageTextRenderer) { this.removeChild(DisplayObject(this.messageTextRenderer), true); this.messageTextRenderer = null; } var factory:Function = this._messageFactory != null ? this._messageFactory : FeathersControl.defaultTextRendererFactory; this.messageTextRenderer = ITextRenderer(factory()); this.messageTextRenderer.wordWrap = true; var messageStyleName:String = this._customMessageStyleName != null ? this._customMessageStyleName : this.messageStyleName; var uiTextRenderer:IFeathersControl = IFeathersControl(this.messageTextRenderer); uiTextRenderer.styleNameList.add(messageStyleName); uiTextRenderer.touchable = false; this.addChild(DisplayObject(this.messageTextRenderer)); } /** * @private */ override protected function refreshFooterStyles():void { super.refreshFooterStyles(); this.buttonGroupFooter.dataProvider = this._buttonsDataProvider; } /** * @private */ protected function refreshMessageStyles():void { this.messageTextRenderer.fontStyles = this._fontStylesSet; for(var propertyName:String in this._messageProperties) { var propertyValue:Object = this._messageProperties[propertyName]; this.messageTextRenderer[propertyName] = propertyValue; } } /** * @private */ override protected function calculateViewPortOffsets(forceScrollBars:Boolean = false, useActualBounds:Boolean = false):void { super.calculateViewPortOffsets(forceScrollBars, useActualBounds); if(this._icon !== null) { if(this._icon is IValidating) { IValidating(this._icon).validate(); } var iconWidth:Number = this._icon.width; if(iconWidth === iconWidth) //!isNaN { this._leftViewPortOffset += iconWidth + this._gap; } } } /** * @private */ protected function closeAlert(item:Object):void { this.removeFromParent(); this.dispatchEventWith(Event.CLOSE, false, item); this.dispose(); } /** * @private */ protected function buttonsFooter_triggeredHandler(event:Event, data:Object):void { this.closeAlert(data); } /** * @private */ protected function icon_resizeHandler(event:Event):void { this.invalidate(INVALIDATION_FLAG_LAYOUT); } /** * @private */ protected function fontStyles_changeHandler(event:Event):void { this.invalidate(INVALIDATION_FLAG_STYLES); } /** * @private */ protected function alert_addedToStageHandler(event:Event):void { var starling:Starling = this.stage !== null ? this.stage.starling : Starling.current; //using priority here is a hack so that objects higher up in the //display list have a chance to cancel the event first. var priority:int = -getDisplayObjectDepthFromStage(this); starling.nativeStage.addEventListener(KeyboardEvent.KEY_DOWN, alert_nativeStage_keyDownHandler, false, priority, true); this.addEventListener(Event.REMOVED_FROM_STAGE, alert_removedFromStageHandler); } /** * @private */ protected function alert_removedFromStageHandler(event:Event):void { this.removeEventListener(Event.REMOVED_FROM_STAGE, alert_removedFromStageHandler); var starling:Starling = this.stage !== null ? this.stage.starling : Starling.current; starling.nativeStage.removeEventListener(KeyboardEvent.KEY_DOWN, alert_nativeStage_keyDownHandler); } /** * @private */ protected function alert_nativeStage_keyDownHandler(event:KeyboardEvent):void { if(event.isDefaultPrevented()) { //someone else already handled this one return; } if(this._buttonsDataProvider === null) { //no buttons to trigger return; } var keyCode:uint = event.keyCode; if(this._acceptButtonIndex != -1 && keyCode == Keyboard.ENTER) { //don't let the OS handle the event event.preventDefault(); var item:Object = this._buttonsDataProvider.getItemAt(this._acceptButtonIndex); this.closeAlert(item); return; } if(this._cancelButtonIndex != -1 && (keyCode == Keyboard.BACK || keyCode == Keyboard.ESCAPE)) { //don't let the OS handle the event event.preventDefault(); item = this._buttonsDataProvider.getItemAt(this._cancelButtonIndex); this.closeAlert(item); return; } } } }
package away3d.core.math { /** A point in 2D space. */ public final class Number2D { /** Horizontal coordinate. */ public var x:Number; /** Vertical coordinate. */ public var y:Number; public function Number2D(x:Number = 0, y:Number = 0) { this.x = x; this.y = y; } public function clone():Number2D { return new Number2D(x, y); } public function get modulo():Number { return Math.sqrt(x*x + y*y); } public static function scale(v:Number2D, s:Number):Number2D { return new Number2D ( v.x * s, v.y * s ); } public static function add(v:Number3D, w:Number3D):Number2D { return new Number2D ( v.x + w.x, v.y + w.y ); } public static function sub(v:Number2D, w:Number2D):Number2D { return new Number2D ( v.x - w.x, v.y - w.y ); } public static function dot(v:Number2D, w:Number2D):Number { return (v.x * w.x + v.y * w.y); } public function normalize():void { var mod:Number = modulo; if (mod != 0 && mod != 1) { this.x /= mod; this.y /= mod; } } // Relative directions. public static var LEFT :Number2D = new Number2D(-1, 0); public static var RIGHT :Number2D = new Number2D( 1, 0); public static var UP :Number2D = new Number2D( 0, 1); public static var DOWN :Number2D = new Number2D( 0, -1); public function toString(): String { return 'x:' + x + ' y:' + y; } } }
// Action script... // [Initial MovieClip Action of sprite 20518] #initclip 39 if (!dofus.graphics.gapi.controls.JobOptionsViewer) { if (!dofus) { _global.dofus = new Object(); } // end if if (!dofus.graphics) { _global.dofus.graphics = new Object(); } // end if if (!dofus.graphics.gapi) { _global.dofus.graphics.gapi = new Object(); } // end if if (!dofus.graphics.gapi.controls) { _global.dofus.graphics.gapi.controls = new Object(); } // end if var _loc1 = (_global.dofus.graphics.gapi.controls.JobOptionsViewer = function () { super(); }).prototype; _loc1.__set__job = function (oJob) { this._oJob.removeEventListener("optionsChanged", this); this._oJob = oJob; this._oJob.addEventListener("optionsChanged", this); if (this.initialized) { this.optionsChanged(); } // end if //return (this.job()); }; _loc1.init = function () { super.init(false, dofus.graphics.gapi.controls.JobOptionsViewer.CLASS_NAME); }; _loc1.createChildren = function () { this.addToQueue({object: this, method: this.initTexts}); this.addToQueue({object: this, method: this.addListeners}); this.addToQueue({object: this, method: this.initData}); }; _loc1.addListeners = function () { this.api.datacenter.Player.addEventListener("craftPublicModeChanged", this); this._vsCraftComplexity.addEventListener("change", this); this._btnEnabled.addEventListener("click", this); this._btnEnabled.addEventListener("over", this); this._btnEnabled.addEventListener("out", this); this._btnValidate.addEventListener("click", this); this._btnNotFree.addEventListener("click", this); this._btnFreeIfFailed.addEventListener("click", this); this._btnRessourcesNeeded.addEventListener("click", this); }; _loc1.initTexts = function () { this._lblReferencingOptions.text = this.api.lang.getText("REFERENCING_OPTIONS"); this._lbNotFree.text = this.api.lang.getText("NOT_FREE"); this._lblFreeIfFailed.text = this.api.lang.getText("FREE_IF_FAILED"); this._lblRessourcesNeeded.text = this.api.lang.getText("CRAFT_RESSOURCES_NEEDED"); this._lblCraftComplexity.text = this.api.lang.getText("MIN_ITEM_IN_RECEIPT"); this._txtInfos.text = this.api.lang.getText("PUBLIC_MODE_INFOS"); this._btnValidate.label = this.api.lang.getText("SAVE"); this._btnValidate.enabled = false; this.craftPublicModeChanged(); }; _loc1.initData = function () { this.optionsChanged(); }; _loc1.refreshBtnEnabledLabel = function () { this._btnEnabled.label = this.api.datacenter.Player.craftPublicMode ? (this.api.lang.getText("DISABLE")) : (this.api.lang.getText("ENABLE")); }; _loc1.refreshCraftComplexityLabel = function (nMinSlot) { this._lblCraftComplexityValue.text = nMinSlot.toString() + " " + ank.utils.PatternDecoder.combine(this.api.lang.getText("SLOT"), "m", nMinSlot < 2); }; _loc1.change = function (oEvent) { switch (oEvent.target._name) { case "_vsCraftComplexity": { this.refreshCraftComplexityLabel(this._vsCraftComplexity.value); this._btnValidate.enabled = true; break; } } // End of switch }; _loc1.click = function (oEvent) { switch (oEvent.target._name) { case "_btnEnabled": { this.api.network.Exchange.setPublicMode(!this.api.datacenter.Player.craftPublicMode); break; } case "_btnValidate": { var _loc3 = this.api.datacenter.Player.Jobs.findFirstItem("id", this._oJob.id); if (_loc3.index != -1) { var _loc4 = (this._btnNotFree.selected ? (1) : (0)) + (this._btnFreeIfFailed.selected ? (2) : (0)) + (this._btnRessourcesNeeded.selected ? (4) : (0)); this.api.network.Job.changeJobStats(_loc3.index, _loc4, this._vsCraftComplexity._visible == false ? (2) : (this._vsCraftComplexity.value)); } // end if break; } case "_btnNotFree": { this._btnFreeIfFailed.enabled = this._btnNotFree.selected ? (true) : (false); } case "_btnFreeIfFailed": case "_btnRessourcesNeeded": { this._btnValidate.enabled = true; break; } } // End of switch }; _loc1.optionsChanged = function (oEvent) { if (this._oJob != undefined && this._btnNotFree.selected != undefined) { var _loc3 = this._oJob.options; var _loc4 = this._oJob.getMaxSkillSlot(); _loc4 = _loc4 > 8 ? (8) : (_loc4); if (_loc4 > 2) { this._vsCraftComplexity._visible = true; this._vsCraftComplexity.markerCount = _loc4 - 1; this._vsCraftComplexity.min = 2; this._vsCraftComplexity.max = _loc4; this._vsCraftComplexity.redraw(); this._vsCraftComplexity.value = _loc3.minSlots; } else { this._vsCraftComplexity._visible = false; } // end else if this.refreshCraftComplexityLabel(_loc3.minSlots); this._btnNotFree.selected = _loc3.isNotFree; this._btnFreeIfFailed.selected = _loc3.isFreeIfFailed; this._btnFreeIfFailed.enabled = this._btnNotFree.selected ? (true) : (false); this._btnRessourcesNeeded.selected = _loc3.ressourcesNeeded; this._btnValidate.enabled = false; } // end if }; _loc1.craftPublicModeChanged = function (oEvent) { this._lblPublicMode.text = this.api.lang.getText("PUBLIC_MODE") + " (" + this.api.lang.getText(this.api.datacenter.Player.craftPublicMode ? ("ACTIVE") : ("INACTIVE")) + ")"; this.refreshBtnEnabledLabel(); this._mcPublicDisable._visible = !this.api.datacenter.Player.craftPublicMode; this._mcPublicEnable._visible = this.api.datacenter.Player.craftPublicMode; }; _loc1.over = function (oEvent) { switch (oEvent.target) { case this._btnEnabled: { var _loc3 = this.api.datacenter.Player.craftPublicMode ? (this.api.lang.getText("DISABLE_PUBLIC_MODE")) : (this.api.lang.getText("ENABLE_PUBLIC_MODE")); this.gapi.showTooltip(_loc3, oEvent.target, -20); break; } } // End of switch }; _loc1.out = function (oEvent) { this.gapi.hideTooltip(); }; _loc1.addProperty("job", function () { }, _loc1.__set__job); ASSetPropFlags(_loc1, null, 1); (_global.dofus.graphics.gapi.controls.JobOptionsViewer = function () { super(); }).CLASS_NAME = "JobOptionsViewer"; } // end if #endinitclip
/** * Created by christoferdutz on 02.08.16. */ package org.dukecon.services { import mx.collections.ArrayCollection; import mx.collections.Sort; import mx.collections.SortField; import org.dukecon.model.ConferenceStorage; public class LocationService { [Inject] public var conferenceService:ConferenceService; public function LocationService() { } public function getLocations(conferenceId:String):ArrayCollection { var conference:ConferenceStorage = conferenceService.getConference(conferenceId); if(conference) { var res:ArrayCollection = conference.conference.metaData.locations; // Sort the locations by order. var orderSortField:SortField = new SortField(); orderSortField.name = "order"; orderSortField.numeric = true; var locationSort:Sort = new Sort(); locationSort.fields = [orderSortField]; res.sort = locationSort; res.refresh(); return res; } return null; } } }
//////////////////////////////////////////////////////////////////////////////// // // Licensed to the Apache Software Foundation (ASF) under one or more // contributor license agreements. See the NOTICE file distributed with // this work for additional information regarding copyright ownership. // The ASF licenses this file to You under the Apache License, Version 2.0 // (the "License"); you may not use this file except in compliance with // the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // //////////////////////////////////////////////////////////////////////////////// package org.apache.royale.mdl { import org.apache.royale.mdl.beads.models.IToastModel; import org.apache.royale.core.UIBase; import org.apache.royale.events.Event; COMPILE::JS { import org.apache.royale.core.WrappedHTMLElement; import org.apache.royale.html.util.addElementToWrapper; } /** * Toast are transient popup notifications without actions like Snackbar (see * Snackbar class) without user actions implied. * * @langversion 3.0 * @playerversion Flash 10.2 * @playerversion AIR 2.6 * @productversion Royale 0.8 */ public class Toast extends UIBase { /** * Constructor. * * @langversion 3.0 * @playerversion Flash 10.2 * @playerversion AIR 2.6 * @productversion Royale 0.8 */ public function Toast() { super(); typeNames = "mdl-js-snackbar mdl-snackbar"; } /** * Message to be displayed on Snackbar * * @langversion 3.0 * @playerversion Flash 10.2 * @playerversion AIR 2.6 * @productversion Royale 0.8 */ public function get message():String { return IToastModel(model).message; } /** * @private */ public function set message(value:String):void { IToastModel(model).message = value; } /** * Timout in milliseconds for hiding Snackbar * * @default 2750 * @langversion 3.0 * @playerversion Flash 10.2 * @playerversion AIR 2.6 * @productversion Royale 0.8 */ public function get timeout():int { return IToastModel(model).timeout; } /** * @private */ public function set timeout(value:int):void { IToastModel(model).timeout = value; } /** * Show the snackbar * * @langversion 3.0 * @playerversion Flash 10.2 * @playerversion AIR 2.6 * @productversion Royale 0.8 */ public function show():void { if (snackbar) { var snackbarData:Object = IToastModel(model).snackbarData; snackbar.showSnackbar(snackbarData); } } protected var snackbar:Object; COMPILE::JS private var snackbarAction:HTMLButtonElement; COMPILE::JS private var snackbarText:HTMLDivElement; /** * @royaleignorecoercion org.apache.royale.core.WrappedHTMLElement * @royaleignorecoercion HTMLDivElement * @royaleignorecoercion HTMLButtonElement * * @return */ COMPILE::JS override protected function createElement():WrappedHTMLElement { addElementToWrapper(this,'div'); element.addEventListener("mdl-componentupgraded", onElementMdlComponentUpgraded, false); snackbarText = document.createElement("div") as HTMLDivElement; snackbarText.classList.add("mdl-snackbar__text"); element.appendChild(snackbarText); snackbarAction = document.createElement("button") as HTMLButtonElement; snackbarAction.classList.add("mdl-snackbar__action"); element.appendChild(snackbarAction); return element; } /** * @private */ private function onElementMdlComponentUpgraded(event:Event):void { if (!event.currentTarget) return; snackbar = event.currentTarget.MaterialSnackbar; } } }
/** * Just need call a link when clicked (banner quest html page) * * @langversion ActionScript 3.0 * @playerversion Flash 9.0 * @author Abraham Lee * @since 07.16.2009 */ //---------------------------------------- // OVERALL FLOW //---------------------------------------- package com.neopets.projects.destination.destinationV2.movieTheater.icons { //---------------------------------------- // IMPORTS //---------------------------------------- import flash.display.MovieClip; //---------------------------------------- // CUSTOM IMPORTS //---------------------------------------- public class ScheduleIcon extends AbsIcon { //---------------------------------------- // CONSTANTS //---------------------------------------- //---------------------------------------- // VARIABLES //---------------------------------------- //---------------------------------------- // CONSTRUCTOR //---------------------------------------- public function ScheduleIcon (pName:String = null, pImageName:String = null,pImageClass:String = null,pTextName:String = null, pTrackArray:Array = null):void { super (pName, pImageName,pImageClass,pTextName, pTrackArray) } //---------------------------------------- // GETTERS AND SETTORS //---------------------------------------- //---------------------------------------- // PUBLIC METHODS //---------------------------------------- public override function cleanup():void { removeChild (mImage) mImage = null; } //---------------------------------------- // PROTECTED METHODS //---------------------------------------- //---------------------------------------- // PRIVATE METHODS //---------------------------------------- //---------------------------------------- // EVENT LISTENERS //---------------------------------------- } }
/* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is [Open Source Virtual Machine.]. * * The Initial Developer of the Original Code is * Adobe System Incorporated. * Portions created by the Initial Developer are Copyright (C) 2005-2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Adobe AS3 Team * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /* In Ecma4 there are three sealed types; Boolean, Number and String You cannot set properties of an instance of a sealed type Should throw a ReferenceError Author: mtilburg@macromedia.com Date: October 13, 2004 */ var SECTION = "ECMA_4"; var VERSION = "ECMA_4"; startTest(); var TITLE = "valof=Number.prototype.valueOf;x=new Number();x.valueOf=valof;"; writeHeaderToLog( TITLE ); var testcases = getTestCases(); test(); function getTestCases() { var array:Array = new Array(); var item:Number = 0; var thisError:String = "no exception thrown"; var valof=Number.prototype.valueOf; var x:Number=new Number(); try{ x.valueOf=valof; x.valueOf(); } catch(e:ReferenceError){ thisError = e.toString(); } finally { array[item] = new TestCase( SECTION,"valof=Number.prototype.valueOf;x=new Number();x.valueOf=valof", "ReferenceError: Error #1056", referenceError(thisError) ); } return ( array ); }
/* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is [Open Source Virtual Machine.]. * * The Initial Developer of the Original Code is * Adobe System Incorporated. * Portions created by the Initial Developer are Copyright (C) 2005-2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Adobe AS3 Team * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var SECTION = "15.7.4.3"; var VERSION = "ECMA_1"; startTest(); var testcases = getTestCases(); writeHeaderToLog( SECTION + " Number.prototype.toLocaleString()"); test(); function getTestCases() { var array:Array = new Array(); var item:Number = 0; var o:String = new String(); var thisError:String = "no exception thrown"; try{ o.toString = Number.prototype.toString; } catch(e:ReferenceError) { thisError = e.toString(); } finally { array[item++] = new TestCase(SECTION, "o = new String(); o.toString = Number.prototype.toString; o.toLocaleString()", "ReferenceError: Error #1056", referenceError(thisError) ); } return ( array ); }
package com.ankamagames.dofus.network.messages.game.house { import com.ankamagames.jerakine.network.CustomDataWrapper; import com.ankamagames.jerakine.network.ICustomDataInput; import com.ankamagames.jerakine.network.ICustomDataOutput; import com.ankamagames.jerakine.network.INetworkMessage; import com.ankamagames.jerakine.network.NetworkMessage; import com.ankamagames.jerakine.network.utils.FuncTree; import flash.utils.ByteArray; public class HouseTeleportRequestMessage extends NetworkMessage implements INetworkMessage { public static const protocolId:uint = 4012; private var _isInitialized:Boolean = false; public var houseId:uint = 0; public var houseInstanceId:uint = 0; public function HouseTeleportRequestMessage() { super(); } override public function get isInitialized() : Boolean { return this._isInitialized; } override public function getMessageId() : uint { return 4012; } public function initHouseTeleportRequestMessage(houseId:uint = 0, houseInstanceId:uint = 0) : HouseTeleportRequestMessage { this.houseId = houseId; this.houseInstanceId = houseInstanceId; this._isInitialized = true; return this; } override public function reset() : void { this.houseId = 0; this.houseInstanceId = 0; this._isInitialized = false; } override public function pack(output:ICustomDataOutput) : void { var data:ByteArray = new ByteArray(); this.serialize(new CustomDataWrapper(data)); writePacket(output,this.getMessageId(),data); } override public function unpack(input:ICustomDataInput, length:uint) : void { this.deserialize(input); } override public function unpackAsync(input:ICustomDataInput, length:uint) : FuncTree { var tree:FuncTree = new FuncTree(); tree.setRoot(input); this.deserializeAsync(tree); return tree; } public function serialize(output:ICustomDataOutput) : void { this.serializeAs_HouseTeleportRequestMessage(output); } public function serializeAs_HouseTeleportRequestMessage(output:ICustomDataOutput) : void { if(this.houseId < 0) { throw new Error("Forbidden value (" + this.houseId + ") on element houseId."); } output.writeVarInt(this.houseId); if(this.houseInstanceId < 0) { throw new Error("Forbidden value (" + this.houseInstanceId + ") on element houseInstanceId."); } output.writeInt(this.houseInstanceId); } public function deserialize(input:ICustomDataInput) : void { this.deserializeAs_HouseTeleportRequestMessage(input); } public function deserializeAs_HouseTeleportRequestMessage(input:ICustomDataInput) : void { this._houseIdFunc(input); this._houseInstanceIdFunc(input); } public function deserializeAsync(tree:FuncTree) : void { this.deserializeAsyncAs_HouseTeleportRequestMessage(tree); } public function deserializeAsyncAs_HouseTeleportRequestMessage(tree:FuncTree) : void { tree.addChild(this._houseIdFunc); tree.addChild(this._houseInstanceIdFunc); } private function _houseIdFunc(input:ICustomDataInput) : void { this.houseId = input.readVarUhInt(); if(this.houseId < 0) { throw new Error("Forbidden value (" + this.houseId + ") on element of HouseTeleportRequestMessage.houseId."); } } private function _houseInstanceIdFunc(input:ICustomDataInput) : void { this.houseInstanceId = input.readInt(); if(this.houseInstanceId < 0) { throw new Error("Forbidden value (" + this.houseInstanceId + ") on element of HouseTeleportRequestMessage.houseInstanceId."); } } } }
/** * BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ * * Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). * * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 3.0 of the License, or (at your option) any later * version. * * BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along * with BigBlueButton; if not, see <http://www.gnu.org/licenses/>. * */ package org.bigbluebutton.main.events { import flash.events.Event; public class MadePresenterEvent extends Event { public static const PRESENTER_NAME_CHANGE:String = "PRESENTER_NAME_CHANGE"; public static const SWITCH_TO_VIEWER_MODE:String = "VIEWER_MODE"; public static const SWITCH_TO_PRESENTER_MODE:String = "PRESENTER_MODE"; public var presenterName:String; public var assignerBy:String; public var userID:String; public function MadePresenterEvent(type:String) { super(type, true, false); } } }
/* * =BEGIN MIT LICENSE * * The MIT License (MIT) * * Copyright (c) 2014 Andras Csizmadia * http://www.vpmedia.hu * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * * =END MIT LICENSE * */ package { import com.docmet.extensions.BotanCryptoExtension; import flash.display.Shape; import flash.display.Sprite; import flash.display.StageAlign; import flash.display.StageScaleMode; import flash.events.Event; import flash.filesystem.StorageVolume; import flash.filesystem.StorageVolumeInfo; import flash.text.TextField; import flash.text.TextFormat; import flash.utils.getTimer; /** * ANE Tester Client Document Class */ public class Main extends Sprite { /** * @private */ private var extension:BotanCryptoExtension; /** * @private */ private var messageLabel:TextField; //---------------------------------- // Constructor //---------------------------------- /** * Constructor */ public function Main() { addEventListener(Event.ADDED_TO_STAGE, onAdded, false, 0, true); } /** * @private */ private function onRemoved(event:Event):void { if (extension) extension.dispose(); } /** * @private */ private function onAdded(event:Event):void { removeEventListener(Event.ADDED_TO_STAGE, onAdded); addEventListener(Event.REMOVED_FROM_STAGE, onRemoved, false, 0, true); stage.scaleMode = StageScaleMode.NO_SCALE; stage.align = StageAlign.TOP_LEFT; const sw:uint = stage.fullScreenWidth; const sh:uint = stage.fullScreenHeight; var bg:Shape = new Shape(); bg.graphics.beginFill(0x333333); bg.graphics.drawRect(0, 0, sw, sh); bg.graphics.endFill(); addChild(bg); // create log text field messageLabel = new TextField(); messageLabel.width = sw; messageLabel.height = sh; messageLabel.multiline = true; messageLabel.wordWrap = true; messageLabel.defaultTextFormat = new TextFormat("Arial", 10, 0xFFFFFF); addChild(messageLabel); // create native extension context extension = new BotanCryptoExtension(); extension.setLogger(function (message:String):void { message = "ANE::" + message; log(message); }); //extension.callNative(BotanCryptoExtension.EXT_SHA_512); // returns -1 since too few parameters extension.callNative(BotanCryptoExtension.EXT_SHA_512, "HelloWorld"); extension.callNative(BotanCryptoExtension.EXT_SHA_512, "Hello World"); } /** * @private */ private function log(message:String):void { const msg:String = getTimer() + " :: " + message; trace(this, msg); messageLabel.text += msg + "\n"; messageLabel.scrollV = messageLabel.maxScrollV; } // EOC } //EOP }
/* Copyright (c) 2006-2013 Regents of the University of Minnesota. For licensing terms, see the file LICENSE. */ /* A size-limited stack which holds anything. If the limit is exceeded, excess items are deleted from the bottom. More generic than original Stack used by the commands.Command_Manager */ package utils.misc { public dynamic class Stack { protected var data:Array; protected var limit:int = 0; // *** Constructor // Create a stack that can hold up to limit items. Omit limit for no // limit. public function Stack(limit:int = 0) { this.data = new Array(); this.limit = limit; } // *** Getters and setters // public function as_array() :Array { return this.data; } // public function get length() :int { return this.data.length; } // *** Other methods // Remove all items from the stack. public function clear() :void { this.data.length = 0; } // Return true if the stack is empty, false otherwise. public function is_empty() :Boolean { return (this.data.length == 0); } // Return the item at the top of the stack, but don't remove it. If // the stack is empty, return null. public function peek() :* { if (this.is_empty()) { return null; } else { return this.data[this.data.length-1]; } } // Pop an item. If the stack is empty, return null. public function pop() :* { if (this.is_empty()) { return null; } else { return this.data.pop(); } } // Push an item. Return the old last item in the stack if it was // removed because of stack size limits, null otherwise. public function push(c:*) :* { this.data.push(c); if ((this.limit > 0) && (this.data.length > this.limit)) { return this.data.shift(); } else { return null; } } // *** // public function toString() :String { var str:String = 'Cmd_Stk: size: ' + String(this.length) + '/ limit: ' + String(this.limit) + '/ cmds: ' + this.data ; return str; } } }
package flare.data.converters { import flare.data.DataSchema; import flare.data.DataSet; import flash.utils.IDataInput; import flash.utils.IDataOutput; /** * Interface for data converters that map between an external data file * format and ActionScript objects (e.g., Arrays and Objects). */ public interface IDataConverter { /** * Converts data from an external format into ActionScript objects. * @param input the loaded input data * @param schema a data schema describing the structure of the data. * Schemas are optional in many but not all cases. * @return a DataSet instance containing converted data objects. */ function read(input:IDataInput, schema:DataSchema=null):DataSet; /** * Converts data from ActionScript objects into an external format. * @param data the data set to write. * @param output an object to which to write the output. If this value * is null, a new <code>ByteArray</code> will be created. * @return the converted data. If the <code>output</code> parameter is * non-null, it is returned. Otherwise the return value will be a * newly created <code>ByteArray</code> */ function write(data:DataSet, output:IDataOutput=null):IDataOutput; } // end of interface IDataConverter }
package org.tuio.windows7 { import flash.display.DisplayObject; import flash.display.Stage; import flash.events.TouchEvent; import flash.geom.Point; import flash.ui.Multitouch; import flash.ui.MultitouchInputMode; import org.tuio.TuioContainer; import org.tuio.TuioCursor; import org.tuio.TuioManager; import org.tuio.debug.TuioDebug; import org.tuio.util.DisplayListHelper; public class Windows7TouchToTuioDispatcher{ private var stage:Stage; private var useTuioManager:Boolean; private var useTuioDebug:Boolean; public function Windows7TouchToTuioDispatcher(stage:Stage, useTuioManager:Boolean = true, useTuioDebug:Boolean = true){ this.stage = stage; this.useTuioManager = useTuioManager; this.useTuioDebug = useTuioDebug; Multitouch.inputMode = MultitouchInputMode.TOUCH_POINT; stage.addEventListener(TouchEvent.TOUCH_BEGIN, touchBegin); stage.addEventListener(TouchEvent.TOUCH_MOVE, dispatchTouchMove); stage.addEventListener(TouchEvent.TOUCH_END, dispatchTouchUp); stage.addEventListener(TouchEvent.TOUCH_TAP, dispatchTap); } private function dispatchTap(event:TouchEvent):void{ var stagePos:Point = new Point(event.stageX, event.stageY); var target:DisplayObject = DisplayListHelper.getTopDisplayObjectUnderPoint(stagePos, stage); var local:Point = target.globalToLocal(new Point(stagePos.x, stagePos.y)); target.dispatchEvent(new org.tuio.TouchEvent(org.tuio.TouchEvent.TAP, true, false, local.x, local.y, stagePos.x, stagePos.y, target, createTuioContainer(event))); } private function touchBegin(event:TouchEvent):void{ if(this.useTuioManager){ TuioManager.getInstance().handleAdd(createTuioContainer(event)); }else{ var stagePos:Point = new Point(event.stageX, event.stageY); var target:DisplayObject = DisplayListHelper.getTopDisplayObjectUnderPoint(stagePos, stage); var local:Point = target.globalToLocal(new Point(stagePos.x, stagePos.y)); target.dispatchEvent(new org.tuio.TouchEvent(org.tuio.TouchEvent.TOUCH_DOWN, true, false, local.x, local.y, stagePos.x, stagePos.y, target, createTuioContainer(event))); } if(this.useTuioDebug){ TuioDebug.getInstance().addTuioCursor(createTuioCursor(event)); } } private function dispatchTouchMove(event:TouchEvent):void{ if(this.useTuioManager){ TuioManager.getInstance().handleUpdate(createTuioContainer(event)); }else{ var stagePos:Point = new Point(event.stageX, event.stageY); var target:DisplayObject = DisplayListHelper.getTopDisplayObjectUnderPoint(stagePos, stage); var local:Point = target.globalToLocal(new Point(stagePos.x, stagePos.y)); target.dispatchEvent(new org.tuio.TouchEvent(org.tuio.TouchEvent.TOUCH_MOVE, true, false, local.x, local.y, stagePos.x, stagePos.y, target, createTuioContainer(event))); } if(this.useTuioDebug){ TuioDebug.getInstance().updateTuioCursor(createTuioCursor(event)); } } private function dispatchTouchUp(event:TouchEvent):void{ if(this.useTuioManager){ TuioManager.getInstance().handleRemove(createTuioContainer(event)); }else{ var stagePos:Point = new Point(event.stageX, event.stageY); var target:DisplayObject = DisplayListHelper.getTopDisplayObjectUnderPoint(stagePos, stage); var local:Point = target.globalToLocal(new Point(stagePos.x, stagePos.y)); target.dispatchEvent(new org.tuio.TouchEvent(org.tuio.TouchEvent.TOUCH_UP, true, false, local.x, local.y, stagePos.x, stagePos.y, target, createTuioContainer(event))); } if(this.useTuioDebug){ TuioDebug.getInstance().removeTuioCursor(createTuioCursor(event)); } } private function createTuioContainer(event:TouchEvent):TuioContainer{ return new TuioContainer("2Dcur",event.touchPointID,event.stageX/stage.stageWidth, event.stageY/stage.stageHeight,0,0,0,0,0,0); } private function createTuioCursor(event:TouchEvent):TuioCursor{ return new TuioCursor("2Dcur",event.touchPointID,event.stageX/stage.stageWidth, event.stageY/stage.stageHeight,0,0,0,0,0,0); } } }
// Decompiled by AS3 Sorcerer 6.08 // www.as3sorcerer.com //kabam.rotmg.core.model.MapModel package kabam.rotmg.core.model { import com.company.assembleegameclient.objects.IInteractiveObject; import com.company.assembleegameclient.map.Map; public class MapModel { public var currentInteractiveTarget:IInteractiveObject; public var currentMap:Map; } }//package kabam.rotmg.core.model
/* Copyright aswing.org, see the LICENCE.txt. */ import GUI.fox.aswing.Component; import GUI.fox.aswing.EventDispatcher; import GUI.fox.aswing.util.EnterFrameEventDispatcher; import GUI.fox.aswing.util.HashMap; /** * RepaintManager use to manager the component's painting. * * <p>If you want to repaint a component, call its repaint method, it will regist itself * to RepaintManager, when frame ended, it will call its paintImmediately to paint its. * So component's repaint method is fast. But it will not paint immediately, if you want to paint * it immediately, you should call paintImmediately method, but it is not fast. * @author iiley */ class GUI.fox.aswing.RepaintManager extends EventDispatcher{ /** * When the paint time before all component painted. *<br> * onBeforePaint(target:RepaintManager) */ public static var ON_BEFORE_PAINT:String = "onBeforePaint"; /** * When the paint time after all component painted. *<br> * onAfterPaint(target:RepaintManager) */ public static var ON_AFTER_PAINT:String = "onAfterPaint"; private static var instance:RepaintManager; /** * although it's a set in fact, but it work more like a queue * just one component would only located one position.(one time a component do not need more than one painting) */ private var repaintQueue:HashMap; /** * similar to repaintQueue */ private var validateQueue:HashMap; private var afterNextTimeFuncs:Array; private var beforeNextTimeFuncs:Array; private function RepaintManager(){ EnterFrameEventDispatcher.addEventListener(tick, this); repaintQueue = new HashMap(); validateQueue = new HashMap(); afterNextTimeFuncs = new Array(); beforeNextTimeFuncs = new Array(); } public static function getInstance():RepaintManager{ if(instance == null){ instance = new RepaintManager(); } return instance; } /** * Set to call a function at next paint time after all component painted. */ public function addCallAfterNextPaintTime(func:Function):Void{ afterNextTimeFuncs.push(func); } /** * Set to call a function at next paint time before all component painted. */ public function addCallBeforeNextPaintTime(func:Function):Void{ beforeNextTimeFuncs.push(func); } /** * Regist A Component need to repaint. * @see GUI.fox.aswing.Component#repaint() */ public function addRepaintComponent(com:Component):Void{ repaintQueue.put(com.getID(), com); } /** * Find the Component's validate root parent and regist it need to validate. * @see GUI.fox.aswing.Component#revalidate() * @see GUI.fox.aswing.Component#validate() * @see GUI.fox.aswing.Component#invalidate() */ public function addInvalidComponent(com:Component):Void{ var validateRoot:Component = getValidateRootComponent(com); if(validateRoot != null){ validateQueue.put(validateRoot.getID(), validateRoot); } } /** * Regists it need to validate. * @see GUI.fox.aswing.Component#validate() */ public function addInvalidRootComponent(com:Component):Void{ validateQueue.put(com.getID(), com); } /** * If a ancestors of component has no parent or it is isValidateRoot * and it's parent are visible, then it will be the validate root component, * else it has no validate root component. */ private function getValidateRootComponent(com:Component):Component{ var validateRoot:Component = null; for(var i:Component = com; i!=null; i=i.getParent()){ if(i.isValidateRoot()){ validateRoot = i; break; } } var root:Component = null; for(var i:Component = validateRoot; i!=null; i=i.getParent()){ if(!i.isVisible()){ //return null; } } return validateRoot; } /** * Every frame this method will be executed to invoke the painting of components needed. */ public function tick():Void{ var i:Number; var n:Number; dispatchEvent(createEventObj(ON_BEFORE_PAINT)); var befores:Array = beforeNextTimeFuncs; beforeNextTimeFuncs = new Array(); n = befores.length; i = -1; while((++i) < n){ befores[i](); } // var time:Number = getTimer(); var processValidates:Array = validateQueue.values(); //must clear here, because there maybe addRepaintComponent at below operation validateQueue.clear(); n = processValidates.length; i = -1; if(n > 0){ //trace("------------------------one tick---------------------------"); } while((++i) < n){ var com:Component = Component(processValidates[i]); com.validate(); //trace("validating com : " + com); } // if(n > 0){ // trace(n + " validate time : " + (getTimer() - time)); // } // time = getTimer(); var processRepaints:Array = repaintQueue.values(); //must clear here, because there maybe addInvalidComponent at below operation repaintQueue.clear(); n = processRepaints.length; i = -1; while((++i) < n){ var com:Component = Component(processRepaints[i]); com.paintImmediately(); } // if(n > 0){ // trace(n + " paint time : " + (getTimer() - time)); // } var afters:Array = afterNextTimeFuncs; afterNextTimeFuncs = new Array(); n = afters.length; i = -1; while((++i) < n){ afters[i](); } dispatchEvent(createEventObj(ON_AFTER_PAINT)); } }
/* Copyright aswing.org, see the LICENCE.txt. */ package org.aswing{ import org.aswing.event.InteractiveEvent; import org.aswing.plaf.basic.BasicScrollBarUI; /** * Dispatched when the scrollBar's state changed. * @see BoundedRangeModel * @eventType org.aswing.event.InteractiveEvent.STATE_CHANGED */ [Event(name="stateChanged", type="org.aswing.event.InteractiveEvent")] /** * An implementation of a scrollbar. The user positions the knob in the scrollbar to determine the contents of * the viewing area. The program typically adjusts the display so that the end of the scrollbar represents the * end of the displayable contents, or 100% of the contents. The start of the scrollbar is the beginning of the * displayable contents, or 0%. The position of the knob within those bounds then translates to the corresponding * percentage of the displayable contents. * <p> * Typically, as the position of the knob in the scrollbar changes a corresponding change is * made to the position of the JViewport on the underlying view, changing the contents of the * JViewport. * </p> * @author iiley */ public class JScrollBar extends Component implements Orientable{ /** * Horizontal orientation. */ public static const HORIZONTAL:int = AsWingConstants.HORIZONTAL; /** * Vertical orientation. */ public static const VERTICAL:int = AsWingConstants.VERTICAL; private var model:BoundedRangeModel; private var orientation:Number; private var unitIncrement:Number; private var blockIncrement:Number; /** * JScrollBar(orientation:Number, value:Number, extent:Number, min:Number, max:Number)<br> * JScrollBar(orientation:Number) default to value=0, extent=10, min=0, max=100<br> * <p> * Creates a scrollbar with the specified orientation, value, extent, minimum, and maximum. * The "extent" is the size of the viewable area. It is also known as the "visible amount". * <p> * Note: Use setBlockIncrement to set the block increment to a size slightly smaller than * the view's extent. That way, when the user jumps the knob to an adjacent position, one * or two lines of the original contents remain in view. * * @param orientation the scrollbar's orientation to either VERTICAL or HORIZONTAL. * @param value * @param extent * @param min * @param max */ public function JScrollBar(orientation:int=AsWingConstants.VERTICAL, value:int=0, extent:int=10, min:int=0, max:int=100){ super(); setName("JScrollBar"); unitIncrement = 1; blockIncrement = (extent == 0 ? 10 : extent); setOrientation(orientation); setModel(new DefaultBoundedRangeModel(value, extent, min, max)); updateUI(); } override public function updateUI():void{ setUI(UIManager.getUI(this)); } override public function getDefaultBasicUIClass():Class{ return org.aswing.plaf.basic.BasicScrollBarUI; } override public function getUIClassID():String{ return "ScrollBarUI"; } /** * @return the orientation. */ public function getOrientation():int{ return orientation; } /** * Sets the orientation. */ public function setOrientation(orientation:int):void{ var oldValue:int = this.orientation; this.orientation = orientation; if (orientation != oldValue){ revalidate(); repaint(); } } /** * Returns data model that handles the scrollbar's four fundamental properties: minimum, maximum, value, extent. * @return the data model */ public function getModel():BoundedRangeModel{ return model; } /** * Sets the model that handles the scrollbar's four fundamental properties: minimum, maximum, value, extent. * @param the data model */ public function setModel(newModel:BoundedRangeModel):void{ if (model != null){ model.removeStateListener(__modelStateListener); } model = newModel; if (model != null){ model.addStateListener(__modelStateListener); } } /** * Sets the unit increment * @param unitIncrement the unit increment * @see #getUnitIncrement() */ public function setUnitIncrement(unitIncrement:int):void{ this.unitIncrement = unitIncrement; } /** * Returns the amount to change the scrollbar's value by, given a unit up/down request. * A ScrollBarUI implementation typically calls this method when the user clicks on a * scrollbar up/down arrow and uses the result to update the scrollbar's value. * Subclasses my override this method to compute a value, e.g. the change required * to scroll up or down one (variable height) line text or one row in a table. * <p> * The JScrollPane component creates scrollbars (by default) that then * set the unit increment by the viewport, if it has one. The {@link Viewportable} interface * provides a method to return the unit increment. * * @return the unit increment * @see org.aswing.JScrollPane * @see org.aswing.Viewportable */ public function getUnitIncrement():int{ return unitIncrement; } /** * Sets the block increment. * @param blockIncrement the block increment. * @see #getBlockIncrement() */ public function setBlockIncrement(blockIncrement:int):void{ this.blockIncrement = blockIncrement; } /** * Returns the amount to change the scrollbar's value by, given a block (usually "page") * up/down request. A ScrollBarUI implementation typically calls this method when the * user clicks above or below the scrollbar "knob" to change the value up or down by * large amount. Subclasses my override this method to compute a value, e.g. the change * required to scroll up or down one paragraph in a text document. * <p> * The JScrollPane component creates scrollbars (by default) that then * set the block increment by the viewport, if it has one. The {@link Viewportable} interface * provides a method to return the block increment. * * @return the block increment * @see JScrollPane * @see Viewportable */ public function getBlockIncrement():int{ return blockIncrement; } /** * Returns the scrollbar's value. * @return the scrollbar's value property. * @see #setValue() * @see BoundedRangeModel#getValue() */ public function getValue():int{ return getModel().getValue(); } /** * Sets the scrollbar's value. This method just forwards the value to the model. * @param value the value to set. * @param programmatic indicate if this is a programmatic change. * @see #getValue() * @see BoundedRangeModel#setValue() */ public function setValue(value:int, programmatic:Boolean=true):void{ var m:BoundedRangeModel = getModel(); m.setValue(value, programmatic); } /** * Returns the scrollbar's extent. In many scrollbar look and feel * implementations the size of the scrollbar "knob" or "thumb" is proportional to the extent. * @return the scrollbar's extent. * @see #setVisibleAmount() * @see BoundedRangeModel#getExtent() */ public function getVisibleAmount():int{ return getModel().getExtent(); } /** * Set the model's extent property. * @param extent the extent to set * @see #getVisibleAmount() * @see BoundedRangeModel#setExtent() */ public function setVisibleAmount(extent:int):void{ getModel().setExtent(extent); } /** * Returns the minimum value supported by the scrollbar (usually zero). * @return the minimum value supported by the scrollbar * @see #setMinimum() * @see BoundedRangeModel#getMinimum() */ public function getMinimum():int{ return getModel().getMinimum(); } /** * Sets the model's minimum property. * @param minimum the minimum to set. * @see #getMinimum() * @see BoundedRangeModel#setMinimum() */ public function setMinimum(minimum:int):void{ getModel().setMinimum(minimum); } /** * Returns the maximum value supported by the scrollbar. * @return the maximum value supported by the scrollbar * @see #setMaximum() * @see BoundedRangeModel#getMaximum() */ public function getMaximum():int{ return getModel().getMaximum(); } /** * Sets the model's maximum property. * @param maximum the maximum to set. * @see #getMaximum() * @see BoundedRangeModel#setMaximum() */ public function setMaximum(maximum:int):void{ getModel().setMaximum(maximum); } /** * True if the scrollbar knob is being dragged. * @return the value of the model's valueIsAdjusting property */ public function getValueIsAdjusting():Boolean{ return getModel().getValueIsAdjusting(); } /** * Sets the model's valueIsAdjusting property. Scrollbar look and feel * implementations should set this property to true when a knob drag begins, * and to false when the drag ends. The scrollbar model will not generate * ChangeEvents while valueIsAdjusting is true. * @see BoundedRangeModel#setValueIsAdjusting() */ public function setValueIsAdjusting(b:Boolean):void{ var m:BoundedRangeModel = getModel(); m.setValueIsAdjusting(b); } /** * Sets the four BoundedRangeModel properties after forcing the arguments to * obey the usual constraints: "minimum le value le value+extent le maximum" * ("le" means less or equals) */ public function setValues(newValue:int, newExtent:int, newMin:int, newMax:int, programmatic:Boolean=true):void{ var m:BoundedRangeModel = getModel(); m.setRangeProperties(newValue, newExtent, newMin, newMax, m.getValueIsAdjusting(), programmatic); } /** * Adds a listener to listen the scrollBar's state change event. * @param listener the listener * @param priority the priority * @param useWeakReference Determines whether the reference to the listener is strong or weak. * @see org.aswing.event.InteractiveEvent#STATE_CHANGED */ public function addStateListener(listener:Function, priority:int=0, useWeakReference:Boolean=false):void{ addEventListener(InteractiveEvent.STATE_CHANGED, listener, false, priority); } /** * Removes a state listener. * @param listener the listener to be removed. * @see org.aswing.event.InteractiveEvent#STATE_CHANGED */ public function removeStateListener(listener:Function):void{ removeEventListener(InteractiveEvent.STATE_CHANGED, listener); } protected function __modelStateListener(event:InteractiveEvent):void{ dispatchEvent(new InteractiveEvent(InteractiveEvent.STATE_CHANGED, event.isProgrammatic())); } override public function setEnabled(b:Boolean):void{ super.setEnabled(b); mouseChildren = b; } } }
package dagd.myles { import flash.display.MovieClip; import flash.events.MouseEvent; public class Asteroid extends MovieClip { public var isDead: Boolean = false; public var health:Number = 0; public function Asteroid() { // constructor code x = Math.random() * 800; y = 0; addEventListener(MouseEvent.MOUSE_OVER, mouseOver); } //this function's job is to perform any cleanup //before an object is removed from the games. public function dispose(): void { removeEventListener(MouseEvent.MOUSE_OVER, mouseOver); } // this function should run every game tick. // it dictates the behavior of an object. public function update(): void { x += 4; y += 5; if (x > 800) { // checks if off right side of screen isDead = true; } if (y > 500) { isDead = true; } } // ends update() private function mouseOver(e: MouseEvent): void { isDead = true; health = 1; } } // ends Asteroid class } // ends package
//////////////////////////////////////////////////////////////////////////////// // // Licensed to the Apache Software Foundation (ASF) under one or more // contributor license agreements. See the NOTICE file distributed with // this work for additional information regarding copyright ownership. // The ASF licenses this file to You under the Apache License, Version 2.0 // (the "License"); you may not use this file except in compliance with // the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // //////////////////////////////////////////////////////////////////////////////// package { import flash.display.DisplayObject; import flash.net.URLLoader; import flash.net.URLRequest; import flash.events.Event; import flash.system.Capabilities; import flash.filesystem.File; [Mixin] /** * Location of a hash table of tests not to run. * This mixin should find the excludes written to one of two locations. * Browsers runs are picky about where they find the excludes, so, we serve them * up via http (in a sibling location to the tests). * The file is one test per line of the form ScriptName$TestID * The location of the file is assumed to be c:/temp on windows, * or /tmp on Unix. */ public class ExcludeFileLocationApollo { private static var loader:URLLoader; private static var url:String; private static var mustellaDir:String; private static var frontURL:String; private static var domain:String; public static var excludeFile:String = "ExcludeList.txt"; /** * tell UnitTester it should wait for this load to complete */ UnitTester.waitForExcludes = true; public static var _root:DisplayObject; public static var triedBrowser:Boolean = false; public static var triedNormal:Boolean = false; // we try the http spot, in case this is a browser run public static function init(root:DisplayObject):void { trace ("Hello from excludes at: " + new Date()); var os:String = Capabilities.os; // This seems to be a timing issue which pops up on some machines. if( UnitTester.cv == null ){ UnitTester.cv = new ConditionalValue(); } if( (UnitTester.cv.os != null) && (UnitTester.cv.os.toLowerCase() == DeviceNames.ANDROID.toLowerCase()) ){ mustellaDir = ".."; excludeFile = UnitTester.excludeFile; trace("Doing Android style exclude. Checking in " + mustellaDir + "/" + excludeFile); }else if( (UnitTester.cv.os != null) && (UnitTester.cv.os.toLowerCase() == DeviceNames.IOS.toLowerCase()) ){ mustellaDir = File.documentsDirectory.url; excludeFile = UnitTester.excludeFile; }else if (os.indexOf ("QNX") > -1) { mustellaDir = ".."; excludeFile = UnitTester.excludeFile; trace("Doing QNX style exclude. Checking in " + mustellaDir + "/" + excludeFile); } else{ if (os.indexOf ("Windows") != -1) { excludeFile = "ExcludeListWinAIR.txt"; } else if (os.indexOf ("Mac") != -1) { excludeFile = "ExcludeListMacAIR.txt"; } else if (os.indexOf ("Linux") != -1) { excludeFile = "ExcludeListLinux.txt"; } else { trace ("Excludes: bad: we didn't see an OS we liked: " + os); excludeFile = "ExcludeListWin.txt"; } _root = root; url = root.loaderInfo.url; if (url.indexOf("app:")!=-1) { ApolloFilePath.init (root); url = encodeURI2(ApolloFilePath.apolloAdjust(url)); trace ("Adjusting path for AIR to: " + url); // url = adjustPath(url); } mustellaDir = url.substring (0, url.indexOf ("mustella/tests")+14); frontURL = url.substring (0, url.indexOf (":")); domain = url.substring (url.indexOf (":")+3); domain = domain.substring (0, domain.indexOf ("/")); } loadTryNormal(); } private static function apolloAdjust(url:String):String { var swf:String = _root.loaderInfo.url; var f:File = new File (swf); // clean it up: var myPattern:RegExp = /\\/g; var path:String = f.nativePath; path = path.replace (myPattern, "/"); path = path.replace (":", "|"); // yank off the swfs directory, which we're in path = path.substr (0, path.lastIndexOf ("/")-1); path = path.substr (0, path.lastIndexOf ("/")); if (url.indexOf ("../")==0) url = url.substring (2); if (url.indexOf ("/..")==0) { url = url.substring (3); path = path.substr (0, path.lastIndexOf ("/")); } /// create the final url path = path + url; return "file:///" + path; } public static var adjustPath:Function = function(url:String):String { return url; }; private static function encodeURI2(s:String):String { var pos:int = s.lastIndexOf("/"); if (pos != -1) { var fragment:String = s.substring(pos + 1); s = s.substring(0, pos + 1); fragment= encodeURIComponent(fragment); s = s + fragment; } return s; } public static function loadTryBrowser():void { trace ("excludes loadTryBrowser at: " + new Date().toString()); triedBrowser = true; var currentOS:String = Capabilities.os; var useFile:String = "http://localhost/" + excludeFile; trace ("try excludes from here: " + useFile); var req:URLRequest = new URLRequest(useFile); loader = new URLLoader(); loader.addEventListener("complete", completeHandler); loader.addEventListener("securityError", errorHandler); loader.addEventListener("ioError", errorHandler); loader.load(req); } /// if it worked, all good private static function completeHandler(event:Event):void { trace ("Excludes: from web server"); postProcessData(event); } /** * A non-browser will get its results from the /tmp location. * It should be a failure to get here; we try the browser case first * because it throws a nasty seciry * */ public static function errorHandler(event:Event):void { trace ("Exclude: in the web read error handler"); if (!triedNormal) { loadTryNormal(); } } public static function loadTryNormal():void { triedNormal = true; trace ("excludes loadTryFile " + new Date().toString()); var currentOS:String = Capabilities.os; var useFile:String; useFile = mustellaDir +"/" + excludeFile; trace ("Exclude: try load from: " + useFile); var req:URLRequest = new URLRequest(useFile); loader = new URLLoader(); loader.addEventListener("complete", completeHandler2); loader.addEventListener("ioError", errorHandler2); loader.addEventListener("securityError", errorHandler2); loader.load(req); } private static function errorHandler2(event:Event):void { trace ("Exclude: error in the exclude file load " +event); if (!triedBrowser) { loadTryBrowser(); } } private static function completeHandler2(event:Event):void { trace ("Excludes: Reading from file system at "+mustellaDir ); postProcessData(event); } private static function postProcessData(event:Event):void { var data:String = loader.data; // DOS end of line var delimiter:RegExp = new RegExp("\r\n", "g"); data = data.replace(delimiter, ","); // Unix end of line delimiter = new RegExp("\n", "g"); data = data.replace(delimiter, ","); UnitTester.excludeList = new Object(); var items:Array = data.split(","); var n:int = items.length; for (var i:int = 0; i < n; i++) { var s:String = items[i]; if (s.length) UnitTester.excludeList[s] = 1; } UnitTester.waitForExcludes = false; UnitTester.pre_startEventHandler(event); } } }
package com.playata.application.ui.elements.convention { import com.greensock.TimelineMax; import com.greensock.easing.Back; import com.greensock.easing.Quart; import com.playata.application.data.GameUtil; import com.playata.application.data.convention.Convention; import com.playata.application.data.convention.ConventionShow; import com.playata.application.data.user.User; import com.playata.application.ui.dialogs.DialogTutorialConventions; import com.playata.application.ui.elements.fan_foto.UiFansThermometer; import com.playata.application.ui.elements.generic.button.UiButton; import com.playata.application.ui.elements.generic.textfield.UiTextTooltip; import com.playata.framework.application.Environment; import com.playata.framework.core.timer.ITimer; import com.playata.framework.core.util.TimeUtil; import com.playata.framework.display.IDisplayObjectContainer; import com.playata.framework.display.UriSprite; import com.playata.framework.input.InteractionEvent; import com.playata.framework.localization.LocText; import visuals.ui.elements.conventions.SymbolConventionShowBriefingContentGeneric; public class UiConventionShowBriefingContent { private var _content:SymbolConventionShowBriefingContentGeneric = null; private var _convention:Convention = null; private var _npcFansBar:UiFansThermometer = null; private var _tooltipTimeLeft:UiTextTooltip = null; private var _tooltipRewards:UiTextTooltip; private var _timer:ITimer = null; private var _tooltipXp:UiTextTooltip = null; private var _bannerLeftContainer:IDisplayObjectContainer; private var _bannerRightContainer:IDisplayObjectContainer; private var _timeline:TimelineMax; private var _btnHelp:UiButton; private var _reward1:UiConventionReward; public function UiConventionShowBriefingContent(param1:SymbolConventionShowBriefingContentGeneric, param2:IDisplayObjectContainer, param3:IDisplayObjectContainer) { super(); _content = param1; _bannerLeftContainer = param2; _bannerRightContainer = param3; _tooltipTimeLeft = new UiTextTooltip(_content.txtTimeLeft,LocText.current.text("dialog/convention_show_briefing/time_left_tooltip")); _npcFansBar = new UiFansThermometer(_content.progress,10,10); _tooltipXp = new UiTextTooltip(_content.txtXp,""); _tooltipRewards = new UiTextTooltip(_content.txtRewardsCaption,LocText.current.text("convention/reward_info_tooltip")); _reward1 = new UiConventionReward(_content.reward1); _timer = Environment.createTimer("UiConventionShowBriefingContent::timer",1000,onTimerEvent); _bannerLeftContainer.removeAllChildren(); _bannerRightContainer.removeAllChildren(); _timeline = new TimelineMax({"paused":true}); _timeline.insert(_bannerLeftContainer.tweenFrom(0.5,{ "x":130.toString(), "ease":Quart.easeOut })); _timeline.insert(_bannerLeftContainer.tweenFrom(1,{ "rotation":"-20", "ease":Back.easeOut })); _timeline.insert(_bannerRightContainer.tweenFrom(0.5,{ "x":(-130).toString(), "ease":Quart.easeOut })); _timeline.insert(_bannerRightContainer.tweenFrom(1,{ "rotation":"20", "ease":Back.easeOut })); _btnHelp = new UiButton(param1.btnHelp,LocText.current.text("general/button_help"),onClickHelp); param1.addChild(_btnHelp); } private function onClickHelp(param1:InteractionEvent) : void { Environment.panelManager.showDialog(new DialogTutorialConventions()); } public function dispose() : void { if(_timeline) { _timeline.clear(); } _timer.dispose(); _timer = null; _npcFansBar.dispose(); _npcFansBar = null; _tooltipTimeLeft.dispose(); _tooltipTimeLeft = null; _tooltipXp.dispose(); _tooltipXp = null; _tooltipRewards.dispose(); _tooltipRewards = null; _btnHelp.dispose(); _btnHelp = null; _reward1.dispose(); _reward1 = null; } public function get content() : SymbolConventionShowBriefingContentGeneric { return _content; } public function refresh(param1:Convention) : void { _convention = param1; if(_convention == null) { return; } _content.txtConventionName.text = _convention.name; _content.txtBriefing.text = _convention.nextShowBriefing; _content.txtBriefing.autoFontSize = true; _content.txtRequirementsCaption.text = LocText.current.text("dialog/convention_show_briefing/requirements_caption"); _content.txtDuration.text = LocText.current.text("dialog/convention_show_briefing/requirement_time_format",TimeUtil.secondsToString(ConventionShow.showDuration)); _content.txtRewardsCaption.text = LocText.current.text("dialog/convention_show_briefing/rewards_caption"); _content.txtGameCurrency.text = _convention.nextShowReward; _content.txtXp.text = "+" + GameUtil.getXpString(_convention.ownXpRewardNextShow); _content.txtXpTotal.htmlText = LocText.current.text("dialog/convention_show_briefing/reward_xp_total","<font color=\"#ff00e4\">" + LocText.current.formatHugeNumber(_convention.ownXpRewardTotalNextShow) + "</font>"); _content.txtXpTotal.x = _content.txtXp.x + _content.txtXp.textWidth + 12; _tooltipXp.text = LocText.current.text("dialog/convention_show_briefing/reward_xp_tooltip",GameUtil.getXpString(_convention.ownXpRewardTotalNextShow),GameUtil.getXpString(_convention.ownXpRewardNextShow)); _reward1.setValue(1,LocText.current.text("dialog/convention_show_briefing/reward_quest_energy"),LocText.current.text("dialog/convention_show_briefing/reward_quest_energy_tooltip",GameUtil.getHighestConventionRewardValue(1))); refreshHitpoints(); _bannerLeftContainer.removeAllChildren(); var _loc3_:IDisplayObjectContainer = UriSprite.load(_convention.bannerLeftUrl,130,290,true); _loc3_.x = -130; _bannerLeftContainer.addChild(_loc3_); _bannerRightContainer.removeAllChildren(); var _loc2_:IDisplayObjectContainer = UriSprite.load(_convention.bannerRightUrl,130,290,true); _bannerRightContainer.addChild(_loc2_); _timer.start(); onTimerEvent(); } public function showBanner() : void { _timeline.timeScale(1); _timeline.play(); } public function hideBanner() : void { if(!_timeline) { return; } _timeline.timeScale(2); _timeline.reverse(); } public function refreshHitpoints() : void { if(_convention == null) { return; } _npcFansBar.maximum = _convention.fansTotal; _npcFansBar.value = _convention.fansCurrent; } private function onTimerEvent() : void { if(!User.current) { if(_timer) { _timer.stop(); } return; } if(_convention == null) { return; } _content.txtTimeLeft.text = TimeUtil.secondsToStringFormat(_convention.remainingSeconds,"H:m:s"); } } }
/* Feathers Copyright 2012-2014 Joshua Tynjala. All Rights Reserved. This program is free software. You can redistribute and/or modify it in accordance with the terms of the accompanying license agreement. */ package feathers.controls { import feathers.system.DeviceCapabilities; import feathers.utils.display.getDisplayObjectDepthFromStage; import flash.events.KeyboardEvent; import flash.ui.Keyboard; import starling.core.Starling; import starling.events.Event; /** * A screen for use with <code>ScreenNavigator</code>, based on <code>Panel</code> * in order to provide a header and layout. * * <p>This component is generally not instantiated directly. Instead it is * typically used as a super class for concrete implementations of screens. * With that in mind, no code example is included here.</p> * * <p>The following example provides a basic framework for a new panel screen:</p> * * <listing version="3.0"> * package * { * import feathers.controls.PanelScreen; * * public class CustomScreen extends PanelScreen * { * public function CustomScreen() * { * this.addEventListener( FeathersEventType.INITIALIZE, initializeHandler ); * } * * private function initializeHandler( event:Event ):void * { * //runs once when screen is first added to the stage. * //a good place to add children and customize the layout * } * } * }</listing> * * @see ScreenNavigator * @see ScrollScreen * @see Screen * @see Panel * @see http://wiki.starling-framework.org/feathers/panel-screen */ public class PanelScreen extends Panel implements IScreen { /** * The default value added to the <code>nameList</code> of the header. * * @see feathers.core.IFeathersControl#nameList */ public static const DEFAULT_CHILD_NAME_HEADER:String = "feathers-panel-screen-header"; /** * @copy feathers.controls.Scroller#SCROLL_POLICY_AUTO * * @see feathers.controls.Scroller#horizontalScrollPolicy * @see feathers.controls.Scroller#verticalScrollPolicy */ public static const SCROLL_POLICY_AUTO:String = "auto"; /** * @copy feathers.controls.Scroller#SCROLL_POLICY_ON * * @see feathers.controls.Scroller#horizontalScrollPolicy * @see feathers.controls.Scroller#verticalScrollPolicy */ public static const SCROLL_POLICY_ON:String = "on"; /** * @copy feathers.controls.Scroller#SCROLL_POLICY_OFF * * @see feathers.controls.Scroller#horizontalScrollPolicy * @see feathers.controls.Scroller#verticalScrollPolicy */ public static const SCROLL_POLICY_OFF:String = "off"; /** * @copy feathers.controls.Scroller#SCROLL_BAR_DISPLAY_MODE_FLOAT * * @see feathers.controls.Scroller#scrollBarDisplayMode */ public static const SCROLL_BAR_DISPLAY_MODE_FLOAT:String = "float"; /** * @copy feathers.controls.Scroller#SCROLL_BAR_DISPLAY_MODE_FIXED * * @see feathers.controls.Scroller#scrollBarDisplayMode */ public static const SCROLL_BAR_DISPLAY_MODE_FIXED:String = "fixed"; /** * @copy feathers.controls.Scroller#SCROLL_BAR_DISPLAY_MODE_NONE * * @see feathers.controls.Scroller#scrollBarDisplayMode */ public static const SCROLL_BAR_DISPLAY_MODE_NONE:String = "none"; /** * The vertical scroll bar will be positioned on the right. * * @see feathers.controls.Scroller#verticalScrollBarPosition */ public static const VERTICAL_SCROLL_BAR_POSITION_RIGHT:String = "right"; /** * The vertical scroll bar will be positioned on the left. * * @see feathers.controls.Scroller#verticalScrollBarPosition */ public static const VERTICAL_SCROLL_BAR_POSITION_LEFT:String = "left"; /** * @copy feathers.controls.Scroller#INTERACTION_MODE_TOUCH * * @see feathers.controls.Scroller#interactionMode */ public static const INTERACTION_MODE_TOUCH:String = "touch"; /** * @copy feathers.controls.Scroller#INTERACTION_MODE_MOUSE * * @see feathers.controls.Scroller#interactionMode */ public static const INTERACTION_MODE_MOUSE:String = "mouse"; /** * @copy feathers.controls.Scroller#INTERACTION_MODE_TOUCH_AND_SCROLL_BARS * * @see feathers.controls.Scroller#interactionMode */ public static const INTERACTION_MODE_TOUCH_AND_SCROLL_BARS:String = "touchAndScrollBars"; /** * Constructor. */ public function PanelScreen() { this.addEventListener(Event.ADDED_TO_STAGE, panelScreen_addedToStageHandler); super(); this.headerName = DEFAULT_CHILD_NAME_HEADER; this.originalDPI = DeviceCapabilities.dpi; this.clipContent = false; } /** * @private */ protected var _screenID:String; /** * @inheritDoc */ public function get screenID():String { return this._screenID; } /** * @private */ public function set screenID(value:String):void { this._screenID = value; } /** * @private */ protected var _owner:ScreenNavigator; /** * @inheritDoc */ public function get owner():ScreenNavigator { return this._owner; } /** * @private */ public function set owner(value:ScreenNavigator):void { this._owner = value; } /** * @private */ protected var _originalDPI:int = 0; /** * The original intended DPI of the application. This value cannot be * automatically detected and it must be set manually. * * <p>In the following example, the original DPI is customized:</p> * * <listing version="3.0"> * this.originalDPI = 326; //iPhone with Retina Display</listing> * * @see #dpiScale * @see feathers.system.DeviceCapabilities#dpi */ public function get originalDPI():int { return this._originalDPI; } /** * @private */ public function set originalDPI(value:int):void { if(this._originalDPI == value) { return; } this._originalDPI = value; this._dpiScale = DeviceCapabilities.dpi / this._originalDPI; this.invalidate(INVALIDATION_FLAG_SIZE); } /** * @private */ protected var _dpiScale:Number = 1; /** * Uses <code>originalDPI</code> and <code>DeviceCapabilities.dpi</code> * to calculate a scale value to allow all content to be the same * physical size (in inches). Using this value will have a much larger * effect on the layout of the content, but it can ensure that * interactive items won't be scaled too small to affect the accuracy * of touches. Likewise, it won't scale items to become ridiculously * physically large. Most useful when targeting many different platforms * with the same code. * * @see #originalDPI * @see feathers.system.DeviceCapabilities#dpi */ protected function get dpiScale():Number { return this._dpiScale; } /** * Optional callback for the back hardware key. Automatically handles * keyboard events to cancel the default behavior. * * <p>This function has the following signature:</p> * * <pre>function():void</pre> * * <p>In the following example, a function will dispatch <code>Event.COMPLETE</code> * when the back button is pressed:</p> * * <listing version="3.0"> * this.backButtonHandler = onBackButton; * * private function onBackButton():void * { * this.dispatchEvent( Event.COMPLETE ); * };</listing> * * @default null */ protected var backButtonHandler:Function; /** * Optional callback for the menu hardware key. Automatically handles * keyboard events to cancel the default behavior. * * <p>This function has the following signature:</p> * * <pre>function():void</pre> * * <p>In the following example, a function will be called when the menu * button is pressed:</p> * * <listing version="3.0"> * this.menuButtonHandler = onMenuButton; * * private function onMenuButton():void * { * //do something with the menu button * };</listing> * * @default null */ protected var menuButtonHandler:Function; /** * Optional callback for the search hardware key. Automatically handles * keyboard events to cancel the default behavior. * * <p>This function has the following signature:</p> * * <pre>function():void</pre> * * <p>In the following example, a function will be called when the search * button is pressed:</p> * * <listing version="3.0"> * this.searchButtonHandler = onSearchButton; * * private function onSearchButton():void * { * //do something with the search button * };</listing> * * @default null */ protected var searchButtonHandler:Function; /** * @private */ protected function panelScreen_addedToStageHandler(event:Event):void { this.addEventListener(Event.REMOVED_FROM_STAGE, panelScreen_removedFromStageHandler); //using priority here is a hack so that objects higher up in the //display list have a chance to cancel the event first. var priority:int = -getDisplayObjectDepthFromStage(this); Starling.current.nativeStage.addEventListener(KeyboardEvent.KEY_DOWN, panelScreen_nativeStage_keyDownHandler, false, priority, true); } /** * @private */ protected function panelScreen_removedFromStageHandler(event:Event):void { this.removeEventListener(Event.REMOVED_FROM_STAGE, panelScreen_removedFromStageHandler); Starling.current.nativeStage.removeEventListener(KeyboardEvent.KEY_DOWN, panelScreen_nativeStage_keyDownHandler); } /** * @private */ protected function panelScreen_nativeStage_keyDownHandler(event:KeyboardEvent):void { if(event.isDefaultPrevented()) { //someone else already handled this one return; } if(this.backButtonHandler != null && event.keyCode == Keyboard.BACK) { event.preventDefault(); this.backButtonHandler(); } if(this.menuButtonHandler != null && event.keyCode == Keyboard.MENU) { event.preventDefault(); this.menuButtonHandler(); } if(this.searchButtonHandler != null && event.keyCode == Keyboard.SEARCH) { event.preventDefault(); this.searchButtonHandler(); } } } }
//Marks the right margin of code ******************************************************************* package com.neopets.projects.np10 { import com.neopets.projects.np10.NP10_Document; import com.neopets.projects.np10.data.vo.GameStatesVO; import com.neopets.projects.np10.managers.NP10_GameManager; import com.neopets.projects.np10.statemachine.interfaces.INeopetsGame; import com.neopets.projects.np10.util.Logging.NeopetsLogger; import com.neopets.util.amfphp.NeopetsConnectionManager; import flash.display.MovieClip; import flash.display.Shape; import flash.display.Sprite; import org.osmf.logging.Logger; /** * This is the class that needs to be extended by the custom game document class. * DEV NOTE: It employs a Decorator pattern to allows for different types of integration of existing games. * * <p><u>REVISIONS</u>:<br> * <table width="500" cellpadding="0"> * <tr><th>Date</th><th>Author</th><th>Description</th></tr> * <tr><td>06/09/2009</td><td>baldarev</td><td>Class created.</td></tr> * <tr><td>MM/DD/YYYY</td><td>AUTHOR</td><td>DESCRIPTION.</td></tr> * </table> * </p> */ public class NP10_Document extends MovieClip implements INeopetsGame { //-------------------------------------------------------------------------- // Costants //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- //Public properties //-------------------------------------------------------------------------- /** * Initial settings defaults. These are obtained from the Flashvars when online. * DEV NOTE: you can override these in your document class with the specific game values you need to test. */ public var USERNAME:String = "guest_user_account"; public var LANGUAGE:String = "EN"; public var COUNTRY:String = "USA"; public var GAMEID:int = 3000; public var LOGLEVEL:String = NeopetsLogger.DEBUG; //-------------------------------------------------------------------------- //Private properties //-------------------------------------------------------------------------- protected var _GM:NP10_GameManager; /** * _game gets created/assigned in the custom game document class. * */ protected var _game:INeopetsGame; //-------------------------------------------------------------------------- // // Constructor // //-------------------------------------------------------------------------- /** * Gets a reference to the Game Manager and initialize it. * By now, _game has to be created/assigned. * */ public function NP10_Document() { super(); if (_game){ _GM = NP10_GameManager.instance; _GM.init(this); } else { throw new Error ("Please instantiate or assign _game before calling the superclass constructor"); } } //-------------------------------------------------------------------------- // Public Methods //-------------------------------------------------------------------------- /** * This is the class to override in your game document class. * It gets called by the Game Manager when the gaming system is done setting up. * */ public function initGame ():void { _GM.logger.info("Please override initGame in your document class", [this]); } /** * This is the class to override in your game document class. * It gets called by the Game Manager when the 'restart game' button is pressed from the score resul diplay screen. * */ public function restartGame():void { _GM.logger.info("Please override restartGame in your document class", [this]); } //-------------------------------------------------------------------------- // Protected Methods //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- // Private Methods //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- // Event Handlers //-------------------------------------------------------------------------- /** * Handler for CustomEvent. * * @param event The <code>CustomEvent</code> * */ //-------------------------------------------------------------------------- // Getters/Setters //-------------------------------------------------------------------------- public function get game ():INeopetsGame { return _game; } } }
//////////////////////////////////////////////////////////////////////////////// // // Licensed to the Apache Software Foundation (ASF) under one or more // contributor license agreements. See the NOTICE file distributed with // this work for additional information regarding copyright ownership. // The ASF licenses this file to You under the Apache License, Version 2.0 // (the "License"); you may not use this file except in compliance with // the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // //////////////////////////////////////////////////////////////////////////////// package org.apache.royale.core { import org.apache.royale.events.Event; import org.apache.royale.events.EventDispatcher; import org.apache.royale.geom.Matrix; import org.apache.royale.utils.sendStrandEvent; public class TransformModel extends EventDispatcher implements ITransformModel { public static const CHANGE:String = "transferModelChange"; private var _matrix:Matrix; protected var _strand:IStrand; public function TransformModel() { } public function get matrix():Matrix { return _matrix; } private function dispatchModelChangeEvent():void { sendStrandEvent(_strand,CHANGE); } /** * @royaleignorecoercion org.apache.royale.core.ITransformHost */ private function get host():ITransformHost { return _strand as ITransformHost; } public function set matrix(value:Matrix):void { _matrix = value; if (_strand) { dispatchModelChangeEvent(); } } public function set strand(value:IStrand):void { _strand = value; dispatchModelChangeEvent(); } } }
/* * VERSION:3.0 * DATE:2014-10-15 * ACTIONSCRIPT VERSION: 3.0 * UPDATES AND DOCUMENTATION AT: http://www.wdmir.net * MAIL:mir3@163.com */ /* package for JavaScript * Copyright (C) 2000 Masanao Izumo <iz@onicos.co.jp> * * Interfaces: * var x:Int64 = new Int64("1234567890123456789012345678901234567890"); * var y:Int64 = new Int64("0x123456789abcdef0123456789abcdef0"); * var z:Int64 = x.clone(); * z = x.negative(); * z = Int64.plus(x, y); * z = Int64.minus(x, y); * z = Int64.multiply(x, y); * z = Int64.divide(x, y); * z = Int64.mod(x, y); * var compare:int = Int64.compare(x, y); //return -1, 0, or 1 * var num:Number = x.toNumber(); //convert to normal number */ package com.adobe.utils { public class Int64 { //sign of Int64, negative or not private var _sign:Boolean; //length of Int64 private var _len:int; //digits of Int64 private var _digits:Array; public function Int64(...arg) { var i:*, x:*, need_init:Boolean; if (arg.length == 0) { _sign = true; _len = 1; _digits = new Array(1); need_init = true; } else if (arg.length == 1) { x = getInt64FromAny(arg[0]); if (x == arg[0]) x = x.clone(); _sign = x._sign; _len = x._len; _digits = x._digits; need_init = false; } else { _sign = (arg[1] ? true : false); _len = arg[0]; _digits = new Array(_len); need_init = true; } if (need_init) { for(i = 0; i < _len; i++) _digits[i] = 0; } } public function get value():String { return this.toStringBase(10); } public function toString():String { return this.toStringBase(10); } public function toStringBase(base:int):String { var i:*, j:*, hbase:*; var t:*; var ds:*; var c:*; i = this._len; if (i == 0) return "0"; if (i == 1 && !this._digits[0]) return "0"; switch(base) { default: case 10: j = Math.floor((2*8*i*241)/800)+2; hbase = 10000; break; case 16: j = Math.floor((2*8*i)/4)+2; hbase = 0x10000; break; case 8: j = (2*8*i)+2; hbase = 010000; break; case 2: j = (2*8*i)+2; hbase = 020; break; } t = this.clone(); ds = t._digits; var s:String = ""; while (i && j) { var k:* = i; var num:* = 0; while (k--) { num = (num<<16) + ds[k]; if(num < 0) num += 4294967296; ds[k] = Math.floor(num / hbase); num %= hbase; } if (ds[i-1] == 0) i--; k = 4; while (k--) { c = (num % base); s = "0123456789abcdef".charAt(c) + s; --j; num = Math.floor(num / base); if (i == 0 && num == 0) { break; } } } i = 0; while(i < s.length && s.charAt(i) == "0") i++; if(i) s = s.substring(i, s.length); if(!this._sign) s = "-" + s; return s; } public function clone():Int64 { var x:Int64, i:int; x = new Int64(this._len, this._sign); for (i = 0; i < this._len; i++) { x._digits[i] = this._digits[i]; } return x; } /** * become a negative Int64 * @return */ public function negative():Int64 { var n:Int64 = this.clone(); n._sign = !n._sign; return normalize(n); } public function toNumber():Number { var d:* = 0.0; var i:* = _len; var ds:* = _digits; while (i--) { d = ds[i] + 65536.0 * d; } if (!_sign) d = -d; return d; } public function get sign():Boolean { return _sign; } public function get length():int { return _len; } public function get digits():Array { return _digits; } /************* public static methods **************/ /** * 加法 */ public static function plus(x:*, y:*):Int64 { x = getInt64FromAny(x); y = getInt64FromAny(y); return add(x, y, 1); } /** * 减法 */ //public static function minus(x:*, y:*):Int64 public static function sub(x:*, y:*):Int64 { x = getInt64FromAny(x); y = getInt64FromAny(y); return add(x, y, 0); } /** * 乘法 */ public static function multiply(x:*, y:*):Int64 { var i:*, j:*; var n:* = 0; var z:*; var zds:*, xds:*, yds:*; var dd:*, ee:*; var ylen:*; x = getInt64FromAny(x); y = getInt64FromAny(y); j = x._len + y._len + 1; z = new Int64(j, x._sign == y._sign); xds = x._digits; yds = y._digits; zds = z._digits; ylen = y._len; while (j--) zds[j] = 0; for (i = 0; i < x._len; i++) { dd = xds[i]; if (dd == 0) continue; n = 0; for (j = 0; j < ylen; j++) { ee = n + dd * yds[j]; n = zds[i + j] + ee; if (ee) zds[i + j] = (n & 0xffff); n >>= 16; } if (n) { zds[i + j] = n; } } return normalize(z); } /** * 除法 */ public static function divide(x:*, y:*):Int64 { x = getInt64FromAny(x); y = getInt64FromAny(y); return divideAndMod(x, y, 0); } /** * 余 */ public static function mod(x:*, y:*):Int64 { x = getInt64FromAny(x); y = getInt64FromAny(y); return divideAndMod(x, y, 1); } /** * compare two Int64s, if x=y return 0, if x>y return 1, if x<y return -1. * @param x * @param y * @return */ public static function compare(x:*, y:*):int { var xlen:*; if (x == y) return 0; x = getInt64FromAny(x); y = getInt64FromAny(y); xlen = x._len; if (x._sign != y._sign) { if (x._sign) return 1; return -1; } if (xlen < y._len) return (x._sign) ? -1 : 1; if (xlen > y._len) return (x._sign) ? 1 : -1; while (xlen-- && (x._digits[xlen] == y._digits[xlen])){}; if ( -1 == xlen) return 0; return (x._digits[xlen] > y._digits[xlen]) ? (x._sign ? 1 : -1) : (x._sign ? -1 : 1); } /************* private static methods **************/ private static function getInt64FromAny(x:*):Int64 { if (typeof(x) == "object") { if (x is Int64) return x; return new Int64(1, 1); } if (typeof(x) == "string") { return getInt64FromString(x); } if (typeof(x) == "number") { var i:*, x1:*, x2:*, fpt:*, np:*; if ( -2147483647 <= x && x <= 2147483647) { return getInt64FromInt(x); } x = x + ""; i = x.indexOf("e", 0); if (i == -1) return getInt64FromString(x); x1 = x.substr(0, i); x2 = x.substr(i + 2, x.length - (i + 2)); fpt = x1.indexOf(".", 0); if (fpt != -1) { np = x1.length - (fpt + 1); x1 = x1.substr(0, fpt) + x1.substr(fpt + 1, np); x2 = parseInt(x2) - np; } else { x2 = parseInt(x2); } while (x2-- > 0) { x1 += "0"; } return getInt64FromString(x1); } return new Int64(1, 1); } private static function getInt64FromInt(n:Number):Int64 { var sign:*, big:Int64, i:*; if (n < 0) { n = -n; sign = false; } else { sign = true; } n &= 0x7FFFFFFF; if (n <= 0xFFFF) { big = new Int64(1, 1); big._digits[0] = n; } else { big = new Int64(2, 1); big._digits[0] = (n & 0xffff); big._digits[1] = ((n >> 16) & 0xffff); } return big; } private static function getInt64FromString(str:String, base:* = null):Int64 { var str_i:*; var sign:Boolean = true; var c:*; var len:*; var z:*; var zds:*; var num:*; var i:*; var blen:* = 1; str += "@"; str_i = 0; if (str.charAt(str_i) == "+") { str_i++; }else if (str.charAt(str_i) == "-") { str_i++; sign = false; } if (str.charAt(str_i) == "@") return null; if (!base) { if (str.charAt(str_i) == "0") { c = str.charAt(str_i + 1); if (c == "x" || c == "X") { base = 16; }else if (c == "b" || c == "B") { base = 2; }else { base = 8; } }else { base = 10; } } if (base == 8) { while (str.charAt(str_i) == "0") str_i++; len = 3 * (str.length - str_i); }else { if (base == 16 && str.charAt(str_i) == '0' && (str.charAt(str_i + 1) == "x" || str.charAt(str_i + 1) == "X")) { str_i += 2; } if (base == 2 && str.charAt(str_i) == '0' && (str.charAt(str_i + 1) == "b" || str.charAt(str_i + 1) == "B")) { str_i += 2; } while (str.charAt(str_i) == "0") str_i++; if (str.charAt(str_i) == "@") str_i--; len = 4 * (str.length - str_i); } len = (len >> 4) + 1; z = new Int64(len, sign); zds = z._digits; while (true) { c = str.charAt(str_i++); if(c == "@") break; switch (c) { case '0': c = 0; break; case '1': c = 1; break; case '2': c = 2; break; case '3': c = 3; break; case '4': c = 4; break; case '5': c = 5; break; case '6': c = 6; break; case '7': c = 7; break; case '8': c = 8; break; case '9': c = 9; break; case 'a': case 'A': c = 10; break; case 'b': case 'B': c = 11; break; case 'c': case 'C': c = 12; break; case 'd': case 'D': c = 13; break; case 'e': case 'E': c = 14; break; case 'f': case 'F': c = 15; break; default: c = base; break; } if (c >= base) break; i = 0; num = c; while (true) { while (i < blen) { num += zds[i]*base; zds[i++] = (num & 0xffff); num >>= 16; } if (num) { blen++; continue; } break; } } return normalize(z); } private static function add(x:Int64, y:Int64, sign:*):Int64 { var z:*; var num:*; var i:*, len:*; sign = (sign == y._sign); if (x._sign != sign) { if (sign) return subtract(y, x); return subtract(x, y); } if (x._len > y._len) { len = x._len + 1; z = x; x = y; y = z; } else { len = y._len + 1; } z = new Int64(len, sign); len = x._len; for (i = 0, num = 0; i < len; i++) { num += x._digits[i] + y._digits[i]; z._digits[i] = (num & 0xffff); num >>= 16; } len = y._len; while (num && i < len) { num += y._digits[i]; z._digits[i++] = (num & 0xffff); num >>= 16; } while (i < len) { z._digits[i] = y._digits[i]; i++; } z._digits[i] = (num & 0xffff); return normalize(z); } private static function subtract(x:Int64, y:Int64):Int64 { var z:* = 0; var zds:*; var num:*; var i:*; i = x._len; if (x._len < y._len) { z = x; x = y; y = z; }else if (x._len == y._len) { while (i > 0) { i--; if (x._digits[i] > y._digits[i]) { break; } if (x._digits[i] < y._digits[i]) { z = x; x = y; y = z; break; } } } z = new Int64(x._len, (z == 0) ? 1 : 0); zds = z._digits; for (i = 0, num = 0; i < y._len; i++) { num += x._digits[i] - y._digits[i]; zds[i] = (num & 0xffff); num >>= 16; } while (num && i < x._len) { num += x._digits[i]; zds[i++] = (num & 0xffff); num >>= 16; } while (i < x._len) { zds[i] = x._digits[i]; i++; } return normalize(z); } private static function divideAndMod(x:Int64, y:Int64, modulo:*):Int64 { var nx:* = x._len; var ny:* = y._len; var i:*, j:*; var yy:*, z:*; var xds:*, yds:*, zds:*, tds:*; var t2:*; var num:*; var dd:*, q:*; var ee:*; var mod:*, div:*; yds = y._digits; if (ny == 0 && yds[0] == 0) return null; if (nx < ny || nx == ny && x._digits[nx - 1] < y._digits[ny - 1]) { if (modulo) return normalize(x); return new Int64(1, 1); } xds = x._digits; if (ny == 1) { dd = yds[0]; z = x.clone(); zds = z._digits; t2 = 0; i = nx; while (i--) { t2 = t2 * 65536 + zds[i]; zds[i] = (t2 / dd) & 0xffff; t2 %= dd; } z._sign = (x._sign == y._sign); if (modulo) { if (!x._sign) t2 = -t2; if (x._sign != y._sign) { t2 = t2 + yds[0] * (y._sign ? 1 : -1); } return getInt64FromInt(t2); } return normalize(z); } z = new Int64(nx == ny ? nx + 2 : nx + 1, x._sign == y._sign); zds = z._digits; if (nx == ny) zds[nx + 1] = 0; while (!yds[ny - 1]) ny--; if ((dd = ((65536 / (yds[ny - 1] + 1)) & 0xffff)) != 1) { yy = y.clone(); tds = yy._digits; j = 0; num = 0; while (j < ny) { num += yds[j] * dd; tds[j++] = num & 0xffff; num >>= 16; } yds = tds; j = 0; num = 0; while (j < nx) { num += xds[j] * dd; zds[j++] = num & 0xffff; num >>= 16; } zds[j] = num & 0xffff; }else { zds[nx] = 0; j = nx; while (j--) zds[j] = xds[j]; } j = nx == ny ? nx + 1 : nx; do { if (zds[j] == yds[ny - 1]) q = 65535; else q = ((zds[j] * 65536 + zds[j - 1]) / yds[ny - 1]) & 0xffff; if (q) { i = 0; num = 0; t2 = 0; do { t2 += yds[i] * q; ee = num - (t2 & 0xffff); num = zds[j - ny + i] + ee; if (ee) zds[j - ny + i] = num & 0xffff; num >>= 16; t2 >>= 16; } while (++i < ny); num += zds[j - ny + i] - t2; while (num) { i = 0; num = 0; q--; do { ee = num + yds[i]; num = zds[j - ny + i] + ee; if (ee) zds[j - ny + i] = num & 0xffff; num >>= 16; } while (++i < ny); num--; } } zds[j] = q; } while (--j >= ny); if (modulo) { mod = z.clone(); if (dd) { zds = mod._digits; t2 = 0; i = ny; while (i--) { t2 = (t2*65536) + zds[i]; zds[i] = (t2 / dd) & 0xffff; t2 %= dd; } } mod._len = ny; mod._sign = x._sign; if (x._sign != y._sign) { return add(mod, y, 1); } return normalize(mod); } div = z.clone(); zds = div._digits; j = (nx == ny ? nx + 2 : nx + 1) - ny; for (i = 0; i < j; i++) zds[i] = zds[i + ny]; div._len = i; return normalize(div); } private static function normalize(x:Int64):Int64 { var len:* = x._len; var ds:* = x._digits; while (len-- && !ds[len]){}; x._len = ++len; return x; } } }
package com.flexcapacitor.model { import com.flexcapacitor.utils.supportClasses.ComponentDescription; /** * Handles exporting to various formats * */ public interface IDocumentExporter { /** * Is valid * */ function set isValid(value:Boolean):void; function get isValid():Boolean; /** * Error event * */ function set error(value:Error):void; function get error():Error; /** * Error message * */ function set errorMessage(value:String):void; function get errorMessage():String; /** * Errors * */ function set errors(value:Array):void; function get errors():Array; /** * Warnings * */ function set warnings(value:Array):void; function get warnings():Array; /** * Exports to an XML string. When reference is true it returns * a shorter string with a URI to the document details * */ function export(document:IDocument, target:ComponentDescription = null, options:ExportOptions = null, dispatchEvents:Boolean = false):SourceData; /** * Export to XML. When reference is true it returns * a shorter string with a URI to the document details * */ function exportXML(document:IDocument, reference:Boolean = false):XML; /** * Export to JSON representation. When reference is true it returns * a shorter string with a URI to the document details * */ function exportJSON(document:IDocument, reference:Boolean = false):JSON; } }
package example.ui { import UI.abstract.component.control.dropDownMenu.MenuData; import UI.abstract.component.data.DataProvider; import UI.theme.defaulttheme.menuBar.MenuBar; import flash.display.Sprite; public class MenuBarE extends Sprite { public function MenuBarE() { super(); var i : int; var j : int; var n : int; var menu : MenuData; var menu1 : MenuData; var menu2 : MenuData; var menuArr : Array = []; var menuArr1 : Array = []; var menuArr2 : Array = []; /** MenuBar **/ var menuBar : MenuBar = new MenuBar(); addChild(menuBar); menuBar.setSize( 200, 25 ); for ( i = 0 ; i < 5 ; i++ ) { menu = new MenuData(); menu.text = "菜单1"; menuArr.push( menu ); if ( i > 1 ) { menuArr1 = []; for ( j = 0 ; j < 4 ; j++ ) { menu1 = new MenuData(); menu1.text = "菜单子2"; menuArr1.push( menu1 ); if ( j == 0 ) { menuArr2 = []; for ( n = 0 ; n < 3 ; n++ ) { menu2 = new MenuData(); menu2.text = "菜单子3"; menuArr2.push( menu2 ); } menu1.items = new DataProvider( menuArr2 ); } } menu.items = new DataProvider( menuArr1 ); } } var dataprovider : DataProvider = new DataProvider( menuArr ); menuBar.addItem("文件", dataprovider ); menuArr = []; for ( i = 0 ; i < 5 ; i++ ) { menu = new MenuData(); menu.text = "菜单2"; menuArr.push(menu); } dataprovider = new DataProvider( menuArr ); menuBar.addItem("编辑", dataprovider ); menuArr = []; for ( i = 0 ; i < 5 ; i++ ) { menu = new MenuData(); menu.text = "菜单3"; menuArr.push(menu); } dataprovider = new DataProvider( menuArr ); menuBar.addItem("工具", dataprovider ); menuArr = []; for ( i = 0 ; i < 5 ; i++ ) { menu = new MenuData(); menu.text = "菜单4"; menuArr.push(menu); } dataprovider = new DataProvider( menuArr ); menuBar.addItem("帮助", dataprovider ); } } }
package cmodule.lua_wrapper { public const ___ulp_D2A:int = regFunc(FSM___ulp_D2A.start); }
package com.d_project.qrcode { /** * QRコード. * <br/> * ■使い方 * <ul> * <li>誤り訂正レベル、データ等、諸パラメータを設定します。</li> * <li>make() を呼び出してQRコードを作成します。</li> * <li>getModuleCount() と isDark() で、QRコードのデータを取得します。</li> * </ul> * @author Kazuhiko Arase */ public class QRCode { private static const PAD0 : int = 0xEC; private static const PAD1 : int = 0x11; private var typeNumber : int; private var modules : Array; private var moduleCount : int; private var errorCorrectLevel : int; private var qrDataList : Array; /** * コンストラクタ * <br>型番1, 誤り訂正レベルH のQRコードのインスタンスを生成します。 * @see ErrorCorrectLevel */ public function QRCode() { this.typeNumber = 1; this.errorCorrectLevel = ErrorCorrectLevel.H; this.qrDataList = new Array(); } /** * 型番を取得する。 * @return 型番 */ public function getTypeNumber() : int { return typeNumber; } /** * 型番を設定する。 * @param typeNumber 型番 */ public function setTypeNumber(typeNumber : int) : void { this.typeNumber = typeNumber; } /** * 誤り訂正レベルを取得する。 * @return 誤り訂正レベル * @see ErrorCorrectLevel */ public function getErrorCorrectLevel() : int { return errorCorrectLevel; } /** * 誤り訂正レベルを設定する。 * @param errorCorrectLevel 誤り訂正レベル * @see ErrorCorrectLevel */ public function setErrorCorrectLevel(errorCorrectLevel : int) : void { this.errorCorrectLevel = errorCorrectLevel; } /** * モードを指定してデータを追加する。 * @param data データ * @param mode モード * @see Mode */ public function addData(data : String, mode : int = 0) : void { if (mode == Mode.MODE_AUTO) { mode = QRUtil.getMode(data); } switch(mode) { case Mode.MODE_NUMBER : addQRData(new QRNumber(data) ); break; case Mode.MODE_ALPHA_NUM : addQRData(new QRAlphaNum(data) ); break; case Mode.MODE_8BIT_BYTE : addQRData(new QR8BitByte(data) ); break; case Mode.MODE_KANJI : addQRData(new QRKanji(data) ); break; default : throw new Error("mode:" + mode); } } /** * データをクリアする。 * <br/>addData で追加されたデータをクリアします。 */ public function clearData() : void { qrDataList = new Array(); } private function addQRData(qrData : QRData) : void { qrDataList.push(qrData); } private function getQRDataCount() : int { return qrDataList.length; } private function getQRData(index : int) : QRData { return qrDataList[index]; } /** * 暗モジュールかどうかを取得する。 * @param row 行 (0 ~ モジュール数 - 1) * @param col 列 (0 ~ モジュール数 - 1) */ public function isDark(row : int, col : int) : Boolean { if (modules[row][col] != null) { return modules[row][col]; } else { return false; } } /** * モジュール数を取得する。 */ public function getModuleCount() : int { return moduleCount; } /** * QRコードを作成する。 */ public function make() : void { makeImpl(false, getBestMaskPattern() ); } private function getBestMaskPattern() : int { var minLostPoint : int = 0; var pattern : int = 0; for (var i : int = 0; i < 8; i++) { makeImpl(true, i); var lostPoint : int = QRUtil.getLostPoint(this); if (i == 0 || minLostPoint > lostPoint) { minLostPoint = lostPoint; pattern = i; } } return pattern; } /** * */ private function makeImpl(test : Boolean, maskPattern : int) : void { // モジュール初期化 moduleCount = typeNumber * 4 + 17; modules = new Array(moduleCount); for (var i : int = 0; i < moduleCount; i++) { modules[i] = new Array(moduleCount); } // 位置検出パターン及び分離パターンを設定 setupPositionProbePattern(0, 0); setupPositionProbePattern(moduleCount - 7, 0); setupPositionProbePattern(0, moduleCount - 7); setupPositionAdjustPattern(); setupTimingPattern(); setupTypeInfo(test, maskPattern); if (typeNumber >= 7) { setupTypeNumber(test); } var dataArray : Array = qrDataList; var data : Array = createData(typeNumber, errorCorrectLevel, dataArray); mapData(data, maskPattern); } private function mapData(data : Array, maskPattern : int) : void { var inc : int = -1; var row : int = moduleCount - 1; var bitIndex : int = 7; var byteIndex : int = 0; for (var col : int = moduleCount - 1; col > 0; col -= 2) { if (col == 6) col--; while (true) { for (var c : int = 0; c < 2; c++) { if (modules[row][col - c] == null) { var dark : Boolean = false; if (byteIndex < data.length) { dark = ( ( (data[byteIndex] >>> bitIndex) & 1) == 1); } var mask : Boolean = QRUtil.getMask(maskPattern, row, col - c); if (mask) { dark = !dark; } modules[row][col - c] = (dark); bitIndex--; if (bitIndex == -1) { byteIndex++; bitIndex = 7; } } } row += inc; if (row < 0 || moduleCount <= row) { row -= inc; inc = -inc; break; } } } } /** * 位置合わせパターンを設定 */ private function setupPositionAdjustPattern() : void { var pos : Array = QRUtil.getPatternPosition(typeNumber); for (var i : int = 0; i < pos.length; i++) { for (var j : int = 0; j < pos.length; j++) { var row : int = pos[i]; var col : int = pos[j]; if (modules[row][col] != null) { continue; } for (var r : int = -2; r <= 2; r++) { for (var c : int = -2; c <= 2; c++) { if (r == -2 || r == 2 || c == -2 || c == 2 || (r == 0 && c == 0) ) { modules[row + r][col + c] = (true); } else { modules[row + r][col + c] = (false); } } } } } } /** * 位置検出パターンを設定 */ private function setupPositionProbePattern(row : int, col : int) : void { for (var r : int = -1; r <= 7; r++) { for (var c : int = -1; c <= 7; c++) { if (row + r <= -1 || moduleCount <= row + r || col + c <= -1 || moduleCount <= col + c) { continue; } if ( (0 <= r && r <= 6 && (c == 0 || c == 6) ) || (0 <= c && c <= 6 && (r == 0 || r == 6) ) || (2 <= r && r <= 4 && 2 <= c && c <= 4) ) { modules[row + r][col + c] = (true); } else { modules[row + r][col + c] = (false); } } } } /** * タイミングパターンを設定 */ private function setupTimingPattern() : void { for (var r : int = 8; r < moduleCount - 8; r++) { if (modules[r][6] != null) { continue; } modules[r][6] = (r % 2 == 0); } for (var c : int = 8; c < moduleCount - 8; c++) { if (modules[6][c] != null) { continue; } modules[6][c] = (c % 2 == 0); } } /** * 型番を設定 */ private function setupTypeNumber(test : Boolean) : void { var bits : int = QRUtil.getBCHTypeNumber(typeNumber); var i : int; var mod : Boolean; for (i = 0; i < 18; i++) { mod = (!test && ( (bits >> i) & 1) == 1); modules[Math.floor(i / 3)][i % 3 + moduleCount - 8 - 3] = mod; } for (i = 0; i < 18; i++) { mod = (!test && ( (bits >> i) & 1) == 1); modules[i % 3 + moduleCount - 8 - 3][Math.floor(i / 3)] = mod; } } /** * 形式情報を設定 */ private function setupTypeInfo(test : Boolean, maskPattern : int) : void { var data : int = (errorCorrectLevel << 3) | maskPattern; var bits : int = QRUtil.getBCHTypeInfo(data); var i : int; var mod : Boolean; // 縦方向 for (i = 0; i < 15; i++) { mod = (!test && ( (bits >> i) & 1) == 1); if (i < 6) { modules[i][8] = mod; } else if (i < 8) { modules[i + 1][8] = mod; } else { modules[moduleCount - 15 + i][8] = mod; } } // 横方向 for (i = 0; i < 15; i++) { mod = (!test && ( (bits >> i) & 1) == 1); if (i < 8) { modules[8][moduleCount - i - 1] = mod; } else if (i < 9) { modules[8][15 - i - 1 + 1] = mod; } else { modules[8][15 - i - 1] = mod; } } // 固定 modules[moduleCount - 8][8] = (!test); } private static function createData(typeNumber : int, errorCorrectLevel : int, dataArray : Array) : Array { var rsBlocks : Array = RSBlock.getRSBlocks(typeNumber, errorCorrectLevel); var buffer : BitBuffer = new BitBuffer(); var i : int; for (i = 0; i < dataArray.length; i++) { var data : QRData = dataArray[i]; buffer.put(data.getMode(), 4); buffer.put(data.getLength(), data.getLengthInBits(typeNumber) ); data.write(buffer); } // 最大データ数を計算 var totalDataCount : int = 0; for (i = 0; i < rsBlocks.length; i++) { totalDataCount += rsBlocks[i].getDataCount(); } if (buffer.getLengthInBits() > totalDataCount * 8) { throw new Error("code length overflow. (" + buffer.getLengthInBits() + ">" + totalDataCount * 8 + ")"); } // 終端コード if (buffer.getLengthInBits() + 4 <= totalDataCount * 8) { buffer.put(0, 4); } // padding while (buffer.getLengthInBits() % 8 != 0) { buffer.putBit(false); } // padding while (true) { if (buffer.getLengthInBits() >= totalDataCount * 8) { break; } buffer.put(PAD0, 8); if (buffer.getLengthInBits() >= totalDataCount * 8) { break; } buffer.put(PAD1, 8); } return createBytes(buffer, rsBlocks); } private static function createBytes(buffer : BitBuffer, rsBlocks : Array) : Array { var offset : int = 0; var maxDcCount : int = 0; var maxEcCount : int = 0; var dcdata : Array = new Array(rsBlocks.length); var ecdata : Array = new Array(rsBlocks.length); var i : int; var r : int; for (r = 0; r < rsBlocks.length; r++) { var dcCount : int = rsBlocks[r].getDataCount(); var ecCount : int = rsBlocks[r].getTotalCount() - dcCount; maxDcCount = Math.max(maxDcCount, dcCount); maxEcCount = Math.max(maxEcCount, ecCount); dcdata[r] = new Array(dcCount); for (i = 0; i < dcdata[r].length; i++) { dcdata[r][i] = 0xff & buffer.getBuffer()[i + offset]; } offset += dcCount; var rsPoly : Polynomial = QRUtil.getErrorCorrectPolynomial(ecCount); var rawPoly : Polynomial = new Polynomial(dcdata[r], rsPoly.getLength() - 1); var modPoly : Polynomial = rawPoly.mod(rsPoly); ecdata[r] = new Array(rsPoly.getLength() - 1); for (i = 0; i < ecdata[r].length; i++) { var modIndex : int = i + modPoly.getLength() - ecdata[r].length; ecdata[r][i] = (modIndex >= 0)? modPoly.getAt(modIndex) : 0; } } var totalCodeCount : int = 0; for (i = 0; i < rsBlocks.length; i++) { totalCodeCount += rsBlocks[i].getTotalCount(); } var data : Array = new Array(totalCodeCount); var index : int = 0; for (i = 0; i < maxDcCount; i++) { for (r = 0; r < rsBlocks.length; r++) { if (i < dcdata[r].length) { data[index++] = dcdata[r][i]; } } } for (i = 0; i < maxEcCount; i++) { for (r = 0; r < rsBlocks.length; r++) { if (i < ecdata[r].length) { data[index++] = ecdata[r][i]; } } } return data; } /** * 最小の型番となる QRCode を作成する。 * @param data データ * @param errorCorrectLevel 誤り訂正レベル */ public static function getMinimumQRCode(data : String, errorCorrectLevel : int) : QRCode { var mode : int = QRUtil.getMode(data); var qr : QRCode = new QRCode(); qr.setErrorCorrectLevel(errorCorrectLevel); qr.addData(data, mode); var length : int = qr.getQRData(0).getLength(); for (var typeNumber : int = 1; typeNumber <= 10; typeNumber++) { if (length <= QRUtil.getMaxLength(typeNumber, mode, errorCorrectLevel) ) { qr.setTypeNumber(typeNumber); break; } } qr.make(); return qr; } } }
package { import feathers.examples.todos.Main; import flash.display.Loader; import flash.display.Sprite; import flash.display.StageAlign; import flash.display.StageOrientation; import flash.display.StageScaleMode; import flash.events.Event; import flash.filesystem.File; import flash.filesystem.FileMode; import flash.filesystem.FileStream; import flash.geom.Rectangle; import flash.system.Capabilities; import flash.utils.ByteArray; import starling.core.Starling; [SWF(width="960",height="640",frameRate="60",backgroundColor="#4a4137")] public class Todos extends Sprite { public function Todos() { if(this.stage) { this.stage.scaleMode = StageScaleMode.NO_SCALE; this.stage.align = StageAlign.TOP_LEFT; } this.mouseEnabled = this.mouseChildren = false; this.showLaunchImage(); this.loaderInfo.addEventListener(Event.COMPLETE, loaderInfo_completeHandler); } private var _starling:Starling; private var _launchImage:Loader; private var _savedAutoOrients:Boolean; private function showLaunchImage():void { var filePath:String; var isPortraitOnly:Boolean = false; if(Capabilities.manufacturer.indexOf("iOS") >= 0) { if(Capabilities.screenResolutionX == 1536 && Capabilities.screenResolutionY == 2048) { var isCurrentlyPortrait:Boolean = this.stage.orientation == StageOrientation.DEFAULT || this.stage.orientation == StageOrientation.UPSIDE_DOWN; filePath = isCurrentlyPortrait ? "Default-Portrait@2x.png" : "Default-Landscape@2x.png"; } else if(Capabilities.screenResolutionX == 768 && Capabilities.screenResolutionY == 1024) { isCurrentlyPortrait = this.stage.orientation == StageOrientation.DEFAULT || this.stage.orientation == StageOrientation.UPSIDE_DOWN; filePath = isCurrentlyPortrait ? "Default-Portrait.png" : "Default-Landscape.png"; } else if(Capabilities.screenResolutionX == 640) { isPortraitOnly = true; if(Capabilities.screenResolutionY == 1136) { filePath = "Default-568h@2x.png"; } else { filePath = "Default@2x.png"; } } else if(Capabilities.screenResolutionX == 320) { isPortraitOnly = true; filePath = "Default.png"; } } if(filePath) { var file:File = File.applicationDirectory.resolvePath(filePath); if(file.exists) { var bytes:ByteArray = new ByteArray(); var stream:FileStream = new FileStream(); stream.open(file, FileMode.READ); stream.readBytes(bytes, 0, stream.bytesAvailable); stream.close(); this._launchImage = new Loader(); this._launchImage.loadBytes(bytes); this.addChild(this._launchImage); this._savedAutoOrients = this.stage.autoOrients; this.stage.autoOrients = false; if(isPortraitOnly) { this.stage.setOrientation(StageOrientation.DEFAULT); } } } } private function loaderInfo_completeHandler(event:Event):void { Starling.handleLostContext = true; Starling.multitouchEnabled = true; this._starling = new Starling(Main, this.stage); this._starling.enableErrorChecking = false; //this._starling.showStats = true; //this._starling.showStatsAt(HAlign.LEFT, VAlign.BOTTOM); this._starling.start(); if(this._launchImage) { this._starling.addEventListener("rootCreated", starling_rootCreatedHandler); } this.stage.addEventListener(Event.RESIZE, stage_resizeHandler, false, int.MAX_VALUE, true); this.stage.addEventListener(Event.DEACTIVATE, stage_deactivateHandler, false, 0, true); } private function starling_rootCreatedHandler(event:Object):void { if(this._launchImage) { this.removeChild(this._launchImage); this._launchImage.unloadAndStop(true); this._launchImage = null; this.stage.autoOrients = this._savedAutoOrients; } } private function stage_resizeHandler(event:Event):void { this._starling.stage.stageWidth = this.stage.stageWidth; this._starling.stage.stageHeight = this.stage.stageHeight; const viewPort:Rectangle = this._starling.viewPort; viewPort.width = this.stage.stageWidth; viewPort.height = this.stage.stageHeight; try { this._starling.viewPort = viewPort; } catch(error:Error) {} //this._starling.showStatsAt(HAlign.LEFT, VAlign.BOTTOM); } private function stage_deactivateHandler(event:Event):void { this._starling.stop(); this.stage.addEventListener(Event.ACTIVATE, stage_activateHandler, false, 0, true); } private function stage_activateHandler(event:Event):void { this.stage.removeEventListener(Event.ACTIVATE, stage_activateHandler); this._starling.start(); } } }
//////////////////////////////////////////////////////////////////////////////// // // Licensed to the Apache Software Foundation (ASF) under one or more // contributor license agreements. See the NOTICE file distributed with // this work for additional information regarding copyright ownership. // The ASF licenses this file to You under the Apache License, Version 2.0 // (the "License"); you may not use this file except in compliance with // the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // //////////////////////////////////////////////////////////////////////////////// package mx.core { import flash.accessibility.AccessibilityProperties; import flash.display.DisplayObject; import flash.display.DisplayObjectContainer; import flash.display.IBitmapDrawable; import flash.display.LoaderInfo; import flash.display.Stage; import flash.events.IEventDispatcher; import flash.geom.Rectangle; import flash.geom.Point; import flash.geom.Transform; /** * The IFlexDisplayObject interface defines the interface for skin elements. * At a minimum, a skin must be a DisplayObject and implement this interface. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ public interface IFlexDisplayObject extends IBitmapDrawable, IEventDispatcher { include "IDisplayObjectInterface.as" //-------------------------------------------------------------------------- // // Properties // //-------------------------------------------------------------------------- //---------------------------------- // measuredHeight //---------------------------------- /** * The measured height of this object. * * <p>This is typically hard-coded for graphical skins * because this number is simply the number of pixels in the graphic. * For code skins, it can also be hard-coded * if you expect to be drawn at a certain size. * If your size can change based on properties, you may want * to also be an ILayoutManagerClient so a <code>measure()</code> * method will be called at an appropriate time, * giving you an opportunity to compute a <code>measuredHeight</code>.</p> * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ function get measuredHeight():Number; //---------------------------------- // measuredWidth //---------------------------------- /** * The measured width of this object. * * <p>This is typically hard-coded for graphical skins * because this number is simply the number of pixels in the graphic. * For code skins, it can also be hard-coded * if you expect to be drawn at a certain size. * If your size can change based on properties, you may want * to also be an ILayoutManagerClient so a <code>measure()</code> * method will be called at an appropriate time, * giving you an opportunity to compute a <code>measuredHeight</code>.</p> * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ function get measuredWidth():Number; //-------------------------------------------------------------------------- // // Methods // //-------------------------------------------------------------------------- /** * Moves this object to the specified x and y coordinates. * * @param x The new x-position for this object. * * @param y The new y-position for this object. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ function move(x:Number, y:Number):void; /** * Sets the actual size of this object. * * <p>This method is mainly for use in implementing the * <code>updateDisplayList()</code> method, which is where * you compute this object's actual size based on * its explicit size, parent-relative (percent) size, * and measured size. * You then apply this actual size to the object * by calling <code>setActualSize()</code>.</p> * * <p>In other situations, you should be setting properties * such as <code>width</code>, <code>height</code>, * <code>percentWidth</code>, or <code>percentHeight</code> * rather than calling this method.</p> * * @param newWidth The new width for this object. * * @param newHeight The new height for this object. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ function setActualSize(newWidth:Number, newHeight:Number):void; } }
package { import com.bit101.components.Label; import com.bit101.components.PushButton; import com.framework.movieclipbitmap.display.MovieSheet; import flash.display.DisplayObject; import flash.display.Loader; import flash.display.LoaderInfo; import flash.display.MovieClip; import flash.display.Sprite; import flash.events.Event; import flash.events.MouseEvent; import flash.net.URLRequest; import flash.utils.Dictionary; [SWF(width='760',height='660',frameRate='24')] /** * 性能演示,1800头猪,同一资源,三种尺寸,24帧(inter i7 2.6G) * @author Rakuten * */ public class PerformanceTest extends Sprite { public function PerformanceTest() { initDisplay(); loadMc("resources/pig_1_0_0.swf", "Pig_1_0_0"); } private var loaderLib:Dictionary = new Dictionary(); private var pigLayer:Sprite = new Sprite(); private function loadMc(path:String, clzName:String):void { pigIdLabel.text = "PigID:"+clzName; var loader:Loader = new Loader(); loaderLib[loader.contentLoaderInfo] = clzName; loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loader_completeHandler); loader.load(new URLRequest(path)); } private function createSourceMc(clz:Class, claName:String, posX:Number = 0, posY:Number = 0, size:Number=1):MovieClip { var sourceMc:MovieClip = new clz() as MovieClip; sourceMc.name = claName; //原动画 sourceMc.gotoAndStop(3); sourceMc.scaleX = size; sourceMc.scaleY = size; sourceMc.x = posX; sourceMc.y = posY; sourceMc.gotoAndStop(1); pigLayer.addChild(sourceMc); return sourceMc; } private function createOptimizeMc(clz:Class, claName:String, posX:Number = 0, posY:Number = 0, size:Number=1):* { var sourceMc:MovieClip = new clz() as MovieClip; sourceMc.name = claName; sourceMc.scaleX = size; sourceMc.scaleY = size; //BMP动画 var mc:MovieSheet = new MovieSheet(sourceMc); mc.x = posX; mc.y = posY; mc.gotoAndStop(1); pigLayer.addChild(mc); return mc } private function createScaleMc(clz:Class, claName:String, posX:Number = 0, posY:Number = 0, size:Number=1):* { //BMP动画 var sourceMc:MovieClip = new clz() as MovieClip; sourceMc.name = claName; var mc:MovieSheet = new MovieSheet(sourceMc); mc.x = posX; mc.y = posY; mc.gotoAndStop(1); mc.scaleX = size; mc.scaleY = size; pigLayer.addChild(mc); return mc } private function loader_completeHandler(event:Event):void { frameLabel.text = "frame:1"; var info:LoaderInfo = event.currentTarget as LoaderInfo; info.removeEventListener(Event.COMPLETE, loader_completeHandler); var clzName:String = loaderLib[info]; var clz:* = info.applicationDomain.getDefinition(clzName); // trace("loader complete:"+loaderLib[info]) for (var i:uint = 0; i<600; i++) { // createSourceMc(clz, clzName, 700*Math.random()+25,600*Math.random()+25, 0.75); // createSourceMc(clz, clzName, 700*Math.random()+25,600*Math.random()+25, 1); // createSourceMc(clz, clzName, 700*Math.random()+25,600*Math.random()+25, 1.5); createOptimizeMc(clz, clzName, 700*Math.random()+25,600*Math.random()+25, 0.75); createOptimizeMc(clz, clzName, 700*Math.random()+25,600*Math.random()+25, 1); createOptimizeMc(clz, clzName, 700*Math.random()+25,600*Math.random()+25, 1.5); } } private var pigIdLabel:Label; private var frameLabel:Label; private function initDisplay():void { addChild(pigLayer); addChild(new Stats()); pigIdLabel = new Label(this, 140, 50); frameLabel = new Label(this, 240, 50) var firstBtn:PushButton = new PushButton(this, 80, 10, "First Frame", firstBtn_clickHandler); var prevBtn:PushButton = new PushButton(this, 190, 10, "Prev Frame",prevBtn_clickHandler); var nextBtn:PushButton = new PushButton(this, 300, 10, "Next Frame",nextBtn_clickHandler); var netxPigBtn:PushButton = new PushButton(this, 410, 10, "Next Pig", nextPigBtn_clickHandler) } private function firstBtn_clickHandler(event:MouseEvent):void { var len:uint = pigLayer.numChildren; for (var i:uint = 0; i<len; i++) { var mc:MovieClip = pigLayer.getChildAt(i) as MovieClip; mc.gotoAndStop(1); } frameLabel.text = "frame:1"; } private function prevBtn_clickHandler(event:MouseEvent):void { var frameIndex:int = 0; var len:uint = pigLayer.numChildren; for (var i:uint = 0; i<len; i++) { var mc:MovieClip = pigLayer.getChildAt(i) as MovieClip; mc.prevFrame(); frameIndex = mc.currentFrame; } frameLabel.text = "frame:"+frameIndex; trace("frameIndex:"+frameIndex) } private function nextBtn_clickHandler(event:MouseEvent):void { var frameIndex:int = 0; var len:uint = pigLayer.numChildren; for (var i:uint = 0; i<len; i++) { var mc:MovieClip = pigLayer.getChildAt(i) as MovieClip; mc.nextFrame(); frameIndex = mc.currentFrame; } frameLabel.text = "frame:"+frameIndex+"/"+mc.totalFrames; trace("frame:"+frameIndex, "/ "+mc.totalFrames) } private var pigIndex:uint = 2; private function nextPigBtn_clickHandler(event:MouseEvent):void { for (var i:uint = 0; i<pigLayer.numChildren; i++) { var obj:DisplayObject = pigLayer.getChildAt(i); if (obj is MovieSheet) { MovieSheet(obj).dispose(); } } pigLayer.removeChildren(); var str:String = ""+pigIndex%3+"_0_0"; trace("load index:"+pigIndex,"file:"+str) loadMc("resources/pig_"+str+".swf", "Pig_"+str); pigIndex++; } } }
// ================================================================================================= // // Starling Framework // Copyright 2011-2014 Gamua. All Rights Reserved. // // This program is free software. You can redistribute and/or modify it // in accordance with the terms of the accompanying license agreement. // // ================================================================================================= package starling.textures { import flash.display3D.textures.TextureBase; import flash.geom.Matrix; import flash.geom.Point; import flash.geom.Rectangle; import starling.utils.MatrixUtil; import starling.utils.RectangleUtil; import starling.utils.VertexData; /** A SubTexture represents a section of another texture. This is achieved solely by * manipulation of texture coordinates, making the class very efficient. * * <p><em>Note that it is OK to create subtextures of subtextures.</em></p> */ public class SubTexture extends Texture { private var mParent:Texture; private var mOwnsParent:Boolean; private var mRegion:Rectangle; private var mFrame:Rectangle; private var mRotated:Boolean; private var mWidth:Number; private var mHeight:Number; private var mTransformationMatrix:Matrix; /** Helper object. */ private static var sTexCoords:Point = new Point(); private static var sMatrix:Matrix = new Matrix(); /** Creates a new SubTexture containing the specified region of a parent texture. * * @param parent The texture you want to create a SubTexture from. * @param region The region of the parent texture that the SubTexture will show * (in points). If <code>null</code>, the complete area of the parent. * @param ownsParent If <code>true</code>, the parent texture will be disposed * automatically when the SubTexture is disposed. * @param frame If the texture was trimmed, the frame rectangle can be used to restore * the trimmed area. * @param rotated If true, the SubTexture will show the parent region rotated by * 90 degrees (CCW). */ public function SubTexture(parent:Texture, region:Rectangle=null, ownsParent:Boolean=false, frame:Rectangle=null, rotated:Boolean=false) { // TODO: in a future version, the order of arguments of this constructor should // be fixed ('ownsParent' at the very end). mParent = parent; mRegion = region ? region.clone() : new Rectangle(0, 0, parent.width, parent.height); mFrame = frame ? frame.clone() : null; mOwnsParent = ownsParent; mRotated = rotated; mWidth = rotated ? mRegion.height : mRegion.width; mHeight = rotated ? mRegion.width : mRegion.height; mTransformationMatrix = new Matrix(); if (rotated) { mTransformationMatrix.translate(0, -1); mTransformationMatrix.rotate(Math.PI / 2.0); } if (mFrame && (mFrame.x > 0 || mFrame.y > 0 || mFrame.right < mRegion.width || mFrame.bottom < mRegion.height)) { trace("[Starling] Warning: frames inside the texture's region are unsupported."); } mTransformationMatrix.scale(mRegion.width / mParent.width, mRegion.height / mParent.height); mTransformationMatrix.translate(mRegion.x / mParent.width, mRegion.y / mParent.height); } /** Disposes the parent texture if this texture owns it. */ public override function dispose():void { if (mOwnsParent) mParent.dispose(); super.dispose(); } /** @inheritDoc */ public override function adjustVertexData(vertexData:VertexData, vertexID:int, count:int):void { var startIndex:int = vertexID * VertexData.ELEMENTS_PER_VERTEX + VertexData.TEXCOORD_OFFSET; var stride:int = VertexData.ELEMENTS_PER_VERTEX - 2; adjustTexCoords(vertexData.rawData, startIndex, stride, count); if (mFrame) { if (count != 4) throw new ArgumentError("Textures with a frame can only be used on quads"); var deltaRight:Number = mFrame.width + mFrame.x - mWidth; var deltaBottom:Number = mFrame.height + mFrame.y - mHeight; vertexData.translateVertex(vertexID, -mFrame.x, -mFrame.y); vertexData.translateVertex(vertexID + 1, -deltaRight, -mFrame.y); vertexData.translateVertex(vertexID + 2, -mFrame.x, -deltaBottom); vertexData.translateVertex(vertexID + 3, -deltaRight, -deltaBottom); } } /** @inheritDoc */ public override function adjustTexCoords(texCoords:Vector.<Number>, startIndex:int=0, stride:int=0, count:int=-1):void { if (count < 0) count = (texCoords.length - startIndex - 2) / (stride + 2) + 1; var endIndex:int = startIndex + count * (2 + stride); var texture:SubTexture = this; var u:Number, v:Number; sMatrix.identity(); while (texture) { sMatrix.concat(texture.mTransformationMatrix); texture = texture.parent as SubTexture; } for (var i:int=startIndex; i<endIndex; i += 2 + stride) { u = texCoords[ i ]; v = texCoords[int(i+1)]; MatrixUtil.transformCoords(sMatrix, u, v, sTexCoords); texCoords[ i ] = sTexCoords.x; texCoords[int(i+1)] = sTexCoords.y; } } /** The texture which the SubTexture is based on. */ public function get parent():Texture { return mParent; } /** Indicates if the parent texture is disposed when this object is disposed. */ public function get ownsParent():Boolean { return mOwnsParent; } /** If true, the SubTexture will show the parent region rotated by 90 degrees (CCW). */ public function get rotated():Boolean { return mRotated; } /** The region of the parent texture that the SubTexture is showing (in points). * * <p>CAUTION: not a copy, but the actual object! Do not modify!</p> */ public function get region():Rectangle { return mRegion; } /** The clipping rectangle, which is the region provided on initialization * scaled into [0.0, 1.0]. */ public function get clipping():Rectangle { var topLeft:Point = new Point(); var bottomRight:Point = new Point(); MatrixUtil.transformCoords(mTransformationMatrix, 0.0, 0.0, topLeft); MatrixUtil.transformCoords(mTransformationMatrix, 1.0, 1.0, bottomRight); var clipping:Rectangle = new Rectangle(topLeft.x, topLeft.y, bottomRight.x - topLeft.x, bottomRight.y - topLeft.y); RectangleUtil.normalize(clipping); return clipping; } /** The matrix that is used to transform the texture coordinates into the coordinate * space of the parent texture (used internally by the "adjust..."-methods). * * <p>CAUTION: not a copy, but the actual object! Do not modify!</p> */ public function get transformationMatrix():Matrix { return mTransformationMatrix; } /** @inheritDoc */ public override function get base():TextureBase { return mParent.base; } /** @inheritDoc */ public override function get root():ConcreteTexture { return mParent.root; } /** @inheritDoc */ public override function get format():String { return mParent.format; } /** @inheritDoc */ public override function get width():Number { return mWidth; } /** @inheritDoc */ public override function get height():Number { return mHeight; } /** @inheritDoc */ public override function get nativeWidth():Number { return mWidth * scale; } /** @inheritDoc */ public override function get nativeHeight():Number { return mHeight * scale; } /** @inheritDoc */ public override function get mipMapping():Boolean { return mParent.mipMapping; } /** @inheritDoc */ public override function get premultipliedAlpha():Boolean { return mParent.premultipliedAlpha; } /** @inheritDoc */ public override function get scale():Number { return mParent.scale; } /** @inheritDoc */ public override function get repeat():Boolean { return mParent.repeat; } /** @inheritDoc */ public override function get frame():Rectangle { return mFrame; } } }
//////////////////////////////////////////////////////////////////////////////// // // Licensed to the Apache Software Foundation (ASF) under one or more // contributor license agreements. See the NOTICE file distributed with // this work for additional information regarding copyright ownership. // The ASF licenses this file to You under the Apache License, Version 2.0 // (the "License"); you may not use this file except in compliance with // the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // //////////////////////////////////////////////////////////////////////////////// package mx.controls { import org.apache.royale.events.Event; import org.apache.royale.events.CloseEvent; import mx.containers.Panel; import mx.managers.ISystemManager; import mx.core.IUIComponent; import mx.core.FlexGlobals; /* import flash.events.Event; import flash.events.EventPhase; import mx.controls.alertClasses.AlertForm; import mx.core.EdgeMetrics; import mx.core.FlexVersion; import mx.core.IFlexDisplayObject; import mx.core.IFlexModule; import mx.core.IFlexModuleFactory; import mx.core.UIComponent; import mx.core.mx_internal; import mx.events.CloseEvent; import mx.events.FlexEvent; import mx.managers.ISystemManager; import mx.managers.PopUpManager; import mx.resources.IResourceManager; import mx.resources.ResourceManager; use namespace mx_internal; */ //-------------------------------------- // Styles //-------------------------------------- /** * Name of the CSS style declaration that specifies * styles for the Alert buttons. * * @default "alertButtonStyle" * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.3 */ //[Style(name="buttonStyleName", type="String", inherit="no")] /** * Name of the CSS style declaration that specifies * styles for the Alert message text. * * <p>You only set this style by using a type selector, which sets the style * for all Alert controls in your application. * If you set it on a specific instance of the Alert control, it can cause the control to * size itself incorrectly.</p> * * @default undefined * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.3 */ //[Style(name="messageStyleName", type="String", inherit="no")] /** * Name of the CSS style declaration that specifies styles * for the Alert title text. * * <p>You only set this style by using a type selector, which sets the style * for all Alert controls in your application. * If you set it on a specific instance of the Alert control, it can cause the control to * size itself incorrectly.</p> * * @default "windowStyles" * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.3 */ //[Style(name="titleStyleName", type="String", inherit="no")] //-------------------------------------- // Other metadata //-------------------------------------- //[AccessibilityClass(implementation="mx.accessibility.AlertAccImpl")] //[RequiresDataBinding(true)] //[ResourceBundle("controls")] /** * The Alert control is a pop-up dialog box that can contain a message, * a title, buttons (any combination of OK, Cancel, Yes, and No) and an icon. * The Alert control is modal, which means it will retain focus until the user closes it. * * <p>Import the mx.controls.Alert class into your application, * and then call the static <code>show()</code> method in ActionScript to display * an Alert control. You cannot create an Alert control in MXML.</p> * * <p>The Alert control closes when you select a button in the control, * or press the Escape key.</p> * * @includeExample examples/SimpleAlert.mxml * * @see mx.managers.SystemManager * @see mx.managers.PopUpManager * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.3 */ public class Alert extends Panel { //include "../core/Version.as"; //-------------------------------------------------------------------------- // // Class constants // //-------------------------------------------------------------------------- /** * Value that enables a Yes button on the Alert control when passed * as the <code>flags</code> parameter of the <code>show()</code> method. * You can use the | operator to combine this bitflag * with the <code>OK</code>, <code>CANCEL</code>, * <code>NO</code>, and <code>NONMODAL</code> flags. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.3 */ public static const YES:uint = 0x0001; /** * Value that enables a No button on the Alert control when passed * as the <code>flags</code> parameter of the <code>show()</code> method. * You can use the | operator to combine this bitflag * with the <code>OK</code>, <code>CANCEL</code>, * <code>YES</code>, and <code>NONMODAL</code> flags. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.3 */ public static const NO:uint = 0x0002; /** * Value that enables an OK button on the Alert control when passed * as the <code>flags</code> parameter of the <code>show()</code> method. * You can use the | operator to combine this bitflag * with the <code>CANCEL</code>, <code>YES</code>, * <code>NO</code>, and <code>NONMODAL</code> flags. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.3 */ public static const OK:uint = 0x0004; /** * Value that enables a Cancel button on the Alert control when passed * as the <code>flags</code> parameter of the <code>show()</code> method. * You can use the | operator to combine this bitflag * with the <code>OK</code>, <code>YES</code>, * <code>NO</code>, and <code>NONMODAL</code> flags. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.3 */ public static const CANCEL:uint= 0x0008; /** * Value that makes an Alert nonmodal when passed as the * <code>flags</code> parameter of the <code>show()</code> method. * You can use the | operator to combine this bitflag * with the <code>OK</code>, <code>CANCEL</code>, * <code>YES</code>, and <code>NO</code> flags. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.3 */ // public static const NONMODAL:uint = 0x8000; //-------------------------------------------------------------------------- // // Class mixins // //-------------------------------------------------------------------------- /** * @private * Placeholder for mixin by AlertAccImpl. */ //mx_internal static var createAccessibilityImplementation:Function; //-------------------------------------------------------------------------- // // Class variables // //-------------------------------------------------------------------------- /** * @private * Storage for the resourceManager getter. * This gets initialized on first access, * not at static initialization time, in order to ensure * that the Singleton registry has already been initialized. */ //private static var _resourceManager:IResourceManager; /** * @private */ //private static var initialized:Boolean = false; //-------------------------------------------------------------------------- // // Class properties // //-------------------------------------------------------------------------- //---------------------------------- // buttonHeight //---------------------------------- //[Inspectable(category="Size")] /** * Height of each Alert button, in pixels. * All buttons must be the same height. * * @default 22 * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.3 */ //public static var buttonHeight:Number = 22; //---------------------------------- // buttonWidth //---------------------------------- //[Inspectable(category="Size")] /** * Width of each Alert button, in pixels. * All buttons must be the same width. * * @default 65 * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.3 */ //public static var buttonWidth:Number = 65; //---------------------------------- // cancelLabel //---------------------------------- /** * @private * Storage for the cancelLabel property. */ //private static var _cancelLabel:String; /** * @private */ //private static var cancelLabelOverride:String; //[Inspectable(category="General")] //---------------------------------- // noLabel //---------------------------------- /** * @private * Storage for the noLabel property. */ //private static var _noLabel:String; /** * @private */ //private static var noLabelOverride:String; //[Inspectable(category="General")] /** * @private * Storage for the okLabel property. */ //private static var _okLabel:String; /** * @private */ //private static var okLabelOverride:String; //[Inspectable(category="General")] /** * @private * Storage for the yesLabel property. */ //private static var _yesLabel:String; /** * @private */ //private static var yesLabelOverride:String; //[Inspectable(category="General")] //-------------------------------------------------------------------------- // // Class methods // //-------------------------------------------------------------------------- /** * Static method that pops up the Alert control. The Alert control * closes when you select a button in the control, or press the Escape key. * * @param text Text string that appears in the Alert control. * This text is centered in the alert dialog box. * * @param title Text string that appears in the title bar. * This text is left justified. * * @param flags Which buttons to place in the Alert control. * Valid values are <code>Alert.OK</code>, <code>Alert.CANCEL</code>, * <code>Alert.YES</code>, and <code>Alert.NO</code>. * The default value is <code>Alert.OK</code>. * Use the bitwise OR operator to display more than one button. * For example, passing <code>(Alert.YES | Alert.NO)</code> * displays Yes and No buttons. * Regardless of the order that you specify buttons, * they always appear in the following order from left to right: * OK, Yes, No, Cancel. * * @param parent Object upon which the Alert control centers itself. * * @param closeHandler Event handler that is called when any button * on the Alert control is pressed. * The event object passed to this handler is an instance of CloseEvent; * the <code>detail</code> property of this object contains the value * <code>Alert.OK</code>, <code>Alert.CANCEL</code>, * <code>Alert.YES</code>, or <code>Alert.NO</code>. * * @param iconClass Class of the icon that is placed to the left * of the text in the Alert control. * * @param defaultButtonFlag A bitflag that specifies the default button. * You can specify one and only one of * <code>Alert.OK</code>, <code>Alert.CANCEL</code>, * <code>Alert.YES</code>, or <code>Alert.NO</code>. * The default value is <code>Alert.OK</code>. * Pressing the Enter key triggers the default button * just as if you clicked it. Pressing Escape triggers the Cancel * or No button just as if you selected it. * * @param moduleFactory The moduleFactory where this Alert should look for * its embedded fonts and style manager. * * @return A reference to the Alert control. * * @see mx.events.CloseEvent * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.3 */ public static function show(text:String = "", title:String = "", flags:uint = 0x4 /* Alert.OK */, //parent:Sprite = null, parent:IUIComponent = null, closeHandler:Function = null, iconClass:Class = null, defaultButtonFlag:uint = 0x4 /* Alert.OK */, moduleFactory:Object = null):Alert //moduleFactory:IFlexModuleFactory = null):Alert { // var modal:Boolean = (flags & Alert.NONMODAL) ? false : true; if (!parent) { var sm:ISystemManager = ISystemManager(FlexGlobals.topLevelApplication.systemManager); // no types so no dependencies var mp:Object; //= sm.getImplementation("mx.managers::IMarshalSystemManager"); //if (mp && mp.useSWFBridge()) // parent = Sprite(sm.getSandboxRoot()); //else // parent = Sprite(FlexGlobals.topLevelApplication); } var alert:Alert = new Alert(); /* if (flags & Alert.OK|| flags & Alert.CANCEL || flags & Alert.YES || flags & Alert.NO) { alert.buttonFlags = flags; } if (defaultButtonFlag == Alert.OK || defaultButtonFlag == Alert.CANCEL || defaultButtonFlag == Alert.YES || defaultButtonFlag == Alert.NO) { alert.defaultButtonFlag = defaultButtonFlag; } alert.text = text; alert.title = title;*/ //alert.iconClass = iconClass; if (closeHandler != null) alert.addEventListener(CloseEvent.CLOSE, closeHandler); // Setting a module factory allows the correct embedded font to be found. /*if (moduleFactory) alert.moduleFactory = moduleFactory; else if (parent is IFlexModule) alert.moduleFactory = IFlexModule(parent).moduleFactory; else { if (parent is IFlexModuleFactory) alert.moduleFactory = IFlexModuleFactory(parent); else alert.moduleFactory = FlexGlobals.topLevelApplication.moduleFactory; // also set document if parent isn't a UIComponent if (!parent is UIComponent) alert.document = FlexGlobals.topLevelApplication.document; } alert.addEventListener(FlexEvent.CREATION_COMPLETE, static_creationCompleteHandler); PopUpManager.addPopUp(alert, parent, modal);*/ return alert; } //-------------------------------------------------------------------------- // // Constructor // //-------------------------------------------------------------------------- /** * Constructor. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.3 */ public function Alert() { super(); // Panel properties. //title = ""; } //-------------------------------------------------------------------------- // // Overridden properties // //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- // // Properties // //-------------------------------------------------------------------------- //---------------------------------- // alertForm //---------------------------------- /** * @private * The internal AlertForm object that contains the text, icon, and buttons * of the Alert control. */ //mx_internal var alertForm:AlertForm; //---------------------------------- // buttonFlags //---------------------------------- /** * A bitmask that contains <code>Alert.OK</code>, <code>Alert.CANCEL</code>, * <code>Alert.YES</code>, and/or <code>Alert.NO</code> indicating * the buttons available in the Alert control. * * @default Alert.OK * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.3 * @royalesuppresspublicvarwarning */ //public var buttonFlags:uint = OK; //---------------------------------- // defaultButtonFlag //---------------------------------- //[Inspectable(category="General")] /** * A bitflag that contains either <code>Alert.OK</code>, * <code>Alert.CANCEL</code>, <code>Alert.YES</code>, * or <code>Alert.NO</code> to specify the default button. * * @default Alert.OK * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.3 * @royalesuppresspublicvarwarning */ //public var defaultButtonFlag:uint = OK; //---------------------------------- // iconClass //---------------------------------- //[Inspectable(category="Other")] /** * The class of the icon to display. * You typically embed an asset, such as a JPEG or GIF file, * and then use the variable associated with the embedded asset * to specify the value of this property. * * @default null * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.3 * @royalesuppresspublicvarwarning */ //public var iconClass:Class; //---------------------------------- // text //---------------------------------- //[Inspectable(category="General")] /** * The text to display in this alert dialog box. * * @default "" * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.3 * @royalesuppresspublicvarwarning */ //public var text:String = ""; } }
package com.smbc.enums { import com.explodingRabbit.utils.Enum; public class PiranhaSpawnType extends Enum { { initEnum(PiranhaSpawnType); } // static ctor public static const SomePipes:PiranhaSpawnType = new PiranhaSpawnType("Some Pipes"); public static const AllPipes:PiranhaSpawnType = new PiranhaSpawnType("All Pipes"); public static const GreenSomePipes:PiranhaSpawnType = new PiranhaSpawnType("Green Some Pipes"); public static const GreenAllPipes:PiranhaSpawnType = new PiranhaSpawnType("Green All Pipes"); public static const RedSomePipes:PiranhaSpawnType = new PiranhaSpawnType("Red Some Pipes"); public static const RedAllPipes:PiranhaSpawnType = new PiranhaSpawnType("Red All Pipes"); public function PiranhaSpawnType(niceName:String = null) { super(niceName); } } }
package com.ankamagames.dofus.logic.game.common.actions.mount { import com.ankamagames.dofus.misc.utils.AbstractAction; import com.ankamagames.jerakine.handlers.messages.Action; public class MountInformationInPaddockRequestAction extends AbstractAction implements Action { public var mountId:uint; public function MountInformationInPaddockRequestAction(params:Array = null) { super(params); } public static function create(mountId:uint) : MountInformationInPaddockRequestAction { var act:MountInformationInPaddockRequestAction = new MountInformationInPaddockRequestAction(arguments); act.mountId = mountId; return act; } } }
package { public class Test { } } function trace_vector(v) { trace("///length: ", v.length); for (var i = 0; i < v.length; i += 1) { trace(v[i]); } } trace("/// var a_bool: Vector.<Boolean> = new <Boolean>[true, false];"); var a_bool:Vector.<Boolean> = new <Boolean>[true, false]; trace("/// var b_bool: Vector.<Boolean> = new <Boolean>[false, true, false];"); var b_bool:Vector.<Boolean> = new <Boolean>[false, true, false]; trace("/// var c_bool = a_bool.concat(b_bool);"); var c_bool = a_bool.concat(b_bool); trace("/// (contents of c_bool...)"); trace_vector(c_bool); class Superclass { } class Subclass extends Superclass { } trace("/// var a_class: Vector.<Superclass> = new <Superclass>[];"); var a_class:Vector.<Superclass> = new <Superclass>[]; trace("/// a_class.length = 2;"); a_class.length = 2; trace("/// a_class[0] = new Superclass();"); a_class[0] = new Superclass(); trace("/// a_class[1] = new Subclass();"); a_class[1] = new Subclass(); trace("/// var b_class: Vector.<Subclass> = new <Subclass>[];"); var b_class:Vector.<Subclass> = new <Subclass>[]; trace("/// b_class.length = 1;"); b_class.length = 1; trace("/// b_class[0] = new Subclass();"); b_class[0] = new Subclass(); trace("/// var c_class = a_class.concat(b_class);"); var c_class = a_class.concat(b_class); trace("/// (contents of c_class...)"); trace_vector(c_class); interface Interface { } class Implementer implements Interface { } trace("/// var a_iface: Vector.<Interface> = new <Interface>[];"); var a_iface:Vector.<Interface> = new <Interface>[]; trace("/// a_iface.length = 1;"); a_iface.length = 1; trace("/// a_iface[0] = new Implementer();"); a_iface[0] = new Implementer(); trace("/// var b_iface: Vector.<Implementer> = new <Implementer>[];"); var b_iface:Vector.<Implementer> = new <Implementer>[]; trace("/// b_iface.length = 1;"); b_iface.length = 1; trace("/// b_iface[0] = new Implementer();"); b_iface[0] = new Implementer(); trace("/// var c_iface = a_iface.concat(b_iface);"); var c_iface = a_iface.concat(b_iface); trace("/// (contents of c_iface...)"); trace_vector(c_iface); trace("/// var a_int: Vector.<int> = new <int>[1,2];"); var a_int:Vector.<int> = new <int>[1,2]; trace("/// var b_int: Vector.<int> = new <int>[5,16];"); var b_int:Vector.<int> = new <int>[5,16]; trace("/// var c_int = a_int.concat(b_int);"); var c_int = a_int.concat(b_int); trace("/// (contents of c_int...)"); trace_vector(c_int); trace("/// var a_number: Vector.<Number> = new <Number>[1,2,3,4];"); var a_number:Vector.<Number> = new <Number>[1,2,3,4]; trace("/// var b_number: Vector.<Number> = new <Number>[5, NaN, -5, 0];"); var b_number:Vector.<Number> = new <Number>[5, NaN, -5, 0]; trace("/// var c_number = a_number.concat(b_number);"); var c_number = a_number.concat(b_number); trace("/// (contents of c_number...)"); trace_vector(c_number); trace("/// var a_string: Vector.<String> = new <String>[\"a\",\"c\",\"d\",\"f\"];"); var a_string:Vector.<String> = new <String>["a", "c", "d", "f"]; trace("/// var b_string: Vector.<String> = new <String>[\"986\",\"B4\",\"Q\",\"rrr\"];"); var b_string:Vector.<String> = new <String>["986", "B4", "Q", "rrr"]; trace("/// var c_string = a_string.concat(b_string);"); var c_string = a_string.concat(b_string); trace("/// (contents of c_string...)"); trace_vector(c_string); trace("/// var a_uint: Vector.<uint> = new <uint>[1,2];"); var a_uint:Vector.<uint> = new <uint>[1,2]; trace("/// var b_uint: Vector.<uint> = new <uint>[5,16];"); var b_uint:Vector.<uint> = new <uint>[5,16]; trace("/// var c_uint = a_uint.concat(b_uint);"); var c_uint = a_uint.concat(b_uint); trace("/// (contents of c_uint...)"); trace_vector(c_uint); trace("/// var a_vector:Vector.<Vector.<int>> = new <Vector.<int>>[new <int>[1,2]];"); var a_vector:Vector.<Vector.<int>> = new <Vector.<int>>[new <int>[1,2]]; trace("/// var b_vector:Vector.<Vector.<int>> = new <Vector.<int>>[new <int>[5,16]];"); var b_vector:Vector.<Vector.<int>> = new <Vector.<int>>[new <int>[5,16]]; trace("/// var c_vector = a_vector.concat(b_vector)"); var c_vector = a_vector.concat(b_vector); trace("/// (contents of c_vector...)"); trace_vector(c_vector);
/* * BetweenAS3 * * Licensed under the MIT License * * Copyright (c) 2009 BeInteractive! (www.be-interactive.org) and * Spark project (www.libspark.org) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * */ package org.libspark.betweenas3.easing { import org.libspark.betweenas3.core.easing.IEasing; import org.libspark.betweenas3.core.easing.QuadraticEaseIn; import org.libspark.betweenas3.core.easing.QuadraticEaseInOut; import org.libspark.betweenas3.core.easing.QuadraticEaseOut; import org.libspark.betweenas3.core.easing.QuadraticEaseOutIn; /** * Quadratic. * * @author yossy:beinteractive */ public class Quad { public static const easeIn:IEasing = new QuadraticEaseIn(); public static const easeOut:IEasing = new QuadraticEaseOut(); public static const easeInOut:IEasing = new QuadraticEaseInOut(); public static const easeOutIn:IEasing = new QuadraticEaseOutIn(); } }
table altGraph "An alternatively spliced gene graph." ( uint id; "Unique ID" string tName; "name of target sequence, often a chrom." int tStart; "First bac touched by graph" int tEnd; "Start position in first bac" char[2] strand; "+ or - strand" uint vertexCount; "Number of vertices in graph" ubyte[vertexCount] vTypes; "Type for each vertex" int[vertexCount] vPositions; "Position in target for each vertex" uint edgeCount; "Number of edges in graph" int[edgeCount] edgeStarts; "Array with start vertex of edges" int[edgeCount] edgeEnds; "Array with end vertex of edges." int mrnaRefCount; "Number of supporting mRNAs." string[mrnaRefCount] mrnaRefs; "Ids of mrnas supporting this." )
package org.flexlite.domUI.skins.vector { import flash.display.GradientType; import org.flexlite.domCore.dx_internal; import org.flexlite.domUI.skins.VectorSkin; use namespace dx_internal; /** * 垂直滚动条track默认皮肤 * @author DOM */ public class VScrollBarTrackSkin extends VectorSkin { public function VScrollBarTrackSkin() { super(); states = ["up","over","down","disabled"]; this.currentState = "up"; this.minHeight = 15; this.minWidth = 15; } /** * @inheritDoc */ override protected function updateDisplayList(w:Number, h:Number):void { super.updateDisplayList(w, h); graphics.clear(); //绘制边框 drawRoundRect( 0, 0, w, h, 0, borderColors[0], 1, horizontalGradientMatrix(0, 0, w, h ), GradientType.LINEAR, null, { x: 1, y: 1, w: w - 2, h: h - 2, r: 0}); //绘制填充 drawRoundRect( 1, 1, w - 2, h - 2, 0, 0xdddbdb, 1, horizontalGradientMatrix(1, 2, w - 2, h - 3)); //绘制底线 drawLine(1,1,1,h-1,0xbcbcbc); this.alpha = currentState=="disabled"?0.5:1; } } }
package com.ankamagames.dofus.network.types.game.context.roleplay { import com.ankamagames.dofus.network.types.game.guild.GuildEmblem; import com.ankamagames.jerakine.network.ICustomDataInput; import com.ankamagames.jerakine.network.ICustomDataOutput; import com.ankamagames.jerakine.network.INetworkType; import com.ankamagames.jerakine.network.utils.FuncTree; public class AllianceInformations extends BasicNamedAllianceInformations implements INetworkType { public static const protocolId:uint = 5338; public var allianceEmblem:GuildEmblem; private var _allianceEmblemtree:FuncTree; public function AllianceInformations() { this.allianceEmblem = new GuildEmblem(); super(); } override public function getTypeId() : uint { return 5338; } public function initAllianceInformations(allianceId:uint = 0, allianceTag:String = "", allianceName:String = "", allianceEmblem:GuildEmblem = null) : AllianceInformations { super.initBasicNamedAllianceInformations(allianceId,allianceTag,allianceName); this.allianceEmblem = allianceEmblem; return this; } override public function reset() : void { super.reset(); this.allianceEmblem = new GuildEmblem(); } override public function serialize(output:ICustomDataOutput) : void { this.serializeAs_AllianceInformations(output); } public function serializeAs_AllianceInformations(output:ICustomDataOutput) : void { super.serializeAs_BasicNamedAllianceInformations(output); this.allianceEmblem.serializeAs_GuildEmblem(output); } override public function deserialize(input:ICustomDataInput) : void { this.deserializeAs_AllianceInformations(input); } public function deserializeAs_AllianceInformations(input:ICustomDataInput) : void { super.deserialize(input); this.allianceEmblem = new GuildEmblem(); this.allianceEmblem.deserialize(input); } override public function deserializeAsync(tree:FuncTree) : void { this.deserializeAsyncAs_AllianceInformations(tree); } public function deserializeAsyncAs_AllianceInformations(tree:FuncTree) : void { super.deserializeAsync(tree); this._allianceEmblemtree = tree.addChild(this._allianceEmblemtreeFunc); } private function _allianceEmblemtreeFunc(input:ICustomDataInput) : void { this.allianceEmblem = new GuildEmblem(); this.allianceEmblem.deserializeAsync(this._allianceEmblemtree); } } }
package kabam.rotmg.messaging.impl.outgoing { import flash.utils.IDataOutput; public class SquareHit extends OutgoingMessage { public var time_:int; public var bulletId_:uint; public var objectId_:int; public function SquareHit(param1:uint, param2:Function) { super(param1,param2); } override public function writeToOutput(param1:IDataOutput) : void { param1.writeInt(this.time_); param1.writeByte(this.bulletId_); param1.writeInt(this.objectId_); } override public function toString() : String { return formatToString("SQUAREHIT","time_","bulletId_","objectId_"); } } }
/* feathers-compat Copyright 2012-2016 Bowler Hat LLC. All Rights Reserved. This program is free software. You can redistribute and/or modify it in accordance with the terms of the accompanying license agreement. */ package feathers.motion.transitions { import feathers.controls.ScreenNavigator; import feathers.motion.Fade; import starling.animation.Transitions; import starling.display.DisplayObject; /** * A transition for <code>ScreenNavigator</code> that fades out the old * screen and fades in the new screen. * * @see feathers.controls.ScreenNavigator */ public class ScreenFadeTransitionManager { /** * Constructor. */ public function ScreenFadeTransitionManager(navigator:ScreenNavigator) { if(!navigator) { throw new ArgumentError("ScreenNavigator cannot be null."); } this.navigator = navigator; this.navigator.transition = this.onTransition; } /** * The <code>ScreenNavigator</code> being managed. */ protected var navigator:ScreenNavigator; /** * @private */ protected var _transition:Function; /** * @private */ protected var _duration:Number = 0.25; /** * The duration of the transition, measured in seconds. * * @default 0.25 */ public function get duration():Number { return this._duration; } /** * @private */ public function set duration(value:Number):void { if(this._duration == value) { return; } this._duration = value; this._transition = null; } /** * @private */ protected var _delay:Number = 0.1; /** * A delay before the transition starts, measured in seconds. This may * be required on low-end systems that will slow down for a short time * after heavy texture uploads. * * @default 0.1 */ public function get delay():Number { return this._delay; } /** * @private */ public function set delay(value:Number):void { if(this._delay == value) { return; } this._delay = value; this._transition = null; } /** * @private */ protected var _ease:Object = Transitions.EASE_OUT; /** * The easing function to use. * * @default starling.animation.Transitions.EASE_OUT */ public function get ease():Object { return this._ease; } /** * @private */ public function set ease(value:Object):void { if(this._ease == value) { return; } this._ease = value; this._transition = null; } /** * Determines if the next transition should be skipped. After the * transition, this value returns to <code>false</code>. * * @default false */ public var skipNextTransition:Boolean = false; /** * The function passed to the <code>transition</code> property of the * <code>ScreenNavigator</code>. */ protected function onTransition(oldScreen:DisplayObject, newScreen:DisplayObject, onComplete:Function):void { if(this.skipNextTransition) { this.skipNextTransition = false; if(onComplete != null) { onComplete(); } return; } if(this._transition === null) { this._transition = Fade.createCrossfadeTransition(this._duration, this._ease, {delay: this._delay}); } this._transition(oldScreen, newScreen, onComplete); } } }
package org.as3commons.ui.layer.popup { import flash.display.DisplayObject; /** * Popup data object. * * @author Jens Struwe 02.02.2011 */ public class PopUpData { /** * The popup. */ private var _popUp : DisplayObject; /** * The overlay. */ private var _modalOverlay : DisplayObject; /** * PopUpData constructor. * * @param popUp The popup. * @param overlay The modal overlay. */ public function PopUpData(popUp : DisplayObject, overlay : DisplayObject = null) { _popUp = popUp; _modalOverlay = overlay; } /** * <code>true</code> if the popup is modal. */ public function get isModal() : Boolean { return _modalOverlay != null; } /** * The popup object. */ public function get popUp() : DisplayObject { return _popUp; } /** * The modal overlay. */ public function set modalOverlay(modalOverlay : DisplayObject) : void { _modalOverlay = modalOverlay; } /** * @private */ public function get modalOverlay() : DisplayObject { return _modalOverlay; } } }
----------------------------------------------------------------------- -- EL.Methods.Func_1 -- Function Bindings with 1 argument -- Copyright (C) 2010, 2011, 2012, 2013 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with EL.Expressions; with EL.Contexts; with Util.Beans.Methods; with Util.Beans.Basic; generic type Param1_Type (<>) is limited private; type Return_Type (<>) is private; package EL.Methods.Func_1 is use Util.Beans.Methods; -- Returns True if the method is a valid method which accepts the arguments -- defined by the package instantiation. function Is_Valid (Method : in EL.Expressions.Method_Info) return Boolean; -- Execute the method describe by the method expression -- and with the given context. The method signature is: -- -- function F (Obj : <Bean>; Param : Param1_Type) return Return_Type; -- -- where <Bean> inherits from <b>Readonly_Bean</b> -- (See <b>Bind</b> package) -- -- Raises <b>Invalid_Method</b> if the method referenced by -- the method expression does not exist or does not match -- the signature. function Execute (Method : in EL.Expressions.Method_Expression'Class; Param : in Param1_Type; Context : in EL.Contexts.ELContext'Class) return Return_Type; -- Function access to the proxy. type Proxy_Access is access function (O : in Util.Beans.Basic.Readonly_Bean'Class; P : in Param1_Type) return Return_Type; -- The binding record which links the method name -- to the proxy function. type Binding is new Method_Binding with record Method : Proxy_Access; end record; type Binding_Access is access constant Binding; -- Proxy for the binding. -- The proxy declares the binding definition that links -- the name to the function and it implements the necessary -- object conversion to translate the <b>Readonly_Bean</b> -- object to the target object type. generic -- Name of the method (as exposed in the EL expression) Name : String; -- The bean type type Bean is new Util.Beans.Basic.Readonly_Bean with private; -- The bean method to invoke with function Method (O : in Bean; P1 : in Param1_Type) return Return_Type; package Bind is -- Method that <b>Execute</b> will invoke. function Method_Access (O : in Util.Beans.Basic.Readonly_Bean'Class; P1 : in Param1_Type) return Return_Type; F_NAME : aliased constant String := Name; -- The proxy binding that can be exposed through -- the <b>Method_Bean</b> interface. Proxy : aliased constant Binding := Binding '(Name => F_NAME'Access, Method => Method_Access'Access); end Bind; end EL.Methods.Func_1;
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- A U N I T . T E S T _ R E S U L T S -- -- -- -- S p e c -- -- -- -- -- -- Copyright (C) 2000-2011, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- -- -- -- -- -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT is maintained by AdaCore (http://www.adacore.com) -- -- -- ------------------------------------------------------------------------------ with Ada_Containers.AUnit_Lists; with AUnit.Time_Measure; use AUnit.Time_Measure; -- Test reporting. -- package AUnit.Test_Results is type Result is tagged limited private; -- Record result. A result object is associated with the execution of a -- top-level test suite. type Test_Failure is record Message : Message_String; Source_Name : Message_String; Line : Natural; end record; type Test_Failure_Access is access all Test_Failure; pragma No_Strict_Aliasing (Test_Failure_Access); -- Description of a test routine failure type Test_Error is record Exception_Name : Message_String; Exception_Message : Message_String; Traceback : Message_String; end record; type Test_Error_Access is access all Test_Error; pragma No_Strict_Aliasing (Test_Error_Access); -- Description of unexpected exceptions type Test_Result is record Test_Name : Message_String; Routine_Name : Message_String; Failure : Test_Failure_Access; Error : Test_Error_Access; Elapsed : Time := Null_Time; end record; -- Decription of a test routine result use Ada_Containers; package Result_Lists is new Ada_Containers.AUnit_Lists (Test_Result); -- Containers for all test results procedure Add_Error (R : in out Result; Test_Name : Message_String; Routine_Name : Message_String; Error : Test_Error; Elapsed : Time); -- Record an unexpected exception procedure Add_Failure (R : in out Result; Test_Name : Message_String; Routine_Name : Message_String; Failure : Test_Failure; Elapsed : Time); -- Record a test routine failure procedure Add_Success (R : in out Result; Test_Name : Message_String; Routine_Name : Message_String; Elapsed : Time); -- Record a test routine success procedure Set_Elapsed (R : in out Result; T : Time); -- Set Elapsed time for reporter function Error_Count (R : Result) return Count_Type; -- Number of routines with unexpected exceptions procedure Errors (R : in out Result; E : in out Result_Lists.List); -- List of routines with unexpected exceptions. This resets the list. function Failure_Count (R : Result) return Count_Type; -- Number of failed routines procedure Failures (R : in out Result; F : in out Result_Lists.List); -- List of failed routines. This resets the list. function Elapsed (R : Result) return Time; -- Elapsed time for test execution procedure Start_Test (R : in out Result; Subtest_Count : Count_Type); -- Set count for a test run function Success_Count (R : Result) return Count_Type; -- Number of successful routines procedure Successes (R : in out Result; S : in out Result_Lists.List); -- List of successful routines. This resets the list. function Successful (R : Result) return Boolean; -- All routines successful? function Test_Count (R : Result) return Ada_Containers.Count_Type; -- Number of routines run procedure Clear (R : in out Result); -- Clear the results private pragma Inline (Errors, Failures, Successes); type Result is tagged limited record Tests_Run : Count_Type := 0; Result_List : Result_Lists.List; Elapsed_Time : Time := Null_Time; end record; end AUnit.Test_Results;
with Ada.Text_IO; use Ada.Text_IO; with Ada.Numerics.Discrete_Random; procedure Test_Updates is type Bucket_Index is range 1..13; package Random_Index is new Ada.Numerics.Discrete_Random (Bucket_Index); use Random_Index; type Buckets is array (Bucket_Index) of Natural; protected type Safe_Buckets is procedure Initialize (Value : Buckets); function Get (I : Bucket_Index) return Natural; procedure Transfer (I, J : Bucket_Index; Amount : Integer); function Snapshot return Buckets; private Data : Buckets := (others => 0); end Safe_Buckets; protected body Safe_Buckets is procedure Initialize (Value : Buckets) is begin Data := Value; end Initialize; function Get (I : Bucket_Index) return Natural is begin return Data (I); end Get; procedure Transfer (I, J : Bucket_Index; Amount : Integer) is Increment : constant Integer := Integer'Max (-Data (J), Integer'Min (Data (I), Amount)); begin Data (I) := Data (I) - Increment; Data (J) := Data (J) + Increment; end Transfer; function Snapshot return Buckets is begin return Data; end Snapshot; end Safe_Buckets; Data : Safe_Buckets; task Equalize; task Mess_Up; task body Equalize is Dice : Generator; I, J : Bucket_Index; begin loop I := Random (Dice); J := Random (Dice); Data.Transfer (I, J, (Data.Get (I) - Data.Get (J)) / 2); end loop; end Equalize; task body Mess_Up is Dice : Generator; begin loop Data.Transfer (Random (Dice), Random (Dice), 100); end loop; end Mess_Up; begin Data.Initialize ((1,2,3,4,5,6,7,8,9,10,11,12,13)); loop delay 1.0; declare State : Buckets := Data.Snapshot; Sum : Natural := 0; begin for Index in State'Range loop Sum := Sum + State (Index); Put (Integer'Image (State (Index))); end loop; Put (" =" & Integer'Image (Sum)); New_Line; end; end loop; end Test_Updates;
type Interval is record Lower : Float; Upper : Float; end record;
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- G N A T . H E A P _ S O R T _ A -- -- -- -- S p e c -- -- -- -- Copyright (C) 1995-2020, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- Heapsort using access to procedure parameters -- This package provides a heap sort routine that works with access to -- subprogram parameters, so that it can be used with different types with -- shared sorting code. It is considered obsoleted by GNAT.Heap_Sort which -- offers a similar routine with a more convenient interface. -- This heapsort algorithm uses approximately N*log(N) compares in the -- worst case and is in place with no additional storage required. See -- the body for exact details of the algorithm used. pragma Compiler_Unit_Warning; package GNAT.Heap_Sort_A is pragma Preelaborate; -- The data to be sorted is assumed to be indexed by integer values from -- 1 to N, where N is the number of items to be sorted. In addition, the -- index value zero is used for a temporary location used during the sort. type Move_Procedure is access procedure (From : Natural; To : Natural); -- A pointer to a procedure that moves the data item with index From to -- the data item with index To. An index value of zero is used for moves -- from and to the single temporary location used by the sort. type Lt_Function is access function (Op1, Op2 : Natural) return Boolean; -- A pointer to a function that compares two items and returns True if -- the item with index Op1 is less than the item with index Op2, and False -- if the Op1 item is greater than or equal to the Op2 item. procedure Sort (N : Natural; Move : Move_Procedure; Lt : Lt_Function); -- This procedures sorts items in the range from 1 to N into ascending -- order making calls to Lt to do required comparisons, and Move to move -- items around. Note that, as described above, both Move and Lt use a -- single temporary location with index value zero. This sort is not -- stable, i.e. the order of equal elements in the input is not preserved. end GNAT.Heap_Sort_A;
-- This file is generated by SWIG. Please do not modify by hand. -- with Interfaces; with Interfaces.C; with Interfaces.C.Pointers; package xcb.xcb_poly_segment_request_t is -- Item -- type Item is record major_opcode : aliased Interfaces.Unsigned_8; pad0 : aliased Interfaces.Unsigned_8; length : aliased Interfaces.Unsigned_16; drawable : aliased xcb.xcb_drawable_t; gc : aliased xcb.xcb_gcontext_t; end record; -- Item_Array -- type Item_Array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_poly_segment_request_t .Item; -- Pointer -- package C_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_poly_segment_request_t.Item, Element_Array => xcb.xcb_poly_segment_request_t.Item_Array, Default_Terminator => (others => <>)); subtype Pointer is C_Pointers.Pointer; -- Pointer_Array -- type Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_poly_segment_request_t .Pointer; -- Pointer_Pointer -- package C_Pointer_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_poly_segment_request_t.Pointer, Element_Array => xcb.xcb_poly_segment_request_t.Pointer_Array, Default_Terminator => null); subtype Pointer_Pointer is C_Pointer_Pointers.Pointer; end xcb.xcb_poly_segment_request_t;
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <!DOCTYPE boost_serialization> <boost_serialization signature="serialization::archive" version="14"> <syndb class_id="0" tracking_level="0" version="0"> <userIPLatency>-1</userIPLatency> <userIPName/> <cdfg class_id="1" tracking_level="1" version="0" object_id="_0"> <name>linebuffer_Loop_1_pr</name> <ret_bitwidth>0</ret_bitwidth> <ports class_id="2" tracking_level="0" version="0"> <count>3</count> <item_version>0</item_version> <item class_id="3" tracking_level="1" version="0" object_id="_1"> <Value class_id="4" tracking_level="0" version="0"> <Obj class_id="5" tracking_level="0" version="0"> <type>1</type> <id>1</id> <name>in_axi_stream_V_value_V</name> <fileName/> <fileDirectory/> <lineNumber>0</lineNumber> <contextFuncName/> <inlineStackInfo class_id="6" tracking_level="0" version="0"> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName>stream&amp;lt;AxiPackedStencil&amp;lt;unsigned int, 1, 1, 1, 1&amp;gt; &amp;gt;.V.value.V</originalName> <rtlName/> <coreName/> </Obj> <bitwidth>32</bitwidth> </Value> <direction>0</direction> <if_type>0</if_type> <array_size>0</array_size> <bit_vecs class_id="7" tracking_level="0" version="0"> <count>0</count> <item_version>0</item_version> </bit_vecs> </item> <item class_id_reference="3" object_id="_2"> <Value> <Obj> <type>1</type> <id>2</id> <name>in_axi_stream_V_last_V</name> <fileName/> <fileDirectory/> <lineNumber>0</lineNumber> <contextFuncName/> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName>stream&amp;lt;AxiPackedStencil&amp;lt;unsigned int, 1, 1, 1, 1&amp;gt; &amp;gt;.V.last.V</originalName> <rtlName/> <coreName/> </Obj> <bitwidth>1</bitwidth> </Value> <direction>0</direction> <if_type>0</if_type> <array_size>0</array_size> <bit_vecs> <count>0</count> <item_version>0</item_version> </bit_vecs> </item> <item class_id_reference="3" object_id="_3"> <Value> <Obj> <type>1</type> <id>3</id> <name>in_stream_V_value_V</name> <fileName/> <fileDirectory/> <lineNumber>0</lineNumber> <contextFuncName/> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName/> <rtlName/> <coreName>FIFO_SRL</coreName> </Obj> <bitwidth>32</bitwidth> </Value> <direction>1</direction> <if_type>3</if_type> <array_size>0</array_size> <bit_vecs> <count>0</count> <item_version>0</item_version> </bit_vecs> </item> </ports> <nodes class_id="8" tracking_level="0" version="0"> <count>10</count> <item_version>0</item_version> <item class_id="9" tracking_level="1" version="0" object_id="_4"> <Value> <Obj> <type>0</type> <id>6</id> <name/> <fileName/> <fileDirectory/> <lineNumber>0</lineNumber> <contextFuncName/> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName/> <rtlName/> <coreName/> </Obj> <bitwidth>0</bitwidth> </Value> <oprand_edges> <count>1</count> <item_version>0</item_version> <item>24</item> </oprand_edges> <opcode>br</opcode> <m_Display>0</m_Display> </item> <item class_id_reference="9" object_id="_5"> <Value> <Obj> <type>0</type> <id>8</id> <name>indvar_flatten</name> <fileName/> <fileDirectory/> <lineNumber>0</lineNumber> <contextFuncName/> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName/> <rtlName/> <coreName/> </Obj> <bitwidth>21</bitwidth> </Value> <oprand_edges> <count>4</count> <item_version>0</item_version> <item>36</item> <item>37</item> <item>38</item> <item>39</item> </oprand_edges> <opcode>phi</opcode> <m_Display>0</m_Display> </item> <item class_id_reference="9" object_id="_6"> <Value> <Obj> <type>0</type> <id>9</id> <name>exitcond_flatten</name> <fileName/> <fileDirectory/> <lineNumber>0</lineNumber> <contextFuncName/> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName/> <rtlName>exitcond_flatten_fu_74_p2</rtlName> <coreName/> </Obj> <bitwidth>1</bitwidth> </Value> <oprand_edges> <count>2</count> <item_version>0</item_version> <item>40</item> <item>42</item> </oprand_edges> <opcode>icmp</opcode> <m_Display>0</m_Display> </item> <item class_id_reference="9" object_id="_7"> <Value> <Obj> <type>0</type> <id>10</id> <name>indvar_flatten_next</name> <fileName/> <fileDirectory/> <lineNumber>0</lineNumber> <contextFuncName/> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName/> <rtlName>indvar_flatten_next_fu_80_p2</rtlName> <coreName/> </Obj> <bitwidth>21</bitwidth> </Value> <oprand_edges> <count>2</count> <item_version>0</item_version> <item>43</item> <item>45</item> </oprand_edges> <opcode>add</opcode> <m_Display>0</m_Display> </item> <item class_id_reference="9" object_id="_8"> <Value> <Obj> <type>0</type> <id>11</id> <name/> <fileName/> <fileDirectory/> <lineNumber>0</lineNumber> <contextFuncName/> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName/> <rtlName/> <coreName/> </Obj> <bitwidth>0</bitwidth> </Value> <oprand_edges> <count>3</count> <item_version>0</item_version> <item>46</item> <item>47</item> <item>48</item> </oprand_edges> <opcode>br</opcode> <m_Display>0</m_Display> </item> <item class_id_reference="9" object_id="_9"> <Value> <Obj> <type>0</type> <id>16</id> <name>empty_20</name> <fileName>../../../lib_files/Linebuffer.h</fileName> <fileDirectory>..</fileDirectory> <lineNumber>554</lineNumber> <contextFuncName>linebuffer&amp;lt;1920, 1080, 1, 1, 1, 1, 1, 1, 3, 3, 1, 1, unsigned int&amp;gt;</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item class_id="11" tracking_level="0" version="0"> <first>/home/dhuff/Halide-HLS/apps/hls_examples/camera_ready_synthesis/app_files/big_apps_32_shifts/conv2d_b2b</first> <second class_id="12" tracking_level="0" version="0"> <count>1</count> <item_version>0</item_version> <item class_id="13" tracking_level="0" version="0"> <first class_id="14" tracking_level="0" version="0"> <first>../../../lib_files/Linebuffer.h</first> <second>linebuffer&amp;lt;1920, 1080, 1, 1, 1, 1, 1, 1, 3, 3, 1, 1, unsigned int&amp;gt;</second> </first> <second>554</second> </item> </second> </item> </inlineStackInfo> <originalName/> <rtlName/> <coreName/> </Obj> <bitwidth>33</bitwidth> </Value> <oprand_edges> <count>3</count> <item_version>0</item_version> <item>26</item> <item>27</item> <item>28</item> </oprand_edges> <opcode>read</opcode> <m_Display>0</m_Display> </item> <item class_id_reference="9" object_id="_10"> <Value> <Obj> <type>0</type> <id>17</id> <name>tmp_value_V</name> <fileName>../../../lib_files/Linebuffer.h</fileName> <fileDirectory>..</fileDirectory> <lineNumber>554</lineNumber> <contextFuncName>linebuffer&amp;lt;1920, 1080, 1, 1, 1, 1, 1, 1, 3, 3, 1, 1, unsigned int&amp;gt;</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>/home/dhuff/Halide-HLS/apps/hls_examples/camera_ready_synthesis/app_files/big_apps_32_shifts/conv2d_b2b</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>../../../lib_files/Linebuffer.h</first> <second>linebuffer&amp;lt;1920, 1080, 1, 1, 1, 1, 1, 1, 3, 3, 1, 1, unsigned int&amp;gt;</second> </first> <second>554</second> </item> </second> </item> </inlineStackInfo> <originalName>tmp.value.V</originalName> <rtlName/> <coreName/> </Obj> <bitwidth>32</bitwidth> </Value> <oprand_edges> <count>1</count> <item_version>0</item_version> <item>29</item> </oprand_edges> <opcode>extractvalue</opcode> <m_Display>0</m_Display> </item> <item class_id_reference="9" object_id="_11"> <Value> <Obj> <type>0</type> <id>18</id> <name/> <fileName>../../../lib_files/Linebuffer.h</fileName> <fileDirectory>..</fileDirectory> <lineNumber>554</lineNumber> <contextFuncName>linebuffer&amp;lt;1920, 1080, 1, 1, 1, 1, 1, 1, 3, 3, 1, 1, unsigned int&amp;gt;</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>/home/dhuff/Halide-HLS/apps/hls_examples/camera_ready_synthesis/app_files/big_apps_32_shifts/conv2d_b2b</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>../../../lib_files/Linebuffer.h</first> <second>linebuffer&amp;lt;1920, 1080, 1, 1, 1, 1, 1, 1, 3, 3, 1, 1, unsigned int&amp;gt;</second> </first> <second>554</second> </item> </second> </item> </inlineStackInfo> <originalName/> <rtlName/> <coreName/> </Obj> <bitwidth>0</bitwidth> </Value> <oprand_edges> <count>3</count> <item_version>0</item_version> <item>31</item> <item>32</item> <item>33</item> </oprand_edges> <opcode>write</opcode> <m_Display>0</m_Display> </item> <item class_id_reference="9" object_id="_12"> <Value> <Obj> <type>0</type> <id>20</id> <name/> <fileName>../../../lib_files/Linebuffer.h</fileName> <fileDirectory>..</fileDirectory> <lineNumber>552</lineNumber> <contextFuncName>linebuffer&amp;lt;1920, 1080, 1, 1, 1, 1, 1, 1, 3, 3, 1, 1, unsigned int&amp;gt;</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>/home/dhuff/Halide-HLS/apps/hls_examples/camera_ready_synthesis/app_files/big_apps_32_shifts/conv2d_b2b</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>../../../lib_files/Linebuffer.h</first> <second>linebuffer&amp;lt;1920, 1080, 1, 1, 1, 1, 1, 1, 3, 3, 1, 1, unsigned int&amp;gt;</second> </first> <second>552</second> </item> </second> </item> </inlineStackInfo> <originalName/> <rtlName/> <coreName/> </Obj> <bitwidth>0</bitwidth> </Value> <oprand_edges> <count>1</count> <item_version>0</item_version> <item>34</item> </oprand_edges> <opcode>br</opcode> <m_Display>0</m_Display> </item> <item class_id_reference="9" object_id="_13"> <Value> <Obj> <type>0</type> <id>22</id> <name/> <fileName/> <fileDirectory/> <lineNumber>0</lineNumber> <contextFuncName/> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName/> <rtlName/> <coreName/> </Obj> <bitwidth>0</bitwidth> </Value> <oprand_edges> <count>0</count> <item_version>0</item_version> </oprand_edges> <opcode>ret</opcode> <m_Display>0</m_Display> </item> </nodes> <consts class_id="15" tracking_level="0" version="0"> <count>3</count> <item_version>0</item_version> <item class_id="16" tracking_level="1" version="0" object_id="_14"> <Value> <Obj> <type>2</type> <id>35</id> <name>empty</name> <fileName/> <fileDirectory/> <lineNumber>0</lineNumber> <contextFuncName/> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName/> <rtlName/> <coreName/> </Obj> <bitwidth>21</bitwidth> </Value> <const_type>0</const_type> <content>0</content> </item> <item class_id_reference="16" object_id="_15"> <Value> <Obj> <type>2</type> <id>41</id> <name>empty</name> <fileName/> <fileDirectory/> <lineNumber>0</lineNumber> <contextFuncName/> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName/> <rtlName/> <coreName/> </Obj> <bitwidth>21</bitwidth> </Value> <const_type>0</const_type> <content>2073600</content> </item> <item class_id_reference="16" object_id="_16"> <Value> <Obj> <type>2</type> <id>44</id> <name>empty</name> <fileName/> <fileDirectory/> <lineNumber>0</lineNumber> <contextFuncName/> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName/> <rtlName/> <coreName/> </Obj> <bitwidth>21</bitwidth> </Value> <const_type>0</const_type> <content>1</content> </item> </consts> <blocks class_id="17" tracking_level="0" version="0"> <count>4</count> <item_version>0</item_version> <item class_id="18" tracking_level="1" version="0" object_id="_17"> <Obj> <type>3</type> <id>7</id> <name>newFuncRoot</name> <fileName/> <fileDirectory/> <lineNumber>0</lineNumber> <contextFuncName/> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName/> <rtlName/> <coreName/> </Obj> <node_objs> <count>1</count> <item_version>0</item_version> <item>6</item> </node_objs> </item> <item class_id_reference="18" object_id="_18"> <Obj> <type>3</type> <id>12</id> <name>.preheader.i</name> <fileName/> <fileDirectory/> <lineNumber>0</lineNumber> <contextFuncName/> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName/> <rtlName/> <coreName/> </Obj> <node_objs> <count>4</count> <item_version>0</item_version> <item>8</item> <item>9</item> <item>10</item> <item>11</item> </node_objs> </item> <item class_id_reference="18" object_id="_19"> <Obj> <type>3</type> <id>21</id> <name>.preheader4.i</name> <fileName/> <fileDirectory/> <lineNumber>0</lineNumber> <contextFuncName/> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName/> <rtlName/> <coreName/> </Obj> <node_objs> <count>4</count> <item_version>0</item_version> <item>16</item> <item>17</item> <item>18</item> <item>20</item> </node_objs> </item> <item class_id_reference="18" object_id="_20"> <Obj> <type>3</type> <id>23</id> <name>.critedge.exitStub</name> <fileName/> <fileDirectory/> <lineNumber>0</lineNumber> <contextFuncName/> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName/> <rtlName/> <coreName/> </Obj> <node_objs> <count>1</count> <item_version>0</item_version> <item>22</item> </node_objs> </item> </blocks> <edges class_id="19" tracking_level="0" version="0"> <count>22</count> <item_version>0</item_version> <item class_id="20" tracking_level="1" version="0" object_id="_21"> <id>24</id> <edge_type>2</edge_type> <source_obj>12</source_obj> <sink_obj>6</sink_obj> </item> <item class_id_reference="20" object_id="_22"> <id>27</id> <edge_type>1</edge_type> <source_obj>1</source_obj> <sink_obj>16</sink_obj> </item> <item class_id_reference="20" object_id="_23"> <id>28</id> <edge_type>1</edge_type> <source_obj>2</source_obj> <sink_obj>16</sink_obj> </item> <item class_id_reference="20" object_id="_24"> <id>29</id> <edge_type>1</edge_type> <source_obj>16</source_obj> <sink_obj>17</sink_obj> </item> <item class_id_reference="20" object_id="_25"> <id>32</id> <edge_type>1</edge_type> <source_obj>3</source_obj> <sink_obj>18</sink_obj> </item> <item class_id_reference="20" object_id="_26"> <id>33</id> <edge_type>1</edge_type> <source_obj>17</source_obj> <sink_obj>18</sink_obj> </item> <item class_id_reference="20" object_id="_27"> <id>34</id> <edge_type>2</edge_type> <source_obj>12</source_obj> <sink_obj>20</sink_obj> </item> <item class_id_reference="20" object_id="_28"> <id>36</id> <edge_type>1</edge_type> <source_obj>35</source_obj> <sink_obj>8</sink_obj> </item> <item class_id_reference="20" object_id="_29"> <id>37</id> <edge_type>2</edge_type> <source_obj>7</source_obj> <sink_obj>8</sink_obj> </item> <item class_id_reference="20" object_id="_30"> <id>38</id> <edge_type>1</edge_type> <source_obj>10</source_obj> <sink_obj>8</sink_obj> </item> <item class_id_reference="20" object_id="_31"> <id>39</id> <edge_type>2</edge_type> <source_obj>21</source_obj> <sink_obj>8</sink_obj> </item> <item class_id_reference="20" object_id="_32"> <id>40</id> <edge_type>1</edge_type> <source_obj>8</source_obj> <sink_obj>9</sink_obj> </item> <item class_id_reference="20" object_id="_33"> <id>42</id> <edge_type>1</edge_type> <source_obj>41</source_obj> <sink_obj>9</sink_obj> </item> <item class_id_reference="20" object_id="_34"> <id>43</id> <edge_type>1</edge_type> <source_obj>8</source_obj> <sink_obj>10</sink_obj> </item> <item class_id_reference="20" object_id="_35"> <id>45</id> <edge_type>1</edge_type> <source_obj>44</source_obj> <sink_obj>10</sink_obj> </item> <item class_id_reference="20" object_id="_36"> <id>46</id> <edge_type>1</edge_type> <source_obj>9</source_obj> <sink_obj>11</sink_obj> </item> <item class_id_reference="20" object_id="_37"> <id>47</id> <edge_type>2</edge_type> <source_obj>21</source_obj> <sink_obj>11</sink_obj> </item> <item class_id_reference="20" object_id="_38"> <id>48</id> <edge_type>2</edge_type> <source_obj>23</source_obj> <sink_obj>11</sink_obj> </item> <item class_id_reference="20" object_id="_39"> <id>108</id> <edge_type>2</edge_type> <source_obj>7</source_obj> <sink_obj>12</sink_obj> </item> <item class_id_reference="20" object_id="_40"> <id>109</id> <edge_type>2</edge_type> <source_obj>12</source_obj> <sink_obj>23</sink_obj> </item> <item class_id_reference="20" object_id="_41"> <id>110</id> <edge_type>2</edge_type> <source_obj>12</source_obj> <sink_obj>21</sink_obj> </item> <item class_id_reference="20" object_id="_42"> <id>111</id> <edge_type>2</edge_type> <source_obj>21</source_obj> <sink_obj>12</sink_obj> </item> </edges> </cdfg> <cdfg_regions class_id="21" tracking_level="0" version="0"> <count>4</count> <item_version>0</item_version> <item class_id="22" tracking_level="1" version="0" object_id="_43"> <mId>1</mId> <mTag>linebuffer_Loop_1_pr</mTag> <mType>0</mType> <sub_regions> <count>3</count> <item_version>0</item_version> <item>2</item> <item>3</item> <item>4</item> </sub_regions> <basic_blocks> <count>0</count> <item_version>0</item_version> </basic_blocks> <mII>-1</mII> <mDepth>-1</mDepth> <mMinTripCount>-1</mMinTripCount> <mMaxTripCount>-1</mMaxTripCount> <mMinLatency>2073602</mMinLatency> <mMaxLatency>-1</mMaxLatency> <mIsDfPipe>0</mIsDfPipe> <mDfPipe class_id="-1"/> </item> <item class_id_reference="22" object_id="_44"> <mId>2</mId> <mTag>Entry</mTag> <mType>0</mType> <sub_regions> <count>0</count> <item_version>0</item_version> </sub_regions> <basic_blocks> <count>1</count> <item_version>0</item_version> <item>7</item> </basic_blocks> <mII>-1</mII> <mDepth>-1</mDepth> <mMinTripCount>-1</mMinTripCount> <mMaxTripCount>-1</mMaxTripCount> <mMinLatency>0</mMinLatency> <mMaxLatency>-1</mMaxLatency> <mIsDfPipe>0</mIsDfPipe> <mDfPipe class_id="-1"/> </item> <item class_id_reference="22" object_id="_45"> <mId>3</mId> <mTag>Loop 1</mTag> <mType>1</mType> <sub_regions> <count>0</count> <item_version>0</item_version> </sub_regions> <basic_blocks> <count>2</count> <item_version>0</item_version> <item>12</item> <item>21</item> </basic_blocks> <mII>1</mII> <mDepth>2</mDepth> <mMinTripCount>2073600</mMinTripCount> <mMaxTripCount>2073600</mMaxTripCount> <mMinLatency>2073600</mMinLatency> <mMaxLatency>-1</mMaxLatency> <mIsDfPipe>0</mIsDfPipe> <mDfPipe class_id="-1"/> </item> <item class_id_reference="22" object_id="_46"> <mId>4</mId> <mTag>Return</mTag> <mType>0</mType> <sub_regions> <count>0</count> <item_version>0</item_version> </sub_regions> <basic_blocks> <count>1</count> <item_version>0</item_version> <item>23</item> </basic_blocks> <mII>-1</mII> <mDepth>-1</mDepth> <mMinTripCount>-1</mMinTripCount> <mMaxTripCount>-1</mMaxTripCount> <mMinLatency>0</mMinLatency> <mMaxLatency>-1</mMaxLatency> <mIsDfPipe>0</mIsDfPipe> <mDfPipe class_id="-1"/> </item> </cdfg_regions> <fsm class_id="24" tracking_level="1" version="0" object_id="_47"> <states class_id="25" tracking_level="0" version="0"> <count>4</count> <item_version>0</item_version> <item class_id="26" tracking_level="1" version="0" object_id="_48"> <id>1</id> <operations class_id="27" tracking_level="0" version="0"> <count>3</count> <item_version>0</item_version> <item class_id="28" tracking_level="1" version="0" object_id="_49"> <id>4</id> <stage>1</stage> <latency>1</latency> </item> <item class_id_reference="28" object_id="_50"> <id>5</id> <stage>1</stage> <latency>1</latency> </item> <item class_id_reference="28" object_id="_51"> <id>6</id> <stage>1</stage> <latency>1</latency> </item> </operations> </item> <item class_id_reference="26" object_id="_52"> <id>2</id> <operations> <count>6</count> <item_version>0</item_version> <item class_id_reference="28" object_id="_53"> <id>8</id> <stage>1</stage> <latency>1</latency> </item> <item class_id_reference="28" object_id="_54"> <id>9</id> <stage>1</stage> <latency>1</latency> </item> <item class_id_reference="28" object_id="_55"> <id>10</id> <stage>1</stage> <latency>1</latency> </item> <item class_id_reference="28" object_id="_56"> <id>11</id> <stage>1</stage> <latency>1</latency> </item> <item class_id_reference="28" object_id="_57"> <id>16</id> <stage>1</stage> <latency>1</latency> </item> <item class_id_reference="28" object_id="_58"> <id>17</id> <stage>1</stage> <latency>1</latency> </item> </operations> </item> <item class_id_reference="26" object_id="_59"> <id>3</id> <operations> <count>6</count> <item_version>0</item_version> <item class_id_reference="28" object_id="_60"> <id>13</id> <stage>1</stage> <latency>1</latency> </item> <item class_id_reference="28" object_id="_61"> <id>14</id> <stage>1</stage> <latency>1</latency> </item> <item class_id_reference="28" object_id="_62"> <id>15</id> <stage>1</stage> <latency>1</latency> </item> <item class_id_reference="28" object_id="_63"> <id>18</id> <stage>1</stage> <latency>1</latency> </item> <item class_id_reference="28" object_id="_64"> <id>19</id> <stage>1</stage> <latency>1</latency> </item> <item class_id_reference="28" object_id="_65"> <id>20</id> <stage>1</stage> <latency>1</latency> </item> </operations> </item> <item class_id_reference="26" object_id="_66"> <id>4</id> <operations> <count>1</count> <item_version>0</item_version> <item class_id_reference="28" object_id="_67"> <id>22</id> <stage>1</stage> <latency>1</latency> </item> </operations> </item> </states> <transitions class_id="29" tracking_level="0" version="0"> <count>4</count> <item_version>0</item_version> <item class_id="30" tracking_level="1" version="0" object_id="_68"> <inState>1</inState> <outState>2</outState> <condition class_id="31" tracking_level="0" version="0"> <id>12</id> <sop class_id="32" tracking_level="0" version="0"> <count>1</count> <item_version>0</item_version> <item class_id="33" tracking_level="0" version="0"> <count>0</count> <item_version>0</item_version> </item> </sop> </condition> </item> <item class_id_reference="30" object_id="_69"> <inState>3</inState> <outState>2</outState> <condition> <id>20</id> <sop> <count>1</count> <item_version>0</item_version> <item> <count>0</count> <item_version>0</item_version> </item> </sop> </condition> </item> <item class_id_reference="30" object_id="_70"> <inState>2</inState> <outState>4</outState> <condition> <id>19</id> <sop> <count>1</count> <item_version>0</item_version> <item> <count>1</count> <item_version>0</item_version> <item class_id="34" tracking_level="0" version="0"> <first class_id="35" tracking_level="0" version="0"> <first>9</first> <second>0</second> </first> <second>0</second> </item> </item> </sop> </condition> </item> <item class_id_reference="30" object_id="_71"> <inState>2</inState> <outState>3</outState> <condition> <id>21</id> <sop> <count>1</count> <item_version>0</item_version> <item> <count>1</count> <item_version>0</item_version> <item> <first> <first>9</first> <second>0</second> </first> <second>1</second> </item> </item> </sop> </condition> </item> </transitions> </fsm> <res class_id="36" tracking_level="1" version="0" object_id="_72"> <dp_component_resource class_id="37" tracking_level="0" version="0"> <count>0</count> <item_version>0</item_version> </dp_component_resource> <dp_expression_resource> <count>9</count> <item_version>0</item_version> <item class_id="38" tracking_level="0" version="0"> <first>ap_block_pp0_stage0_flag00001001 ( or ) </first> <second class_id="39" tracking_level="0" version="0"> <count>4</count> <item_version>0</item_version> <item class_id="40" tracking_level="0" version="0"> <first>(0P0)</first> <second>1</second> </item> <item> <first>(1P1)</first> <second>1</second> </item> <item> <first>FF</first> <second>0</second> </item> <item> <first>LUT</first> <second>2</second> </item> </second> </item> <item> <first>ap_block_state1 ( or ) </first> <second> <count>4</count> <item_version>0</item_version> <item> <first>(0P0)</first> <second>1</second> </item> <item> <first>(1P1)</first> <second>1</second> </item> <item> <first>FF</first> <second>0</second> </item> <item> <first>LUT</first> <second>2</second> </item> </second> </item> <item> <first>ap_block_state2_pp0_stage0_iter0 ( and ) </first> <second> <count>4</count> <item_version>0</item_version> <item> <first>(0P0)</first> <second>1</second> </item> <item> <first>(1P1)</first> <second>1</second> </item> <item> <first>FF</first> <second>0</second> </item> <item> <first>LUT</first> <second>2</second> </item> </second> </item> <item> <first>ap_block_state3_pp0_stage0_iter1 ( and ) </first> <second> <count>4</count> <item_version>0</item_version> <item> <first>(0P0)</first> <second>1</second> </item> <item> <first>(1P1)</first> <second>1</second> </item> <item> <first>FF</first> <second>0</second> </item> <item> <first>LUT</first> <second>2</second> </item> </second> </item> <item> <first>ap_enable_pp0 ( xor ) </first> <second> <count>4</count> <item_version>0</item_version> <item> <first>(0P0)</first> <second>1</second> </item> <item> <first>(1P1)</first> <second>2</second> </item> <item> <first>FF</first> <second>0</second> </item> <item> <first>LUT</first> <second>2</second> </item> </second> </item> <item> <first>ap_enable_reg_pp0_iter1 ( xor ) </first> <second> <count>4</count> <item_version>0</item_version> <item> <first>(0P0)</first> <second>1</second> </item> <item> <first>(1P1)</first> <second>2</second> </item> <item> <first>FF</first> <second>0</second> </item> <item> <first>LUT</first> <second>2</second> </item> </second> </item> <item> <first>exitcond_flatten_fu_74_p2 ( icmp ) </first> <second> <count>4</count> <item_version>0</item_version> <item> <first>(0P0)</first> <second>21</second> </item> <item> <first>(1P1)</first> <second>16</second> </item> <item> <first>FF</first> <second>0</second> </item> <item> <first>LUT</first> <second>13</second> </item> </second> </item> <item> <first>indvar_flatten_next_fu_80_p2 ( + ) </first> <second> <count>4</count> <item_version>0</item_version> <item> <first>(0P0)</first> <second>21</second> </item> <item> <first>(1P1)</first> <second>1</second> </item> <item> <first>FF</first> <second>68</second> </item> <item> <first>LUT</first> <second>26</second> </item> </second> </item> <item> <first>start_write ( and ) </first> <second> <count>4</count> <item_version>0</item_version> <item> <first>(0P0)</first> <second>1</second> </item> <item> <first>(1P1)</first> <second>1</second> </item> <item> <first>FF</first> <second>0</second> </item> <item> <first>LUT</first> <second>2</second> </item> </second> </item> </dp_expression_resource> <dp_fifo_resource> <count>0</count> <item_version>0</item_version> </dp_fifo_resource> <dp_memory_resource> <count>0</count> <item_version>0</item_version> </dp_memory_resource> <dp_multiplexer_resource> <count>8</count> <item_version>0</item_version> <item> <first>ap_NS_fsm</first> <second> <count>4</count> <item_version>0</item_version> <item> <first>(0Size)</first> <second>4</second> </item> <item> <first>(1Bits)</first> <second>1</second> </item> <item> <first>(2Count)</first> <second>4</second> </item> <item> <first>LUT</first> <second>21</second> </item> </second> </item> <item> <first>ap_done</first> <second> <count>4</count> <item_version>0</item_version> <item> <first>(0Size)</first> <second>2</second> </item> <item> <first>(1Bits)</first> <second>1</second> </item> <item> <first>(2Count)</first> <second>2</second> </item> <item> <first>LUT</first> <second>9</second> </item> </second> </item> <item> <first>ap_enable_reg_pp0_iter1</first> <second> <count>4</count> <item_version>0</item_version> <item> <first>(0Size)</first> <second>3</second> </item> <item> <first>(1Bits)</first> <second>1</second> </item> <item> <first>(2Count)</first> <second>3</second> </item> <item> <first>LUT</first> <second>15</second> </item> </second> </item> <item> <first>in_axi_stream_V_last_V_blk_n</first> <second> <count>4</count> <item_version>0</item_version> <item> <first>(0Size)</first> <second>2</second> </item> <item> <first>(1Bits)</first> <second>1</second> </item> <item> <first>(2Count)</first> <second>2</second> </item> <item> <first>LUT</first> <second>9</second> </item> </second> </item> <item> <first>in_axi_stream_V_value_V_blk_n</first> <second> <count>4</count> <item_version>0</item_version> <item> <first>(0Size)</first> <second>2</second> </item> <item> <first>(1Bits)</first> <second>1</second> </item> <item> <first>(2Count)</first> <second>2</second> </item> <item> <first>LUT</first> <second>9</second> </item> </second> </item> <item> <first>in_stream_V_value_V_blk_n</first> <second> <count>4</count> <item_version>0</item_version> <item> <first>(0Size)</first> <second>2</second> </item> <item> <first>(1Bits)</first> <second>1</second> </item> <item> <first>(2Count)</first> <second>2</second> </item> <item> <first>LUT</first> <second>9</second> </item> </second> </item> <item> <first>indvar_flatten_reg_63</first> <second> <count>4</count> <item_version>0</item_version> <item> <first>(0Size)</first> <second>2</second> </item> <item> <first>(1Bits)</first> <second>21</second> </item> <item> <first>(2Count)</first> <second>42</second> </item> <item> <first>LUT</first> <second>9</second> </item> </second> </item> <item> <first>real_start</first> <second> <count>4</count> <item_version>0</item_version> <item> <first>(0Size)</first> <second>2</second> </item> <item> <first>(1Bits)</first> <second>1</second> </item> <item> <first>(2Count)</first> <second>2</second> </item> <item> <first>LUT</first> <second>9</second> </item> </second> </item> </dp_multiplexer_resource> <dp_register_resource> <count>10</count> <item_version>0</item_version> <item> <first>ap_CS_fsm</first> <second> <count>3</count> <item_version>0</item_version> <item> <first>(Bits)</first> <second>3</second> </item> <item> <first>(Consts)</first> <second>0</second> </item> <item> <first>FF</first> <second>3</second> </item> </second> </item> <item> <first>ap_done_reg</first> <second> <count>3</count> <item_version>0</item_version> <item> <first>(Bits)</first> <second>1</second> </item> <item> <first>(Consts)</first> <second>0</second> </item> <item> <first>FF</first> <second>1</second> </item> </second> </item> <item> <first>ap_enable_reg_pp0_iter0</first> <second> <count>3</count> <item_version>0</item_version> <item> <first>(Bits)</first> <second>1</second> </item> <item> <first>(Consts)</first> <second>0</second> </item> <item> <first>FF</first> <second>1</second> </item> </second> </item> <item> <first>ap_enable_reg_pp0_iter1</first> <second> <count>3</count> <item_version>0</item_version> <item> <first>(Bits)</first> <second>1</second> </item> <item> <first>(Consts)</first> <second>0</second> </item> <item> <first>FF</first> <second>1</second> </item> </second> </item> <item> <first>exitcond_flatten_reg_90</first> <second> <count>3</count> <item_version>0</item_version> <item> <first>(Bits)</first> <second>1</second> </item> <item> <first>(Consts)</first> <second>0</second> </item> <item> <first>FF</first> <second>1</second> </item> </second> </item> <item> <first>indvar_flatten_reg_63</first> <second> <count>3</count> <item_version>0</item_version> <item> <first>(Bits)</first> <second>21</second> </item> <item> <first>(Consts)</first> <second>0</second> </item> <item> <first>FF</first> <second>21</second> </item> </second> </item> <item> <first>real_start_status_reg</first> <second> <count>3</count> <item_version>0</item_version> <item> <first>(Bits)</first> <second>1</second> </item> <item> <first>(Consts)</first> <second>0</second> </item> <item> <first>FF</first> <second>1</second> </item> </second> </item> <item> <first>start_control_reg</first> <second> <count>3</count> <item_version>0</item_version> <item> <first>(Bits)</first> <second>1</second> </item> <item> <first>(Consts)</first> <second>0</second> </item> <item> <first>FF</first> <second>1</second> </item> </second> </item> <item> <first>start_once_reg</first> <second> <count>3</count> <item_version>0</item_version> <item> <first>(Bits)</first> <second>1</second> </item> <item> <first>(Consts)</first> <second>0</second> </item> <item> <first>FF</first> <second>1</second> </item> </second> </item> <item> <first>tmp_value_V_reg_99</first> <second> <count>3</count> <item_version>0</item_version> <item> <first>(Bits)</first> <second>32</second> </item> <item> <first>(Consts)</first> <second>0</second> </item> <item> <first>FF</first> <second>32</second> </item> </second> </item> </dp_register_resource> <dp_component_map class_id="41" tracking_level="0" version="0"> <count>0</count> <item_version>0</item_version> </dp_component_map> <dp_expression_map> <count>2</count> <item_version>0</item_version> <item class_id="42" tracking_level="0" version="0"> <first>exitcond_flatten_fu_74_p2 ( icmp ) </first> <second> <count>1</count> <item_version>0</item_version> <item>9</item> </second> </item> <item> <first>indvar_flatten_next_fu_80_p2 ( + ) </first> <second> <count>1</count> <item_version>0</item_version> <item>10</item> </second> </item> </dp_expression_map> <dp_fifo_map> <count>0</count> <item_version>0</item_version> </dp_fifo_map> <dp_memory_map> <count>0</count> <item_version>0</item_version> </dp_memory_map> </res> <node_label_latency class_id="43" tracking_level="0" version="0"> <count>10</count> <item_version>0</item_version> <item class_id="44" tracking_level="0" version="0"> <first>6</first> <second class_id="45" tracking_level="0" version="0"> <first>0</first> <second>0</second> </second> </item> <item> <first>8</first> <second> <first>1</first> <second>0</second> </second> </item> <item> <first>9</first> <second> <first>1</first> <second>0</second> </second> </item> <item> <first>10</first> <second> <first>1</first> <second>0</second> </second> </item> <item> <first>11</first> <second> <first>1</first> <second>0</second> </second> </item> <item> <first>16</first> <second> <first>1</first> <second>0</second> </second> </item> <item> <first>17</first> <second> <first>1</first> <second>0</second> </second> </item> <item> <first>18</first> <second> <first>2</first> <second>0</second> </second> </item> <item> <first>20</first> <second> <first>2</first> <second>0</second> </second> </item> <item> <first>22</first> <second> <first>2</first> <second>0</second> </second> </item> </node_label_latency> <bblk_ent_exit class_id="46" tracking_level="0" version="0"> <count>4</count> <item_version>0</item_version> <item class_id="47" tracking_level="0" version="0"> <first>7</first> <second class_id="48" tracking_level="0" version="0"> <first>0</first> <second>0</second> </second> </item> <item> <first>12</first> <second> <first>1</first> <second>1</second> </second> </item> <item> <first>21</first> <second> <first>1</first> <second>2</second> </second> </item> <item> <first>23</first> <second> <first>2</first> <second>2</second> </second> </item> </bblk_ent_exit> <regions class_id="49" tracking_level="0" version="0"> <count>1</count> <item_version>0</item_version> <item class_id="50" tracking_level="1" version="0" object_id="_73"> <region_name>Loop 1</region_name> <basic_blocks> <count>2</count> <item_version>0</item_version> <item>12</item> <item>21</item> </basic_blocks> <nodes> <count>0</count> <item_version>0</item_version> </nodes> <anchor_node>-1</anchor_node> <region_type>8</region_type> <interval>1</interval> <pipe_depth>2</pipe_depth> </item> </regions> <dp_fu_nodes class_id="51" tracking_level="0" version="0"> <count>6</count> <item_version>0</item_version> <item class_id="52" tracking_level="0" version="0"> <first>48</first> <second> <count>1</count> <item_version>0</item_version> <item>16</item> </second> </item> <item> <first>56</first> <second> <count>1</count> <item_version>0</item_version> <item>18</item> </second> </item> <item> <first>67</first> <second> <count>1</count> <item_version>0</item_version> <item>8</item> </second> </item> <item> <first>74</first> <second> <count>1</count> <item_version>0</item_version> <item>9</item> </second> </item> <item> <first>80</first> <second> <count>1</count> <item_version>0</item_version> <item>10</item> </second> </item> <item> <first>86</first> <second> <count>1</count> <item_version>0</item_version> <item>17</item> </second> </item> </dp_fu_nodes> <dp_fu_nodes_expression class_id="54" tracking_level="0" version="0"> <count>4</count> <item_version>0</item_version> <item class_id="55" tracking_level="0" version="0"> <first>exitcond_flatten_fu_74</first> <second> <count>1</count> <item_version>0</item_version> <item>9</item> </second> </item> <item> <first>indvar_flatten_next_fu_80</first> <second> <count>1</count> <item_version>0</item_version> <item>10</item> </second> </item> <item> <first>indvar_flatten_phi_fu_67</first> <second> <count>1</count> <item_version>0</item_version> <item>8</item> </second> </item> <item> <first>tmp_value_V_fu_86</first> <second> <count>1</count> <item_version>0</item_version> <item>17</item> </second> </item> </dp_fu_nodes_expression> <dp_fu_nodes_module> <count>0</count> <item_version>0</item_version> </dp_fu_nodes_module> <dp_fu_nodes_io> <count>2</count> <item_version>0</item_version> <item> <first>StgValue_17_write_fu_56</first> <second> <count>1</count> <item_version>0</item_version> <item>18</item> </second> </item> <item> <first>empty_20_read_fu_48</first> <second> <count>1</count> <item_version>0</item_version> <item>16</item> </second> </item> </dp_fu_nodes_io> <return_ports> <count>0</count> <item_version>0</item_version> </return_ports> <dp_mem_port_nodes class_id="56" tracking_level="0" version="0"> <count>0</count> <item_version>0</item_version> </dp_mem_port_nodes> <dp_reg_nodes> <count>4</count> <item_version>0</item_version> <item> <first>63</first> <second> <count>1</count> <item_version>0</item_version> <item>8</item> </second> </item> <item> <first>90</first> <second> <count>1</count> <item_version>0</item_version> <item>9</item> </second> </item> <item> <first>94</first> <second> <count>1</count> <item_version>0</item_version> <item>10</item> </second> </item> <item> <first>99</first> <second> <count>1</count> <item_version>0</item_version> <item>17</item> </second> </item> </dp_reg_nodes> <dp_regname_nodes> <count>4</count> <item_version>0</item_version> <item> <first>exitcond_flatten_reg_90</first> <second> <count>1</count> <item_version>0</item_version> <item>9</item> </second> </item> <item> <first>indvar_flatten_next_reg_94</first> <second> <count>1</count> <item_version>0</item_version> <item>10</item> </second> </item> <item> <first>indvar_flatten_reg_63</first> <second> <count>1</count> <item_version>0</item_version> <item>8</item> </second> </item> <item> <first>tmp_value_V_reg_99</first> <second> <count>1</count> <item_version>0</item_version> <item>17</item> </second> </item> </dp_regname_nodes> <dp_reg_phi> <count>1</count> <item_version>0</item_version> <item> <first>63</first> <second> <count>1</count> <item_version>0</item_version> <item>8</item> </second> </item> </dp_reg_phi> <dp_regname_phi> <count>1</count> <item_version>0</item_version> <item> <first>indvar_flatten_reg_63</first> <second> <count>1</count> <item_version>0</item_version> <item>8</item> </second> </item> </dp_regname_phi> <dp_port_io_nodes class_id="57" tracking_level="0" version="0"> <count>3</count> <item_version>0</item_version> <item class_id="58" tracking_level="0" version="0"> <first>in_axi_stream_V_last_V</first> <second> <count>1</count> <item_version>0</item_version> <item> <first>read</first> <second> <count>1</count> <item_version>0</item_version> <item>16</item> </second> </item> </second> </item> <item> <first>in_axi_stream_V_value_V</first> <second> <count>1</count> <item_version>0</item_version> <item> <first>read</first> <second> <count>1</count> <item_version>0</item_version> <item>16</item> </second> </item> </second> </item> <item> <first>in_stream_V_value_V</first> <second> <count>1</count> <item_version>0</item_version> <item> <first>write</first> <second> <count>1</count> <item_version>0</item_version> <item>18</item> </second> </item> </second> </item> </dp_port_io_nodes> <port2core class_id="59" tracking_level="0" version="0"> <count>1</count> <item_version>0</item_version> <item class_id="60" tracking_level="0" version="0"> <first>3</first> <second>FIFO_SRL</second> </item> </port2core> <node2core> <count>0</count> <item_version>0</item_version> </node2core> </syndb> </boost_serialization>
-- C64105D.ADA -- Grant of Unlimited Rights -- -- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687, -- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained -- unlimited rights in the software and documentation contained herein. -- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making -- this public release, the Government intends to confer upon all -- recipients unlimited rights equal to those held by the Government. -- These rights include rights to use, duplicate, release or disclose the -- released technical data and computer software in whole or in part, in -- any manner and for any purpose whatsoever, and to have or permit others -- to do so. -- -- DISCLAIMER -- -- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR -- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED -- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE -- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE -- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A -- PARTICULAR PURPOSE OF SAID MATERIAL. --* -- CHECK THAT CONSTRAINT_ERROR IS NOT RAISED FOR ACCESS PARAMETERS -- IN THE FOLLOWING CIRCUMSTANCES: -- (1) -- (2) -- (3) BEFORE OR AFTER THE CALL, WHEN AN UNCONSTRAINED ACTUAL -- OUT ACCESS PARAMETER DESIGNATES AN OBJECT (PRIOR TO THE -- CALL) WITH CONSTRAINTS DIFFERENT FROM THE FORMAL -- PARAMETER. -- SUBTESTS ARE: -- (G) CASE 3, STATIC LIMITED PRIVATE DISCRIMINANT. -- (H) CASE 3, DYNAMIC ONE DIMENSIONAL BOUNDS. -- JRK 3/20/81 -- SPS 10/26/82 WITH REPORT; PROCEDURE C64105D IS USE REPORT; BEGIN TEST ("C64105D", "CHECK THAT CONSTRAINT_ERROR IS NOT RAISED " & "BEFORE AND AFTER THE CALL, WHEN AN UNCONSTRAINED ACTUAL " & "OUT ACCESS PARAMETER DESIGNATES AN OBJECT (PRIOR TO THE " & "CALL) WITH CONSTRAINTS DIFFERENT FROM THE FORMAL " & "PARAMETER" ); -------------------------------------------------- DECLARE -- (G) PACKAGE PKG IS SUBTYPE INT IS INTEGER RANGE 0..5; TYPE T (I : INT := 0) IS LIMITED PRIVATE; PRIVATE TYPE ARR IS ARRAY (INTEGER RANGE <>) OF INTEGER; TYPE T (I : INT := 0) IS RECORD J : INTEGER; A : ARR (1..I); END RECORD; END PKG; USE PKG; TYPE A IS ACCESS T; SUBTYPE SA IS A(3); V : A := NEW T (2); CALLED : BOOLEAN := FALSE; PROCEDURE P (X : OUT SA) IS BEGIN CALLED := TRUE; X := NEW T (3); EXCEPTION WHEN OTHERS => FAILED ("EXCEPTION RAISED IN PROCEDURE - (G)"); END P; BEGIN -- (G) P (V); EXCEPTION WHEN CONSTRAINT_ERROR => IF NOT CALLED THEN FAILED ("EXCEPTION RAISED BEFORE CALL - (G)"); ELSE FAILED ("EXCEPTION RAISED ON RETURN - (G)"); END IF; WHEN OTHERS => FAILED ("EXCEPTION RAISED - (G)"); END; -- (G) -------------------------------------------------- DECLARE -- (H) TYPE A IS ACCESS STRING; SUBTYPE SA IS A (1..2); V : A := NEW STRING (IDENT_INT(5) .. IDENT_INT(7)); CALLED : BOOLEAN := FALSE; PROCEDURE P (X : OUT SA) IS BEGIN CALLED := TRUE; X := NEW STRING (IDENT_INT(1) .. IDENT_INT(2)); EXCEPTION WHEN OTHERS => FAILED ("EXCEPTION RAISED IN PROCEDURE - (H)"); END P; BEGIN -- (H) P (V); EXCEPTION WHEN CONSTRAINT_ERROR => IF NOT CALLED THEN FAILED ("EXCEPTION RAISED BEFORE CALL - (H)"); ELSE FAILED ("EXCEPTION RAISED ON RETURN - (H)"); END IF; WHEN OTHERS => FAILED ("EXCEPTION RAISED - (H)"); END; -- (H) -------------------------------------------------- RESULT; END C64105D;
with openGL.Tasks, GL.lean, System, ada.unchecked_Conversion; package body openGL.Attribute is use GL.lean; --------- -- Forge -- procedure define (Self : in out Item) is begin null; end define; procedure destroy (Self : in out Item) is begin null; end destroy; package body Forge is function to_Attribute (Name : in String; gl_Location : in gl.GLuint; Size : in gl.GLint; data_Kind : in Attribute.data_Kind; Stride : in Natural; Offset : in storage_Offset; Normalized : in Boolean) return Item is begin return (name => new String'(Name), location => gl_Location, size => Size, data_kind => data_Kind, vertex_stride => gl.GLint (Stride), offset => Offset, normalized => Boolean'Pos (Normalized)); end to_Attribute; function new_Attribute (Name : in String; gl_Location : in gl.GLuint; Size : in gl.GLint; data_Kind : in Attribute.data_Kind; Stride : in Natural; Offset : in Storage_Offset; Normalized : in Boolean) return View is begin return new Item' (to_Attribute (Name, gl_Location, Size, data_Kind, Stride, Offset, Normalized)); end new_Attribute; end Forge; -------------- -- Attributes -- function Name (Self : in Item'Class) return String is begin return Self.Name.all; end Name; function gl_Location (Self : in Item'Class) return gl.GLuint is begin return Self.Location; end gl_Location; -------------- -- Operations -- procedure enable (Self : in Item) is use GL, system.Storage_Elements; type GLvoid_access is access all GLvoid; function to_GL is new ada.unchecked_Conversion (attribute.data_Kind, gl.GLenum); -- TODO: Address different sizes warning. function to_GL is new ada.unchecked_Conversion (storage_Offset, GLvoid_access); begin Tasks.check; glEnableVertexAttribArray (Index => Self.gl_Location); glVertexAttribPointer (Index => Self.gl_Location, Size => Self.Size, the_Type => to_GL (Self.data_Kind), Normalized => Self.Normalized, Stride => Self.vertex_Stride, Ptr => to_GL (Self.Offset)); end enable; end openGL.Attribute;
with logger; use logger; package body text_file is procedure write_string_to_file(file_path, content : string) is file : file_type; begin begin debug("Ouverture du fichier " & file_path); -- Ouverture du fichier open(file, out_file, file_path); exception -- si le fichier n'existe pas when name_error => debug("Fichier inexistant ou erreur. Création"); -- creation du fichier create(file, out_file, file_path); debug("Fichier crée"); end; -- écriture de la chaîne dans le fichier put(file, content); -- fermeture du fichier close(file); debug("Fichier écrit et fermé"); end; procedure read_file_to_string(file_path : string; content : out unbounded_string) is file : file_type; begin content := to_unbounded_string(""); debug("Ouverture du fichier " & file_path); -- Ouverture du fichier open(file, in_file, file_path); while not end_of_file(file) loop declare line : constant string := get_line(file); begin append(content, line); end; end loop; -- fermeture du fichier close(file); debug("Fichier écrit et fermé"); end; procedure read_file_to_string(file_handle : in out file_type; content : out unbounded_string) is begin reset(file_handle, in_file); content := to_unbounded_string(""); while not end_of_file(file_handle) loop declare line : constant string := get_line(file_handle); begin append(content, line); end; end loop; end; end text_file;
package Problem_47 is procedure Solve; end Problem_47;
-------------------------------------------------------------------------------- -- Copyright (C) 2020 by Heisenbug Ltd. (gh+owm@heisenbug.eu) -- -- This work is free. You can redistribute it and/or modify it under the -- terms of the Do What The Fuck You Want To Public License, Version 2, -- as published by Sam Hocevar. See the LICENSE file for more details. -------------------------------------------------------------------------------- pragma License (Unrestricted); -------------------------------------------------------------------------------- --% @summary --% Open_Weather_Map.API.Service.Weather -- --% @description --% Provides the query object implementing a single id based query. -------------------------------------------------------------------------------- package Open_Weather_Map.API.Service.Weather is ----------------------------------------------------------------------------- -- API: Current weather data (by city ID) ----------------------------------------------------------------------------- type T is new Service.T with private; ----------------------------------------------------------------------------- -- Initialize ----------------------------------------------------------------------------- procedure Initialize (Self : out T; Configuration : in GNATCOLL.JSON.JSON_Value; Connection : not null Client.T_Access; Max_Cache_Interval : in Ada.Real_Time.Time_Span := Default_Cache_Interval; Id : in City_Id); --% Initializes an instance of a single query. -- --% @param Self --% Instance of the single query to initialize. -- --% @param Configuration --% Configuration data object containing connection relevant data (proxy --% server, API key, etc.). -- --% @param Connection --% The connection to be used for client server communication. -- --% @param Max_Cache_Interval --% Denotes the maximum frequency at which actual queries are being sent to --% the server. -- --% @param Id --% Location id of the place to be queried. private type T is new API. Service.T with null record; ----------------------------------------------------------------------------- -- Decode_Response ----------------------------------------------------------------------------- overriding function Decode_Response (Self : in T; Root : in GNATCOLL.JSON.JSON_Value) return Data_Set; --% Decodes a single query response from the server. -- --% @param Self --% The single query instance. -- --% @param Root --% Root of the JSON data sent back by the server. -- --% @return --% The data set decoded from the response in Root. end Open_Weather_Map.API.Service.Weather;
-- Copyright 2021 Free Software Foundation, Inc. -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program. If not, see <http://www.gnu.org/licenses/>. with Pck; use Pck; procedure Voidctx is function DoSomething return Integer is begin return 42; end; procedure DoSomething is begin null; end; begin null; -- STOP end Voidctx;
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- A D A . T E X T _ I O . W I D E _ T E X T _ I O . F I X E D _ I O -- -- -- -- B o d y -- -- -- -- Copyright (C) 1992-2020, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ with Ada.Wide_Text_IO.Float_Aux; with System.WCh_Con; use System.WCh_Con; with System.WCh_WtS; use System.WCh_WtS; package body Ada.Wide_Text_IO.Fixed_IO is subtype TFT is Ada.Wide_Text_IO.File_Type; -- File type required for calls to routines in Aux package Aux renames Ada.Wide_Text_IO.Float_Aux; --------- -- Get -- --------- procedure Get (File : File_Type; Item : out Num; Width : Field := 0) is begin Aux.Get (TFT (File), Long_Long_Float (Item), Width); exception when Constraint_Error => raise Data_Error; end Get; procedure Get (Item : out Num; Width : Field := 0) is begin Get (Current_Input, Item, Width); end Get; procedure Get (From : Wide_String; Item : out Num; Last : out Positive) is S : constant String := Wide_String_To_String (From, WCEM_Upper); -- String on which we do the actual conversion. Note that the method -- used for wide character encoding is irrelevant, since if there is -- a character outside the Standard.Character range then the call to -- Aux.Gets will raise Data_Error in any case. begin Aux.Gets (S, Long_Long_Float (Item), Last); exception when Constraint_Error => raise Data_Error; end Get; --------- -- Put -- --------- procedure Put (File : File_Type; Item : Num; Fore : Field := Default_Fore; Aft : Field := Default_Aft; Exp : Field := Default_Exp) is begin Aux.Put (TFT (File), Long_Long_Float (Item), Fore, Aft, Exp); end Put; procedure Put (Item : Num; Fore : Field := Default_Fore; Aft : Field := Default_Aft; Exp : Field := Default_Exp) is begin Put (Current_Output, Item, Fore, Aft, Exp); end Put; procedure Put (To : out Wide_String; Item : Num; Aft : Field := Default_Aft; Exp : Field := Default_Exp) is S : String (To'First .. To'Last); begin Aux.Puts (S, Long_Long_Float (Item), Aft, Exp); for J in S'Range loop To (J) := Wide_Character'Val (Character'Pos (S (J))); end loop; end Put; end Ada.Wide_Text_IO.Fixed_IO;
------------------------------------------------------------------------------ -- -- -- GNAT ncurses Binding -- -- -- -- Terminal_Interface.Curses.Text_IO.Complex_IO -- -- -- -- S P E C -- -- -- ------------------------------------------------------------------------------ -- Copyright 2020 Thomas E. Dickey -- -- Copyright 1999-2003,2009 Free Software Foundation, Inc. -- -- -- -- Permission is hereby granted, free of charge, to any person obtaining a -- -- copy of this software and associated documentation files (the -- -- "Software"), to deal in the Software without restriction, including -- -- without limitation the rights to use, copy, modify, merge, publish, -- -- distribute, distribute with modifications, sublicense, and/or sell -- -- copies of the Software, and to permit persons to whom the Software is -- -- furnished to do so, subject to the following conditions: -- -- -- -- The above copyright notice and this permission notice shall be included -- -- in all copies or substantial portions of the Software. -- -- -- -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -- -- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -- -- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -- -- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -- -- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -- -- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR -- -- THE USE OR OTHER DEALINGS IN THE SOFTWARE. -- -- -- -- Except as contained in this notice, the name(s) of the above copyright -- -- holders shall not be used in advertising or otherwise to promote the -- -- sale, use or other dealings in this Software without prior written -- -- authorization. -- ------------------------------------------------------------------------------ -- Author: Juergen Pfeifer, 1996 -- Version Control: -- $Revision: 1.12 $ -- Binding Version 01.00 ------------------------------------------------------------------------------ with Ada.Numerics.Generic_Complex_Types; generic with package Complex_Types is new Ada.Numerics.Generic_Complex_Types (<>); package Terminal_Interface.Curses.Text_IO.Complex_IO is use Complex_Types; Default_Fore : Field := 2; Default_Aft : Field := Real'Digits - 1; Default_Exp : Field := 3; procedure Put (Win : Window; Item : Complex; Fore : Field := Default_Fore; Aft : Field := Default_Aft; Exp : Field := Default_Exp); procedure Put (Item : Complex; Fore : Field := Default_Fore; Aft : Field := Default_Aft; Exp : Field := Default_Exp); private pragma Inline (Put); end Terminal_Interface.Curses.Text_IO.Complex_IO;