Esempio n. 1
0
 //不在运行中时,Handle的类型或者m_go改变的时候会刷新值
 public override void OnReset(Handle h, bool resetBegin = true, bool resetEnd = false)
 {
     if (h.m_go)
     {
         ImageEx s = h.m_go.GetComponent <ImageEx>();
         if (s)
         {
             h.m_b1 = s.m_grey;
         }
     }
 }
Esempio n. 2
0
 static int SetAllDirty(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         UI.ImageEx obj = (UI.ImageEx)ToLua.CheckObject(L, 1, typeof(UI.ImageEx));
         obj.SetAllDirty();
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Esempio n. 3
0
        public override void OnEnd(Handle h)
        {
            if (h.m_go == null)
            {
                return;
            }
            ImageEx s = h.m_go.GetComponent <ImageEx>();

            if (s == null)
            {
                return;
            }
            s.SetGrey(h.m_b1);
        }
Esempio n. 4
0
 static int SetGrey(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         UI.ImageEx obj  = (UI.ImageEx)ToLua.CheckObject(L, 1, typeof(UI.ImageEx));
         bool       arg0 = LuaDLL.luaL_checkboolean(L, 2);
         obj.SetGrey(arg0);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Esempio n. 5
0
 static int Set(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         UI.ImageEx obj  = (UI.ImageEx)ToLua.CheckObject(L, 1, typeof(UI.ImageEx));
         string     arg0 = ToLua.CheckString(L, 2);
         obj.Set(arg0);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Esempio n. 6
0
    static int set_mProgress(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UI.UIProgressEx obj  = (UI.UIProgressEx)o;
            UI.ImageEx      arg0 = (UI.ImageEx)ToLua.CheckUnityObject(L, 2, typeof(UI.ImageEx));
            obj.mProgress = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index mProgress on a nil value" : e.Message));
        }
    }
Esempio n. 7
0
    static int get_mProgress(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UI.UIProgressEx obj = (UI.UIProgressEx)o;
            UI.ImageEx      ret = obj.mProgress;
            ToLua.Push(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index mProgress on a nil value" : e.Message));
        }
    }
Esempio n. 8
0
    static int get_m_progressBar(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UILoading  obj = (UILoading)o;
            UI.ImageEx ret = obj.m_progressBar;
            ToLua.Push(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index m_progressBar on a nil value" : e.Message));
        }
    }
Esempio n. 9
0
    static int get_m_grey(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UI.ImageEx obj = (UI.ImageEx)o;
            bool       ret = obj.m_grey;
            LuaDLL.lua_pushboolean(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index m_grey on a nil value" : e.Message));
        }
    }
Esempio n. 10
0
    static int set_m_grey(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UI.ImageEx obj  = (UI.ImageEx)o;
            bool       arg0 = LuaDLL.luaL_checkboolean(L, 2);
            obj.m_grey = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index m_grey on a nil value" : e.Message));
        }
    }
Esempio n. 11
0
        int SetImageProgress(ImageEx image, float value)
        {
            if (value <= 0)
            {
                if (image != null)
                {
                    image.fillAmount = 0;
                }
                return(0);
            }

            int   num       = GetNumOfValue(value);
            float unitValue = Mathf.Clamp01((value % Unit) / Unit);

            if (unitValue == 0)
            {
                unitValue = 1;
            }

            //替换对应条数的图片
            if (m_spriteNames != null && num <= m_spriteNames.Length)
            {
                if (image != null)
                {
                    image.Set(m_spriteNames[num - 1]);
                }
            }
            else if (m_sprites != null && num <= m_sprites.Length)
            {
                if (image != null)
                {
                    image.overrideSprite = m_sprites[num - 1];
                }
            }

            //设置进度
            if (image != null)
            {
                image.fillAmount = unitValue;
            }
            EditorUtil.SetDirty(image);
            return(num);
        }
Esempio n. 12
0
        //框架,绘制属性(不包含游戏对象),syncGo的话结束值变化会同步到m_go。这里是最小化绘制,只绘制最需要的属性
        public override void OnDrawMid(Component comp, Handle h, System.Action <Handle.WndType, object> onOpenWnd, bool syncGo = false)
        {
            if (h.m_go == null)
            {
                return;
            }
            GUI.changed = false;
            ImageEx s = h.m_go.GetComponent <ImageEx>();
            bool    b = UnityEditor.EditorGUILayout.Toggle("变灰", h.m_b1);

            if (GUI.changed)
            {
                EditorUtil.RegisterUndo("Handle Change", comp);
                h.m_b1 = b;
                EditorUtil.SetDirty(comp);
                if (syncGo && h.m_go)
                {
                    End(h);
                    EditorUtil.SetDirty(h.m_go);
                }
            }
        }
Esempio n. 13
0
        void DrawAtlasSel()
        {
            ImageEx imageEx = target as ImageEx;

            bool grey = EditorGUILayout.Toggle("变灰", imageEx.m_grey);

            if (grey != imageEx.m_grey)
            {
                imageEx.SetGrey(grey);
            }

            string[] ns = UnityEditor.Sprites.Packer.atlasNames;
            if (ns.Length == 0)
            {
                return;
            }
            List <string> l = new List <string>(ns);

            l.Add("CCMJ");
            l.Add("Common");
            l.Add("DDZ");
            l.Add("Main");
            ns = l.ToArray();

            //图集选择
            string curAtlas = EditorPrefs.GetString("cur_atlas");

            using (new AutoBeginHorizontal())
            {
                EditorGUILayout.PrefixLabel("图片选择:");

                int i = Array.IndexOf(ns, curAtlas);
                i = EditorGUILayout.Popup(i, ns);
                if (i != -1 && ns[i] != curAtlas)
                {
                    EditorPrefs.SetString("cur_atlas", ns[i]);
                    curAtlas = ns[i];
                }
                else if (i == -1)
                {
                    curAtlas = string.Empty;
                }

                //图片选择
                if (string.IsNullOrEmpty(curAtlas))
                {
                    return;
                }
                if (GUILayout.Button("图片", EditorStyles.popup, GUILayout.Width(50)))
                {
                    //ImageSelector.Show(curAtlas, OnSel);
                    EditorGUIUtility.ShowObjectPicker <Sprite>(imageEx.sprite, false, "ui_" + curAtlas, 0);;
                    UnityEditor.EditorPrefs.SetString("cur_sprite_picker", "imageex");
                }
                if (Event.current.GetTypeForControl(0) == EventType.ExecuteCommand && Event.current.commandName == "ObjectSelectorUpdated" && UnityEditor.EditorPrefs.GetString("cur_sprite_picker") == "imageex")
                {
                    Sprite s = EditorGUIUtility.GetObjectPickerObject() as Sprite;
                    if (s != null && s != imageEx.sprite)
                    {
                        UnityEditor.Undo.RecordObject(imageEx, "imageEx select");
                        imageEx.sprite = s;
                        if (imageEx.type == Image.Type.Simple)
                        {
                            RectTransform t = imageEx.GetComponent <RectTransform>();
                            if (t.sizeDelta.x == 100 && t.sizeDelta.y == 100)//没有设置过大小的情况下设置成图片大小
                            {
                                t.sizeDelta = s.rect.size;
                            }
                        }
                        UnityEditor.EditorUtility.SetDirty(imageEx);
                    }
                }
            }
        }