コード例 #1
0
 public Node Normalized()
 {
     if (IsDictionary)
     {
         var node = new Node(_type);
         foreach (var kv in AsDictionary.OrderBy(kv => kv.Key))
         {
             node.AsDictionary.Add(kv.Key, kv.Value.Normalized());
         }
         return(node);
     }
     else if (IsList)
     {
         var node = new Node(_type);
         foreach (var child in AsList.OrderBy(n => n.AsString))
         {
             node.AsList.Add(child.Normalized());
         }
         return(node);
     }
     else
     {
         return(Node.From(AsString));
     }
 }
コード例 #2
0
        public virtual AsVector <AsTexture> getTextures(String prefix)
        {
            AsVector <AsTexture> textures = new AsVector <AsTexture>();
            AsVector <String>    names    = new AsVector <String>();
            AsDictionary         __names_ = mTextureRegions;

            if (__names_ != null)
            {
                foreach (String name in __names_)
                {
                    if (AsString.indexOf(name, prefix) == 0)
                    {
                        names.push(name);
                    }
                }
            }
            names.sort(AsArray.CASEINSENSITIVE);
            AsVector <String> __names_ = names;

            if (__names_ != null)
            {
                foreach (String name in __names_)
                {
                    textures.push(getTexture(name));
                }
            }
            return(textures);
        }
コード例 #3
0
 public virtual void addKerning(int charID, float amount)
 {
     if (mKernings == null)
     {
         mKernings = new AsDictionary();
     }
     mKernings[charID] = amount;
 }
コード例 #4
0
 public AsBitmapChar(int id, AsTexture texture, float xOffset, float yOffset, float xAdvance)
 {
     mCharID   = id;
     mTexture  = texture;
     mXOffset  = xOffset;
     mYOffset  = yOffset;
     mXAdvance = xAdvance;
     mKernings = null;
 }
コード例 #5
0
 public AsTextureAtlas(AsTexture texture, AsXML atlasXml)
 {
     mTextureRegions = new AsDictionary();
     mTextureFrames  = new AsDictionary();
     mAtlasTexture   = texture;
     if (atlasXml != null)
     {
         parseAtlasXml(atlasXml);
     }
 }
コード例 #6
0
 private void initializeGraphicsAPI()
 {
     mContext = mStage3D.getContext3D();
     mContext.setEnableErrorChecking(mEnableErrorChecking);
     mPrograms = new AsDictionary();
     updateViewPort();
     AsGlobal.trace("[Starling] Initialization complete.");
     AsGlobal.trace("[Starling] Display Driver:", mContext.getDriverInfo());
     dispatchEventWith(starling.events.Event.CONTEXT3D_CREATE, false, mContext);
 }
コード例 #7
0
        private static AsDictionary getBitmapFonts()
        {
            AsDictionary fonts = AsStarling.getCurrent().getCustomData()[BITMAP_FONT_DATA_NAME] as AsDictionary;

            if (fonts == null)
            {
                fonts = new AsDictionary();
                AsStarling.getCurrent().getCustomData()[BITMAP_FONT_DATA_NAME] = fonts;
            }
            return(fonts);
        }
コード例 #8
0
 public virtual void removeEventListeners(String type)
 {
     if (type != null && mEventListeners != null)
     {
         mEventListeners.remove(type);
     }
     else
     {
         mEventListeners = null;
     }
 }
コード例 #9
0
 public object this[string key] {
     get { return(AsDictionary.FirstOrDefault(kv => kv.Key.Equals(key)).Value); }
     set {
         if (AsDictionary.ContainsKey(key))
         {
             AsDictionary[key] = value;
         }
         else
         {
             AsDictionary.Add(key, value);
         }
     }
 }
コード例 #10
0
        public virtual void dispose()
        {
            stop();
            mNativeStage.removeEventListener(AsEvent.ENTER_FRAME, onEnterFrame, false);
            mNativeStage.removeEventListener(AsKeyboardEvent.KEY_DOWN, onKey, false);
            mNativeStage.removeEventListener(AsKeyboardEvent.KEY_UP, onKey, false);
            mNativeStage.removeEventListener(AsEvent.RESIZE, onResize, false);
            mNativeStage.removeChild(mNativeOverlay);
            mStage3D.removeEventListener(AsEvent.CONTEXT3D_CREATE, onContextCreated, false);
            mStage3D.removeEventListener(AsErrorEvent.ERROR, onStage3DError, false);
            AsArray __touchEventTypes_ = getTouchEventTypes();

            if (__touchEventTypes_ != null)
            {
                foreach (String touchEventType in __touchEventTypes_)
                {
                    mNativeStage.removeEventListener(touchEventType, onTouch, false);
                }
            }
            AsDictionary __programs_ = mPrograms;

            if (__programs_ != null)
            {
                foreach (AsProgram3D program in __programs_)
                {
                    program.dispose();
                }
            }
            if (mStage != null)
            {
                mStage.dispose();
            }
            if (mSupport != null)
            {
                mSupport.dispose();
            }
            if (mTouchProcessor != null)
            {
                mTouchProcessor.dispose();
            }
            if (mContext != null && !mShareContext)
            {
                mContext.dispose();
            }
            if (sCurrent == this)
            {
                sCurrent = null;
            }
        }
コード例 #11
0
        public virtual void addEventListener(String type, AsEventListenerCallback listener, bool useCapture, int priority, bool useWeakReference)
        {
            if (mEventListeners == null)
            {
                mEventListeners = new AsDictionary();
            }
            AsVector <AsEventListenerCallback> listeners = (AsVector <AsEventListenerCallback>)(mEventListeners[type]);

            if (listeners == null)
            {
                listeners             = new AsVector <AsEventListenerCallback>();
                mEventListeners[type] = listeners;
            }
            listeners.push(listener);
        }
コード例 #12
0
 public AsBitmapFont(AsTexture texture, AsXML fontXml)
 {
     if (texture == null && fontXml == null)
     {
         texture = AsMiniBitmapFont.getTexture();
         fontXml = AsMiniBitmapFont.getXml();
     }
     mName             = "unknown";
     mLineHeight       = mSize = mBaseline = 14;
     mTexture          = texture;
     mChars            = new AsDictionary();
     mHelperImage      = new AsImage(texture);
     mCharLocationPool = new AsVector <AsCharLocation>();
     if (fontXml != null)
     {
         parseFontXml(fontXml);
     }
 }
コード例 #13
0
        public void Dictionary_OpenAddressing_Test()
        {
            var Dictionary = new AsDictionary <int, int>(DictionaryType.OpenAddressing);
            int nodeCount  = 1000 * 10;

            //insert test


            for (int i = 0; i <= nodeCount; i++)
            {
                Dictionary.Add(i, i);
                Assert.AreEqual(true, Dictionary.ContainsKey(i));
            }


            for (int i = 0; i <= nodeCount; i++)
            {
                Dictionary.Remove(i);
                Assert.AreEqual(false, Dictionary.ContainsKey(i));
            }


            var rnd        = new Random();
            var testSeries = Enumerable.Range(1, nodeCount).OrderBy(x => rnd.Next()).ToList();


            foreach (var item in testSeries)
            {
                Dictionary.Add(item, item);
                Assert.AreEqual(true, Dictionary.ContainsKey(item));
            }

            foreach (var item in testSeries)
            {
                Assert.AreEqual(true, Dictionary.ContainsKey(item));
            }

            for (int i = 1; i <= nodeCount; i++)
            {
                Dictionary.Remove(i);
                Assert.AreEqual(false, Dictionary.ContainsKey(i));
            }
        }
コード例 #14
0
        public virtual void addEventListener(String type, AsEventListenerCallback listener)
        {
            if (mEventListeners == null)
            {
                mEventListeners = new AsDictionary();
            }
            AsVector <AsEventListenerCallback> listeners = mEventListeners[type] as AsVector <AsEventListenerCallback>;

            if (listeners == null)
            {
                mEventListeners[type] = new AsVector <AsEventListenerCallback>();
            }
            else
            {
                if (listeners.indexOf(listener) == -1)
                {
                    listeners.push(listener);
                }
            }
        }
コード例 #15
0
 private static void registerDefaults()
 {
     sTransitions = new AsDictionary();
     register(LINEAR, linear);
     register(EASE_IN, easeIn);
     register(EASE_OUT, easeOut);
     register(EASE_IN_OUT, easeInOut);
     register(EASE_OUT_IN, easeOutIn);
     register(EASE_IN_BACK, easeInBack);
     register(EASE_OUT_BACK, easeOutBack);
     register(EASE_IN_OUT_BACK, easeInOutBack);
     register(EASE_OUT_IN_BACK, easeOutInBack);
     register(EASE_IN_ELASTIC, easeInElastic);
     register(EASE_OUT_ELASTIC, easeOutElastic);
     register(EASE_IN_OUT_ELASTIC, easeInOutElastic);
     register(EASE_OUT_IN_ELASTIC, easeOutInElastic);
     register(EASE_IN_BOUNCE, easeInBounce);
     register(EASE_OUT_BOUNCE, easeOutBounce);
     register(EASE_IN_OUT_BOUNCE, easeInOutBounce);
     register(EASE_OUT_IN_BOUNCE, easeOutInBounce);
 }
コード例 #16
0
 bool ICollection <KeyValuePair <object, DataEntry> > .Contains(KeyValuePair <object, DataEntry> item)
 {
     return(AsDictionary.Contains(item));
 }
コード例 #17
0
 public bool HasField(string s)
 {
     return(AsDictionary.ContainsKey(Unquote(s)));
 }
コード例 #18
0
 System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
 {
     return(AsDictionary.GetEnumerator());
 }
コード例 #19
0
 public IEnumerator <KeyValuePair <string, dynamic> > GetEnumerator()
 {
     return(AsDictionary.GetEnumerator());
 }
コード例 #20
0
        public AsStarling(AsClass rootClass, bc.flash.display.AsStage stage, AsRectangle viewPort, AsStage3D stage3D, String renderMode, String profile)
        {
            if (stage == null)
            {
                throw new AsArgumentError("Stage must not be null");
            }
            if (rootClass == null)
            {
                throw new AsArgumentError("Root class must not be null");
            }
            if (viewPort == null)
            {
                viewPort = new AsRectangle(0, 0, stage.getStageWidth(), stage.getStageHeight());
            }
            if (stage3D == null)
            {
                stage3D = stage.getStage3Ds()[0];
            }
            makeCurrent();
            mRootClass     = rootClass;
            mViewPort      = viewPort;
            mStage3D       = stage3D;
            mStage         = new AsStage(viewPort.width, viewPort.height, stage.getColor());
            mNativeOverlay = new AsSprite();
            mNativeStage   = stage;
            mNativeStage.addChild(mNativeOverlay);
            mTouchProcessor      = new AsTouchProcessor(mStage);
            mJuggler             = new AsJuggler();
            mAntiAliasing        = 0;
            mSimulateMultitouch  = false;
            mEnableErrorChecking = false;
            mLastFrameTimestamp  = AsGlobal.getTimer() / 1000.0f;
            mPrograms            = new AsDictionary();
            mCustomData          = new AsDictionary();
            mSupport             = new AsRenderSupport();
            AsArray __touchEventTypes_ = getTouchEventTypes();

            if (__touchEventTypes_ != null)
            {
                foreach (String touchEventType in __touchEventTypes_)
                {
                    stage.addEventListener(touchEventType, onTouch, false, 0, true);
                }
            }
            stage.addEventListener(AsEvent.ENTER_FRAME, onEnterFrame, false, 0, true);
            stage.addEventListener(AsKeyboardEvent.KEY_DOWN, onKey, false, 0, true);
            stage.addEventListener(AsKeyboardEvent.KEY_UP, onKey, false, 0, true);
            stage.addEventListener(AsEvent.RESIZE, onResize, false, 0, true);
            if (mStage3D.getContext3D() != null && mStage3D.getContext3D().getDriverInfo() != "Disposed")
            {
                mShareContext = true;
                AsGlobal.setTimeout(initialize, 1);
            }
            else
            {
                mShareContext = false;
                mStage3D.addEventListener(AsEvent.CONTEXT3D_CREATE, onContextCreated, false, 1, true);
                mStage3D.addEventListener(AsErrorEvent.ERROR, onStage3DError, false, 1, true);
                try
                {
                    mStage3D.requestContext3D(renderMode);
                }
                catch (AsError e)
                {
                    showFatalError("Context3D error: " + e.message);
                }
            }
        }
コード例 #21
0
 void ICollection <KeyValuePair <object, DataEntry> > .CopyTo(KeyValuePair <object, DataEntry>[] array, int arrayIndex)
 {
     AsDictionary.CopyTo(array, arrayIndex);
 }