Example #1
0
    //----------------------------------------------------------------------------------------------
    // 更新処理
    //----------------------------------------------------------------------------------------------
    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);
    }
Example #2
0
        //-------------------------------------
        // 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);
            }
        }
Example #3
0
        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));
        }
Example #4
0
        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);
            }
Example #6
0
        public void KeyPress(JsValue value)
        {
            var code = Util2.AsKeyCode(value);

            //Logger.Debug("Down:" + code);
            emulateKey(code, true);
            _engineEx.NextFrameAction += () => _engineEx.NextFrameAction += () => emulateKey(code, false);
        }
Example #7
0
 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("/"));
 }
Example #8
0
        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);
        }
Example #9
0
        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);
        }
Example #10
0
        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);
        }
Example #11
0
        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);
            }
        }
Example #12
0
        private string GetUserHistory(string key)
        {
            var value = Util2.GetSessionObj($"ushgiving-{key}");

            return(value == null ? string.Empty : value.ToString());
        }
Example #13
0
 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");
 }
Example #16
0
 public void KeyUp(JsValue value)
 {
     emulateKey(Util2.AsKeyCode(value), false);
 }
Example #17
0
 public void KeyDown(JsValue value)
 {
     emulateKey(Util2.AsKeyCode(value), true);
 }