예제 #1
0
 public void SetDoor()
 {
     if (m_Soldier != null)
     {
         m_Soldier.SetDoor(UnityTool.FindChildGameObject(UnityTool.FindGameObject("Door"), "Point").transform);
     }
 }
예제 #2
0
    // 設定特效元件
    protected void SetupEffect()
    {
        GameObject EffectObj = UnityTool.FindChildGameObject(m_GameObject, "Effect");

        // 取得特效使用的元件
        m_Line      = EffectObj.GetComponent <LineRenderer>();
        m_Particles = EffectObj.GetComponent <ParticleSystem>();
        m_Audio     = EffectObj.GetComponent <AudioSource>();
        m_Light     = EffectObj.GetComponent <Light>();
    }
예제 #3
0
    // 取得集合点
    private Vector3 GetTrainPoint(string GameObjectName)
    {
        // 取得物件
        GameObject theCamp = UnityTool.FindGameObject(GameObjectName);
        // 取得集合点
        GameObject theTrainPoint = UnityTool.FindChildGameObject(theCamp, "TrainPoint");

        theTrainPoint.SetActive(false);

        return(theTrainPoint.transform.position);
    }
예제 #4
0
 // 查找UI界面,在制定Canvas下
 public static GameObject FindUIGameObject(string UIName)
 {
     if (m_CanvasObj == null)
     {
         m_CanvasObj = UnityTool.FindGameObject("Canvas");
     }
     if (m_CanvasObj == null)
     {
         return(null);
     }
     return(UnityTool.FindChildGameObject(m_CanvasObj, UIName));
 }
예제 #5
0
    public override void Initialize(string s)
    {
        m_RootUI = UnityTool.FindGameObject(s);

        closeBtn = UITool.GetUIComponent <Button>(m_RootUI, "SelectStageCloseBtn");

        item = UnityTool.FindChildGameObject(m_RootUI, "Item");

        content = UITool.GetUIComponent <Transform>(m_RootUI, "Content");

        closeBtn.onClick.AddListener(() => { _ctrl.OnCloseBtnClick(); });
    }
예제 #6
0
    public override void Initialize(string s)
    {
        m_RootUI = UnityTool.FindGameObject(s);

        // 查找开始按钮
        StartGameBtn = UnityTool.FindChildGameObject(m_RootUI, "StartGameBtn").GetComponent <Button>();


        if (StartGameBtn != null)
        {
            StartGameBtn.onClick.AddListener(() => _ctrl.OnStartGameBtnClick(StartGameBtn));
        }
    }
    public IUserInterfaceManager()
    {
        UI_Root = UnityTool.FindGameObject("UIRoot").transform;

        Normal = UnityTool.FindChildGameObject(UI_Root.gameObject, "Normal").transform;

        Fixed = UnityTool.FindChildGameObject(UI_Root.gameObject, "Fixed").transform;

        PopUp = UnityTool.FindChildGameObject(UI_Root.gameObject, "PopUp").transform;

        uiCache = new Dictionary <Type, IUserInterfaceConfig>();

        uiShowCache = new Dictionary <Type, IUserInterface>();
    }
예제 #8
0
    public override void Initialize(string s)
    {
        m_RootUI = UnityTool.FindGameObject(s);

        tips = UnityTool.FindChildGameObject(m_RootUI, "Tips");
        item = UnityTool.FindChildGameObject(m_RootUI, "CreateRoleItemBtn");

        pop = UnityTool.FindChildGameObject(m_RootUI, "Pop");

        GoBackBtn  = UITool.GetUIComponent <Button>(m_RootUI, "GoBackBtn");
        RepeatBtn  = UITool.GetUIComponent <Button>(m_RootUI, "RepeatBtn");
        ConfirmBtn = UITool.GetUIComponent <Button>(m_RootUI, "ConfirmBtn");
        CancelBtn  = UITool.GetUIComponent <Button>(m_RootUI, "CancelBtn");

        showRole = UITool.GetUIComponent <Image>(m_RootUI, "ShowRole");

        input = UITool.GetUIComponent <InputField>(m_RootUI, "InputField");

        content = UITool.GetUIComponent <Transform>(m_RootUI, "CreateContent");

        pop.SetActive(false);



        //根据基础信息生成可以创建的角色
        List <RoleBasicInfo> roleBasicInfoList = _model.GetRoleBasicInfoConfig();

        for (int i = 0; i < roleBasicInfoList.Count; i++)
        {
            int        k     = i;
            GameObject clone = GameObject.Instantiate(item, content, false);
            clone.GetComponentInChildren <Text>().text = roleBasicInfoList[k].name;
            clone.GetComponent <Button>().onClick.AddListener(() =>
            {
                tips.SetActive(true);
                showRole.sprite = Resources.Load <Sprite>("RoleShow/" + roleBasicInfoList[k].model);
                currentType     = roleBasicInfoList[k].roleType;
            });
        }

        currentType = roleBasicInfoList[0].roleType;

        GoBackBtn.onClick.AddListener(() => { _ctrl.SwitchChooseRolePanel(); });

        RepeatBtn.onClick.AddListener(() => { _ctrl.OnRepeatBtnClick(input.text); });

        ConfirmBtn.onClick.AddListener(() => { _ctrl.OnConfirmBtnClick(input.text); });

        CancelBtn.onClick.AddListener(() => { _ctrl.OnCancelBtnClick(); });
    }
예제 #9
0
    public override void Initialize(string s)
    {
        m_RootUI = UnityTool.FindGameObject(s);

        //UITool默认找的是UIRoot下的,刚生成界面的时候,不在Root下

        item = UnityTool.FindChildGameObject(m_RootUI, "ChooseRoleItem");

        content = UITool.GetUIComponent <Transform>(m_RootUI, "ChooseContent");

        CreateRoleBtn = UITool.GetUIComponent <Button>(m_RootUI, "CreateRoleBtn");

        CreateRoleBtn.onClick.AddListener(() => { _ctrl.SwitchCreateRolePanel(); });
    }
예제 #10
0
    // 取得UI元件
    public static T GetUIComponent <T>(GameObject Container, string UIName) where T : UnityEngine.Component
    {
        GameObject ChildGameObject = UnityTool.FindChildGameObject(Container, UIName);

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

        T tempObj = ChildGameObject.GetComponent <T>();

        if (tempObj == null)
        {
            Debug.LogWarning("元件[" + UIName + "]不是[" + typeof(T) + "]");
            return(null);
        }
        return(tempObj);
    }
예제 #11
0
    //
    public override void Initialize()
    {
        m_RootUI = UITool.FindUIGameObject("GameStateInfo");

        //遊戲訊息
        m_MsgText      = UITool.GetUIComponent <Text>(m_RootUI, "NotifyText");
        m_MsgText.text = "";
        // 關卡
        m_NowStageLvText = UITool.GetUIComponent <Text>(m_RootUI, "NowStageLvText");
        ShowNowStageLv(1);
        // AP訊息
        m_APText            = UITool.GetUIComponent <Text>(m_RootUI, "APText");
        m_ApSlider          = UITool.GetUIComponent <Slider>(m_RootUI, "APSlider");
        m_ApSlider.maxValue = APSystem.MAX_AP;
        m_ApSlider.minValue = 0;
        ShowAP(APSystem.MAX_AP);
        // 雙方數量
        m_SoldierCountText = UITool.GetUIComponent <Text>(m_RootUI, "SoldierCountText");;
        m_EnemyCountText   = UITool.GetUIComponent <Text>(m_RootUI, "EnemyCountText");;

        // Heart
        m_HeartImages = new List <Image>();
        for (int i = 1; i <= StageSystem.MAX_HEART; ++i)
        {
            string name = string.Format("Heart{0}", i);
            m_HeartImages.Add(UITool.GetUIComponent <Image>(m_RootUI, name));
        }
        ShowHeart(StageSystem.MAX_HEART);

        // 結束Continue
        Button btn = UITool.GetUIComponent <Button>(m_RootUI, "ContinueBtn");

        btn.onClick.AddListener(() => OnContinueBtnClick());
        // 結束
        m_GameOverObj = UnityTool.FindChildGameObject(m_RootUI, "GameOver");
        m_GameOverObj.SetActive(false);

        // 暫停
        btn = UITool.GetUIComponent <Button>(m_RootUI, "PauseBtn");
        btn.onClick.AddListener(() => OnPauseBtnClick());
    }
예제 #12
0
 public SpriteRenderer GetWeaponObj()
 {
     return(UnityTool.FindChildGameObject(m_GameObject, "weapon01").GetComponent <SpriteRenderer>());
 }
예제 #13
0
 public override void Initialize()
 {
     tags     = UnityTool.FindChildGameObject(RootUI, "img_tags").GetComponent <Image>();
     schedule = UnityTool.FindChildGameObject(RootUI, "Slid_schedule").GetComponent <Slider>();
 }