示例#1
0
    public void InitUIList <T>() where T : UIListItemBase
    {
        if (m_bIsInit)
        {
            return;
        }

        m_ObjectListRoot       = gameObject;
        m_ObjectPanelRoot      = ComponentTool.FindChild(m_strPanelRoot, m_ObjectListRoot);
        m_ObjectGridRoot       = ComponentTool.FindChild(m_strGridRoot, m_ObjectPanelRoot);
        m_ObjectTableRoot      = ComponentTool.FindChild(m_strTableRoot, m_ObjectPanelRoot);
        m_ChildElementTemplate = ComponentTool.FindChild(m_strElementName, m_ObjectPanelRoot);

        m_HandlerType      = typeof(T);
        m_ChildElementList = new List <ListData>();
        m_Grid             = m_ObjectGridRoot == null ? null : m_ObjectGridRoot.GetComponent <UIGrid>();
        m_Table            = m_ObjectTableRoot == null ? null : m_ObjectTableRoot.GetComponent <UITable>();
        m_UIPanel          = m_ObjectPanelRoot.GetComponent <UIPanel>();
        m_ScrollView       = m_ObjectPanelRoot.GetComponent <UIScrollView>();
        m_ChildElementList.Add(new ListData(m_ChildElementTemplate, Activator.CreateInstance(m_HandlerType) as UIListItemBase, this));
        m_ChildElementList[0].m_Handler.OnInit();
        m_ChildElementTemplate.gameObject.SetActive(false);
        m_InitPos         = new Vector3(m_ObjectGridRoot.transform.localPosition.x, m_ObjectGridRoot.transform.localPosition.y, m_ObjectGridRoot.transform.localPosition.z);
        m_InitPanelOffset = new Vector2(m_UIPanel.clipOffset.x, m_UIPanel.clipOffset.y);
        m_bIsInit         = true;
    }
示例#2
0
    public void Initialize()
    {
        UIWindowCameraRoot = ComponentTool.FindChild("UI_Root", null);
        if (null == UIWindowCameraRoot)
        {
            Debuger.LogError("can't load ui root ");
            return;
        }

        m_UIRoot              = UIWindowCameraRoot.GetComponent <UIRoot>();
        m_UICamera            = ComponentTool.FindChildComponent <Camera>("Camera", UIWindowCameraRoot);
        m_UpdateStore         = new List <Action>();
        m_RemoveingUpdateList = new List <Action>();
        m_bIsUpdateListBusy   = false;
        m_WindowStore         = new Dictionary <int, WindowBase>();
        m_WindowIndexStore    = new Dictionary <int, WindowIndexStruct>();
        m_LayerIndexStore     = new Dictionary <WindowLayer, LayerInfo>();
        m_ActivedWindowQueue  = new Dictionary <WindowLayer, List <WindowBase> >();

        m_LayerIndexStore.Add(WindowLayer.Window, new LayerInfo(0, 20, ComponentTool.FindChild("LayerWindow", UIWindowCameraRoot)));
        m_LayerIndexStore.Add(WindowLayer.Tip, new LayerInfo(21, 40, ComponentTool.FindChild("LayerTip", UIWindowCameraRoot)));

        //register window
        Definer.RegisterWindow();
        m_bIsOnUpdateStore = false;
    }
 public void OnClickOpen()
 {
     m_SelectPanel.SelectPlane((ID) =>
     {
         Clear();
         m_Root = m_TreeParser.CreateBehaviourTree(ID, m_NodeTempalte, ComponentTool.FindChild("TreeRoot", null), LoadAIConfig());
         m_Root.Render(0);
     });
 }
    private void Clear()
    {
        GameObject root = ComponentTool.FindChild("TreeRoot", null);

        for (int i = 0; i < root.transform.childCount; ++i)
        {
            GameObject.Destroy(root.transform.GetChild(i).gameObject);
        }
    }
    private GameObject GetAttachPoint(GameObject root)
    {
        if (root == null || string.IsNullOrEmpty(m_FrameConfig.AttachPoingName))
        {
            return(root);
        }

        return(ComponentTool.FindChild(m_FrameConfig.AttachPoingName, root));
    }
示例#6
0
    public void Initialize()
    {
        m_MapIndexStore    = new Dictionary <MapId, MapIndexStruct>();
        m_MapInstanceStore = new Dictionary <MapId, List <GameObject> >();

        m_2dMapRoot = ComponentTool.FindChild(m_str2dMapRoot, null);
        m_3dMapRoot = ComponentTool.FindChild(m_str3dMapRoot, null);

        MapDefiner.RegisterMap();
    }
示例#7
0
    public GameObject GetFollowPoint(int index)
    {
        GameObject res = null;

        res = ComponentTool.FindChild("FollowPoint" + index, m_CharTransformData.GetGameObject());
        if (null == res)
        {
            res = m_CharTransformData.GetGameObject();
        }
        return(res);
    }
示例#8
0
 protected void AddChildElementClickEvent(UIEventListener.VoidDelegate handler, string childName, string rootName = "")
 {
     if (string.IsNullOrEmpty(rootName))
     {
         UIEventListener.Get(FindChild(childName)).onClick = handler;
     }
     else
     {
         UIEventListener.Get(ComponentTool.FindChild(childName, FindChild(rootName))).onClick = handler;
     }
 }
示例#9
0
    public void Initialize()
    {
        m_AudioRoot            = ComponentTool.FindChild("AudioPlayer", null);
        m_AudioClipList        = new List <AudioElementStruct>(m_iPoolSize);
        m_AudioStorePool       = new Stack <AudioElementStruct>(m_iPoolSize);
        m_AudioCallBacktmpList = new List <AudioCallBackElement>();

        InitAudioPool();

        MessageDispatcher.Instance.RegistMessage(ClientCustomMessageDefine.C_CHANGE_SCENE, OnChangeScene);
    }
 public void OnClickCreateRoot()
 {
     m_SelectPanel.CreateRoot((id, desc) =>
     {
         if (null != desc)
         {
             Clear();
             AIDebugerTreeRoot root = new AIDebugerTreeRoot(id, m_NodeTempalte);
             root.Desc = desc;
             ComponentTool.Attach(ComponentTool.FindChild("TreeRoot", null).transform, root.m_ObjRoot.transform);
             m_Root = root;
         }
     });
 }
示例#11
0
    public AIDebugerTreeNode(string name, GameObject template)
    {
        m_bIsRuntime = UIWindow_BTViewPanel.GetInstance == null;
        m_strName    = name;
        m_ChildList  = new List <AIDebugerTreeNode>();
        m_ObjRoot    = GameObject.Instantiate(template);
        m_ObjRoot.SetActive(true);

        m_ObjChildRoot   = ComponentTool.FindChild("Root", m_ObjRoot);
        m_LabelName      = ComponentTool.FindChildComponent <UILabel>("Label", m_ObjRoot);
        m_LabelName.text = name;
        if (!m_bIsRuntime)
        {
            UIEventListener.Get(m_ObjRoot).onDoubleClick = UIWindow_BTViewPanel.GetInstance.OnDoubleClick;
            UIEventListener.Get(m_ObjRoot).onClick       = UIWindow_BTViewPanel.GetInstance.OnClick;
        }
    }
示例#12
0
        public PilesAlphaElement(GameObject objRoot, string name, bool isVisable, string emptyTextureName)
        {
            m_ObjRoot             = objRoot;
            m_ObjOptionRoot       = ComponentTool.FindChild("Option", m_ObjRoot);
            m_ObjPlayerAttachRoot = ComponentTool.FindChild("PlayerAttachPos", m_ObjRoot);
            m_strName             = name;
            m_bIsVisable          = isVisable;

            m_MeshRenderer = m_ObjOptionRoot.GetComponent <MeshRenderer>();
            m_Materials    = new Material(ResourceManager.Instance.LoadBuildInResource <Material>("Piles/PilesMaterial", AssetType.Materials));
            if (m_bIsVisable)
            {
                m_Materials.mainTexture = ResourceManager.Instance.LoadBuildInResource <Texture2D>(m_strName, AssetType.Texture);
            }
            else
            {
                m_Materials.mainTexture = ResourceManager.Instance.LoadBuildInResource <Texture2D>(emptyTextureName, AssetType.Texture);
            }
            m_MeshRenderer.material = m_Materials;
        }
示例#13
0
 protected GameObject FindChild(string childName)
 {
     return(ComponentTool.FindChild(childName, m_ObjectRoot));
 }
 public FireworkPlanElement(GameObject root)
 {
     m_ObjRoot       = root;
     m_ObjBlock0Root = ComponentTool.FindChild("SpriteBlock0", m_ObjRoot);
     m_ObjBlock1Root = ComponentTool.FindChild("SpriteBlock1", m_ObjRoot);
 }