Exemple #1
0
        public async Task <IActionResult> Create(AddGeneral addGeneral)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    if (addGeneral.OfficialDayOff < DateTime.Now)
                    {
                        ModelState.AddModelError(string.Empty, "Official Day off must be greater than actual day");
                        return(View(addGeneral));
                    }
                    GeneralTable generalTable = new GeneralTable()
                    {
                        OfficialDayOff = addGeneral.OfficialDayOff,
                        Reason         = addGeneral.Reason
                    };
                    await _generalService.CreateGeneralAsync(generalTable);

                    return(RedirectToAction("CalendarHolidays"));
                }
                return(View(addGeneral));
            }
            catch (Exception)
            {
                ViewBag.Error = "Something wrong";
                return(View("Error"));
            }
        }
    // Update is called once per frame
    void Update()
    {
        if (GamePlayManager.CurGameState != GamePlayManager.GameState.InGame)
        {
            return;
        }
        //catch input information
        if (Input.GetKeyDown(fireKey))
        {
            isOn = !isOn;
            playerMeshRenderer.material.color = (isOn)? GeneralTable.GetColor(type) : GeneralTable.GetColor(GeneralTable.Type.White);
            if (isOn)
            {
                EnType();
            }
            else
            {
                DeType();
            }
        }

        if (Input.GetKeyDown(changeDirKey) && isOn)
        {
            ChangeWaypointColor();
        }
    }
Exemple #3
0
    // if Color match queue color, add one point, and create another color into queue.
    public bool match(GeneralTable.Type typeValue)
    {
        currentColorBallNum++;

        bool result = false;

        if (!typeValue.Equals(targetTypeQueue.Peek()))
        {
            failFlag = true;
            result   = true;
        }

        if (currentColorBallNum == estimateColorBallNum)
        {
            GamePlayManager.Instance.ResetTimer();
            if (failFlag)
            {
                PerformFail();
            }
            else
            {
                currentPoint++;
                GamePlayManager.Instance.NextStage();
                GeneralTable.Type currentType = targetTypeQueue.Peek();
                while (currentType == targetTypeQueue.Peek())
                {
                    targetTypeQueue.Dequeue();
                    targetTypeQueue.Enqueue(GeneralTable.GetRandomType());
                }
                centerPointMeshRenderer.material.color = GeneralTable.GetColor(targetTypeQueue.Peek());
            }
        }

        return(result);
    }
Exemple #4
0
    private void OnTriggerEnter(Collider other)
    {
        ColorBall tempColorBall = other.gameObject.GetComponent <ColorBall>();

        if (tempColorBall)
        {
            // Don't case equal for now lol
            if ((int)type > (int)tempColorBall.type)
            {
                type      = GeneralTable.Combine(type, tempColorBall.type);
                BallColor = GeneralTable.GetColor(type);

                GamePlayManager.Instance.centerPoint.RemoveEstimateColorBallNum();
            }
            else
            {
                Destroy(this.gameObject);
            }
        }
        CenterPoint tempCenterPoint = other.gameObject.GetComponent <CenterPoint>();

        if (tempCenterPoint)
        {
            nextCenterPoint.match(type);
            ballCollider.enabled = false;
        }
    }
Exemple #5
0
 public void DeType(GeneralTable.Type type)
 {
     myType = GeneralTable.Remove(myType, type);
     waypointMeshRenderer.material.color = GeneralTable.GetColor(myType);
     if (colorLine)
     {
         colorLine.RemoveType(type);
     }
     if (colorLines.Length > 0)
     {
         colorLines[nextWaypointIndex].RemoveType(type);
     }
 }
    void OnGameOver()
    {
        if (startWaypoint.nextWaypointIndex != 0)
        {
            ChangeWaypointColor();
        }

        if (!isOn)
        {
            EnType();
        }
        isOn = true;
        playerMeshRenderer.material.color = GeneralTable.GetColor(type);
    }
    public void FireColorBall()
    {
        if (ps)
        {
            ps.Clear();
            //ps.startColor = GeneralTable.GetColor(type);
            ps.Play();
        }

        GameObject colorballGO = Instantiate(colorBallRef);

        colorballGO.transform.position = new Vector3(this.transform.position.x, 1, this.transform.position.z);
        colorballGO.GetComponent <ColorBall>().type         = type;
        colorballGO.GetComponent <ColorBall>().BallColor    = GeneralTable.GetColor(type);
        colorballGO.GetComponent <ColorBall>().nextWaypoint = startWaypoint;
    }
Exemple #8
0
    public void Reset()
    {
        currentPoint = 0;

        blackFlag      = false;
        cumulativeTime = 0;

        estimateColorBallNum = 0;
        currentColorBallNum  = 0;
        failFlag             = false;

        targetTypeQueue.Clear();
        for (int i = 0; i < countMax; ++i)
        {
            targetTypeQueue.Enqueue(GeneralTable.GetRandomType());
        }
        centerPointMeshRenderer.material.color = GeneralTable.GetColor(targetTypeQueue.Peek());

        this.transform.localScale = new Vector3(fixedScale, fixedScale, fixedScale);
    }
Exemple #9
0
        public static GeneralTable LoadGeneralTable(string file)
        {
            GeneralTable rval = new GeneralTable();

            using (StreamReader srTable = new StreamReader(new FileStream(file, FileMode.Open)))
            {
                rval.N = int.Parse(srTable.ReadLine().Trim());

                var M = new Dictionary <int, int>();
                while (!srTable.EndOfStream)
                {
                    string   line  = srTable.ReadLine();
                    string[] parts = line.Split('\t');
                    if (parts.Length == 2)
                    {
                        M.Add(int.Parse(parts[0].TrimStart('0')), int.Parse(parts[1].Trim()));
                    }
                }
                rval.M = M;
            }
            return(rval);
        }
Exemple #10
0
            public static int Insert(UserModel Value)
            {
                SqlCommand Cmd = new SqlCommand("ShippingCostRegister", new SqlConnection(DBMan.EsamConnection));

                Cmd.CommandType = CommandType.StoredProcedure;

                SqlParameter _RefID = new SqlParameter("@RefID", SqlDbType.Int);

                DBMan.SetParameterValue(_RefID, Value.RefID.ID);

                SqlParameter _Cost = new SqlParameter("@Cost", SqlDbType.Decimal);

                DBMan.SetParameterValue(_Cost, Value.Cost);

                SqlParameter _Description = new SqlParameter("@Description", SqlDbType.NVarChar);

                DBMan.SetParameterValue(_Description, Value.Description);

                SqlParameter _Status = new SqlParameter("@Status", SqlDbType.Int);

                DBMan.SetParameterValue(_Status, Value.Status);

                Cmd.Parameters.Add(_RefID);
                Cmd.Parameters.Add(_Cost);
                Cmd.Parameters.Add(_Description);
                Cmd.Parameters.Add(_Status);

                try
                {
                    Cmd.Connection.Open();
                    return(GeneralTable.ExecuteCommand(Cmd));
                }
                finally
                {
                    Cmd.Connection.Close();
                }
            }
 public PropertyGridViewModel()
 {
     TableSource = new GeneralTable(0, 1);
 }
Exemple #12
0
 public void RemoveType(GeneralTable.Type type)
 {
     colorType = GeneralTable.Remove(type, colorType);
     colorLineRenderer.material.color = GeneralTable.GetColor(colorType);
 }
Exemple #13
0
 public void Start()
 {
     colorLineRenderer.material.color = GeneralTable.GetColor(colorType);
 }
Exemple #14
0
 public void AddType(GeneralTable.Type type)
 {
     colorType = GeneralTable.Combine(type, colorType);
     colorLineRenderer.material.color = GeneralTable.GetColor(colorType);
 }
Exemple #15
0
 private void Update()
 {
     if (blackFlag)
     {
         cumulativeTime += Time.deltaTime;
         centerPointMeshRenderer.material.color = Color.Lerp(centerPointMeshRenderer.material.color, GeneralTable.GetColor(GeneralTable.Type.White), cumulativeTime / colorLerpPeriod);
         if (cumulativeTime / colorLerpPeriod >= 1)
         {
             blackFlag = false;
         }
     }
 }
Exemple #16
0
        public async Task <ServiceResultWithModel <GeneralTable> > CreateGeneralAsync(GeneralTable general)
        {
            try
            {
                _unitOfWork.GeneralRepository.Insert(general);
                await _unitOfWork.CommitAsync();

                return(ServiceResultWithModel <GeneralTable> .Success(general));
            }
            catch (Exception ex)
            {
                return(ServiceResultWithModel <GeneralTable> .Failed(ex.Message));
            }
        }
Exemple #17
0
 void init()
 {
     GamePlayManager.OnGameOver += OnGameOver;
     //keep and do something
     playerMeshRenderer.material.color = GeneralTable.GetColor(type);
 }
Exemple #18
0
 // Use this for initialization
 void Start()
 {
     Reset();
     GamePlayManager.OnGameStart           += Reset;
     centerPointMeshRenderer.material.color = GeneralTable.GetColor(GeneralTable.Type.White);
 }