Ejemplo n.º 1
0
 public RuleSelectScreen()
 {
     BaseGame.ShowMouse = true;
     RuleLoader.Initial();
     string[] ruleLists = RuleLoader.GetRulesList();
     rulesList = new Listbox( "rulelist", new Vector2( 200, 150 ), new Point( 400, 300 ), Color.WhiteSmoke, Color.Green );
     foreach (string rulename in ruleLists)
     {
         rulesList.AddItem( rulename );
     }
     rulesList.OnChangeSelection += new EventHandler( rulesList_OnChangeSelection );
     btn = new TextButton( "OkBtn", new Vector2( 700, 500 ), "Begin", 0, Color.Blue );
     btn.OnClick += new EventHandler( btn_OnPress );
 }
Ejemplo n.º 2
0
        public Room()
        {
            BaseGame.ShowMouse = true;

            roomList = new Listbox("roomlist", new Vector2(30, 100), new Point(200, 350), Color.WhiteSmoke, Color.Green);

            rankList = new Listbox("ranklist", new Vector2(300, 100), new Point(450, 350), Color.WhiteSmoke, Color.Green);

            roomList.AddItem("Room 1");

            bgTexture = BaseGame.ContentMgr.Load<Texture2D>(Path.Combine(Directories.BgContent, "login"));

            bgRect = new Rectangle(0, 0, 800, 600);



            btnCreate = new TextButton("CreateBtn", new Vector2(130, 460), "Create", 0, Color.Gold);
            btnEnter = new TextButton("EnterBtn", new Vector2(50, 460), "Enter", 0, Color.Gold);
            btnRank = new TextButton("RankBtn", new Vector2(650, 460), "Rank List", 0, Color.Gold);

            btnCreate.OnClick += new EventHandler(btnCreate_OnPress);
            btnEnter.OnClick += new EventHandler(btnEnter_OnPress);
            btnRank.OnClick += new EventHandler(btnRank_OnPress);

            rankList.OnChangeSelection += new EventHandler(rankList_OnChangeSelection);
            roomList.OnChangeSelection += new EventHandler(roomList_OnChangeSelection);

            SocketMgr.OnReceivePkg += new SocketMgr.ReceivePkgEventHandler(OnReceivePack);

            /*

            stPkgHead head = new stPkgHead();
            //head.iSytle = //包头类型还没初始化


            MemoryStream Stream = new MemoryStream();
            Stream.Write(new byte[1], 0, 1);
            head.dataSize = 1;
            head.iSytle = 50;
            SocketMgr.SendCommonPackge(head, Stream);
            Stream.Close();
            */
            // 连接到服务器
            //SocketMgr.ConnectToServer();
        }
Ejemplo n.º 3
0
        public Hall(string tmpName)
        {

            devHeads = new List<string>();
            devHeads.Add("asokawu");
            devHeads.Add("ddli");
            devHeads.Add("jehutyhu");
            devHeads.Add("zashchen");
            devHeads.Add("orrischen");
            devHeads.Add("johntan");
            devHeads.Add("seekyao");
            myName = tmpName;

            heads = new List<Texture2D>();
            ranks = new List<int>();
            scores = new List<int>();

            BaseGame.ShowMouse = true;

            roomList = new Listbox("roomlist", new Vector2(50, 120), new Point(200, 350), Color.White, Color.Green);

            rankList = new Listbox("ranklist", new Vector2(300, 120), new Point(450, 350), Color.White, Color.Green);


            bgTexture = BaseGame.ContentMgr.Load<Texture2D>(Path.Combine(Directories.BgContent, "bg"));
            rlTexture = BaseGame.ContentMgr.Load<Texture2D>(Path.Combine(Directories.UIContent, "roomlist"));
            riTexture = BaseGame.ContentMgr.Load<Texture2D>(Path.Combine(Directories.UIContent, "roominfo"));

            bgRect = new Rectangle(0, 0, 800, 600);


            btnRefresh = new TextButton("RefreshBtn", new Vector2(150, 480), "Refresh", 0, Color.Gold);
            btnCreate = new TextButton("CreateBtn", new Vector2(310, 480), "Create a new room", 0, Color.Gold);
            btnQuit = new TextButton("QuitBtn", new Vector2(450, 410), "Quit", 0, Color.Gold);
            btnEnter = new TextButton("EnterBtn", new Vector2(70, 480), "Enter", 0, Color.Gold);
            btnRank = new TextButton("RankBtn", new Vector2(650, 480), "Rank List", 0, Color.Gold);
            btnStart = new TextButton("StartBtn", new Vector2(550, 410), "Start", 0, Color.Gold);

            btnRefresh.OnClick += new EventHandler(btnRefresh_OnPress);
            btnCreate.OnClick += new EventHandler(btnCreate_OnPress);
            btnQuit.OnClick += new EventHandler(btnQuit_OnPress);
            btnEnter.OnClick += new EventHandler(btnEnter_OnPress);
            btnRank.OnClick += new EventHandler(btnRank_OnPress);
            btnStart.OnClick += new EventHandler(btnStart_OnPress);

            rankList.OnChangeSelection += new EventHandler(rankList_OnChangeSelection);
            roomList.OnChangeSelection += new EventHandler(roomList_OnChangeSelection);

            SocketMgr.OnReceivePkg += new SocketMgr.ReceivePkgEventHandler(OnReceivePack);



            headSend = new stPkgHead();
            Stream = new MemoryStream();
            headSend.dataSize = 0;
            headSend.iSytle = 33;
            SocketMgr.SendCommonPackge(headSend, Stream);
            Stream.Close();
            bInRoom = false;
            bWaitEnter = false;
            bIsHost = false;
            bHasError = false;
        }
Ejemplo n.º 4
0
        public Rank()
        {
            devHeads = new List<string>();
            devHeads.Add("asokawu");
            devHeads.Add("ddli");
            devHeads.Add("jehutyhu");
            devHeads.Add("zashchen");
            devHeads.Add("orrischen");
            devHeads.Add("johntan");
            devHeads.Add("seekyao");
            
            BaseGame.ShowMouse = true;


            rankPos = new Vector2(50, 120);

            roomList = new Listbox("roomlist", new Vector2(550, 120), new Point(200, 150), Color.White, Color.Black);
            rankList = new Listbox("ranklist", rankPos, new Point(450, 350), Color.White, Color.Green);
            bgTexture = BaseGame.ContentMgr.Load<Texture2D>(Path.Combine(Directories.BgContent, "bg"));
            rkTexture = BaseGame.ContentMgr.Load<Texture2D>(Path.Combine(Directories.UIContent, "ranklist"));
            piTexture = BaseGame.ContentMgr.Load<Texture2D>(Path.Combine(Directories.UIContent, "yourinfo"));
            bgRect = new Rectangle(0, 0, 800, 600);
            btnOK = new TextButton("OKBtn", new Vector2(550, 370), "OK", 0, Color.Gold);
            btnOK.OnClick += new EventHandler(btnOK_OnPress);
            rankList.OnChangeSelection += new EventHandler(rankList_OnChangeSelection);
            roomList.OnChangeSelection += new EventHandler(roomList_OnChangeSelection);
            SocketMgr.OnReceivePkg += new SocketMgr.ReceivePkgEventHandler(OnReceivePack);



            stPkgHead head = new stPkgHead();
            //head.iSytle = //包头类型还没初始化
            byte[] rankcode = new byte[4];
            rankcode[0] = 1;
            rankcode[1] = 0;
            rankcode[2] = 0;
            rankcode[3] = 0;

            MemoryStream Stream = new MemoryStream();
            Stream.Write(rankcode, 0, 4);
            head.dataSize = 4;
            head.iSytle = 50;
            SocketMgr.SendCommonPackge(head, Stream);
            Stream.Close();


            stPkgHead head2 = new stPkgHead();
            MemoryStream Stream2 = new MemoryStream();
            head2.dataSize = 0;
            head2.iSytle = 40;
            SocketMgr.SendCommonPackge(head2, Stream2);
            Stream2.Close();

            head = new stPkgHead();
            //head.iSytle = //包头类型还没初始化
            rankcode = new byte[4];
            rankcode[0] = 1;
            rankcode[1] = 0;
            rankcode[2] = 0;
            rankcode[3] = 0;

            Stream = new MemoryStream();
            Stream.Write(rankcode, 0, 4);
            head.dataSize = 4;
            head.iSytle = 50;
            SocketMgr.SendCommonPackge(head, Stream);
            Stream.Close();

            bOK = false;
            rankItems = new List<RankIF>();
            bLoaded = false;
            // 连接到服务器
            //SocketMgr.ConnectToServer();
        }