public int Check(char code) { int check = 0; input_stream.Add(code); if (input_stream.Count > codeArr.Length) { input_stream.RemoveAt(0); } if (input_stream.Count == codeArr.Length) { for (int i = input_stream.Count - 1; i > 0; i--) { if (input_stream[i] != codeArr[i]) { check = -1; break; } } if (check == 0) { Unlock?.Invoke(); } } return(check); }
protected void btnAdd_Click(object sender, EventArgs e) { if (!Global.Account.IsZeroKAdmin) { throw new ApplicationException("You are not an admin!"); } var db = new ZkDataContext(); var unlock = new Unlock() { Code = tbCode.Text, Name = tbName.Text, XpCost = int.Parse(tbXpCost.Text), Description = tbDescription.Text, NeededLevel = int.Parse(tbMinLevel.Text), RequiredUnlockID = GetInt(tbPreq.Text), UnlockType = (UnlockTypes)int.Parse(ddType.SelectedValue), MorphLevel = GetInt(tbMorphLevel.Text) ?? 0, MaxModuleCount = GetInt(tbMaxCount.Text) ?? 1, LimitForChassis = tbChassisLimit.Text, MetalCost = GetInt(tbMetalCost.Text), MetalCostMorph2 = GetInt(tbMorph2.Text), MetalCostMorph3 = GetInt(tbMorph3.Text), MetalCostMorph4 = GetInt(tbMorph4.Text), MetalCostMorph5 = GetInt(tbMorph5.Text) }; db.Unlocks.InsertOnSubmit(unlock); db.SubmitChanges(); GridView1.DataBind(); }
private void DrawTypeSpecificFields(Unlock unlock) { if (unlock.GetType() == typeof(PackUnlock)) { DrawPackUnlock(unlock as PackUnlock); } }
// Player and Server public void SetNextUnlock(byte unlockToSetTo, bool runEffects, bool setSwitchedAt) { if (whichUnlock != unlockToSetTo) { Unlock usingUnlock = getUnlockEquipped(); if (usingUnlock != null) { usingUnlock.disable(); } // Trigger animation: nextUnlock = unlockToSetTo; if (setSwitchedAt) { switchedAt.trigger(GetComponent <SyncPlayer> ().getTime()); // This'll be overwritten } if (runEffects) { GetComponent <PlayerAnimation> ().animTrigger(getNextUnlock().getAnimationType() + "Trigger"); } } else if (!setSwitchedAt) { nextUnlock = unlockToSetTo; } }
public void AddUnlock(Unlock u) { if (!Contains(u.title)) { unlocks.Add(u); } }
public static void Unlock() { using (Unlock form = new Unlock()) { var result = form.ShowDialog(); if (result == DialogResult.OK) { if (!ValidatePassword(form.PasswordInput)) { Unlock(); return; } _password = form.PasswordInput; } else if (result == DialogResult.Abort) { if (MainService.ConfirmReset()) { MainService.Reset(); } else { Unlock(); } } else { Application.Exit(); } } }
// ALL void switchCheck() { // Creates unlock if it doesn't exist here. Player, Server, and Client could do it this way in general. // Now check for switching: if (isSwitching()) { if (isMidSwitchOver()) { midSwitch(); } if (isSwitchingOver()) { // Set unlock accordingly: whichUnlock = nextUnlock; Unlock unlockEquipped = getUnlockEquipped(); if (OperationNetwork.isServer || GetComponent <PlayerMove> ().thisIsMine) { unlockEquipped.equippedAt.trigger(GetComponent <SyncPlayer> ().getTime()); } else { unlockEquipped.equippedAt.interpTrigger(true); } unlockEquipped.enable(); } } }
public void HideCameraBtn() { if (Unlock != null) { Unlock.SetActive(false); } }
public void ShowCameraBtn() { if (Unlock != null) { Unlock.SetActive(true); } }
public void DoNothing_GivenPlayerHasNoKey() { // Arrange var inventory = new Inventory(); var fakePlayer = A.Fake <IAdventurePlayer>(); A.CallTo(() => fakePlayer.Inventory).Returns(inventory); var fakeGame = A.Fake <IReadonlyAdventureGame>(); var fakeCage = A.Fake <IAdventureItem>(); A.CallTo(() => fakeCage.ItemId).Returns(Item.Cage); A.CallTo(() => fakeCage.IsPortable).Returns(true); A.CallTo(() => fakeCage.IsMatch("cage")).Returns(true); fakeCage.IsOpen = false; fakeCage.IsLocked = true; fakeCage.ItemIdToUnlock = Item.Key; // Act var action = new Unlock(); var result = action.Do(fakePlayer, fakeCage); // Assert Assert.IsTrue(fakeCage.IsLocked); Assert.IsFalse(result); }
public void clientInterp(byte unlockID) { if (unlockID != nextUnlock) { // This assumes switching is possible. (Client side this is obviously fine) Unlock usingUnlock = getUnlockEquipped(); if (usingUnlock != null) { usingUnlock.disable(); } nextUnlock = unlockID; GetComponent <PlayerAnimation> ().animTrigger(getNextUnlock().getAnimationType() + "Trigger"); switchedAt.interpTrigger(true); // "Triggers" always start at the START of the tick. } switchCheck(); // Now we run client interp: Unlock currUnlock = getUnlockEquipped(); if (currUnlock != null) { currUnlock.interp(); } }
public async Task UnlockAsync(string id, ulong cas, UnlockOptions?options = null) { //sanity check for deferred bootstrapping errors _bucket.ThrowIfBootStrapFailed(); //Check to see if the CID is needed if (RequiresCid()) { //Get the collection ID await PopulateCidAsync().ConfigureAwait(false); } options ??= UnlockOptions.Default; using var rootSpan = RootSpan(OuterRequestSpans.ServiceSpan.Kv.Unlock); using var unlockOp = new Unlock { Key = id, Cid = Cid, CName = Name, SName = ScopeName, Cas = cas, Span = rootSpan }; _operationConfigurator.Configure(unlockOp, options); using var ctp = CreateRetryTimeoutCancellationTokenSource(options, unlockOp); await _bucket.RetryAsync(unlockOp, ctp.TokenPair).ConfigureAwait(false); }
protected virtual void _(Events.RowSelected <TYear> e) { bool isReverseActionAvailable = e.Cache.Graph.GetService <IFinPeriodUtils>().CanPostToClosedPeriod(); Reopen.SetEnabled(isReverseActionAvailable); Unlock.SetEnabled(isReverseActionAvailable); }
private void btnDosure_Click(object sender, EventArgs e) { if (rtboxNote.Text.Trim().Length == 0) { MsgBox.Show("工具使用备注不能为空!", LanguageResource.Language.Tip_Tip, MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } ComitDoControl(false); if (!isWorkOrderCreateAfter) {//该页面只是作为参数窗体的页面 Unlock ul = new Unlock() { Remark = rtboxNote.Text, UnLockTarget = _LockUorR, UserName = _Uname, RoleName = _Rname }; CallBackEventParam p = new CallBackEventParam() { CallData = ul, NowForm = this }; dataCallBack(p); string.Format("{0} Call back is end", typeof(FormToolGuserUnLock).Name).Logger(); return; } _clihandle.GameNoLockUR(this.Handle.ToInt32(), _LockUorR, _taskid); }
private void DeadHappen() { if (!Onedead) { if (this.CompareTag("Player1")) { GameManager.Instance.player2.PlayerUnlocked(); GameManager.Instance.player2.Bmovable = true; Amovable = false; } if (this.CompareTag("Player2")) { Debug.Log(this.name); GameManager.Instance.player1.PlayerUnlocked(); GameManager.Instance.player1.Amovable = true; Bmovable = false; } QTE_main.Singleton.InteruptQTE(); Mashring.gameObject.SetActive(false); Mashcircle.gameObject.SetActive(false); Destroy(FindObjectsOfType <QTE_Trigger>()[0]); Destroy(FindObjectsOfType <QTE_Trigger>()[1]); GameManager.AliveNum -= 1; OneguyDie -= DeadHappen; UnlockIron(); //in case this function be called second time; Onedead = true; } OneguyDie -= DeadHappen; }
public bool DeepEquals(UnlockEventUnlock other) { return(other != null && Unlock.DeepEquals(other.Unlock) && SelectedValue == other.SelectedValue && ClearedValue == other.ClearedValue && UnlockValue.DeepEquals(other.UnlockValue)); }
private void CreateNotification(Unlock unlockData) { GameObject newNotification = Instantiate(unlockData.unlockPrefab); UnlockNotification unlockNotification = newNotification.GetComponent <UnlockNotification>(); unlockNotification.UpdateNotificationText(unlockData.unlockDescription); unlockNotification.SubscribeEventToDestroy(ProgressDisplayRoutine); }
// Create Animation for Purchase Panel In and Out void Start() { scrollColliderHandlerScript = ScrollColHandler.GetComponent <ScrollColliderHandler>(); currencyManagerScript = Currency_ManagerObj.GetComponent <CurrencyManager>(); displayCurrencyCountScript = CurrencyTextObj.GetComponent <DisplayCurrencyCount>(); unlockScript = _UnlockObj.GetComponent <Unlock>(); shareAmount = SecurePlayerPrefs.GetInt("ShareWith5", 0); }
// This overrides unlockSlot if called directly: (It can ONLY be used on init directly though to sync with clients) // This is used by ALL public void SetUnlock <U>(int unlockSlot) where U : Unlock { Unlock unlock = getUnlock <U>(); UnlocksEquipped [unlockSlot] = (Unlock)unlock.Clone(); UnlocksEquipped [unlockSlot].setUnlockType(unlock.getUnlockType()); // Just to be consistent. UnlocksEquipped [unlockSlot].whichBind = unlockSlot; UnlocksEquipped[unlockSlot].InitAll(GetComponent <PlayerMove>()); }
public static void Unlocks_AddUnlock(Unlock createdUnlock, Unlock __result) { if (createdUnlock != null) { __result.unavailable = createdUnlock.unavailable; __result.onlyInCharacterCreation = createdUnlock.onlyInCharacterCreation; __result.freeItem = createdUnlock.freeItem; } }
public ActionResult Unlock(int id, bool useKudos = false) { using (var db = new ZkDataContext()) using (var scope = new TransactionScope()) { List <Unlock> unlocks; List <Unlock> future; GetUnlockLists(db, out unlocks, out future); if (unlocks.Any(x => x.UnlockID == id)) { Unlock unlock = db.Unlocks.FirstOrDefault(x => x.UnlockID == id); if (!useKudos && unlock.IsKudosOnly == true) { return(Content("That unlock cannot be bought using XP")); } if (useKudos && unlock.KudosCost == null) { return(Content("That unlock cannot be bought using Kudos")); } if (useKudos) { var acc = db.Accounts.Find(Global.AccountID); var kudosRemaining = acc.KudosGained - acc.KudosSpent; if (kudosRemaining < unlock.KudosCost) { return(Content("Not enough kudos to unlock this")); } acc.KudosPurchases.Add(new KudosPurchase() { Time = DateTime.UtcNow, Unlock = unlock, Account = acc, KudosValue = unlock.KudosCost ?? 0 }); db.SaveChanges(); } var au = db.AccountUnlocks.SingleOrDefault(x => x.AccountID == Global.AccountID && x.UnlockID == id); if (au == null) { au = new AccountUnlock() { AccountID = Global.AccountID, UnlockID = id, Count = 1 }; db.AccountUnlocks.InsertOnSubmit(au); } else { au.Count++; } db.SaveChanges(); } scope.Complete(); } return(RedirectToAction("UnlockList")); }
public static bool IsPrerequisiteUnlockPresent(Commander comm, Unlock unlock) { if (!string.IsNullOrEmpty(unlock.RequiredInstalledUnlockIDs)) { var requiredUnlockIDs = unlock.RequiredInstalledUnlockIDs.Split(',').Select(int.Parse); if (!comm.CommanderModules.Any(x => requiredUnlockIDs.Contains(x.ModuleUnlockID))) return false; } return true; }
public async Task Unlock <T>(string id, UnlockOptions options) { var unlockOp = new Unlock { Key = id, Cid = Cid, Cas = options.Cas }; await ExecuteOp(unlockOp, options.Token, options.Timeout).ConfigureAwait(false); }
public int getUnlockIndex(Unlock unlock) { for (int i = 0; i < UnlocksEquipped.Length; i++) { if (UnlocksEquipped [i] == unlock) { return(i); } } return(-1); }
private Unlock CastUnlockType(Type unlockType) { Unlock unlock = null; if (unlockType == typeof(PackUnlock)) { unlock = new PackUnlock(); } return(unlock); }
ClientData SwitchDo(GSSModel.Request.ClientData clientData) {//在创建工单的同时将逻辑数据提交到服务端处理 TaskContainerLogicData tl = clientData.Data as TaskContainerLogicData; Tasks task = tl.WorkOrder; int id = dbhandle.AddTask(task); clientData.TaskID = id; string.Format("Sync create task and run :{0}", clientData.Data.GetType().Name); if (tl.LogicData.GetType().Name != typeof(RunTask).Name) { Unlock un = tl.LogicData as Unlock;//bug 此处不能直接将object转换为json string json = un.MapObject <Unlock, UnlockLogic>().ConvertJson(); // if(clientData.Data.GetType().Name==typeof()) int code = dbhandle.InsertLogicJsonAfterTask(id, json); clientData.Data = null; if (code != StatueCode.Ok) {//未创建成功 clientData.Data = code; clientData.Message = "Error"; } else { string ret = WebServiceLib.URNolock((un.RoleId > 0 ? "2" : "1"), id.ToString()); clientData.Success = ret == "true"; string.Format("taskId=[{0}]->Unlock result:[{1}]", id, ret).Logger(); clientData.Message = ret; } return(clientData); } msgCommand cmd; RunTask rt = tl.LogicData as RunTask; clientData.Data = null; string.Format("create work order and run-> {0}", rt.Command).Logger(); string msg = string.Empty; cmd = (msgCommand)Enum.Parse(typeof(msgCommand), rt.Command); switch (cmd) { case msgCommand.GameNoticeStart: //运行公告 msg = WebServiceLib.GameNoticeStart(id.ToString()); break; default: break; } clientData.Message = msg; if (!string.IsNullOrEmpty(msg)) { clientData.Success = true; } return(clientData); }
/// <summary> /// Updates the cylinder data and state. /// </summary> public void Update() { float driveDelta = GetDriveDelta(); switch (State) { case StateType.Idle: // Idle state if (driveDelta != 0f) { State = StateType.Moving; goto case StateType.Moving; } break; case StateType.Moving: // Moving state if (driveDelta == 0f) { State = StateType.Idle; break; } float prevRotation = Rotation; Rotation += driveDelta; if (Rotation >= MaxTensionRotation && driveDelta > 0f && MaxTensionRotation != 1f) { Rotation = prevRotation; State = StateType.Stuck; goto case StateType.Stuck; } if (Rotation >= 1f) { State = StateType.Unlocked; Unlock?.Invoke(this, EventArgs.Empty); } break; case StateType.Stuck: // Stuck state if (driveDelta <= 0f) { State = StateType.Moving; goto case StateType.Moving; } break; case StateType.Unlocked: // Unlocked state if (Rotation < 1f) { State = StateType.Idle; goto case StateType.Idle; } break; } }
// Use this for initialization void Start() { eggTop.SetActive(false); eggBottom.SetActive(false); start = transform.position; SpriteRenderer sr = egg.GetComponent <SpriteRenderer>(); end = egg.transform.position + new Vector3(0, sr.bounds.extents.y + 0.2f, 0); cageLock = GameObject.Find("Lock").GetComponent <Unlock>(); }
private static bool ShouldDo(Unlock unlock, Dictionary <string, ParsedArg> config, Dictionary <string, TagExpectedValue> tags, Type unlockType) { string type = Unlock.GetTypeName(unlockType); string typeLower = type.ToLowerInvariant(); if (config == null) { return(unlock.Type == type); } return(unlock.Type == type && config.ContainsKey(typeLower) && config[typeLower].ShouldDo(unlock.GetName(), tags)); }
public static void ProcessUnlock(Unlock unlock, ICLIFlags flags, string basePath, string heroFileName, STUHero hero, STUVoiceSetComponent baseComponent, Combo.ComboInfo baseInfo) { if (!(unlock.STU is STUUnlock_SkinTheme unlockSkinTheme)) { return; } if (unlockSkinTheme.m_0B1BA7C1 != 0) { return; } SaveSkin(flags, unlockSkinTheme.m_skinTheme, basePath, hero, heroFileName, unlock.Name, baseComponent, baseInfo); }
public void Unserialize(JSONObject jsonObject) { Unlocked = (Unlock)Enum.Parse(typeof(Unlock), jsonObject.GetField("Unlocked").str, true); if (Unlocked == Unlock.Friends) { for (int index = 0; index < jsonObject.GetField("FriendsIds").list.Count; index++) { var friendId = jsonObject.GetField("FriendsIds").list[index].str; FriendsIds[index] = friendId; } } AfterLevel = jsonObject.GetField("AfterLevel").integer; UnlockedLevel = jsonObject.GetField("UnlockedLevel").integer; }