Esempio n. 1
0
    public void NoMissionShow()
    {
        NGUITools.SetActive(MainMission, false);
        NGUITools.SetActive(FriendsView, false);
        NGUITools.SetActive(NoMissionInfo, true);
        GameObject NoInfo    = NoMissionInfo.transform.Find("CityInfoMation").gameObject;
        UILabel    CityName  = NoInfo.transform.Find("CityNameLabel").GetComponent <UILabel>();
        UILabel    NumLabel  = NoInfo.transform.Find("MissionNumLabel").GetComponent <UILabel>();
        UILabel    TimeLabel = NoInfo.transform.Find("TimeLabel").GetComponent <UILabel>();

        Map_Citys MapCity = Globals.Instance.MDataTableManager.GetConfig <Map_Citys>();

        Map_Citys.Map_CitysObject MapObj = MapCity.GetMap_CitysObjectByID(Globals.Instance.MTaskManager.mTaskDailyData.CurrentCityID);
        if (MapObj == null)
        {
            return;
        }
        CityName.text = MapObj.Citys_Name;
        NumLabel.text = "0";
    }
Esempio n. 2
0
    public void ShowMissionList(sg.GS2C_Enter_City_Res res)
    {
        mMissionItemList.Clear();
        Globals.Instance.MSceneManager.ChangeCameraActiveState(SceneManager.CameraActiveState.MAINCAMERA);
        this.SetVisible(true);
        if (res.cityId == 9)
        {
            CityInforDaily.text = res.taskLis.Count.ToString() + "/" + 20;
            NGUITools.SetActive(CityInfor.gameObject, false);
            NGUITools.SetActive(CityInforDaily.gameObject, true);
        }
        else
        {
            NGUITools.SetActive(CityInforDaily.gameObject, false);
            NGUITools.SetActive(CityInfor.gameObject, true);
        }
        NGUITools.SetActive(FriendsView, false);
        NGUITools.SetActive(NoMissionInfo, false);

        mRefreshTaskSpendMoney = res.refreshMoney;
        mRefreshTaskCount      = res.refreshCount;
        Globals.Instance.MTaskManager.mTaskDailyData.CurrentCityID = res.cityId;
        Map_Citys MapCity = Globals.Instance.MDataTableManager.GetConfig <Map_Citys>();

        Map_Citys.Map_CitysObject MapObj = MapCity.GetMap_CitysObjectByID(res.cityId);
        if (MapObj == null)
        {
            return;
        }

        CityNameLabel.text   = MapObj.Citys_Name;
        MissionNumLabel.text = res.taskLis.Count.ToString();
        HelpUtil.DelListInfo(MainTable.transform);

        foreach (sg.GS2C_Enter_City_Res.completedTask completetask in res.compLis)
        {
            GameObject completeMissionObj = GameObject.Instantiate(CompleteMissionItemPrefab) as GameObject;
            completeMissionObj.transform.parent        = MainTable.transform;
            completeMissionObj.transform.localScale    = Vector3.one;
            completeMissionObj.transform.localPosition = new Vector3(0, 0, 0);
            GameObject completeMissionBase = completeMissionObj.transform.Find("MissionBase").gameObject;
            GameObject completeStars       = completeMissionBase.transform.Find("Stars").gameObject;
            GameObject completeTween       = completeMissionObj.transform.Find("Tween").gameObject;
            NGUITools.SetActive(completeTween.gameObject, false);
            //基础信息-----//
            UISprite rankSprite     = completeMissionBase.transform.Find("Rank").GetComponent <UISprite>();
            UISprite PassSprite     = completeMissionBase.transform.Find("Pass").GetComponent <UISprite>();
            UISprite SexSprite      = completeMissionBase.transform.Find("SexSprite").GetComponent <UISprite>();
            UILabel  JingLiNumLabel = completeMissionBase.transform.Find("JingLiNumLabel").GetComponent <UILabel>();
            UILabel  NameLabel      = completeMissionBase.transform.Find("NameLabel").GetComponent <UILabel>();
            UIButton DareButton     = completeMissionBase.transform.Find("DareButton").GetComponent <UIButton>();
            //详细信息---//
            UILabel  completeMissionBriefing = completeTween.transform.Find("MissionBriefingLabel").GetComponent <UILabel>();
            UILabel  completeMoneyLabel      = completeTween.transform.Find("MoneyLabel").GetComponent <UILabel>();
            UILabel  completeFansLabel       = completeTween.transform.Find("FansLabel").GetComponent <UILabel>();
            UILabel  completeNoRewardLabel   = completeTween.transform.Find("NoRewardLabel").GetComponent <UILabel>();
            UIButton completeRankButton      = completeTween.transform.Find("RankButton").GetComponent <UIButton>();

            Task            comtask         = Globals.Instance.MDataTableManager.GetConfig <Task>();
            Task.TaskObject completeElement = null;
            bool            hasData         = comtask.GetTaskObject(completetask.taskId, out completeElement);
            if (!hasData)
            {
                Debug.Log(" completetask  ================  Null" + completetask.taskId);
                return;
            }
            completeMissionObj.name = "AMission" + completetask.taskId;
            rankSprite.spriteName   = HangyeDengji[FinalEvaluation(completetask.level)];
            PassSprite.spriteName   = FinalEvaluation(completetask.level) == 4 ? "IconManfen":"IconPass";
            SexSprite.spriteName    = completeElement.Sex_Icon;

            NameLabel.text = completeElement.Name;
            completeMissionBriefing.text = completeElement.Task_Desc;

            if (FinalEvaluation(completetask.level) == 0 && completeElement.Progress_Count <= 0)
            {
                NGUITools.SetActive(completeStars, false);
                NGUITools.SetActive(rankSprite.gameObject, false);
            }
            else
            {
                string[] stars  = { "Green", "Blue", "Purple", "Red", "Yellow" };
                string[] starBg = { "GreenBg", "BlueBg", "PurpleBg", "RedBg", "YellowBg" };
                for (int i = 0; i < 5; i++)
                {
                    UISprite currentStar   = completeStars.transform.Find(stars[i]).GetComponent <UISprite>();
                    UISprite currentStarbg = completeStars.transform.Find(starBg[i]).GetComponent <UISprite>();

                    if (i <= FinalEvaluation(completetask.level))
                    {
                        NGUITools.SetActive(currentStarbg.gameObject, false);
                        NGUITools.SetActive(currentStar.gameObject, true);
                    }
                    else
                    {
                        NGUITools.SetActive(currentStarbg.gameObject, true);
                        NGUITools.SetActive(currentStar.gameObject, false);
                    }
                }
            }


            NGUITools.SetActive(completeMoneyLabel.gameObject, false);
            NGUITools.SetActive(completeFansLabel.gameObject, false);
            NGUITools.SetActive(completeNoRewardLabel.gameObject, false);
            List <string[]> RewardArray = ParsingRewards(completeElement.Rewards);
            if (!completetask.costEnergy)
            {
                NGUITools.SetActive(JingLiNumLabel.gameObject, false);
                NGUITools.SetActive(completeNoRewardLabel.gameObject, true);
            }
            else
            {
                JingLiNumLabel.text = "-" + completeElement.Need_Energy.ToString();
                NGUITools.SetActive(JingLiNumLabel.gameObject, true);

                bool isReward = false;
                for (int i = 0; i < RewardArray.Count; i++)
                {
                    switch (StrParser.ParseDecInt(RewardArray[i][0], -1))
                    {
                    case (int)TaskRewardTypeEnum.ROLE_ATTR:
                        switch (StrParser.ParseDecInt(RewardArray[i][1], -1))
                        {
                        case (int)BaseRewardType.MONEY:
                            isReward = true;
                            NGUITools.SetActive(completeMoneyLabel.gameObject, true);
                            completeMoneyLabel.text = (StrParser.ParseDecInt(RewardArray[i][2], -1) / 2.0 == StrParser.ParseDecInt(RewardArray[i][2], -1) / 2? StrParser.ParseDecInt(RewardArray[i][2], -1) / 2: StrParser.ParseDecInt(RewardArray[i][2], -1) / 2 + 1).ToString();
                            break;
                        }
                        break;

                    case (int)TaskRewardTypeEnum.FANS_NUM:
                        isReward = true;
                        NGUITools.SetActive(completeFansLabel.gameObject, true);
                        completeFansLabel.text = (StrParser.ParseDecInt(RewardArray[i][2], -1) / 2.0 == StrParser.ParseDecInt(RewardArray[i][2], -1) / 2? StrParser.ParseDecInt(RewardArray[i][2], -1) / 2: StrParser.ParseDecInt(RewardArray[i][2], -1) / 2 + 1).ToString();
                        break;
                    }
                }
                if (!isReward)
                {
                    NGUITools.SetActive(completeNoRewardLabel.gameObject, true);
                }
            }


            DareButton.Data = completetask;
            UIEventListener.Get(DareButton.gameObject).onClick += OnClickChallengeAgain;
        }


        foreach (sg.GS2C_Enter_City_Res.visibleTask taskInfo in res.taskLis)
        {
            GameObject MissionObj = GameObject.Instantiate(MissionItemPrefab) as GameObject;
            MissionObj.transform.parent        = MainTable.transform;
            MissionObj.transform.localScale    = Vector3.one;
            MissionObj.transform.localPosition = new Vector3(0, 0, 0);
            UIToggle   Toggle      = MissionObj.transform.GetComponent <UIToggle>();
            GameObject MissionBase = MissionObj.transform.Find("MissionBase").gameObject;
            GameObject Tween       = MissionObj.transform.Find("Tween").gameObject;
            UISprite   Unlocked    = MissionObj.transform.Find("Unlocked").GetComponent <UISprite>();

            //基础信息-----//
            UITexture GradeTexture   = MissionBase.transform.Find("GradeTexture").GetComponent <UITexture>();
            UISprite  IssuedSprite   = MissionBase.transform.Find("IssuedSprite").GetComponent <UISprite>();
            UISprite  SexSprite      = MissionBase.transform.Find("SexSprite").GetComponent <UISprite>();
            UILabel   JingLiNumLabel = MissionBase.transform.Find("JingLiNumLabel").GetComponent <UILabel>();
            UILabel   NameLabel      = MissionBase.transform.Find("NameLabel").GetComponent <UILabel>();
            UIButton  DareButton     = MissionBase.transform.Find("DareButton").GetComponent <UIButton>();

            //详细信息---//
            UILabel   MissionBriefingLabel = Tween.transform.Find("MissionBriefingLabel").GetComponent <UILabel>();
            UILabel   MoneyLabel           = Tween.transform.Find("MoneyLabel").GetComponent <UILabel>();
            UILabel   FansLabel            = Tween.transform.Find("FansLabel").GetComponent <UILabel>();
            UILabel   DiamondLabel         = Tween.transform.Find("DiamondLabel").GetComponent <UILabel>();
            UILabel   NoRewardLabel        = Tween.transform.Find("NoRewardLabel").GetComponent <UILabel>();
            UITexture RewardItemOne        = Tween.transform.Find("RewardItemOne").GetComponent <UITexture>();
            UITexture RewardItemTwo        = Tween.transform.Find("RewardItemTwo").GetComponent <UITexture>();
            UIButton  ChangeButton         = Tween.transform.Find("ChangeButton").GetComponent <UIButton>();



            //未解锁信息--//
            UILabel LockLabel = Unlocked.transform.Find("LockLabel").GetComponent <UILabel>();
            UILabel TimeLabel = Unlocked.transform.Find("TimeLabel").GetComponent <UILabel>();

            Task            task    = Globals.Instance.MDataTableManager.GetConfig <Task>();
            Task.TaskObject element = null;
            bool            hasData = task.GetTaskObject(taskInfo.taskId, out element);
            if (!hasData)
            {
                Debug.Log(" Task  ================  Null" + taskInfo.taskId);
                return;
            }


            SexSprite.spriteName = element.Sex_Icon;

            if (element.Task_Category == (int)TaskCategoryEnum.DAILY)
            {
                NGUITools.SetActive(ChangeButton.gameObject, true);
            }
            else
            {
                NGUITools.SetActive(ChangeButton.gameObject, false);
            }

            if (element.Publish_Type == -1)
            {
                NGUITools.SetActive(IssuedSprite.gameObject, false);
            }
            else
            {
                NGUITools.SetActive(IssuedSprite.gameObject, true);
            }

            NameLabel.text      = element.Name;
            JingLiNumLabel.text = "-" + element.Need_Energy.ToString();

            NGUITools.SetActive(Tween.gameObject, false);
            if (taskInfo.isLock)
            {
                MissionObj.name = "CMission" + taskInfo.taskId;
                NGUITools.SetActive(Unlocked.gameObject, true);

                BoxCollider BtnBox = DareButton.gameObject.transform.GetComponent <BoxCollider>();
                Destroy(BtnBox);
                // 解锁条件 -- //
                if (taskInfo.remainTime > 0)
                {
                    TimeLabel.text = taskInfo.remainTime.ToString();
                }
                else
                {
                    NGUITools.SetActive(TimeLabel.gameObject, false);
                }


                foreach (sg.BI_Condition condition in taskInfo.unlockConditions)
                {
                    switch (condition.type)
                    {
                    case (int)TaskRequireVisibleTypeEnum.SEXLIMIT:
                        LockLabel.text = "1";
                        break;

                    case (int)TaskRequireVisibleTypeEnum.ITEMCOUNT:
                        LockLabel.text = "2";
                        break;

                    case (int)TaskRequireVisibleTypeEnum.BEFORETASKID:

                        Task.TaskObject Specify     = null;
                        bool            SpecifyBool = task.GetTaskObject(condition.itemId, out Specify);
                        if (!SpecifyBool)
                        {
                            return;
                        }
                        LockLabel.text = Specify.Name;
                        break;

                    case (int)TaskRequireVisibleTypeEnum.ROLEATTR:
                        break;

                    case (int)TaskRequireVisibleTypeEnum.HAVEARTIST:
                        break;

                    case (int)TaskRequireVisibleTypeEnum.FANSNUM:
                        break;
                    }
                }

                UIButton btn = MissionObj.transform.GetComponent <UIButton>();
                btn.onClick.Clear();
                TweenHeight th = MissionObj.transform.GetComponent <TweenHeight>();
                Destroy(th);
                TweenRotation tr = MissionObj.transform.Find("Picture").transform.Find("ArrowObject").transform.GetComponent <TweenRotation>();
                Destroy(tr);
            }
            else
            {
                int RewardItemState = 0;
                MissionObj.name = "BMission" + taskInfo.taskId;
                NGUITools.SetActive(Unlocked.gameObject, false);
                //已经解锁、 详细信息赋值//

                MissionBriefingLabel.text = element.Task_Desc;
                NGUITools.SetActive(MoneyLabel.gameObject, false);
                NGUITools.SetActive(FansLabel.gameObject, false);
                NGUITools.SetActive(DiamondLabel.gameObject, false);
                NGUITools.SetActive(RewardItemOne.gameObject, false);
                NGUITools.SetActive(RewardItemTwo.gameObject, false);
                NGUITools.SetActive(NoRewardLabel.gameObject, false);


                List <string[]> RewardArray = ParsingRewards(element.Rewards);
                if (RewardArray.Count <= 0)
                {
                    NGUITools.SetActive(NoRewardLabel.gameObject, true);
                }
                else
                {
                    for (int i = 0; i < RewardArray.Count; i++)
                    {
                    }
                }
            }
            Toggle.Data = taskInfo.isLock;
            UIEventListener.Get(Toggle.gameObject).onClick += OnClickToggle;
            ChangeButton.Data = taskInfo.taskId;
            UIEventListener.Get(ChangeButton.gameObject).onClick += OnClickChangeButton;
            DareButton.Data = taskInfo.taskId;
            UIEventListener.Get(DareButton.gameObject).onClick += OnClickDareButton;

            mMissionItemList.Add(taskInfo.taskId, MissionObj);
        }

        MainTable.repositionNow = true;
//		MainScrollView.ResetPosition();//

        int completeNum = res.compLis.Count;
        int unfinishNum = res.taskLis.Count;

        if ((completeNum + unfinishNum) * 300 > 1482)
        {
            if (unfinishNum * 300 > 1482)
            {
                MainScrollView.Press(true);
                SpringPanel.Begin(MainScrollView.gameObject, new Vector3(-8, completeNum * 300 + 738, 0), 13);
            }
            else
            {
                MainScrollView.Press(true);
                SpringPanel.Begin(MainScrollView.gameObject, new Vector3(-8, (completeNum * 300 + unfinishNum * 300 - 744), 0), 13);
            }
        }


        if (Globals.Instance.MTaskManager.mTaskDailyData.NextTaskId != 0)
        {
        }
    }