示例#1
0
    // Use this for initialization
    void Start()
    {
        map = WMSK.instance;


        map.OnProvinceClick += (int provinceIndex, int regionIndex, int buttonIndex) => Debug.Log("Clicked province " + map.provinces[provinceIndex].name);


        map.OnClick += (float x, float y, int buttonIndex) => {
            if (buttonIndex == 1)
            {
                return;
            }
            Vector2 provincePosition = new Vector2(x, y);
            if (map.ContainsWater(provincePosition))
            {
                Debug.Log("Yes, water!");
            }
            else
            {
                Debug.Log("Land");
            }
            int clickedIndex = map.GetProvinceIndex(provincePosition);
            assemblyCsharp.Province clickedProvince = provinces[clickedIndex];
            int provinceOwner = clickedProvince.getOwnerIndex();
            //  Debug.Log("Province Culture: " + clickedProvince.getCulture());
            Nation owner = nations[provinceOwner];
            Debug.Log("Nation name " + owner.getName());
            if (map.VGOLastHighlighted == null)
            {
                if (SelfProvinceGUI.activeSelf)
                {
                    SelfProvinceGUI.SetActive(false);
                }

                if (OtherProvinceGUI.activeSelf)
                {
                    OtherProvinceGUI.SetActive(false);
                }


                if (owner.IsHuman())
                {
                    ThisFillInData(clickedProvince);

                    SelfProvinceGUI.SetActive(true);
                }
                else
                {
                    NationName.text = owner.getName();
                    ThatFillInData(clickedProvince);
                    OtherProvinceGUI.SetActive(true);
                }
            }
        };
        upgradeDevelopment.onClick.AddListener(delegate { UpgradeDevelopment(); });
        upgradeRailway.onClick.AddListener(delegate { UpgradeRailway(); });
        upgradeFort.onClick.AddListener(delegate { UpgradeFort(); });
    }
示例#2
0
    // Use this for initialization
    void Start()
    {
        map = WMSK.instance;


        map.OnClick += (float x, float y, int buttonIndex) =>
        {
            if (buttonIndex == 1)
            {
                return;
            }
            Vector2 provincePosition = new Vector2(x, y);
            int     clickedIndex     = map.GetProvinceIndex(provincePosition);
            if (map.ContainsWater(provincePosition))
            {
                return;
            }
            assemblyCsharp.Province clickedProvince = provinces[clickedIndex];
            int    provinceOwner = clickedProvince.getOwnerIndex();
            Nation owner         = nations[provinceOwner];
            //   Debug.Log("That 51");

            if (map.VGOLastHighlighted == null)
            {
                if (SelfProvinceGUI.activeSelf)
                {
                    SelfProvinceGUI.SetActive(false);
                }

                if (OtherProvinceGUI.activeSelf)
                {
                    OtherProvinceGUI.SetActive(false);
                }

                if (!owner.IsHuman())
                {
                    //     Debug.Log("That 69");
                    ThatFillInData(clickedProvince);
                    OtherProvinceGUI.SetActive(true);
                }
            }
        };
    }