?? head.cpp
字號:
#include"head.h"
#include<iostream>//輸入輸出流
#include"CRole.h"
#include"Color.h"
using namespace std;
color c;
CRole k;
extern mygame call;//調用已經聲明的對象
mygame::mygame()
{
wupin1="強化烏龍劍 ";//物品
wupin2=" ";
wupin3=" ";
wupin4=" ";
wupin5=" ";
zhuangtai=0;
}
mygame::~mygame()
{
}
void mygame::image(char a[],int b)//提示玩家輸入信息(單個輸出)
{
for(int i=0;i<b;i++)
{
cout<<a[i];
Sleep(10);
}
}
void mygame::user()//用戶名及密碼輸入
{
c.anlvse();
cout<<"歡迎來到游戲世界!"<<endl;
cout<<"你的用戶名為:lilinjie"<<endl;
cout<<"你的密碼為:123456\n"<<endl;
comein=1;
while(comein){
c.baise();
call.image("請輸入用戶名:",14);
c.qingse();
cin>>inName;//接收用戶輸入的用戶名
char name[]="lilinjie";
int OK1 = strcmp(inName,name);//判斷輸入的用戶名和服務器上的是否一樣
if(OK1==0)//如果用戶名正確
{
c.anhuangse();
cout<<"用戶名輸入正確\n"<<endl;
c.baise();
A: call.image("請輸入密碼:",12);
char code[] = "123456";
c.qingse();
cin>>inCode;//接收密碼
int OK2 = strcmp(inCode,code);//判斷輸入的密碼和服務器上的是否一樣
if(OK2==0)//如果密碼正確
{
c.anhuangse();
cout<<"密碼輸入正確\n"<<endl;
comein=0;
}else
{
c.Hongse();
cout<<"密碼輸入錯誤,請重新輸入!\n"<<endl;
goto A;
}
}else
{
c.Hongse();
cout<<"用戶名輸入錯誤,請重新輸入!\n"<<endl;;
}
}
}
void mygame::jiaose()//角色
{
c.lvse();
cout<<"進入游戲前需要創建你的人物昵稱,天性選擇,性別選擇。"<<endl;
cout<<"\n"<<endl;
c.anbaise();
call.image("請輸入你想創建的昵稱(中英文均可):",36);
c.qingse();//昵稱顏色
cin>>inNickName;
cout<<"\n"<<endl;
c.huangse();
cout<<"人物昵稱";
c.qingse();
cout<<" 【"<<inNickName<<"】 ";
c.huangse();
cout<<"創建成功\n"<<endl;
strcpy(k.player,inNickName);
comein=1;
while(comein){
c.Hongse();
cout<<"請選擇你的天性:\n"<<endl;
c.anbaise();
cout<<"1:陰險奸詐"<<" 2:光明磊落"<<" 3:狡猾多變"<<" 4:心狠手辣"<<" 5:無惡不做\n"<<endl;
cin>>M;
switch(M[0])
{
c.baise();
case '1':
cout<<" 陰險奸詐的 ";
c.huangse();
cout<<"【"<<inNickName<<"】~!.\n"<<endl;
comein=0;
break;
case '2':
cout<<" 光明磊落的 ";
c.qingse();
cout<<"【"<<inNickName<<"】~~.\n"<<endl;
comein=0;
break;
case '3':
cout<<" 狡猾多變的 ";
c.huangse();
cout<<"【"<<inNickName<<"】~~.\n"<<endl;
comein=0;
break;
case '4':
cout<<" 心狠手辣的 ";
c.huangse();
cout<<"【"<<inNickName<<"】!!.\n"<<endl;
comein=0;
break;
case '5':
cout<<" 無惡不做的 ";
c.huangse();
cout<<"【"<<inNickName<<"】!!.\n"<<endl;
comein=0;
break;
c.Hongse();
default:cout<<"錯誤!\n"<<endl;
}
}
comein=1;
while(comein){
c.Hongse();
cout<<"選擇你要扮演的角色性別:男";
c.huangse();
cout<<"(g)";
c.Hongse();
cout<<"女";
c.huangse();
cout<<"(m)."<<endl;
cin>>M;
c.baise();
if(M[1]==NULL){
switch(M[0])
{
case 'g':
cout<<"性別:男\n"<<endl;
comein=0;
break;
case 'm' :
cout<<"性別:女\n"<<endl;
comein=0;
break;
default:cout<<"現在沒有太監的分類~~!\n"<<endl;
}
}else
{
cout<<"現在還沒有太監的分類~~!\n"<<endl;
}
}
c.baise();
c.huangse();
call.image(" 昵稱:",6);
cout<<inNickName;
if(nature[0]=='1')
call.image(" 天性:陰險奸詐",17);
if(nature[0]=='2')
call.image(" 天性:光明磊落",17);
if(nature[0]=='3')
call.image(" 天性:狡猾多變",17);
if(nature[0]=='4')
call.image(" 天性:心狠手辣",17);
if(nature[0]=='5')
call.image(" 天性:無惡不做",17);
if(M[0]=='g')
call.image(" 性別: 男",15);
if(M[0]=='m')
call.image(" 性別: 女",13);
cout<<"\n"<<endl;
c.baise();
cout<<"==============================================="<<endl;
call.zhuangtai=1000;
k.shuxing();
}
void mygame::wenben( )//游戲介紹
{
FILE *p;//文本指針
char w;//接 入字符串
p=fopen(".\\world.ini","r");//r是讀字符串
if(p==NULL)
{
cout << "閱讀文件出錯"<<endl;
}
while(true)
{
w=fgetc(p);//得到文本里面的字符串給w;
if(w!=EOF)//如果得到的字符不結束。。。。。
{
c.qingse();
cout<<w;
Sleep(5);//文字顯示速度
}else
{
cout<<"\n"<<endl;
break;
}
}
}
void mygame::shuoming()//菜單
{
c.huangse();
cout<<" ***************";
c.Hongse();
cout<<" 歡迎";
c.qingse();
cout<<" 【"<<inNickName<<"】 ";
c.Hongse();
cout<<"進入游戲世界!";
c.huangse();
cout<<" ***************"<<"\n";
c.qingse();
cout<<"【"<<inNickName<<"】 ";
c.lvse();
cout<<"你好:"<<endl;;
call.image(" 歡迎來到游戲.",16);
cout<<"\n"<<endl;
c.qingse();
call.image(" 你現在的位置是",16);
c.anHongse();
cout<<"新手村";
c.qingse();
call.image("肩負著改變人類命運的使命!",26);
cout<<endl;
call.image(" 提升自己的法力!消滅魔族,挽救世界!!",38);
cout<<""<<endl;
cout<<" --------算是挽救世界吧~~~!真不知道該寫什么好~!---------"<<endl;
call.image(" 招數道行可以在蓬萊(烏龍)大理(鐵鷹)祝融地(無慮) 學會。",58);
cout<<""<<endl;
call.image(" 法術道行可以在蓬萊(無憂)大理(無歡)祝融地(寇神官) 學會。",64);
cout<<"\n"<<endl;
cout<<" 新手村";
call.image("有七條路分別通往",16);
c.huangse();
call.image(": 蓬萊 大理 帝王陵 死亡金山 占卜圣地 祝融地 勇士之谷",52);
cout<<"\n"<<endl;
c.qingse();
call.image(" 每條路上都有可能出現怪物,并有生命危險!",42);
cout<<"\n"<<endl;
}
void mygame::caidan(){
B: c.Lanse();
cout<<"菜單選擇";cout<<"\n"<<endl;
c.anzise();
cout<<" ◆◆◆◆◆◆◆◆◆"<<"\n"<<endl;
c.huangse();
cout<<" s: ";
c.Hongse();
cout<<"開始游戲";cout<<"\n"<<endl;
c.huangse();
cout<<" h: ";
c.Hongse();
cout<<"游戲幫助";cout<<"\n"<<endl;
c.huangse();
cout<<" k: ";
c.Hongse();
cout<<"物品查看";cout<<"\n"<<endl;
c.huangse();
cout<<" m: ";
c.Hongse();
cout<<"查看地圖";cout<<"\n"<<endl;
c.huangse();
cout<<" b: ";
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -