//---------------------------------------------------------------------------------------------- // 更新処理 //---------------------------------------------------------------------------------------------- public override void OnUpdate(AutoPilot ap) { /// 左クリックでスプライト追加 if (Input.GetKeyDown(KeyCode.Mouse0)) { util.AddSprite(ap); } /// 右クリックでスプライト削除 if (Input.GetKeyDown(KeyCode.Mouse1)) { util.RemoveSprite(ap); } // 全スプライト移動 util.MoveSprites(ap); // スプライトが無い場合のみライン描画 int spriteCount = util.GetSpriteCount(); if (spriteCount == 0) { Util2.DrawLines(ap); } ap.Print(0, "SpriteCount=" + spriteCount); }
//------------------------------------- // Internal Methods //-------------------------------------- #region Internal Methods /// <summary> /// Retrieves name of server cache. If an error occurs, we return null and save the error code in /// errorCode. /// If we are not currently connected to the server, we automatically establish the connection /// </summary> /// <param name="timeout">maximum amount of time to wait, in milliseconds</param> /// <param name="errorCode">On output, contains protocol-specific error code (0 if successful)</param> /// <returns>name of server cache, null if timeout or error</returns> internal string GetServerSectionName(int timeout, out int errorCode) { byte[] input = new byte[sizeof(Int32)]; Marshal.WriteInt32(input, 0, FontCacheConstants.GetCacheNameMessage); byte[] output = new byte[MaxCacheNameSize]; if (_conn == null) { _conn = _protocol.TryConnectToServer(timeout, out errorCode); if (_conn == null) { return(null); } } errorCode = 0; _protocol.TrySendRequest(_conn, input, 0, input.Length, output, 0, output.Length, timeout, out errorCode); if (errorCode == 0) { return(Util2.ByteArrayToString(output)); } else { return(null); } }
public ContentResult TagAll(string tagname, bool?cleartagfirst, QueryModel m) { // take a query, add all people from the result of that query to the tag specified // empty the tag first if requested string resultMessage = string.Empty; bool shouldContinue = true; if (shouldContinue) { var workingTag = CurrentDatabase.FetchOrCreateTag(Util2.GetValidTagName(tagname), Util.UserPeopleId, DbUtil.TagTypeId_Personal); var shouldEmptyTag = cleartagfirst ?? false; if (shouldEmptyTag) { CurrentDatabase.ClearTag(workingTag); } m.TagAll(workingTag); Util2.CurrentTag = workingTag.Name; resultMessage = "Manage"; shouldContinue = false; } return(Content(resultMessage)); }
private void Unsubscribe(ref KeyEvents events, JsValue keyCodeVal) { var keyCode = Util2.AsKeyCode(keyCodeVal); //Logger.Debug("Unsubscribe " + keyCode); events = new KeyEvents(events); events.Remove(keyCode); }
public AnglometerBlockWrapper(EngineEx engineEx, Block block) : base(engineEx, block) { _targetDir = (Vector3)Util2.ReadPrivateField(BB, "targetDir"); var t = typeof(AnglometerBlock); _correctedAngle = t.GetMethod("CorrectedAngle", BindingFlags.Instance | BindingFlags.NonPublic); _isBetweenLimits = t.GetMethod("IsBetweenLimits", BindingFlags.Instance | BindingFlags.NonPublic); }
public void KeyPress(JsValue value) { var code = Util2.AsKeyCode(value); //Logger.Debug("Down:" + code); emulateKey(code, true); _engineEx.NextFrameAction += () => _engineEx.NextFrameAction += () => emulateKey(code, false); }
public ActionResult OnlineRegTypeSearchAdd(bool id) { Util2.SetSessionObj("OnlineRegTypeSearchAdd", id ? "false" : "true"); DbUtil.Db.SubmitChanges(); if (Request.UrlReferrer != null) { return(Redirect(Request.UrlReferrer.OriginalString)); } return(Redirect("/")); }
public void KeyPress(JsValue value, JsValue timeout) { var code = Util2.AsKeyCode(value); //Logger.Debug("Down:" + code); emulateKey(code, true); _engineEx.GetComponent <JsScheduler>().Schedule((_1, _2) => { //Logger.Debug("Up:" + code); emulateKey(code, false); return(JsValue.Undefined); }, TypeConverter.ToInt32(timeout), new JsValue[0], false); }
public static User CreateUser(CMSDataContext db, int peopleId) { var p = db.LoadPersonById(peopleId); var uname = Util2.FetchUsername(db, p.PreferredName, p.LastName); var pword = Guid.NewGuid().ToString(); CMSMembershipProvider.provider.AdminOverride = true; var user = CMSMembershipProvider.provider.NewUser( uname, pword, null, true, peopleId); CMSMembershipProvider.provider.AdminOverride = false; return(user); }
public void TagAll(string tagname, bool?cleartagfirst) { var workingTag = CurrentDatabase.FetchOrCreateTag(Util2.GetValidTagName(tagname), CurrentDatabase.UserPeopleId, DbUtil.TagTypeId_Personal); var shouldEmptyTag = cleartagfirst ?? false; if (shouldEmptyTag) { CurrentDatabase.ClearTag(workingTag); } if (workingTag == null) { throw new ArgumentNullException(nameof(workingTag)); } CurrentDatabase.CurrentTagName = workingTag.Name; CurrentDatabase.CurrentTagOwnerId = workingTag.PersonOwner.PeopleId; var q = Senders(); CurrentDatabase.TagAll(q, workingTag); }
private void Subscribe(ref KeyEvents events, JsValue keyCodeVal, JsValue action) { List <Action> actions; var keyCode = Util2.AsKeyCode(keyCodeVal); if (events.TryGetValue(keyCode, out actions)) { events = new KeyEvents(events); events[keyCode] = actions = new List <Action>(actions); } else { events = new KeyEvents(events); events[keyCode] = actions = new List <Action>(); } //Logger.Debug("subscribe " + keyCode); actions.Add(() => action.Invoke((int)keyCode)); if (keyInputController != null) { keyInputController.Add(keyCode); } }
private string GetUserHistory(string key) { var value = Util2.GetSessionObj($"ushgiving-{key}"); return(value == null ? string.Empty : value.ToString()); }
public JsonResult SaveGivingUserHistory(string key, string value) { //Seve in Context here Util2.SetSessionObj($"ushgiving-{key}", value); return(Json("OK")); }
public void Should_Add_Peopple_To_Tag(string tagname) { string TagName = Util2.GetValidTagName(tagname); TagName.ShouldNotBeNullOrEmpty(); }
public SpeedometerBlockWrapper(EngineEx engineEx, Block block) : base(engineEx, block) { _speedSlider = (MSlider)Util2.ReadPrivateField(BB, "speedSlider"); }
public void KeyUp(JsValue value) { emulateKey(Util2.AsKeyCode(value), false); }
public void KeyDown(JsValue value) { emulateKey(Util2.AsKeyCode(value), true); }