示例#1
0
文件: Hp.cs 项目: Hengle/GameDemo
    public void SetAgent(GoapAgent goapAgent)
    {
        this.goapAgent = goapAgent;
        Transform hpTarget = ToolsComponent.FindChildCom <Transform>(goapAgent.transform, "Hp");

        follow.SetTarget(hpTarget);
    }
示例#2
0
文件: Hp.cs 项目: Hengle/GameDemo
    protected override void GetView()
    {
        follow   = ToolsComponent.GetComponent <Follow>(transform);
        hpSlider = ToolsComponent.FindChildCom <HpSlider>(transform, "HpSlider");

        textItem = ToolsComponent.FindChildCom <Transform>(transform, "HpText");
    }
示例#3
0
    private Transform GetHpTransform(GoapAgent goapAgent)
    {
        string hpName = string.Format("Hp{0}", Enum.GetName(typeof(Camp), goapAgent.Camp));

        if (!hpQueueDic.ContainsKey(hpName))
        {
            hpQueueDic[hpName] = new Queue <Transform>();
        }

        Transform hpTr = null;

        if (hpQueueDic[hpName].Count <= 0)
        {
            GameObject newHpGo = Instantiate(hpDic[hpName].gameObject) as GameObject;
            newHpGo.name = hpName;
            hpTr         = newHpGo.transform;
            ToolsComponent.AddChild(transform, hpTr);
            hpTr.position = new Vector3(0, 1000, 0);
        }
        else
        {
            hpTr = hpQueueDic[hpName].Dequeue();
        }

        return(hpTr);
    }
示例#4
0
 public void Init()
 {
     m_bg               = ToolsComponent.FindChildCom <Transform>(m_tr, "BG");
     m_UidInputField    = ToolsComponent.FindChildCom <InputField>(m_tr, "BG/UidInputField");
     m_loginButton      = ToolsComponent.FindChildCom <Button>(m_tr, "BG/LoginButton");
     m_clearButton      = ToolsComponent.FindChildCom <Button>(m_tr, "BG/ClearButton");
     m_languageDropDown = ToolsComponent.FindChildCom <Dropdown>(m_tr, "BG/LanguageDropdown");
     m_serverDropDown   = ToolsComponent.FindChildCom <Dropdown>(m_tr, "BG/ServerDropdown");
 }
示例#5
0
 protected override void GetView()
 {
     for (int i = 0; i < hpNames.Length; ++i)
     {
         Transform hpTr = ToolsComponent.FindChildCom <Transform>(transform, hpNames[i]);
         if (hpTr != null)
         {
             hpDic[hpNames[i]] = hpTr;
         }
     }
 }
示例#6
0
    public Transform GetPanel(string panelName)
    {
        Transform panel = null;

        if (m_otherPanelDic.TryGetValue(panelName, out panel))
        {
            return(panel);
        }

        panel = ToolsComponent.FindChildCom <Transform>(m_tr, panelName);
        return(panel);
    }
示例#7
0
文件: Hp.cs 项目: Hengle/GameDemo
    private HpText GetText()
    {
        if (hpTextQueue.Count > 0)
        {
            return(hpTextQueue.Dequeue());
        }

        if (textItem == null)
        {
            return(null);
        }

        Transform item   = ToolsComponent.CloneItem(transform, textItem);
        HpText    hpText = item.GetComponent <HpText>();

        hpText.SetHp(this);
        return(hpText);
    }
示例#8
0
文件: UIBase.cs 项目: Hengle/GameDemo
        protected virtual void Awake()
        {
            // 获取 UI
            m_Tr       = transform;
            m_closeBtn = ToolsComponent.FindChildCom <Button>(m_Tr, "Close");
            if (m_closeBtn != null)
            {
                m_closeBtn.onClick.AddListener(CloseOnClick);
            }

            GetView();
            State |= UIPanelState.InitialUI;

            if (isRootPanel)
            {
                SetData(-1, null);
            }
        }
示例#9
0
 // Use this for initialization
 void Start()
 {
     slider = ToolsComponent.FindChildCom <Slider>(transform, "Slider");
 }
示例#10
0
 private void GetUICamera()
 {
     m_uiCamera  = ToolsComponent.FindChildCom <Camera>(m_tr, "Camera");
     m_rootPanel = ToolsComponent.FindChildCom <Transform>(m_tr, "RootPanel");
 }