Ejemplo n.º 1
0
    internal static void Serialize(uLink.BitStream stream, object value, params object[] codecOptions)
    {
        BuildingID buildingID = value as BuildingID;

        stream.Write <int>(buildingID.townId);
        stream.Write <int>(buildingID.buildingNo);
    }
Ejemplo n.º 2
0
 public void RemoveBuilding(BuildingID buildingId)
 {
     if (mBuildingInfoMap.ContainsKey(buildingId))
     {
         mBuildingInfoMap.Remove(buildingId);
     }
 }
Ejemplo n.º 3
0
    IEnumerator CreateMapItemInBuilding(BuildingID buildingId, List <CreatItemInfo> itemInfoList, Vector3 root, int id, int rotation)
    {
        if (PeGameMgr.IsSingleAdventure)
        {
            for (int i = 0; i < itemInfoList.Count; i++)
            {
                //LogManager.Error(itemInfoList[i].mItemId, itemInfoList[i].mPos, itemInfoList[i].mRotation);
                DragArticleAgent.PutItemByProroId(itemInfoList[i].mItemId, itemInfoList[i].mPos, itemInfoList[i].mRotation);
                yield return(null);
            }

            mCreatedNpcBuildingID.Add(buildingId, 0);
        }
        else if (GameConfig.IsMultiMode)
        {
            while (true)
            {
                if (PeCreature.Instance.mainPlayer == null)
                {
                    yield return(null);
                }
                else
                {
                    break;
                }
            }
            //--to do: createBuildingWithItem
            //PlayerNetwork.MainPlayer.CreateBuildingWithItem(buildingId, itemInfoList, root, id, rotation);
            yield return(null);
        }

        yield return(null);
    }
Ejemplo n.º 4
0
    internal static object Deserialize(uLink.BitStream stream, params object[] codecOptions)
    {
        int        townId     = stream.Read <int>();
        int        buildingNo = stream.Read <int>();
        BuildingID buildingID = new BuildingID(townId, buildingNo);

        return(buildingID);
    }
Ejemplo n.º 5
0
 public VABuildingInfo GetBuildingInfoByBuildingID(BuildingID buildingid)
 {
     if (!mBuildingInfoMap.ContainsKey(buildingid))
     {
         return(null);
     }
     return(mBuildingInfoMap[buildingid]);
 }
Ejemplo n.º 6
0
 public override void WriteDataOnParent(MainForm frm, Control parent, ref Point location)
 {
     EventLabel(frm, parent, ref location, "HF:", HF);
     EventLabel(frm, parent, ref location, "State:", BodyState);
     EventLabel(frm, parent, ref location, "Site:", Site);
     EventLabel(frm, parent, ref location, "BuildingID:", BuildingID.ToString());
     EventLabel(frm, parent, ref location, "Region:", Subregion);
     EventLabel(frm, parent, ref location, "Layer:", FeatureLayerID == -1 ? "" : FeatureLayerID.ToString());
     EventLabel(frm, parent, ref location, "Coords:", new Coordinate(Coords));
 }
Ejemplo n.º 7
0
    public void RenderBuilding(BuildingID buildingId)
    {
        VABuildingInfo b = GetBuildingInfoByBuildingID(buildingId);

        if (b == null)
        {
            return;
        }
        RenderBuilding(b);
    }
Ejemplo n.º 8
0
 public override bool Equals(object obj)
 {
     if (null == obj)
     {
         return(false);
     }
     BuildingID vec = (BuildingID)obj;
     //if(vec != null)
     {
         return(townId == vec.townId && buildingNo == vec.buildingNo);
     }
     //return false;
 }
Ejemplo n.º 9
0
        public virtual IBuilding GetBuildingOrDeafult(IProvider provider)
        {
            int buildingId = BuildingID.GetValueOrDefault(DefaultBuildingID);

            if (buildingId == -1)
            {
                return(GetResourceTree(provider).GetBuilding(DefaultBuildingID));
            }
            else
            {
                return(GetResourceTree(provider).GetBuilding(buildingId));
            }
        }
Ejemplo n.º 10
0
    public void RenderBuilding(VABuildingInfo b)
    {
        BuildingID buildingId = b.buildingId;

        if (b.pos.y == -1)
        {
            LogManager.Error("building [", buildingId, "] height not initialized!");
            return;
        }

        RenderPrefebBuilding(b);

        //renderManager[buildingId] = true;
    }
Ejemplo n.º 11
0
 public static int GetBuildingRank(BuildingID buildingId)
 {
     // buildingID, buildingName, texturePrefix, icon, description, rank = C_Garrison.GetBuildingInfo(buildingID)
     //
     try
     {
         string result = Others.GetRandomString(Others.Random(4, 10));
         Lua.LuaDoString("_, _, _, _, _, " + result + " = C_Garrison.GetBuildingInfo(" + (int)buildingId + ");");
         return(Others.ToInt32(Lua.GetLocalizedText(result)));
     }
     catch (Exception e)
     {
         Logging.WriteError("public int GetBuildingRank(int buildingId): " + e);
     }
     return(0);
 }
Ejemplo n.º 12
0
        public override string ToString()
        {
            string pathDelimiter = PathDelimiter;
            string result        = string.Empty;

            if (BuildingID == 0 && ResourceID == 0)
            {
                return(result);
            }
            else
            {
                result += BuildingID.ToString();
            }

            if (LabID == 0 && ResourceID == 0)
            {
                return(result);
            }
            else
            {
                result += pathDelimiter + LabID.ToString();
            }

            if (ProcessTechID == 0 && ResourceID == 0)
            {
                return(result);
            }
            else
            {
                result += pathDelimiter + ProcessTechID.ToString();
            }

            if (ResourceID == 0)
            {
                return(result);
            }
            else
            {
                result += pathDelimiter + ResourceID.ToString();
            }

            return(result);
        }
Ejemplo n.º 13
0
    public VABuildingInfo(Vector3 pos, float rot, int id, BuildingID buildingId, VABuildingType type, VArtifactUnit vau, Vector2 size)
    {
        this.pos      = pos;
        this.id       = id;
        this.rotation = rot;
        buildingType  = type;

        center   = new IntVector2();
        center.x = Mathf.FloorToInt(this.pos.x);
        center.y = Mathf.FloorToInt(this.pos.z);

        root      = pos;
        this.size = size;
//        int length = Mathf.CeilToInt(size.x);
        int width    = Mathf.CeilToInt(size.y);
        int distance = width / 2 + 3;

        //--to do:get front door pos
        frontDoorPos = root + new Vector3(distance * Mathf.Sin(rot * Mathf.PI / 180), 0, distance * Mathf.Cos(rot * Mathf.PI / 180));

        this.buildingId = buildingId;
        this.vau        = vau;
    }
Ejemplo n.º 14
0
        public string GetCondensedInformation()
        {
            string name, left, top, facing;

            name = BuildingID.ToString();
            left = LeftPosition.ToString();
            top  = TopPosition.ToString();

            switch (DirectionFacing)
            {
            case Enums.BuildingDirection.Down: facing = "down"; break;

            case Enums.BuildingDirection.Left: facing = "left"; break;

            case Enums.BuildingDirection.Up: facing = "up"; break;

            case Enums.BuildingDirection.Right: facing = "right"; break;

            default: facing = "???"; break;
            }

            return(string.Format("{0} -- position: (left: {1}, top: {2}) -- facing: {3}", name, left, top, facing));
        }
Ejemplo n.º 15
0
        public override void LoadFromStream(BinaryReader stream, FileVersion version)
        {
            try {
                fID  = (BuildingID)StreamUtils.ReadInt(stream);
                Area = StreamUtils.ReadRect(stream);

                Doors.Clear();
                sbyte count = (sbyte)StreamUtils.ReadByte(stream);
                for (int i = 0; i < count; i++)
                {
                    int       dx  = StreamUtils.ReadInt(stream);
                    int       dy  = StreamUtils.ReadInt(stream);
                    int       dir = StreamUtils.ReadByte(stream);
                    DoorState st  = (DoorState)StreamUtils.ReadByte(stream);
                    AddDoor(dx, dy, dir, st);
                }

                int idx = StreamUtils.ReadInt(stream);
                Holder = ((idx == -1) ? null : (CreatureEntity)((NWField)Owner).Creatures.GetItem(idx));
            } catch (Exception ex) {
                Logger.Write("Building.loadFromStream(): " + ex.Message);
                throw ex;
            }
        }
Ejemplo n.º 16
0
 public Building(GameSpace space, object owner)
     : base(space, owner)
 {
     fID = BuildingID.bid_None;
 }
Ejemplo n.º 17
0
        public override string LegendsDescription()
        {
            string timestring = base.LegendsDescription();

            return(string.Format("{0} {1} was entombed in {2} within {3}.",
                                 timestring, HF.ToString(), Site.AltName, "BUILDING " + BuildingID.ToString()));
        }
Ejemplo n.º 18
0
    public void Import(byte[] buffer)
    {
        //LogManager.Error("BuildingInfoManager.Instance.Import()");
        Clear();
        if (buffer.Length == 0)
        {
            return;
        }

        MemoryStream ms  = new MemoryStream(buffer);
        BinaryReader _in = new BinaryReader(ms);

        int iSize = _in.ReadInt32();

        for (int i = 0; i < iSize; i++)
        {
            NpcMissionData data  = new NpcMissionData();
            int            npcid = _in.ReadInt32();

            if (npcid == -1)
            {
                continue;
            }

            data.m_Rnpc_ID              = _in.ReadInt32();
            data.m_QCID                 = _in.ReadInt32();
            data.m_CurMissionGroup      = _in.ReadInt32();
            data.m_CurGroupTimes        = _in.ReadInt32();
            data.mCurComMisNum          = _in.ReadByte();
            data.mCompletedMissionCount = _in.ReadInt32();
            data.m_RandomMission        = _in.ReadInt32();
            data.m_RecruitMissionNum    = _in.ReadInt32();

            int num = _in.ReadInt32();
            for (int j = 0; j < num; j++)
            {
                data.m_MissionList.Add(_in.ReadInt32());
            }

            num = _in.ReadInt32();
            for (int j = 0; j < num; j++)
            {
                data.m_MissionListReply.Add(_in.ReadInt32());
            }

            bool  isStand = _in.ReadBoolean();
            float rotY    = _in.ReadSingle();
            createdNpcIdList.Add(new BuildingNpcIdStand(npcid, isStand, rotY));
            NpcMissionDataRepository.AddMissionData(npcid, data);
        }

        iSize = _in.ReadInt32();
        for (int i = 0; i < iSize; i++)
        {
            BuildingID no = new BuildingID();
            no.townId     = _in.ReadInt32();
            no.buildingNo = _in.ReadInt32();
            mCreatedNpcBuildingID.Add(no, 0);
        }


        _in.Close();
        ms.Close();
        //loadRecord = LOADMARK;
    }