コード例 #1
0
        private static bool Do(ref int use, ref object first, ref object second, DoAction callback)
        {
#if DEBUG
            // NOTICE this method has no null check in the public build as an optimization, this is just to appease the dragons
            if (callback == null)
            {
                throw new ArgumentNullException(nameof(callback));
            }
#endif
            var foundFirst = Interlocked.CompareExchange(ref first, null, null);
            if (foundFirst == null)
            {
                return(false);
            }

            try
            {
                Interlocked.Increment(ref use);
                return(callback(ref first));
            }
            finally
            {
                DoLeave(ref use, ref first, ref second);
            }
        }
コード例 #2
0
    private IEnumerator createData()
    {
        bool exist = true;

        if (DoAction.getInstance().findFiles("monster01") == false)
        {
            MonsterCreate.getInstance().m01Create();
            MonsterCreate.getInstance().m02Create();
            MonsterCreate.getInstance().m03Create();
            MonsterCreate.getInstance().m04Create();
            MonsterCreate.getInstance().m05Create();
        }
        if (DoAction.getInstance().findFiles("skill01") == false)
        {
            SkillCreat.getInstance().skill01Create();
            SkillCreat.getInstance().skill02Create();
            SkillCreat.getInstance().skill03Create();
            SkillCreat.getInstance().skill04Create();
            SkillCreat.getInstance().skill05Create();
            SkillCreat.getInstance().skill06Create();
            SkillCreat.getInstance().skill07Create();
            SkillCreat.getInstance().skill08Create();
        }
        if (DoAction.getInstance().findFiles("player") == false)
        {
            PlayerCreate.getInstance().playerCreate();
        }
        if (DoAction.getInstance().findFiles("usingskill") == false)
        {
            OtherCreate.getInstance().usingSkill(1, 2, 3, 4);
        }

        yield return(0);
    }
コード例 #3
0
 public bool Do(int index, DoAction callback)
 {
     if (_level == 1)
     {
         var subIndex = SubIndex(index);
         return(Do
                (
                    ref _arrayUse[subIndex],
                    ref _arrayFirst[subIndex],
                    ref _arraySecond[subIndex],
                    callback
                ));
     }
     else
     {
         var subIndex = SubIndex(index);
         return(Do
                (
                    ref _arrayUse[subIndex],
                    ref _arrayFirst[subIndex],
                    ref _arraySecond[subIndex],
                    (ref object target) =>
         {
             try
             {
                 return ((BucketCore)target).Do(index, callback);
             }
             catch (NullReferenceException)
             {
                 return false;
             }
         }
                ));
     }
 }
コード例 #4
0
        public bool DoMayIncrement(int index, DoAction callback)
        {
            // Assume anything could have been set to null, start no sync operation, this could be running during DomainUnload
            var arrayFirst   = Volatile.Read(ref _arrayFirst);
            var arraySecond  = Volatile.Read(ref _arraySecond);
            var arrayUse     = Volatile.Read(ref _arrayUse);
            var childFactory = _childFactory;

            if (arrayFirst == null || arraySecond == null || arrayUse == null || childFactory == null)
            {
                return(false);
            }
            var subIndex = SubIndex(index);

            return(DoMayIncrement
                   (
                       ref arrayUse[subIndex],
                       ref arrayFirst[subIndex],
                       ref arraySecond[subIndex],
                       childFactory,
                       _level == 1
                    ? callback
                    : (ref object?target) => target is BucketCore core && core.DoMayIncrement(index, callback)
                   ));
        }
コード例 #5
0
ファイル: BucketCore.cs プロジェクト: NN---/Theraot
        public bool Do(int index, DoAction callback)
        {
            // Assume anything could have been set to null, start no sync operation, this could be running during DomainUnload
            var arrayFirst  = Volatile.Read(ref _arrayFirst);
            var arraySecond = Volatile.Read(ref _arraySecond);
            var arrayUse    = Volatile.Read(ref _arrayUse);

            if (arrayFirst == null || arraySecond == null || arrayUse == null)
            {
                return(false);
            }
            if (_level == 1)
            {
                var subIndex = SubIndex(index);
                return(Do
                       (
                           ref arrayUse[subIndex],
                           ref arrayFirst[subIndex],
                           ref arraySecond[subIndex],
                           callback
                       ));
            }
            else
            {
                var subIndex = SubIndex(index);
                return(Do
                       (
                           ref arrayUse[subIndex],
                           ref arrayFirst[subIndex],
                           ref arraySecond[subIndex],
                           (ref object target) => target is BucketCore core && core.Do(index, callback)
                       ));
            }
        }
コード例 #6
0
        // Essentially passing in a function.
        // Remember to actually call the function to execute it!
        public void GiveMeAMethod(DoAction tradeAction)
        {
            // What we get after actually calling the function
            var text = tradeAction();

            Console.WriteLine($"Basic Delegate -> {text}");
        }
コード例 #7
0
ファイル: Utils.cs プロジェクト: teknologika/McWatiN
 public static void TryActionIgnoreException(DoAction action)
 {
     try
     {
         action.Invoke();
     }
     catch { }
 }
コード例 #8
0
 static public DoAction getInstance()
 {
     if (_action == null)
     {
         _action = new DoAction();
     }
     return(_action);
 }
コード例 #9
0
 public void missionBlood(int mission)
 {
     temp_blood = DoAction.getInstance().bloodAndMission(0, mission, temp_blood);
     p_blood    = temp_blood;
     p_attack   = temp_attack;
     p_defend   = temp_defend;
     p_speed    = temp_speed;
     //temp_blood = p_blood;
 }
コード例 #10
0
 private static void j()
 {
     try
     {
         Stack.Push(DoAction.j());
     }
     catch (NfException)
     {
         throw new NfException("Trying to retrieve J outside of nested loop");
     }
 }
コード例 #11
0
ファイル: MenuItem.cs プロジェクト: Yinon-haver/projects
 internal void ActiveMenu()
 {
     if (DoAction == null)
     {
         DoWhenChosen();
     }
     else
     {
         DoAction.Invoke();
     }
 }
コード例 #12
0
        public ButtonTexture(Bitmap bitmap, DoAction doAction, bool selected = false) : base(doAction, selected)
        {
            Width  = 0.3f;
            Height = 0.2f;

            texture = TextureLoader.FromBitmap(bitmap);
            //background clear color
            //GL.ClearColor(Color.Black);
            //for transparency in textures we use blending
            GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha);
        }
コード例 #13
0
    public void m05Create()
    {
        Monster m = new Monster();

        m.Id     = 5;
        m.Blood  = 22.5f;
        m.Attack = 0.45f;
        m.Defend = 0;
        m.Speed  = 0.8f;
        DoAction.getInstance().writeData <Monster>(m, "Monster05");
    }
コード例 #14
0
    public void playerCreate()
    {
        Player p = new Player();

        p.Id     = 1;
        p.Blood  = 30;
        p.Defend = 10;
        p.Attack = 10;
        p.Speed  = 1;
        p.Level  = 1;
        DoAction.getInstance().writeData <Player>(p, "Player");
    }
コード例 #15
0
ファイル: CombinableDo.cs プロジェクト: adrianf223/DW.CodedUI
        /// <summary>
        /// Waits the given time.
        /// </summary>
        /// <param name="milliseconds">The milliseconds to wait.</param>
        /// <returns>A combinable Do to be able to append additional actions.</returns>
        public CombinableDo Wait(uint milliseconds)
        {
            _doAction      = DoAction.Action;
            _currentAction = () =>
            {
                LogPool.Append("Wait {0} milliseconds.", milliseconds);
                Thread.Sleep((int)milliseconds);
            };

            Execute();
            return(new CombinableDo());
        }
コード例 #16
0
ファイル: UserAction.cs プロジェクト: steve-stanton/backsight
        /// <summary>
        /// Creates a new <c>UserAction</c>
        /// </summary>
        /// <param name="items">The associated UI elements (at least one of them)</param>
        /// <param name="isActionEnabled">Delegate that can be used to determine if the action should be enabled (null means the
        /// action will always be enabled)</param>
        /// <param name="doAction">Delegate that should be called to perform the action (not null)</param>
        /// <exception cref="ArgumentNullException">If <paramref name="doAction"/> is null, or the associated
        /// UI elements are empty or null</exception>
        public UserAction(ToolStripItem[] items, IsActionEnabled isActionEnabled, DoAction doAction)
        {
            if (doAction==null)
                throw new ArgumentNullException();

            m_Elements = new UserActionSupport(items);
            m_IsActionEnabled = isActionEnabled;
            m_DoAction = doAction;

            // Wire the supplied UI elements to a suitable handler
            m_Elements.SetHandler(Do);
        }
コード例 #17
0
    public void skill05Create()
    {
        Skill s = new Skill();

        s.Skill_id             = 5;
        s.Skill_name           = "no.5";
        s.Skill_attack         = 10;
        s.Skill_CD             = 5;
        s.Skill_Dir            = 10; s.BuffType = new Buff();
        s.BuffType.MonsterBuff = Buff.MONSTERBUFF.FIREDAMAGE;
        s.ResName = @"";
        DoAction.getInstance().writeData <Skill>(s, "Skill05");
    }
コード例 #18
0
        /// <summary>
        /// Load ra khung upload mutils
        /// </summary>
        public ActionResult AjaxFormPicture()
        {
            var type       = Request["Type"];
            var categoryId = Request["CategoryID"];
            var model      = new ModelPictureItem
            {
                Type       = !string.IsNullOrEmpty(type) ? Convert.ToInt32(type) : 0,
                CategoryID = !string.IsNullOrEmpty(categoryId) ? Convert.ToInt32(categoryId) : 0,
                Action     = DoAction.ToString(),
            };

            return(View(model));
        }
コード例 #19
0
ファイル: DebtController.cs プロジェクト: ngochieu0302/IG42
        public ActionResult AjaxForm()
        {
            var model = new FormDebtItem
            {
                ObjItem     = (DoAction == ActionType.Edit) ? _api.GetItemByID(ArrId.FirstOrDefault()) : new DebtItem(),
                Action      = DoAction.ToString(),
                AgencyId    = UserItem.AgencyID,
                UserId      = UserItem.UserId,
                DNSuppliers = supplieAPI.GetList(UserItem.AgencyID)
            };

            return(View(model));
        }
コード例 #20
0
 public ActionResult AjaxForm()
 {
     var model = new FormCashAdvanceItem
     {
         ObjItem = (DoAction == ActionType.Edit) ? _api.GetCashAdvanceItem(ArrId.FirstOrDefault()) : new CashAdvanceItem(),
         Action = DoAction.ToString(),
         AgencyId = UserItem.AgencyID,
         UserId = UserItem.UserId,
         Users = _userApi.GetListAllAgency(UserItem.AgencyID),
         Users1 = _userApi.GetAll(UserItem.AgencyID)
     };
     return View(model);
 }
コード例 #21
0
    public void skill04Create()
    {
        Skill s = new Skill();

        s.Skill_id             = 4;
        s.Skill_name           = "no.4";
        s.Skill_attack         = 8;
        s.Skill_CD             = 2;
        s.Skill_Dir            = 10; s.BuffType = new Buff();
        s.BuffType.MonsterBuff = Buff.MONSTERBUFF.HARDDAMAGE;
        s.ResName = @"F:\allprojects\unitypro\Nonstop_Finger\Assets\Data\skill03.jpg";
        DoAction.getInstance().writeData <Skill>(s, "Skill04");
    }
コード例 #22
0
    void Awake()
    {
        //Debug.Log(System.IO.Directory.GetCurrentDirectory());
        //DoAction.getInstance().writeData<string>(System.IO.Directory.GetCurrentDirectory(), System.IO.Directory.GetCurrentDirectory(), true);

        //_buff = new PlayerBuff();
        //_buff.getBuff().PlayerBuff = Buff.PLAYERBUFF.NONE;
        gameManager = Camera.main.gameObject;

        player    = new Player();
        p_skill01 = new Skill();
        p_skill02 = new Skill();
        p_skill03 = new Skill();
        p_skill04 = new Skill();

        setSkill01(1);
        setSkill02(2);
        setSkill03(3);
        setSkill04(4);
        //try
        //{
        player = DoAction.getInstance().readData <Player>(player);
        //}
        //catch (System.Exception e)
        //{ }
        //finally
        //{
        //    player.Id = 0;
        //    player.Blood = 23;
        //    player.Attack = 10;
        //    player.Defend = 10;
        //    player.Level = 1;
        //    player.Speed = 1;
        //    DoAction.getInstance().writeData<Player>(player);
        //}
        p_id     = player.Id;
        p_blood  = player.Blood;
        p_attack = player.Attack;
        //p_skill = new Skill();
        p_defend = player.Defend;
        p_speed  = player.Speed;
        p_level  = player.Level;

        temp_blood  = p_blood;
        temp_attack = p_attack;
        temp_defend = p_defend;
        temp_speed  = p_speed;

        //mission = GameManager.mission;
        //Debug.Log(p_blood);
    }
コード例 #23
0
        public ActionResult AjaxForm()
        {
            var model = new FormReceiptPaymentItem
            {
                ObjItem       = (DoAction == ActionType.Edit) ? _api.GetPaymentItem(ArrId.FirstOrDefault()) : new ReceiptPaymentItem(),
                Action        = DoAction.ToString(),
                AgencyId      = UserItem.AgencyID,
                UserId        = UserItem.UserId,
                Users         = _userApi.GetListAllAgency(UserItem.AgencyID),
                CostTypeItems = _costTypeApi.GetList(UserItem.AgencyID, (int)Vouchers.Payment)
            };

            return(View(model));
        }
コード例 #24
0
ファイル: UserAction.cs プロジェクト: 15831944/backsight
        /// <summary>
        /// Creates a new <c>UserAction</c>
        /// </summary>
        /// <param name="items">The associated UI elements (at least one of them)</param>
        /// <param name="isActionEnabled">Delegate that can be used to determine if the action should be enabled (null means the
        /// action will always be enabled)</param>
        /// <param name="doAction">Delegate that should be called to perform the action (not null)</param>
        /// <exception cref="ArgumentNullException">If <paramref name="doAction"/> is null, or the associated
        /// UI elements are empty or null</exception>
        public UserAction(ToolStripItem[] items, IsActionEnabled isActionEnabled, DoAction doAction)
        {
            if (doAction == null)
            {
                throw new ArgumentNullException();
            }

            m_Elements        = new UserActionSupport(items);
            m_IsActionEnabled = isActionEnabled;
            m_DoAction        = doAction;

            // Wire the supplied UI elements to a suitable handler
            m_Elements.SetHandler(Do);
        }
コード例 #25
0
        public ActionResult AjaxForm()
        {
            var model = new ModelDiscountItem
            {
                Action       = DoAction.ToString(),
                DiscountItem = new DiscountItem()
            };

            if (DoAction == ActionType.Edit)
            {
                model.DiscountItem = _api.GetItemById(ArrId.FirstOrDefault());
            }
            return(View(model));
        }
コード例 #26
0
        public static void  Test()
        {
            //实际上就是一种表驱动编程方法的实践
            Console.WriteLine("【委托的使用,字典的使用,以及[,]多维操作符的自定义】");
            ArgsActions aas = new ArgsActions();
            DoAction    da  = new DoAction();
            Action      a1  = da.PrintAdd;
            Action      a2  = da.PrintMod;

            aas.SetOption("add", a1);
            aas.SetOption("mod", a2);
            ArgsProcessor ap = new ArgsProcessor(aas);

            ap.Process(new string[] { "add", "mod" });
        }
コード例 #27
0
        public ButtonText(string buttonText, DoAction doAction, bool selected = false, bool enabled = true) : base(doAction, selected)
        {
            this.Text = buttonText;


            Width  = buttonText.Length * boundingBoxWidth / 20;
            Height = boundingBoxHeight;

            isEnabled = enabled;

            if (!enabled)
            {
                base.doAction = () => { }
            }
            ;
        }
コード例 #28
0
        /// <summary>
        /// Sau khi upload xong, cập nhật thông tin cho picture
        /// </summary>
        /// <returns></returns>
        public ActionResult AjaxFormPictureUpdate()
        {
            var arrFile     = Request["fileData"];
            var oSerializer = new JavaScriptSerializer();
            var ltsFileobj  = oSerializer.Deserialize <List <FileObj> >(arrFile);
            var type        = Request["Type"];
            var categoryId  = Request["CategoryID"];
            var model       = new ModelFileObj
            {
                ListCategoryItem = _categoryDa.GetChildByParentId(false),
                ListItem         = ltsFileobj,
                Type             = !string.IsNullOrEmpty(type) ? Convert.ToInt32(type) : 0,
                CategoryId       = !string.IsNullOrEmpty(categoryId) ? Convert.ToInt32(categoryId) : 0,
                Action           = DoAction.ToString()
            };

            return(View(model));
        }
コード例 #29
0
ファイル: CombinableDo.cs プロジェクト: adrianf223/DW.CodedUI
        /// <summary>
        /// Executes the given action.
        /// </summary>
        /// <param name="action">The action to execute.</param>
        /// <returns>A combinable Do to be able to append additional actions.</returns>
        /// <exception cref="System.Exception">Cannot invoke the given action.</exception>
        public CombinableDo Action(Action action)
        {
            _doAction      = DoAction.Action;
            _currentAction = () =>
            {
                try
                {
                    action();
                }
                catch (Exception ex)
                {
                    throw new LoggedException("Cannot invoke the given action. See inner exception.", ex);
                }
            };

            Execute();
            return(new CombinableDo(this));
        }
コード例 #30
0
ファイル: BucketCore.cs プロジェクト: pocketgems/Theraot
        private static bool Do(ref int use, ref object first, ref object second, DoAction callback)
        {
            var foundFirst = Interlocked.CompareExchange(ref first, null, null);

            if (foundFirst == null)
            {
                return(false);
            }
            try
            {
                Interlocked.Increment(ref use);
                return(callback(ref first));
            }
            finally
            {
                DoLeave(ref use, ref first, ref second);
            }
        }
コード例 #31
0
ファイル: CombinableDo.cs プロジェクト: adrianf223/DW.CodedUI
        /// <summary>
        /// Repeats the previous actions the given times.
        /// </summary>
        /// <param name="amount">The amount of repeats.</param>
        /// <returns>A combinable Do to be able to append additional actions.</returns>
        /// <remarks>The amount is additional to the calls before. That means Do.Action(() =&gt; { }).Repeat(2); will result in 3 action calls.</remarks>
        public CombinableDo Repeat(uint amount)
        {
            _currentAction = null;
            _doAction      = DoAction.Repeat;

            LogPool.Append("Repeat the previous action {0} times.", amount);

            for (int i = 0; i < amount; i++)
            {
                var previousDo = _previousDo;
                while (previousDo != null && previousDo._doAction != DoAction.Repeat)
                {
                    previousDo._currentAction();
                    previousDo = previousDo._previousDo;
                }
            }

            return(new CombinableDo(this));
        }
コード例 #32
0
ファイル: MovieDecoder.cs プロジェクト: heon21st/flashdevelop
		public override void  doAction(DoAction tag)
		{
			frame.doActions.Add(tag.actionList);
		}
コード例 #33
0
		public override void  doAction(DoAction tag)
		{
			open(tag);
			end();
			
			if (showActions)
			{
				openCDATA();
				printActions(tag.actionList);
				closeCDATA();
			}
			else
			{
				//UPGRADE_TODO: Method 'java.io.PrintWriter.println' was converted to 'System.IO.TextWriter.WriteLine' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaioPrintWriterprintln_javalangString'"
				out_Renamed.WriteLine("<!-- " + tag.actionList.size() + " action(s) elided -->");
			}
			close(tag);
		}
コード例 #34
0
 public EditingAction(EditingActionId id, ToolStripItem[] items, IsActionEnabled isActionEnabled, DoAction doAction)
     : base(items, isActionEnabled, doAction)
 {
     m_Id = id;
 }
コード例 #35
0
ファイル: UserAction.cs プロジェクト: steve-stanton/backsight
 /// <summary>
 /// Copy constructor
 /// </summary>
 /// <param name="action">The action to copy</param>
 protected UserAction(UserAction action)
 {
     m_Elements = action.m_Elements;
     m_IsActionEnabled = action.m_IsActionEnabled;
     m_DoAction = action.m_DoAction;
 }
コード例 #36
0
ファイル: UserAction.cs プロジェクト: steve-stanton/backsight
 /// <summary>
 /// Creates a <c>UserAction</c> that is invoked by one UI item that is
 /// always enabled.
 /// </summary>
 /// <param name="item">The associated UI element (not null)</param>
 /// <param name="doAction">Delegate that should be called to perform the action (not null)</param>
 public UserAction(ToolStripItem item, DoAction doAction)
     : this(new ToolStripItem[] { item }, null, doAction)
 {
 }
コード例 #37
0
ファイル: Workbench.cs プロジェクト: patrick963534/g11
 public static void DoAction(DoAction action)
 {
     s_singleton.Invoke(action);
 }
コード例 #38
0
 /// <summary>
 /// Creates a new <c>TextSizeAction</c>
 /// </summary>
 /// <param name="item">The associated UI element (not null)</param>
 /// <param name="doAction">Delegate that should be called to perform the action (not null)</param>
 /// <param name="sizeFactor">The magnification factor associated with the UI element (as a percentage
 /// of normal size)</param>
 /// <param name="defaultSizeFactor">The current default magnification factor (this will be compared
 /// with the supplied <paramref name="sizeFactor"/> to see whether a checkmark should be set alongside
 /// the supplied UI element)</param>
 internal TextSizeAction(ToolStripMenuItem item, DoAction doAction, uint sizeFactor, uint defaultSizeFactor)
     : base(item, doAction)
 {
     m_SizeFactor = sizeFactor;
     item.Checked = (sizeFactor==defaultSizeFactor);
 }
コード例 #39
0
		public override void  doAction(DoAction tag)
		{
			int adjust = 0;
			if (Debug)
			{
				adjust = writer.Pos + 6;
				debug.adjust += adjust;
			}
			
			new ActionEncoder(tagw, debug).encode(tag.actionList);
			tagw.writeUI8(0);
			encodeTag(tag);
			
			if (Debug)
			{
				debug.adjust -= adjust;
			}
		}