Exemplo n.º 1
0
        /// <summary>
        /// 存储陷落柱信息
        /// </summary>
        public void getCInfo()
        {
            string constr = sqlDataManager.getConn();

            using (SqlConnection conn = new SqlConnection(constr))
            {
                string         sql     = "select X,Y from CollapseColumnPoint ";
                SqlCommand     cmd     = new SqlCommand(sql, conn);
                SqlDataAdapter adapter = new SqlDataAdapter();
                adapter.SelectCommand = cmd;
                DataSet   ds = new DataSet();
                DataTable dt = new DataTable();
                conn.Open();
                adapter.Fill(ds);
                dt = ds.Tables[0];
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    CInfo cinfo = new CInfo();
                    cinfo.X = Convert.ToDouble(dt.Rows[i][4]);
                    cinfo.Y = Convert.ToDouble(dt.Rows[i][5]);
                    Cinfo.Add(cinfo);
                }
                conn.Close();
            }
        }
        public async Task <IActionResult> Edit(int id, [Bind("ID,FName,LName,Dateofbirth,Telno,Email")] CInfo cInfo)
        {
            if (id != cInfo.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(cInfo);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CInfoExists(cInfo.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(cInfo));
        }
Exemplo n.º 3
0
 public void resetInfo()
 {
     character    = null;
     hand         = null;
     dominant     = "undefined";
     attackDamage = 0;
 }
Exemplo n.º 4
0
        static void Main(string[] args)
        {
            AFactory a1;

            a1 = BuildB; // ковариантность
            A p = a1("class A use method of class B (delegate of class A, B : A)");

            p.Display();

            AFactory a2;

            a2 = BuildC; // ковариантность
            p  = a2("class A use method of class C (delegate of class A, C : B, B : A)");
            p.Display();

            BFactory b;

            b = BuildC; // ковариантность
            p = b("class B use method of class C (delegate of class B, C : B)");
            p.Display();

            CInfo cInfo = GetAInfo; // контравариантность
            C     c1    = new C("class C use method of class A (delegate of class C, C : B, B : A)");

            cInfo(c1);

            cInfo = GetBInfo; // контравариантность
            C c2 = new C("class C use method of class B (delegate of class C, C : B)");

            cInfo(c2);

            Console.ReadKey();
        }
Exemplo n.º 5
0
    public CSurvivalState(CInfo stageInfo)
    {
        CGame.inst().setImage("Sprites/level_Background00");
        CurrentStageData.clearData();
        SoundList.instance.playLevelMusic();
        tryAgainInfo = stageInfo;
        switch (stageInfo.Kaiju)
        {
        case 1:
            monster = new Dinosaur(stageInfo.startStage, stageInfo.firstStage, stageInfo.secondStage);
            break;

        case 2:
            monster = new Kong(stageInfo.startStage, stageInfo.firstStage, stageInfo.secondStage);
            break;

        case 3:
            monster = new Kraken(stageInfo.startStage, stageInfo.firstStage, stageInfo.secondStage);
            break;
        }
        current_state = STATE_PLAYING;
        CurrentStageData.difficulty = 0;
        mBoard = new Board(1);

        building = new Enemy(0);


        timeLeft = new CText("Time: ", CText.alignment.TOP_CENTER);
        timeLeft.setX(0);
        timeLeft.setY(0);
        timeLeft.setColor(Color.black);

        scoreText = new CText("SCORE :", CText.alignment.TOP_CENTER);
        scoreText.setX(400);
        scoreText.setY(0);
        scoreText.setColor(Color.black);
        btnNextScreen = new CSprite();
        btnNextScreen.setSortingLayer("TextUI");

        mBoard.targetScore = stageInfo.TargetScore; // MOVE TO CLASS
        float scoreCoefficient = (float)70 / (float)mBoard.targetScore;

        skills = new SkillBar(stageInfo.Kaiju);
        mTimer = new Timer();
        CurrentStageData.assignData(monster, mBoard, scoreCoefficient, skills);
        CurrentStageData.assignTimer(mTimer);
        screenDim = new CSprite();
        screenDim.setSortingLayer("ScreenShade");
        screenDim.setName("Sombra");
        backMenuBttn = new CSprite();
        backMenuBttn.setSortingLayer("TextUI");
        tryAgainBttn = new CSprite();
        tryAgainBttn.setSortingLayer("TextUI");
        optionsBttn = new CSprite();
        optionsBttn.setImage(Resources.Load <Sprite>("Sprites/Buttons/Pause_Button"));
        optionsBttn.setXY(680, 40);
        optionsBttn.setSortingLayer("TextUI");
    }
Exemplo n.º 6
0
        /// <summary>
        /// 写文件线程方法
        /// </summary>
        private void WriteThread()
        {
            if (!Directory.Exists("Log"))
            {
                Directory.CreateDirectory("Log");
            }
            CInfo info = null;

            while (true)
            {
                while (wirteLogs.Count > 0)
                {
                    lock (lockWirteLogs)
                    {
                        info = wirteLogs.Dequeue();
                    }

                    if (info != null)
                    {
                        string path = System.IO.Path.Combine("Log", DateTime.Now.ToString("yyyy-MM-dd")) + ".log";
                        using (StreamWriter writer = new StreamWriter(path, true))
                        {
                            writer.WriteLine(info.ToString());
                        }


                        if (Logs.Count > 0xffff)
                        {
                            Logs.RemoveRange(0, 0xff);
                        }
                        Logs.Add(info);

                        if (IsClose)
                        {
                            return;
                        }
                        this.Dispatcher.Invoke(() =>
                        {
                            ListViewItem item = new ListViewItem();
                            item.Content      = info;
                            if (info.type == CInfo.emType.Error)
                            {
                                item.Background = Brushes.Red;
                            }
                            listView.Items.Add(item);
                        });

#if DEBUG
                        //Console.WriteLine(info.ToString());
#endif
                        info = null;
                    }
                }

                Thread.Sleep(10);
            }
        }
        public async Task <IActionResult> Create([Bind("ID,FName,LName,Dateofbirth,Telno,Email")] CInfo cInfo)
        {
            if (ModelState.IsValid)
            {
                _context.Add(cInfo);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(cInfo));
        }
Exemplo n.º 8
0
    public CLevelState(int stageNumber)
    {
        SoundList.instance.playLevelMusic();
        CInfo stageInfo = LevelsInfo.getLevel(stageNumber);

        CGame.inst().setImage("Sprites/level_Background0" + stageInfo.building.ToString());
        CurrentStageData.currentStage = stageNumber;
        switch (stageInfo.Kaiju)
        {
        case 1:
            monster = new Dinosaur(stageInfo.startStage, stageInfo.firstStage, stageInfo.secondStage);
            break;

        case 2:
            monster = new Kong(stageInfo.startStage, stageInfo.firstStage, stageInfo.secondStage);
            break;

        case 3:
            monster = new Kraken(stageInfo.startStage, stageInfo.firstStage, stageInfo.secondStage);
            break;
        }
        current_state = STATE_PLAYING;
        CurrentStageData.difficulty = stageInfo.dif;
        mBoard = new Board(0);
        //monster = new Kong(1, 53, 76);
        building = new Enemy(stageInfo.building);
        mText    = new CText("TEST", CText.alignment.TOP_CENTER);
        mText.setX(0);
        mText.setY(0);
        mText.setColor(Color.black);



        mBoard.movementsLeft = stageInfo.movements;   // MOVE TO CLASS
        mBoard.targetScore   = stageInfo.TargetScore; // MOVE TO CLASS
        float scoreCoefficient = (float)70 / (float)mBoard.targetScore;

        skills = new SkillBar(stageInfo.Kaiju);
        CurrentStageData.assignData(monster, mBoard, scoreCoefficient, skills);
        screenDim = new CSprite();
        screenDim.setSortingLayer("ScreenShade");
        screenDim.setName("Sombra");
        backMenuBttn = new CSprite();
        backMenuBttn.setSortingLayer("TextUI");
        tryAgainBttn = new CSprite();
        tryAgainBttn.setSortingLayer("TextUI");
        btnNextScreen = new CSprite();
        btnNextScreen.setSortingLayer("TextUI");
        optionsBttn = new CSprite();
        optionsBttn.setImage(Resources.Load <Sprite>("Sprites/Buttons/Pause_Button"));
        optionsBttn.setXY(680, 40);
        optionsBttn.setSortingLayer("TextUI");
    }
Exemplo n.º 9
0
        /// <summary>
        /// 添加一条记录
        /// 内部使用,不对外公开
        /// </summary>
        /// <param name="info"></param>
        protected static void Add(CInfo info)
        {
            try
            {
                Logs.Add(info);

                lock (CLog.Instance.lockWirteLogs)
                {
                    CLog.Instance.wirteLogs.Enqueue(info);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Exemplo n.º 10
0
        public MessageBuilder(CInfo info)
        {
            FormattedMessage = new List<string>();

            Info = info;
        }
Exemplo n.º 11
0
 public void setInfo(CInfo c, GameObject h, string d)
 {
     character = c;
     hand      = h;
     dominant  = d;
 }
    override public void update()
    {
        base.update();
        CMouse.update();
        backBtn.update();
        dinoBtn.update();
        kongBtn.update();
        krakenBtn.update();

        if (backClick())
        {
            SoundList.instance.playMenuMusic();
            CGame.inst().setState(new CMenuState());
            return;
        }

        switch (selected)
        {
        case 0:
            if (dinoClick())
            {
                kongBtn.leave();
                krakenBtn.leave();
                selected = 1;
                SoundList.instance.playNewGame2();
                return;
            }
            else
            if (kongClick())
            {
                dinoBtn.leave();
                krakenBtn.leave();
                SoundList.instance.playNewGame2();
                selected = 2;
                return;
            }
            else if (krakenClick())
            {
                kongBtn.leave();
                dinoBtn.leave();
                SoundList.instance.playNewGame2();
                selected = 3;
                return;
            }
            break;

        case 1:
            if (kongBtn.currentState == 1 & krakenBtn.currentState == 1)
            {
                CInfo aux1 = new CInfo(1, 1, 50, 70, CGameConstants.HIGH_SCORE, 0, 0, 0);
                CGame.inst().setState(new CSurvivalState(aux1));
            }
            break;

        case 2:
            if (dinoBtn.currentState == 1 & krakenBtn.currentState == 1)
            {
                CInfo aux1 = new CInfo(2, 1, 50, 70, CGameConstants.HIGH_SCORE, 0, 0, 0);
                CGame.inst().setState(new CSurvivalState(aux1));
            }
            break;

        case 3:
            if (dinoBtn.currentState == 1 & kongBtn.currentState == 1)
            {
                CInfo aux1 = new CInfo(3, 1, 50, 70, CGameConstants.HIGH_SCORE, 0, 0, 0);
                CGame.inst().setState(new CSurvivalState(aux1));
            }
            break;
        }


        CSpriteManager.inst().update();
    }