| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1780 人关注过本帖
标题:求一段用c#编写的翻牌游戏的代码
只看楼主 加入收藏
kimi_lio0120
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2009-7-1
收藏
 问题点数:0 回复次数:2 
求一段用c#编写的翻牌游戏的代码
求一段用c#编写的翻牌游戏的代码
谢谢啦
搜索更多相关主题的帖子: 编写 代码 游戏 翻牌 
2009-07-01 12:56
曾几何时7467
Rank: 1
等 级:新手上路
帖 子:10
专家分:0
注 册:2010-4-17
收藏
得分:0 
/ RoAssistDlg.cpp : implementation file
//

#include "stdafx.h"
#include "RoAssist.h"
#include "RoAssistDlg.h"
#include "afxmt.h"
#include "GameSocket.h"
#include "CSDialog.h"

#include <Windows.h>
#include <lm.h>
#include <assert.h>
#pragma comment(lib, "Netapi32.lib")

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CAboutDlg dialog used for App About
HINSTANCE g_sockhdll;
HINSTANCE g_kbhdll;

typedef  BOOL  (__stdcall *InstallSocketHook)(unsigned int pid);
typedef BOOL  (__stdcall *UninstallSocketHook)();
typedef BOOL (__stdcall *InstallKeyboardHook)(unsigned int pid,LPCTSTR wndName);
typedef BOOL  (__stdcall *UninstallKeyboardHook)();

InstallSocketHook InstallSocketHookFunc;
UninstallSocketHook UninstallSocketHookFunc;
InstallKeyboardHook InstallKeyboardHookFunc;
UninstallKeyboardHook UninstallKeyboardHookFunc;

CEvent ThreadBegin;
CEvent ThreadEnd;
CEvent ThreadOver;

UINT SendPackageThread(LPVOID lParam)
{
    ::WaitForSingleObject(ThreadBegin.m_hObject,INFINITE);

    CRoAssistDlg *pDlg=(CRoAssistDlg*)lParam;
    unsigned int sendnum=0;
    CString strsn;
    BOOL KeepRunning=true;
    while(KeepRunning)
    {
        if((pDlg->m_autoattack) && (pDlg->m_hSocket!=NULL))
        {
            sendnum++;
            strsn.Format("%d",sendnum);
            pDlg->GetDlgItem(IDC_STATIC_PACKNUM)->SetWindowText(strsn);
            pDlg->m_hSocket->SendData(pDlg->m_2lianbuf,25);
        }

        int Result=::WaitForSingleObject(ThreadEnd.m_hObject,0);
        if (Result==WAIT_OBJECT_0)
        {
            KeepRunning=false;
        }else{
            Sleep(pDlg->m_sleepTime);
        }
    }
//    ThreadOver.SetEvent();
    return 0;
}

UINT RecvPackageThread(LPVOID lParam)
{
    HWND mainwnd=::AfxGetMainWnd()->GetSafeHwnd();
    SOCKET sock=(SOCKET)lParam;
    BOOL KeepRunning=true;
    char buf[2][2048];
    int bufindex=0;
    int recvlen;
    while(KeepRunning)
    {
        if((recvlen=recv(sock,buf[bufindex],2048,MSG_PEEK))>0)
        {
            if(memcmp(buf[bufindex],buf[1-bufindex],recvlen)!=0)
            {
                COPYDATASTRUCT cds;
                cds.dwData=0;
                cds.cbData=recvlen+4;
                cds.lpData=new char[recvlen+4];
                *(int*)cds.lpData=3;
                memcpy(((char*)cds.lpData)+4,buf[bufindex],recvlen);
                SendMessage((HWND)mainwnd,WM_COPYDATA,(WPARAM)NULL,(LPARAM)&cds);
                delete cds.lpData;
                cds.lpData=NULL;
                bufindex=1-bufindex;
            }
        }
        Sleep(1);
    }
    return 0;
}

class CAboutDlg : public CDialog
{
public:
    CAboutDlg();

// Dialog Data
    //{{AFX_DATA(CAboutDlg)
    enum { IDD = IDD_ABOUTBOX };
    //}}AFX_DATA

    // ClassWizard generated virtual function overrides
    //{{AFX_VIRTUAL(CAboutDlg)
    protected:
    virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
    //}}AFX_VIRTUAL

// Implementation
protected:
    //{{AFX_MSG(CAboutDlg)
    //}}AFX_MSG
    DECLARE_MESSAGE_MAP()
};

CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
    //{{AFX_DATA_INIT(CAboutDlg)
    //}}AFX_DATA_INIT
}

void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
    CDialog::DoDataExchange(pDX);
    //{{AFX_DATA_MAP(CAboutDlg)
    //}}AFX_DATA_MAP                             QQ244479979 可以问我 收费的哈
2010-05-14 16:23
快速回复:求一段用c#编写的翻牌游戏的代码
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.023971 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved