예제 #1
0
        public void Test_needsUpdate()
        {
            string[] versions = { "1.0.1", "2.5", "2.9", "2.40" };

            var sm   = new SeaMonkey("de", false);
            var dect = new DetectedSoftware();

            foreach (var item in versions)
            {
                dect.displayVersion = item;
                Assert.IsTrue(sm.needsUpdate(dect));
            }
        }
예제 #2
0
        public void Test_validLanguageCodes()
        {
            var list = SeaMonkey.validLanguageCodes();

            Assert.IsNotNull(list);

            int items = 0;

            foreach (var item in list)
            {
                Assert.IsFalse(string.IsNullOrWhiteSpace(item));
                ++items;
            }
            Assert.IsTrue(items > 15);
        }
예제 #3
0
        public void Test_implementsSearchForNewer()
        {
            var sm = new SeaMonkey("de", false);

            Assert.IsTrue(sm.implementsSearchForNewer());
        }
예제 #4
0
        public static void Postfix(SeaMonkeyBringGift __instance, ref float __result, float time)
        {
            if (PinManager.Count == 0)
            {
                return;
            }

            if (__result > 0f)
            {
                __result *= 100f;
                return;
            }

            if (GameModeUtils.IsInvisible())
            {
                if (!SeaMonkey.IsGiftBehaviorEnabled())
                {
                    __result = 0f;
                    return;
                }
                var main = Player.main;
                if (main.IsInside() || !main.IsUnderwater())
                {
                    __result = 0f;
                    return;
                }
                if (SeaMonkeyBringGift.activeSeaMonkeyGiftAction != null && SeaMonkeyBringGift.activeSeaMonkeyGiftAction != __instance)
                {
                    __result = 0f;
                    return;
                }
                if (__instance.state == SeaMonkeyBringGift.State.Animation || __instance.state == SeaMonkeyBringGift.State.AnimationEnd)
                {
                    __result = __instance.finishAnimationPriority;
                    return;
                }
                switch (__instance.state)
                {
                case SeaMonkeyBringGift.State.Inactive:
                    if (time < __instance.timeLastGiftAnimation + __instance.minInterval || time < SeaMonkeyBringGift.timeLastGlobalSeaMonkeyGift + __instance.minGlobalGiftInterval)
                    {
                        __result = 0f;
                        return;
                    }
                    if ((Utils.GetLocalPlayerPos() - __instance.transform.position).sqrMagnitude > __instance.maxRange * __instance.maxRange)
                    {
                        __result = 0f;
                        return;
                    }
                    break;

                case SeaMonkeyBringGift.State.Swim:
                    if (time > __instance.timeActionStart + __instance.maxDuration)
                    {
                        __result = 0f;
                        return;
                    }
                    break;

                case SeaMonkeyBringGift.State.End:
                    __result = 0f;
                    return;
                }
                if (!__instance.HasGift() && !__instance.spawnTempItem.TrySpawn(__instance.IsFirstGift(), main.GetBiomeString()))
                {
                    __result = 0f;
                    return;
                }

                __result = __instance.GetEvaluatePriority();
            }
        }