30-03-2011, 16:13
|
|
|
חבר מתאריך: 03.08.09
הודעות: 38
|
|
טוב אחי זה הנה,
אז הולך לעשות על תקשורת בין מחשבים ושרק אנשים רגילים יוכלו לשחק ושאין שימוש בAI!
אז אני צריך שתגידו לי אם המחלקה של הלקוח והשרת בסדר ואם אני צריך להוסיף עוד משו(כל מה שיש לומר תגידו כדי שאהיה לי במצב הכי טוב שיש ולא אהיו בעיות)-
server
קוד PHP:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace poker_texas_holdem
{
class server
{
public myServer(int port, string password)
{
if (password=="")
password = "OK";
this.pass = password;
this.port = port;
#if DEBUG
this.myTcpListener = new TcpListener(IPAddress.Loopback, this.port);
#else
this.myTcpListener = new TcpListener(IPAddress.Any, this.port);
#endif
}
}
}
client
קוד PHP:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace poker_texas_holdem
{
class client
{
public bool Connect()
{
try
{
#if DEBUG
myTcpClient.Connect(IPAddress.Loopback,port);
#else
IPAddress ipAddress = IPAddress.Parse(ip);
IPEndPoint ipEndPoint = new IPEndPoint(ipAddress, port);
myTcpClient.Connect(ipEndPoint);
#endif
HandleConnectedThread = new Thread(HandleConnected);
HandleConnectedThread.Start();
return true;
}
}
}
ויש לי עוד מחלקה שבנתיים עשיתי שהיא "קלף" בבקשה תגידו לי אם בסדר וצריך להוסיף משו-
card
קוד PHP:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace poker
{
class card
{
private int num;//num of the card
private int shape;//shape of the card
public card(int num, int shape)//constructive method
{
this.num = num;
this.shape = shape;
}
}
}
תודה לכולם על העזרה...
|