forked from chrisguo/beijing_fushengji
-
Notifications
You must be signed in to change notification settings - Fork 1
/
StoryDlg.cpp
executable file
·151 lines (128 loc) · 3.34 KB
/
StoryDlg.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
// StoryDlg.cpp : implementation file
//
#include "stdafx.h"
#include "duallistdemo.h"
#include "StoryDlg.h"
#include <io.h>
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CStoryDlg dialog
CStoryDlg::CStoryDlg(CWnd* pParent,int id /*=NULL*/)
: CDialog(CStoryDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CStoryDlg)
// NOTE: the ClassWizard will add member initialization here
Act=id;
//}}AFX_DATA_INIT
}
void CStoryDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CStoryDlg)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CStoryDlg, CDialog)
//{{AFX_MSG_MAP(CStoryDlg)
ON_WM_TIMER()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CStoryDlg message handlers
BOOL CStoryDlg::OnInitDialog()
{
CDialog::OnInitDialog();
GetDlgItem(IDOK)->EnableWindow(FALSE);
if(Act==0)
SetTimer(1,330,NULL);
// TODO: Add extra initialization here
if(Act==1)
{
GetDlgItem(IDOK)->SetWindowText("继续游戏");
GetDlgItem(IDOK)->EnableWindow(TRUE);
}
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CStoryDlg::ProcessHelpFile()
{
GetDlgItem(IDC_INIT_MSG)->SetWindowText("初始化帮助信息....");
CString str=AfxGetApp()->m_pszHelpFilePath;
int n=str.ReverseFind('\\');
CString str1=str.Left(n);
CString m_strHelpFile=str1;
str1+="\\helpinfo";
FILE *fp=fopen(str1,"rb");
if(!fp){
AfxMessageBox(str1);
exit(-1);
}
CString tmp;
tmp.Format("help.html");
m_strHelpFile+="\\";
m_strHelpFile+=tmp;
FILE *fp1=fopen(m_strHelpFile,"wb");
int i;
if(fp!=NULL){
char *buf;
buf=(char *)malloc(_filelength(_fileno(fp)));
fread(buf,_filelength(_fileno(fp)),1,fp);
for(i=0;i<_filelength(_fileno(fp));i++)
buf[i]=buf[i] ^ 0x52;
fwrite(buf,_filelength(_fileno(fp)),1,fp1);
free(buf);
fclose(fp);
fclose(fp1);
}
GetDlgItem(IDC_INIT_MSG)->SetWindowText("游戏初始化完毕,准备进入北京...");
}
void CStoryDlg::InitUser()
{
int i,j,k;
CString msg;
GetDlgItem(IDC_INIT_MSG)->SetWindowText("初始化黑市信息....");
for(i=0;i<10;i++)
for(j=0;j<10;j++)
for(k=0;k<1000;k++){
//msg.Format("%d",k);
//GetDlgItem(IDC_INIT_MSG)->SetWindowText(msg);
}
GetDlgItem(IDC_INIT_MSG)->SetWindowText("初始化二环路信息....");
AfxMessageBox("ok");
}
void CStoryDlg::OnTimer(UINT nIDEvent)
{
// TODO: Add your message handler code here and/or call default
CString Msg[5]={
"初始化黑客信息....",
"初始化二环路信息.....",
"初始化黑市物品......",
"初始化随机事件......",
"加载北京实时新闻...."
};
CString Rest[5]={
"喝汽水",
"吃街头烤红薯",
"小睡一觉",
"洗脸",
"买车票"
};
static int j=0;
if(j>=5){
if(Act==0)
ProcessHelpFile();
GetDlgItem(IDOK)->EnableWindow(TRUE);
KillTimer(1+Act);
}
else{
if(Act==0) {
GetDlgItem(IDC_INIT_MSG)->SetWindowText(Msg[j]);
GetDlgItem(IDOK)->EnableWindow(FALSE);
}
j++;
CDialog::OnTimer(nIDEvent);}
}