Advertisement
Guest User

InstrumentData

a guest
Mar 28th, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ////////////////////////////////////////////////////////////////////////////////
  2. //
  3. //  © 2017 nexters.com
  4. //
  5. ////////////////////////////////////////////////////////////////////////////////
  6.  
  7. package ru.nexters.ie2.view.components.drag {
  8.     import feathers.dragDrop.DragDropManager;
  9.    
  10.     import starling.core.Starling;
  11.  
  12.     /**
  13.      * @author                  v.proskurin
  14.      * @version                 1.0
  15.      * @playerversion           Flash 10
  16.      * @langversion             3.0
  17.      * @date                    Mar 27, 2017
  18.      */
  19.     public class InstrumentData {
  20.        
  21.         public static const SETUP:String = 'InstrumentData.SETUP';
  22.         public static const COLLECT:String = 'InstrumentData.COLLECT';
  23.        
  24.         public static var current:InstrumentData;
  25.        
  26.         public static function get isActive():Boolean {
  27.             return current != null && DragDropManager.isDragging;
  28.         }
  29.        
  30.         public var type:String;
  31.         public var data:*;
  32.         public var callback:Function;
  33.         public var count:int = 0;
  34.        
  35.         public function InstrumentData(id:String) {
  36.             this.type = id;
  37.             this.data = DragDropManager.dragData.getDataForFormat(id);
  38.         }
  39.        
  40.         public function dispatch(value:Boolean):void {
  41.             if (value) count++;
  42.            
  43.             if (callback!=null) {
  44.                 callback(this, value);
  45.             }
  46.         }
  47.        
  48.         public function cancel():void {
  49.             DragDropManager.cancelDrag();
  50.             Starling.current.touchProcessor.currentTouches.length = 0;
  51.         }
  52.        
  53.     }
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement