Ejemplo n.º 1
0
        public override void Initial(ModelElement mod)
        {
            palette               = new Palette();
            callBackR             = EventCallBack.RegEvent <EventCallBack>(mod);
            callBackR.IsCircular  = true;
            callBackR.Drag        = callBackR.DragEnd = DragingR;
            callBackR.PointerDown = PointDownR;
            NobA                  = mod.Find("NobA");
            NobB                  = mod.Find("NobB");
            hc                    = mod.Find("HTemplate");
            template              = hc.GetComponent <RawImageElement>();
            callBackC             = EventCallBack.RegEvent <EventCallBack>(hc);
            callBackC.Drag        = callBackC.DragEnd = DragingC;
            callBackC.PointerDown = PointDownC;
            htemp                 = mod.GetComponent <RawImageElement>();
            ThreadMission.InvokeToMain((o) => {
                htemp.Context.texture    = Palette.LoadCTemplateAsync();
                template.Context.texture = palette.texture;
                slider.Context.texture   = Palette.AlphaTemplate();
            }, null);
            palette.LoadHSVTAsync(1);
            SelectColor.a = 1;
            var son = mod.Find("Slider");

            slider   = son.GetComponent <RawImageElement>();
            uISlider = new UISlider();
            uISlider.Initial(son);
            uISlider.OnValueChanged = AlphaChanged;
            uISlider.Percentage     = 1;
        }
Ejemplo n.º 2
0
        public static void Play(this RawImageElement raw, List <Texture2D> t2ds, bool loop = true, int count = 0, int inter = 66, Action <GifAnimat> over = null, bool hide = true, bool cover = true)
        {
            if (raw == null)
            {
                return;
            }
            raw.model.activeSelf = true;
            var ani = AnimationManage.Manage.FindAni <GifAnimat>((o) => { return(o.image == raw ? true : false); });

            if (ani == null)
            {
                ani = new GifAnimat(raw);
                if (over == null)
                {
                    ani.PlayOver = (o) => { o.Dispose(); }
                }
                ;
                else
                {
                    ani.PlayOver = over;
                }
            }
            else if (!cover)
            {
                return;
            }
            ani.Play(t2ds);
            ani.Loop     = loop;
            ani.Interval = inter;
            if (count > 0)
            {
                ani.gifCount = count;
            }
        }
Ejemplo n.º 3
0
 public static GifAnimat Findt2dsAni(this RawImageElement raw)
 {
     if (raw == null)
     {
         return(null);
     }
     raw.model.activeSelf = true;
     return(AnimationManage.Manage.FindAni <GifAnimat>((o) => { return o.image == raw ? true : false; }));
 }
Ejemplo n.º 4
0
        public override void Initial(ModelElement mod)
        {
            base.Initial(mod);
            model = mod;
            raw   = model.GetComponent <RawImageElement>();
            var size = model.data.sizeDelta;

            Width                 = (int)size.x;
            Height                = (int)size.y;
            HalfW                 = Width / 2;
            HalfH                 = Height / 2;
            buffer                = new Color[Width * Height];
            gesture               = EventCallBack.RegEvent <GestureEvent>(model);
            gesture.PointerDown   = PointDown;
            gesture.Drag          = Drag;
            gesture.DragEnd       = DragEnd;
            gesture.AutoColor     = false;
            gesture.TowFingerMove = TowFingerMove;
            ThreadMission.InvokeToMain(Apply, null);
        }
Ejemplo n.º 5
0
    public static GameObject LoadToGame(ModelElement mod, object o, Transform parent, string filter = "mod")
    {
        if (mod == null)
        {
            Debug.Log("Mod is null");
            return(null);
        }
        if (mod.tag == filter)
        {
            return(null);
        }
        var g = ModelManagerUI.CreateNew(mod.data.type);

        if (g == null)
        {
            Debug.Log("Name:" + mod.name + " is null");
            return(null);
        }
        var t = g.transform;

        if (parent != null)
        {
            t.SetParent(parent);
        }
        mod.LoadToObject(t);
        var typ = mod.data.type;

        if ((typ & 0x2) > 0)
        {
            var child = mod.components;
            for (int j = 0; j < child.Count; j++)
            {
                ImageElement e = child[j] as ImageElement;
                if (e != null)
                {
                    mod.Context.GetComponent <Image>().sprite = FindSprite(e.textureName, e.spriteName);
                    break;
                }
            }
        }
        else if ((typ & 0x20) > 0)
        {
            var child = mod.components;
            for (int j = 0; j < child.Count; j++)
            {
                RawImageElement e = child[j] as RawImageElement;
                if (e != null)
                {
                    mod.Context.GetComponent <RawImage>().texture = FindTexture(e.textureName);
                    break;
                }
            }
        }
        mod.Main = g;
        mod.AddSizeScale();
        var c = mod.child;

        for (int i = 0; i < c.Count; i++)
        {
            LoadToGame(c[i], o, t, filter);
        }
        //if (o != null)
        //    GetObject(mod, o, mod);
        return(g);
    }
Ejemplo n.º 6
0
 public GifAnimat(RawImageElement img)
 {
     image = img;
     AnimationManage.Manage.AddAnimat(this);
 }