Beispiel #1
0
 private void FollowMonster()
 {
     if (m_FollwNode)
     {
         m_FollowRectTsf.anchoredPosition = UiTools.WorldToRectPos(gameObject, m_FollwNode.position, m_ParentRectTsf);
     }
 }
        public override void Init <T>(string name, UIInfo info, T arg)
        {
            base.Init(name, info, arg);
            m_NpcBehavior = arg as NpcBehavior;
            Canvas        parentCanvas  = GetComponentInParent <Canvas>();
            RectTransform parentRectTsf = parentCanvas.GetComponent <RectTransform>();

            m_AdaptNode.rectTransform.anchoredPosition = UiTools.WorldToRectPos(gameObject, m_NpcBehavior.GetTaskUINode().position, parentRectTsf);
            GenerateRecycleMat();
            InitNode();
            base.ChangeLanguage();
        }
Beispiel #3
0
        public void Init(Transform adaptNode, int npcIndex, Action <int, GunCard_TableItem, bool, bool> callback)
        {
            m_NpcIndex = npcIndex;
            m_Callback = callback;
            pointData  = CampsiteMgr.singleton.GetPointByIndex(npcIndex);
            GunCard_TableItem gunData = null;

            if (pointData.equipGunId > 0)
            {
                gunData = TableMgr.singleton.GunCardTable.GetItemByID(pointData.equipGunId);
            }
            InitWeaponDropDown(pointData.buildingRes.gunType);
            SetTestValues(gunData, false, false);
            m_TitleText.text.text = string.Format("npc{0}, lv{1}", npcIndex + 1, pointData.Lv);
            m_TaskAdaptNode.rectTransform.anchoredPosition = UiTools.WorldToRectPos(gameObject, adaptNode.position, m_CanvasRect);
        }
Beispiel #4
0
 public void SetPos(Vector3 pos, RectTransform rectTransform)
 {
     gameObject.GetComponent <RectTransform>().anchoredPosition = UiTools.WorldToRectPos(gameObject, pos, rectTransform);
 }
        public void InitDetailsInfo(NpcQuestItemDTO taskItem, int taskIndex, Transform adaptNode, Action closeCallBack)
        {
            m_CloseCallBack = closeCallBack;
            m_TaskIndex     = taskIndex;
            m_FollowRectTsf.anchoredPosition = UiTools.WorldToRectPos(gameObject, adaptNode.position, m_ParentRectTsf);
            CampTasksItem campTasksItem = Global.gApp.gGameData.CampTasksConfig.Get(taskItem.npcQuestId);

            if (campTasksItem != null)
            {
                TitleText.text.text             = Global.gApp.gGameData.GetTipsInCurLanguage(campTasksItem.title);
                prNum.text.text                 = ((int)taskItem.cur).ToString() + "/" + campTasksItem.taskCondition[2].ToString();
                m_passProgress.image.fillAmount = (float)taskItem.cur / campTasksItem.taskCondition[2];


                ItemItem conditonItem = Global.gApp.gGameData.ItemData.Get((int)campTasksItem.taskCondition[1]);
                if (conditonItem != null)
                {
                    taskIcon.image.sprite = Resources.Load(conditonItem.image_grow, typeof(Sprite)) as Sprite;
                }
                else
                {
                    if (campTasksItem.taskCondition[0] == FilterTypeConstVal.KILL_ZOMBIE)
                    {
                        taskIcon.image.sprite = Resources.Load(CommonResourceConstVal.CAMP_KILL_ICON, typeof(Sprite)) as Sprite;
                    }
                    else if (campTasksItem.taskCondition[0] == FilterTypeConstVal.GET_ITEM_BY_TYPE)
                    {
                        taskIcon.image.sprite = Resources.Load(CommonResourceConstVal.CAMP_GET_TYPE_ITEM_ICON, typeof(Sprite)) as Sprite;
                    }
                    else
                    {
                        taskIcon.image.sprite = Resources.Load(CommonResourceConstVal.CAMP_KILL_ICON, typeof(Sprite)) as Sprite;
                    }
                }
                ItemItem rewardItem = Global.gApp.gGameData.ItemData.Get(int.Parse(campTasksItem.reward[0]));
                if (rewardItem != null)
                {
                    icon.image.sprite = Resources.Load(rewardItem.image_grow, typeof(Sprite)) as Sprite;
                }
                if (rewardItem.id == SpecialItemIdConstVal.GOLD)
                {
                    double          itemNum = double.Parse(campTasksItem.reward[1]);
                    Gold_paramsItem cfg     = Global.gApp.gGameData.GoldParamsConfig.Get(Global.gApp.gSystemMgr.GetBaseAttrMgr().GetLevel());
                    itemNum      *= cfg.coinParams;
                    Num.text.text = UiTools.FormateMoneyUP(itemNum);
                }
                else
                {
                    Num.text.text = UiTools.FormateMoneyUP(double.Parse(campTasksItem.reward[1]));
                }
            }
            if (taskItem.state == NpcState.UnReceived)
            {
                WaitRewardBtn.gameObject.SetActive(false);
                RewardBtn.gameObject.SetActive(true);
                RewardBtn.button.onClick.AddListener(ReceiveReward);
            }
            else
            {
                WaitRewardBtn.gameObject.SetActive(true);
                RewardBtn.gameObject.SetActive(false);
            }
        }