void Start()
    {
        if (SelectedPart == null)
        {
            SelectedPart = SelectPart(0);
            SelectedParts.Add(SelectedPart);
        }

        PlayerStyle = Shoal.isolated;

        UpdateUI();
    }
Пример #2
0
    void JiraToFishes(string jiraText)
    {
//		Debug.Log(jiraText);
        JSONObject k = new JSONObject(jiraText);

//		debugText.text = "Total: "+k["issues"].Count;
//		CopyTextoToClipboard(jiraText);



        //Add new issues
        for (int i = 0; i < k["issues"].Count; i++)
        {
            string projectName  = k["issues"][i]["fields"]["project"]["name"].str;
            Shoal  currentShoal = GetShoalFromProjectName(projectName);
            if (currentShoal == null)
            {
                GameObject newShoalGO = new GameObject(projectName);
                Shoal      newShoal   = newShoalGO.AddComponent <Shoal>();
                newShoal.Initialize(projectName, newShoalGO, ProjectToColor(projectName));
                shoals.Add(newShoal);
                currentShoal = newShoal;

                GameObject    newProjectUI          = Instantiate(prjectUIPrefab) as GameObject;
                RectTransform newProjectUITransform = newProjectUI.GetComponent <RectTransform>();
                newProjectUITransform.SetParent(projectsUIContainer);
                newProjectUITransform.sizeDelta        = new Vector2(0, 40f);
                newProjectUITransform.anchoredPosition = new Vector2(0, -60f - (shoals.Count - 1) * 40f);
                newProjectUI.GetComponent <UIProject>().SetProject(projectName);
                projectsUI.Add(newProjectUI.GetComponent <UIProject>());

                Debug.Log("new project: " + projectName);
                MonophonicAudio.instance.Play(newProject, 1);
            }
            currentShoal.AddFish(new Issue(k["issues"][i]));
        }


        //Remove done issues
        for (int i = 0; i < shoals.Count; i++)
        {
            for (int j = 0; j < shoals[i].fishes.Count; j++)
            {
                if (!KeyExistInJSON(k, shoals[i].fishes[j].issue.key))
                {
                    Debug.Log("end fish: " + shoals[i].fishes[j].issue.key);
                    shoals[i].RemoveFish(shoals[i].fishes[j].issue.key);
                    MonophonicAudio.instance.Play(endFish, 2);
                }
            }

            if (!ProjectExistInJSON(k, shoals[i].projectName))
            {
                Debug.Log("end project: " + shoals[i].projectName);
                Destroy(projectsUI[i].gameObject);
                projectsUI.RemoveAt(i);
                Destroy(shoals[i].gameObject);
                shoals.RemoveAt(i);

                MonophonicAudio.instance.Play(endProject, 1);
            }
        }
    }