Beispiel #1
0
            public Rect GetGuiRect(jxE g)
            {
                jxV vRect = g.AttrVar("Rect");

                if (vRect == null)
                {
                    vRect = g.AttrVar("Name");
                }
                if (vRect == null)
                {
                    //jDebug.jWARN(" attribute not found Rect : " + g.GetTagName());
                    return(new Rect(0, 0, 0, 0));
                }

                if (vRect.GetEType() == nXML.EDataType.e_Rect)
                {
                    return(vRect.GetRect());
                }

                if (vRect.GetEType() != nXML.EDataType.e_string)
                {
                    throw new System.Exception("xml : vRect.GetEType() != nXML.EDataType.e_string : " + m_Doc.m_name);
                }

                jxE eRect = m_eNamedRect.Find(vRect.Get_string());

                if (eRect == null)
                {
                    throw new System.Exception(m_Doc.m_name + "  eRect==null");
                }

                return(eRect.GetRect());
            }
Beispiel #2
0
            //#--------------------------------------------------------------------------
            // member function
            //#--------------------------------------------------------------------------
            public jxV AttrVarOverride(string attribute_name)
            {
                jxA v = m_jxE.AttrVar(attribute_name);

                if (v != null || m_OverrideAttribute == null)
                {
                    return(v);
                }

                jxE e = m_OverrideAttribute.Find(m_jxE.GetTagID(), 1);

                if (e == null)
                {
                    return(null);
                }
                //Debug.Log(e.GetTagName() + " : OverrideAttribute : " + attribute_name);
                return(e.AttrVar(attribute_name));
            }
Beispiel #3
0
            protected void loadDefaultParam(jGuiStage stage, jGuiWindow win, jGuiControl parent, jxE g, jxE overrideAttribute)
            {
                m_OverrideAttribute = g.Find("OverrideAttribute", 1);
                if (m_OverrideAttribute == null)
                {
                    m_OverrideAttribute = overrideAttribute;
                }

                m_TextAnchor.t1 = false;
                m_jxE           = g;
                m_jGuiStage     = stage;
                m_jGuiParent    = parent;
                m_Enable        = m_jxE.AttrVar("Enable");
                m_Text          = AttrOverride("Text");
                m_Name          = m_jxE.Attr("Name");
                if (m_Text == null)
                {
                    m_Text = m_Name;
                }

                load_GUIStyle();
            }
Beispiel #4
0
            // iDepth=-1이면 모든 자식에 대해 검색.
            public jxE Find(string_id_t id, int iDepth = -1)
            {
                if (iDepth == 0)
                {
                    return(null);
                }
                if (id == 0)
                {
                    return(null);
                }
                for (jxE e = m_Child; e != null; e = e.m_Next)
                {
                    if (e.GetIndex() != id)
                    {
                        continue;
                    }
                    return(e);
                }

                --iDepth;
                if (iDepth == 0)
                {
                    return(null);
                }

                for (jxE e = m_Child; e != null; e = e.m_Next)
                {
                    jxE eFind = e.Find(id, iDepth);
                    if (eFind == null)
                    {
                        continue;
                    }
                    return(eFind);
                }

                return(null);
            }
Beispiel #5
0
            public void Load(string name, string xml, GUISkin skin, GameObject eventHandler, string GuiEventPrifix = "GuiEvent_")
            {
                m_GuiEventPrifix = GuiEventPrifix;
                if (eventHandler == null)
                {
                    throw new System.Exception(xml + " : eventHandler == null. set EventHandler GameObject!");
                }
                m_EventHandler = eventHandler;
                string xml_url = " name = " + name + "xml=" + xml;

                m_GUISkin = skin;
                m_Doc     = nXML.jxDocument.Load(name, xml);
                if (m_Doc == null)
                {
                    throw new System.Exception(xml_url);
                }

//              string outString = "";
//              m_Doc.m_Root.WriteToString(ref outString);
//              Debug.Log(outString);

                m_eGuiHeader = m_Doc.m_Root.Find("GuiHeader");
                if (m_eGuiHeader != null)
                {
                    m_eNamedRect = m_eGuiHeader.Find("NamedRect");
                }

                m_ejGuiList = m_Doc.m_Root.Find("jGui_List");
                if (m_ejGuiList == null)
                {
                    throw new System.Exception("xml : jGui_List is not found : " + xml_url);
                }

                m_eModal_Window = m_Doc.m_Root.Find("Modal_Window", 1);

                string stageName = m_Doc.m_Root.Attr("Name");

                m_EventHandler.SendMessage("OnLoadStageXML_" + stageName, m_Doc);

                jGuiControl ctrl;

                jxE overrideAttr = m_ejGuiList.Find("OverrideAttribute", 1);

                foreach (jxE e in m_ejGuiList)
                {
                    //Debug.Log (" load ; " + e.GetTagName());
                    ctrl = CreateRTTI(e);
                    if (ctrl == null)
                    {
                        continue;
                    }
                    ctrl.Load(this, null, null, e, overrideAttr);
                }

                if (m_eModal_Window != null)
                {
                    overrideAttr = m_eModal_Window.Find("OverrideAttribute", 1);
                    foreach (jxE e in m_eModal_Window)
                    {
                        ctrl = CreateRTTI(e);
                        if (ctrl == null)
                        {
                            continue;
                        }
                        ctrl.Load(this, null, null, e, overrideAttr);
                    }
                }

                m_EventHandler.SendMessage("OnLoadStageGUI_" + stageName, this);
            }