Exemplo n.º 1
0
    void __clickEmoji2(EventContext context)
    {
        GButton item = (GButton)context.data;
        string  txt  = Char.ConvertFromUtf32(Convert.ToInt32(UIPackage.GetItemByURL(item.icon).name, 16));

        _input2.ReplaceSelection(txt);
    }
Exemplo n.º 2
0
        public void Create(RichTextField owner, HtmlElement element)
        {
            _owner   = owner;
            _element = element;

            int width  = element.GetInt("width", 0);
            int height = element.GetInt("height", 0);

            NTexture texture = owner.htmlPageContext.GetImageTexture(this);

            if (texture != null)
            {
                if (width == 0)
                {
                    width = texture.width;
                }
                if (height == 0)
                {
                    height = texture.height;
                }

                loader.SetSize(width, height);
                loader.texture   = texture;
                _externalTexture = true;
            }
            else
            {
                string src = element.GetString("src");
                if (src != null && (width == 0 || height == 0))
                {
                    PackageItem pi = UIPackage.GetItemByURL(src);
                    if (pi != null)
                    {
                        width  = pi.width;
                        height = pi.height;
                    }
                }

                if (width == 0)
                {
                    width = 5;
                }
                if (height == 0)
                {
                    height = 10;
                }

                loader.SetSize(width, height);
                loader.url       = src;
                _externalTexture = false;
            }
        }
Exemplo n.º 3
0
        public override void OnInspectorGUI()
        {
            DisplayObject obj = (target as DisplayObjectInfo).displayObject;

            EditorGUILayout.LabelField(obj.GetType().Name + ": " + obj.id, (GUIStyle)"OL Title");
            EditorGUILayout.Separator();
            EditorGUI.BeginChangeCheck();
            string name = EditorGUILayout.TextField("Name", obj.name);

            if (EditorGUI.EndChangeCheck())
            {
                obj.name = name;
            }
            if (obj is FairyGUI.Container)
            {
                EditorGUI.BeginChangeCheck();
                bool fairyBatching = EditorGUILayout.Toggle("FairyBatching", ((FairyGUI.Container)obj).fairyBatching);
                if (EditorGUI.EndChangeCheck())
                {
                    ((FairyGUI.Container)obj).fairyBatching = fairyBatching;
                }
            }

            GObject gObj = obj.gOwner;

            if (gObj != null)
            {
                EditorGUILayout.Separator();
                EditorGUILayout.LabelField(gObj.GetType().Name + ": " + gObj.id, (GUIStyle)"OL Title");
                EditorGUILayout.Separator();

                if (!string.IsNullOrEmpty(gObj.resourceURL))
                {
                    PackageItem pi = UIPackage.GetItemByURL(gObj.resourceURL);
                    EditorGUILayout.BeginHorizontal();
                    EditorGUILayout.PrefixLabel("Resource");
                    EditorGUILayout.LabelField(pi.name + "@" + pi.owner.name);
                    EditorGUILayout.EndHorizontal();
                }

                EditorGUI.BeginChangeCheck();
                name = EditorGUILayout.TextField("Name", gObj.name);
                if (EditorGUI.EndChangeCheck())
                {
                    gObj.name = name;
                }

                if (gObj.parent != null)
                {
                    string[] options = new string[gObj.parent.numChildren];
                    int[]    values  = new int[options.Length];
                    for (int i = 0; i < options.Length; i++)
                    {
                        options[i] = i.ToString();
                        values[i]  = i;
                    }
                    EditorGUI.BeginChangeCheck();
                    int childIndex = EditorGUILayout.IntPopup("Child Index", gObj.parent.GetChildIndex(gObj), options, values);
                    if (EditorGUI.EndChangeCheck())
                    {
                        gObj.parent.SetChildIndex(gObj, childIndex);
                    }
                }
                else
                {
                    EditorGUILayout.BeginHorizontal();
                    EditorGUILayout.PrefixLabel("Child Index");
                    EditorGUILayout.LabelField("No Parent");
                    EditorGUILayout.EndHorizontal();
                }

                EditorGUI.BeginChangeCheck();
                Vector3 position = EditorGUILayout.Vector3Field("Position", gObj.position);
                if (EditorGUI.EndChangeCheck())
                {
                    gObj.position = position;
                }

                EditorGUI.BeginChangeCheck();
                Vector3 rotation = EditorGUILayout.Vector3Field("Rotation", new Vector3(gObj.rotationX, gObj.rotationY, gObj.rotation));
                if (EditorGUI.EndChangeCheck())
                {
                    gObj.rotationX = rotation.x;
                    gObj.rotationY = rotation.y;
                    gObj.rotation  = rotation.z;
                }

                EditorGUI.BeginChangeCheck();
                Vector2 scale = EditorGUILayout.Vector2Field("Scale", gObj.scale);
                if (EditorGUI.EndChangeCheck())
                {
                    gObj.scale = scale;
                }

                EditorGUI.BeginChangeCheck();
                Vector2 skew = EditorGUILayout.Vector2Field("Skew", gObj.skew);
                if (EditorGUI.EndChangeCheck())
                {
                    gObj.skew = skew;
                }

                EditorGUI.BeginChangeCheck();
                Vector2 size = EditorGUILayout.Vector2Field("Size", gObj.size);
                if (EditorGUI.EndChangeCheck())
                {
                    gObj.size = size;
                }

                EditorGUI.BeginChangeCheck();
                Vector2 pivot = EditorGUILayout.Vector2Field("Pivot", gObj.pivot);
                if (EditorGUI.EndChangeCheck())
                {
                    gObj.pivot = pivot;
                }

                EditorGUI.BeginChangeCheck();
                string text = EditorGUILayout.TextField("Text", gObj.text);
                if (EditorGUI.EndChangeCheck())
                {
                    gObj.text = text;
                }

                EditorGUI.BeginChangeCheck();
                string icon = EditorGUILayout.TextField("Icon", gObj.icon);
                if (EditorGUI.EndChangeCheck())
                {
                    gObj.icon = icon;
                }
            }
        }