Beispiel #1
0
        static bool Postfix(bool __result, GameAreaManager __instance, int x, int z)
        {
            try
            {
                if (ModConfig.Instance.PurchasableWithoutMilestones)
                {
                    if (x < 0 || z < 0 || x >= 5 || z >= 5)
                    {
                        return(false);
                    }

                    bool result = __instance.IsUnlocked(x, z - 1) || __instance.IsUnlocked(x - 1, z) || __instance.IsUnlocked(x + 1, z) || __instance.IsUnlocked(x, z + 1);
                    __instance.m_AreasWrapper.OnCanUnlockArea(x, z, ref result);
                    return(result);
                }
                else
                {
                    return(__result);
                }
            }
            catch (Exception e)
            {
                Debug.Log("[Purchase It!] GameAreaManagerCanUnlockPatch:Postfix -> Exception: " + e.Message);
                return(__result);
            }
        }
        private static IEnumerator Purchase(int x, int y)
        {
            try
            {
                GameAreaManager gameAreaManager = Singleton <GameAreaManager> .instance;

                if (gameAreaManager != null)
                {
                    if (!gameAreaManager.IsUnlocked(x, y))
                    {
                        int tileIndex = gameAreaManager.GetTileIndex(x, y);
                        gameAreaManager.UnlockArea(tileIndex);
                    }
                }
            }
            catch (Exception e)
            {
                Debug.Log("[Rebuild It!] PurchaseUtils:Purchase -> Exception: " + e.Message);
            }

            yield return(null);
        }
Beispiel #3
0
        public void CalculateUnlockedResources(out uint ore, out uint oil, out uint forest, out uint fertility, out uint water)
        {
            ore       = 0U;
            oil       = 0U;
            forest    = 0U;
            fertility = 0U;
            water     = 0U;
            GameAreaManager instance = Singleton <GameAreaManager> .instance;
            //begin mod
            int num = 0;

            for (int z = 0; z < FakeGameAreaManager.GRID; ++z)
            {
                for (int x = 0; x < FakeGameAreaManager.GRID; ++x)
                {
                    //end mod
                    if (instance.IsUnlocked(x, z))
                    {
                        this.GetTileResourcesImpl(x + num, z + num, ref ore, ref oil, ref forest, ref fertility, ref water);
                    }
                }
            }
        }