Example #1
0
    // Populate scene with game-specific objects
    void Begin()
    {
        //Create UI controller object
        GameObject objUI = Instantiate(UIObject);
        UIDocument UIDoc = objUI.GetComponent <UIDocument>();

        //Create ScoreController, and bind to logic script
        GameObject scoreController = Instantiate(ScoreObject);
        ScoreLogic sLogic          = scoreController.GetComponent <ScoreLogic>();

        //Give ScoreLogic a reference to my own logic script
        sLogic.gLogic = GetComponent <GameLogic>();
        sLogic.UIRef  = UIDoc;

        //Ship creation
        GameObject PlayerShip = Instantiate(ShipObject, new Vector3(7, 3, 1), Quaternion.Euler(0, -90, -90));
        ShipLogic  Logic      = PlayerShip.GetComponent <ShipLogic>();

        Logic.Player = (1);
        AllShips.Insert(0, Logic);

        PlayerShip   = Instantiate(ShipObject, new Vector3(-7, -3, 1), Quaternion.Euler(0, 90, 90));
        Logic        = PlayerShip.GetComponent <ShipLogic>();
        Logic.Player = (2);
        AllShips.Insert(1, Logic);
    }
Example #2
0
    public void CreateScore()
    {
        string[,] scores = ScoreLogic.StringToList(PlayerPrefs.GetString("HighScore"));

        string[] tempUser = new string[2] {
            writtenName.text, currentScore.text
        };
        for (int i = 0; i < scores.GetLength(0); i++)
        {
            listedUser[0] = scores[i, 0];
            listedUser[1] = scores[i, 1];

            if (listedUser[1].Equals("") || Int16.Parse(tempUser[1]) > Int16.Parse(listedUser[1]))
            {
                scores[i, 0] = tempUser[0];
                scores[i, 1] = tempUser[1];

                tempUser[0] = listedUser[0];
                tempUser[1] = listedUser[1];
            }
        }

        PlayerPrefs.SetString("HighScore", ScoreLogic.ListToString(scores));
        StaticData.ResetScores();
        SceneManager.LoadScene("TheHub", LoadSceneMode.Single);
    }
Example #3
0
        public ScoreObject startupGameObject(GameObject parent, int score)
        {
            this.ImageStretch = Stretch.UniformToFill;
            this.IsCroppable  = CropTo.Both;

            base.startupGameObject(new Point(80, 29), "Media/board_score.png", ZLayers.PLAYER_Z);

            _bkg = new TextBlock()
            {
                Height = dimensions.Y,
                Width  = dimensions.X
            };
            _bkg.Padding    = new Thickness(25, 3, 2, 3);
            _bkg.Text       = score.ToString();
            _bkg.FontSize   = 16;
            _bkg.FontWeight = FontWeights.Bold;
            _bkg.SetValue(Canvas.LeftProperty, 0.0d);
            _bkg.SetValue(Canvas.TopProperty, 0.0d);

            (AuditoryGameApp.Current.RootVisual as GamePage).LayoutRoot.Children.Remove(this.rect);
            (AuditoryGameApp.Current.RootVisual as GamePage).LayoutRoot.Children.Add(rect);
            (AuditoryGameApp.Current.RootVisual as GamePage).LayoutRoot.Children.Add(_bkg);

            _player             = parent;
            _scoreLogic         = (score == 0) ? new ScoreLogic(this.ZeroScoreLogic) : new ScoreLogic(this.AddScoreLogic);
            this._collisionName = CollisionIdentifiers.NONE;
            return(this);
        }
Example #4
0
    void Start()
    {
        ShowCurrentScore();

        CheckValidFormat();

        string[,] score = ScoreLogic.StringToList(PlayerPrefs.GetString("HighScore"));

        for (int i = 0; i < 10; i++)
        {
            line = i % 5;
            row  = Mathf.FloorToInt(i / 5);

            GameObject newPanel = Instantiate(scorePanel);
            newPanel.transform.SetParent(GameObject.Find("/Canvases/HighScoreCanvas/HighScorePanel").transform);
            newPanel.transform.GetChild(0).GetComponent <TextMeshProUGUI>().text = (i + 1).ToString() + ". " + score[i, 0] + " " + score[i, 1];
            newPanel.GetComponent <RectTransform>().localScale = new Vector3(1, 1, 1);

            RectTransform rect = newPanel.GetComponent <RectTransform>();
            rect.anchoredPosition3D = new Vector3(0, 0, 0);
            rect.offsetMin          = new Vector2(2 + 93 * row, rect.offsetMin.y);
            rect.offsetMax          = new Vector2(-95 + 93 * row, rect.offsetMax.y);
            rect.offsetMax          = new Vector2(rect.offsetMax.x, -13 - 17 * line);
            rect.offsetMin          = new Vector2(rect.offsetMin.x, 70 - 17 * line);
            rect.Rotate(new Vector3(0, 90, 0));
        }
    }
Example #5
0
 void Start()
 {
     headChefTransform = GameObject.Find("Head Chef").GetComponent <Transform>();
     foodSpawner       = GameObject.Find("Scene Manager").GetComponent <FoodSpawner>();
     scoreLogic        = GameObject.Find("Scene Manager").GetComponent <ScoreLogic>();
     foodInteraction   = GameObject.Find("Detection Trigger").GetComponent <FoodInteraction>();
 }
Example #6
0
 void Start()
 {
     physicsLogic     = this.gameObject.GetComponent <PhysicsLogic> ();
     movmentLogic     = this.gameObject.GetComponent <MovmentLogic> ();
     scoreLogic       = this.gameObject.GetComponent <ScoreLogic>();
     playerStatsLogic = this.gameObject.GetComponent <PlayerStatsLogic>();
     missionLogic     = this.gameObject.GetComponent <MissionLogic>();
     animationLogic   = this.gameObject.GetComponent <AnimationLogic>();
     soundLogic       = this.gameObject.GetComponent <SoundLogic>();
 }
Example #7
0
 public override void shutdown()
 {
     (AuditoryGameApp.Current.RootVisual as GamePage).LayoutRoot.Children.Remove(_bkg);
     _bkg = null;
     base.shutdown();
     _scoreLogic = null;
     if (_player != null)
     {
         _player.collision(null);
     }
 }
Example #8
0
        public static void Main(string[] args)
        {
            Console.WriteLine("Fetching Reviews....");
            List <HtmlDocument> htmlDocList = ReviewLogic.GetReviews(SettingsLogic.GetURL());
            List <Review>       reviews     = ReviewLogic.ParseReviews(htmlDocList);

            ScoreLogic.CalculateScores(reviews);
            ReviewLogic.PrintReviewsToConsole(reviews);

            Console.WriteLine("Press enter to close.");
            Console.ReadLine();
        }
Example #9
0
        public void NegativeReviewScoreIsEqual()
        {
            //283 characters = 2
            //10 rating = 2
            //1 Negative words = -2
            //total 2
            Review review = new();

            review.Body   = "The sales adds are very misleading. I made the mistake again to trust this dealership to lead me to believe that I would get the help I needed to get into something nicer or newer as they put it. They get your hopes up and then shatter them by trying to out you in what they want to.";
            review.Rating = 10;
            review.Score  = ScoreLogic.CalculateScore(review);

            Assert.AreEqual(review.Score, 2);
        }
Example #10
0
 private void OnCollisionEnter2D(Collision2D collision)
 {
     if (collision.gameObject.tag == "Collision")
     {
         score = GameObject.FindGameObjectWithTag("GUI").GetComponent <ScoreLogic>();
         score.AddToScore();
         Instantiate(whiteExplosion, new Vector3(collision.transform.position.x, collision.transform.position.y, 0), Quaternion.identity);
         Instantiate(greenExplosion, new Vector3(collision.transform.position.x, collision.transform.position.y, 0), Quaternion.identity);
         Destroy(collision.gameObject);
     }
     else if (collision.gameObject.tag == "Projectile")
     {
         Destroy(collision.gameObject);
     }
 }
Example #11
0
        public void PositiveReviewScoreIsEqual()
        {
            //1179 characters = 10
            //9 exclamations = 3
            //50 rating = 10
            //2 positive words = 4
            //total 27
            Review review = new();

            review.Body   = "This is the 2nd vehicle I have purchased from McKaig Chevrolet Buick, and I wouldn’t purchase a vehicle anywhere else!  Their service department has taken care of me exceptionally several times, especially Patrick Evans!  He is so friendly and so knowledgeable.  I had a small wreck in my 2018 Chevy Traverse that I purchased from McKaig, and Patrick recommended Adrian Cortes to sell me a new vehicle on the spot instead of fixing my Traverse and I took the bait willingly!  LOL !!!  I knew that Adrian would put me in a reliable vehicle that would fit my needs, including 4-wheel drive, having to fit a 6’4” man in the front passenger seat and 2 big car seats in the back, not to mention TONS of room in the back for all my junk and groceries.  Needless to say, Adrian  fixed me up in a 2018 4x4 Jeep Grand Cherokee that is loaded to the max and is WAY sportier and more luxurious than what I had before.  I told Adrian what I wanted in a vehicle and he took me right to it, where I immediately fell in love with the All-Black look, even the 20” wheels.  I feel like a Cool Mom now thanks to Adrian!  I will DEFINITELY purchase my next vehicle from him!  I couldn’t be happier!";
            review.Rating = 50;
            review.Score  = ScoreLogic.CalculateScore(review);

            Assert.AreEqual(review.Score, 27);
        }
Example #12
0
    // Use this for initialization
    void Start()
    {
        losePanel = GameObject.Find("LosePanel");
        OrigPos   = new Vector3(0, 30, 0);
        EndPos    = new Vector3(0, 6, 0);

        movmentLogic          = this.gameObject.GetComponent <MovmentLogic>();
        playerStatsLogic      = this.gameObject.GetComponent <PlayerStatsLogic>();
        missionLogic          = this.gameObject.GetComponent <MissionLogic>();
        scoreLogic            = this.gameObject.GetComponent <ScoreLogic>();
        missionsToggleAndText = new InternalMissionModel[] {
            new InternalMissionModel(),
            new InternalMissionModel(),
            new InternalMissionModel()
        };
        deathMissionsToggleAndText = new InternalMissionModel[] {
            new InternalMissionModel(),
            new InternalMissionModel(),
            new InternalMissionModel()
        };
        deathMissionsToggleAndTextNew = new InternalMissionModel[] {
            new InternalMissionModel(),
            new InternalMissionModel(),
            new InternalMissionModel()
        };
        int missionNum = 0;

        deathMissionsToggleAndText[missionNum].missionText      = GameObject.Find("LosePanel/LoseMission1/LoseMissionText1").GetComponent <Text>();
        deathMissionsToggleAndText[missionNum].missionToggle    = GameObject.Find("LosePanel/LoseMission1").GetComponent <Toggle>();
        deathMissionsToggleAndTextNew[missionNum].missionText   = GameObject.Find("LosePanel/LoseMission1New/LoseMissionText1").GetComponent <Text>();
        deathMissionsToggleAndTextNew[missionNum].missionToggle = GameObject.Find("LosePanel/LoseMission1New").GetComponent <Toggle>();
        missionNum++;

        deathMissionsToggleAndText[missionNum].missionText      = GameObject.Find("LosePanel/LoseMission2/LoseMissionText2").GetComponent <Text>();
        deathMissionsToggleAndText[missionNum].missionToggle    = GameObject.Find("LosePanel/LoseMission2").GetComponent <Toggle>();
        deathMissionsToggleAndTextNew[missionNum].missionText   = GameObject.Find("LosePanel/LoseMission2New/LoseMissionText2").GetComponent <Text>();
        deathMissionsToggleAndTextNew[missionNum].missionToggle = GameObject.Find("LosePanel/LoseMission2New").GetComponent <Toggle>();
        missionNum++;

        deathMissionsToggleAndText[missionNum].missionText      = GameObject.Find("LosePanel/LoseMission3/LoseMissionText3").GetComponent <Text>();
        deathMissionsToggleAndText[missionNum].missionToggle    = GameObject.Find("LosePanel/LoseMission3").GetComponent <Toggle>();
        deathMissionsToggleAndTextNew[missionNum].missionText   = GameObject.Find("LosePanel/LoseMission3New/LoseMissionText3").GetComponent <Text>();
        deathMissionsToggleAndTextNew[missionNum].missionToggle = GameObject.Find("LosePanel/LoseMission3New").GetComponent <Toggle>();

        origMissionTextX = deathMissionsToggleAndText[missionNum].missionToggle.transform.position.x - 1;
        EndMissionTextX  = origMissionTextX - 30;
        deathScore       = GameObject.Find("LosePanel/LoseScore").GetComponent <Text>();
    }
Example #13
0
    // Start is called before the first frame update
    void Start()
    {
        limitScript = GameObject.Find("GameManager").GetComponent <ObjectLimits>();
        scoreScript = GameObject.Find("GameManager").GetComponent <ScoreLogic>();

        canvas         = GetComponentInChildren <Canvas>();
        canvas.enabled = false;

        healthBar = GetComponentInChildren <Slider>();

        health     = 1500;
        fullHealth = 1500;

        tier         = 1;
        requiredGold = 5000;
    }
        public void TestIncrease()
        {
            this.mockScore = new Mock <IScoreModel>(MockBehavior.Default);
            this.mockBall  = new Mock <IBallModel>(MockBehavior.Default);

            this.mockScore.SetupProperty(mock => mock.CurrentScore, 0);
            this.mockScore.SetupProperty(mock => mock.ComboCounter, 1);

            ScoreLogic scoreLogic = new ScoreLogic(this.mockScore.Object, this.mockBall.Object);

            scoreLogic.Increase(ScoreType.FootHit);
            Assert.That(this.mockScore.Object.CurrentScore, Is.EqualTo(10));
            scoreLogic.Increase(ScoreType.FootHit);
            Assert.That(this.mockScore.Object.CurrentScore, Is.EqualTo(30));
            scoreLogic.Increase(ScoreType.FootHit);
            Assert.That(this.mockScore.Object.CurrentScore, Is.EqualTo(60));
        }
Example #15
0
        private void GameScreen_Loaded(object sender, RoutedEventArgs e)
        {
            MainWindow win = (MainWindow)Window.GetWindow(this);

            if (win.IsNewGame)
            {
                this.GameModel      = new GameModel(win.PlayerName);
                this.ballLogic      = new BallLogic(this.GameModel.Ball);
                this.characterLogic = new CharacterLogic(this.GameModel.Ball, this.GameModel.Character, this.GameModel.Score, this.GameModel.Timer);
                this.scoreLogic     = new ScoreLogic(this.GameModel.Score, this.GameModel.Ball);
                this.timerLogic     = new TimerLogic(this.GameModel.Timer, this.GameModel);
            }
            else
            {
                this.GameModel = win.GameModel;
                this.GameModel.Character.Blocked = false;
                this.ballLogic      = new BallLogic(this.GameModel.Ball);
                this.characterLogic = new CharacterLogic(this.GameModel.Ball, this.GameModel.Character, this.GameModel.Score, this.GameModel.Timer);
                this.scoreLogic     = new ScoreLogic(this.GameModel.Score, this.GameModel.Ball);
                this.timerLogic     = new TimerLogic(this.GameModel.Timer, this.GameModel);
            }

            this.render = new GameRenderer(this.GameModel);

            if (win != null)
            {
                this.tickTimer        = new DispatcherTimer();
                this.tickTimerSeconds = new DispatcherTimer
                {
                    Interval = TimeSpan.FromMilliseconds(1000),
                };
                this.tickTimer.Interval = TimeSpan.FromMilliseconds(20);

                this.tickTimer.Tick        += this.Timer_Tick;
                this.tickTimerSeconds.Tick += this.Timer_Tick_Seconds;

                this.tickTimerSeconds.Start();
                this.tickTimer.Start();

                win.KeyDown += this.Win_KeyDown;
                win.KeyUp   += this.Win_KeyUp;
            }

            this.ballLogic.RefreshScreen += (obj, args) => this.InvalidateVisual();
            this.InvalidateVisual();
        }
Example #16
0
        public ActionResult CheckApply(string keyValue)
        {
            ExpApplyEntity entity = entityApp.GetForm(keyValue);

            AgentApp    agApp = new AgentApp();
            AgentEntity ag    = agApp.GetForm(entity.c_agent_id);

            //更新申请表
            entity.c_apply_state = 1;
            entityApp.SubmitForm(entity, keyValue);

            //更新代理商表

            ag.c_agnet_type = (int)AgentType.Fran;
            agApp.SubmitForm(ag, null, ag.F_Id);

            #region 推荐奖励
            //积分奖励
            ScoreLogic.DealRewardScore(ag.F_Id, RewartType.Recommend);

            Agent ag2 = AgentLogic.GetEnityById(entity.c_agent_id);
            #endregion

            //扣减积分
            int score = Convert.ToInt32(CommConfigLogic.GetValueFromConfig((int)ConfigCategory.ScoreConfigCate, (int)RewardConfigKey.expLevelUpScore));
            ScoreDetailLogic.UpdateAgentScore(entity.c_agent_id, -score, "体验店升级扣除");

            //升级
            AgentRelation ar        = AgentRelationLogic.FindEntity(t => t.c_child_id == ag.F_Id);
            Agent         recomm_ag = AgentLogic.GetEnityById(ar.c_parent_id);
            LevelLogic.IsLevelUpWithCondition(recomm_ag);

            #region 生成代理商订单
            Order order = new Order();
            order.c_agent_id   = ag.F_Id;
            order.c_mobile     = ag.c_mobile;
            order.c_state      = (int)OrderState.NoDeliver;
            order.c_remark     = "代理商订单";
            order.c_order_num  = DateTime.Now.ToString("yyyyMMddHHmmss-") + Guid.NewGuid().ToString().Substring(0, 6);
            order.c_order_type = (int)OrderType.Agent;
            OrderLogic.InsertNewEntiy(order);
            #endregion


            return(Success("审核成功。"));
        }
        public ActionResult PostOrder(string OrderId)
        {
            AjaxResult result = new AjaxResult();

            try
            {
                Order order = OrderLogic.GetEnityById(OrderId);
                if (order == null)
                {
                    throw new Exception("未找到订单");
                }
                order.c_total      = OrderDetailLogic.SumOrderTotal(OrderId);
                order.c_order_num  = DateTime.Now.ToString("yyyyMMddHHmmss-") + Guid.NewGuid().ToString().Substring(0, 6);
                order.c_state      = (int)OrderState.NoDeliver;
                order.c_rec_person = agentInfo.agent.c_rec_person;
                order.c_mobile     = agentInfo.agent.c_rec_mobile;
                order.c_address    = agentInfo.agent.c_address;
                if (agentInfo.CanCashScore < order.c_total)
                {
                    throw new Exception("剩余积分不足以支付订单内所有商品");
                }
                OrderLogic.UpdateEntity(order);
                int changeScore = 0 - (int)order.c_total;
                ScoreDetailLogic.UpdateAgentScore(agentInfo.agent.c_id, changeScore, "购买产品");
                var detailList = OrderDetailLogic.GetList().Where(t => t.c_order_id == order.F_Id);
                if (detailList.Count() > 0)
                {
                    int totalAmount = (int)detailList.Sum(t => t.c_amount);
                    ScoreLogic.DealRewardScore(agentInfo.agent.c_id, RewartType.Purchase, totalAmount);
                }

                result.state   = ResultType.success.ToString();
                result.message = "成功";
                return(Content(result.ToJson()));
            }
            catch (Exception ex)
            {
                result.state   = ResultType.error.ToString();
                result.message = string.Format("提交失败({0})", ex.Message);
                return(Content(result.ToJson()));

                throw;
            }
        }
Example #18
0
        public ActionResult EnabledAccount(string keyValue)
        {
            bool        hadReward  = agentApp.hadReward(keyValue);
            AgentEntity userEntity = new AgentEntity();

            userEntity.F_Id         = keyValue;
            userEntity.c_state      = 1;//0:未审核   1:审核通过
            userEntity.c_had_reward = true;
            agentApp.UpdateForm(userEntity);

            Agent ag = AgentLogic.GetEnityById(keyValue);

            //升级
            AgentRelation ar        = AgentRelationLogic.FindEntity(t => t.c_child_id == ag.c_id);
            Agent         recomm_ag = AgentLogic.GetEnityById(ar.c_parent_id);

            LevelLogic.IsLevelUpWithCondition(recomm_ag);
            if (!hadReward)
            {
                #region 推荐奖励
                //积分奖励
                ScoreLogic.DealRewardScore(ag.c_id, RewartType.Recommend);

                #endregion

                if (ag.c_agnet_type != (int)AgentType.Exp)//体验店计算上下级奖励即可
                {
                    #region 生成代理商订单
                    Order order = new Order();
                    order.c_agent_id   = ag.c_id;
                    order.c_mobile     = ag.c_mobile;
                    order.c_state      = (int)OrderState.NoDeliver;
                    order.c_remark     = "代理商订单";
                    order.c_order_num  = DateTime.Now.ToString("yyyyMMddHHmmss-") + Guid.NewGuid().ToString().Substring(0, 6);
                    order.c_order_type = (int)OrderType.Agent;
                    OrderLogic.InsertNewEntiy(order);
                    #endregion
                }
            }


            return(Success("审核成功。"));
        }
Example #19
0
        private void OnSectorMouseClick(object sender, MouseEventArgs e)
        {
            if (IsBallNotSector)
            {
                return;
            }

            Sector sector = (Sector)sender;

            if (e.Button == MouseButtons.Left)
            {
                sector.TurnLeft();
            }

            if (e.Button == MouseButtons.Right)
            {
                sector.TurnRight();
            }

            int currentMaxScore = ScoreLogic.GetUpdatedMaximumScore();

            Game.ChangeScoreForAllPlayers();
            ShowScoreForAllPlayers();

            if (currentMaxScore >= Constants.WIN_SCORE)
            {
                SomeoneWins(currentMaxScore);
            }

            if (Game.HasNoWhiteBalls())
            {
                GameOver();
            }

            sector.Game.SetNextPlayerIndex();
            lblActivePlayer.Text = OnscreenText.PlayerName(Player.GetActivePlayer().Name);
            label_hint.Text      = OnscreenText.ChooseBall;

            IsBallNotSector = true;
        }
Example #20
0
    // Start is called before the first frame update
    void Start()
    {
        canvas         = GetComponentInChildren <Canvas>();
        canvas.enabled = false;

        limitScript   = GameObject.Find("GameManager").GetComponent <ObjectLimits>();
        scoreScript   = GameObject.Find("GameManager").GetComponent <ScoreLogic>();
        goldPerSecond = 4;

        healthBar = GetComponentInChildren <Slider>();

        health     = 150;
        fullHealth = 150;

        tier          = 1;
        requiredWood  = 5;
        requiredStone = 5;
        requiredGold  = 0;

        sellingWood  = 2;
        sellingStone = 2;
        sellingGold  = 0;
    }
Example #21
0
 void callAddToScoreScript()
 {
     addToScore = GameObject.FindGameObjectWithTag("GUI").GetComponent <ScoreLogic>();
     addToScore.addToScoreVoid();
 }
Example #22
0
 // Use this for initialization
 void Start()
 {
     scoreLogic = GameObject.Find("Logic").GetComponent <ScoreLogic>();
 }
Example #23
0
 void Start()
 {
     score = GameObject.FindGameObjectWithTag("GUI").GetComponent <ScoreLogic>();
 }
 void Awake()
 {
     waitSignTime       = 0.0f;
     scoreGameObject    = GameObject.FindGameObjectWithTag("Score").GetComponent <ScoreLogic>();
     waitTextGameObject = GameObject.FindGameObjectWithTag("WaitText").GetComponent <WaitTextLogic>();
 }
 void Start()
 {
     ps         = GetComponent <ParticleSystem>();
     scoreLogic = GameObject.FindGameObjectWithTag("GameController").GetComponent <ScoreLogic> ();
     gameOver   = GameObject.FindObjectOfType <GameOver> ();
 }