Exemplo n.º 1
0
    public bool CheckGuideTask(int id)
    {
        bool ishas = false;

        if (Globals.Instance.MTeachManager.IsOpenTeach)
        {
            for (int i = 0; i < mBeginnersGuideTaskID.Length; i++)
            {
                Debug.Log("mBeginnersGuideTaskID[i] = " + mBeginnersGuideTaskID[i] + "--Globals.Instance.MTeachManager.NewGetTeachStep(mBeginnersGuideIndex[i]) = " + Globals.Instance.MTeachManager.NewGetTeachStep(mBeginnersGuideIndex[i]));
                if (mBeginnersGuideTaskID[i] == id && Globals.Instance.MTeachManager.NewGetTeachStep(mBeginnersGuideIndex[i]) < mBeginnersGuideValue[i])
                {
                    GUIGuoChang.Hide();

                    GUIMain main = Globals.Instance.MGUIManager.GetGUIWindow <GUIMain>();
                    if (main != null)
                    {
                        main.SetVisible(true);
                        main.SetFunctionState();
                        Globals.Instance.MSceneManager.mMainCamera.enabled = true;
                    }
                    ishas = true;
                }
            }
        }
        return(ishas);
    }
    public void showTaskLables(sg.GS2C_Task_GetLabels_Res res)
    {
        NGUITools.SetActive(npcIcon.transform.parent.gameObject, false);
        string atlasPath = "UIAtlas/" + "Home1";

        textureBackgroundScene.mainTexture = Resources.Load(atlasPath, typeof(Texture2D)) as Texture2D;

        NGUITools.SetActive(SkipBtnAll.gameObject, false);

        Task_Label taskLabelConfig = Globals.Instance.MDataTableManager.GetConfig <Task_Label>();

//		NGUITools.SetActive(TaskDialogGameObject , false);
        NGUITools.SetActive(TaskLabelGameObject, true);

        cacheFatherTaskId = res.fatherTaskId;

        HelpUtil.DelListInfo(TaskLabelGameObject.transform);
        for (int i = 0; i < res.tasks.Count; i++)
        {
            int taskLabelID = res.tasks[i];

            GameObject taskLabelItem = GameObject.Instantiate(taksLableItemPrefab) as GameObject;
            taskLabelItem.transform.parent        = TaskLabelGameObject.transform;
            taskLabelItem.transform.localPosition = LabelItem_Positon[i];
            taskLabelItem.transform.localScale    = Vector3.one;


            UILabel  taskLabel  = taskLabelItem.transform.Find("TaskLabel").GetComponent <UILabel>();
            UISprite needSprite = taskLabelItem.transform.Find("NeedSprite").GetComponent <UISprite>();
            UILabel  needLabel  = needSprite.transform.Find("NeedLabel").GetComponent <UILabel>();

            Task_Label.TaskLabelElement element = taskLabelConfig.GetTaskLabelElement(taskLabelID);
            if (element == null)
            {
                return;
            }
            taskLabel.text = element.Title;
            NGUITools.SetActive(needSprite.gameObject, false);

            UIButton btn = taskLabelItem.transform.GetComponent <UIButton>();
            btn.Data = taskLabelID;
            UIEventListener.Get(btn.gameObject).onClick += OnClickTaskLabelItemBtn;
        }

        GUIGuoChang.Hide();
    }
Exemplo n.º 3
0
    public void StartNextTask(int id, bool isSpendDiamond = false, int fatherTaskId = 0)
    {
        if (Globals.Instance.MGameDataManager.MActorData.starData.IsTimeborrowing)
        {
            GUIGuoChang.Hide();
            return;
        }
        if (CheckGuideTask(id))
        {
            // 如果新手引导 不需要接任务就先加到缓存里面 -- //
            if (id > 0)
            {
                bool ishave = false;
                foreach (sg.GS2C_Task_GetRunning_Res.GetRunning_TaskItem taskitem in Globals.Instance.MGameDataManager.MActorData.MainTaskIDList)
                {
                    if (taskitem.taskId == id)
                    {
                        ishave = true;
                    }
                }
                if (!ishave)
                {
                    sg.GS2C_Task_GetRunning_Res.GetRunning_TaskItem taskitem = new sg.GS2C_Task_GetRunning_Res.GetRunning_TaskItem();
                    taskitem.taskId        = id;
                    taskitem.taskState     = 1;
                    taskitem.taskLastLevel = 0;

                    Globals.Instance.MGameDataManager.MActorData.MainTaskIDList.Add(taskitem);
                }
            }
            GUITaskTalkView taskview = Globals.Instance.MGUIManager.GetGUIWindow <GUITaskTalkView>();
            if (taskview != null)
            {
                taskview.DestroyThisGUI();
            }
            GUIGuoChang.Hide();
            return;
        }

        if (id == 0)
        {
            GUITravel guiTravel = Globals.Instance.MGUIManager.GetGUIWindow <GUITravel>();
            if (guiTravel != null)
            {
                guiTravel.Close();
            }
            else
            {
                GUIMain main = Globals.Instance.MGUIManager.GetGUIWindow <GUIMain>();
                if (main != null)
                {
                    main.SetVisible(true);
                    Globals.Instance.MSceneManager.mMainCamera.enabled = true;
                }
            }
            GUIGuoChang.Hide();
            Globals.Instance.MTaskManager.mTaskDailyData.NextTaskId = 0;
            return;
        }


        NetSender.Instance.RequestTaskAcceptReq(id, isSpendDiamond, 0, fatherTaskId);
    }