private void InitCtrlBtns()
    {
        var        diver     = dragScript.dragObject.GetComponent <MeDriver>();
        bool       isSingle  = diver.IsSingle();
        var        modelUnit = diver.unit;
        GameObject btnAuto   = UnityHelper.FindTheChildNode(gameObject, "Btn3").gameObject;
        GameObject btnPause  = UnityHelper.FindTheChildNode(gameObject, "Btn4").gameObject;

        btnAuto.SetActive(isSingle);
        btnPause.SetActive(isSingle);
        if (!isSingle)
        {
            return;
        }

        RigisterButtonObjectEvent("Btn3",
                                  p =>
        {
            modelUnit.StartTimer(10, true);
        });
        RigisterButtonObjectEvent("Btn4",
                                  p =>
        {
            modelUnit.PauseTimer();
        });
    }
Exemple #2
0
    IEnumerator FindUI(string name)
    {
        //寻找目标
        Transform go = UnityHelper.FindTheChildNode(GlobalObj.Canvas, name);

        while (go == null)
        {
            yield return(new WaitForSeconds(0.1f));

            Debug.Log("wait");
            go = UnityHelper.FindTheChildNode(GlobalObj.Canvas, name);
        }

        //高亮
        maskTra = GlobalObj.GuideMask.transform;
        maskTra.gameObject.SetActive(true);
        maskTra.SetAsLastSibling();

        finger = UnityHelper.FindTheChildNode(maskTra.gameObject, "finger");
        Vector3 newPos = maskTra.InverseTransformPoint(go.transform.position);

        finger.localPosition = newPos + offset;
        finger.AddOrGetComponent <Canvas>().overrideSorting = true;
        finger.GetComponent <Canvas>().sortingOrder         = 2;

        go.AddOrGetComponent <Canvas>().overrideSorting = true;
        go.GetComponent <Canvas>().sortingOrder         = 1;
        go.AddOrGetComponent <GraphicRaycaster>();

        //设置监听
        EventTriggerListener.Get(go).onClick += CancelHighLight;
    }
Exemple #3
0
 private void StopScriptRuning()
 {
     GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerControl>().StopGame();
     UnityHelper.FindTheChildNode(GameObject.Find("MainGameScene"), "PipeGroup").gameObject.GetComponent <PipeMovingControl>().EndGame();
     GameObject.Find("MainGameScene").GetComponent <Ctrl_GetTimer>().StopGame();
     //GameObject.Find("MainGameScene").GetComponent<Ctrl_Golds>().StopGame();
 }
Exemple #4
0
    //测试
    //SynopsisSystem syn;

    #endregion

    #region 生命周期

    private void Awake()
    {
        CurrentUIType.UIForms_ShowMode = UIFormShowMode.Normal;
        #region abandon
        //测试
        //bg = transform.Find("Bg").gameObject;
        //nameTxt = transform.Find("Bg/Text/name").GetComponent<Text>();
        //description = transform.Find("Bg/Text/description").GetComponent<Text>();
        //rewards = transform.Find("Bg/Text/rewards").GetComponent<Text>();
        //need = transform.Find("Bg/Text/needbig").GetComponent<Text>();
        //button = transform.Find("Bg/Text/Button").GetComponent<Button>();
        //header = transform.Find("Bg/Text/header").GetComponent<Text>();
        #endregion

        bg          = this.gameObject;
        nameTxt     = UnityHelper.FindTheChildNode(gameObject, "NameText").GetComponent <Text>();
        description = UnityHelper.FindTheChildNode(gameObject, "Description Text").GetComponent <Text>();
        need        = UnityHelper.FindTheChildNode(gameObject, "Needbig").GetComponent <Text>();
        Debug.Log(need.name);
        header = UnityHelper.FindTheChildNode(gameObject, "Title Text").GetComponent <Text>();
        Debug.Log(header.name);
        button = UnityHelper.FindTheChildNode(gameObject, "Button").GetComponent <Button>();
        Debug.Log(button.name);
        exit    = UnityHelper.FindTheChildNode(gameObject, "Exit").GetComponent <Button>();
        rewards = UnityHelper.FindTheChildNode(gameObject, "Rewards").GetComponent <Text>();
        Debug.Log(rewards.name);
        showUI      = new ShowUI();
        buttonClick = new ButtonClick();
        EventCenter.AddListener <TaskSystem, NpcSystem, TalkSystem>(EventDefine.ShowTaskButton, ShowButtonAndState);
        EventCenter.AddListener(EventDefine.Init, InitButton);
        EventCenter.AddListener <TaskSystem>(EventDefine.ShowUI, ShowPanel);
        EventCenter.AddListener <SynopsisSystem>(EventDefine.SetTaskPanel, SetTaskPanel);
        EventCenter.AddListener <SynopsisSystem, TalkSystem>(EventDefine.SetTaskPanelEndTalk, ShowTaskPanel);
    }
Exemple #5
0
 private void Awake()
 {
     CurrentUIType.UIForms_ShowMode = UIFormShowMode.HideOther;
     GameTimer = UnityHelper.FindTheChildNode(this.gameObject, "Timer").GetComponent <Text>();
     MAXScore  = UnityHelper.FindTheChildNode(this.gameObject, "MAXScore").GetComponent <Text>();
     CurScore  = UnityHelper.FindTheChildNode(this.gameObject, "CurScore").GetComponent <Text>();
 }
 private void Awake()
 {
     TxtUserCount  = UnityHelper.FindTheChildNode(gameObject, "TxtUserCount").GetComponent <Text>();
     GridInfo      = UnityHelper.FindTheChildNode(gameObject, "GridInfo").gameObject;
     BtnNewUser    = UnityHelper.FindTheChildNode(gameObject, "BtnNewUser").gameObject;
     BtnDeleteUser = UnityHelper.FindTheChildNode(gameObject, "BtnDeleteUser").gameObject;
 }
Exemple #7
0
    public override void OnAwake()
    {
        base.OnAwake();

        m_IconRawImage = UnityHelper.FindTheChildNode(gameObject, "Icon").GetComponent <RawImage>();
        m_NameText     = UnityHelper.FindTheChildNode(gameObject, "Name").GetComponent <Text>();
        m_DesText      = UnityHelper.FindTheChildNode(gameObject, "Des").GetComponent <Text>();
        M_CoinText     = UnityHelper.FindTheChildNode(gameObject, "Coin").GetComponent <Text>();

        //--------------------------------------------模拟装备数据库--------------------------------------------
        EquipmentInfo clothesInfo = new EquipmentInfo {
            Level = 1, Name = "普通布衣", Base = 5, Coin = 100, Icon = "1LVclothes"
        };
        EquipmentInfo trousersInfo = new EquipmentInfo {
            Level = 1, Name = "粗布麻库", Base = 8, Coin = 200, Icon = "1LVpants"
        };
        EquipmentInfo shoesInfo = new EquipmentInfo {
            Level = 1, Name = "敏捷鞋子", Base = 12, Coin = 300, Icon = "1LVshoes"
        };

        m_EquipmentInfosList.Add(clothesInfo);
        m_EquipmentInfosList.Add(trousersInfo);
        m_EquipmentInfosList.Add(shoesInfo);

        rigisterButtonEvent();
    }
 void Awake()
 {
     //窗体性质
     CurrentUIType.UIForms_Type = UIFormType.Fixed;  //固定在主窗体上面显示
     resetBtn         = UnityHelper.GetTheChildNodeComponetScripts <Button>(gameObject, "ResetBtn");
     resetBtn.enabled = false;
     RigisterButtonObjectEvent("StartBtn", EnterFunc);
     RigisterButtonObjectEvent("ResetBtn", ResetMechanisms);
     RigisterButtonObjectEvent("SearchBtn", ShowModelDetail);
     RigisterButtonObjectEvent("CloseBtn",
                               p =>
     {
         if (!GlobalObj.LabObj.activeInHierarchy)
         {
             ExitFunc();
             return;
         }
         CloseUIForm();
         CameraCtrl.instance.CorrectCamera();
         GlobalObj.LabObj.SetActive(true);
         UIManager.GetInstance().ShowUIForms(ProConst.HERO_INFO_UIFORM);
         ObjectPool.Instance.putBack(unit);
     });
     colliderDic  = new Dictionary <Transform, CachedInfo>();
     mainTitleObj = UnityHelper.FindTheChildNode(gameObject, "mainTitleObj").gameObject;
     mainTitleObj.SetActive(false);
     loadingObj = UnityHelper.FindTheChildNode(gameObject, "LoadingObj").gameObject;
     loadingObj.SetActive(false);
     loadingImage            = UnityHelper.GetTheChildNodeComponetScripts <Image>(loadingObj, "progress");
     loadingImage.fillAmount = 0;
     canApart = false;
 }
Exemple #9
0
    IEnumerator FindUI(string name)
    {
        //寻找目标
        GameObject go = UnityHelper.FindTheChildNode(_canvas, name).gameObject;

        while (go == null)
        {
            yield return(new WaitForSeconds(0.1f));

            Debug.Log("wait");
            go = UnityHelper.FindTheChildNode(_canvas, name).gameObject;
        }

        //高亮
        maskTra = UnityHelper.FindTheChildNode(_canvas, "_UIMaskPanel").transform;
        maskTra.gameObject.SetActive(true);
        maskTra.SetAsLastSibling();
        Canvas canvas = go.AddComponent <Canvas>();

        canvas.overrideSorting = true;
        canvas.sortingOrder    = 1;
        go.AddComponent <GraphicRaycaster>();

        //设置监听
        EventTriggerListener.GetListener(go).onPointerClick += CancelHightLight;
    }
Exemple #10
0
 private void Awake()
 {
     CurrentUIType.UIForms_Type = UIFormType.PopUp;
     RigisterButtonObjectEvent("Btn_Close", p => CloseMessage());
     message = UnityHelper.FindTheChildNode(gameObject, "Content").GetComponent <Text>();
     EventCenter.AddListener <string>(EventDefine.Message, ShowMessage);
 }
Exemple #11
0
 public void UpdateHeroList()
 {
     for (int i = 0; i < 2; i++)
     {
         if (GamingData.heroList[i] != "-1" && GamingData.heroList[i] != "")
         {
             if (UnityHelper.FindTheChildNode(gameObject, GamingData.heroList[i]) == null)
             {
                 GameObject objTemp = Instantiate(Resources.Load <GameObject>("Character(List)"), selectCharacter);
                 objTemp.name = GamingData.heroList[i];
                 objTemp.transform.GetChild(0).GetComponent <Text>().text    = GamingData.heroList[i];
                 objTemp.transform.GetChild(3).GetComponent <Image>().sprite = Resources.Load <Sprite>("Item/102");
                 if (GamingData.heroLT[GamingData.heroList[i]] == 0)
                 {
                     objTemp.transform.GetChild(4).GetComponent <Text>().text = "女性角色";
                 }
                 if (GamingData.heroLT[GamingData.heroList[i]] == 1)
                 {
                     objTemp.transform.GetChild(4).GetComponent <Text>().text = "男性角色";
                 }
                 RigisterButtonObjectEvent(GamingData.heroList[i], p =>
                 {
                     GameSystem.Instance.gamingDataController.SetNickname(objTemp.name);
                     GamingData.heroType = GamingData.heroLT[GamingData.nickname];
                     SetSprite(GamingData.heroType);
                     image.transform.SetParent(objTemp.transform);
                     image.gameObject.SetActive(true);
                     image.rectTransform.localPosition = new Vector3(400, -50, 0);
                 }
                                           );
             }
         }
     }
 }
Exemple #12
0
    private void Awake()
    {
        //设置父节点
        Transform tran         = GameObject.FindGameObjectWithTag(SysDefine.SYS_TAG_CANVAS).transform;
        Transform scriptHolder = UnityHelper.FindTheChildNode(tran.gameObject, SysDefine.SYS_NODE_SCRIPTSMANAGER);

        this.gameObject.transform.SetParent(scriptHolder);
    }
Exemple #13
0
 public override void Execute(INotification notification)
 {
     //游戏重新运行
     GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerControl>().StartGame();
     UnityHelper.FindTheChildNode(GameObject.Find("MainGameScene"), "PipeGroup").GetComponent <PipeMovingControl>().StartGame();
     GameObject.Find("MainGameScene").GetComponent <Ctrl_GetTimer>().StartGame();
     //GameObject.Find("MainGameScene").GetComponent<Ctrl_Golds>().StartGame();
 }
Exemple #14
0
    public override void OnAwake()
    {
        base.OnAwake();

        m_InputName     = UnityHelper.FindTheChildNode(gameObject, "InputName").GetComponent <InputField>();
        m_InputPassword = UnityHelper.FindTheChildNode(gameObject, "InputPassword").GetComponent <InputField>();

        rigisterButtonEvent();
    }
 private void Awake()
 {
     TxtUserName   = UnityHelper.FindTheChildNode(gameObject, "Txt_UserName").GetComponent <Text>();
     TxtGender     = UnityHelper.FindTheChildNode(gameObject, "Txt_Gender").GetComponent <Text>();
     TxtDepartMent = UnityHelper.FindTheChildNode(gameObject, "Txt_Dep").GetComponent <Text>();
     TxtTel        = UnityHelper.FindTheChildNode(gameObject, "Txt_Tel").GetComponent <Text>();
     TxtEmail      = UnityHelper.FindTheChildNode(gameObject, "Txt_Email").GetComponent <Text>();
     _Toggle       = GetComponent <Toggle>();
 }
Exemple #16
0
    private void AddGameObjectScripts()
    {
        GameObject goRoot = GameObject.Find("MainGameScene");

        UnityHelper.FindTheChildNode(goRoot, "LandGroup").gameObject.AddComponent <LandMovingControl>();
        UnityHelper.FindTheChildNode(goRoot, "PipeGroup").gameObject.AddComponent <PipeMovingControl>();
        GameObject.FindGameObjectWithTag("Player").AddComponent <PlayerControl>();
        goRoot.AddComponent <Ctrl_GetTimer>();
    }
Exemple #17
0
    /// <summary>
    /// 注册按钮事件
    /// </summary>
    /// <param name="buttonName">按钮节点名称</param>
    /// <param name="handle">委托:需要注册的方法</param>
    protected void RegisterButtonObjectEvent(string buttonName, EventTriggerListener.VoidDelegate handle)
    {
        GameObject goButton = UnityHelper.FindTheChildNode(gameObject, buttonName).gameObject;

        if (goButton != null)
        {
            EventTriggerListener.Get(goButton).onClick = handle;
        }
    }
Exemple #18
0
    //TODO登陆界面的初始化
    private void Awake()
    {
        if_Username     = UnityHelper.FindTheChildNode(gameObject, "InputField(Username)").GetComponent <InputField>();
        if_Password     = UnityHelper.FindTheChildNode(gameObject, "InputField(Password)_1").GetComponent <InputField>();
        if_Password_two = UnityHelper.FindTheChildNode(gameObject, "InputField(Password)_2").GetComponent <InputField>();

        CurrentUIType.UIForms_ShowMode = UIFormShowMode.ReverseChange;
        RigisterButtonObjectEvent("Button(Register)", p => Register());
        RigisterButtonObjectEvent("Button(Return)", p => Return());
    }
Exemple #19
0
    private void Awake()
    {
        text_Content  = UnityHelper.FindTheChildNode(gameObject, "Msg").GetComponent <Text>();
        image_Log     = UnityHelper.FindTheChildNode(gameObject, "Log").GetComponent <Image>();
        image_Warning = UnityHelper.FindTheChildNode(gameObject, "Warning").GetComponent <Image>();
        image_Error   = UnityHelper.FindTheChildNode(gameObject, "Error").GetComponent <Image>();

        RigisterAllButtonObjectEvent(OnClickButton);
        MessageMgr.AddMsgListener("LatestMsgUIFormMsg", OnMessagesEvent);
    }
Exemple #20
0
    private void Awake()
    {
        mLoopListView = UnityHelper.FindTheChildNode(gameObject, "Viewport").GetComponent <LoopListView2>();
        mLoopListView.InitListView(0, OnGetItemByIndex);

        scrollbar = UnityHelper.FindTheChildNode(gameObject, "Scrollbar").GetComponent <Scrollbar>();

        MessageMgr.AddMsgListener("AllMsgUIFormMsg", OnUIFormMessagesEvent);
        MessageMgr.AddMsgListener(Define.GLOBAL_MESSAGE_TYPE, OnGlobalMessagesEvent);
    }
Exemple #21
0
    /// <summary>
    /// 注册按钮事件
    /// </summary>
    /// <param name="buttonName">按钮节点名称</param>
    /// <param name="delHandle">委托:需要注册的方法</param>
    protected void RigisterButtonObjectEvent(string buttonName, EventTriggerListener.VoidDelegate delHandle)
    {
        GameObject Button = UnityHelper.FindTheChildNode(gameObject, buttonName).gameObject;

        //给按钮注册事件方法
        if (Button != null)
        {
            EventTriggerListener.GetLister(Button).onClick = delHandle;
        }
    }
Exemple #22
0
 private void Awake()
 {
     scrollRect         = UnityHelper.FindTheChildNode(gameObject, "ScrollRect").GetComponent <ScrollRect>();
     scrollRect.enabled = false;
     text_Msg           = UnityHelper.FindTheChildNode(gameObject, "Msg").GetComponent <Text>();
     inputField         = UnityHelper.FindTheChildNode(gameObject, "InputField").GetComponent <InputField>();
     RigisterAllButtonObjectEvent(OnClickButton);
     MessageMgr.AddMsgListener("SelectMsgUIFormMsg", OnMessagesEvent);
     inputField.onValueChanged.AddListener(Change);
     inputField.onEndEdit.AddListener(End);
 }
    public override void OnAwake()
    {
        base.OnAwake();

        m_CoinText            = UnityHelper.FindTheChildNode(gameObject, "Coin").GetComponent <Text>();
        m_CoinText.text       = UserData.Coin.ToString();
        m_CapabilityText      = UnityHelper.FindTheChildNode(gameObject, "Capability").GetComponent <Text>();
        m_CapabilityText.text = m_CapabilityText.text = "战斗力:" + UserData.Capability;

        rigisterButtonEvent();
    }
 private void Awake()
 {
     Item_FirstName  = UnityHelper.FindTheChildNode(gameObject, "Item_FirstName_Text").GetComponent <InputField>();
     Item_LastName   = UnityHelper.FindTheChildNode(gameObject, "Item_LastName_Text").GetComponent <InputField>();
     Tog_Male        = UnityHelper.FindTheChildNode(gameObject, "Tog_Male").GetComponent <Toggle>();
     Tog_Famale      = UnityHelper.FindTheChildNode(gameObject, "Tog_Famale").GetComponent <Toggle>();
     Item_Department = UnityHelper.FindTheChildNode(gameObject, "Item_Department_Text").GetComponent <InputField>();
     Item_Tel        = UnityHelper.FindTheChildNode(gameObject, "Item_Tel_Text").GetComponent <InputField>();
     Item_Email      = UnityHelper.FindTheChildNode(gameObject, "Item_Email_Text").GetComponent <InputField>();
     BtnConfirm      = UnityHelper.FindTheChildNode(gameObject, "BtnConfirm").GetComponent <Button>();
 }
Exemple #25
0
    /// <summary>
    /// 给按钮注册方法
    /// </summary>
    /// <param name="btnName">按钮名称</param>
    /// <param name="dele">委托事件</param>
    protected void RegisterButtonEvent(string btnName, EventTriggerListener.VoidDelegate dele)
    {
        Transform traLoginUISysButton = UnityHelper.FindTheChildNode(this.gameObject, btnName);

        //给按钮注册方法
        if (traLoginUISysButton != null)
        {
            //通过自己写的脚本把事件动态注册到这个按钮上
            EventTriggerListener.Get(traLoginUISysButton.gameObject).onClick = dele;
        }
    }
    public override void ShowTween()
    {
        base.ShowTween();
        monsterTrans = UnityHelper.FindTheChildNode(gameObject, "Monster");
        var canvasGroup = gameObject.AddOrGetComponent <CanvasGroup>();

        canvasGroup.alpha = 0;
        canvasGroup.DOFade(1, 0.5f).onComplete = () =>
        {
            monsterTrans.DOShakeScale(1, 0.5f, 7);
        };
    }
    void Awake()
    {
        EventTriggerListener.GetListener(UnityHelper.FindTheChildNode(gameObject, "Button").gameObject).onPointerClick +=
            (go) => { UIManager.GetInstance().ShowUIForms("EquipPanel"); };
        EventTriggerListener.GetListener(UnityHelper.FindTheChildNode(gameObject, "Button (1)").gameObject).onPointerClick +=
            (go) => { UIManager.GetInstance().ShowUIForms("BagPanel"); };
        EventTriggerListener.GetListener(UnityHelper.FindTheChildNode(gameObject, "Button (2)").gameObject).onPointerClick +=
            (go) => { GuideManager.Instance.Next(); };
        EventTriggerListener.GetListener(UnityHelper.FindTheChildNode(gameObject, "Button (3)").gameObject).onPointerClick +=
            (go) => { GuideManager.Instance.Next(); };

        GuideManager.Instance.Init();
    }
    public override void Execute(PureMVC.Interfaces.INotification notification)
    {
        base.Execute(notification);
        //重新运行
        GameObject.FindGameObjectWithTag("Player").GetComponent <Ctrl_HeroControl>().StartGame();
        //得到层级视图根节点。
        GameObject goEnviromentRoot = GameObject.Find("MainGameScene");

        //管道组停止运行
        UnityHelper.FindTheChildNode(goEnviromentRoot, "GamePips").GetComponent <Ctrl_PipMove>().StartGame();
        //获取时间脚本
        goEnviromentRoot.GetComponent <Ctrl_GetTime>().StartGame();
    }
Exemple #29
0
        /// <summary>
        /// 注册按钮事件
        /// </summary>
        /// <param name="buttonName">按钮的名称</param>
        /// <param name="delHandle">委托的方法</param>
        protected void RigisterButtonObjectEvent(string buttonName, EventTriggerListener.VoidDelegate delHandle)
        {
            GameObject goButton = UnityHelper.FindTheChildNode(this.gameObject, buttonName).gameObject;

            if (goButton != null)
            {
                EventTriggerListener.Get(goButton).onClick = delHandle;
            }
            else
            {
                Debug.LogWarning(GetType() + "/RigisterButtonObjectEvent/add button event is error! button is null!  buttonName:" + buttonName);
            }
        }
Exemple #30
0
    //开始游戏初始化背包
    public void SendBagInfo()
    {
        //更新Bag信息
        rectTransforms = UnityHelper.FindTheChildNode(gameObject, "SlotsGrid").GetComponentsInChildren <BagGrid>();
        Dictionary <int, GridInfo> message = new Dictionary <int, GridInfo>();

        for (int i = 0; i < rectTransforms.Length; i++)
        {
            message.Add(i + 1, new GridInfo(i + 1, rectTransforms[i].GetItem, rectTransforms[i].GetCount));
        }
        //广播更新bagInfo
        EventCenter.Broadcast(EventDefine.UI_SendBagInfo, message);
    }