Beispiel #1
0
                    public byte[] ToBin(twp.app.unit.UnitType type)
                    {
                        NetSocket.ByteArray bin = new NetSocket.ByteArray();

                        switch(type)
                        {
                        case twp.app.unit.UnitType.UNITTYPE_PLAYER:
                        {
                            bin.Put(player.ToBin());
                            break;
                        }
                        case twp.app.unit.UnitType.UNITTYPE_MONSTER:
                        {
                            bin.Put(monster.ToBin());
                            break;
                        }
                        case twp.app.unit.UnitType.UNITTYPE_SYSTEM:
                        {
                            bin.Put(system.ToBin());
                            break;
                        }
                        case twp.app.unit.UnitType.UNITTYPE_TRAP:
                        {
                            bin.Put(trap.ToBin());
                            break;
                        }
                        case twp.app.unit.UnitType.UNITTYPE_WALL:
                        {
                            bin.Put(wall.ToBin());
                            break;
                        }
                        case twp.app.unit.UnitType.UNITTYPE_CRAFTSMAN_HOUSE:
                        {
                            bin.Put(craftsman.ToBin());
                            break;
                        }
                        case twp.app.unit.UnitType.UNITTYPE_ALLIANCE_HALL:
                        {
                            bin.Put(alliance.ToBin());
                            break;
                        }
                        case twp.app.unit.UnitType.UNITTYPE_TRADE_CENTRALITY:
                        {
                            bin.Put(trade_centralit.ToBin());
                            break;
                        }
                        case twp.app.unit.UnitType.UNITTYPE_HERO_PALACE:
                        {
                            bin.Put(hero_palace.ToBin());
                            break;
                        }
                        case twp.app.unit.UnitType.UNITTYPE_ENLIST_TOWER:
                        {
                            bin.Put(enlist_tower.ToBin());
                            break;
                        }
                        case twp.app.unit.UnitType.UNITTYPE_MAIN_CITY:
                        {
                            bin.Put(main_city.ToBin());
                            break;
                        }
                        case twp.app.unit.UnitType.UNITTYPE_FARMLANG:
                        {
                            bin.Put(farmlage.ToBin());
                            break;
                        }
                        case twp.app.unit.UnitType.UNITTYPE_SHOP:
                        {
                            bin.Put(shop.ToBin());
                            break;
                        }
                        case twp.app.unit.UnitType.UNITTYPE_BARN:
                        {
                            bin.Put(barn.ToBin());
                            break;
                        }
                        case twp.app.unit.UnitType.UNITTYPE_EXCHEUQER:
                        {
                            bin.Put(excheuqer.ToBin());
                            break;
                        }
                        case twp.app.unit.UnitType.UNITTYPE_RESIDENT:
                        {
                            bin.Put(resident.ToBin());
                            break;
                        }
                        default:
                        {
                            Debug.LogError("Unhandle unity type = " + type);
                            break;
                        }

                        }
                        return bin.GetData();
                    }
Beispiel #2
0
					public byte[] ToBin (twp.app.city.CityHeroOperate type)
					{
						NetSocket.ByteArray bin = new NetSocket.ByteArray ();
						switch (type) {
						case twp.app.city.CityHeroOperate.CITY_CALL_BROWSER_HERO://召唤英雄前,浏览英雄
							{
								bin.Put (browse.ToBin ());
							}
							break;
						case twp.app.city.CityHeroOperate.CITY_CALL_HERO://召唤英雄
							{
								bin.Put (summon.ToBin ());
							}
							break;
						case twp.app.city.CityHeroOperate.CITY_GIVE_UP_BROWSER_HERO://放弃浏览英雄
							{
								bin.Put (giveup_browse.ToBin ());
							}
							break;
						case twp.app.city.CityHeroOperate.CITY_LEVEL_UP_HERO://升级英雄
							{
								bin.Put (level_up.ToBin ());
							}
							break;
						case twp.app.city.CityHeroOperate.CITY_HERO_LEARN_SKILL:/* CITY_LEVEL_UP_HERO_SKILL*/ //英雄技能升级
							{
								bin.Put (up_skill.ToBin ());
							}
							break;
						case twp.app.city.CityHeroOperate.CITY_BUY_TRAIN_TIMES://购买次数
							{
								bin.Put (train_time.ToBin ());
							}
							break;
						case twp.app.city.CityHeroOperate.CITY_FIRE_HERO://解雇英雄
							{
								bin.Put (fire_hero.ToBin ());
							}
							break;
						case twp.app.city.CityHeroOperate.CITY_TRAIN_HERO://
							{
								bin.Put (train_hero.ToBin ());
							}
							break;
						case twp.app.city.CityHeroOperate.CITY_BUILD_ADD_HERO:// 建筑入驻英雄
							{
								bin.Put (build_add_hero.ToBin ());
							}
							break;
						case twp.app.city.CityHeroOperate.CITY_REQ_HERO_LIST:
						{
							bin.Put (hero_list.ToBin());
						}
							break;
						case twp.app.city.CityHeroOperate.CITY_BUILD_DEL_HERO:
						{
								bin.Put(build_del_hero.ToBin());
						}
							break;
						case twp.app.city.CityHeroOperate.CITY_HERO_CLEAN_SKILL_CD:
						{
							bin.Put(clean_skill_cd.ToBin());	
						}
							break;
						case twp.app.city.CityHeroOperate.CITY_HERO_CLEAN_TRAIN_CD://清除培养cd
						{
							bin.Put(clean_train_cd.ToBin());
						}
							break;
						default:
							break;
						}
						
						return bin.GetData ();
					}
Beispiel #3
0
                    public void FromBin(twp.app.unit.UnitType type, NetSocket.ByteArray bin)
                    {
                        switch(type)
                        {
                        case twp.app.unit.UnitType.UNITTYPE_PLAYER:
                        {
                            player.FromBin(bin);
                            break;
                        }
                        case twp.app.unit.UnitType.UNITTYPE_MONSTER:
                        {
                            monster.FromBin(bin);
                            break;
                        }
                        case twp.app.unit.UnitType.UNITTYPE_SYSTEM:
                        {
                            system.FromBin(bin);
                            break;
                        }
                        case twp.app.unit.UnitType.UNITTYPE_TRAP:
                        {
                            trap.FromBin(bin);

                            break;
                        }
                        case twp.app.unit.UnitType.UNITTYPE_WALL:
                        {
                            wall.FromBin(bin);
                            break;
                        }
                        case twp.app.unit.UnitType.UNITTYPE_CRAFTSMAN_HOUSE:
                        {
                            craftsman.FromBin(bin);
                            break;
                        }
                        case twp.app.unit.UnitType.UNITTYPE_ALLIANCE_HALL:
                        {
                            alliance.FromBin(bin);
                            break;
                        }
                        case twp.app.unit.UnitType.UNITTYPE_TRADE_CENTRALITY:
                        {
                            trade_centralit.FromBin(bin);
                            break;
                        }
                        case twp.app.unit.UnitType.UNITTYPE_HERO_PALACE:
                        {
                            hero_palace.FromBin(bin);
                            break;
                        }
                        case twp.app.unit.UnitType.UNITTYPE_ENLIST_TOWER:
                        {
                            enlist_tower.FromBin(bin);
                            break;
                        }
                        case twp.app.unit.UnitType.UNITTYPE_MAIN_CITY:
                        {
                            main_city.FromBin(bin);
                            break;
                        }
                        case twp.app.unit.UnitType.UNITTYPE_FARMLANG:
                        {
                            farmlage.FromBin(bin);
                            break;
                        }
                        case twp.app.unit.UnitType.UNITTYPE_SHOP:
                        {
                            shop.FromBin(bin);
                            break;
                        }
                        case twp.app.unit.UnitType.UNITTYPE_BARN:
                        {
                            barn.FromBin(bin);
                            break;
                        }
                        case twp.app.unit.UnitType.UNITTYPE_EXCHEUQER:
                        {
                            excheuqer.FromBin(bin);
                            break;
                        }
                        case twp.app.unit.UnitType.UNITTYPE_RESIDENT:
                        {
                            resident.FromBin(bin);
                            break;
                        }
                        case twp.app.unit.UnitType.UNITTYPE_INVALID:
                        {
                            bin.Move(8);
                            break;
                        }
                        default:
                        {
                            Debug.LogError("Unhandle unity type = " + type);
                            break;
                        }

                        }
                    }
Beispiel #4
0
					public CombatChangeAttackDest change_dest; // 单位改变攻击目标
					
					public byte[] ToBin (twp.app.scene.CombatOperationType type)
					{
						NetSocket.ByteArray bin = new NetSocket.ByteArray ();
						switch(type)
						{
							
						case twp.app.scene.CombatOperationType.COMBAT_BASIC_OPERATION_TYPE_UNIT_BORN:
						{
							bin.Put(unit_born.ToBin());
							break;
						}
						case twp.app.scene.CombatOperationType.COMBAT_BASIC_OPERATION_TYPE_UNIT_MOVE:
						{
							bin.Put(unit_move.ToBin());
							break;
						}
						case twp.app.scene.CombatOperationType.COMBAT_BASIC_OPERATION_TYPE_UNIT_CHAGNE_DEST:
						{
							//TDMacro.Assert(false, "COMBAT_BASIC_OPERATION_TYPE_APPLY_COMBAT  UnHandle......");
							bin.Put(change_dest.ToBin());
							
							break;
						}
						case twp.app.scene.CombatOperationType.COMBAT_BASIC_OPERATION_TYPE_OVER:
						{
							bin.appendMargin(18);
							break;
						}
						default:
						{
							//TDMacro.Assert(false, "Not Process CombatOperationType");
							break;
						}
							
						}
						
						return bin.GetData ();
					}
Beispiel #5
0
					public byte[] ToBin (twp.app.build.BuildOperationEvent type)
					{
						NetSocket.ByteArray bin = new NetSocket.ByteArray ();
						switch (type) {
						case twp.app.build.BuildOperationEvent.ADD_BUILD:
							{
								bin.Put (add_build.ToBin ());
							}
							break;
						case twp.app.build.BuildOperationEvent.DEL_BUILD:
							{
								bin.Put (del_build.ToBin ());
							}
							break;
						case twp.app.build.BuildOperationEvent.LEVEL_BUILD:
							{
								bin.Put (uplevel_build.ToBin ());	
							}
							break;
						default:
							break;
						}
						return bin.GetData ();
					}
Beispiel #6
0
 public void FromBin(NetSocket.ByteArray bin, twp.app.build.BuildsType build_type)
 {
     switch (build_type) {
     case twp.app.build.BuildsType.BUILD_TYPE_WALL:
         {
             wall_build = new twp.app.city.WallsInfoDP ();
             wall_build.FromBin (bin);
         }
         break;
     default:
         {
             base_build = new twp.app.city.BuildsInfoDP ();
             base_build.FromBin (bin);
         }
         break;
     }
 }
Beispiel #7
0
					public byte[] ToBin(twp.app.relation.OperationRelation ot)
					{
						NetSocket.ByteArray bin = new NetSocket.ByteArray();
						
						switch(ot)
						{
							case twp.app.relation.OperationRelation.OPERATION_RELATION_ADD_ID:
							{
								bin.Put(data.ToBin());
								break;
							}
							case twp.app.relation.OperationRelation.OPERATION_RELATION_ADD_NAME:
							{
								bin.Put(add_name.ToBin());
								break;
							}
						}
						
						return bin.GetData();
					}
Beispiel #8
0
                    public CombatResumeMonData mon_data; // 英雄信息

                    public void FromBin(twp.app.scene.CombatResumeElemType  type, NetSocket.ByteArray bin)
                    {
                        switch (type) {
                        case twp.app.scene.CombatResumeElemType.RESUME_ELEM_TYPE_BUILD_DATA:
                            {
                                build_data = new CombatResumeBuildData ();
                                build_data.FromBin (bin);

                                bin.Move (25 - 10);
                                break;
                            }
                        case twp.app.scene.CombatResumeElemType.RESUME_ELEM_TYPE_HERO_DATA:
                            {
                                mon_data = new CombatResumeMonData ();
                                mon_data.FromBin (bin);
                                break;
                            }
                        default:
                            {
                                //TDMacro.Assert (false, "Not Process the condition");
                                break;
                            }

                        }
                    }
Beispiel #9
0
 public void FromBin(NetSocket.ByteArray bin, twp.app.unit.CityOperateType type_)
 {
     switch (type_) {
     case twp.app.unit.CityOperateType.AREA_CITY_OPERATION_TYPE_CONSTRUCT:
         create = new Create ();
         create.FromBin (bin);
         break;
     default:
         //TDMacro.Assert (false, "Wrong CityOperateType, when parsing");
         break;
     }
 }
Beispiel #10
0
                    public void FromBin(twp.app.scene.InstanceMonEventType type, NetSocket.ByteArray bin)
                    {
                        switch(type)
                          {
                          case twp.app.scene.InstanceMonEventType.ET_INFO_MON_BORN:
                          {
                           unit_born = new Unit_Born();
                           unit_born.FromBin(bin);
                           break;
                          }
                          case twp.app.scene.InstanceMonEventType.ET_INFO_MON_CHANGE_DEST:
                          {
                           unit_chage_dest = new  Unit_Chage_Dest();
                           unit_chage_dest.FromBin(bin);

                           break;
                          }
                          default:
                          {
                           UnityEngine.Debug.LogError("Unhandle type = " + type);
                           break;
                          }

                          }
                    }
Beispiel #11
0
                    public CombatBuildHurtElem build; // 建筑

                    public void FromBin(twp.app.unit.UnitType type ,NetSocket.ByteArray bin)
                    {
                        switch(type)
                          {

                          case twp.app.unit.UnitType.UNITTYPE_MONSTER:
                          {
                           mon = new CombatMonHurtElem();
                           mon.FromBin(bin);
                           break;
                          }
                          default:
                          {
                           build = new CombatBuildHurtElem();
                           //???? All Left is Building???
                           build.FromBin(bin);
                           break;
                          }

                          }
                    }
Beispiel #12
0
                    public void FromBin(twp.app.scene.InstanceEventType type, NetSocket.ByteArray bin)
                    {
                        switch (type) {

                        case twp.app.scene.InstanceEventType.ET_INTO_COMBAT_TIME:
                            {
                                into_combat_time = new Into_Combat_Time ();
                                into_combat_time.FromBin (bin);
                                break;
                            }
                        case twp.app.scene.InstanceEventType.ET_INTO_COMBAT_SUCCED:
                        case twp.app.scene.InstanceEventType.ET_INTO_COMBAT_FAIL:
                            {
                                combat_end_time = new Combat_End_Time ();
                                combat_end_time.FromBin (bin);
                                break;
                            }
                        case twp.app.scene.InstanceEventType.ET_ING_COMBAT_UNIT_BORN:
                            {
                                combat_born = new Combat_Born ();
                                combat_born.FromBin (bin);
                                break;
                            }
                        case twp.app.scene.InstanceEventType.ET_ING_COMBAT_OVER:
                            {
                                combat_end = new Combat_End ();
                                combat_end.FromBin (bin);
                                break;
                            }

                        }
                    }
Beispiel #13
0
 public void FromBin(NetSocket.ByteArray bin, twp.app.resource.AreaResourceType type)
 {
     switch (type) {
     case twp.app.resource.AreaResourceType.AREA_RESOURCE_TYPE_RESOURCE:
         goto case twp.app.resource.AreaResourceType.AREA_RESOURCE_TYPE_RESOURCE_MAX;
     case twp.app.resource.AreaResourceType.AREA_RESOURCE_TYPE_RESOURCE_MAX:
     {
         resouce = new Resouce();
         resouce.FromBin(bin);
     }
         break;
     case twp.app.resource.AreaResourceType.AREA_RESOURCE_TYPE_ENGINEER:
         goto case twp.app.resource.AreaResourceType.AREA_RESOURCE_TYPE_ENGINEER_MAX;
     case twp.app.resource.AreaResourceType.AREA_RESOURCE_TYPE_ENGINEER_MAX:
     {
         engineer = new Engineer();
         engineer.FromBin(bin);
     }
         break;
         default:
         break;
     }
 }
Beispiel #14
0
 public void FromBin(NetSocket.ByteArray bin, twp.app.city.CityHeroOperate type)
 {
     switch (type) {
     case twp.app.city.CityHeroOperate.CITY_CALL_HERO://召唤英雄
         {
             summon_hero = new Summon_Hero ();
             summon_hero.FromBin (bin);
         }
         break;
     case twp.app.city.CityHeroOperate.CITY_CALL_BROWSER_HERO://召唤前浏览英雄信息
         {
             browse_hero = new Browser_Hero ();
             browse_hero.FromBin (bin);
         }
         break;
     case twp.app.city.CityHeroOperate.CITY_LEVEL_UP_HERO://升级后的英雄
         {
             levelup_hero = new Levelup_Hero ();
             levelup_hero.FromBin (bin);
         }
         break;
     case twp.app.city.CityHeroOperate.CITY_FIRE_HERO://解雇英雄
         {
             fire_hero = new Fire_Hero ();
             fire_hero.FromBin (bin);
         }
         break;
     case twp.app.city.CityHeroOperate.CITY_BUY_TRAIN_TIMES://购买次数
         {
             buy_train_times = new Buy_Train_Times ();
             buy_train_times.FromBin (bin);
         }
         break;
     //	case twp.app.city.CityHeroOperate.CITY_LEVEL_UP_HERO_SKILL:
     //		goto case twp.app.city.CityHeroOperate.CITY_HERO_LEARN_SKILL;
     case twp.app.city.CityHeroOperate.CITY_HERO_LEARN_SKILL:
         {
             learn_skill = new Learn_Skill ();
             learn_skill.FromBin (bin);
         }
         break;
     case twp.app.city.CityHeroOperate.CITY_TRAIN_HERO:
     {
             train_hero = new Train_Hero();
             train_hero.FromBin(bin);
     }
         break;
     case twp.app.city.CityHeroOperate.CITY_BUILD_ADD_HERO:
     {
         build_add_hero = new Build_Add_Hero();
         build_add_hero.FromBin(bin);
     }
         break;
     case twp.app.city.CityHeroOperate.CITY_BUILD_DEL_HERO:
     {
         build_del_hero = new Build_Del_Hero();
         build_del_hero.FromBin(bin);
     }
         break;
     case twp.app.city.CityHeroOperate.CITY_GIVE_UP_BROWSER_HERO:
     {
         //哈哈└(^o^)┘
     }
         break;
     case twp.app.city.CityHeroOperate.CITY_HERO_CLEAN_TRAIN_CD:
     {
         clean_train_cd = new Clean_Train_Cd();
         clean_train_cd.FromBin(bin);
     }
         break;
     case twp.app.city.CityHeroOperate.CITY_HERO_CLEAN_SKILL_CD:
     {
         clean_skill_cd = new Clean_Skill_Cd();
         clean_skill_cd.FromBin(bin);
     }
         break;
     default:
         UnityEngine.Debug.LogError ("twp.app.city.CityHeroOperate error:" + type);
         break;
     }
 }
Beispiel #15
0
 public void FromBin(twp.app.mate.MatchOperateType  type, NetSocket.ByteArray bin)
 {
     switch (type) {
     case twp.app.mate.MatchOperateType.PLAYER_OPERATE_MATCH_CITY:
         match_Enemy = new Match_Enemy ();
         match_Enemy.FromBin (bin);
         break;
     default:
     #if true
         match_Enemy = new Match_Enemy ();
         match_Enemy.FromBin (bin);
     #endif
         break;
     }
 }
Beispiel #16
0
 public void FromBin(NetSocket.ByteArray bin, twp.app.city.CityResumeElemType type_)
 {
     switch (type_) {
     case twp.app.city.CityResumeElemType.RESUME_ELEM_TYPE_BUILD:
         builds = new ResumeBuildData ();
         builds.FromBin (bin);
         break;
     case twp.app.city.CityResumeElemType.RESUME_ELEM_TYPE_WALL:
         walls = new ResumeWallData ();
         walls.FromBin (bin);
         break;
     default:
         break;
     }
 }