コード例 #1
0
    void Winner()
    {
        WaveSpawner  w  = GameObject.FindObjectOfType <WaveSpawner>();
        WaveSpawner1 w1 = GameObject.FindObjectOfType <WaveSpawner1>();
        WaveSpawner2 w2 = GameObject.FindObjectOfType <WaveSpawner2>();
        PlayerStats  p  = GameObject.FindObjectOfType <PlayerStats>();

        if (stage == 1 && p.Lives > 0 && w.Wavenumber == 6 && w.EnemiesAlive1 <= 0 && w.EnemiesAlive2 <= 0 && w.BossAlive <= 0 && w.BossAlive2 <= 0)
        {
            WinWin.SetActive(true);
            w.enabled            = false;
            WinDisplayScore.text = "Score " + Score;
            Unlocker Un = GameObject.FindObjectOfType <Unlocker>();
            Un.unlockerlevel2();
            LevelManager.score1 = Score;
        }
        else if (stage == 2 && p.Lives > 0 && w.Wavenumber == 6 && w.EnemiesAlive1 <= 0 && w.EnemiesAlive2 <= 0 && w.BossAlive <= 0 && w.BossAlive2 <= 0)
        {
            WinWin.SetActive(true);
            w.enabled            = false;
            WinDisplayScore.text = "Score " + Score;
            Unlocker Un = GameObject.FindObjectOfType <Unlocker>();

            Un.unlockerlevel3();
            LevelManager.score2 = Score;
        }
        else if (stage == 3 && p.Lives > 0 && w.Wavenumber == 6 && w.EnemiesAlive1 <= 0 && w.EnemiesAlive2 <= 0 && w.BossAlive <= 0 && w.BossAlive2 <= 0)
        {
            WinWin.SetActive(true);
            w.enabled            = false;
            WinDisplayScore.text = "Score " + Score;
            Unlocker Un = GameObject.FindObjectOfType <Unlocker>();
            Un.unlockerlevel4();
            LevelManager.score3 = Score;
        }
        else if (stage == 4 && p.Lives > 0 && w.Wavenumber == 6 && w.EnemiesAlive1 <= 0 && w.EnemiesAlive2 <= 0 && w.BossAlive <= 0 && w.BossAlive2 <= 0)
        {
            WinWin.SetActive(true);
            w.enabled            = false;
            WinDisplayScore.text = "Score " + Score;
            Unlocker Un = GameObject.FindObjectOfType <Unlocker>();
            Un.unlockerlevel5();
            LevelManager.score4 = Score;
        }
        else if (stage == 5 && p.Lives > 0 && w1.Wavenumber == 6 && w1.EnemiesAlive1 <= 0 && w1.EnemiesAlive2 <= 0 && w1.EnemiesAlive3 <= 0 && w1.BossAlive <= 0 && w1.BossAlive2 <= 0 && w1.BossAlive3 <= 0)
        {
            WinWin.SetActive(true);
            w1.enabled           = false;
            WinDisplayScore.text = "Score " + Score;
            Unlocker Un = GameObject.FindObjectOfType <Unlocker>();
            Un.unlockerlevel6();
            LevelManager.score5 = Score;
        }
        else if (stage == 6 && p.Lives > 0 && w2.Wavenumber == 6 && w2.EnemiesAlive1 <= 0 && w2.EnemiesAlive2 <= 0 && w2.EnemiesAlive3 <= 0 && w2.EnemiesAlive4 <= 0 && w2.BossAlive <= 0 && w2.BossAlive2 <= 0 && w2.BossAlive3 <= 0 && w2.BossAlive4 <= 0)
        {
            WinWin.SetActive(true);
            w2.enabled          = false;
            LevelManager.score6 = Score;
        }
    }
コード例 #2
0
    public static string LoginLocal(string password, string id)
    {
        string connectionString = ConfigurationManager.ConnectionStrings["KioskConnectionString"].ConnectionString;
        string serverPassword   = String.Empty;

        using (SqlConnection con = new SqlConnection(connectionString))
            using (SqlCommand cmd = new SqlCommand("SELECT password FROM kiosk WHERE id=@id AND status='pending'", con))
            {
                con.Open();
                cmd.Parameters.AddWithValue("id", id);
                SqlDataReader rdr = cmd.ExecuteReader();
                while (rdr.Read())
                {
                    serverPassword = rdr["password"].ToString();
                }
                con.Close();
            }

        if (password == serverPassword)
        {
            Unlocker.Unlock(Convert.ToInt32(id), "Staff", "startstaff"); return(true.ToString());
        }
        else
        {
            return("Invalid password!");
        }
    }
コード例 #3
0
        private void TestSequence(string sequence, int expectedResult)
        {
            unlocker = new Unlocker();

            var result = unlocker.MoveSequence(sequence);

            Assert.AreEqual(expectedResult.ToString(), result);
        }
コード例 #4
0
        public void GetCode_TestInput2_ValidResult(string input, string expectedResult)
        {
            unlocker = new Unlocker(2);

            var result = unlocker.GetCode("ULL,RRDDD,LURDL,UUUUD".Split(","));

            Assert.AreEqual(expectedResult, result);
        }
コード例 #5
0
        public void GetCode_TestInput_ValidResult()
        {
            unlocker = new Unlocker();

            var result = unlocker.GetCode("ULL,RRDDD,LURDL,UUUUD".Split(","));

            Assert.AreEqual("1985", result);
        }
コード例 #6
0
        public SpinLock()
        {
            _unlocker = new Unlocker(this);

#if !NETFX_CORE
            //We should never spin wait on a single threaded machine!
            _alwaysYield = Environment.ProcessorCount == 1;
#endif
        }
コード例 #7
0
        public void Unlock_CannotBeUnlocked_ReturnsInvalidResult(string startColor, string finalColor,
                                                                 List <Chip <string> > inputColors)
        {
            var unlocker = new Unlocker <string>(startColor, finalColor, new UnlockVerifier <string>());

            var result = unlocker.Unlock(inputColors);

            Assert.Matches("Cannot unlock master panel", result);
        }
コード例 #8
0
    public Unlocker createUnlocker(string whatThisUnlocks, JSONObject unlockerComponents)
    {
        Unlocker unlockerToAdd = new Unlocker();

        unlockerToAdd.setWhenToUnlock(unlockerComponents[0].str);
        unlockerToAdd.NameOfThingToUnlock = unlockerComponents[1].str;
        unlockerToAdd.setWhatThisUnlocks(whatThisUnlocks);
        if (unlockerComponents[2] != null)
        {
            unlockerToAdd.SpecifierForNameOfThingToUnlock = unlockerComponents[2].str;
        }
        return(unlockerToAdd);
    }
コード例 #9
0
    public static string LoginSIP(string barcode, string id)
    {
        int intID = Convert.ToInt32(id);

        if (CheckSip(barcode))
        {
            Unlocker.Unlock(Convert.ToInt32(id), barcode, "startsip");
            return(true.ToString());
        }
        else
        {
            return("There seems to be a problem with this account.  Please see a librarian.");
        }
    }
コード例 #10
0
        public void RemoveLock_Should_Remove_Current_Lock()
        {
            // create valid lock that shouldn't get removed
            var validLock = $"{TestFileName}.{Guid.NewGuid()}.launchlock";

            FileSystem.AddFile(validLock, new Mocks().GetLaunchLockJson(validLock));

            // create current lock that should get removed
            LockBuilder.Build();
            LockWriter.Write();

            GetCurrentLauchLocks();

            Unlocker.RemoveLock();

            GetCurrentLauchLocks().Count().Should().Be(1);
        }
コード例 #11
0
    // Use this for initialization
    void Start()
    {
        this.transform.Find("Model3D").Find("Eye").gameObject.SetActive(false);
        pivot = transform.Find("Pivot");
        inf   = this.GetComponent <Informer>();
        ask   = this.GetComponent <Asker>();
        sol   = this.GetComponent <Solutioner>();
        ul    = this.GetComponent <Unlocker>();
        inq   = this.GetComponent <Inquisitor>();
        if (sol != null)
        {
            message.transform.Find("Text").GetComponent <TextMesh>().text = sol.answer;
        }

        this.name = data.name;
        message.SetActive(false);
    }
コード例 #12
0
        // Create a background job to unlock the plugin. Don't wait for it.
        static void TryUnlockAsync()
        {
            if (HP_IsPluginUnlocked())
            {
                return;
            }

            var unlocker = new Unlocker();

            void OnUpdate()
            {
                if (unlocker.IsCompleted)
                {
                    UnityEditor.EditorApplication.update -= OnUpdate;
                    unlocker.Dispose();
                }
            };
            UnityEditor.EditorApplication.update += OnUpdate;
        }
コード例 #13
0
        public void RemoveObsoleteLocks_Should_Remove_Old_User_Lock()
        {
            // create valid lock that shouldn't get removed
            var validLock = $"{TestFileName}.{Guid.NewGuid()}.launchlock";

            FileSystem.AddFile(validLock, new Mocks().GetLaunchLockJson(validLock));

            // create old lock that should be removed
            var invalidLock = $"{TestFileName}.{Guid.NewGuid()}.launchlock";

            FileSystem.AddFile(invalidLock, new Mocks().GetLaunchLockJson(validLock, true));

            GetCurrentLauchLocks();

            Unlocker.RemoveObsoleteLocks();

            LockFinder.DoesLockExist();

            GetCurrentLauchLocks().Count().Should().Be(1);
        }
コード例 #14
0
 public static bool ScrollToCompstionUpdated(TextStoreBase textStore, EditView view, int start, int end)
 {
     if (textStore.IsLocked() == false)
     {
         return(false);
     }
     using (Unlocker locker = textStore.LockDocument(false))
     {
         foreach (TextDisplayAttribute attr in textStore.EnumAttributes(start, end))
         {
             if (attr.attribute.bAttr == TF_DA_ATTR_INFO.TF_ATTR_TARGET_CONVERTED)
             {
                 if (view.AdjustSrc(attr.startIndex))
                 {
                     return(true);
                 }
             }
         }
     }
     return(false);
 }
コード例 #15
0
        public override void OnLevelLoaded(LoadMode mode)
        {
            base.OnLevelLoaded(mode);

            Debugger.Log("On_Level_Loaded");
            Debugger.OnLevelLoaded();

            try
            {
                if (mode != LoadMode.LoadGame && mode != LoadMode.NewGame)
                {
                    return;
                }

                Unlocker.UnlockButtons();
            }
            catch (Exception e)
            {
                Debugger.LogException(e);
            }
        }
コード例 #16
0
        public override void OnCreated(ILoading loading)
        {
            base.OnCreated(loading);

            Debugger.InitializeDebugger();

            Debugger.Log("On_Level_Created");
            Debugger.Log("Feature Unlocker: Initializing");

            try
            {
                Unlocker.RegisterUnlocker();
                FeatureUnlockManager.instance.Reset();

                UpdateSettings();

                Debugger.Log("Feature Unlocker Successfully Initialized");
            }
            catch (Exception e)
            {
                Debugger.LogException(e);
            }
        }
コード例 #17
0
    public static string LoginKoha(string username, string pin, string id)
    {
        int intID = Convert.ToInt32(id);

        if (intID > 50)
        {
            return("This option has been disabled by the administrator.  Please see a librarian for help logging in.");
        }
        WebClient   client         = new WebClient();
        string      downloadString = client.DownloadString("https://yourKohaServer/cgi-bin/koha/ilsdi.pl?service=AuthenticatePatron&username="******"&password="******"id");

        if (patronid[0] != null)
        {
            string patronID = patronid[0].InnerText;
            downloadString = client.DownloadString("https://yourKohaServer/cgi-bin/koha/ilsdi.pl?service=GetPatronInfo&patron_id=" + patronID);
            xmlDoc.LoadXml(downloadString);
            XmlNodeList cardnumber       = xmlDoc.GetElementsByTagName("cardnumber");
            string      patronCardnumber = cardnumber[0].InnerText;
            Unlocker.Unlock(Convert.ToInt32(id), patronCardnumber, "startkoha");
            if (CheckSip(patronCardnumber))
            {
                return(true.ToString());
            }
            else
            {
                return("There seems to be a problem with this account.  Please see a librarian.");
            }
        }
        else
        {
            return("Invalid username and/or pin!");
        }
    }
コード例 #18
0
        private void DrawImeConversionLine(MyTextLayout layout, LineToIndexTable lti, int row, double x, double y)
        {
            if (InputMethod.Current.ImeState != InputMethodState.On)
            {
                return;
            }

            using (Unlocker locker = this.store.LockDocument(false))
            {
                int lineIndex  = lti.GetIndexFromLineNumber(row);
                int lineLength = lti.GetLengthFromLineNumber(row);
                foreach (TextDisplayAttribute attr in this.store.EnumAttributes(lineIndex, lineIndex + lineLength))
                {
                    if (attr.startIndex == attr.endIndex)
                    {
                        continue;
                    }
                    int length = attr.endIndex - attr.startIndex;
                    int start  = attr.startIndex - lineIndex;

                    HilightType type  = HilightType.None;
                    Color4?     color = null;
                    switch (attr.attribute.lsStyle)
                    {
                    case TF_DA_LINESTYLE.TF_LS_DOT:
                        type  = HilightType.Dot;
                        color = this.GetColor4(attr.attribute.crLine);
                        break;

                    case TF_DA_LINESTYLE.TF_LS_SOLID:
                        type  = HilightType.Sold;
                        color = this.GetColor4(attr.attribute.crLine);
                        break;

                    case TF_DA_LINESTYLE.TF_LS_DASH:
                        type  = HilightType.Dash;
                        color = this.GetColor4(attr.attribute.crLine);
                        break;

                    case TF_DA_LINESTYLE.TF_LS_SQUIGGLE:
                        type  = HilightType.Squiggle;
                        color = this.GetColor4(attr.attribute.crLine);
                        break;
                    }

                    if (attr.attribute.crBk.type != TF_DA_COLORTYPE.TF_CT_NONE)
                    {
                        type  = HilightType.Select;
                        color = this.GetColor4(attr.attribute.crBk);
                    }

                    this.DrawMarkerEffect(layout, type, start, length, x, y, attr.attribute.fBoldLine, color);

                    color = this.GetColor4(attr.attribute.crText);
                    if (color != null)
                    {
                        this.SetTextColor(layout, start, length, color);
                        layout.Invaild = true;
                    }
                }
            }
        }
コード例 #19
0
 public override void Uninstall(System.Collections.IDictionary savedState)
 {
     Console.WriteLine("Hello There From Uninstall");
     Unlocker.Exec();
 }
コード例 #20
0
        // Make sure the plugin is unlocked. Wait for it if necessary.
        internal static void EnsureUnlocked()
        {
            if (HP_IsPluginUnlocked())
            {
                return;
            }

            // Don't create dialogs if in automatic mode or explicitly requested (used by unit tests)
            bool createDialogs = UnityEditorInternal.InternalEditorUtility.isHumanControllingUs &&
                                 !UnityEngine.PlayerPrefs.HasKey("Havok.Auth.SuppressDialogs");

            using (var unlocker = new Unlocker())
            {
                while (true)
                {
                    if (!unlocker.IsCompleted)
                    {
                        if (createDialogs)
                        {
                            if (UnityEditor.EditorUtility.DisplayCancelableProgressBar("Checking Havok Physics permission", "Please wait...", 0.0f))
                            {
                                UnityEditor.EditorUtility.ClearProgressBar();
                                break;
                            }
                        }
                    }
                    else
                    {
                        const string assetStoreLink  = "https://aka.ms/hkunityassetstore";
                        const string failureTitle    = "Havok Physics simulation disabled";
                        const string closeButtonText = "Close";
                        UnityEditor.EditorUtility.ClearProgressBar();
                        switch (unlocker.Result.Value)
                        {
                        case UnlockResult.Status.NoUser:
                        {
                            string message = "Could not check Havok Physics permissions because no user is signed into Unity.\nPlease sign in.";
                            if (createDialogs)
                            {
                                UnityEditor.EditorUtility.DisplayDialog(failureTitle, message, closeButtonText);
                            }
                            else
                            {
                                UnityEngine.Debug.LogError(failureTitle + ".\n" + message);
                            }
                        }
                        break;

                        case UnlockResult.Status.NoSubscription:
                        {
                            string message = "No Havok Physics subscription found for the current user.\nUnity Pro users must purchase a subscription from the Unity Asset Store.";
                            if (createDialogs)
                            {
                                if (UnityEditor.EditorUtility.DisplayDialog(failureTitle, message, "Go to Asset Store page", closeButtonText))
                                {
                                    UnityEditor.Help.BrowseURL(assetStoreLink);
                                }
                            }
                            else
                            {
                                UnityEngine.Debug.LogError(failureTitle + ".\n" + message);
                            }
                        }
                        break;

                        case UnlockResult.Status.Unlocked:
                        {
                            // Show the license expire warning in console (not in a dialog), but only in cases where user is playing a scene from editor
                            if (createDialogs && unlocker.Result.NumDaysRemaining < 10)
                            {
                                UnityEngine.Debug.LogWarningFormat("Havok.Physics license will expire in {0} days. Please extend it from the Unity Asset Store: {1} .",
                                                                   unlocker.Result.NumDaysRemaining, assetStoreLink);
                            }
                        }
                        break;

                        default:
                            break;
                        }
                        break;
                    }
                }
            }
        }
コード例 #21
0
ファイル: LockedValue.cs プロジェクト: ChatVR/ChatVR-Mirror
 public ReadonlyLockedValue(T value)
 {
     _value      = value;
     _lockObject = new object();
     _unlocker   = new Unlocker(this);
 }
コード例 #22
0
 public void addUnlocker(Unlocker unlockerToAdd)
 {
     thingsThisConversationUnlocks.Add(unlockerToAdd);
 }
コード例 #23
0
ファイル: Fiber.cs プロジェクト: GWBasic/SharpLang
        /// <summary>
        /// Analogy for the "lock" keyword. Allows the current caller to use the fiber. Blocks until the fiber is blocked, unblocks the fiber when the returned object is disposed. Intended to be used in a "using" block.
        /// </summary>
        public virtual IDisposable Lock()
        {
            if (this.disposed)
                throw new ObjectDisposedException(this.Name);

            var unlocker = new Unlocker()
            {
                fiber = this
            };

            lock (unlocker.sync)
            {
                this.Enqueue(() =>
                    {
                        lock (unlocker.sync)
                        {
                            Monitor.Pulse(unlocker.sync);
                            Monitor.Wait(unlocker.sync);
                        }
                    });

                Monitor.Wait(unlocker.sync);
            }

            this.IsInFiber = true;

            return unlocker;
        }