예제 #1
0
파일: PJson.cs 프로젝트: nryota/uProcessing
 public void load(PGraphics graphics, string path, Action <JSONObject> onComplete = null)
 {
     graphics.loadStringText(path, strings =>
     {
         onLoadComplete(strings);
         onComplete(this);
     });
 }
예제 #2
0
 public void init(PGraphics graphics)
 {
     normal.set(Color.white, Color.black, Color.white, 2);
     active.set(Color.black, Color.white, Color.white, 4);
     textAlignX = CENTER;
     textAlignY = CENTER;
     textX      = textY = 0.0f;
     groupName  = "none";
 }
예제 #3
0
파일: PJson.cs 프로젝트: nryota/uProcessing
 public void load(PGraphics graphics, string path, Action <JSONArray> onComplete = null)
 {
     graphics.loadStringText(path, strings =>
     {
         onLoadComplete(strings);
         if (onComplete != null)
         {
             onComplete(this);
         }
     });
 }
예제 #4
0
 public void create(int width, int height, TextureFormat texFormat = TextureFormat.ARGB32)
 {
     this.width  = width;
     this.height = height;
     texture     = new Texture2D(width, height, texFormat, false);
     if (texture == null)
     {
         PGraphics.debuglogWaring("create: new Texture2D <failed>");
         return;
     }
     clear(new Color(0, 0, 0, 0));
 }
예제 #5
0
    public void init(PGraphics graphics)
    {
        g = graphics;
        g.beginKeep();
        obj = g.prefab("unitychanP5");
        //obj = g.box (1);
        //obj.addRigid();

        obj.transform.Rotate(0, 90, 0);
        obj.rigidBody.constraints |= RigidbodyConstraints.FreezePositionZ;
        g.endKeep();
    }
예제 #6
0
파일: PJson.cs 프로젝트: nryota/uProcessing
        public bool save(PGraphics graphics, string path)
        {
            if (data == null)
            {
                return(false);
            }
            string text = PMiniJSON.Json.Serialize(data);

            if (text == null)
            {
                return(false);
            }
            graphics.saveStringText(path, text);
            return(true);
        }
예제 #7
0
 public void load(PGraphics g, string path)
 {
     this.path = path;
     if (path.StartsWith("http://") || path.StartsWith("file://"))
     {
         StartCoroutine("loadFromURL", path);
         PGraphics.debuglog("loadImage:loadFromURL " + path);
     }
     else
     {
         if (!loadFromResources(g, path))
         {
             loadFromLocalFile(path);
         }
     }
 }
예제 #8
0
 public void load(PGraphics g, string path)
 {
     this.path = path;
     if (path.StartsWith("http://") || path.StartsWith("file://"))
     {
         StartCoroutine("loadFromURL", path);
         PGraphics.debuglog("loadImage:loadFromURL " + path);
     }
     else
     {
         if (!loadFromResources(g, path))
         {
             loadFromLocalFile(path);
         }
     }
 }
예제 #9
0
 public bool loadPixels()
 {
     if (!texture)
     {
         return(false);
     }
     pixels = texture.GetPixels32();
     if (pixels == null)
     {
         PGraphics.debuglogWaring("loadPixels:GetPixels32 <failed>");
         return(false);
     }
     else
     {
         return(true);
     }
 }
예제 #10
0
        bool loadFromLocalFile(string path)
        {
            if (!File.Exists(path))
            {
                PGraphics.debuglogWaring("loadImage:loadFromLocalFile <NotFound> " + path);;
                return(false);
            }
            byte[] bytes = null;

            FileStream fs = new FileStream(path, FileMode.Open);

            using (BinaryReader bin = new BinaryReader(fs))
            {
                bytes = bin.ReadBytes((int)bin.BaseStream.Length);
            }

            Texture2D tex = new Texture2D(0, 0);

            tex.LoadImage(bytes);
            set(tex);

            if (tex != null)
            {
                PGraphics.debuglog("loadImage:loadFromLocalFile " + path);
                if (width == 0)
                {
                    width = texWidth;
                }
                if (height == 0)
                {
                    height = texHeight;
                }
            }
            else
            {
                PGraphics.debuglogWaring("loadImage:loadFromLocalFile <Failed> " + path);
            }
            return(tex != null);
        }
예제 #11
0
        bool loadFromResources(PGraphics g, string path)
        {
            string    resPath = g.getResourceName(path);
            Texture2D tex     = Resources.Load(resPath) as Texture2D;

            set(tex);
            if (tex != null)
            {
                PGraphics.debuglog("loadImage:loadFromResources " + resPath);
                if (width == 0)
                {
                    width = texWidth;
                }
                if (height == 0)
                {
                    height = texHeight;
                }
            }
            else
            {
                PGraphics.debuglogWaring("loadImage:loadFromResources <Failed> " + resPath);
            }
            return(tex != null);
        }
예제 #12
0
    public void init(PGraphics graphics)
    {
        g = graphics;
        g.beginKeep();
        obj = g.prefab("unitychanP5");
        //obj = g.box (1);
        //obj.addRigid();

        obj.transform.Rotate(0, 90, 0);
        obj.rigidBody.constraints |= RigidbodyConstraints.FreezePositionZ;
        g.endKeep();
    }
예제 #13
0
 public void stroke(int r, int g, int b, int a = 255)
 {
     stroke(PGraphics.color(r, g, b, a));
 }
예제 #14
0
 public void stroke(int gray, int alpha = 255)
 {
     stroke(PGraphics.color(gray, alpha));
 }
예제 #15
0
 public void fill(int r, int g, int b, int a = 255)
 {
     fill(PGraphics.color(r, g, b, a));
 }
예제 #16
0
 public void fill(int gray, int alpha = 255)
 {
     fill(PGraphics.color(gray, alpha));
 }
예제 #17
0
 public void tint(int r, int g, int b, int a = 255)
 {
     tint(PGraphics.color(r, g, b, a));
 }
예제 #18
0
 public void tint(int gray, int alpha = 255)
 {
     tint(PGraphics.color(gray, alpha));
 }
예제 #19
0
 bool loadFromResources(PGraphics g, string path)
 {
     string resPath = g.getResourceName(path);
     Texture2D tex = Resources.Load(resPath) as Texture2D;
     set(tex);
     if (tex != null)
     {
         PGraphics.debuglog("loadImage:loadFromResources " + resPath);
         if (width == 0) width = texWidth;
         if (height == 0) height = texHeight;
     }
     else { PGraphics.debuglogWaring("loadImage:loadFromResources <Failed> " + resPath); }
     return tex != null;
 }