Esempio n. 1
0
    // Use this for initialization
    void Start()
    {
        areaTrigger = GetComponent <Collider2D> ();
//		if(roombaCount == 0 && roomba){
//			RespawnRoomba ();
//		}

        // initialize all the roomba childs
        foreach (Transform child in transform)
        {
            ObjectIdentity oi = child.GetComponent <ObjectIdentity> ();
            if (oi && oi.objType == ObjectType.Roomba)
            {
                ControlStatus cs = child.GetComponent <ControlStatus> ();
                if (cs)
                {
                    cs.Boss = transform;
                    if (hacker)
                    {
                        cs.Hacker = hacker;
                    }
                }
            }
        }
    }
Esempio n. 2
0
 public void Update(ControlStatus meas, UInt32 index, String id)
 {
     if (this.AllControlStatusUpdate != null)
     {
         sync.BeginInvoke(new Action(() => AllControlStatusUpdate(meas, index, id)), null);
     }
 }
Esempio n. 3
0
    void LineCutBehavior(Collider2D other)
    {
//		Debug.Log ("Collision");
//		Debug.Log (other.transform);
        ControlStatus  cs = other.GetComponentInParent <ControlStatus> ();
        ObjectIdentity oi = other.GetComponent <ObjectIdentity> ();

        if (cs == null || oi == null)
        {
            return;
        }
        bool controlledByBoss =
            (cs.controller == Controller.Boss);
        bool isLine =
            (oi.objType == ObjectType.Line);

//		Debug.Log (controlledByBoss);
//		Debug.Log (isLine);


        if (isLine && controlledByBoss && couldCut)          // && other.gameObject.GetComponent<LineRenderer>().startColor != Color.clear && other.gameObject.GetComponent<LineRenderer>().endColor != Color.clear)
        {
            // reaching an enemyline, cut it
            if (OnLineCut != null)
            {
                OnLineCut(this.transform);
            }
            cs.controller = Controller.None;
        }
    }
Esempio n. 4
0
    void HitVirusBehaviour(Collider2D coll)
    {
        if (HasControlStatus(coll.transform))
        {
            // the colliding object must have control status
            ControlStatus targetCS = coll.transform.GetComponent <ControlStatus> ();

            // verify that the enemy is not controlled by anything else
            if (NotControlled(coll.transform) == false)
            {
                // if the enemy is controlled by something else,
                // paralyze the target
                VirusActions va = coll.transform.GetComponent <VirusActions> ();
                if (va)
                {
                    va.Paralyze(paralyzeTime);
                }
                // bullet will destroy by itself
                return;
            }

            // if the enemy is not connected to anything right now...
            // the target is now acquired by the HACKER!
            targetCS.controller = Controller.Hacker;

            // modify layer so it wont collide
            coll.gameObject.layer = LayerMask.NameToLayer(friendlyVirusLayerName);
        }
    }
Esempio n. 5
0
        /// <summary>
        /// A simple way to set a visual status on controls (useful for showing an error has occurred on input)
        /// </summary>
        /// <param name="SomeControl"></param>
        /// <param name="Status"></param>
        public static void SetVisualStatus(this Control SomeControl, ControlStatus Status)
        {
            //This uses the control's Tag field to store the original backcolor of the control.
            if (SomeControl.Tag == null)
            {
                SomeControl.Tag = SomeControl.BackColor;
            }

            if (Status == ControlStatus.Error)
            {
                SomeControl.BackColor = Color.LightSalmon;
            }
            else if (Status == ControlStatus.Warning)
            {
                SomeControl.BackColor = Color.LemonChiffon;
            }
            else
            {
                if (SomeControl.Tag is Color)
                {
                    SomeControl.BackColor = (Color)SomeControl.Tag;
                }
                else
                {
                    //Logger.Warn("Could not find control's original color when setting status. Using White instead.")
                    SomeControl.BackColor = Color.White;
                }
            }
        }
Esempio n. 6
0
    void OnCollisionEnter2D(Collision2D coll)
    {
        Transform      target = coll.collider.transform;
        ObjectIdentity oi     = target.GetComponent <ObjectIdentity> ();

        if (oi && paralyzeTargets.Contains(oi.objType))
        {
            // paralyze the target
            switch (oi.objType)
            {
            case ObjectType.Virus:
            {
                ControlStatus cs = target.GetComponent <ControlStatus> ();
                if (cs && cs.controller != Controller.None)
                {
                    VirusActions va = coll.transform.GetComponent <VirusActions> ();
                    if (va)
                    {
                        va.Paralyze(paralyzeTime);
                    }
                }
                break;
            }
            }
        }
    }
Esempio n. 7
0
    bool IsEnemy(Transform target)
    {
        bool          isEnemy  = true;
        ControlStatus targetCS = target.GetComponent <ControlStatus> ();

        if (cs && targetCS)
        {
            if (targetCS.controller == Controller.None)
            {
                if (!includeUncontrolledTarget)
                {
                    return(false);
                }
                else
                {
                    return(true);
                }
            }
            if (cs.controller == targetCS.controller && cs.controller != Controller.None)
            {
                isEnemy = false;
            }
        }
        return(isEnemy);
    }
Esempio n. 8
0
    void RespawnRoomba()
    {
        GameObject roombaGO =
            Instantiate(roomba, transform.position, transform.rotation);

        roombaGO.transform.parent     = transform;
        roombaGO.transform.localScale = new Vector3(1f, 1f, 1f);
        // set boss and hacker
        ControlStatus cs = roombaGO.GetComponent <ControlStatus> ();

        if (cs)
        {
            cs.Boss   = this.transform;
            cs.Hacker = hacker;
        }
        if (hasOldRoomba)
        {
            FieldOfView fov = roombaGO.GetComponent <FieldOfView> ();
            if (fov)
            {
                fov.radius            = oldFovRadius;
                fov.ignoreVisionBlock = oldIgnoreVisionBlock;
            }
        }
        if (uncontrolled)
        {
            cs.controller = Controller.None;
            cs.GetComponent <LineUpdate> ().DisableLine();
        }
    }
Esempio n. 9
0
 protected override void OnMouseDown(MouseEventArgs e)
 {
     if (isDrawSlider)
     {
         if (e.Button == MouseButtons.Left)//左键按下
         {
             if (sliderRect.Contains(e.Location))
             {
                 if (sliderStatus != ControlStatus.Normal)
                 {
                     sliderStatus    = ControlStatus.Down;
                     sliderDownPoint = e.Location;
                     this.Invalidate();//重绘
                 }
             }
             else if (scrollBarRect.Contains(e.Location))
             {
                 if (e.Location.Y < sliderRect.Y)
                 {
                     //更改滑块的value值
                     this.SliderValue = e.Location.Y * (contentHight - this.Height) / (this.Height - sliderRect.Height);
                 }
                 else
                 {
                     this.SliderValue = (e.Location.Y - sliderRect.Height) * (contentHight - this.Height) / (this.Height - sliderRect.Height);
                 }
             }
         }
     }
     this.Focus();
     base.OnMouseDown(e);
 }
Esempio n. 10
0
    // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
    override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        Transform hacker = animator.GetComponentInChildren <ControlStatus> ().Hacker;

        if (hacker)
        {
            PlayerControl pc = hacker.GetComponent <PlayerControl> ();
            HealthSystem  hs = hacker.GetComponent <HealthSystem> ();
            if (pc && !hs.IsDead())
            {
                pc.canControl = true;
            }
        }
        ControlStatus cs = animator.GetComponentInChildren <ControlStatus> ();

        if (cs)
        {
            cs.controller = Controller.None;
        }

        LaserCannonSP lcsp = animator.GetComponent <LaserCannonSP> ();

        if (lcsp)
        {
            lcsp.SetNoneSprite();
        }


        animator.ResetTrigger("playerLink");
    }
Esempio n. 11
0
        /// <summary>
        /// Blocks execution of current thread until this service has completely stopped.
        /// This call must be performed by only 1 thread otherwise exception is thrown
        /// </summary>
        public void WaitForCompleteStop()
        {
            lock (m_StatusLock)
            {
                if (m_Status == ControlStatus.Inactive)
                {
                    return;
                }

                if (m_Status != ControlStatus.Stopping)
                {
                    SignalStop();
                }

                if (m_PendingWaitingStop)
                {
                    throw new NFXException(StringConsts.SERVICE_INVALID_STATE + "{0}.{1}".Args(Name, "WaitForCompleteStop() already blocked"));
                }

                m_PendingWaitingStop = true;
                try
                {
                    DoWaitForCompleteStop();
                }
                finally
                {
                    m_PendingWaitingStop = false;
                }

                m_Status = ControlStatus.Inactive;
            }
        }
Esempio n. 12
0
 protected override void OnMouseMove(MouseEventArgs e)
 {
     if (isDrawSlider)
     {
         if (sliderStatus == ControlStatus.Down)//拖动滑块
         {
             int diffY = e.Location.Y - sliderDownPoint.Y;
             this.SliderValue     = this.SliderValue + diffY * (contentHight - this.Height) / (this.Height - sliderRect.Height);
             this.sliderDownPoint = e.Location;
             return;
         }
         if (sliderRect.Contains(e.Location))//鼠标进入滑块
         {
             if (sliderStatus != ControlStatus.Hover)
             {
                 sliderStatus = ControlStatus.Hover;
                 this.Invalidate();//重绘
             }
         }
         else
         {
             if (sliderStatus != ControlStatus.Normal)
             {
                 sliderStatus = ControlStatus.Normal;
                 this.Invalidate();//重绘
             }
         }
     }
     base.OnMouseMove(e);
 }
Esempio n. 13
0
    // Use this for initialization
    void Start()
    {
        ct = GetComponent <ChaseTarget> ();
        cs = GetComponent <ControlStatus> ();
        hd = GetComponent <HurtAndDamage> ();

        if (ct)
        {
            defaultRotSpeed  = ct.rotationSpeed;
            defaultMoveSpeed = ct.moveSpeed;
        }

        virusState    = VirusState.Idle;
        previousState = VirusState.Idle;

        ResetActions();
        if (OnIdleStart != null)
        {
            OnIdleStart(this.transform);
        }

        paralyzeTime = 5f;

        tp  = GetComponent <VirusTargetPicker> ();
        vpm = transform.parent.GetComponent <VirusPosManager> ();

        if (cs)
        {
            cs.OnCutByEnemy  += StopStateControl;
            cs.OnCutByPlayer += StopStateControl;

            cs.OnLinkedByEnemy  += StartStateControl;
            cs.OnLinkedByPlayer += StartStateControl;
        }
    }
Esempio n. 14
0
    // Use this for initialization
    void Start()
    {
        audioS = GetComponent <AudioSource>();
        cs     = GetComponent <ControlStatus> ();

        cs.OnCutByPlayer   += LightTower;
        cs.OnLinkedByEnemy += UnlightTower;
    }
Esempio n. 15
0
    // Use this for initialization
    void Start()
    {
        cs = GetComponent <ControlStatus> ();

        cs.OnLinkedByPlayer += ChangeLayerToFriend;
        cs.OnCutByEnemy     += ChangeLayerToEnemy;
        //cs.OnLinkedByEnemy += ChangeLayerToEnemy;
    }
Esempio n. 16
0
 void Start()
 {
     cs = GetComponent <ControlStatus> ();
     if (useInitialFacing)
     {
         facing = Direction2Vector(initialDirection);
     }
 }
Esempio n. 17
0
    // Use this for initialization
    void Start()
    {
        CS = GetComponent <ControlStatus>();

        ChangeBossHint();

        CS.OnCutByPlayer    += ChangeNoneHint;
        CS.OnLinkedByPlayer += ChangeHackerHint;
    }
Esempio n. 18
0
 // Use this for initialization
 void Start()
 {
     cs        = GetComponent <ControlStatus> ();
     wallLaser = laserWall.GetComponentInChildren <WallLaser> ();
     if (laserWall != null)
     {
         StartCoroutine(BindLaserWallActionIE());
     }
 }
Esempio n. 19
0
File: Service.cs Progetto: sk8tz/nfx
 /// <summary>
 /// Non-blocking call that initiates the stopping of the service
 /// </summary>
 public void SignalStop()
 {
     lock (m_StatusLock)
         if (m_Status == ControlStatus.Active)
         {
             m_Status = ControlStatus.Stopping;
             DoSignalStop();
         }
 }
Esempio n. 20
0
    public override void OnInspectorGUI()
    {
        ControlStatus cs = (ControlStatus)target;

        EditorGUILayout.LabelField("Controller", cs.controller.ToString());

        DrawDefaultInspector();

        this.Repaint();
    }
Esempio n. 21
0
    // verify if a transform's object is controlled
    // return false if it connot find ControlStatus on the transform
    bool NotControlled(Transform controllable)
    {
        ControlStatus cs = controllable.GetComponentInParent <ControlStatus> ();

        if (cs == null)
        {
            return(false);
        }
        return(cs.controller == Controller.None);
    }
Esempio n. 22
0
    // Respawn the virus around a circle with the radius of respawnRadius
    void Respawn()
    {
        if (hs && hs.IsDead())
        {
            return;
        }

        for (int i = 0; i < respawnCount; ++i)
        {
            GameObject newVirus =
                Instantiate(virusPrefab, transform.position, transform.rotation);
            if (fov)
            {
                newVirus.GetComponentInChildren <VirusPosReceiver>().transform.up = fov.facing;
            }
            newVirus.transform.parent = transform;

            ControlStatus cs = newVirus.GetComponentInChildren <ControlStatus> ();
            if (cs)
            {
                cs.Hacker = this.hacker;
                cs.Boss   = transform;
            }

            // stop the virus from changing its virusState until it is
            // reaching the spreadRadius
            VirusStateControl vsc = newVirus.GetComponentInChildren <VirusStateControl> ();
            vsc.enabled = false;
            StartCoroutine(EnableStateChange(newVirus.transform));
        }
//		if(virusPrefab == null || respawnCount == 0){
//			return;
//		}
//		float deltaAngle = 360f / respawnCount;
//		float curAngle = 0f;
//		for(int virusIndex = 0; virusIndex < respawnCount; virusIndex ++){
//			float dirx = Mathf.Cos (curAngle * Mathf.Deg2Rad);
//			float diry = Mathf.Sin (curAngle * Mathf.Deg2Rad);
//			Vector3 virusDir = new Vector3 (dirx, diry, 0f);
//			virusDir.Normalize ();
//
//			Vector3 virusPosOffset = virusDir * respawnRadius;
//			Vector3 virusNewPos = transform.position + virusPosOffset;
//
//			Quaternion newRot = new Quaternion();
//			newRot.eulerAngles = new Vector3 (0f, 0f, curAngle - 90f);
//			// instantiate the virus
//			GameObject newVirus = Instantiate (virusPrefab, virusNewPos, newRot);
//			newVirus.transform.SetParent (this.transform);
//
//			curAngle += deltaAngle;
//		}
//		currentCount += respawnCount;
    }
Esempio n. 23
0
        public ActionResult Create(ControlStatus status)
        {
            if (ModelState.IsValid)
            {
                _controlStatusDao.Create(status);
                return(RedirectToAction("Index", "ControlStatus"));
            }

            ViewBag.categories = _controlStatusDao.GetAll().ToList();
            return(View("Index"));
        }
Esempio n. 24
0
    // Use this for initialization
    void Start()
    {
        if (findRendererInParent)
        {
            spRenderer = transform.parent.GetComponent <SpriteRenderer> ();
        }
        else
        {
            spRenderer = GetComponent <SpriteRenderer> ();
        }

        if (spRenderer)
        {
            switch (defaultController)
            {
            case Controller.Boss:
                if (BossControlSprite)
                {
                    spRenderer.sprite = BossControlSprite;
                }
                break;

            case Controller.Hacker:
                if (HackerControlSprite)
                {
                    spRenderer.sprite = HackerControlSprite;
                }
                break;

            case Controller.None:
                if (NoneControlSprite)
                {
                    spRenderer.sprite = NoneControlSprite;
                }
                break;
            }
        }
        // add the switch sprite methods to actions
        ControlStatus cs = GetComponent <ControlStatus> ();

        if (cs)
        {
            cs.OnLinkedByEnemy  += SpriteToBoss;
            cs.OnLinkedByPlayer += SpriteToHacker;
            cs.OnCutByEnemy     += SpriteToNone;
            cs.OnCutByPlayer    += SpriteToNone;
        }
        else
        {
            Debug.LogError("cannot find control status");
        }
    }
Esempio n. 25
0
File: Service.cs Progetto: sk8tz/nfx
        /// <summary>
        /// Allows to abort unsuccessful DoStart() overridden implementation.
        /// This method must be called from within DoStart()
        /// </summary>
        protected void AbortStart()
        {
            var trace = new StackTrace(1, false);

            if (!trace.GetFrames().Any(f => f.GetMethod().Name.Equals("DoStart", StringComparison.Ordinal)))
            {
                Debugging.Fail(
                    text:   "Service.AbortStart() must be called from within DoStart()",
                    action: DebugAction.ThrowAndLog);
            }

            m_Status = ControlStatus.AbortingStart;
        }
Esempio n. 26
0
        protected override void OnMouseLeave(EventArgs e)
        {
            if (isDrawSlider)
            {
                if (sliderStatus != ControlStatus.Normal)//是从滑块移动出界的,重绘。
                {
                    sliderStatus = ControlStatus.Normal;
                    this.Invalidate();
                }
            }

            base.OnMouseLeave(e);
        }
Esempio n. 27
0
        private void setControlStatus(ControlStatus controlStatus)
        {
            btnNewLot.Text = (controlStatus == ControlStatus.status_newlot) ? "Done" : "New Lot";

            txtProgramName.ReadOnly      = controlStatus != ControlStatus.status_newlot;
            txtDeviceName.ReadOnly       = controlStatus != ControlStatus.status_newlot;
            txtLotNo.ReadOnly            = controlStatus != ControlStatus.status_newlot;
            txtTestCode.ReadOnly         = controlStatus != ControlStatus.status_newlot;
            txtProgramDirectory.ReadOnly = controlStatus != ControlStatus.status_newlot;
            btnProgramDirectory.Enabled  = controlStatus == ControlStatus.status_newlot;
            txtDatalogDirectory.ReadOnly = controlStatus != ControlStatus.status_newlot;
            btnDatalogDirectory.Enabled  = controlStatus == ControlStatus.status_newlot;
        }
 /// <summary>
 /// 设置系统按钮样式
 /// </summary>
 /// <param name="style">系统按钮样式</param>
 public void SetStyle(SysButtonStyle style)
 {
     switch (style)
     {
     case SysButtonStyle.KingSoftV4:
         this.Size        = new Size(43, 21);
         mStatusImages[0] = Resources.sysbtn_ksv4_close_normal;
         mStatusImages[1] = Resources.sysbtn_ksv4_close_over;
         mStatusImages[2] = Resources.sysbtn_ksv4_close_down;
         break;
     }
     // 重新设置控件状态以便绘制背景图像
     ControlStatus = ControlStatus.Normal;
 }
Esempio n. 29
0
    void Start()
    {
        myRigidbody2D = this.transform.GetComponent <Rigidbody2D> ();

        oldDrag        = (myRigidbody2D != null) ? myRigidbody2D.drag : 0f;
        oldAngularDrag = (myRigidbody2D != null) ? myRigidbody2D.angularDrag : 0f;

        hd = GetComponent <HurtAndDamage> ();
        cs = GetComponent <ControlStatus> ();
        hs = GetComponent <HealthSystem> ();


        StartCoroutine(BindVirusActionIE());
    }
Esempio n. 30
0
    void DefaultBehaviour(Collision2D coll)
    {
        //Debug.Log (coll.transform);
        ControlStatus cs = coll.transform.GetComponentInParent <ControlStatus> ();

        if (!cs)
        {
            return;
        }
        if (NotControlled(coll.transform))
        {
            // it the door is not controlled by the boss...
            coll.transform.GetComponentInParent <ControlStatus> ().controller = Controller.Hacker;
        }
    }
        // �������¼�
        private void TextBox_MouseEnter(object sender, EventArgs e)
        {
            // �޸ı���
            mControlStatus = ControlStatus.Hover;
            Invalidate();

            // �ж��Ƿ���ˮӡ
            if (mWatermark != null)
            {
                // �ж��ı��Ƿ�ΪĬ���ı�
                if (string.Equals(mTextbox.Text, mWatermark))
                {
                    mTextbox.Text = string.Empty;
                    mTextbox.ForeColor = Color.Black;
                }
            }
        }
        /// <summary>
        /// 用特定的文本、大小和位置初始化 Control 类的新实例
        /// </summary>
        /// <param name="text">控件显示的文本</param>
        /// <param name="left">控件距其容器左边缘的 X 位置(以像素为单位)。 该值被分配给 Left 属性</param>
        /// <param name="top">控件距其容器上边缘的 Y 位置(以像素为单位)。 该值被分配给 Top 属性</param>
        /// <param name="width">控件的宽度(以像素为单位)。该值被分配给 Width 属性</param>
        /// <param name="height">控件的高度(以像素为单位)。该值被分配给 Height 属性</param>
        public CharmControl(
            string text,
            int left,
            int top,
            int width,
            int height)
        {
            // * 版权声明 *
            mProductName = "CharmControlLibrary";
            mCompanyName = "CSBox工作室";
            mProductVersion = "2.0.*";

            // * 初始化属性 *
            mText = text;
            mLeft = left;
            mTop = top;
            mWidth = width;
            mHeight = height;

            mBackgroundImage = new Bitmap(width, height);
            mClientRectangle = new Rectangle(left, top, width, height);
            mSize = mClientRectangle.Size;
            mLocation = mClientRectangle.Location;
            mClientSize = mClientRectangle.Size;
            mControls = new List<CharmControl>();
            mControlStatus = ControlStatus.Normal;
            mCursor = Cursors.Arrow;
            mFont = new Font("微软雅黑", 9);
            mForeColor = Color.Black;
            Random rand = new Random();
            mHandle = (IntPtr)rand.Next(100000, 999999);
            mName = string.Empty;
            mTabIndex = 0;
            mIsTabStop = true;
            mIsAllowDrop = false;
            mIsEnabled = true;
            mIsFocused = false;
            mIsVisible = true;

            // * 释放系统资源 *
        }
Esempio n. 33
0
 /// <summary>
 ///     设置付款控制状态
 /// </summary>
 /// <param name="status">付款控制状态</param>
 public void SetControlStatus(ControlStatus status)
 {
     switch (status)
     {
         case ControlStatus.正常支付:
             Status = ControlStatus.正常支付;
             break;
         case ControlStatus.暂缓支付:
             Status = ControlStatus.暂缓支付;
             break;
         case ControlStatus.已匹配发票:
             Status = ControlStatus.已匹配发票;
             break;
         case ControlStatus.已完成:
             Status = ControlStatus.已完成;
             break;
         default:
             throw new ArgumentOutOfRangeException("status");
     }
 }
        // ����뿪�¼�
        private void TextBox_MouseLeave(object sender, EventArgs e)
        {
            // �޸ı���
            mControlStatus = ControlStatus.Normal;
            Invalidate();

            // �ж��Ƿ�ӵ�н�������ˮӡ
            if (!mTextbox.Focused)
            {
                if (mWatermark != null)
                {
                    // �ж��ı��Ƿ�Ϊ��
                    if (string.Equals(mTextbox.Text, string.Empty))
                    {
                        mTextbox.ForeColor = Color.DarkGray;
                        mTextbox.Text = mWatermark;
                    }
                }
            }
        }
Esempio n. 35
0
        /// <summary>
        ///     设置发票ID
        /// </summary>
        /// <param name="id">发票ID</param>
        public void SetInvoice(int id)
        {
            if (id == 0)
            {
                throw new ArgumentException("发票ID参数为空!");
            }

            InvoiceId = id;
            Status = ControlStatus.已匹配发票;
        }
Esempio n. 36
0
        /// <summary>
        ///     设置发票
        /// </summary>
        /// <param name="invoice">发票</param>
        public void SetInvoice(Invoice invoice)
        {
            if (invoice == null || invoice.IsTransient())
            {
                throw new ArgumentException("发票参数为空!");
            }

            Invoice = invoice;
            InvoiceId = invoice.Id;
            Status = ControlStatus.已匹配发票;
        }
Esempio n. 37
0
 /// <summary>
 /// Blocking call that starts the service instance
 /// </summary>
 public void Start()
 {
     EnsureObjectNotDisposed();
         lock (m_StatusLock)
             if (m_Status == ControlStatus.Inactive)
             {
                 m_Status = ControlStatus.Starting;
                 try
                 {
                   Behavior.ApplyBehaviorAttributes(this);
                   DoStart();
                   m_Status = ControlStatus.Active;
                 }
                 catch
                 {
                   m_Status = ControlStatus.Inactive;
                   throw;
                 }
             }
 }
Esempio n. 38
0
 /// <summary>
 /// Non-blocking call that initiates the stopping of the service
 /// </summary>
 public void SignalStop()
 {
     lock (m_StatusLock)
             if (m_Status == ControlStatus.Active)
             {
                 m_Status = ControlStatus.Stopping;
                 DoSignalStop();
             }
 }
Esempio n. 39
0
        /// <summary>
        /// Blocks execution of current thread until this service has completely stopped
        /// </summary>
        public void WaitForCompleteStop()
        {
            lock (m_StatusLock)
                {
                    if (m_Status == ControlStatus.Inactive) return;

                    if (m_Status != ControlStatus.Stopping) SignalStop();

                    DoWaitForCompleteStop();

                    m_Status = ControlStatus.Inactive;
                }
        }
Esempio n. 40
0
		//设置文本控件的可用性
		private void SetAllTextControls(ControlStatus ctr)
		{
			if (CutShowMode== FormShowMode.AddOne || CutShowMode == FormShowMode.ContinueAdd ||CutShowMode== FormShowMode.DisplayCurrent||CutShowMode== FormShowMode.ReadOnlyForOne )
				FormPager.Visible = false ;
			else FormPager.Visible = true ;
			switch (ctr)
			{
				case ControlStatus.ReSet :
					SetControlReSet () ;
				return ;
				case ControlStatus.Edit :
					SetControlEdit () ;
				return ;
				case ControlStatus.ReadOnly :
					SetControlReadOnly () ;
				return ;
			}
			
		}
Esempio n. 41
0
        /// <summary>
        /// Allows to abort unsuccessful DoStart() overridden implementation.
        /// This method must be called from within DoStart()
        /// </summary>
        protected void AbortStart()
        {
            var trace = new StackTrace(1, false);

                if (!trace.GetFrames().Any(f => f.GetMethod().Name.Equals("DoStart", StringComparison.Ordinal)))
                    Debugging.Fail(
                        text:   "Service.AbortStart() must be called from within DoStart()",
                        action: DebugAction.ThrowAndLog);

                m_Status = ControlStatus.AbortingStart;
        }
Esempio n. 42
0
 private void RemovePanel()
 {
     _screenBuf = null;
     _sprites.ControlPanel = null;
     _sprites.Button = null;
     _sprites.ButtonDown = null;
     _sprites.SavePanel = null;
     _sprites.YesNo = null;
     _sprites.Slide = null;
     _sprites.Slide2 = null;
     _sprites.Slode = null;
     _sprites.Slode2 = null;
     _sprites.MusicBodge = null;
     _controlPanel = null;
     _exitButton = null;
     _controlPanel = null;
     _slide = null;
     _slide2 = null;
     _slode = null;
     _restorePanButton = null;
     _savePanel = null;
     _saveButton = null;
     _downFastButton = null;
     _downSlowButton = null;
     _upFastButton = null;
     _upSlowButton = null;
     _quitButton = null;
     _autoSaveButton = null;
     _savePanButton = null;
     _dosPanButton = null;
     _restartPanButton = null;
     _fxPanButton = null;
     _musicPanButton = null;
     _bodge = null;
     _yesNo = null;
     _text = null;
     _statusBar = null;
     _restoreButton = null;
     _textSprite = null;
 }
Esempio n. 43
0
        private void InitPanel()
        {
            _screenBuf = new byte[Screen.GameScreenWidth * Screen.FullScreenHeight];

            var volY = (ushort)((127 - _skyMusic.Volume) / 4 + 59 - MpnlY); // volume slider's Y coordinate
            var spdY = (ushort)((SystemVars.Instance.GameSpeed - 2) / SpeedMultiply);
            spdY += MpnlY + 83; // speed slider's initial position

            _sprites.ControlPanel = _skyDisk.LoadFile(60500);
            _sprites.Button = _skyDisk.LoadFile(60501);
            _sprites.ButtonDown = _skyDisk.LoadFile(60502);
            _sprites.SavePanel = _skyDisk.LoadFile(60503);
            _sprites.YesNo = _skyDisk.LoadFile(60504);
            _sprites.Slide = _skyDisk.LoadFile(60505);
            _sprites.Slode = _skyDisk.LoadFile(60506);
            _sprites.Slode2 = _skyDisk.LoadFile(60507);
            _sprites.Slide2 = _skyDisk.LoadFile(60508);
            if (SystemVars.Instance.GameVersion.Version.Minor < 368)
                _sprites.MusicBodge = null;
            else
                _sprites.MusicBodge = _skyDisk.LoadFile(60509);

            //Main control panel:                                            X    Y Text       OnClick
            _controlPanel = CreateResource(_sprites.ControlPanel, 1, 0, 0, 0, 0, DoNothing, Mainpanel);
            _exitButton = CreateResource(_sprites.Button, 3, 0, 16, 125, 50, Exit, Mainpanel);
            _slide = CreateResource(_sprites.Slide2, 1, 0, 19, (short)spdY, 95, SpeedSlide, Mainpanel);
            _slide2 = CreateResource(_sprites.Slide2, 1, 0, 19, (short)volY, 14, MusicSlide, Mainpanel);
            _slode = CreateResource(_sprites.Slode2, 1, 0, 9, 49, 0, DoNothing, Mainpanel);
            _restorePanButton = CreateResource(_sprites.Button, 3, 0, 58, 19, 51, RestGamePanel, Mainpanel);
            _savePanButton = CreateResource(_sprites.Button, 3, 0, 58, 39, 48, SaveGamePanel, Mainpanel);
            _dosPanButton = CreateResource(_sprites.Button, 3, 0, 58, 59, 93, QuitToDos, Mainpanel);
            _restartPanButton = CreateResource(_sprites.Button, 3, 0, 58, 79, 94, Restart, Mainpanel);
            _fxPanButton = CreateResource(_sprites.Button, 3, 0, 58, 99, 90, ToggleFx, Mainpanel);

            if (SkyEngine.IsCDVersion)
            {
                // CD Version: Toggle text/speech
                _musicPanButton = CreateResource(_sprites.Button, 3, 0, 58, 119, 52, ToggleText, Mainpanel);
            }
            else
            {
                // disk version: toggle music on/off
                _musicPanButton = CreateResource(_sprites.Button, 3, 0, 58, 119, 91, ToggleMs, Mainpanel);
            }
            _bodge = CreateResource(_sprites.MusicBodge, 2, 1, 98, 115, 0, DoNothing, Mainpanel);
            _yesNo = CreateResource(_sprites.YesNo, 1, 0, -2, 40, 0, DoNothing, Mainpanel);

            _text = new TextResource(null, 1, 0, 15, 137, 0, DoNothing, _system, _screenBuf);
            _controlPanLookList = new[]
            {
                _exitButton,
                _restorePanButton,
                _savePanButton,
                _dosPanButton,
                _restartPanButton,
                _fxPanButton,
                _musicPanButton,
                _slide,
                _slide2
            };


            // save/restore panel
            _savePanel = CreateResource(_sprites.SavePanel, 1, 0, 0, 0, 0, DoNothing, Savepanel);
            _saveButton = CreateResource(_sprites.Button, 3, 0, 29, 129, 48, SaveAGame, Savepanel);
            _downFastButton = CreateResource(_sprites.ButtonDown, 1, 0, 212, 114, 0, ShiftDownFast, Savepanel);
            _downSlowButton = CreateResource(_sprites.ButtonDown, 1, 0, 212, 104, 0, ShiftDownSlow, Savepanel);
            _upFastButton = CreateResource(_sprites.ButtonDown, 1, 0, 212, 10, 0, ShiftUpFast, Savepanel);
            _upSlowButton = CreateResource(_sprites.ButtonDown, 1, 0, 212, 21, 0, ShiftUpSlow, Savepanel);
            _quitButton = CreateResource(_sprites.Button, 3, 0, 72, 129, 49, SpCancel, Savepanel);
            _restoreButton = CreateResource(_sprites.Button, 3, 0, 29, 129, 51, RestoreAGame, Savepanel);
            _autoSaveButton = CreateResource(_sprites.Button, 3, 0, 115, 129, 0x8FFF, RestoreAuto, Savepanel);

            _savePanLookList = new[]
            {
                _saveButton,
                _downSlowButton,
                _downFastButton,
                _upFastButton,
                _upSlowButton,
                _quitButton
            };
            _restorePanLookList = new[]
            {
                _restoreButton,
                _downSlowButton,
                _downFastButton,
                _upFastButton,
                _upSlowButton,
                _quitButton,
                _autoSaveButton
            };

            _statusBar = new ControlStatus(_skyText, _system, _screenBuf);

            _textSprite = null;
        }