Esempio n. 1
0
    public static void doSaveAsset(GameObject go)
    {
        CLPanelBase panel = go.GetComponent <CLPanelBase>();

        if (panel == null)
        {
            return;
        }
        Debug.Log(panel.name);
        if (panel.isNeedResetAtlase)
        {
            CLUIUtl.resetAtlasAndFont(panel.transform, true);
            PrefabUtility.SavePrefabAsset(go);
        }
        string dir = Application.dataPath + "/" + ECLEditorUtl.getPathByObject(go);

        dir = Path.GetDirectoryName(dir);
        ECLCreatAssetBundle4Update.createAssets4Upgrade(dir, panel.gameObject, true);

        // 必须再取一次,好像执行了上面一句方法后,cell就会变成null
        panel = go.GetComponent <CLPanelBase>();
        if (panel != null && panel.isNeedResetAtlase)
        {
            CLUIUtl.resetAtlasAndFont(panel.transform, false);
            PrefabUtility.SavePrefabAsset(go);
        }
    }
Esempio n. 2
0
    public override void OnInspectorGUI()
    {
        panel = target as CLPanelLua;

        panel.isNeedMask4Init = EditorGUILayout.Toggle("Is Need Mask 4 Show", panel.isNeedMask4Init);
        if (panel.isNeedMask4Init)
        {
            panel.isNeedMask4InitOnlyOnce = EditorGUILayout.Toggle("    Only First Show", panel.isNeedMask4InitOnlyOnce);
        }

        base.OnInspectorGUI();
        NGUIEditorTools.BeginContents();
        {
            GUILayout.Space(3);
//			if (GUILayout.Button("Reload Lua")) {
//				reloadLua();
//			}
            if (GUILayout.Button("Reset Atlas & Font"))
            {
                if (panel.isNeedResetAtlase)
                {
//					CLUIInit.self.init ();
                    CLUIUtl.resetAtlasAndFont(panel.transform, false);
//					CLUIInit.self.clean();
                }
            }
            if (GUILayout.Button("Save Panel 2 U3dType"))
            {
                saveToU3d();
            }
        }
        NGUIEditorTools.EndContents();
        GUILayout.Space(5);
    }
Esempio n. 3
0
    static public void uipanels2U3d()
    {
        UnityEngine.Object[] objs = Selection.objects;
        int count = objs.Length;

        UnityEngine.Object obj   = null;
        CLPanelLua         panel = null;

        for (int i = 0; i < count; i++)
        {
            obj   = objs [i];
            panel = ((GameObject)obj).GetComponent <CLPanelLua> ();
            if (panel != null)
            {
                Debug.LogError(obj.name);
                CLPanelLuaInspector.doSaveAsset(panel.gameObject);
            }
        }
    }
Esempio n. 4
0
    static public void Bio2Json()
    {
        UnityEngine.Object[] objs = Selection.objects;
        int count = objs.Length;

        UnityEngine.Object obj   = null;
        CLPanelLua         panel = null;

        for (int i = 0; i < count; i++)
        {
            obj = objs [i];
            string path    = AssetDatabase.GetAssetPath(obj);          //Selection表示你鼠标选择激活的对象
            object map     = Utl.fileToObj(path);
            string jsonStr = JSON.JsonEncode(map);
            Debug.Log(jsonStr);

            File.WriteAllText(path + ".json", jsonStr);
        }
    }
Esempio n. 5
0
    static public void Json2Bio()
    {
        UnityEngine.Object[] objs = Selection.objects;
        int count = objs.Length;

        UnityEngine.Object obj   = null;
        CLPanelLua         panel = null;

        for (int i = 0; i < count; i++)
        {
            obj = objs [i];
            string path    = AssetDatabase.GetAssetPath(obj);          //Selection表示你鼠标选择激活的对象
            string jsonStr = File.ReadAllText(path);
            object map     = JSON.JsonDecode(jsonStr);

            MemoryStream ms = new MemoryStream();
            B2OutputStream.writeObject(ms, map);
            Directory.CreateDirectory(Path.GetDirectoryName(path));
            File.WriteAllBytes(path + ".bio", ms.ToArray());
        }
    }
Esempio n. 6
0
    public override void OnInspectorGUI()
    {
        panel = target as CLPanelLua;

        panel.isNeedMask4Init = EditorGUILayout.Toggle("Is Need Mask 4 Show", panel.isNeedMask4Init);
        if (panel.isNeedMask4Init)
        {
            panel.isNeedMask4InitOnlyOnce = EditorGUILayout.Toggle("    Only First Show", panel.isNeedMask4InitOnlyOnce);
        }

        base.OnInspectorGUI();
        init();

        GUILayout.BeginHorizontal();
        {
            EditorGUILayout.LabelField("背景框", GUILayout.Width(100));
            frameObj = EditorGUILayout.ObjectField(frameObj, typeof(UnityEngine.Object), GUILayout.Width(125));
        }
        GUILayout.EndHorizontal();
        string path = AssetDatabase.GetAssetPath(frameObj);

        panel.frameName = Path.GetFileNameWithoutExtension(path);
        EditorUtility.SetDirty(panel);

        if (GUILayout.Button("增加渐显缩放效果"))
        {
            //instance.EffectList.Count
            TweenScale ts = panel.gameObject.AddComponent <TweenScale>();
            ts.from     = Vector3.one * 1.5f;
            ts.to       = Vector3.one;
            ts.duration = 0.5f;
            ts.method   = UITweener.Method.EaseInOut;
            ts.enabled  = false;
            panel.EffectList.Add(ts);

            TweenAlpha ta = panel.gameObject.AddComponent <TweenAlpha>();
            ta.from     = 0.1f;
            ta.to       = 1;
            ta.duration = 0.5f;
            ta.method   = UITweener.Method.EaseInOut;
            ta.enabled  = false;
            panel.EffectList.Add(ta);
            panel.effectType = CLPanelBase.EffectType.synchronized;
            EditorUtility.SetDirty(panel);
        }

        if (GUILayout.Button("增加渐显左移效果"))
        {
            //instance.EffectList.Count
            TweenPosition ts = panel.gameObject.AddComponent <TweenPosition>();
            ts.from     = Vector3.left * 1920;
            ts.to       = Vector3.zero;
            ts.duration = 0.5f;
            ts.method   = UITweener.Method.EaseInOut;
            ts.enabled  = false;
            panel.EffectList.Add(ts);

            TweenAlpha ta = panel.gameObject.AddComponent <TweenAlpha>();
            ta.from     = 0.1f;
            ta.to       = 1;
            ta.duration = 0.5f;
            ta.method   = UITweener.Method.EaseInOut;
            ta.enabled  = false;
            panel.EffectList.Add(ta);
            panel.effectType = CLPanelBase.EffectType.synchronized;
            EditorUtility.SetDirty(panel);
        }

        if (GUILayout.Button("增加渐显下移效果"))
        {
            //instance.EffectList.Count
            TweenPosition ts = panel.gameObject.AddComponent <TweenPosition>();
            ts.from     = Vector3.up * 1080;
            ts.to       = Vector3.zero;
            ts.duration = 0.5f;
            ts.method   = UITweener.Method.EaseInOut;
            ts.enabled  = false;
            panel.EffectList.Add(ts);

            TweenAlpha ta = panel.gameObject.AddComponent <TweenAlpha>();
            ta.from     = 0.1f;
            ta.to       = 1;
            ta.duration = 0.5f;
            ta.method   = UITweener.Method.EaseInOut;
            ta.enabled  = false;
            panel.EffectList.Add(ta);
            panel.effectType = CLPanelBase.EffectType.synchronized;
            EditorUtility.SetDirty(panel);
        }

        NGUIEditorTools.BeginContents();
        {
            GUILayout.Space(3);
//			if (GUILayout.Button("Reload Lua")) {
//				reloadLua();
//			}
            if (GUILayout.Button("Reset Atlas & Font"))
            {
                if (panel.isNeedResetAtlase)
                {
//					CLUIInit.self.init ();
                    CLUIUtl.resetAtlasAndFont(panel.transform, false);
//					CLUIInit.self.clean();
                }
            }
            if (GUILayout.Button("Save Panel 2 U3dType"))
            {
                saveToU3d();
            }
        }
        NGUIEditorTools.EndContents();
        GUILayout.Space(5);
    }