예제 #1
0
 /// <summary>
 /// 填充数据
 /// </summary>
 /// <param name="_info"></param>
 public void FillInfo(LittleHelperRef _info)
 {
     if (_info == null)
     {
         littleHelperRef = null;
         return;
     }
     else
     {
         littleHelperRef = _info;
     }
     Refresh();
 }
예제 #2
0
    public void Refresh()
    {
        int num = 0;

        for (int i = 0; i < littleHelperTogs.Length; i++)
        {
            if (littleHelperTogs[i].value)
            {
                //GameCenter.littleHelperMng.NeedType = (LittleHelpType)i;
                num = i;
            }
        }
        if (!GameCenter.littleHelperMng.LittleHelperDic.ContainsKey(num + 1))
        {
            return;
        }
        if (GameCenter.littleHelperMng.LittleHelperDic[num + 1].Count < 1)
        {
            return;
        }
        DestroyItem();
        Vector3 V3 = Vector3.zero;

        for (int i = 0; i < GameCenter.littleHelperMng.LittleHelperDic[num + 1].Count; i++)
        {
            LittleHelperRef littleHelper = GameCenter.littleHelperMng.LittleHelperDic[num + 1][i];
            TaskInfo        curTask      = GameCenter.taskMng.GetMainTaskInfo();
            if ((curTask != null && littleHelper != null && littleHelper.TaskId.Count > 1))
            {
                //Debug.Log(" step :   " + curTask.Step + "  taskId :  " + littleHelper.TaskId[1]);
                if (curTask.Step >= littleHelper.TaskId[1])//该条任务已经完成功能已经开启
                {
                    GameObject obj = Instantiate(exResources.GetResource(ResourceType.GUI, "SetUp/LittleHelperItem")) as GameObject;
                    if (obj != null)
                    {
                        obj.transform.parent        = grid.transform;
                        obj.transform.localPosition = V3;
                        obj.transform.localScale    = Vector3.one;
                        obj.GetComponent <LittleHelperItem>().FillInfo(littleHelper);
                        V3 = new Vector3(V3.x, V3.y - 105, V3.z);
                    }
                    obj = null;
                }
            }
            else//主线任务做完
            {
                if (littleHelper != null && littleHelper.TaskId.Count > 0)
                {
                    bool isMainTakEnded = GameCenter.taskMng.IsTaskEnded(littleHelper.TaskId[0], TaskType.Main);
                    if (isMainTakEnded)
                    {
                        GameObject obj = Instantiate(exResources.GetResource(ResourceType.GUI, "SetUp/LittleHelperItem")) as GameObject;
                        if (obj != null)
                        {
                            obj.transform.parent        = grid.transform;
                            obj.transform.localPosition = V3;
                            obj.transform.localScale    = Vector3.one;
                            obj.GetComponent <LittleHelperItem>().FillInfo(littleHelper);
                            V3 = new Vector3(V3.x, V3.y - 105, V3.z);
                        }
                        obj = null;
                    }
                }
            }
        }
    }