'Programing'에 해당되는 글 46건

  1. 2016.11.15 NPM 인스톨이 안될때.
  2. 2016.10.17 c# string format
  3. 2015.11.20 texturepacker license post
  4. 2015.11.20 starling main frame
  5. 2015.11.20 starling moviebutton
  6. 2015.11.20 coineff
  7. 2015.11.20 baseEff
  8. 2015.11.20 objectMgr
  9. 2013.09.23 java heap space build halted with errors (fcsh)
  10. 2013.05.22 json 요약

NPM 인스톨이 안될때.

 

USER/.npmrc 파일 수정.

 

 

strict-ssl=false
registry=http://registry.npmjs.org/
cat >>~/.npmrc <<NPMRC
root = $HOME/.node_libraries
binroot = $HOME/bin
manroot = $HOME/share/man
NPMRC

 

'Programing > node.js' 카테고리의 다른 글

NPM 인스톨이 안될때.  (0) 2016.11.15
Posted by 패스맨

댓글을 달아 주세요

c# string format

Programing/Etc 2016.10.17 12:46 |


출처

http://www.dreamy.pe.kr/zbxe/CodeClip/157656






숫자형식 포맷팅을 이용하면 숫자로 이루어진 문자열을 다양한 형태로 출력 할 수 있습니다.

기본적으로 이 포맷팅은 System. String.Format 매서드에 기반하여 적용됩니다.


형식지정자

종류

예제코드

출력결과

C / c

통화
Currency

Response.Write(string.Format("{0:C}", 2.5));

₩3

Response.Write(string.Format("{0:C}", -3.5));

-₩4

D / d

10진법
Decimal

Response.Write(string.Format("{0:D}", 00035));

35

E / e

과학적지수
Scientific

Response.Write(string.Format("{0:E}", 342));

3.420000E+02

F / f

고정 소수점
Fixed-point

Response.Write(string.Format("{0:F2}", 35.22));

35.22

Response.Write(string.Format("{0:F0}", 35.22));

35

G / g

일반
General

Response.Write(string.Format("{0:G}", 123456));

123456

N / n

숫자
Number

Response.Write(string.Format("{0:N}", 25000000));

25,000,000.00

P / p

백분율
Percentage

Response.Write(string.Format("{0:P}", .21548));

21.55%

Response.Write(string.Format("{0:P1}", .112345));

11.2%

X / x

16진법
Hexadecimal

Response.Write(string.Format("{0:X}", 250));

FA

Response.Write(string.Format("{0:X}", 0xffff));

FFFF


 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
// This code example demonstrates the String.Format() method.
// Formatting for this example uses the "en-US" culture.
 
using System;
class Sample
{
    enum Color {Yellow = 1, Blue, Green};
    static DateTime thisDate = DateTime.Now;
 
    public static void Main()
    {
// Store the output of the String.Format method in a string.
    string s = "";
 
    Console.Clear();
 
// Format a negative integer or floating-point number in various ways.
    Console.WriteLine("Standard Numeric Format Specifiers");
    s = String.Format(
        "(C) Currency: . . . . . . . . {0:C}\n" +
        "(D) Decimal:. . . . . . . . . {0:D}\n" +
        "(E) Scientific: . . . . . . . {1:E}\n" +
        "(F) Fixed point:. . . . . . . {1:F}\n" +
        "(G) General:. . . . . . . . . {0:G}\n" +
        "    (default):. . . . . . . . {0} (default = 'G')\n" +
        "(N) Number: . . . . . . . . . {0:N}\n" +
        "(P) Percent:. . . . . . . . . {1:P}\n" +
        "(R) Round-trip: . . . . . . . {1:R}\n" +
        "(X) Hexadecimal:. . . . . . . {0:X}\n",
        -123, -123.45f);
    Console.WriteLine(s);
 
// Format the current date in various ways.
    Console.WriteLine("Standard DateTime Format Specifiers");
    s = String.Format(
        "(d) Short date: . . . . . . . {0:d}\n" +
        "(D) Long date:. . . . . . . . {0:D}\n" +
        "(t) Short time: . . . . . . . {0:t}\n" +
        "(T) Long time:. . . . . . . . {0:T}\n" +
        "(f) Full date/short time: . . {0:f}\n" +
        "(F) Full date/long time:. . . {0:F}\n" +
        "(g) General date/short time:. {0:g}\n" +
        "(G) General date/long time: . {0:G}\n" +
        "    (default):. . . . . . . . {0} (default = 'G')\n" +
        "(M) Month:. . . . . . . . . . {0:M}\n" +
        "(R) RFC1123:. . . . . . . . . {0:R}\n" +
        "(s) Sortable: . . . . . . . . {0:s}\n" +
        "(u) Universal sortable: . . . {0:u} (invariant)\n" +
        "(U) Universal sortable: . . . {0:U}\n" +
        "(Y) Year: . . . . . . . . . . {0:Y}\n",
        thisDate);
    Console.WriteLine(s);
 
// Format a Color enumeration value in various ways.
    Console.WriteLine("Standard Enumeration Format Specifiers");
    s = String.Format(
        "(G) General:. . . . . . . . . {0:G}\n" +
        "    (default):. . . . . . . . {0} (default = 'G')\n" +
        "(F) Flags:. . . . . . . . . . {0:F} (flags or integer)\n" +
        "(D) Decimal number: . . . . . {0:D}\n" +
        "(X) Hexadecimal:. . . . . . . {0:X}\n",
        Color.Green);      
    Console.WriteLine(s);
    }
}
/*
This code example produces the following results:
 
Standard Numeric Format Specifiers
(C) Currency: . . . . . . . . ($123.00)
(D) Decimal:. . . . . . . . . -123
(E) Scientific: . . . . . . . -1.234500E+002
(F) Fixed point:. . . . . . . -123.45
(G) General:. . . . . . . . . -123
    (default):. . . . . . . . -123 (default = 'G')
(N) Number: . . . . . . . . . -123.00
(P) Percent:. . . . . . . . . -12,345.00 %
(R) Round-trip: . . . . . . . -123.45
(X) Hexadecimal:. . . . . . . FFFFFF85
 
Standard DateTime Format Specifiers
(d) Short date: . . . . . . . 6/26/2004
(D) Long date:. . . . . . . . Saturday, June 26, 2004
(t) Short time: . . . . . . . 8:11 PM
(T) Long time:. . . . . . . . 8:11:04 PM
(f) Full date/short time: . . Saturday, June 26, 2004 8:11 PM
(F) Full date/long time:. . . Saturday, June 26, 2004 8:11:04 PM
(g) General date/short time:. 6/26/2004 8:11 PM
(G) General date/long time: . 6/26/2004 8:11:04 PM
    (default):. . . . . . . . 6/26/2004 8:11:04 PM (default = 'G')
(M) Month:. . . . . . . . . . June 26
(R) RFC1123:. . . . . . . . . Sat, 26 Jun 2004 20:11:04 GMT
(s) Sortable: . . . . . . . . 2004-06-26T20:11:04
(u) Universal sortable: . . . 2004-06-26 20:11:04Z (invariant)
(U) Universal sortable: . . . Sunday, June 27, 2004 3:11:04 AM
(Y) Year: . . . . . . . . . . June, 2004
 
Standard Enumeration Format Specifiers
(G) General:. . . . . . . . . Green
    (default):. . . . . . . . Green (default = 'G')
(F) Flags:. . . . . . . . . . Green (flags or integer)
(D) Decimal number: . . . . . 3
(X) Hexadecimal:. . . . . . . 00000003
 
*/


'Programing > Etc' 카테고리의 다른 글

c# string format  (0) 2016.10.17
java heap space build halted with errors (fcsh)  (0) 2013.09.23
json 요약  (0) 2013.05.22
Posted by 패스맨

댓글을 달아 주세요

TP:78DD247B

'Programing > flash' 카테고리의 다른 글

texturepacker license post  (0) 2015.11.20
starling main frame  (0) 2015.11.20
starling moviebutton  (0) 2015.11.20
coineff  (0) 2015.11.20
baseEff  (0) 2015.11.20
objectMgr  (0) 2015.11.20
Posted by 패스맨

댓글을 달아 주세요

package
{

 import flash.display.Sprite;
 import flash.geom.Rectangle;
 import net.hires.debug.Stats;
 import starling.events.Event;
 import starling.text.TextField;
 
 
 import flash.events.Event;
 
 import screens.InGame.*;
 //import screens.Logo;
 import starling.core.Starling;
 
 import flash.display.StageAlign;
 import flash.display.StageScaleMode;
 
 import flash.desktop.NativeApplication;

 import flash.net.URLLoader;
 
 import flash.net.URLRequest;
 import flash.net.URLVariables;
 
 import flash.media.StageWebView;
 import flash.events.ErrorEvent;
 import flash.events.LocationChangeEvent;
 import flash.events.Event;
 
 /*
 CONFIG::MOBILE
 {
 import com.sticksports.nativeExtensions.SilentSwitch;
 }
 */
 
 /*
 CONFIG::ANDROID
 {
  import com.milkmangames.nativeextensions.*;
  import com.milkmangames.nativeextensions.events.GoogleGamesEvent;
  import com.milkmangames.nativeextensions.events.*;
  
  import com.milkmangames.nativeextensions.GoogleGames;
 }
 */
 
 import flash.display.StageDisplayState;
 

 //import pl.mllr.extensions.contactEditor.ContactEditor;
 import flash.geom.Point;
 import starling.utils.RectangleUtil;
 import starling.utils.ScaleMode;
 import flash.system.Capabilities;
 import Game;
 import   flash.media.AudioPlaybackMode;
 import   flash.media.SoundMixer;

 
 //[SWF(frameRate="60", width="1024", height="748", backgroundColor="0x333333")]e87474
 [SWF(frameRate="60",  width="320", height="568" ,backgroundColor="0xffffff")] //0xffffff //0x2a2a2d
 public class Main extends Sprite
 {
  
  //private var stats:Stats;
  
  //private var myStarling:Starling;
  
  //1136
  //640
  
  //320;
  // 568;
  
  private const SCREEN_WIDTH:int = 320;
  private const SCREEN_HEIGHT:int = 568;
  
  private function onResize(event:starling.events.Event, size:Point):void
  {
   RectangleUtil.fit(
    new Rectangle(0, 0, stage.stageWidth, stage.stageHeight),
    new Rectangle(0, 0, size.x, size.y),
    ScaleMode.SHOW_ALL, false,
    Starling.current.viewPort
   );
  }

  public  function Main()
  {
   //super();
  
  
   
   var isMobile:Boolean = false;
   CONFIG::MOBILE
   {
    isMobile = true;
   }
   
   
   
   if ( isMobile == false)
   {
    /*
    stats = new Stats();
    stats.y = 200;
    stats.scaleX = 1;
    stats.scaleY = 1;
    */
    //this.addChild(stats);
   }
   
   
  
  
   //stage.scaleMode = StageScaleMode.NO_SCALE;
   //stage.align = StageAlign.TOP_LEFT;
   
   /*
   CONFIG::MOBILE
   {
   SilentSwitch.apply();//진동모드 일때 무음
   }
   */
 
   var screenWidth:int = stage.fullScreenWidth;
   var screenHeight:int = stage.fullScreenHeight;
   
   Assets.fullScreenWidth = screenWidth;
   Assets.fullScreenHeight = screenHeight ;
   
   var viewport:Rectangle =  //new Rectangle( 0, 0, stage.stageWidth, stage.stageHeight);
   new Rectangle( 0, 0, screenWidth, screenHeight);
   
   //멀티터치 사용여부
   Starling.multitouchEnabled = true;
   Starling.handleLostContext = true; // deactivate on
  
   stage.quality = "high";
   
   //stage.displayState = StageDisplayState.FULL_SCREEN_INTERACTIVE;
    
   Assets.myStarling = new Starling( Game , stage, viewport);
   stage.quality = "high";
   //stage.frameRate = 60;
   
  
   
   if ( screenHeight == 1136)
    Assets.isIPHONE5 = true;
   else
   {
    Assets.isIPHONE5 = true;
    //Assets.isIPHONE5 = false;
   }
   
 
   //Assets.isIPHONE5 = true;
   
   if ( Assets.isIPHONE5 == true)
   {
    Assets.myStarling.stage.stageWidth = SCREEN_WIDTH;
    Assets.myStarling.stage.stageHeight = SCREEN_HEIGHT; 
    
   }
   else
   {
    Assets.myStarling.stage.stageWidth = SCREEN_WIDTH;
    Assets.myStarling.stage.stageHeight = SCREEN_HEIGHT;
   }
   
   Assets.stageWCenter = SCREEN_WIDTH / 2;//stage.stageWidth / 2;
   Assets.stageHCenter = SCREEN_HEIGHT / 2;// stage.stageHeight / 2;
   Assets.itemSpwaningArea =  SCREEN_WIDTH + SCREEN_WIDTH / 3;//stage.stageWidth + stage.stageWidth / 3;
   Assets.stageWidth  = SCREEN_WIDTH;//stage.stageWidth;
   Assets.stageHeight = SCREEN_HEIGHT;// stage.stageHeight;
   
   
   //Assets.flashStage = stage;

   
   Assets.myStarling.antiAliasing = 0;
   //Assets.myStarling.simulateMultitouch = true;
   Assets.myStarling.start();
   //Assets.myStarling.simulateMultitouch = true;
   
   SoundMixer.audioPlaybackMode  =  AudioPlaybackMode.AMBIENT;
 
   stage.quality = "high";

  } 

 }
}

 

 

'Programing > flash' 카테고리의 다른 글

texturepacker license post  (0) 2015.11.20
starling main frame  (0) 2015.11.20
starling moviebutton  (0) 2015.11.20
coineff  (0) 2015.11.20
baseEff  (0) 2015.11.20
objectMgr  (0) 2015.11.20
Posted by 패스맨

댓글을 달아 주세요

// =================================================================================================
//
// Starling Framework
// Copyright 2011 Gamua OG. 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.display
{
    import flash.geom.Rectangle;
    import flash.ui.Mouse;
    import flash.ui.MouseCursor;
 import starling.core.Starling;
   
    import starling.events.Event;
    import starling.events.Touch;
    import starling.events.TouchEvent;
    import starling.events.TouchPhase;
    import starling.text.TextField;
    import starling.textures.Texture;
    import starling.utils.HAlign;
    import starling.utils.VAlign;
 

    /** Dispatched when the user triggers the button. Bubbles. */
    [Event(name="triggered", type="starling.events.Event")]
   
    /** A simple button composed of an image and, optionally, text.
     * 
     *  <p>You can pass a texture for up- and downstate of the button. If you do not provide a down
     *  state, the button is simply scaled a little when it is touched.
     *  In addition, you can overlay a text on the button. To customize the text, almost the
     *  same options as those of text fields are provided. In addition, you can move the text to a
     *  certain position with the help of the <code>textBounds</code> property.</p>
     * 
     *  <p>To react on touches on a button, there is special <code>triggered</code>-event type. Use
     *  this event instead of normal touch events - that way, users can cancel button activation
     *  by moving the mouse/finger away from the button before releasing.</p>
     */
    public class MovieButton extends DisplayObjectContainer
    {
        private static const MAX_DRAG_DIST:Number = 50;
       
        private var mUpState:Vector.<Texture>;
        private var mDownState:Vector.<Texture>;
       
        private var mContents:Sprite;
        private var mBackground:MovieClip;
  
        private var mTextField:TextField;
        private var mTextBounds:Rectangle;
       
        private var mScaleWhenDown:Number;
        private var mAlphaWhenDisabled:Number;
        private var mEnabled:Boolean;
        private var mIsDown:Boolean;
        private var mUseHandCursor:Boolean;
       
        /** Creates a button with textures for up- and down-state or text. */
        public function MovieButton(upState:Vector.<Texture>, text:String="", downState:Vector.<Texture>=null)
        {
            if (upState == null) throw new ArgumentError("Texture cannot be null");
           
            mUpState = upState;
            mDownState = downState ? downState : upState;
            mBackground = new MovieClip(upState, 3);
   //Assets.setCenterMC(mBackground);
   Starling.juggler.add( mBackground);
            mScaleWhenDown = downState ? 1.0 : 0.9;
            mAlphaWhenDisabled = 0.5;
            mEnabled = true;
            mIsDown = false;
            mUseHandCursor = true;
            mTextBounds = new Rectangle(0, 0, upState[0].width, upState[0].height);           
           
            mContents = new Sprite();
            mContents.addChild(mBackground);
            addChild(mContents);
            addEventListener(TouchEvent.TOUCH, onTouch);
           
            this.text = text;
        }
  
  public function stopAnim():void
  {
   mBackground.stop();
  }
  
  public function playAnim():void
  {
   mBackground.play();
  }
  
  public function setFrame( f:int ):void
  {
   mBackground.currentFrame = f;
  }
  
  public function getCurFrame():int
  {
   return mBackground.currentFrame;
  }
       
        private function resetContents():void
        {
            mIsDown = false;
           // mBackground.texture = mUpState[0];
            mContents.x = mContents.y = 0;
            mContents.scaleX = mContents.scaleY = 1.0;
        }
       
        private function createTextField():void
        {
            if (mTextField == null)
            {
                mTextField = new TextField(mTextBounds.width, mTextBounds.height, "");
                mTextField.vAlign = VAlign.CENTER;
                mTextField.hAlign = HAlign.CENTER;
                mTextField.touchable = false;
                mTextField.autoScale = true;
                mTextField.batchable = true;
            }
           
            mTextField.width  = mTextBounds.width;
            mTextField.height = mTextBounds.height;
            mTextField.x = mTextBounds.x;
            mTextField.y = mTextBounds.y;
        }
       
        private function onTouch(event:TouchEvent):void
        {
            Mouse.cursor = (mUseHandCursor && mEnabled && event.interactsWith(this)) ?
                MouseCursor.BUTTON : MouseCursor.AUTO;
           
            var touch:Touch = event.getTouch(this);
            if (!mEnabled || touch == null) return;
           
            if (touch.phase == TouchPhase.BEGAN && !mIsDown)
            {
                mBackground.texture = mDownState[0];
                mContents.scaleX = mContents.scaleY = mScaleWhenDown;
                mContents.x = (1.0 - mScaleWhenDown) / 2.0 * mBackground.width;
                mContents.y = (1.0 - mScaleWhenDown) / 2.0 * mBackground.height;
                mIsDown = true;
            }
            else if (touch.phase == TouchPhase.MOVED && mIsDown)
            {
                // reset button when user dragged too far away after pushing
                var buttonRect:Rectangle = getBounds(stage);
                if (touch.globalX < buttonRect.x - MAX_DRAG_DIST ||
                    touch.globalY < buttonRect.y - MAX_DRAG_DIST ||
                    touch.globalX > buttonRect.x + buttonRect.width + MAX_DRAG_DIST ||
                    touch.globalY > buttonRect.y + buttonRect.height + MAX_DRAG_DIST)
                {
                    resetContents();
                }
            }
            else if (touch.phase == TouchPhase.ENDED && mIsDown)
            {
                resetContents();
                dispatchEventWith(Event.TRIGGERED, true);
            }
        }
       
        /** The scale factor of the button on touch. Per default, a button with a down state
          * texture won't scale. */
        public function get scaleWhenDown():Number { return mScaleWhenDown; }
        public function set scaleWhenDown(value:Number):void { mScaleWhenDown = value; }
       
        /** The alpha value of the button when it is disabled. @default 0.5 */
        public function get alphaWhenDisabled():Number { return mAlphaWhenDisabled; }
        public function set alphaWhenDisabled(value:Number):void { mAlphaWhenDisabled = value; }
       
        /** Indicates if the button can be triggered. */
        public function get enabled():Boolean { return mEnabled; }
        public function set enabled(value:Boolean):void
        {
            if (mEnabled != value)
            {
                mEnabled = value;
                mContents.alpha = value ? 1.0 : mAlphaWhenDisabled;
                resetContents();
            }
        }
       
        /** The text that is displayed on the button. */
        public function get text():String { return mTextField ? mTextField.text : ""; }
        public function set text(value:String):void
        {
            if (value.length == 0)
            {
                if (mTextField)
                {
                    mTextField.text = value;
                    mTextField.removeFromParent();
                }
            }
            else
            {
                createTextField();
                mTextField.text = value;
               
                if (mTextField.parent == null)
                    mContents.addChild(mTextField);
            }
        }
       
        /** The name of the font displayed on the button. May be a system font or a registered
          * bitmap font. */
        public function get fontName():String { return mTextField ? mTextField.fontName : "Verdana"; }
        public function set fontName(value:String):void
        {
            createTextField();
            mTextField.fontName = value;
        }
       
        /** The size of the font. */
        public function get fontSize():Number { return mTextField ? mTextField.fontSize : 12; }
        public function set fontSize(value:Number):void
        {
            createTextField();
            mTextField.fontSize = value;
        }
       
        /** The color of the font. */
        public function get fontColor():uint { return mTextField ? mTextField.color : 0x0; }
        public function set fontColor(value:uint):void
        {
            createTextField();
            mTextField.color = value;
        }
       
        /** Indicates if the font should be bold. */
        public function get fontBold():Boolean { return mTextField ? mTextField.bold : false; }
        public function set fontBold(value:Boolean):void
        {
            createTextField();
            mTextField.bold = value;
        }
       
        /** The texture that is displayed when the button is not being touched. */
        public function get upState():Texture { return mUpState[0]; }
        public function set upState(value:Texture):void
        {
            if (mUpState[0] != value)
            {
                mUpState[0] = value;
                if (!mIsDown) mBackground.texture = value;
            }
        }
       
        /** The texture that is displayed while the button is touched. */
        public function get downState():Texture { return mDownState[0]; }
        public function set downState(value:Texture):void
        {
            if (mDownState[0] != value)
            {
                mDownState[0] = value;
                if (mIsDown) mBackground.texture = value;
            }
        }
       
        /** The vertical alignment of the text on the button. */
        public function get textVAlign():String { return mTextField.vAlign; }
        public function set textVAlign(value:String):void
        {
            createTextField();
            mTextField.vAlign = value;
        }
       
        /** The horizontal alignment of the text on the button. */
        public function get textHAlign():String { return mTextField.hAlign; }
        public function set textHAlign(value:String):void
        {
            createTextField();
            mTextField.hAlign = value;
        }
       
        /** The bounds of the textfield on the button. Allows moving the text to a custom position. */
        public function get textBounds():Rectangle { return mTextBounds.clone(); }
        public function set textBounds(value:Rectangle):void
        {
            mTextBounds = value.clone();
            createTextField();
        }
       
        /** Indicates if the mouse cursor should transform into a hand while it's over the button.
         *  @default true */
        public override function get useHandCursor():Boolean { return mUseHandCursor; }
        public override function set useHandCursor(value:Boolean):void { mUseHandCursor = value; }
    }
}

'Programing > flash' 카테고리의 다른 글

texturepacker license post  (0) 2015.11.20
starling main frame  (0) 2015.11.20
starling moviebutton  (0) 2015.11.20
coineff  (0) 2015.11.20
baseEff  (0) 2015.11.20
objectMgr  (0) 2015.11.20
Posted by 패스맨

댓글을 달아 주세요

coineff

Programing/flash 2015.11.20 15:47 |

package objects.ObjectMgr
{
 import starling.animation.Juggler;
 import starling.core.Starling;
 import starling.display.MovieClip;
 import starling.display.Sprite;
 import starling.events.EnterFrameEvent;
 import starling.events.Event;
 
 import starling.animation.Juggler;
 import starling.utils.deg2rad;
 import com.greensock.TweenLite;
 import flash.system.System;
 /**
  * ...
  * @author searoopy
  */
 public class CoinEff extends BaseEff
 {
  
  static public var g_CoinEff:CoinEff = null;
  
  
  public function CoinEff(imageName:String)
  {
   
   g_CoinEff = this;
   
   super(imageName , 1 );
   
  }
  
 }

}

'Programing > flash' 카테고리의 다른 글

starling main frame  (0) 2015.11.20
starling moviebutton  (0) 2015.11.20
coineff  (0) 2015.11.20
baseEff  (0) 2015.11.20
objectMgr  (0) 2015.11.20
flash 용 app 인증 파일 만들기  (0) 2012.12.11
Posted by 패스맨

댓글을 달아 주세요

baseEff

Programing/flash 2015.11.20 15:44 |

package objects.ObjectMgr
{
 import com.distriqt.extension.notifications.events.GenericEvent;
 import flash.geom.Point;
 import starling.animation.Juggler;
 import starling.core.Starling;
 import starling.display.MovieClip;
 import starling.display.Sprite;
 import starling.events.EnterFrameEvent;
 import starling.events.Event;
 import UI.BigInt;
 
 import starling.animation.Juggler;
 import starling.utils.deg2rad;

 import com.greensock.TweenLite;
 import flash.system.System;
 import starling.utils.getTimer;
 
 import starling.text.TextField;
 
 import starling.utils.HAlign;
 import starling.utils.VAlign;
 import flash.geom.Rectangle;
 
 /**
  * ...
  * @author searoopy
  */
 public class BaseEff extends Sprite
 {
  //static public var g_DamageEff:DamageEff = null;
  
  public var m_mvEff:Vector.<MovieClip>;// = new vec;
  
  public var m_textEff:Vector.<TextField>;
  
  public const MAX_EFF_CNT:int = 16;
  
  protected var m_imageName:String ;
  
  public var m_Dir:Vector.<int>;
  
  private var m_type:int = 0;
  
  
  private var m_val:BigInt = new BigInt( 50);
  
  
  public function BaseEff( imageName:String , type:int = 0 )
  {
   super();

   this.addEventListener(starling.events.Event.ADDED_TO_STAGE, onAddedStage);
   this.addEventListener(starling.events.Event.REMOVED_FROM_STAGE, onRemoveStage);

   
   m_imageName = imageName;
   
   m_type = type;
  }
  
  private function onAddedStage():void
  {
   this.removeEventListener(starling.events.Event.ADDED_TO_STAGE, onAddedStage);
   
   init();

  }
  
   
  private function onRemoveStage():void
  {
   this.removeEventListener(starling.events.Event.REMOVED_FROM_STAGE, onRemoveStage);
   
   destroy();

  }
  
  public function init():void
  {
   m_mvEff = new Vector.<MovieClip>;
   m_Dir = new Vector.<int>;
   m_textEff = new Vector.<TextField>;

   var _tmv:MovieClip = null;
   var _text:TextField = null;
   for ( var i:int = 0; i < MAX_EFF_CNT; i++)
   {
    _tmv = new MovieClip( Assets.getAtlasTest().getTextures( m_imageName ), 15 );
    Assets.setCenterMC(_tmv);
    Starling.juggler.add(_tmv);
    _tmv.stop();
    _tmv.visible = false;
    addChild(_tmv);
    m_mvEff.push( _tmv ) ;
    
    m_Dir.push(0);
    
    
    _text = new TextField( 100, 70, "0", "Ubuntu", 30, 0xffffff );
    _text.pivotX = _text.width / 2;
    _text.pivotY = _text.height / 2;
    _text.x = 0; //130
    _text.y = 10;
    _text.hAlign = HAlign.CENTER;
    _text.vAlign = VAlign.CENTER;
    //_text.touchable = false;
    //m_textMoney.text = m_curStage.toString() +  " / " + m_maxStage.toString();// .1288';
    _text.visible = false;
    addChild(_text);
    
    m_textEff.push( _text);
   }
   
   this.addEventListener(EnterFrameEvent.ENTER_FRAME, onUpdate);

  }
  
  private function onUpdate():void
  {
   for ( var i:int = 0; i < MAX_EFF_CNT; i++)
   {
    if ( m_mvEff[i].visible == true)
    {
     //m_mvEff[i].x += m_Dir[i];
    }
    
   }

  }
  
  public function showEff( _x:int, _y:int , moveRan:Boolean = false ):void
  {
   for ( var i:int = 0; i < MAX_EFF_CNT; i++)
   {
    if ( m_mvEff[i].visible == false)
    {
     
     if ( moveRan == true)
     {
      var ran:Number = Math.random() ;
      if ( ran > 0.7)
      {
       m_Dir[i] = 1 + Math.random()*2;
      }
      else if (  ran > 0.3)
      {
       m_Dir[i] = -1 - Math.random()*2;
      }
      else
      {
       m_Dir[i] = Math.random()*2;
      }
     }
     
     
     //var text:TextField = m_textEff[i];
     //text.visible = true;
     //text.x = _x;
     //text.y = _y;
     
     /*
     if ( CoinTextEff.g_coinTextEff != null)
     {
      if( BigInt.compare(  LevelMgr.g_nBonusShowCoin , 0 ) > 0 )
       CoinTextEff.g_coinTextEff.showEff(  _x - 50, _y , LevelMgr.g_nBonusShowCoin.toString() );
     }
     */
     
     var tmv:MovieClip = m_mvEff[i];
     tmv.visible = true;
     //m_mvEff[i].x = 0;
     m_mvEff[i].x = _x;
     m_mvEff[i].y = _y ;
     //this.x = x;
     //this.y = y;
     tmv.stop();
     if ( m_type == 1 )
      tmv.currentFrame = Math.random() * 3;
     tmv.play();
     //tmv.addEventListener(Event.COMPLETE, onComplete);
     tmv.addEventListener(EnterFrameEvent.ENTER_FRAME, Delegate.sendParameters( onFrame ,  i , getTimer()  ) );
     break;
    }
   }
   
  }
  
  private function onFrame( idx:int , time:int ):void
  {
   if ( getTimer() - time > 300)
   {
    var mv:MovieClip = m_mvEff[idx ] as MovieClip;
    mv.removeEventListeners();
    mv.visible = false;
    
    //m_textEff[idx].visible = false;
    
    
   }
 
   
  }
  
  private function onComplete( event:Event ):void
  {
   //event.currentTarget.removeEventListeners();
   var mv:MovieClip = event.currentTarget as MovieClip;
   mv.removeEventListeners();
   mv.visible = false;
   
   
   if ( m_type == 1) // 코인일경우
   {
    if ( CoinTextEff.g_coinTextEff != null)
    {
     
     LevelMgr.addGameCoin( m_val );
     
     
     
     CoinTextEff.g_coinTextEff.showEff( this.x + mv.x , this.y + 20 , m_val.toString() );
    }
   }
  }
  
  
  public function destroy():void
  {
   if ( m_mvEff != null)
   {
    for ( var i:int = 0; i < MAX_EFF_CNT; i++)
    {
     Starling.juggler.remove(m_mvEff[i]);
     m_mvEff[i].removeFromParent(true);
     m_mvEff[i] = null;
    }
   }
   
   m_Dir = null;
   
   this.removeEventListeners();
   
   System.gc();
  }
  
  
 }

}

'Programing > flash' 카테고리의 다른 글

starling main frame  (0) 2015.11.20
starling moviebutton  (0) 2015.11.20
coineff  (0) 2015.11.20
baseEff  (0) 2015.11.20
objectMgr  (0) 2015.11.20
flash 용 app 인증 파일 만들기  (0) 2012.12.11
Posted by 패스맨

댓글을 달아 주세요

objectMgr

Programing/flash 2015.11.20 15:37 |

package objects.ObjectMgr
{
 
 import flash.geom.Point;
 import starling.display.Sprite;
 import starling.display.MovieClip;
 import starling.events.EnterFrameEvent;
 import starling.events.Event;
 import objects.*;

 import starling.display.Button;
 import starling.utils.HAlign;
 import starling.utils.VAlign;
 import starling.text.TextField;
 import com.greensock.TweenLite;
 import UI.BigInt;
 import starling.display.Image;
 import starling.utils.deg2rad;
 import starling.core.Starling;

 import screens.InGame.InGame;
 
 import flash.utils.getDefinitionByName;
 

 
 /**
  * ...
  * @author dfsdf
  */
 public class ObjectMgr  extends Sprite
 {
  private var m_type:int = 0;
  private var m_layerSprite:Sprite;
  private var m_frontlayerSprite:Sprite;
  private var m_layerIdx:int = 0;
  
  
  public var MAX_MON_CNT:int = 0;
  private var m_vecMon:Vector.<*> = new Vector.<*>;
  
  
  private var m_objectType:String;
  private var m_passedTime:Number = 0;
  
  
  public var m_updateState:Boolean = false;
  
  dropStar, stopStar;
  
  public function ObjectMgr(  layer:Sprite ,frontLayer:Sprite, layerIdx:int ,  typeName:String ,cnt:int  )
  {
   super();
   //m_type = type;
   m_layerSprite = layer;
   m_frontlayerSprite = frontLayer;
   m_layerIdx = layerIdx;
   
   m_objectType  = typeName;
   
   MAX_MON_CNT = cnt;
   
   this.addEventListener(starling.events.Event.ADDED_TO_STAGE, onAddedStage);
   this.addEventListener(starling.events.Event.REMOVED_FROM_STAGE, onRemoveStage);

   this.addEventListener(EnterFrameEvent.ENTER_FRAME, update);
  
  }
  
  private function onAddedStage():void
  {
   this.removeEventListener(starling.events.Event.ADDED_TO_STAGE, onAddedStage);
   
   init();

  }
  
   
  private function onRemoveStage():void
  {
   this.removeEventListener(starling.events.Event.REMOVED_FROM_STAGE, onRemoveStage);

  }
  
  public function init ():void
  {
   var tempMon:Sprite;
   for ( var i:int = 0;  i < MAX_MON_CNT ; i++)
   {
    var classRef:Class = getDefinitionByName("objects."+m_objectType) as Class;
    tempMon = new classRef( m_layerSprite );
    tempMon.x = 0 + i* 40;
    
    tempMon.visible = false;//false;
    //if ( i%2 == 0)
    //{
    
    if ( m_layerIdx == 0)
    {
     //tempMon.y = 150;
     m_layerSprite.addChild( tempMon );
    }
    else if ( m_layerIdx == 1)
    {
     //tempMon.y = 180;
     m_frontlayerSprite.addChild( tempMon );
    }
     
    //}
    //else
    //{
    // tempMon.y = 180;
    // addChild( tempMon );
    // 
    //}
    m_vecMon.push( tempMon );

   }

  }
  
  private function update( e:EnterFrameEvent):void
  {
   if ( m_updateState == false)
    return ;
   
   m_passedTime += e.passedTime;
   
   if ( m_passedTime > 0.2 )
   {
    m_passedTime = 0;
    
    
    createMon( 1 );
   }
   
   for ( var i:int = 0;  i < MAX_MON_CNT ; i++)
   {
    if( m_vecMon[i].visible == true)
     m_vecMon[i].update();
   }
  }
  
  
  public function createMon( createCnt:int  = 1 ):void
  {
   var curCnt:int = 0;
   for ( var i:int = 0;  i < MAX_MON_CNT ; i++)
   {
    if ( m_vecMon[i].visible == false)
    {
     if ( createCnt >= curCnt )
     {
      if ( m_vecMon[i].create() == true)
      {
      
       curCnt += 1;
      }
      
     }
     else
     {
      break;
     }
    }
   }
  }
  
  public function initCreate( createCnt :int = 6 ):void
  {
   var curCnt:int = 0;
   
   
   for ( var i:int = 0;  i < MAX_MON_CNT ; i++)
   {
    if ( m_vecMon[i].visible == false)
    {
     if ( createCnt >= curCnt )
     {
      m_vecMon[i].initCreate();
      
      curCnt += 1;
      
     }
     else
     {
      break;
     }
    }
   }
  }//end func.
  
  
  public function allOffVisible( val:Boolean = false ):void
  {
   for ( var i:int = 0;  i < MAX_MON_CNT ; i++)
   {
    m_vecMon[i].visible = val;

   }
  }
  
  
 }

}

'Programing > flash' 카테고리의 다른 글

starling main frame  (0) 2015.11.20
starling moviebutton  (0) 2015.11.20
coineff  (0) 2015.11.20
baseEff  (0) 2015.11.20
objectMgr  (0) 2015.11.20
flash 용 app 인증 파일 만들기  (0) 2012.12.11
Posted by 패스맨

댓글을 달아 주세요

 

 

http://www.flashdevelop.org/community/viewtopic.php?p=30283

 

C:\Program Files (x86)\FlashDevelop\Tools\flexsdk\bin\jvm

수정
# Arguments to VM

java.args=-Xmx1024m -Dsun.io.useCanonCaches=false

'Programing > Etc' 카테고리의 다른 글

c# string format  (0) 2016.10.17
java heap space build halted with errors (fcsh)  (0) 2013.09.23
json 요약  (0) 2013.05.22
Posted by 패스맨

댓글을 달아 주세요

json 요약

Programing/Etc 2013.05.22 12:00 |

JSON이란 무엇이고 어떻게 쓰이는지 알아보도록 하겠습니다.


1. JSON이란

JSON : JavaScript Object Notation


영어 그대로 해석하자면 자바스트립트를 객체형식으로 표현하는 것입니다.


JSON은 XML보다 빠르고 변환하기도 쉬워 많이 대체해서 쓰고 있습니다. 그리고  적은양의 데이터가 송수신 되므로 모바일쪽에서 쓰기에도 부담이 적습니다.


2. JSON 표기법


JSON의 표기법은 다음과 같습니다.


JSON 데이터는 key/value형식으로 구성되어 있습니다.

"firstName" : "김"


알아보기 쉽게 자바스크립트 문장으로 바꾸면 다음과 같습니다.

firstName = "김"


이중에서 value에는 다음과 같은 형식을 넣을 수 있습니다.

  •  a number(integer or float)
  •  a string(큰 따옴표 포함)
  •  a boolean(true or false)
  •  an object(중괄호 포함)
  •  an array(대괄호 포함)
  •  null


[a number]

integer형이나 float형을 넣을 수 있습니다.  

"clickNumber" : 1



[a string]

string형을 표현하고 싶을 때는 큰 따옴표로 묶어줍니다.

"name" : "홍길동"



[a boolean]

true 나 false를 넣을 수 있습니다.

"bResult" : true



[an object]

여러개의 key/value를 입력하여 중괄호로 둘러싸여집니다.

{"firstName" : "길동", "lastName" : "홍"}



[an array]

  여러개의 object를 대괄호를 통해 둘러싸여집니다.

{

  "employees" : [

    {"firstName" : "길동", "lastName" : "홍"},

    {"firstName" : "철수", "lastName" : "김"},

    {"firstName" : "영순", "lastName" : "박"}

  ]

}


JSON은 자바스크립트 문법을 사용하기 때문에, JSON으로 작업할 때 별도의 소프트웨어가 필요없습니다.

자바스크립트를 사용해서 다음과 같이 생성할 수 있습니다.


var employees = [

   {"firstName" : "길동", "lastName" : "홍"},

   {"firstName" : "철수", "lastName" : "김"},

   {"firstName" : "영순", "lastName" : "박"}

];



3. JSON 예제


<html>

  <header></header>

  <body>

Name: <span id="jname"></span><br /> 

Age: <span id="jage"></span><br /> 

Address: <span id="jstreet"></span><br /> 

Phone: <span id="jphone"></span><br /> 

  </body>


  <script type="text/javascript">

    var employees = {

"name":"홍길동",

"street":"서울시 서초구 서초동", 

"age":33,

"phone":"010-1234-5678"};


document.getElementById("jname").innerHTML=employees.name 

document.getElementById("jage").innerHTML=employees.age 

document.getElementById("jstreet").innerHTML=employees.street 

document.getElementById("jphone").innerHTML=employees.phone 

  </script>

</html>


결과





간단하게 JSON 문법에 대해 알아봤습니다.



출처

  http://www.w3schools.com/json/default.asp

http://magicmon.tistory.com/90

'Programing > Etc' 카테고리의 다른 글

c# string format  (0) 2016.10.17
java heap space build halted with errors (fcsh)  (0) 2013.09.23
json 요약  (0) 2013.05.22
Posted by 패스맨

댓글을 달아 주세요