Example #1
0
    public void AddTask()
    {
        Debug.LogWarning("AddTask");

        if (null == m_AddTaskInterfaceHelper)
        {
            return;
        }

        {
            TaskBundle bundle = TaskBundleHelper.CopyFromAddTaskInterfaceHelper(m_AddTaskInterfaceHelper);
            // prepare bundle to upload string
            TaskAddRequest req = new TaskAddRequest();
            req.RequestSerial = m_RequestSerial++;
            req.UpdateSerial  = TaskMauerStaticData.GetUpdateSerial();
            req.ProjectKey    = m_ProjectKey;
            req.Task          = bundle;

            m_RequestList.Add(m_RequestSerial, req);

            StartCoroutine(StartRequestTaskAdd(req));
        }

        m_AddTaskInterfaceHelper.gameObject.SetActive(false);
    }
Example #2
0
    void MouseRelease()
    {
        if (m_SelectedObjDraged)
        {
            if (IsSelected())
            {
                // update position to data
                TaskBundle    bundle = TryFindTaskData(m_SelectedObjTaskID);
                TaskVisualObj visual = TryFindTaskVisual(m_SelectedObjTaskID);
                if (null != visual && null != bundle)
                {
                    if (bundle.Visual.IsPin)
                    {
                        // revert position
                        SetTaskVisual3DFromBundle(visual.m_3DObj, bundle);
                    }
                    else
                    {
                        Vector3 pos = visual.m_3DObj.transform.localPosition;

                        bundle.Visual.PositionStr = string.Format("{0},{1},{2}", pos.x, pos.y, pos.z);

                        // uploading apply change to task
                        TaskAddRequest fetchReq = new TaskAddRequest();
                        fetchReq.UpdateSerial = TaskMauerStaticData.GetUpdateSerial();
                        fetchReq.ProjectKey   = m_ProjectKey;
                        fetchReq.Task         = bundle;

                        StartCoroutine(StartRequestModifyTask(fetchReq));
                    }
                }
            }
            m_SelectedObjDraged = false;
        }
    }
Example #3
0
    public void ConfirmModifyTask()
    {
        Debug.LogWarning("ConfirmModifyTask");
        if (null == m_ModifyTaskInterfaceHelper)
        {
            return;
        }

        TaskBundle bundle = TryFindTaskData(m_SelectedObjTaskID);

        if (null != bundle)
        {
            // uploading apply change to task
            TaskBundle modifyBundle = TaskBundleHelper.CopyFromModifyTaskInterfaceHelper(m_ModifyTaskInterfaceHelper, bundle);

            TaskAddRequest fetchReq = new TaskAddRequest();
            fetchReq.UpdateSerial = TaskMauerStaticData.GetUpdateSerial();
            fetchReq.ProjectKey   = m_ProjectKey;
            fetchReq.Task         = modifyBundle;

            StartCoroutine(StartRequestModifyTask(fetchReq));
        }

        HideModifyTaskInterface();
    }
Example #4
0
    public void FetchTask()
    {
        Debug.LogWarning("FetchTask");
        TaskUpdateRequestBase fetchReq = new TaskUpdateRequestBase();

        fetchReq.UpdateSerial = TaskMauerStaticData.GetUpdateSerial();
        fetchReq.ProjectKey   = m_ProjectKey;
        StartCoroutine(StartRequestFetchTasks(fetchReq));
    }
Example #5
0
    IEnumerator ParseFetchTask(StandardResponse res)
    {
        if (null == res)
        {
            yield break;
        }

        TasksResponse contentObj = null;
        string        content    = res.Content;

        try
        {
            contentObj = JsonUtility.FromJson <TasksResponse>(content);
        }
        catch
        {
            yield break;
        }
        yield return(null);

        Debug.Log("ParseTaskAddResponse contentObj.UpdateSerial=" + contentObj.UpdateSerial);
        Debug.Log("ParseTaskAddResponse contentObj.RequestSerial=" + contentObj.RequestSerial);

        var updateSerial = TaskMauerStaticData.GetUpdateSerial();

        if (contentObj.UpdateSerial > updateSerial)
        {
            TaskMauerStaticData.SetUpdateSerial(contentObj.UpdateSerial);
        }

        if (null == contentObj.TaskVec)
        {
            Debug.LogWarning("null == contentObj.TaskVec");
            yield break;
        }
        Debug.Log("ParseTaskAddResponse contentObj.TaskVec.Length=" + contentObj.TaskVec.Length);

        for (int i = 0; i < contentObj.TaskVec.Length; ++i)
        {
            UpdateTaskBundle(contentObj.TaskVec[i]);
        }
    }