public void changeState(bool Change){
			
				if (Change)
				{
					if (this.state == status.closed)
					{
						this.state = status.open;
					}	
					else 
					{
						Console.WriteLine("State is alraedy Open");
					}
				}	
				else 
				{
					if (this.state == status.open)
					{
						this.state = status.closed;
					}
					else 
					{
						Console.WriteLine("State is already closed");
					}
				}
			}
Exemplo n.º 2
0
 public void InitializationServer()
 {
     serverCommand.StartListener();
     dataOfThisGame = new GameData();
     currentStatus = status.on;
     WorkerThread();
 }
 public step(string name, string title, long start, status status)
 {
     nameField = name;
     titleField = title;
     startField = start;
     statusField = status;
 }
Exemplo n.º 4
0
	/// <summary>
	/// Initialises a new instance of the <see cref="Task"/> class.
	/// </summary>
	/// <param name="newName">The name of the task.</param>
	public Task (string newName)
	{
		this.name = newName;
		this.description = "Describe the task here";
		this.startDate = DateTime.Now;
		this.currentStatus = status.Open;
	}
Exemplo n.º 5
0
 public DBSearch(string qField, string qTerm, status qStatus, gender qGender)
 {
     this.queryField = qField;
     this.queryTerm = qTerm;
     this.queryGender = qGender;
     this.queryStatus = qStatus;
 }
Exemplo n.º 6
0
 public VertexSourceAdapter(IVertexSource vertexSource, IGenerator generator)
 {
     markers = new null_markers();
     this.VertexSource = vertexSource;
     this.generator = generator;
     m_status = status.initial;
 }
Exemplo n.º 7
0
	/// <summary>
	/// Initialises a new default instance of the <see cref="Task"/> class.
	/// </summary>
	public Task()
	{
		this.name = "New Task";
		this.description = "Describe the task here";
		this.startDate = DateTime.Now;
		this.currentStatus = status.Open;
	}
Exemplo n.º 8
0
	/// <summary>
	/// Initialises a new instance of the <see cref="Task"/> class.
	/// </summary>
	/// <param name="newName">The name of the task.</param>
	/// <param name="newDesc">A description.</param>
	public Task(string newName, string newDesc)
	{
		this.name = newName;
		this.description = newDesc;
		this.startDate = DateTime.Now;
		this.currentStatus = status.Open;
	}
Exemplo n.º 9
0
	public void Complete()
	{
		if (this.currentStatus == status.Open)
		{
			this.currentStatus = status.Solved;
			this.endDate = DateTime.Now;
		}
	}
Exemplo n.º 10
0
 void Awake()
 {
     currentStatus = GetComponent<status>();
     if(!currentStatus)
     {
         Debug.LogError("No Status Component Attached");
     }
 }
        protected int who_plays; //number of actual player;

        #endregion Fields

        #region Constructors

        public Domino_BaseRules(int game_time,
            int who_plays,
            int block_of_every_player)
        {
            this.status = status.stop;
            this.game_time = game_time;
            this.who_plays = who_plays;
            this.block_of_every_player = block_of_every_player;
        }
Exemplo n.º 12
0
 public Fairway(status player)
 {
     Player = player;
     Queen = false;
     Jump = false;
     StoneMove = false;
     Moves = new List<string>();
     Dests = new List<string>();
     Overs = new List<string>();
 }
Exemplo n.º 13
0
 // Кнопка умножения
 private void multiplicationButton_Click(object sender, RoutedEventArgs e)
 {
     // Если у нас статуса пока нет - делаем статус "умножение" и сохраняем переменную в буффер
     if (Status == status.нетСтатуса)
     {
         Status = status.умножение;
         buffer = окноВывода.Text;
         окноВывода.Text = "";
         окноВывода.Focus();
     }
 }
Exemplo n.º 14
0
    void Update()
    {

		m_acumTime += Time.deltaTime;

		switch (spotStatus) {
		case status.IDLE:
			if (m_acumTime > timeToSpawnHint) {
				CreateCollectableHint();
				spotStatus = status.HINT;
				m_acumTime =0;
			}
			break;
		case status.HINT:
			if (m_acumTime > hintLifetime) {
				CreateCollectableInSpot();
				spotStatus = status.POWERUPFULL;
				m_acumTime =0;
			}
			break;
		case status.POWERUPFULL:
			if (m_acumTime > powerupLifetime) {
				spotStatus = status.COOLDOWN;
				m_acumTime =0;
			}
			break;
		case status.COOLDOWN:
			if (m_acumTime > timeToCooldown) {
				spotStatus = status.IDLE;
				m_acumTime =0;
			}
			break;
		}
		/*


        if (!isFull)
        {
            m_acumTime += Time.deltaTime;

			if (m_acumTime > timeToSpawnHint && !hasHint)
			{
				CreateCollectableHint();
				//m_acumTime =0;
			}

			if (m_acumTime > timeToSpawnPowerUp && !isFull)
            {
                CreateCollectableInSpot();
                //m_acumTime = 0;
            }
        }*/
    }
Exemplo n.º 15
0
 public void FinalizationWorkingServer()
 {
     serverCommand.StopListener();
     for (int i = 0; i < ClientCommand.nextID; i++)
     {
         if (clients.ContainsKey(i) && clients[i].CurrentStatus == status.on)
         {
             clients[i].Disconnect();
         }
     }
     currentStatus = status.off;
 }
Exemplo n.º 16
0
 //define information of skill. a list of skill information. could be dirty and not effective but is esay to know
 public SkillInfo(int _number, string _skillName, int _damage, int _type, int _atktype, int[] _effect, status _status, int _maxChance, int _nowChance)
 {
     skillName = _skillName;
     number = _number;
     damage = _damage;
     type = _type;
     AtkType = _atktype;
     effect = _effect;
     giveStatus = _status;
     maxChance = _maxChance;
     nowChance = _nowChance;
 }
Exemplo n.º 17
0
 public SkillInfo(int _number)
 {
     SkillList asg = new SkillList();
     skillName = asg.SkillArray[_number].retSkillName();
     number = _number;
     damage = asg.SkillArray[_number].retDamage();
     type = asg.SkillArray[_number].retType();
     AtkType = asg.SkillArray[_number].retAtkType();
     effect = asg.SkillArray[_number].retEffect();
     giveStatus = asg.SkillArray[_number].retGiveStatus();
     maxChance = asg.SkillArray[_number].retMaxChance();
     nowChance = asg.SkillArray[_number].retNowChance();
 }
Exemplo n.º 18
0
        public Form1()
        {
            InitializeComponent();

            statSetter = ((message) => { m_statusText.Text = message; });
            ToggleTreeLoadIcon(false);
            ToggleListLoadIcon(false);
            //Ken added 11-9-12
            listView1.DoubleClick +=listView1_DoubleClick;
            //
            SetupWorker();

            LoadMoldListView();
        }
Exemplo n.º 19
0
	void Update()
	{

		m_acumTime += Time.deltaTime;
		particles.SetActive (false);
		switch (spotStatus) {
		case status.IDLE:
			if (m_acumTime > timeToSpawnHint) {
				CreateCollectableHint();
				spotStatus = status.HINT;
				m_acumTime =0;
			}
			break;
		case status.HINT:
			if (m_acumTime > hintLifetime) {
				CreateCollectableInSpot();
				spotStatus = status.RUNEFULL;
				m_acumTime =0;
			}
			break;
		case status.RUNEFULL:
			break;
		case status.COOLDOWN:
			particles.SetActive (true);
			if (m_acumTime > timeToCooldown) {
				spotStatus = status.IDLE;
				m_acumTime =0;
			}
			break;
		}
		/*


        if (!isFull)
        {
            m_acumTime += Time.deltaTime;

			if (m_acumTime > timeToSpawnHint && !hasHint)
			{
				CreateCollectableHint();
				//m_acumTime =0;
			}

			if (m_acumTime > timeToSpawnPowerUp && !isFull)
            {
                CreateCollectableInSpot();
                //m_acumTime = 0;
            }
        }*/
	}
Exemplo n.º 20
0
 public static String getStatusString(status s)
 {
     if (s == status.encomendada)
         return "encomendada";
     else if (s == status.preparacao)
         return "em preparação";
     else if (s == status.pronta)
         return "pronta para entrega";
     else if (s == status.entrega)
         return "em entrega";
     else if (s == status.concluida)
         return "concluída";
     return null;
 }
Exemplo n.º 21
0
        status Status;//текушее состояние
        
        

        // Кнопка "=" - считает результат по тому статусу, который выполняется
        private void button16_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                // если текущий статус деление
                if (Status == status.деление)
                {
                    Status = status.нетСтатуса;
                    double buff2 = double.Parse(окноВывода.Text);
		            if(buff2==0)
                    {
                        MessageBox.Show("Деление на ноль!");
                        return;
                    }

                    окноВывода.Text = (double.Parse(buffer) / buff2).ToString();
                } 
                // если текущий статус умножение
                if (Status == status.умножение)
                {
                    Status = status.нетСтатуса;
                    double buff2 = double.Parse(окноВывода.Text);
                    окноВывода.Text = (double.Parse(buffer) * buff2).ToString();
                }
                // если текущий статус вычитание
                if (Status == status.вычитание)
                {
                    Status = status.нетСтатуса;
                    double buff2 = double.Parse(окноВывода.Text);                    
                    окноВывода.Text = (double.Parse(buffer) - buff2).ToString();
                } 
                // если текущий статус добавление
                if (Status == status.сложение)
                {
                    Status = status.нетСтатуса;
                    double buff2 = double.Parse(окноВывода.Text);
                    окноВывода.Text = (double.Parse(buffer) + buff2).ToString();
                }
            }
            catch 
            {
            }
        }
Exemplo n.º 22
0
        public void Connect(string ip, int port)
        {
            //TODO change this ti lowercase.
            try {
                //Set the Host IP
                hostIP = ip;

                connectionStatus = status.connecting;

                //Register and Initialize the TCP Channel
                InitializeRemoteServer();
                hostInstance = new ScreenObject();

                castTimer.Enabled = true;
                connected = true;
                btnConnect.ImageIndex = 1;
                btnConnect.Text = "Disconnect";
                updatePanel(pnlBottom, true);
                updateText(lblMessage, "Connected to " + hostIP + " - " + DateTime.Now);
            } catch (Exception exc) {
                updateText(lblMessage, exc.Message);
            }
        }
Exemplo n.º 23
0
        /// <summary>
        /// コンストラクタ
        /// </summary>
        public CommPSO2Bot()
        {
            //タイムライン名をデバッグのため変更tritri ‏@sakatri
            //botName = "sakatri";
            twitterAccess = new CommTwitterizer();
            beforeTime = DateTime.Now;
            this.intervalMinutes = 1;
            this.currentStatus = status.OverTimeQuest;

            this.selectShipName = Properties.Settings.Default.saveShipName;

            var shipsBotUrl
                = new List<string>
                    (ConfigurationManager.AppSettings.Get("shipsBotUrl").Split(new char[] { ';' }));
            botUrls = new Dictionary<string, string>();
            int counter=1;
            foreach (var url in shipsBotUrl)
            {
                //botアプリ内でのship名は"ship+ship番号"となります
                botUrls.Add("ship" + counter.ToString(), url);
                counter++;
            }
        }
Exemplo n.º 24
0
        public List<PesquisaManifestosModel> ExecutePesquisa(status st, DateTime dtIni, DateTime dtFim)
        {
            try
            {
                string sWhere = string.Format(" m.dt_cad between '{0}' and '{1}' and m.cd_empresa = '{2}' ",
                    dtIni.ToString("dd.MM.yyyy"),
                    dtFim.ToString("dd.MM.yyyy"),
                    Acesso.CD_EMPRESA);

                if (st != status.Ambos)
                {
                    sWhere += (st == status.NaoEnviados ? "and (m.st_mdfe = 'N' or m.st_mdfe is null or m.st_mdfe = '') " : "and m.st_mdfe = 'S'  ");
                }

                this.resultado = base.Execute(sWhere).AsEnumerable().Select(c => new PesquisaManifestosModel
                 {
                     numero = c["numero"].ToString(),
                     sequencia = c["sequencia"].ToString(),
                     dt_manife = (c["dt_cad"].ToString() != "" ? Convert.ToDateTime(c["dt_cad"].ToString()).ToString("dd/MM/yyyy") : ""),
                     descricao = c["descricao"].ToString(),
                     protocolo = c["protocolo"].ToString(),
                     cd_empresa = c["cd_empresa"].ToString(),
                     chaveMDFe = c["chave"].ToString(),
                     recibo = c["recibo"].ToString(),
                     status = c["status"].ToString(),
                     bEnviado = c["bEnviado"].ToString() == "0" ? false : true,
                     bCancelado = c["bCancelado"].ToString() == "0" ? false : true,
                 }).ToList();

                return this.resultado;

            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 25
0
        public void create()
        {
            Console.WriteLine("Enter flight number: ");
            flight_number = int.Parse(Console.ReadLine());
            Console.WriteLine("Enter city: ");
            city = Console.ReadLine();
            Console.WriteLine("Enter port: ");
            port = int.Parse(Console.ReadLine());
            Console.WriteLine("Enter  airline: ");
            airline = Console.ReadLine();
            Console.WriteLine("Enter terminal: ");
            terminal = int.Parse(Console.ReadLine());
            Console.WriteLine("Enter gate: ");
            gate = int.Parse(Console.ReadLine());
            Console.WriteLine("Enter date/time in the format year.month.day hour:minute ");
            datetime = Console.ReadLine();
            dt = Convert.ToDateTime(datetime);
            Console.WriteLine(@"Chouse the flight_status: 
 1. checkin 2. gate_closed 3. arrived 
 4. departed_at 5. unknown 6. canceled
 7. expected_at 8. delayed 9. in_flight ");
            flightstatus = int.Parse(Console.ReadLine());
            s = (status)flightstatus;
        }
Exemplo n.º 26
0
 [Test] public void NoArgsForm([Range(-1, +1)] int val)
 {
     status s0 = x.pass?[status.@unchecked(val)];
 }
Exemplo n.º 27
0
    IEnumerator waitBefom(float time, status sts)
    {
        yield return(new WaitForSeconds(time));

        statusQueue.Enqueue(sts);
    }
Exemplo n.º 28
0
        public ActionResult Create(TimeManagement_EmployeeTimeAttendanceTransaction_Header model, FormCollection form)
        {
            try
            {
                var LocationCode  = form["Location_Code"].Split(',');
                var WorkingSystem = form["Working_System"].Split(',');
                var ShiftCode     = form["Shift_Code"].Split(',');
                ViewBag.Employee_Profile          = dbcontext.Employee_Profile.Where(a => a.Active == true).ToList().Select(m => new { Code = m.Code + "-[" + m.Name + ']', ID = m.ID });
                ViewBag.ManualPaymentTypes_Header = dbcontext.ManualPaymentTypes_Header.ToList().Select(m => new { Code = m.PaymentTypeCode + "-[" + m.PaymentTypeDesc + ']', ID = m.ID });
                TimeManagement_EmployeeTimeAttendanceTransaction_Header new_Record = new TimeManagement_EmployeeTimeAttendanceTransaction_Header();
                new_Record.Employee_Code  = model.Employee_Code;
                new_Record.EffectiveMonth = model.EffectiveMonth;
                new_Record.EffectiveYear  = model.EffectiveYear;
                if (LocationCode[0] != "")
                {
                    var locat = LocationCode[0];
                    var loc   = dbcontext.work_location.FirstOrDefault(a => a.Name == locat);
                    new_Record.Location_Code = loc.Code;
                }
                if (WorkingSystem[0] != "")
                {
                    var working = WorkingSystem[0];
                    var Day     = "Day";
                    var shift8  = "shift -8 Hours";
                    var shift12 = "shift -12 Hours";
                    if (Day == working)
                    {
                        new_Record.Working_System = 1;
                    }
                    else if (shift8 == working)
                    {
                        new_Record.Working_System = 2;
                    }
                    else if (shift12 == working)
                    {
                        new_Record.Working_System = 3;
                    }
                }
                if (ShiftCode[0] != "")
                {
                    var shift = ShiftCode[0];
                    var sh    = dbcontext.Shift_setup.FirstOrDefault(a => a.Name == shift);
                    new_Record.Shift_Code = sh.Code;
                }
                DateTime statis2 = Convert.ToDateTime("1/1/1900");
                new_Record.CreatedDate       = DateTime.Now.Date;
                new_Record.CreatedBy         = User.Identity.Name;
                new_Record.ReportAsReadyDate = statis2;
                new_Record.ApprovedDate      = statis2;
                new_Record.RejectedDate      = statis2;
                new_Record.CanceledDate      = statis2;
                new_Record.ClosedDate        = statis2;
                new_Record.Modified_Date     = statis2;
                new_Record.Created_By        = User.Identity.Name;
                new_Record.Created_Date      = DateTime.Now.Date;

                new_Record.check_status = HR.Models.Infra.check_status.created;
                new_Record.name_state   = nameof(check_status.created);
                var username = User.Identity.GetUserName();
                var Date     = Convert.ToDateTime("1/1/1900");
                var s        = new status {
                    statu = HR.Models.Infra.check_status.created, created_by = username, Type = Models.Infra.Type.ManualPaymentTransactionEntry, approved_bydate = Date, cancaled_bydate = Date, created_bydate = DateTime.Now.Date, Rejected_bydate = Date, return_to_reviewdate = Date
                };
                var st = dbcontext.status.Add(s);
                dbcontext.SaveChanges();
                new_Record.statID = s.ID;

                var Header = dbcontext.TimeManagement_EmployeeTimeAttendanceTransaction_Header.Add(new_Record);
                dbcontext.SaveChanges();

                ///////////////////
                var ID                  = form["ID"].Split(',');
                var AttendDate          = form["AttendDate"].Split(',');
                var week                = form["week"].Split(',');
                var fromtime            = form["fromtime"].Split(',');
                var totime              = form["totime"].Split(',');
                var worklocationcode    = form["worklocationcode"].Split(',');
                var worklocationDes     = form["worklocationDes"].Split(',');
                var LocationCodes       = form["LocationCode"].Split(',');
                var tmcode              = form["tmcode"].Split(',');
                var tmdes               = form["tmdes"].Split(',');
                var LocationDescription = form["LocationDescription"].Split(',');
                var ShiftCodes          = form["ShiftCode"].Split(',');
                var ShiftDescription    = form["ShiftDescription"].Split(',');
                var from_time           = form["from_time"].Split(',');
                var to_time             = form["to_time"].Split(',');
                var empsta              = form["empsta"].Split(',');
                var staref              = form["staref"].Split(',');
                var activ               = form["activ"].Split(',');
                var worksys             = form["worksys"].Split(',');
                var comm                = form["comm"].Split(',');
                var proqty              = form["proqty"].Split(',');
                var damqty              = form["damqty"].Split(',');
                var ches                = form["che"].Split(',');//
                var ret                 = new List <uoi>();
                for (var ck = 0; ck < ID.Length; ck++)
                {
                    if (ID[ck] != "")
                    {
                        bool chbool = false;
                        ret.Add(new uoi {
                            check = chbool
                        });
                    }
                }
                var Cht = new List <uoi>();
                for (var chs = 0; chs < ches.Count(); chs++)
                {
                    if (ches[chs] != "")
                    {
                        ret[int.Parse(ches[chs]) - 1].check = true;
                    }
                }


                for (var i = 0; i < ret.Count(); i++)
                {
                    if (ID[i] != "")
                    {
                        var f_t         = Convert.ToDateTime(fromtime[i]).TimeOfDay;
                        var t_t         = Convert.ToDateTime(totime[i]).TimeOfDay;
                        var timeinafter = Convert.ToDateTime(from_time[i]).TimeOfDay;
                        var timoutafter = Convert.ToDateTime(to_time[i]).TimeOfDay;
                        var isoffical   = Convert.ToBoolean(ret[i].check);
                        var empstatus   = short.Parse(empsta[i]);
                        var worksy      = short.Parse(worksys[i]);
                        var pro         = double.Parse(proqty[i]);
                        var dam         = double.Parse(damqty[i]);

                        var new_details = new TimeManagement_EmployeeTimeAttendanceTransaction_Detail
                        {
                            TransactionNumber  = Header.ID.ToString(), Created_By = User.Identity.Name, Created_Date = DateTime.Now.Date, AttendanceDate = DateTime.Parse(AttendDate[i]),
                            Employee_Code      = Header.Employee_Code, EffectiveMonth = Header.EffectiveMonth, EffectiveYear = Header.EffectiveYear,
                            TimeIn             = f_t, TimeOut = t_t, IsCalling = isoffical, TimeInAfterCalling = timeinafter, TimeOutAfterCalling = timoutafter,
                            StatusRefrenceCode = staref[i], EmployeeStatus = empstatus, DayStatus_Code = worklocationcode [i],
                            Activity           = activ[i], Location_Code = LocationCodes[i], TM_Location_Code = tmcode[i],
                            Working_System     = worksy, Shift_Code = ShiftCodes [i], Comments = comm[i], ProductivityQtyValue = pro, DamagedQtyValue = dam
                        };
                        dbcontext.TimeManagement_EmployeeTimeAttendanceTransaction_Detail.Add(new_details);
                        dbcontext.SaveChanges();
                    }
                }

                ////////////////
                return(RedirectToAction("index"));
            }
            catch (Exception e)
            {
                return(View(model));
            }
        }
Exemplo n.º 29
0
    public List <Foe> readFoes(GameProgress.jankFile input)
    {
        // Determine number of unique foes
        string s = input.ReadLine();

        string[] split  = s.Split(' ');
        int      foeAmt = 0;

        int.TryParse(split[split.Length - 1], out foeAmt);

        // Read in each foe in the ecosystem
        Foe[] community = new Foe[foeAmt];
        for (int i = 0; i < foeAmt; i++)
        {
            input.ReadLine();
            input.ReadLine();
            string       foeName   = "";
            string       path      = "";
            int[]        stats     = new int[7];
            List <Skill> skillList = new List <Skill>();

            // Read in name
            s     = input.ReadLine();
            split = s.Split(' ');
            for (int j = 1; j < split.Length; j++)
            {
                foeName += split[j];
                if (j != split.Length - 1)
                {
                    foeName += " ";
                }
            }
            // Read in path
            path = input.ReadLine();
            // Read in stats
            s     = input.ReadLine();
            split = s.Split(' ');
            for (int j = 1; j < split.Length; j++)
            {
                int.TryParse(split[j], out stats[j - 1]);
            }
            // Open up the sprites in the path file
            Sprite[] source = Resources.LoadAll <Sprite>(@path);

            // Read in items
            int itemAmt;
            s     = input.ReadLine();
            split = s.Split(' ');
            int.TryParse(split[split.Length - 1], out itemAmt);
            Item[] drops    = new Item[itemAmt];
            int[]  dropRate = new int[itemAmt];

            for (int j = 0; j < itemAmt; j++)
            {
                int itemID, itemCount, itemOdds;
                s     = input.ReadLine();
                split = s.Split(' ');
                int.TryParse(split[0], out itemID);
                int.TryParse(split[1], out itemCount);
                int.TryParse(split[2], out itemOdds);

                Item theDrop = (Item)TitleManager.curFile.getItemList()[itemID];
                drops[j]    = theDrop.copy(itemCount);
                dropRate[j] = itemOdds;
            }

            // Read in skills
            int skillAmt;
            s     = input.ReadLine();
            split = s.Split(' ');
            int.TryParse(split[split.Length - 1], out skillAmt);

            int[]    skillOdds = new int[skillAmt];
            AItype[] ai        = new AItype[skillAmt];
            for (int j = 0; j < skillAmt; j++)
            {
                skillType       skill;
                string          atkName, des, skillSFX;
                element         atkEle;
                int             basePower, mpCost, range, effectChance;
                bool            isMagical, animLoop;
                float           start, end, fps;
                SpriteAnimation anim;

                battleType support    = battleType.NULL;
                status     statusMod  = status.NULL;
                int        scalar     = 0;
                stat       statBoost  = stat.NULL;
                bool       selfTarget = false;
                bool       targetAlly = false;

                List <Foe> spawnSet = new List <Foe>();

                s       = input.ReadLine();
                split   = s.Split('-');
                atkName = split[1];
                des     = input.ReadLine();

                // Read in odds then ai type
                s     = input.ReadLine();
                split = s.Split(' ');
                int.TryParse(split[split.Length - 1], out skillOdds[j]);
                s     = input.ReadLine();
                split = s.Split(' ');
                ai[j] = decideAI(split[split.Length - 1]);

                s     = input.ReadLine();
                split = s.Split(' ');
                if (split[split.Length - 1].CompareTo("Offensive") == 0)
                {
                    skill = skillType.OFFENSIVE;

                    // Attack element
                    s      = input.ReadLine();
                    split  = s.Split(' ');
                    atkEle = decideEle(split[split.Length - 1]);

                    // base power
                    s     = input.ReadLine();
                    split = s.Split(' ');
                    int.TryParse(split[split.Length - 1], out basePower);

                    // mp cost
                    s     = input.ReadLine();
                    split = s.Split(' ');
                    int.TryParse(split[split.Length - 1], out mpCost);

                    // is magical
                    s     = input.ReadLine();
                    split = s.Split(' ');
                    bool.TryParse(split[split.Length - 1], out isMagical);

                    // effect chance
                    s     = input.ReadLine();
                    split = s.Split(' ');
                    int.TryParse(split[split.Length - 1], out effectChance);
                    if (effectChance > 0)
                    {
                        /*
                         * implement me eventually
                         */
                    }

                    // range
                    s     = input.ReadLine();
                    split = s.Split(' ');
                    int.TryParse(split[split.Length - 1], out range);

                    // positions
                    s     = input.ReadLine();
                    split = s.Split(' ');
                    float.TryParse(split[split.Length - 1], out start);
                    s     = input.ReadLine();
                    split = s.Split(' ');
                    float.TryParse(split[split.Length - 1], out end);
                }
                else if (split[split.Length - 1].CompareTo("Spawn") == 0)
                {
                    skill        = skillType.SPAWN;
                    basePower    = 0;
                    effectChance = 0;
                    isMagical    = true;
                    int spawnAmt, curSpawn;

                    // Attack element
                    s      = input.ReadLine();
                    split  = s.Split(' ');
                    atkEle = decideEle(split[split.Length - 1]);

                    // mp cost
                    s     = input.ReadLine();
                    split = s.Split(' ');
                    int.TryParse(split[split.Length - 1], out mpCost);

                    // range
                    range = 1;
                    // positions
                    start = -1;
                    end   = -1;

                    // Get number of dudes in spawn set
                    s     = input.ReadLine();
                    split = s.Split(' ');
                    int.TryParse(split[split.Length - 1], out spawnAmt);
                    // Add each monster in the spawn set
                    for (int k = 0; k < spawnAmt; k++)
                    {
                        s = input.ReadLine();
                        int.TryParse(s, out curSpawn);
                        spawnSet.Add(community[curSpawn].copy());
                    }
                }
                else
                {
                    skill        = skillType.SUPPORT;
                    basePower    = 0;
                    effectChance = 0;
                    isMagical    = true;

                    // Attack element
                    s      = input.ReadLine();
                    split  = s.Split(' ');
                    atkEle = decideEle(split[split.Length - 1]);

                    // mp cost
                    s     = input.ReadLine();
                    split = s.Split(' ');
                    int.TryParse(split[split.Length - 1], out mpCost);

                    // range
                    s     = input.ReadLine();
                    split = s.Split(' ');
                    int.TryParse(split[split.Length - 1], out range);

                    // positions
                    s     = input.ReadLine();
                    split = s.Split(' ');
                    float.TryParse(split[split.Length - 1], out start);
                    s     = input.ReadLine();
                    split = s.Split(' ');
                    float.TryParse(split[split.Length - 1], out end);

                    // status variables
                    s         = input.ReadLine();
                    split     = s.Split(' ');
                    support   = decideSupport(split[split.Length - 1]);
                    s         = input.ReadLine();
                    split     = s.Split(' ');
                    statusMod = decideStatus(split[split.Length - 1]);
                    s         = input.ReadLine();
                    split     = s.Split(' ');
                    statBoost = decideStat(split[split.Length - 1]);
                    s         = input.ReadLine();
                    split     = s.Split(' ');
                    int.TryParse(split[split.Length - 1], out scalar);
                    s     = input.ReadLine();
                    split = s.Split(' ');
                    bool.TryParse(split[split.Length - 1], out selfTarget);
                    s     = input.ReadLine();
                    split = s.Split(' ');
                    bool.TryParse(split[split.Length - 1], out targetAlly);
                }

                // FPS
                s     = input.ReadLine();
                split = s.Split(' ');
                float.TryParse(split[split.Length - 1], out fps);

                // Sprite animation
                int spriteAmt;
                s     = input.ReadLine();
                split = s.Split(' ');
                if (split.Length > 2)
                {
                    int.TryParse(split[split.Length - 2], out spriteAmt);
                    animLoop = true;
                }
                else
                {
                    int.TryParse(split[split.Length - 1], out spriteAmt);
                    animLoop = false;
                }
                Sprite[] sprites = new Sprite[spriteAmt];
                for (int k = 0; k < spriteAmt; k++)
                {
                    s          = input.ReadLine();
                    sprites[k] = getSprite(source, s);
                }
                anim = new SpriteAnimation(sprites, new int[0], fps, animLoop);

                // Get SFX path
                input.ReadLine();
                skillSFX = input.ReadLine();

                Skill move = new Skill(skill, atkName, des, atkEle, mpCost, range, start, end, anim, skillSFX);
                if (skill == skillType.OFFENSIVE)
                {
                    move.setAttack(basePower, isMagical, effectChance);
                }
                else if (skill == skillType.SPAWN)
                {
                    move.setSpawn(spawnSet);
                }
                else if (skill == skillType.SUPPORT)
                {
                    move.setSupport(support, statusMod, statBoost, scalar, selfTarget, targetAlly);
                }
                skillList.Add(move);
            }
            // Hitboxes
            int hitboxAmt;
            s     = input.ReadLine();
            split = s.Split(' ');
            int.TryParse(split[split.Length - 1], out hitboxAmt);
            HitBox[] boxes = new HitBox[hitboxAmt];
            for (int j = 0; j < hitboxAmt; j++)
            {
                s     = input.ReadLine();
                split = s.Split(' ');
                float x, y, xs, ys;
                float.TryParse(split[0], out x);
                float.TryParse(split[1], out y);
                float.TryParse(split[2], out xs);
                float.TryParse(split[3], out ys);

                boxes[j] = new HitBox((x / 2) + xs, (y / 2) + ys, (-x / 2) + xs, (-y / 2) + ys);
            }
            // Gravity
            float gravity;
            s     = input.ReadLine();
            split = s.Split(' ');
            float.TryParse(split[split.Length - 1], out gravity);

            // Read in standard animations
            input.ReadLine();
            input.ReadLine();
            string facePath = input.ReadLine();
            Sprite face     = getSprite(Resources.LoadAll <Sprite>(@facePath), input.ReadLine());
            List <SpriteAnimation> anims = new List <SpriteAnimation>();
            for (int j = 0; j < 5; j++)
            {
                input.ReadLine();
                // FPS
                float fps;
                s     = input.ReadLine();
                split = s.Split(' ');
                float.TryParse(split[split.Length - 1], out fps);

                // Sprite animation
                int spriteAmt;
                s     = input.ReadLine();
                split = s.Split(' ');
                int.TryParse(split[split.Length - 1], out spriteAmt);

                Sprite[] sprites = new Sprite[spriteAmt];
                for (int k = 0; k < spriteAmt; k++)
                {
                    s          = input.ReadLine();
                    sprites[k] = getSprite(source, s);
                }
                SpriteAnimation anim = new SpriteAnimation(sprites, new int[0], fps, true);
                anims.Add(anim);
            }

            Foe inhabitant = new Foe(foeName, stats, skillList, skillOdds, ai, drops, dropRate, boxes, gravity);
            inhabitant.setAnimations(face, anims[0], anims[1], anims[2], anims[3], anims[4]);
            community[i] = inhabitant;
        }

        // Create an empty foe set so you don't have to use NULL
        int[] nothing = { 0, 0, 0, 0, 0, 0, 0 };
        Foe   empty   = new Foe("", nothing, new List <Skill>(), new int[0], new AItype[0], new Item[0], new int[0], new HitBox[0], 0);

        // Read in sets of enemies
        input.ReadLine();
        int setAmt;

        s     = input.ReadLine();
        split = s.Split(' ');
        int.TryParse(split[split.Length - 1], out setAmt);
        List <Foe> foeList = new List <Foe>();

        for (int j = 0; j < 1; j++)
        {
            input.ReadLine();
            // Read in rate
            s = input.ReadLine();
            // Read in foes
            int foeCount;
            s     = input.ReadLine();
            split = s.Split(' ');
            int.TryParse(split[split.Length - 1], out foeCount);
            for (int k = 0; k < 5; k++)
            {
                if (k < foeCount)
                {
                    int foeNum;
                    s = input.ReadLine();
                    int.TryParse(s, out foeNum);
                    foeList.Add(community[foeNum]);
                }
                else
                {
                    foeList.Add(empty);
                }
            }
        }
        return(foeList);
    }
Exemplo n.º 30
0
 [Test] public void Construct_logtraceMissing()
 {
     Assert.Throws <ArgEx>(() =>
                           { var z = new status(0, null, null); });
 }
Exemplo n.º 31
0
 public void setStatus(status s, bool isTrue)
 {
     this.curStatus[(int)s] = isTrue; return;
 }
Exemplo n.º 32
0
 // Use this for initialization
 void Start()
 {
     ST               = image.GetComponent <status> ();
     _slider          = this.gameObject.GetComponent <Slider>();
     _slider.maxValue = ST.MAXHP;
 }
Exemplo n.º 33
0
 // Update is called once per frame
 void Update()
 {
     ST            = image.GetComponent <status> ();
     _slider.value = (float)ST.HP / (float)ST.MAXHP * 100;
 }
    void Start()
    {
        playerStatus = player.Instance.GetComponent<status>();
        maxHealth = playerStatus.maxHealth;
        maxHealthContainers = playerStatus.maxHealthContainers;
        currentHealthContainers = playerStatus.currentHealthContainers;
        createHealthContainers(currentHealthContainers);
        maxReactionLength = reactionLength;

        origin = transform.position;
    }
Exemplo n.º 35
0
    [Test] public void ToStatus()
    {
        status s = x;

        o(s.failing);
    }
Exemplo n.º 36
0
 [Test] public void TestLoop()
 {
     x.index = 5; status s = x.loop; o(x.index, 0); o(s.running);
 }
Exemplo n.º 37
0
 m_statusHandlerDict[status.m_Type].Attach(status, target, caster);
Exemplo n.º 38
0
        public ActionResult Create([Bind(Include = "id,image_Type,doctor_id,patient_id,specialist_id,report_id,comment_id,create_datetime,file")] ImageCreateViewModel model)
        {
            string photoName = model.file.FileName;
            string savedName = Path.Combine(Server.MapPath("~/image"), photoName);
            image  image     = new image();

            try
            {
                if (ModelState.IsValid)
                {
                    //再新增圖片的時候report and comment也要跟著加入
                    report report = new report();
                    report.specialist_id = model.specialist_id;
                    report.annotation    = "Please enter content.";
                    report.create_date   = DateTime.Now;
                    report.type          = model.image_Type;
                    report.patient_id    = model.patient_id;
                    status r_status = new status();
                    r_status.type    = "report";
                    r_status.status1 = "new";
                    db.status.Add(r_status);
                    db.reports.Add(report);
                    db.SaveChanges();

                    comment comment = new comment();
                    comment.content    = "Please enter content.";
                    comment.doctor_Id  = model.doctor_id;
                    comment.patient_id = model.patient_id;
                    status c_status = new status();
                    c_status.type    = "comment";
                    c_status.status1 = "new";
                    db.status.Add(c_status);
                    db.comments.Add(comment);



                    image.id              = model.id;
                    image.image_Type      = model.image_Type;
                    image.doctor_id       = model.doctor_id;
                    image.patient_id      = model.patient_id;
                    image.specialist_id   = model.specialist_id;
                    image.report_id       = report.id;
                    image.comment_id      = comment.id;
                    image.create_datetime = model.create_datetime;
                    image.file_Path       = Path.Combine(Server.MapPath("~/image"), photoName).ToString();
                    image.file_Name       = photoName;

                    db.images.Add(image);
                    db.SaveChanges();
                    return(RedirectToAction("Index", "Administrators"));
                }
            }
            catch (Exception ex)
            {
                return(View(ex.ToString()));
            }

            //ViewBag.doctor_id = new SelectList(db.doctors, "user_id", "user_id", image.doctor_id);
            //ViewBag.patient_id = new SelectList(db.patients, "id", "first_Name", image.patient_id);
            //ViewBag.specialist_id = new SelectList(db.stomatologists, "user_id", "user_id", image.specialist_id);
            return(View(image));
        }
Exemplo n.º 39
0
        static void Main(string[] args)
        {
            Regex regex = new Regex(@"\w\w\b\b\b\b\b\b\b");

            Console.WriteLine("Меню вывода данных" + "\n" + "1.Вывести всех посетителей..." + "\n" + "2.Вывести высляющихся..." + "\n" + "3.Добавить посетителя..." + "\n" + "4.Статус жильцов по номеру комнаты..." + "\n" + "5.ФИО и номер комнаты по паспортным данным..." + "\n" + "6.Изменить статус проживающего..." + "\n" + "7.Выход...");
            int count = 3;
            int VAL   = 100;

            person[] Clients = new person[VAL];
            Clients[0] = new person();
            Clients[1] = new person(3, "Robert Radriges", "A212", "AB7654321", (status)2, 2500);
            Clients[2] = new person(Clients[0]);
            string pattern = @"[A-Z]{2}[0-9]{7}";
            int    menu    = 0;

            for (; ;)
            {
                try
                {
                    menu = Convert.ToInt32(Console.ReadLine());
                    if (menu <= 0)
                    {
                        throw new Exception("Переменная меню не должна быть отрицательна или ровна нулю...");
                    }


                    {
                        switch (menu)
                        {
                        case 1:
                        {
                            Console.WriteLine();
                            Console.WriteLine("ВЫвод всех посетителей:");
                            for (int i = 0; i < count; i++)
                            {
                                Console.WriteLine("ID клиента:" + Clients[i].ID + "\n"
                                                  + "ФИО клиента:" + Clients[i].name + "\n"
                                                  + "Номер комнаты:" + Clients[i].room + "\n"
                                                  + "Паспортные данные клиента:" + Clients[i].pasp + "\n"
                                                  + "Статус клиента:" + Clients[i].state + "\n"
                                                  + "Внесенная сумма:" + Clients[i].Sum);
                                Console.WriteLine("***");
                            }
                            break;
                        }

                        case 2:
                        {
                            Console.WriteLine();
                            Console.WriteLine("Вывод всех выселяющихся:");
                            Vis(Clients, count);
                            break;
                        }

                        case 3:
                        {
                            Console.WriteLine();
                            Console.WriteLine("***Добавление посетителя***");
                            {
                                Console.Write("Введите ID клиента:");
                                int ID = Convert.ToInt32(Console.ReadLine());
                                Console.Write("Введите ФИО клиента:");
                                string name = Console.ReadLine();
                                Console.Write("Введите номер комнаты клиента:");
                                string room = (Console.ReadLine());
                                Console.Write("Введите паспортные данные клиента:");
                                {
                                    string fpass = null;

                                    while (true)
                                    {
                                        string pass = Console.ReadLine();

                                        if (pass.Length > 9)
                                        {
                                            Console.WriteLine("Вы ввели неверное колличество символов...");
                                        }
                                        else
                                        {
                                            if (Regex.IsMatch(pass, pattern))
                                            {
                                                fpass = pass;
                                                break;
                                            }
                                            else
                                            {
                                                Console.WriteLine("Некорректные паспортные данные, повторите попытку ввода...");
                                            }
                                        }
                                    }
                                    Console.Write("Статус клиента(1-Новый,2-Постоянный,3-Выселяющийся)");
                                    status state = (status)Convert.ToInt32(Console.ReadLine());
                                    Console.Write("Внесенная сумма:");
                                    decimal sum = Convert.ToDecimal(Console.ReadLine());
                                    Clients[count] = new person(ID, name, room, fpass, state, sum);
                                    fpass          = null;
                                }
                                count += 1;
                                break;
                            }
                        }

                        case 4:
                        {
                            Console.WriteLine();
                            Console.WriteLine("Статус жильцов по номеру комнаты...");
                            Console.Write("Введите номер комнаты:");
                            string room   = (Console.ReadLine());
                            person person = new person(1, "name", room, "AA0000000", (status)3, 0);
                            Rom(person.room, Clients, count);
                            break;
                        }

                        case 5:
                        {
                            Console.WriteLine();
                            Console.WriteLine("Вывод ФИО и номера комнаты по паспортным данным...");
                            Console.Write("Введите паспортные данные:");
                            string str = "";
                            while (true)
                            {
                                string pass = Console.ReadLine();
                                if (pass.Length > 9)
                                {
                                    Console.WriteLine("Вы ввели неверное колличество символов...");
                                }
                                else
                                {
                                    if (Regex.IsMatch(pass, pattern))
                                    {
                                        str = pass;
                                        break;
                                    }
                                    else
                                    {
                                        Console.WriteLine("Некорректные паспортные данные, повторите попытку ввода...");
                                    }
                                }
                            }
                            person person = new person(1, "name", "000", str, (status)3, 0);
                            pass(str, Clients, count);

                            break;
                        }

                        case 6:
                        {
                            Console.WriteLine();
                            Console.WriteLine("Изменение статуса и смена оплаты...");
                            Console.Write("Введите паспортные данные:");
                            string str = "";
                            while (true)
                            {
                                string pass = Console.ReadLine();
                                if (pass.Length > 9)
                                {
                                    Console.WriteLine("Вы ввели неверное колличество символов...");
                                }
                                else
                                {
                                    if (Regex.IsMatch(pass, pattern))
                                    {
                                        str = pass;
                                        break;
                                    }
                                    else
                                    {
                                        Console.WriteLine("Некорректные паспортные данные, повторите попытку ввода...");
                                    }
                                }
                            }
                            // person person = new person(1, "name", "000", str, (status)3, 0);
                            pass2(str, Clients, count);
                            break;
                        }

                        case 7:

                        {
                            Environment.Exit(0);
                            break;
                        }

                        default:
                        {
                            Console.Write("Введите номер пункта из списка сверху...");
                            break;
                        }
                        }
                    }
                }
                catch (Exception ex) { Console.WriteLine("Ошибка:" + ex.Message); }
            }
        }
Exemplo n.º 40
0
    [Test] public void Construct_withStatusAndPrev_1()
    {
        status a = done(), b = fail();

        o(new status(a, prev: b).complete);
    }
Exemplo n.º 41
0
 public ClassBossBee()
 {
     X  = BX = 300 - Width / 2;
     EX = 600 - Width;
     this.Current_Status = status.Lv1;
 }
Exemplo n.º 42
0
    [Test] public void IncrementOp()
    {
        status d = done, c = cont, f = fail;

        o(++f, cont); o(++c, done); o(++d, done);
    }
Exemplo n.º 43
0
        public ShapePath.FlagsAndCommand vertex(out double x, out double y)
        {
            x = 0;
            y = 0;
            ShapePath.FlagsAndCommand command = ShapePath.FlagsAndCommand.Stop;
            bool done = false;

            while (!done)
            {
                switch (m_status)
                {
                case status.initial:
                    markers.remove_all();
                    m_last_cmd = VertexSource.vertex(out m_start_x, out m_start_y);
                    m_status   = status.accumulate;
                    goto case status.accumulate;

                case status.accumulate:
                    if (ShapePath.is_stop(m_last_cmd))
                    {
                        return(ShapePath.FlagsAndCommand.Stop);
                    }

                    generator.RemoveAll();
                    generator.AddVertex(m_start_x, m_start_y, ShapePath.FlagsAndCommand.MoveTo);
                    markers.add_vertex(m_start_x, m_start_y, ShapePath.FlagsAndCommand.MoveTo);

                    for (; ;)
                    {
                        command = VertexSource.vertex(out x, out y);
                        //DebugFile.Print("x=" + x.ToString() + " y=" + y.ToString() + "\n");
                        if (ShapePath.is_vertex(command))
                        {
                            m_last_cmd = command;
                            if (ShapePath.is_move_to(command))
                            {
                                m_start_x = x;
                                m_start_y = y;
                                break;
                            }
                            generator.AddVertex(x, y, command);
                            markers.add_vertex(x, y, ShapePath.FlagsAndCommand.LineTo);
                        }
                        else
                        {
                            if (ShapePath.is_stop(command))
                            {
                                m_last_cmd = ShapePath.FlagsAndCommand.Stop;
                                break;
                            }
                            if (ShapePath.is_end_poly(command))
                            {
                                generator.AddVertex(x, y, command);
                                break;
                            }
                        }
                    }
                    generator.Rewind(0);
                    m_status = status.generate;
                    goto case status.generate;

                case status.generate:
                    command = generator.Vertex(ref x, ref y);
                    //DebugFile.Print("x=" + x.ToString() + " y=" + y.ToString() + "\n");
                    if (ShapePath.is_stop(command))
                    {
                        m_status = status.accumulate;
                        break;
                    }
                    done = true;
                    break;
                }
            }
            return(command);
        }
Exemplo n.º 44
0
 public static status ε(status s, [P] S path = "", [M] S member = "",
                        [L] int line         = 0)
 => Eval(s, path, member, line);
Exemplo n.º 45
0
 public void rewind(int path_id)
 {
     VertexSource.rewind(path_id);
     m_status = status.initial;
 }
Exemplo n.º 46
0
        public ShapePath.FlagsAndCommand vertex(out double x, out double y)
        {
            x = 0;
            y = 0;
            ShapePath.FlagsAndCommand command = ShapePath.FlagsAndCommand.CommandStop;
            bool done = false;
            while (!done)
            {
                switch (m_status)
                {
                    case status.initial:
                        markers.remove_all();
                        m_last_cmd = VertexSource.vertex(out m_start_x, out m_start_y);
                        m_status = status.accumulate;
                        goto case status.accumulate;

                    case status.accumulate:
                        if (ShapePath.is_stop(m_last_cmd))
                        {
                            return ShapePath.FlagsAndCommand.CommandStop;
                        }

                        generator.RemoveAll();
                        generator.AddVertex(m_start_x, m_start_y, ShapePath.FlagsAndCommand.CommandMoveTo);
                        markers.add_vertex(m_start_x, m_start_y, ShapePath.FlagsAndCommand.CommandMoveTo);

                        for (; ; )
                        {
                            command = VertexSource.vertex(out x, out y);
                            //DebugFile.Print("x=" + x.ToString() + " y=" + y.ToString() + "\n");
                            if (ShapePath.is_vertex(command))
                            {
                                m_last_cmd = command;
                                if (ShapePath.is_move_to(command))
                                {
                                    m_start_x = x;
                                    m_start_y = y;
                                    break;
                                }
                                generator.AddVertex(x, y, command);
                                markers.add_vertex(x, y, ShapePath.FlagsAndCommand.CommandLineTo);
                            }
                            else
                            {
                                if (ShapePath.is_stop(command))
                                {
                                    m_last_cmd = ShapePath.FlagsAndCommand.CommandStop;
                                    break;
                                }
                                if (ShapePath.is_end_poly(command))
                                {
                                    generator.AddVertex(x, y, command);
                                    break;
                                }
                            }
                        }
                        generator.Rewind(0);
                        m_status = status.generate;
                        goto case status.generate;

                    case status.generate:
                        command = generator.Vertex(ref x, ref y);
                        //DebugFile.Print("x=" + x.ToString() + " y=" + y.ToString() + "\n");
                        if (ShapePath.is_stop(command))
                        {
                            m_status = status.accumulate;
                            break;
                        }
                        done = true;
                        break;
                }
            }
            return command;
        }
    // ao jump
    // red kinsetu
    // kiiro enkyori

    // Use this for initialization
    void Start()
    {
        status       = PlayerStatus.GetComponent <status>();
        PlayerStatus = GameObject.Find("PlayerStatus");
    }
Exemplo n.º 48
0
        private void PacketDecode(byte c)
        {
            //Console.WriteLine(c.ToString("X"));
            switch (state)
            {
            case status.kStatus_Idle:
                if (c == 0x5A)
                {
                    state = status.kStatus_Cmd;
                }
                break;

            case status.kStatus_Cmd:
                cmd = c;
                if (cmd == 0xA5)
                {
                    state = status.kStatus_LenLow;
                }
                else
                {
                    state = status.kStatus_Idle;
                }
                break;

            case status.kStatus_LenLow:
                DataPacketLen = c;
                state         = status.kStatus_LenHigh;
                break;

            case status.kStatus_LenHigh:
                DataPacketLen += (UInt16)(c << 8);

                if (DataPacketLen > MAX_PACKET_LEN)
                {
                    state = status.kStatus_Idle;
                }
                else
                {
                    state = status.kStatus_CRCLow;
                }
                break;

            case status.kStatus_CRCLow:
                CRCReceived = c;
                state       = status.kStatus_CRCHigh;
                break;

            case status.kStatus_CRCHigh:
                CRCReceived += (UInt16)(c << 8);
                DataCounter  = 0;
                state        = status.kStatus_Data;
                break;

            case status.kStatus_Data:
                DataPacketBuffer[DataCounter++] = c;

                if (DataCounter >= DataPacketLen)
                {
                    List <byte> header = new List <byte>();
                    header.Add(0x5A);
                    header.Add(0xA5);
                    header.AddRange(BitConverter.GetBytes(DataPacketLen));
                    CRCCalculated = crc16(0, header.ToArray(), 0, header.Count, 0x1021);
                    CRCCalculated = crc16(CRCCalculated, DataPacketBuffer, 0, DataPacketLen, 0x1021);

                    // CRC match, Kboot suffucally received a packet
                    if (CRCCalculated == CRCReceived)
                    {
                        if (OnPacketRecieved != null)
                        {
                            OnPacketRecieved(this, DataPacketBuffer, DataPacketLen);
                        }
                    }
                    state = status.kStatus_Idle;
                }
                break;
            }
        }
Exemplo n.º 49
0
    [Test] public void DecrementOp()
    {
        status d = done, c = cont, f = fail;

        o(--f, fail); o(--c, fail); o(--d, cont);
    }
Exemplo n.º 50
0
 [Test] public void TestEnd()
 {
     status s = x.end;
 }
Exemplo n.º 51
0
    // --------------------------------------------------------------

        #if AL_OPTIMIZE
    // optimized mode
    [Test] public void Construct_withLogTrace()
    {
        status a = done();

        o(new status(a, trace: null).complete);
    }
Exemplo n.º 52
0
        public void ProcessMessage(IMDMMessage icmd, Func <byte[], Task> cbsend = null)
        {
            ManifestMasterData  mmcmd;
            ManifestDetailsData mdcmd;
            bool        bTerminateThread = false;
            Request     valReq;
            int         cnt = 0;
            IMDMMessage mcmd;

            if (icmd.Command == eCommand.Manifest)
            {
                mmcmd        = (ManifestMasterData)icmd;
                mmcmd.status = status.Init;
                Add(mmcmd);

                //Winsys loading of the Manifest Master update to the original requestId for a ship date
                Logger.Info($"ManifestVM::Process Message from Winsys: ManifestMaster Query: {mmcmd.ToString()}");

                if (dRequests.TryGetValue(mmcmd.RequestId, out valReq))
                {
                    if (!valReq.LIds.ContainsKey(mmcmd.LINK))
                    {
                        Logger.Info($"ManifestVM::Add Init Query link {mmcmd.LINK}");
                        lock (olock)
                        {
                            valReq.LIds.Add(mmcmd.LINK, status.Init);
                            LoadManifestIdComplete.Add(mmcmd.LINK.ToString());
                        }
                    }
                    else
                    {
                        Logger.Info($"ManifestVM::Update Init to Releasing for link: {mmcmd.LINK}");
                        valReq.LIds[mmcmd.LINK] = status.Releasing;
                    }
                }
                else
                {
                    Logger.Error($"Request not found, why are we processing an unkniown message? {mmcmd.RequestId}");
                }

                //Search the Manifest from the SQL Server to see if it was already released.
                CheckManifestStatus(mmcmd);
            }
            else if (icmd.Command == eCommand.CheckManifest)
            {
                mmcmd        = (ManifestMasterData)icmd;
                mmcmd.status = status.Init;
                Add(mmcmd);
                Logger.Info($"ManifestVM::Process Message: Check Manifest Result: {mmcmd.ToString()}");

                if (dRequests.TryGetValue(mmcmd.RequestId, out valReq))
                {
                    if (mmcmd.ManifestId != 0)
                    {
                        mmcmd.Command           = eCommand.ManifestLoadComplete;
                        mmcmd.status            = status.Released;
                        valReq.LIds[mmcmd.LINK] = status.Completed;
                        if (valReq.LinkMid.ContainsKey(mmcmd.LINK))
                        {
                            lock (olock)
                                valReq.LinkMid[mmcmd.LINK].Add(mmcmd.ManifestId);
                        }
                        else
                        {
                            lock (olock)
                                valReq.LinkMid.Add(mmcmd.LINK, new List <long>()
                                {
                                    mmcmd.ManifestId
                                });
                        }
                    }
                    else
                    {
                        mmcmd.Command = eCommand.Manifest;
                        mmcmd.status  = status.Uploaded;
                        if (valReq.LIds.ContainsKey(mmcmd.LINK))
                        {
                            valReq.LIds[mmcmd.LINK] = status.Completed;
                        }
                        else
                        {
                            valReq.LIds.Add(mmcmd.LINK, status.Completed);
                        }
                    }
                }
                Add(mmcmd);
            }
            else if (icmd.Command == eCommand.CheckManifestComplete)
            {
                mmcmd = (ManifestMasterData)icmd;
                // if the man id exists update otherwise we are done here
                mmcmd.Command = eCommand.ManifestLoadComplete;

                if (LoadManifestIdComplete.Contains(mmcmd.LINK.ToString()))
                {
                    lock (olock)
                        LoadManifestIdComplete.Remove(mmcmd.LINK.ToString());
                }

                int mcnt = 0;

                if (dRequests.TryGetValue(mmcmd.RequestId, out valReq))
                {
                    if (valReq.LinkMid.ContainsKey(mmcmd.LINK))
                    {
                        mmcmd.status = status.Released;
                    }
                    else
                    {
                        mmcmd.status = status.Completed;
                    }

                    Add(mmcmd);

                    valReq.ChkIds.Remove(mmcmd.LINK);
                    if ((valReq.LIds.Select(a => a).Where(b => b.Value.CompareTo(status.Init) == 0).Count() == 0 ||
                         valReq.LIds.Count == 0) && valReq.ChkIds.Count == 0)
                    {
                        bTerminateThread = true;
                    }

                    cnt = valReq.LIds.Select(a => a).Where(b => b.Value.CompareTo(status.Init) == 0).Count();
                    Logger.Info($"ManifestVM::Process Manifest {cnt} PENDING remaining.");
                }

                if (cnt == 0 && (valReq != null && valReq.ChkIds.Count == 0) && mcnt == 0)
                {
                    Logger.Info($"ManifestVM::Process Manifest Load Complete May now Terminate Thread.");
                    bTerminateThread = true;
                }
            }
            else if (icmd.Command == eCommand.ManifestLoadComplete)
            {
                mmcmd = (ManifestMasterData)icmd;
                Logger.Info($"ManifestVM::Process Manifest Load Complete Message: {mmcmd.ToString()}");

                if (dRequests.TryGetValue(mmcmd.RequestId, out valReq))
                {
                    cnt = valReq.LIds.Select(a => a).Where(b => b.Value.CompareTo(status.Init) == 0).Count() + valReq.ChkIds.Count();

                    if (mmcmd.ManifestId == 0 && mmcmd.LINK != 0)
                    {
                        var it = valReq.LIds.Select(b => b).Where(a => a.Key.CompareTo((Int32)mmcmd.LINK) == 0).FirstOrDefault();

                        status est = ((KeyValuePair <long, status>)it).Value;
                        if (est == status.Init)
                        {
                            Logger.Info($"ManifestVM::Process Manifest decrementing from {cnt} Inits. Flipping {mmcmd.LINK} Request to PENDING.");
                            valReq.LIds[mmcmd.LINK] = status.Pending;
                        }
                        else
                        {
                            valReq.LIds[mmcmd.LINK] = status.Completed;
                        }

                        cnt = valReq.LIds.Select(a => a).Where(b => b.Value.CompareTo(status.Init) == 0).Count() + valReq.ChkIds.Count();
                        Logger.Info($"ManifestVM::Process Manifest decrementing New Count {cnt} Inits. Flipping {mmcmd.LINK} Request to PENDING.");
                    }
                    else if (mmcmd.LINK == 0)
                    {
                        // No trucks found in winsys
                        Logger.Info($"No truck manifest found for this date {mmcmd.SHIP_DTE}!");
                    }
                    else
                    {
                        Logger.Info($"ManifestVM::Process Manifest Load cnt: {cnt} Complete Terminate Thread.");

                        if (valReq.LIds.ContainsKey(mmcmd.LINK))
                        {
                            lock (olock)
                                valReq.LIds.Remove(mmcmd.LINK);
                        }

                        mmcmd.Command = eCommand.ManifestLoadComplete;

                        lock (olock)
                            LoadManifestIdComplete.Add(mmcmd.ManifestId.ToString());
                    }
                    cnt = valReq.LIds.Select(a => a).Where(b => b.Value.CompareTo(status.Init) == 0).Count();
                    Logger.Info($"ManifestVM::Process Manifest {cnt} PENDING remaining.");

                    if (cnt == 0 && valReq.ChkIds.Count == 0)
                    {
                        Logger.Info($"ManifestVM::Process Manifest Load Complete May now Terminate Thread.");
                        bTerminateThread = true;
                    }
                }
            }
            else if (icmd.Command == eCommand.UploadManifestComplete)
            {
                mmcmd = (ManifestMasterData)icmd;
                lock (olock)
                    uploadManifestIdComplete.Add(mmcmd.ManifestId.ToString());
            }
            else if (icmd.Command == eCommand.ManifestDetails)
            {
                //dlrnos
                //Set the status of tyhe manifestDetail id to received.
            }
            else if (icmd.Command == eCommand.ManifestDetailsComplete)
            {
                //Set the status of tyhe manifestDetail id to completed.
                mdcmd = (ManifestDetailsData)icmd;

                //check if there are zero remaining with status Pending
                // Orders + OrderDetails + ManifestDetails
            }
            else if (icmd.Command == eCommand.OrdersLoad)
            {
            }
            else if (icmd.Command == eCommand.OrderUpdatesComplete)
            {
                OrderMasterData omd = (OrderMasterData)icmd;
            }
            else if (icmd.Command == eCommand.OrderDetails)
            {
                OrderDetailsData odd = (OrderDetailsData)icmd;

                //int wncnt = odd.WIN_CNT;
                //if (wncnt < 0) wncnt = 0;

                long id = Int64.Parse(odd.MDL_NO.ToString() +
                                      odd.MDL_CNT.ToString() + odd.OPT_NUM.ToString() + odd.ORD_NO.ToString());

                if (!LoadManifestIdComplete.Contains(id.ToString()))
                {
                    Logger.Info($"Add ODC LoadManifestIdComplete: {odd.ORD_NO.ToString()}");
                    lock (olock)
                    {
                        if (!lstMissingIds.Contains(id))
                        {
                            LoadManifestIdComplete.Add(id.ToString());
                        }
                        else
                        {
                            lstMissingIds.Remove(id);
                            Logger.Info($"Ignore already in the missing container, Remove it ODC LoadManifestIdComplete: {odd.ORD_NO.ToString()}");
                        }
                    }
                }
                if ((lstMissingIds.Count + LoadManifestIdComplete.Count - odcnt == 0) && binitOD && (oocnt == 0 && binitOO))
                {
                    bTerminateThread = true;
                }
            }
            else if (icmd.Command == eCommand.OrderDetailsComplete)
            {
                OrderDetailsData oddc = (OrderDetailsData)icmd;
                if (!binitOD)
                {
                    odcnt   = oddc.LineNumber;
                    binitOD = true;
                }

                if (LoadManifestIdComplete.Contains(oddc.ORD_NO.ToString()))
                {
                    Logger.Info($"Remove ODC LoadManifestIdComplete: {oddc.ORD_NO.ToString()}");
                    lock (olock)
                    {
                        LoadManifestIdComplete.Remove(oddc.ORD_NO.ToString());

                        if (lstMissingIds.Contains(oddc.ORD_NO))
                        {
                            Logger.Info($"Also Remove ODC lstMissingIds {oddc.ORD_NO.ToString()}");
                            lstMissingIds.Remove(oddc.ORD_NO);
                        }
                    }
                }
                else
                {
                    Logger.Info($"Add ODC Add lstMissingIds:{oddc.ORD_NO.ToString()}");
                    lock (olock)
                        lstMissingIds.Add(oddc.ORD_NO);
                }

                Logger.Info($"ODO check missing:{lstMissingIds.Count} + complete{LoadManifestIdComplete.Count} - odcnt:{odcnt} oocnt:{oocnt} ");
                if (lstMissingIds.Count + LoadManifestIdComplete.Count - odcnt == 0 && (oocnt == 0 && binitOO))
                {
                    bTerminateThread = true;
                }
            }
            else if (icmd.Command == eCommand.OrderOptions)
            {
                OrderOptionsData ood = (OrderOptionsData)icmd;

                if (LoadManifestIdComplete.Contains(ood.ORD_NO.ToString()))
                {
                    Logger.Info($"Remove OO LoadManifestIdComplete:{ood.ORD_NO.ToString()} LoadManifestIdComplete.cnt:{LoadManifestIdComplete.Count}");
                    lock (olock)
                    {
                        LoadManifestIdComplete.Remove(ood.ORD_NO.ToString());

                        if (lstMissingIds.Contains(ood.ORD_NO))
                        {
                            Logger.Info($"Also Remove OO lstMissingIds {ood.ORD_NO.ToString()} lstMissingIds cnt:{lstMissingIds.Count}");
                            lstMissingIds.Remove(ood.ORD_NO);
                        }
                    }
                }
                else
                {
                    Logger.Info($"Add OO Add lstMissingIds: {ood.ORD_NO.ToString()} lstMissingIds cnt:{lstMissingIds.Count}");
                    lock (olock)
                        lstMissingIds.Add(ood.ORD_NO);
                }

                Logger.Info($"OO check missing:{lstMissingIds.Count} + complete{LoadManifestIdComplete.Count} - oocnt:{oocnt} odcnt:{odcnt} ");
                if ((lstMissingIds.Count + LoadManifestIdComplete.Count - oocnt == 0) && binitOO && (odcnt == 0 && binitOD))
                {
                    bTerminateThread = true;
                }
            }
            else if (icmd.Command == eCommand.OrderOptionsComplete)
            {
                OrderOptionsData oodc = (OrderOptionsData)icmd;
                if (!binitOO)
                {
                    oocnt   = oodc.Count;
                    binitOO = true;
                }

                if (LoadManifestIdComplete.Contains(oodc.ORD_NO.ToString()))
                {
                    lock (olock)
                    {
                        Logger.Info($"Remove OOComplete LoadManifestIdComplete: {oodc.ORD_NO.ToString()}");
                        LoadManifestIdComplete.Remove(oodc.ORD_NO.ToString());
                    }
                }
                else
                {
                    Logger.Info($"Add OOComplete lstMissingIds:{oodc.ORD_NO.ToString()}");
                    lock (olock)
                        lstMissingIds.Add(oodc.ORD_NO);
                }

                Logger.Info($"OOComplete check: Missing:{lstMissingIds.Count} + Complete:{LoadManifestIdComplete.Count} - oocnt:{oocnt}");
                if (lstMissingIds.Count + LoadManifestIdComplete.Count - oocnt == 0 && (odcnt == 0 && binitOD))
                {
                    bTerminateThread = true;
                }
            }
            else if (icmd.Command == eCommand.Trucks)
            {
                // TruckData td = (TruckData)icmd;
            }
            else if (icmd.Command == eCommand.ScanFile)
            {
                ScanFileData sf = (ScanFileData)icmd;
            }
            else if (icmd.Command == eCommand.TrucksLoadComplete)
            {
                // TruckData tdc = (TruckData)icmd;
                bTerminateThread = true;
            }
            else if (icmd.Command == eCommand.Stops)
            {
                // StopData sd = (StopData)icmd;
            }
            else if (icmd.Command == eCommand.StopsLoadComplete)
            {
                //  StopData sdc = (StopData)icmd;
            }
            else if (icmd.Command == eCommand.OrdersLoad)
            {
                // OrderData od = (OrderData)icmd;
            }
            else if (icmd.Command == eCommand.OrdersLoadComplete)
            {
                // OrderData odc = (OrderData)icmd;

//                long id = odc.ORD_NO;

                //lock (olock)
                //{
                //    if (LoadManifestIdComplete.Contains(id.ToString()))
                //    {
                //        Logger.Info($"Remove (Error Should skip) OComplete check {LoadManifestIdComplete.Count}");
                //        LoadManifestIdComplete.Remove(id.ToString());
                //    }
                //}

                //if (dRequests.TryGetValue(icmd.RequestId, out valReq))
                //{
                //    if (valReq.LinkMid.ContainsKey(id))
                //        odc.status = status.Released;
                //    else
                //        odc.status = status.Completed;

                //    Logger.Info($"ManifestVM::Process Manifest {cnt} PENDING remaining.");
                //}
            }
            else
            {
                Logger.Error($"Unhandled command Backgrtound worker handler {Enum.GetName(typeof(eCommand), icmd.Command)}.");
            }

            //The request id has completed
            if (bTerminateThread)
            {
                Logger.Info($"ManifestVM::Process Terminate Thread for {icmd.RequestId}.");
                manifestMasterThread.CompleteBackgroundWorker(icmd.RequestId);
                LoadManifestRequestComplete = icmd.RequestId.ToString();
                LoadManifestCompleted       = true;
            }
        }
Exemplo n.º 53
0
 public void rewind(int path_id)
 {
     VertexSource.rewind(path_id);
     m_status = status.initial;
 }
Exemplo n.º 54
0
        public void Play()
        {
            status gameStatus = status.KEEP_PLAYING;
            // int point, new_rules_sum;
            int sum_of_dice;


            do
            {
                Console.WriteLine("Welcome to the Craps Game");
                Console.WriteLine("+++++++++++++++++++++++++++++++++++++++");

                Console.WriteLine("+++++++++++++++++++++++++++++++++++++++");
                Console.WriteLine(" ");

                Console.WriteLine("ITS YOUR TURN" + " " + " +++++++++++++++++++++");
                Console.WriteLine(" ");

                Console.WriteLine("Rolling dice....");
                Console.WriteLine(" ");
                Console.WriteLine("======");
                Console.WriteLine("Round: {0}", round);
                Console.WriteLine("======");
                Console.WriteLine(" ");
                Console.WriteLine("======");
                Console.WriteLine("Wins: {0} and Losses: {1}", wins, losses);
                Console.WriteLine("======");

                dice1 = dieOne();
                Console.WriteLine("Dice 1:" + " " + dice1);
                dice2 = dieTwo();
                Console.WriteLine("Dice 2:" + " " + dice2);
                //   Console.WriteLine("You rolled a" + " " + "{0} & {1}", dice1, dice2);

                sum_of_dice = dice1 + dice2;
                Console.WriteLine(" ");

                Console.WriteLine("Sum of dice...." + dice1 + " + " + dice2 + "=" + "{0}", sum_of_dice);
                Console.WriteLine(" ");



                if (sum_of_dice == 7 || sum_of_dice == 11)
                {
                    Console.WriteLine("You win");
                    Console.WriteLine("------------ ");
                    wins++;
                    round++;

                    Thread.Sleep(5000);

                    Console.WriteLine("Press yes to roll again or press no to quit");
                    string choice = Console.ReadLine();
                    if (choice == "yes")
                    {
                        gameStatus = status.KEEP_PLAYING;
                    }
                    else if (choice == "no")
                    {
                        gameStatus = status.DONE;
                        Environment.Exit(0);
                    }
                }

                else if (sum_of_dice == 2 || sum_of_dice == 3 || sum_of_dice == 12)
                {
                    Console.WriteLine("You lose");
                    Console.WriteLine(" ");
                    losses++;
                    round++;


                    Console.WriteLine("Press yes to roll again or press no to quit");
                    string choice = Console.ReadLine();
                    if (choice == "yes")
                    {
                        gameStatus = status.KEEP_PLAYING;
                    }
                    else if (choice == "no")
                    {
                        gameStatus = status.DONE;
                        Environment.Exit(0);
                    }
                }
                else if (sum_of_dice == 4 || sum_of_dice == 5 || sum_of_dice == 6 || sum_of_dice == 7 || sum_of_dice == 8 || sum_of_dice == 9 || sum_of_dice == 10)
                {
                    point = sum_of_dice;
                    Console.WriteLine("Rules changed, point is now {0}. If you roll  a {0} you win, if you roll a 7 you lose", point);
                    Console.WriteLine(" ");

                    Console.WriteLine("Roll again...");
                    Console.WriteLine(" ");

                    int rollagain1 = dieOne();
                    int rollagain2 = dieTwo();

                    new_rules_sum = rollagain1 + rollagain2;

                    Console.WriteLine("You rolled {0} and a {1}", rollagain1, rollagain2);
                    Console.WriteLine(" ");

                    if (new_rules_sum == 7)
                    {
                        Console.WriteLine("You rolled a {0}, you lose ", new_rules_sum);
                        Console.WriteLine(" ");
                        losses++;
                        point = 0;
                        round++;

                        Console.WriteLine("Press yes or no button to roll again..");
                        string choice = Console.ReadLine();
                        if (choice == "yes")
                        {
                            gameStatus = status.KEEP_PLAYING;
                        }
                        else if (choice == "no")
                        {
                            gameStatus = status.DONE;
                            Environment.Exit(0);
                        }
                    }



                    else if (new_rules_sum == point)
                    {
                        Console.WriteLine("You win, you rolled a {0}", point);
                        Console.WriteLine(" ");
                        wins++;
                        point = 0;
                        round++;


                        Console.WriteLine("Press yes to roll again or press no to quit");
                        string choice = Console.ReadLine();
                        if (choice == "yes")
                        {
                            gameStatus = status.KEEP_PLAYING;
                        }
                        else if (choice == "no")
                        {
                            gameStatus = status.DONE;
                            Environment.Exit(0);
                        }
                    }
                    else
                    {
                        do
                        {
                            Console.WriteLine("Roll again...");
                            rollagain1 = dieOne();
                            rollagain2 = dieTwo();

                            int sum = rollagain1 + rollagain2;

                            Console.WriteLine(" ");
                            Console.WriteLine("++++++++++++++++++++++");
                            Console.WriteLine(" ");

                            Console.WriteLine("You rolled a {0} and a {1} , ", rollagain1, rollagain2);
                            Console.WriteLine("Sum = {0}", sum);
                            Console.WriteLine(" ");

                            if (sum == point)
                            {
                                Console.WriteLine("You win");
                                wins++;
                                round++;
                                gameStatus = status.KEEP_PLAYING;

                                Console.WriteLine("Press yes to roll again or press no to quit");
                                string choice = Console.ReadLine();
                                if (choice == "yes")
                                {
                                    gameStatus = status.KEEP_PLAYING;
                                }
                                else if (choice == "no")
                                {
                                    gameStatus = status.DONE;
                                    Environment.Exit(0);
                                }
                            }
                            else if (sum == 7)
                            {
                                Console.WriteLine("You lose");
                                losses++;
                                round++;

                                gameStatus = status.KEEP_PLAYING;

                                Console.WriteLine("Press yes to roll again or press no to quit");
                                string choice = Console.ReadLine();
                                if (choice == "yes")
                                {
                                    gameStatus = status.KEEP_PLAYING;
                                }
                                else if (choice == "no")
                                {
                                    gameStatus = status.DONE;
                                    Environment.Exit(0);
                                }
                            }
                        } while (new_rules_sum != 7 || new_rules_sum != point);
                    }
                }
            } while (gameStatus == status.KEEP_PLAYING && choice != "no");
        }
Exemplo n.º 55
0
    [Test] public void end()
    {
        status k = i.end;

        o(k.raw - 1, 1);
    }
    public int getAbility(string ability, int level)
    {
        switch (ability)
        {
        case "":
            damage    = 0;
            mana      = 0;
            condition = status.FINE;
            break;

//////////////////////////*Dragons*///////////////////////////////
        case "Fire":
            all             = false;
            heal            = false;
            damage          = 10 * level;
            mana            = 10;
            condition       = status.BURN;
            abilityParticle = abilityList[0];
            break;

        case "Fire breath":
            all             = false;
            heal            = false;
            damage          = 20 * level;
            mana            = 20;
            condition       = status.BURN;
            abilityParticle = abilityList[1];
            break;

        case "Ice breath":
            all             = false;
            heal            = false;
            damage          = 20 * level;
            mana            = 20;
            condition       = status.STUN;
            abilityParticle = abilityList[3];
            break;

        case "Ice":
            all             = false;
            heal            = false;
            damage          = 10 * level;
            mana            = 10;
            condition       = status.STUN;
            abilityParticle = abilityList[2];
            break;

        case "Thunder breath":
            all             = false;
            heal            = false;
            damage          = 20 * level;
            mana            = 20;
            abilityParticle = abilityList[4];
            break;

        case "Thunder":
            all             = false;
            heal            = false;
            damage          = 10 * level;
            mana            = 10;
            abilityParticle = abilityList[4];
            break;

        case "Firestorm":
            all             = true;
            heal            = false;
            damage          = 20 * level;
            mana            = 20;
            condition       = status.BURN;
            abilityParticle = abilityList[5];
            break;

        case "Thunderstorm":
            all             = true;
            heal            = false;
            damage          = 20 * level;
            mana            = 20;
            abilityParticle = abilityList[7];
            break;

        case "Icestorm":
            all             = true;
            heal            = false;
            damage          = 20 * level;
            mana            = 20;
            condition       = status.STUN;
            abilityParticle = abilityList[6];
            break;

        case "Dragon Claw":
            all    = false;
            heal   = false;
            damage = 10 * level;
            mana   = 5;
            break;

        case "Dragon Scales":
            all       = false;
            heal      = false;
            damage    = 0;
            mana      = 20;
            condition = status.DEFUP;
            break;

        case "Earthquake":
            all       = true;
            heal      = false;
            damage    = 10 * level;
            mana      = 20;
            condition = status.STUN;
            break;

        case "Earthen Breath":
            all    = false;
            heal   = false;
            damage = 20 * level;
            mana   = 10;
            break;

        case "Cauterize":
            all             = false;
            heal            = true;
            damage          = 5 * level;
            mana            = 10;
            abilityParticle = abilityList[9];
            break;

        case "Tail Swipe":
            all       = false;
            heal      = false;
            damage    = 20 * level;
            mana      = 10;
            condition = status.DEFDOWN;
            break;

        case "Cataclysm":
            all       = true;
            heal      = false;
            damage    = 100 * level;
            mana      = 50;
            condition = status.BURN;
            break;

//////////////////////////*Warrior*///////////////////////////////
        case "Shield Bash":
            all       = false;
            heal      = false;
            damage    = 20 * level;
            mana      = 10;
            condition = status.STUN;
            break;

        case "Shield Block":
            all       = false;
            heal      = false;
            damage    = 0;
            mana      = 20;
            condition = status.BLOCK;
            break;

        case "First Aid":
            all             = false;
            heal            = true;
            damage          = 5 * level;
            mana            = 10;
            abilityParticle = abilityList[9];
            break;

        case "Earthen Dragon's Defence":
            all       = true;
            heal      = false;
            damage    = 50 * level;
            mana      = 30;
            condition = status.DEFUP;
            break;

//////////////////////////*Fighter*///////////////////////////////
        case "Mortal Strike":
            all       = false;
            heal      = false;
            damage    = 20 * level;
            mana      = 10;
            condition = status.ATTACKDOWN;
            break;

        case "Impale":
            all       = false;
            heal      = false;
            damage    = 30 * level;
            mana      = 20;
            condition = status.BURN;
            break;

        case "Attack Buff":
            all       = true;
            heal      = false;
            damage    = 0;
            mana      = 10;
            condition = status.ATTACKUP;
            break;

        case "Red Dragon's Fist":
            all       = false;
            heal      = false;
            damage    = 50 * level;
            mana      = 30;
            condition = status.BURN;
            break;

//////////////////////////*Healer*///////////////////////////////
        case "Heal":
            all             = false;
            heal            = true;
            damage          = 10 * level;
            mana            = 10;
            abilityParticle = abilityList[9];
            break;

        case "Holy Fire":
            all       = false;
            heal      = false;
            damage    = 20 * level;
            mana      = 20;
            condition = status.BURN;
            break;

        case "Protection Buff":
            all       = true;
            heal      = false;
            damage    = 0;
            mana      = 10;
            condition = status.DEFUP;
            break;

        case "Jade Dragon's Breath":
            all             = true;
            heal            = true;
            damage          = 50 * level;
            mana            = 30;
            abilityParticle = abilityList[10];
            break;
        }

        return(damage);
    }
Exemplo n.º 57
0
 public string CheckLanding(Rectangle rocketBounds, Rectangle platformBounds)
 {
     //is there an intersection
     if (rocketBounds.IntersectsWith(platformBounds))
     {
         //check horizontal velocity
         if (Math.Abs(xVel) <= maxX)
         {
             //check vertical velocity
             if (Math.Abs(yVel) <= maxY)
             {
                 if (Math.Abs(rocketBounds.Bottom - platformBounds.Top) < 20)
                 {
                     MessageBox.Show("Congratulation!", "Landed", MessageBoxButtons.OK, MessageBoxIcon.Information);
                     hasLanded = status.LANDED;
                     return hasLanded.ToString();
                 }
                 else
                 {
                     MessageBox.Show("Ouch", "Crashed", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                     hasLanded = status.CRASHED;
                     return hasLanded.ToString();
                 }
             }
             else
             {
                 //yVel is too large
                 MessageBox.Show("Maximum vertical velocity exceeded!\n\nVertical Velocity: " + Math.Round(Math.Abs(yVel)) + " pixel/s      Max: " + maxY + " pixel/s", 
                     "Crashed", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                 hasLanded = status.CRASHED;
                 return hasLanded.ToString();
             }
         }
         else
         {
             if (Math.Abs(yVel) >= maxY)
             {
                 //xVel and yVel are too large
                 MessageBox.Show("Maximum vertical and horizontal velocity exceeded!\n\nVertical Velocity:     " + Math.Round(Math.Abs(yVel)) + " pixel/s      Max: " + maxY + " pixel/s\nHorizontal Velocity: " + Math.Round(Math.Abs(xVel)) + " pixel/s      Max: " + maxX + " pixel/s",
                     "Crashed", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                 hasLanded = status.CRASHED;
                 return hasLanded.ToString();
             }
             else
             {
                 //xVel is too large
                 MessageBox.Show("Maximum horizontal velocity exceeded!\n\nHorizontal Velocity: " + Math.Round(Math.Abs(xVel)) + " pixel/s      Max: " + maxX + " pixel/s",
                     "Crashed", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                 hasLanded = status.CRASHED;
                 return hasLanded.ToString();
             }
         }
     }
     hasLanded = status.MOVING;
     return hasLanded.ToString(); 
 }
Exemplo n.º 58
0
 public int SetStatus(status s)
 {
     mStatus     = s;
     mStatusDesc = utility.status[(int)s];
     return(1);
 }
Exemplo n.º 59
0
        public belPesquisaNotas(status _st, Filtro _fl, string _sValor1, string _sValor2)
        {
            lResultPesquisa = new List<belPesquisaNotas>();
            List<HlpDbFuncoes.ListaCampos> lCampos = new List<HlpDbFuncoes.ListaCampos>();
            lCampos.Add(new HlpDbFuncoes.ListaCampos { sCampo = "cd_chavenfe", sAlias = "sCHAVENFE", sCoalesce = "" });
            lCampos.Add(new HlpDbFuncoes.ListaCampos { sCampo = "cd_notafis", sAlias = "sCD_NOTAFIS" });
            lCampos.Add(new HlpDbFuncoes.ListaCampos { sCampo = "cd_nfseq", sAlias = "sCD_NFSEQ" });
            lCampos.Add(new HlpDbFuncoes.ListaCampos { sCampo = "dt_emi", sAlias = "dDT_EMI" });
            lCampos.Add(new HlpDbFuncoes.ListaCampos { sCampo = "cd_nprotnfe", sAlias = "cd_nprotnfe" });
            lCampos.Add(new HlpDbFuncoes.ListaCampos { sCampo = "coalesce(cd_numero_nfse,'')", sAlias = "scd_numero_nfse" });
            lCampos.Add(new HlpDbFuncoes.ListaCampos { sCampo = "clifor.NM_CLIFOR", sAlias = "sNM_CLIFOR" });
            lCampos.Add(new HlpDbFuncoes.ListaCampos { sCampo = "clifor.NM_GUERRA", sAlias = "sNM_GUERRA" });
            lCampos.Add(new HlpDbFuncoes.ListaCampos { sCampo = "vl_totnf", sAlias = "dVL_TOTNF" });
            lCampos.Add(new HlpDbFuncoes.ListaCampos { sCampo = "NF.cd_gruponf", sAlias = "sCD_GRUPONF", sCoalesce = "" });
            lCampos.Add(new HlpDbFuncoes.ListaCampos { sCampo = "st_contingencia", sCoalesce = "N", sAlias = "bContingencia" });
            lCampos.Add(new HlpDbFuncoes.ListaCampos { sCampo = "cast(case when nf.st_nfe = 'S' then '1' else '0' end as smallint)", sAlias = "bEnviado" });
            lCampos.Add(new HlpDbFuncoes.ListaCampos { sCampo = "case when coalesce(nf.cd_recibocanc, '') = '' then '0' else '1' end", sAlias = "bCancelado" });
            if (HlpDbFuncoes.fExisteCampo("ST_DENEGADA", "NF"))
            {
                lCampos.Add(new HlpDbFuncoes.ListaCampos { sCampo = "case when coalesce(nf.st_denegada, 'N') = 'N' then '0' else '1' end", sAlias = "bDenegada" });
            }
            else
            {
                lCampos.Add(new HlpDbFuncoes.ListaCampos { sCampo = "0", sAlias = "bDenegada" });
            }
            lCampos.Add(new HlpDbFuncoes.ListaCampos { sCampo = "coalesce(cd_recibonfe,'')", sAlias = "sRECIBO_NF", sCoalesce = "" });

            StringBuilder sWhere = new StringBuilder();
            sWhere.Append("cd_empresa = '" + Acesso.CD_EMPRESA + "' and  (coalesce(nf.st_nf_prod,'S') = 'S') and ");
            if (_st != status.Ambos)
            {
                sWhere.Append(_st == status.NaoEnviados ? "(nf.st_nfe = 'N' or nf.st_nfe is null or nf.st_nfe = '') and " : "nf.st_nfe = 'S' and ");
            }
            if (_fl == Filtro.Data)
            {
                sWhere.Append("(dt_emi between '" + Convert.ToDateTime(_sValor1).ToString("dd.MM.yyyy") + "' and '" + Convert.ToDateTime(_sValor2).ToString("dd.MM.yyyy") + "')");
            }
            else if (_fl == Filtro.Sequencia)
            {
                sWhere.Append("(nf.cd_nfseq between '" + _sValor1 + "' and '" + _sValor2 + "') ");
            }
            else if (_fl == Filtro.NF)
            {
                sWhere.Append("(nf.cd_notafis between '" + _sValor1 + "' and '" + _sValor2 + "') ");
            }
            else if (_fl == Filtro.Cliente)
            {
                sWhere.Append("clifor.nm_clifor like('%" + _sValor1.ToUpper() + "%')");
            }
            sWhere.Append(" order by cd_notafis desc");

            DataTable dt = HlpDbFuncoes.qrySeekRet("NF inner join clifor on nf.cd_clifor = clifor.cd_clifor ", "", sWhere.ToString(), lCampos);

            foreach (DataRow dr in dt.Rows)
            {
                lResultPesquisa.Add(new belPesquisaNotas
                {
                    sCHAVENFE = dr["sCHAVENFE"].ToString(),
                    sCD_NFSEQ = dr["sCD_NFSEQ"].ToString(),
                    sCD_NOTAFIS = dr["sCD_NOTAFIS"].ToString(),
                    sNM_CLIFOR = dr["sNM_CLIFOR"].ToString(),
                    sNM_GUERRA = dr["sNM_GUERRA"].ToString(),
                    sCD_GRUPONF = dr["sCD_GRUPONF"].ToString(),
                    scd_numero_nfse = dr["scd_numero_nfse"].ToString(),
                    dVL_TOTNF = Convert.ToDouble(dr["dVL_TOTNF"].ToString()),
                    dDT_EMI = Convert.ToDateTime(dr["dDT_EMI"].ToString()),
                    bEnviado = dr["bEnviado"].ToString().Equals("0") ? false : true,
                    bContingencia = (dr["bContingencia"].ToString().Equals("N") || dr["bContingencia"].ToString().Equals("")) ? false : true,
                    bCancelado = dr["bCancelado"].ToString().Equals("1") ? true : false,
                    bDenegada = dr["bDenegada"].ToString().Equals("1") ? true : false,
                    bSeleciona = false,
                    cd_nprotnfe = dr["cd_nprotnfe"].ToString(),
                    sRECIBO_NF = dr["sRECIBO_NF"].ToString()


                });
            }

        }
Exemplo n.º 60
0
        public static async Task <List <status> > Parse(string content)
        {
            try
            {
                var    tempList2 = new List <status>();
                string htmlPage  = "";

                string locale = Language.CurrentInputMethodLanguageTag.ToString();
                string url    = "https://support.xbox.com/" + locale + "/xbox-live-status?mobileOverride=mobile";

                Uri uri = new Uri((String.Format(url)));
                using (var client = new HttpClient())
                {
                    htmlPage = await client.GetStringAsync(uri);
                }

                //var file = await Windows.Storage.ApplicationData.Current.LocalFolder.GetFileAsync("test.txt");
                //using (var inputStream = await file.OpenReadAsync())
                //using (var classicStream = inputStream.AsStreamForRead())
                //using (var streamReader = new StreamReader(classicStream))
                //{
                //    while (streamReader.Peek() >= 0)
                //    {
                //        htmlPage += streamReader.ReadLine();
                //    }
                //}

                HtmlDocument htmlDocument = new HtmlDocument();
                htmlDocument.LoadHtml(htmlPage);

                //First Part
                Func <ObservableCollection <status> > funcCalc = () =>
                {
                    ObservableCollection <status> tempList = new ObservableCollection <status>();

                    foreach (var div in htmlDocument.DocumentNode.Descendants().Where(i => i.Name == "li" && (i.GetAttributeValue("class", "").StartsWith("service"))))
                    {
                        try
                        {
                            status newStatus = new status();
                            string name;
                            string state;
                            string description;

                            name           = div.Descendants().Where(i => (i.Name == "h3") && i.GetAttributeValue("class", "") == "servicename m-t-n ").FirstOrDefault().InnerText.Trim();
                            newStatus.name = name.Replace("&#233;", "é");

                            state           = div.Descendants().Where(i => i.Name == "span" && (i.GetAttributeValue("class", "") == "unavailable d-ib-lg d-n-s" || i.GetAttributeValue("class", "") == "active d-ib-lg d-n-s")).FirstOrDefault().InnerText.Trim();
                            newStatus.state = state;

                            description           = div.Descendants().Where(i => i.Name == "p" && (i.GetAttributeValue("class", "") == "description")).FirstOrDefault().InnerText.Trim();
                            newStatus.description = description.Replace("&amp;", "&");

                            if (div.Descendants().Where(i => i.Name == "span" && (i.GetAttributeValue("class", "") == "unavailable d-ib-lg d-n-s")).FirstOrDefault() != null)
                            {
                                newStatus.stateIcon = "\uE7BA";
                                try
                                {
                                    newStatus.affectedServices = div.Descendants().Where(i => i.Name == "ul" && (i.GetAttributeValue("class", "") == "services")).FirstOrDefault().InnerText.Trim();
                                    newStatus.lastUpdate       = div.Descendants().Where(i => i.Name == "p" && (i.GetAttributeValue("class", "") == "")).Last().InnerText.Trim();
                                }
                                catch
                                {
                                }

                                newStatus.affectedPlatforms = new List <string>();
                                foreach (var div2 in div.Descendants().Where(i => i.Name == "div" && (i.GetAttributeValue("class", "").StartsWith("label"))))
                                {
                                    try
                                    {
                                        newStatus.affectedPlatforms.Add(div2.InnerText.Trim());
                                    }
                                    catch
                                    {
                                        continue;
                                    }
                                }
                            }
                            else
                            {
                                newStatus.stateIcon = "\uE73E";
                            }

                            tempList.Add(newStatus);
                        }
                        catch
                        {
                            continue;
                        }
                    }
                    return(tempList);
                };

                var list = await Task.Run(funcCalc);

                foreach (var i in list)
                {
                    tempList2.Add(i);
                }

                //Second Part
                Func <ObservableCollection <status> > funcCalc2 = () =>
                {
                    ObservableCollection <status> tempList = new ObservableCollection <status>();

                    foreach (var div in htmlDocument.DocumentNode.Descendants().Where(i => i.Name == "div" && (i.GetAttributeValue("class", "") == ("row l-col-24-24"))))
                    {
                        try
                        {
                            status newStatus = new status();
                            string name;
                            string state;
                            string description;

                            name           = div.Descendants().Where(i => (i.Name == "h2")).FirstOrDefault().InnerText.Trim();
                            newStatus.name = name.Replace("&#233;", "é");

                            state           = div.Descendants().Where(i => i.Name == "span" && (i.GetAttributeValue("class", "") == "unavailable d-ib-lg d-n-s" || i.GetAttributeValue("class", "") == "active d-ib-lg d-n-s")).FirstOrDefault().InnerText.Trim();
                            newStatus.state = state;

                            description           = div.Descendants().Where(i => i.Name == "p" && (i.GetAttributeValue("class", "") == "description-only")).FirstOrDefault().InnerText.Trim();
                            newStatus.description = description;

                            if (div.Descendants().Where(i => i.Name == "span" && (i.GetAttributeValue("class", "") == "unavailable d-ib-lg d-n-s")).FirstOrDefault() != null)
                            {
                                newStatus.stateIcon = "\uE7BA";
                                try
                                {
                                    newStatus.affectedServices = div.Descendants().Where(i => i.Name == "ul" && (i.GetAttributeValue("class", "") == "services")).FirstOrDefault().InnerText.Trim();
                                    newStatus.lastUpdate       = div.Descendants().Where(i => i.Name == "p" && (i.GetAttributeValue("class", "") == "")).Last().InnerText.Trim();
                                }
                                catch
                                {
                                }

                                newStatus.affectedPlatforms = new List <string>();
                                foreach (var div2 in div.Descendants().Where(i => i.Name == "div" && (i.GetAttributeValue("class", "").StartsWith("label"))))
                                {
                                    try
                                    {
                                        newStatus.affectedPlatforms.Add(div2.InnerText.Trim());
                                    }
                                    catch
                                    {
                                        continue;
                                    }
                                }
                            }
                            else
                            {
                                newStatus.stateIcon = "\uE73E";
                            }

                            tempList.Add(newStatus);
                            //xl-col-14-24 l-col-13-24 m-col-16-24 s-col-20-24 xs-col-20-24
                            //description = div.Descendants().Where(i => (i.Name == "p") && i.GetAttributeValue("class", "") == "description").FirstOrDefault().InnerText.Trim();
                            //newStatus.description = description.Replace("&amp;","&");
                        }
                        catch
                        {
                            continue;
                        }
                    }
                    return(tempList);
                };

                var list2 = await Task.Run(funcCalc2);

                foreach (var i in list2)
                {
                    tempList2.Add(i);
                }

                return(tempList2);
            }
            catch
            {
                return(null);
            }
        }