public void FuncionMovimiento() { Vector3 mousePosition = Input.mousePosition; // Analiza la posicion del cursor mouseX += Input.GetAxis("Mouse X"); // Actualiza los valores de mouseX transform.eulerAngles = new Vector3(0, mouseX, 0); // Actualiza la rotacion horizontal datosHeroe = GameObject.Find("Heroe").GetComponent <MyHero>().datosHeroe; if (Input.GetKey(KeyCode.W)) // Condicion para moverse hacia adelante con la tecla W { transform.position += transform.forward * (datosHeroe.velHeroe) * Time.deltaTime; // Transforma la posicion hacia el frente } if (Input.GetKey(KeyCode.S)) // Condicion para moverse hacia atras con la tecla S { transform.position -= transform.forward * (datosHeroe.velHeroe) * Time.deltaTime; // Transforma la posicion hacia atras } if (Input.GetKey(KeyCode.A)) // Condicion para moverse hacia la izquierda con la tecla A { transform.position -= transform.right * (datosHeroe.velHeroe) * Time.deltaTime; // Transforma la posicion hacia la izquierda } if (Input.GetKey(KeyCode.D)) // Condicion para moverse hacia la derecha con la tecla D { transform.position += transform.right * (datosHeroe.velHeroe) * Time.deltaTime; // Transforma la posicion hacia la derecha } }
private static object Decode(Type type, string raw, GameStruct instance) { var parser = new LLParser(instance.GetParserSense(), raw); var description = GeometryDashApi.GetStructMemberCache(type); Span <char> next = null; var position = -1; while ((next = parser.Next()) != null) { position++; var value = next.ToString(); if (!description.Members.TryGetValue(position, out var member)) { throw new Exception($"Can't find member for position: {position}"); } if (member.ArraySeparatorAttribute != null) { member.SetValue(instance, ArrayParser.Decode(member.MemberType, member.ArraySeparatorAttribute.Separator, value)); continue; } member.SetValue(instance, GeometryDashApi.GetStringParser(member.MemberType)(value)); } return(instance); }
public void AddRegionInfo(GameStruct.MapRegionInfo info) { if (mListRegionInfo == null) { mListRegionInfo = new List<GameStruct.MapRegionInfo>(); } mListRegionInfo.Add(info); }
public GameMap(GameStruct.MapInfo mapinfo) { mListRegionInfo = null; info = mapinfo; mDicObject = new Dictionary<uint, BaseObject>(); mListDeleteObj = new List<BaseObject>(); mListAddObj = new List<BaseObject>(); last_null_tick = System.Environment.TickCount; }
//添加掉落道具信息 public void AddDropItemObj(uint itemid,short x,short y,uint ownerid = 0,int time = 120000,GameStruct.RoleItemInfo info = null,RoleData_Eudemon eudemon = null) { DropItemObject obj = new DropItemObject(itemid, x, y,ownerid, time); obj.SetRoleItemInfo(info); obj.SetRoleEudemonInfo(eudemon); AddObject(obj); obj.RefreshVisibleObject(); //广播给玩家 obj.BroadcastInfo(); }
private void OnCollisionEnter(Collision collision) { if (collision.transform.name == "Aldeano") { contactoAldeano = true; datosAldeano = collision.gameObject.GetComponent <MyVillager>().datosAldeano; } if (collision.transform.name == "Zombie") { contactoZombi = true; datosZombie = collision.gameObject.GetComponent <MyZombie>().datosZombie; // Esto va en el colision de cada zombie o aldeano } }
IEnumerator ComportamientoZombie(GameStruct gameStruct) { while (true) { gameStruct.estadoZombi = (GameStruct.estadosZombi)Random.Range(0, 2); switch (gameStruct.estadoZombi) { case GameStruct.estadosZombi.Idle: seMueve = false; break; case GameStruct.estadosZombi.Moving: seMueve = true; break; } yield return(new WaitForSeconds(5.0f)); } }
protected override void ProcessAction_Move(GameStruct.Action act) { byte runvalue = 1; if (act.GetObjectCount() > 0) { runvalue = (byte)act.GetObject(0); } RefreshVisibleObject(); if (mVisibleList.Count > 0) { foreach (RefreshObject obj in mVisibleList.Values) { BaseObject o = obj.obj; switch (o.type) { case OBJECTTYPE.NPC: { if (obj.bRefreshTag) break; this.SendNpcInfo(o); obj.bRefreshTag = true; break; } case OBJECTTYPE.MONSTER: case OBJECTTYPE.CALLOBJECT: { if (obj.bRefreshTag) break; this.SendMonsterInfo(o); obj.bRefreshTag = true; break; } case OBJECTTYPE.PLAYER: { this.SendRoleMoveInfo(o, runvalue, obj); break; } case OBJECTTYPE.DROPITEM: { if (obj.bRefreshTag) break; this.SendDropItemInfo(o); obj.bRefreshTag = true; break; } case OBJECTTYPE.EUDEMON: { if (obj.bRefreshTag) break; (o as EudemonObject).SendEudemonInfo(this); obj.bRefreshTag = true; break; } case OBJECTTYPE.ROBOT: { if (obj.bRefreshTag) break; (o as RobotObject).SendRobotInfo(this); obj.bRefreshTag = true; break; } case OBJECTTYPE.GUARDKNIGHT: { if (obj.bRefreshTag) break; (o as GuardKnightObject).SendInfo(this); obj.bRefreshTag = true; break; } case OBJECTTYPE.EFFECT: { if (obj.bRefreshTag) break; (o as EffectObject).SendInfo(this); obj.bRefreshTag = true; break; } case OBJECTTYPE.PTICH: //摊位 { if (obj.bRefreshTag) break; (o as PtichObject).SendInfo(this); obj.bRefreshTag = true; break; } } //加入到对方视野中- o.AddVisibleObject(this); } // mRefreshList.Clear(); } }
internal static string Encode(Type type, GameStruct value) { throw new NotImplementedException(); }
public void AddAttribute(GameStruct.EudemonAttribute attr, int value) { list_item.Add(attr); list_value.Add(value); }
protected override void ProcessAction_Die(GameStruct.Action act) { base.ProcessAction_Die(act); mPlay.GetTimerSystem().DeleteStatus(GameStruct.RoleStatus.STATUS_WANGNIANWULING); }
//设置官爵等级 public void SetGuanJue(GameStruct.GUANGJUELEVEL info) { mGuanJue = info; }
//创建怪物 public void CreateMonster(GameStruct.GeneratorInfo info) { GameStruct.MonsterInfo minfo = ConfigManager.Instance().GetMonsterInfo(info.monsterid); if (minfo == null) { Log.Instance().WriteLog("无法找到怪物id:" + info.monsterid.ToString()); return; } MonsterObject obj ; Random rd = new Random(); for (int i = 0; i < info.amount; i++) { short cx = 0; short cy = 0; byte index = 0; while (true) { cx = (short)rd.Next((int)info.bound_x, (int)(info.bound_x + info.bound_cx)); cy = (short)rd.Next((int)info.bound_y, (int)(info.bound_y + info.bound_cy)); if (CanMove(cx, cy)) { break; } index++; if (index >= 100) { cx = cy = 0; break; } } if (cx == 0 && cy == 0) { Log.Instance().WriteLog("创建怪物失败,无法找到落脚点" + this.GetMapInfo().name + "怪物名称:" + minfo.name + "地图id:"+ info.mapid.ToString()+" x:"+info.bound_x.ToString()+" y:"+info.bound_y.ToString()); return; } obj = new MonsterObject(minfo.id, minfo.ai,cx,cy,true); if (info.dir == DIR.MAX_DIRSIZE) { obj.SetDir(GameStruct.DIR.Random_Dir()); } else { obj.SetDir(info.dir); } obj.SetRebirthTime(info.time); AddObject(obj); } }
public uint ScriptId; //脚本id #endregion Fields #region Constructors public NpcObject(GameStruct.NPCInfo info) { type = OBJECTTYPE.NPC; mInfo = info; }
//死亡 protected override void ProcessAction_Die(GameStruct.Action act) { this.GetAttr().life = 0; mInfo.bDie = true; //if (this.GetState() == EUDEMONSTATE.BATTLE) { NetMsg.MsgEudemonInfo msg = new NetMsg.MsgEudemonInfo(); msg.id = this.GetTypeId(); msg.AddAttribute(EudemonAttribute.Life, 0); play.SendData(msg.GetBuffer(), true); // 收到网络协议:长度:24协议号:2037 // byte[] data = {24,0,245,7,1,0,0,0,252,159,138,131,1,0,0,0,83,0,0,0,45,0,0,0}; PacketOut outpack = new PacketOut(); outpack.WriteUInt16(24); outpack.WriteUInt16(2037); outpack.WriteUInt32(1); outpack.WriteUInt32(this.GetTypeId()); outpack.WriteInt32(1); outpack.WriteInt32(83); outpack.WriteInt32(45); play.SendData(outpack.Flush(), true); //收到网络协议:长度:20协议号:1017 //{20,0,249,3,252,159,138,131,1,0,0,0,35,0,0,0,45,0,0,0} outpack = new PacketOut(); outpack.WriteInt16(20); outpack.WriteInt16(1017); outpack.WriteUInt32(this.GetTypeId()); outpack.WriteInt32(1); outpack.WriteInt32(35); outpack.WriteInt32(45); play.SendData(outpack.Flush(), true); //收到网络协议:长度:24协议号:2037 //{24,0,245,7,1,0,0,0,252,159,138,131,1,0,0,0,8,0,0,0,149,0,0,0} outpack = new PacketOut(); outpack.WriteUInt16(24); outpack.WriteUInt16(2037); outpack.WriteUInt32(1); outpack.WriteUInt32(this.GetTypeId()); outpack.WriteInt32(1); outpack.WriteInt32(8); outpack.WriteInt32(149); play.SendData(outpack.Flush(), true); } //else if (this.GetState() == EUDEMONSTATE.FIT) { //解体 play.GetEudemonSystem().Eudemon_BreakUp(this.GetTypeId()); //再召回 play.GetEudemonSystem().Eudemon_Battle(this.GetTypeId()); } if (this.GetState() == EUDEMONSTATE.BATTLE) { //广播 this.SendEudemonInfo(); } }
public void SetMosterInfo(GameStruct.MonsterInfo info) { mMonsterInfo = info; }
private bool SWITCH(GameStruct.ActionInfo info, PlayerObject play) { bool ret = true; switch (info.type) { case ActionID.ACTION_MENU_TEXT: { Action_MenuText(info, play); mbEndTag = true; //要发送npc结尾标记,显示npc对话框 break; } case ActionID.ACTION_MENU_LINK: { Action_MenuLink(info, play); mnSelectIndex++; break; } case ActionID.ACTION_MENU_EDIT: { Action_MenuEdit(info, play); break; } case ActionID.ACTION_MENU_PIC: { Action_MenuImage(info, play); break; } case ActionID.ACTION_MESSAGEBOX: { Action_MessageBox(info, play); break; } case ActionID.ACTION_MAP_ENTERMAP: { Action_Map_EnterMap(info, play); break; } case ActionID.ACTION_MAP_RANDOM: { Action_Map_Random(info, play); break; } case ActionID.ACTION_MAP_RECALL: { Action_Map_ReCall(info, play); break; } case ActionID.ACTION_MAP_CHANGE: { Action_Map_Change(info, play); break; } case ActionID.ACTION_ITEM_ADD: { Action_Item_Add(info, play); break; } case ActionID.ACTION_ITEM_DELETE: { Action_Item_Delete(info, play); break; } case ActionID.ACTION_ITEM_DELETE_NAME: { ret = Action_Item_Delete_Name(info, play); break; } case ActionID.ACTION_ITEM_DELETE_ITEMID: { ret = Action_Item_Delete_ItemID(info, play); break; } case ActionID.ACTION_ITEM_LEVEL: { ret = Action_Item_Level(info, play); break; } case ActionID.ACTION_EQUIP_OPERATION: { ret = Action_Equip_Operation(info, play); break; } case ActionID.ACTION_CHECK_BAG_SIZE: { ret = Action_Check_Bag_Size(info, play); break; } case ActionID.ACTION_CHECK_PROFESSION: { ret = Action_CheckProfession(info, play); break; } case ActionID.ACTION_CHECK_LEVEL: { ret = Action_CheckLevel(info, play); break; } case ActionID.ACTION_SET_ROLE_PRO: { Action_Set_Role_Pro(info, play); break; } case ActionID.ACTION_GET_ROLE_PRO: { ret = Action_Get_Role_Pro(info, play); break; } case ActionID.ACTION_ADDMAGIC: { Action_AddMagic(info, play); break; } case ActionID.ACTION_OPENDIALOG: { Action_OpenDialog(info, play); break; } case ActionID.ACTION_LEARNMAGIC: { Action_LearnMagic(info, play); break; } case ActionID.ACTION_CHECKMAGIC: { ret = Action_CheckMagic(info, play); break; } case ActionID.ACTION_LEFTNOTICE: { String str = Sprintf_string(info.param, play); play.LeftNotice(str); break; } case ActionID.ACTION_CHATNOTICE: { String str = Sprintf_string(info.param, play); play.ChatNotice(str); break; } case ActionID.ACTION_SCREENNOTICE: { String str = Sprintf_string(info.param, play); UserEngine.Instance().SceneNotice(str); break; } case ActionID.ACTION_MSGBOX: { String str = Sprintf_string(info.param, play); play.MsgBox(str); break; } case ActionID.ACTION_PITCH: { play.Ptich(); break; } case ActionID.ACTION_GETPAYGAMEGOLD: { PayManager.Instance().GetMoney(play); break; } case ActionID.ACTION_FUCK_NIAN: { Action_Fuck_Nian(info, play); break; } case ActionID.ACTION_EUDEMON_CREATE: { Action_Eudemon_Create(info, play); break; } case ActionID.ACTION_EUDEMON_CREATEEX: { Action_Eudemon_CreateEx(info, play); break; } case ActionID.ACTION_RECALL_EUDEMON: { Action_Recall_Eudemon(info, play); break; } case ActionID.ACTION_LEGION_CREATE: { ret = Action_Legion_Create(info, play); break; } case ActionID.ACTION_LEGION_CHANGE_TITLE: { Action_Legion_ChangeTitle(info, play); break; } case ActionID.ACTION_TIMEOUT_CREATE: { ret = Action_TimeOut_Create(info, play); break; } case ActionID.ACTION_TIMEOUT_CHECK: { ret = Action_TimeOut_Check(info, play); break; } case ActionID.ACTION_TIMEOUT_DELETE: { Action_TimeOut_Delete(info, play); break; } case ActionID.ACTION_MAGIC_OPERATION: { ret = Action_Magic_Operation(info, play); break; } case ActionID.ACTION_RANDOM_INIT: { Action_Random_Init(info, play); break; } case ActionID.ACTION_RANDOM_COMPARE: { ret = Action_Random_Compare(info, play); break; } case ActionID.ACTION_GET_EUDEMON_PRO: { ret = Action_Get_Eudemon_Pro(info, play); break; } case ActionID.ACTION_SET_EUDEMON_PRO: { Action_Set_Eudemon_Pro(info, play); break; } case ActionID.ACTION_FUBEN_CREATE: { ret = Action_Fuben_Create(info, play); break; } } return ret; }
protected override void ProcessAction_Die(GameStruct.Action act) { //变为幽灵 //TransformGhost(); //死亡标记 BaseObject obj = act.GetObject(0) as BaseObject; NetMsg.MsgMonsterDieInfo die = new NetMsg.MsgMonsterDieInfo(); die.monsterid = this.GetTypeId(); die.roleid = obj.GetTypeId(); die.role_x = this.GetCurrentX(); die.role_y = this.GetCurrentY(); die.tag = 14; this.BroadcastBuffer(die.GetBuffer(), true); m_bGhost = true; mnGhostTick = System.Environment.TickCount; //死亡之后自动攻击目标为Null this.GetFightSystem().SetAutoAttackTarget(null); this.GetPKSystem().Die(obj); //亡念巫灵原地复活//要在删除状态之前调用该代码 if (this.GetTimerSystem().QueryStatus(GameStruct.RoleStatus.STATUS_WANGNIANWULING) != null) { this.Alive(true); } //移除一些死亡后的状态 this.GetTimerSystem().Die_DeleteState(); //死亡后幻兽也要召回 this.GetEudemonSystem().Eudemon_ReCallAll(); //死亡后骑乘幻兽中就下马 if (this.GetMountID() > 0) { this.TakeOffMount(0); } this.GetTimerSystem().AddStatus(GameStruct.RoleStatus.STATUS_DIE); }
//更改角色基本属性 public void ChangeAttribute(GameStruct.UserAttribute type, int value, bool isBrocat = true) { if (this.GetGameSession() == null) return; int v = value; switch (type) { case GameStruct.UserAttribute.GOLD: { if (this.GetBaseAttr().gold + value> GameBase.Config.Define.MAX_GOLD) //最高三十亿 { this.MsgBox("少年,别再刷了,最高二十亿金币!"); this.GetBaseAttr().gold = GameBase.Config.Define.MAX_GOLD; }else { this.GetBaseAttr().gold += value; } if (this.GetBaseAttr().gold < 0) { this.GetBaseAttr().gold = 0; } v = (int)this.GetBaseAttr().gold; // if (v > PlayerItem.MAX_GOLD) this.GetBaseAttr().gold = PlayerItem.MAX_GOLD; break; } case GameStruct.UserAttribute.GAMEGOLD: { if (this.GetBaseAttr().gold + value > GameBase.Config.Define.MAX_GAMEGOLD) //最高三十亿 { this.GetBaseAttr().gamegold = GameBase.Config.Define.MAX_GAMEGOLD; this.MsgBox("少年,别再刷了,最高二十亿魔石!"); } else { this.GetBaseAttr().gamegold += value; } if (this.GetBaseAttr().gamegold < 0) { this.GetBaseAttr().gamegold = 0; } v = this.GetBaseAttr().gamegold; break; } case GameStruct.UserAttribute.LEVEL: { this.GetBaseAttr().level += (byte)value; v = GetBaseAttr().level; //重新计算属性 this.CalcAttribute(); this.GetBaseAttr().life = this.GetBaseAttr().life_max; this.GetBaseAttr().mana = this.GetBaseAttr().mana_max; //升级特效 PacketOut outpack = new PacketOut(); outpack.WriteInt16(28); outpack.WriteInt16(1010); outpack.WriteInt32(System.Environment.TickCount); outpack.WriteUInt32(this.GetTypeId()); outpack.WriteInt32(0); outpack.WriteInt32(0); outpack.WriteInt32(1); outpack.WriteInt32(9550); this.BroadcastBuffer(outpack.Flush(), true); break; } case GameStruct.UserAttribute.EXP: { this.GetBaseAttr().exp += value; v = (int)this.GetBaseAttr().exp; //发送公告 // this.LeftNotice(string.Format(StringDefine.KILLEXP,value.ToString())); break; } case GameStruct.UserAttribute.LIFE: { v = (int)GetBaseAttr().life + value; if (v < 0) v = 0; GetBaseAttr().life = (uint)v; if (v > GetBaseAttr().life_max) GetBaseAttr().life = GetBaseAttr().life_max; //无敌状态 if (this.GetTimerSystem().QueryStatus(GameStruct.RoleStatus.STATUS_WUDI) != null) { GetBaseAttr().life = GetBaseAttr().life_max; } break; } case GameStruct.UserAttribute.LIFE_MAX: { GetBaseAttr().life_max = (uint)value; break; } case GameStruct.UserAttribute.MANA: { v = (int)GetBaseAttr().mana + value; if (v < 0) v = 0; GetBaseAttr().mana = (uint)v; break; } case GameStruct.UserAttribute.MANA_MAX: { GetBaseAttr().mana_max = (uint)value; break; } case GameStruct.UserAttribute.LOOKFACE: { // pPlayer->SetFace((m_pInfo->aUserAttrib[i].dwAttributeData/10000)%1000); // pPlayer->SetSex((m_pInfo->aUserAttrib[i].dwAttributeData / 1000) % 10); //pPlayer->Transform(m_pInfo->aUserAttrib[i].dwAttributeData / 10000000); //如果是鬼魂状态不写到数据库 if (!IsGhost()) { this.GetBaseAttr().lookface = (uint)value; } v = value; break; } case GameStruct.UserAttribute.HAIR: { this.GetBaseAttr().hair = (uint)value; v = value; break; } case GameStruct.UserAttribute.STATUS: { v = value; break; } case GameStruct.UserAttribute.SP: { this.GetBaseAttr().sp += value; v = this.GetBaseAttr().sp; break; } case GameStruct.UserAttribute.PK: { //防止溢出 if (this.GetBaseAttr().pk + value >= 30000) { this.GetBaseAttr().pk = 30000; } else { this.GetBaseAttr().pk += (short)value; } if (this.GetBaseAttr().pk < 0) this.GetBaseAttr().pk = 0; this.GetPKSystem().ResetPKNameType(); break; } case GameStruct.UserAttribute.MAXEUDEMON: { this.GetBaseAttr().maxeudemon += (byte)value; v = this.GetBaseAttr().maxeudemon; break; } } NetMsg.MsgUserAttribute msg = new NetMsg.MsgUserAttribute(); msg.role_id = this.GetTypeId(); if (isBrocat) { msg.Create(null, null); } msg.AddAttribute(type, (uint)v); if (type == GameStruct.UserAttribute.LEVEL) { msg.AddAttribute(UserAttribute.LIFE_MAX, this.GetBaseAttr().life_max); msg.AddAttribute(UserAttribute.LIFE, this.GetBaseAttr().life); if (this.GetBaseAttr().mana_max > 0) { msg.AddAttribute(UserAttribute.MANA_MAX, this.GetBaseAttr().mana_max); msg.AddAttribute(UserAttribute.MANA, this.GetBaseAttr().mana); } } //是否广播 if (isBrocat) { this.BroadcastBuffer(msg.GetBuffer(), true); } else { this.SendData(msg.GetBuffer(), true); } }
protected virtual void ProcessAction_Injured(GameStruct.Action act) { }
protected override void ProcessAction_Injured(GameStruct.Action act) { //base.ProcessAction_Injured(act); }
protected virtual void ProcessAction_Move(GameStruct.Action act) { }
protected override void ProcessAction_Move(GameStruct.Action act) { byte runvalue = 1; if (act.GetObjectCount() > 0) { runvalue = (byte)act.GetObject(0); } //取现有列表- 不在范围内的就通知客户端了 foreach (RefreshObject refobj in this.GetVisibleList().Values) { BaseObject obj = refobj.obj; if (obj.type == OBJECTTYPE.PLAYER) { // Console.WriteLine("距离:x"+Math.Abs(this.GetCurrentX() - obj.GetCurrentX()).ToString()+" y:"+Math.Abs(this.GetCurrentY() - obj.GetCurrentY()).ToString()); if (!obj.GetPoint().CheckVisualDistance(this.GetCurrentX(), this.GetCurrentY(), GameBase.Config.Define.MAX_EUDEMON_OTHER_PLAY_DISTANCE)) { NetMsg.MsgClearObjectInfo info = new NetMsg.MsgClearObjectInfo(); info.id = this.GetTypeId(); (obj as PlayerObject).SendData(info.GetBuffer(),true); obj.GetVisibleList().Remove(this.GetGameID()); } } } this.RefreshVisibleObject(); foreach(RefreshObject refobj in this.GetVisibleList().Values) { BaseObject obj = refobj.obj; if (obj.type == OBJECTTYPE.PLAYER) { if (!obj.GetVisibleList().ContainsKey(this.GetGameID())) { obj.AddVisibleObject(this, true); this.SendEudemonInfo(); } //if (this.GetVisibleList().ContainsKey(obj.GetGameID())) //{ // this.AddVisibleObject(obj, true); // this.SendEudemonInfo(); //} } } NetMsg.MsgMoveInfo move = new NetMsg.MsgMoveInfo(); move.id = this.GetTypeId(); move.x = this.GetCurrentX(); move.y = this.GetCurrentY(); move.dir = this.GetDir(); move.ucMode = runvalue; this.BrocatBuffer(move.GetBuffer()); //if (mRefreshList.Count > 0) //{ // foreach (BaseObject o in mRefreshList.Values) // { // switch (o.type) // { // case OBJECTTYPE.PLAYER: // { // // if (o.GetGameID() == play.GetGameID()) continue; // this.SendMoveInfo(o, runvalue); // break; // } // } // } // mRefreshList.Clear(); //} }
public void SetRoleItemInfo(GameStruct.RoleItemInfo info) { mItemInfo = info; }
//更改幻兽属性 //type 属性 //value 值 //isBrocat 是否广播 public void ChangeAttribute(GameStruct.EudemonAttribute type, int value, bool isBrocat = true) { RoleData_Eudemon eudemon_info = play.GetEudemonSystem().FindEudemon(this.GetTypeId()); if (eudemon_info == null) return; int v = value; switch (type) { case GameStruct.EudemonAttribute.Level: { eudemon_info.level += (short)value; this.SetEudemonInfo(eudemon_info); // this.GetAttr().level += (short)value; this.CalcAttribute(); //升级特效 PacketOut outpack = new PacketOut(); outpack.WriteInt16(28); outpack.WriteInt16(1010); outpack.WriteInt32(System.Environment.TickCount); outpack.WriteUInt32(this.GetTypeId()); outpack.WriteInt32(0); outpack.WriteInt32(0); outpack.WriteInt32(1); outpack.WriteInt32(9550); this.BrocatBuffer(outpack.Flush()); v = this.GetAttr().level; break; } } NetMsg.MsgEudemonInfo msg = new NetMsg.MsgEudemonInfo(); msg.id = this.GetTypeId(); msg.AddAttribute(type, v); if (isBrocat) { this.BrocatBuffer(msg.GetBuffer()); } else { play.SendData(msg.GetBuffer(), true); } }
protected override void ProcessAction_Attack(GameStruct.Action act) { }
public void SetRobotInfo(GameStruct.RobotInfo _info) { mInfo = _info; this.SetPoint(mInfo.x, mInfo.y); }
public void SetCurrentNpcInfo(GameStruct.NPCInfo info) { mNpcInfo = info; }
public string MensajeZombi(GameStruct datosZombie) { string mensajeZombi = "Waaaarrrr quiero comer " + datosZombie.gustoZombi; return(mensajeZombi); }
//增加幻兽 public void AddEudemon(GameStruct.RoleItemInfo item, byte level = 1, int quality = 0,byte wuxing = 0) { //创建进化后的幻兽处理-- 因为幻兽进化配置表只配置了初始幻兽的id String sItemID = item.itemid.ToString(); uint nItemId = item.itemid; if (sItemID.Substring(sItemID.Length-1, 1) != "0") { sItemID = sItemID.Substring(0, sItemID.Length - 1) + "0"; nItemId = Convert.ToUInt32(sItemID); } GameStruct.EudemonInfo info = ConfigManager.Instance().GetEudemonInfo(nItemId); if (info == null) { Log.Instance().WriteLog("创建幻兽失败,不存在的幻兽id:" + item.id.ToString()); return; } if (mDicEudemon.ContainsKey(item.itemid)) { Log.Instance().WriteLog("创建幻兽失败,重复的幻兽id:" + item.id.ToString()); return; } GameStruct.ItemTypeInfo itembaseinfo = ConfigManager.Instance().GetItemTypeInfo(item.itemid); if (itembaseinfo == null) { Log.Instance().WriteLog("创建幻兽失败,找不到基础物品id:" + item.itemid.ToString()); return; } RoleData_Eudemon data = new RoleData_Eudemon(); data.id = 0; data.itemid = item.id; data.phyatk_grow_rate = IRandom.Random(0.5f, info.atk_grow_min); data.phyatk_grow_rate_max = IRandom.Random(info.atk_grow_min, info.atk_grow_max); data.magicatk_grow_rate = IRandom.Random(0.5f, info.magicatk_grow_min); data.magicatk_grow_rate_max = IRandom.Random(info.magicatk_grow_min, info.magicatk_grow_max); data.life_grow_rate = IRandom.Random(info.life_grow_min, info.life_grow_max); data.defense_grow_rate = IRandom.Random(info.defense_grow_min, info.defense_grow_max); data.magicdef_grow_rate = IRandom.Random(info.magicdef_grow_min, info.magicdef_grow_max); data.init_life = IRandom.Random(info.life_min, info.life_max); data.init_atk_min = IRandom.Random(info.atk_min_min, info.atk_min_max); data.init_atk_max = IRandom.Random(info.atk_max_min, info.atk_max_max); data.init_defense = IRandom.Random(info.defense_min, info.defense_max); data.init_magicdef = IRandom.Random(info.magicdef_min, info.magicdef_max); data.init_magicatk_min = IRandom.Random(info.magicatk_min_min, info.magicatk_min_max); data.init_magicatk_max = IRandom.Random(info.magicatk_max_min, info.magicatk_max_max); data.luck = IRandom.Random(1, 100); //幸运值 data.intimacy = 150; //亲密度 data.level = level; //等级 //data.card = IDManager.CreateEudemonCard(); //创建身份牌号码 data.card = 0; //身份牌是二次进化的时候才获得- data.exp = 0; data.quality = quality; //品质在第一次进化的时候才出现 if (wuxing == 0) { data.wuxing = IDManager.GetEudemonWuxing(); } else { data.wuxing = wuxing; } data.name = itembaseinfo.name; data.typeid = item.typeid; mDicEudemon[data.GetTypeID()] = data; EudemonObject obj = new EudemonObject(data, play); obj.CalcAttribute(); mListObj.Add(obj); SendEudemonInfo(data); }
public void AddHotKeyInfo(GameStruct.HotkeyInfo info) { mListHotKey.Add(info); }
static void con_OnReceiveCompleted(object sender, ReceiveCompletedEventArgs args) { string text = Encoding.Unicode.GetString(args.data); if (DEBUG) { Console.WriteLine(text); } IPEndPoint iep = (args.remoteSock.RemoteEndPoint as IPEndPoint); string clientAddr = iep.Address.ToString() + iep.Port; // list games if (text.StartsWith("0GL")) { foreach (var game in gameRooms) { con.sendBySpecificSocket(Encoding.Unicode.GetBytes("0GH_" + game.Value.name1 + ";" + game.Value.who), args.remoteSock); } } // host game else if (text.StartsWith("0GH_")) { string player1 = text.Substring(4); if (DEBUG) { Console.WriteLine(player1 + " has created a game"); } gameRooms.Add(nrOfGame, new GameStruct(player1, "", 0)); gamePointer.Add(player1, nrOfGame); /* register new game */ con.send(Encoding.Unicode.GetBytes("0GH_" + gameRooms[nrOfGame].name1 + ";" + gameRooms[nrOfGame].who)); nrOfGame++; } // join game else if (text.StartsWith("0GJ_")) { string[] player = text.Substring(4).Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); if (DEBUG) { Console.WriteLine(player[1] + " has joied " + player[0] + "'s game"); } UInt64 nrOfGame = gamePointer[player[0]]; gameRooms[nrOfGame] = new GameStruct(player[0], player[1], 1); gamePointer.Add(player[1], nrOfGame); //start game con.send(Encoding.Unicode.GetBytes("0GS_" + player[0] + ";" + 1)); con.send(Encoding.Unicode.GetBytes("0GJ_" + player[0] + ";" + player[1])); System.Threading.Thread.Sleep(1000); // first card gameRooms[gamePointer[player[0]]].GetCard(3); // players cards gameRooms[gamePointer[player[0]]].cardsToTake = 4; gameRooms[gamePointer[player[0]]].GetCard(1); gameRooms[gamePointer[player[0]]].cardsToTake = 4; gameRooms[gamePointer[player[0]]].GetCard(2); gameRooms[gamePointer[player[0]]].SendStatus(); } // exit game else if (text.StartsWith("0GE_")) { string player = text.Substring(4); if (DEBUG) { Console.WriteLine(player + " has closed the game"); } UInt64 nrOfGame = gamePointer[player]; con.send(Encoding.Unicode.GetBytes("0GE_" + gameRooms[nrOfGame].name1)); con.send(Encoding.Unicode.GetBytes("0GE_" + gameRooms[nrOfGame].name2)); gamePointer.Remove(gameRooms[nrOfGame].name1); gamePointer.Remove(gameRooms[nrOfGame].name2); gameRooms.Remove(nrOfGame); } //reset game else if (text.StartsWith("0GR_")) { string game = text.Substring(4); UInt64 nrOfGame = gamePointer[game]; gameRooms[nrOfGame] = new GameStruct(gameRooms[nrOfGame].name1, gameRooms[nrOfGame].name2, 1); con.send(Encoding.Unicode.GetBytes(text)); // first card gameRooms[nrOfGame].GetCard(3); // players cards gameRooms[nrOfGame].cardsToTake = 4; gameRooms[nrOfGame].GetCard(1); gameRooms[nrOfGame].cardsToTake = 4; gameRooms[nrOfGame].GetCard(2); gameRooms[nrOfGame].SendStatus(); } // chat else if (text.StartsWith("00C_")) { if (DEBUG) { Console.WriteLine(text.Substring(4)); } con.send(Encoding.Unicode.GetBytes("00C_" + text.Substring(4))); } // game move else if (text.StartsWith("0GM_")) { string[] tmp = text.Substring(4).Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); if (gameRooms[gamePointer[tmp[0]]].who == UInt64.Parse(tmp[1])) // right player { if (tmp[2].Equals("GC")) // getCard { gameRooms[gamePointer[tmp[0]]].GetCard(gameRooms[gamePointer[tmp[0]]].who); } else { gameRooms[gamePointer[tmp[0]]].stack = UInt64.Parse(tmp[2]); if (UInt64.Parse(tmp[2]) % 13 == 0) // A { gameRooms[gamePointer[tmp[0]]].changeSuit = UInt64.Parse(tmp[3]); } else { gameRooms[gamePointer[tmp[0]]].changeSuit = 0; } if (UInt64.Parse(tmp[2]) % 13 == 1) // 2 { if (gameRooms[gamePointer[tmp[0]]].cardsToTake == 1) { gameRooms[gamePointer[tmp[0]]].cardsToTake = 2; } else { gameRooms[gamePointer[tmp[0]]].cardsToTake += 2; } } else if (UInt64.Parse(tmp[2]) % 13 == 2) // 3 { if (gameRooms[gamePointer[tmp[0]]].cardsToTake == 1) { gameRooms[gamePointer[tmp[0]]].cardsToTake = 3; } else { gameRooms[gamePointer[tmp[0]]].cardsToTake += 3; } } else if (UInt64.Parse(tmp[2]) % 13 == 3) // 4 { if (gameRooms[gamePointer[tmp[0]]].who == 1) { gameRooms[gamePointer[tmp[0]]].p2stay = 1; } else if (gameRooms[gamePointer[tmp[0]]].who == 2) { gameRooms[gamePointer[tmp[0]]].p1stay = 1; } } if (gameRooms[gamePointer[tmp[0]]].who == 1) { gameRooms[gamePointer[tmp[0]]].p1cards.Remove(UInt64.Parse(tmp[2])); } else if (gameRooms[gamePointer[tmp[0]]].who == 2) { gameRooms[gamePointer[tmp[0]]].p2cards.Remove(UInt64.Parse(tmp[2])); } } if (gameRooms[gamePointer[tmp[0]]].p1cards.Count == 0) { con.send(Encoding.Unicode.GetBytes("0GW_" + gameRooms[gamePointer[tmp[0]]].name1)); if (DEBUG) { Console.WriteLine(gameRooms[gamePointer[tmp[0]]].name1 + " has won !!"); } } else if (gameRooms[gamePointer[tmp[0]]].p2cards.Count == 0) { con.send(Encoding.Unicode.GetBytes("0GW_" + gameRooms[gamePointer[tmp[0]]].name2)); if (DEBUG) { Console.WriteLine(gameRooms[gamePointer[tmp[0]]].name2 + " has won !!"); } } else { gameRooms[gamePointer[tmp[0]]].GetNext(); gameRooms[gamePointer[tmp[0]]].SendStatus(); } } } else if (DEBUG) { Console.WriteLine("Error: Unknown command: " + text); } }
protected virtual void ProcessAction_Attack(GameStruct.Action act) { }
public void SendMagicInfo(GameStruct.RoleMagicInfo info) { NetMsg.MsgMagicInfo magicinfo = new NetMsg.MsgMagicInfo(); magicinfo.Create(null, play.GetGamePackKeyEx()); magicinfo.id = play.GetTypeId(); magicinfo.magicid = (ushort)info.magicid; magicinfo.level = info.level; magicinfo.exp = info.exp; play.SendData(magicinfo.GetBuffer()); }
protected override void ProcessAction_Injured(GameStruct.Action act) { BaseObject target = act.GetObject(0) as BaseObject; uint value = (uint)act.GetObject(1); if (!IsDie()) { //亡灵巫师- 被攻击后如果有召唤巫环状态- 就同时召唤出三个亡灵攻击对方。 if (this.GetTimerSystem().QueryStatus(GameStruct.RoleStatus.STATUS_ZHAOHUANWUHUAN) != null && this.GetTimerSystem().QueryStatus(GameStruct.RoleStatus.STATUS_HUASHENWANGLING) != null && mZhaoHuanWuHuanObj == null) { int nNewX = target.GetCurrentX() - DIR._DELTA_X[this.GetDir()]; int nNewY = target.GetCurrentY() - DIR._DELTA_Y[this.GetDir()]; MonsterObject Object_CALL = null; uint[] CallObj_ID = { GameBase.Config.Define.DIYUXIEFU_MONSTER_ID, GameBase.Config.Define.SHIHUNWULING_MONSTER_ID, GameBase.Config.Define.SHENYUANELING_MONSTER_ID }; for (int i = 0; i < CallObj_ID.Length; i++) { GameStruct.MonsterInfo monster_info = ConfigManager.Instance().GetMonsterInfo(CallObj_ID[i]); if (monster_info != null) { Object_CALL = new DiYuXieFu(this, target, (short)nNewX, (short)nNewY, this.GetDir(), monster_info.id, monster_info.ai); this.GetGameMap().AddObject(Object_CALL, null); Object_CALL.Alive(false); } } SetZhaoHuanWuHuanObj(target); } } mTarget = target; }
public virtual void ProcessAction(GameStruct.Action act) { if (act == null) return; switch (act.GetAction()) { case GameStruct.Action.MOVE: { ProcessAction_Move(act); break; } case GameStruct.Action.ATTACK: { ProcessAction_Attack(act); break; } case GameStruct.Action.DIE: { ProcessAction_Die(act); break; } case GameStruct.Action.ALIVE: { ProcessAction_Alive(act); break; } case GameStruct.Action.INJURED: { ProcessAction_Injured(act); break; } } }
public virtual void PushAction(GameStruct.Action act) { mActionList.Add(act); }
public string MensajeAldeano(GameStruct datosAldeano) { string mensajeAldeano = "Hola soy " + datosAldeano.nombreAldeano + " y tengo " + datosAldeano.edadAldeano + " años"; return(mensajeAldeano); }
bool InitialiseGameState() { game = new GameStruct(); game.names = new string[4]; game.scores = new int[4]; ball = GameObject.Find("PhysicsBall").GetComponent <BallScript>(); uiReference = GameObject.Find("Interface").GetComponent <InterfaceScript>(); camera2DRef = GameObject.Find("TopDownCamera").GetComponent <Camera>(); camera3DRef = GameObject.Find("PerspectiveCamera").GetComponent <Camera>(); if (ball == null) { return(false); } else { ball.Init(this); } if (GameObject.Find("Player1")) { Debug.Log("found"); } else { Debug.Log("not found"); } for (int i = 0; i < paddles.Length; i++) { Debug.Log("searching for Paddle" + (i + 1)); paddles[i] = GameObject.Find("Paddle" + (i + 1)).GetComponent <PaddleScript>(); paddles[i].SetPaddlePosition(i); if (paddles[i] == null) { return(false); } } /*set paddle controllers * if (game.paddles == GamePaddles.two) * { * if (game.playerRules == GamePlayerRules.single) * { * paddles[0].SetControllerType(2); //controller type 0 = keyboard, 1 = mouse, 2 = computer * paddles[1].SetControllerType(2); * paddles[2].DisablePaddle(); * paddles[3].DisablePaddle(); * game.names[0] = "Player1"; * game.names[1] = "Player2"; * } * } * else if (game.paddles == GamePaddles.four) * { * if (game.playerRules == GamePlayerRules.single) * { * paddles[0].SetControllerType(2); //controller type 0 = keyboard, 1 = mouse, 2 = computer * paddles[1].SetControllerType(2); * paddles[2].SetControllerType(2); * paddles[3].SetControllerType(2); * } * }*/ if (LoadSettings() == false) { Debug.Log("could not load settings"); return(false); } //load ui after settings to get player names if (uiReference == null) { return(false); } else { uiReference.Init(this); } return(true); }