Beispiel #1
0
    // Update is called once per frame
    void Update()
    {
        if (target == null)
        {
            target = targetName == null ? null : map.countries[map.GetCountryIndex(targetName)];
            return;
        }

        if (target.data.eventQueue.Count <= 6)
        {
            int i = 0;
            for (; i < target.data.eventQueue.Count; i++)
            {
                sprites [i].sprite = archive.getSprite(target.data.eventQueue [target.data.eventQueue.Count - 1 - i]);
            }
            for (; i < 6; i++)
            {
                sprites [i].sprite = null;
            }
        }
        else
        {
            for (int i = 0; i < 6; i++)
            {
                sprites [i].sprite = archive.getSprite(target.data.eventQueue [target.data.eventQueue.Count - 1 - i]);
            }
            // ADD new ... icon
        }
    }
Beispiel #2
0
    private void updateOngoingIcons()
    {
        if (modeChange || indexChange)
        {
            if (mode == displayMode.IconList && countryIndex != -1)
            {
                //enable all icons
                for (int i = 0; i < 14; i++)
                {
                    if (data.genericQueue.Contains(((eventNumber)i).ToString()))
                    {
                        icons [i].GetComponent <Image> ().color = normalColor;
                        iconStatus [i] = true;
                    }
                    else
                    {
                        icons [i].GetComponent <Image> ().color = disabledColor;
                        iconStatus [i] = false;
                    }
                    iconBoxs [i].GetComponent <HoldToDisplay> ().setName(((eventNumber)i).ToString());
                }

                if (data.genericQueue.Contains("RiotGenre"))
                {
                    updateRiotGenre();
                }
                if (data.genericQueue.Contains("WarGenre"))
                {
                    updateWarGenre();
                }
                if (data.genericQueue.Contains("FinancialGenre"))
                {
                    updateFinancialGenre();
                }
            }
            else
            {
                //disable icons
                for (int i = 0; i < 14; i++)
                {
                    icons [i].GetComponent <Image> ().color = transparentColor;
                    iconBoxs [i].GetComponent <HoldToDisplay> ().setName("temp");
                }
                icons [0].GetComponent <Image> ().sprite = archive.getSprite("Riot");
                icons [1].GetComponent <Image> ().sprite = archive.getSprite("Skirmish");
                icons [2].GetComponent <Image> ().sprite = archive.getSprite("Inflation");
            }
        }
        else
        {
            //update each icon
            if (mode == displayMode.IconList && countryIndex != -1)
            {
                for (int i = 3; i < 14; i++)
                {
                    if (iconStatus [i])
                    {
                        //Icon i is enabled
                        if (!data.genericQueue.Contains(((eventNumber)i).ToString()))
                        {
                            icons [i].GetComponent <Image> ().color = disabledColor;
                            iconStatus [i] = false;
                        }
                    }
                    else
                    {
                        //Icon i is disabled
                        if (data.genericQueue.Contains(((eventNumber)i).ToString()))
                        {
                            icons [i].GetComponent <Image> ().color = normalColor;
                            iconStatus [i] = true;
                        }
                    }
                }

                //Update RiotGenre
                if (iconStatus [0])
                {
                    //Icon i is enabled
                    if (!data.genericQueue.Contains("RiotGenre"))
                    {
                        icons [0].GetComponent <Image> ().sprite = archive.getSprite("Riot");
                        icons [0].GetComponent <Image> ().color  = disabledColor;
                        iconStatus [0] = false;
                    }
                    else if (!data.eventQueue.Contains(prevGenerics [0]))
                    {
                        updateRiotGenre();
                    }
                }
                else
                {
                    //Icon i is disabled
                    if (data.genericQueue.Contains("RiotGenre"))
                    {
                        updateRiotGenre();
                        icons [0].GetComponent <Image> ().color = normalColor;
                        iconStatus [0] = true;
                    }
                }

                //Update WarGenre
                if (iconStatus [1])
                {
                    //Icon i is enabled
                    if (!data.genericQueue.Contains("WarGenre"))
                    {
                        icons [1].GetComponent <Image> ().sprite = archive.getSprite("Skirmish");
                        icons [1].GetComponent <Image> ().color  = disabledColor;
                        iconStatus [1] = false;
                    }
                    else if (!data.eventQueue.Contains(prevGenerics [1]))
                    {
                        updateWarGenre();
                    }
                }
                else
                {
                    //Icon i is disabled
                    if (data.genericQueue.Contains("WarGenre"))
                    {
                        updateWarGenre();
                        icons [1].GetComponent <Image> ().color = normalColor;
                        iconStatus [1] = true;
                    }
                }

                //Update FinancialGenre
                if (iconStatus [2])
                {
                    //Icon i is enabled
                    if (!data.genericQueue.Contains("FinancialGenre"))
                    {
                        icons [2].GetComponent <Image> ().sprite = archive.getSprite("Inflation");
                        icons [2].GetComponent <Image> ().color  = disabledColor;
                        iconStatus [2] = false;
                    }
                    else if (!data.eventQueue.Contains(prevGenerics [2]))
                    {
                        updateFinancialGenre();
                    }
                }
                else
                {
                    //Icon i is disabled
                    if (data.genericQueue.Contains("FinancialGenre"))
                    {
                        updateFinancialGenre();
                        icons [2].GetComponent <Image> ().color = normalColor;
                        iconStatus [2] = true;
                    }
                }
            }
        }
    }