Exemplo n.º 1
0
    public void SelectMark(string spriteName, int index)
    {
        XmlMarker tmp_xmlData = xmlArrayList [index] as  XmlMarker;

        selectedMark = spriteName;

        GameObject markPrefab = AssetDatabase.LoadAssetAtPath(prefabPath, typeof(GameObject)) as GameObject;
        MarkXmlUI  mark_ui    = markPrefab.GetComponent <MarkXmlUI> ();

        mark_ui.name         = tmp_xmlData.locationName;
        mark_ui.coordinate_x = tmp_xmlData.coordinate_x;
        mark_ui.coordinate_y = tmp_xmlData.coordinate_y;

        mark_ui.normalPixelInset_x = tmp_xmlData.normalPixelInset_x;
        mark_ui.normalPixelInset_y = tmp_xmlData.normalPixelInset_y;
        mark_ui.normalPixelInset_w = tmp_xmlData.normalPixelInset_w;
        mark_ui.normalPixelInset_h = tmp_xmlData.normalPixelInset_h;

        mark_ui.textPixelInset_x = tmp_xmlData.textPixelInset_x;
        mark_ui.textPixelInset_y = tmp_xmlData.textPixelInset_y;
        mark_ui.textFontSize     = tmp_xmlData.textFontSize;

        mark_ui.normalColor = new Color(tmp_xmlData.normalColor_r / 255.0f, tmp_xmlData.normalColor_g / 255.0f, tmp_xmlData.normalColor_b / 255.0f, tmp_xmlData.normalColor_a / 255.0f);

        mark_ui.textShow = tmp_xmlData.textShow;

        mark_ui.textColor = new Color(tmp_xmlData.textColor_r / 255.0f, tmp_xmlData.textColor_g / 255.0f, tmp_xmlData.textColor_b / 255.0f, tmp_xmlData.textColor_a / 255.0f);

        mark_ui.mainTexture   = Resources.Load("UI/" + tmp_xmlData.normalSprite) as Texture2D;
        mark_ui.overTexture   = Resources.Load("UI/" + tmp_xmlData.hoverSprite) as Texture2D;
        mark_ui.activeTexture = Resources.Load("UI/" + tmp_xmlData.activeSprite) as Texture2D;

        Select(markPrefab);
    }
Exemplo n.º 2
0
    public void updateXmlMark(int index)
    {
        XmlMarker  tmp_xmlData = xmlArrayList [index] as  XmlMarker;
        GameObject Prefab      = AssetDatabase.LoadAssetAtPath(prefabPath, typeof(GameObject)) as GameObject;

        MarkXmlUI mark_ui = Prefab.GetComponent <MarkXmlUI> ();

        tmp_xmlData.locationName = mark_ui.name;
        tmp_xmlData.coordinate_x = mark_ui.coordinate_x;

        tmp_xmlData.coordinate_y       = mark_ui.coordinate_y;
        tmp_xmlData.normalPixelInset_x = mark_ui.normalPixelInset_x;

        tmp_xmlData.normalPixelInset_y = mark_ui.normalPixelInset_y;
        tmp_xmlData.normalPixelInset_w = mark_ui.normalPixelInset_w;
        tmp_xmlData.normalPixelInset_h = mark_ui.normalPixelInset_h;

        tmp_xmlData.normalPixelInset_x = mark_ui.normalPixelInset_x;
        tmp_xmlData.normalPixelInset_y = mark_ui.normalPixelInset_y;

        tmp_xmlData.textFontSize = mark_ui.textFontSize;

        tmp_xmlData.normalColor_r = (int)(mark_ui.normalColor.r * 255);
        tmp_xmlData.normalColor_g = (int)(mark_ui.normalColor.g * 255);
        tmp_xmlData.normalColor_b = (int)(mark_ui.normalColor.b * 255);
        tmp_xmlData.normalColor_a = (int)(mark_ui.normalColor.a * 255);

        tmp_xmlData.textShow     = mark_ui.textShow;
        tmp_xmlData.textFontSize = mark_ui.textFontSize;

        tmp_xmlData.textColor_r = (int)(mark_ui.textColor.r * 255);
        tmp_xmlData.textColor_g = (int)(mark_ui.textColor.g * 255);
        tmp_xmlData.textColor_b = (int)(mark_ui.textColor.b * 255);
        tmp_xmlData.textColor_a = (int)(mark_ui.textColor.a * 255);


        if (mark_ui.mainTexture != null)
        {
            tmp_xmlData.normalSprite = mark_ui.mainTexture.name;
        }
        if (mark_ui.overTexture != null)
        {
            tmp_xmlData.hoverSprite = mark_ui.overTexture.name;
        }
        if (mark_ui.activeTexture != null)
        {
            tmp_xmlData.activeSprite = mark_ui.activeTexture.name;
        }


        xmlArrayList [index] = tmp_xmlData;
    }
Exemplo n.º 3
0
    public void SelectMarkClear()
    {
        GameObject markPrefab = AssetDatabase.LoadAssetAtPath(prefabPath, typeof(GameObject)) as GameObject;

        MarkXmlUI mark_ui = markPrefab.GetComponent <MarkXmlUI> ();

        mark_ui.name = mark_ui.coordinate_x = mark_ui.coordinate_y = "";
        mark_ui.normalPixelInset_x = mark_ui.normalPixelInset_y = mark_ui.normalPixelInset_w = mark_ui.normalPixelInset_h = mark_ui.textPixelInset_x = mark_ui.textPixelInset_y = mark_ui.textFontSize = 0;
        mark_ui.normalColor        = mark_ui.textColor = Color.white;
        mark_ui.textShow           = false;
        mark_ui.mainTexture        = mark_ui.overTexture = mark_ui.activeTexture = null;
        Select(markPrefab);
    }
Exemplo n.º 4
0
    public override void OnInspectorGUI()
    {
        GUILayout.BeginHorizontal();
        GUI.backgroundColor = Color.cyan;
        GUILayout.Label("Location Name");
        markXml_ui.name = GUILayout.TextField(markXml_ui.name);
        GUILayout.EndHorizontal();


        GUI.backgroundColor = Color.white;


        GUILayout.Space(6);

        EditorGUILayout.LabelField("Longitude  (X)");
        markXml_ui.coordinate_x = EditorGUILayout.TextField(markXml_ui.coordinate_x);
        EditorGUILayout.LabelField("Latitude  (Y)");
        markXml_ui.coordinate_y = EditorGUILayout.TextField(markXml_ui.coordinate_y);

        GUILayout.Space(10);


        EditorGUILayout.LabelField("Mark Image info");
        MarkXmlUI.BeginContents();
        EditorGUILayout.BeginHorizontal();
        //GUILayout.Space (10);
        EditorGUILayout.BeginVertical();
        EditorGUILayout.LabelField("Nomal", GUILayout.Width(50));

        markXml_ui.mainTexture = EditorGUILayout.ObjectField("", markXml_ui.mainTexture, typeof(Texture2D), false) as Texture2D;
        EditorGUILayout.EndVertical();


        EditorGUILayout.BeginVertical();
        EditorGUILayout.LabelField("Hover", GUILayout.Width(50));
        markXml_ui.overTexture = EditorGUILayout.ObjectField("", markXml_ui.overTexture, typeof(Texture2D), false) as Texture2D;
        EditorGUILayout.EndVertical();


        EditorGUILayout.BeginVertical();
        EditorGUILayout.LabelField("Active", GUILayout.Width(50));
        markXml_ui.activeTexture = EditorGUILayout.ObjectField("", markXml_ui.activeTexture, typeof(Texture2D), false) as Texture2D;
        EditorGUILayout.EndVertical();

        EditorGUILayout.EndHorizontal();
        GUILayout.Space(10);
        EditorGUILayout.BeginHorizontal();
        GUILayout.Label("Color");
        markXml_ui.normalColor = EditorGUILayout.ColorField(markXml_ui.normalColor);
        EditorGUILayout.EndHorizontal();


        MarkXmlUI.FloatPair("Pixel Inset", "X", "Y", markXml_ui.normalPixelInset_x, markXml_ui.normalPixelInset_y);

        MarkXmlUI.FloatPair("", "Width", "Height", markXml_ui.normalPixelInset_w, markXml_ui.normalPixelInset_h);

        GUILayout.Space(20);


        EditorGUILayout.LabelField("Mark Text info");

        GUILayout.BeginHorizontal();
        markXml_ui.textShow = EditorGUILayout.Toggle("Text Show", markXml_ui.textShow, GUILayout.Width(100f));
        GUILayout.Label("Mark Text show");
        GUILayout.EndHorizontal();

        MarkXmlUI.BeginContents();

        MarkXmlUI.FloatPair("Pixel Offset", "X", "Y", markXml_ui.textPixelInset_x, markXml_ui.textPixelInset_y);
        markXml_ui.textFontSize = EditorGUILayout.IntField("Font Size", markXml_ui.textFontSize, GUILayout.MinWidth(30f));

        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.LabelField("Color");
        markXml_ui.textColor = EditorGUILayout.ColorField(markXml_ui.textColor);
        EditorGUILayout.EndHorizontal();

        mAlignmentType = (AlignmentType)EditorGUILayout.EnumPopup("Alignment", mAlignmentType, GUILayout.MinWidth(200f));

        MarkXmlUI.EndContents();
        MarkXmlUI.EndContents();

        //inspector changed
        if (GUI.changed)
        {
            manager.updateXmlMark(manager.selectListIndex);
        }
    }
Exemplo n.º 5
0
 void OnEnable()
 {
     manager    = GameObject.Find("Manager").GetComponent <Xml_Manager> ();
     markXml_ui = target as MarkXmlUI;
 }