예제 #1
0
        private Handler CreateMovement()
        {
            var handler = new ActionHandler();

            handler.AddAction(new MoveCharacterAction(moveComponent));
            return(handler);
        }
예제 #2
0
        /// <summary>
        /// Member CacheStringProp
        /// </summary>
        /// <param name="obj">obj</param><param name="tag">tag</param><param name="tss">_tss</param>
        /// <remarks>
        /// IVwCacheDa method
        /// </remarks>
        public void CacheStringProp(int obj, int tag, ITsString tss)
        {
            var before = new CacheInfo(ObjType.BasicTsString, obj, tag, m_cache.get_Prop(obj, tag));
            var after  = new CacheInfo(ObjType.BasicTsString, obj, tag, tss);

            ActionHandler.AddAction(new CacheUndoAction(m_cache, before, after));

            m_cache.CacheStringProp(obj, tag, tss);
        }
예제 #3
0
        /// <summary>
        /// Member CacheUnknown
        /// </summary>
        /// <param name="obj">obj</param><param name="tag">tag</param><param name="unk">unk</param>
        /// <remarks>
        /// IVwCacheDa method
        /// </remarks>
        public void CacheUnknown(int obj, int tag, object unk)
        {
            var before = new CacheInfo(ObjType.Object, obj, tag, m_cache.get_Prop(obj, tag));
            var after  = new CacheInfo(ObjType.Object, obj, tag, unk);

            ActionHandler.AddAction(new CacheUndoAction(m_cache, before, after));

            m_cache.CacheUnknown(obj, tag, unk);
        }
예제 #4
0
        /// <summary>
        /// Member CacheBinaryProp
        /// </summary>
        /// <param name="obj">obj</param><param name="tag">tag</param><param name="rgb">rgb</param><param name="cb">cb</param>
        /// <remarks>
        /// IVwCacheDa method
        /// </remarks>
        public void CacheBinaryProp(int obj, int tag, byte[] rgb, int cb)
        {
            var before = new CacheInfo(ObjType.ByteArray, obj, tag, m_cache.get_Prop(obj, tag));
            var after  = new CacheInfo(ObjType.ByteArray, obj, tag, rgb);

            ActionHandler.AddAction(new CacheUndoAction(m_cache, before, after));

            m_cache.CacheBinaryProp(obj, tag, rgb, cb);
        }
예제 #5
0
        /// <summary>
        /// Member CacheUnicodeProp
        /// </summary>
        /// <param name="obj">obj</param><param name="tag">tag</param><param name="val">val</param><param name="cch">cch</param>
        /// <remarks>
        /// IVwCacheDa method
        /// </remarks>
        public void CacheUnicodeProp(int obj, int tag, string val, int cch)
        {
            var before = new CacheInfo(ObjType.String, obj, tag, m_cache.get_Prop(obj, tag));
            var after  = new CacheInfo(ObjType.String, obj, tag, val);

            ActionHandler.AddAction(new CacheUndoAction(m_cache, before, after));

            m_cache.CacheUnicodeProp(obj, tag, val, cch);
        }
예제 #6
0
        /// <summary>
        /// Member CacheInt64Prop
        /// </summary>
        /// <param name="obj">obj</param><param name="tag">tag</param><param name="val">val</param>
        /// <remarks>
        /// IVwCacheDa method
        /// </remarks>
        public void CacheInt64Prop(int obj, int tag, long val)
        {
            var before = new CacheInfo(ObjType.Long, obj, tag, m_cache.get_Prop(obj, tag));
            var after  = new CacheInfo(ObjType.Long, obj, tag, val);

            ActionHandler.AddAction(new CacheUndoAction(m_cache, before, after));

            m_cache.CacheInt64Prop(obj, tag, val);
        }
예제 #7
0
        /// <summary>
        /// Member CacheGuidProp
        /// </summary>
        /// <param name="obj">obj</param><param name="tag">tag</param><param name="uid">uid</param>
        /// <remarks>
        /// IVwCacheDa method
        /// </remarks>
        public void CacheGuidProp(int obj, int tag, Guid uid)
        {
            var before = new CacheInfo(ObjType.Guid, obj, tag, m_cache.get_Prop(obj, tag));
            var after  = new CacheInfo(ObjType.Guid, obj, tag, uid);

            ActionHandler.AddAction(new CacheUndoAction(m_cache, before, after));

            m_cache.CacheGuidProp(obj, tag, uid);
        }
예제 #8
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Caches the boolean prop.
        /// </summary>
        /// <param name="hvo">The hvo.</param><param name="tag">The tag.</param><param name="value">if set to <c>true</c> [value].</param>
        /// <remarks>
        /// IVwCacheDa method
        /// </remarks>
        /// ------------------------------------------------------------------------------------
        public void CacheBooleanProp(int hvo, int tag, bool value)
        {
            var before = new CacheInfo(ObjType.Bool, hvo, tag, m_cache.get_Prop(hvo, tag));
            var after  = new CacheInfo(ObjType.Bool, hvo, tag, value);

            ActionHandler.AddAction(new CacheUndoAction(m_cache, before, after));

            m_cache.CacheBooleanProp(hvo, tag, value);
        }
예제 #9
0
        /// <summary>
        /// Member CacheVecProp
        /// </summary>
        /// <param name="obj">obj</param><param name="tag">tag</param><param name="rghvo">rghvo</param><param name="chvo">chvo</param>
        public void CacheVecProp(int obj, int tag, int[] rghvo, int chvo)
        {
            var before = new CacheInfo(ObjType.Vector, obj, tag, m_cache.get_Prop(obj, tag));
            var after  = new CacheInfo(ObjType.Vector, obj, tag, rghvo);

            ActionHandler.AddAction(new CacheUndoAction(m_cache, before, after));

            m_cache.CacheVecProp(obj, tag, rghvo, chvo);
        }
예제 #10
0
        /// <summary>
        /// Member CacheStringAlt
        /// </summary>
        /// <param name="obj">obj</param><param name="tag">tag</param><param name="ws">ws</param><param name="tss">tss</param>
        /// <remarks>
        /// IVwCacheDa method
        /// </remarks>
        public void CacheStringAlt(int obj, int tag, int ws, ITsString tss)
        {
            var before = new CacheInfo(ObjType.ExtendedTsString, obj, tag, ws,
                                       m_cache.get_IsPropInCache(obj, tag, (int)CellarPropertyType.MultiString, ws) ?
                                       m_cache.get_MultiStringAlt(obj, tag, ws) : null);
            var after = new CacheInfo(ObjType.ExtendedTsString, obj, tag, ws, tss);

            ActionHandler.AddAction(new CacheUndoAction(m_cache, before, after));

            m_cache.CacheStringAlt(obj, tag, ws, tss);
        }
예제 #11
0
    protected override void InitComponents()
    {
        Cave0 = FindWidget <Transform>("Cave0");
        var actionHandler = new ActionHandler(Cave0.gameObject);

        actionHandler.AddAction(new ActionRun(actionHandler.handler));
        addUpdateAction(() =>
        {
            if (Input.GetMouseButtonDown(0))
            {
                actionHandler.Do <ActionRun>().Play();
            }
            if (Input.GetMouseButtonUp(0))
            {
                actionHandler.Do <ActionRun>().Stop();
            }
            return(false);
        });

        var tr = FindWidget <Transform>("expBg");

        expSlider = new WExpSlider();
        expSlider.SetGameObj(tr.gameObject);

        FindWidget <Text>("textAvatarname").text = URemoteData.AvatarName;
        ShowLevel();

        inputAnswer = FindWidget <InputField>("inputAnswer");

        btnReturn = FindWidget <Button>("btnReturn");
        btnReturn.onClick.AddListener(() =>
        {
            OnUnloadThis();

            LoadAnotherUI <UIMain>();
        });

        btnGetQuestion = FindWidget <Button>("btnGetQuestion");
        btnGetQuestion.onClick.AddListener(() =>
        {
            btnGetQuestion.gameObject.SetActive(false);
            UStaticWebRequests.OnWebRequest("Question/GetOne", "username="******"&token=" + UILogin.token, jobj =>
            {
                ShowWidget("question", true);
                FindWidget <Text>("textQuestion").text = jobj["q"].ToString();
            },
                                            jfail =>
            {
                ShowWidget("question", false);
                btnGetQuestion.gameObject.SetActive(true);
            });
        });

        ShowWidget("question", false);
        btnAnswer = FindWidget <Button>("btnAnswer");
        btnAnswer.onClick.AddListener(() =>
        {
            if (string.IsNullOrEmpty(inputAnswer.text))
            {
                return;
            }
            UStaticWebRequests.OnWebRequest("Question/Answer", "username="******"&token=" + UILogin.token + "&answer=" + inputAnswer.text, jobj =>
            {
                if (jobj.ContainsKey("avatar"))
                {
                    ShowWidget("question", false);
                    URemoteData.OnReceiveAvatarData(jobj["avatar"].ToString());
                    UIAlert.Show("回答正确!");
                    btnGetQuestion.gameObject.SetActive(true);
                }
                else
                {
                    UIAlert.Show("回答错误,再好好想想吧。");
                }
            },
                                            jfail =>
            {
                UIAlert.Show("回答错误,再好好想想吧。");
            });
        });


        URemoteData.ListeningParam(InfoNameDefs.AvatarLevel, ShowLevel);
    }
예제 #12
0
        public DataHandler(string path, IDataPlugin plugin) : base(plugin)
        {
            _actionHandler = new ActionHandler(path, "events.json", Plugin.Logger);
            _actionHandler.AddAction("meteors", typeof(MeteorAction));

            _actionHandler.AddAction("power_on", typeof(EnablePowerAction));
            _actionHandler.AddAction("power_off", typeof(DisablePowerAction));
            _actionHandler.AddAction("power_toggle", typeof(TogglePowerAction));

            _actionHandler.AddAction("toggle_power", typeof(TogglePowerAction));
            _actionHandler.AddAction("enable_power", typeof(EnablePowerAction));
            _actionHandler.AddAction("disable_power", typeof(DisablePowerAction));

            _actionHandler.AddAction("refill", typeof(RefillAction));
            _actionHandler.AddAction("power_up", typeof(PowerUpAction));
            _actionHandler.AddAction("power_down", typeof(PowerDownAction));

            _actionHandler.AddAction("toggle_dampeners", typeof(ToggleDampenersAction));
            _actionHandler.AddAction("enable_dampeners", typeof(EnableDampenersAction));
            _actionHandler.AddAction("disable_dampeners", typeof(DisableDampenersAction));

            _actionHandler.AddAction("toggle_thrusters", typeof(ToggleThrustersAction));
            _actionHandler.AddAction("enable_thrusters", typeof(EnableThrustersAction));
            _actionHandler.AddAction("disable_thrusters", typeof(DisableThrustersAction));

            _actionHandler.AddAction("toggle_helmet", typeof(ToggleHelmetAction));
            _actionHandler.AddAction("enable_helmet", typeof(EnableHelmetAction));
            _actionHandler.AddAction("disable_helmet", typeof(DisableHelmetAction));

            _actionHandler.AddAction("fulfill_buildplanner", typeof(FulfillBuildPlannerAction));
            _actionHandler.AddAction("give_item", typeof(GiveItemAction));
            _actionHandler.AddAction("inventory_bomb", typeof(InventoryBombAction));

            _actionHandler.AddAction("multi", typeof(MultiActions));
            _actionHandler.AddAction("random", typeof(RandomAction));
            _actionHandler.AddAction("warhead", typeof(WarheadAction));
            _actionHandler.AddAction("spawn_drone", typeof(SpawnDroneAction));
            _actionHandler.AddAction("snap", typeof(SnapAction));

            _actionHandler.AddAction("charge_jump_drive", typeof(ChargeJumpDriveAction));
            //_actionHandler.AddAction("start_jump_drive", typeof(StartJumpDriveAction));
            _actionHandler.StartWatching();
        }
예제 #13
0
        public DataHandler(string path) : base(Plugin.Static.Logger)
        {
            _actionHandler = new ActionHandler(path, "events.json", Logger);
            _actionHandler.AddAction("meteors", typeof(MeteorAction));

            _actionHandler.AddAction("power_on", typeof(EnablePowerAction));
            _actionHandler.AddAction("power_off", typeof(DisablePowerAction));
            _actionHandler.AddAction("power_toggle", typeof(TogglePowerAction));

            _actionHandler.AddAction("toggle_power", typeof(TogglePowerAction));
            _actionHandler.AddAction("enable_power", typeof(EnablePowerAction));
            _actionHandler.AddAction("disable_power", typeof(DisablePowerAction));

            _actionHandler.AddAction("refill", typeof(RefillAction));
            _actionHandler.AddAction("power_up", typeof(PowerUpAction));
            _actionHandler.AddAction("power_down", typeof(PowerDownAction));

            _actionHandler.AddAction("toggle_dampeners", typeof(ToggleDampenersAction));
            _actionHandler.AddAction("enable_dampeners", typeof(EnableDampenersAction));
            _actionHandler.AddAction("disable_dampeners", typeof(DisableDampenersAction));

            _actionHandler.AddAction("toggle_thrusters", typeof(ToggleThrustersAction));
            _actionHandler.AddAction("enable_thrusters", typeof(EnableThrustersAction));
            _actionHandler.AddAction("disable_thrusters", typeof(DisableThrustersAction));

            _actionHandler.AddAction("fulfill_buildplanner", typeof(FulfillBuildPlannerAction));
            _actionHandler.AddAction("random", typeof(RandomAction));
            _actionHandler.StartWatching();
        }