예제 #1
0
        public Camera(BCSV.Entry entry, Zone parent) : base(Vector3.Zero)
        {
            mEntry = entry;

            mName       = mEntry.Get <string>("id");
            mParentZone = parent;

            mType = mEntry.Get <string>("camtype");

            mFields = new Dictionary <string, object>();

            // the first thing we load are the camera-type specific fields
            List <string> fields = CameraUtil.GetStrings(mType).ToList();

            foreach (string field in fields)
            {
                if (field == "none")
                {
                    break;
                }

                string type = CameraUtil.GetTypeOfField(field);

                switch (type)
                {
                case "float":
                    mFields[field] = mEntry.Get <float>(field);
                    break;

                case "int":
                    mFields[field] = mEntry.Get <int>(field);
                    break;

                case "string":
                    mFields[field] = mEntry.Get <string>(field);
                    break;
                }
            }

            Dictionary <string, string> allFields = CameraUtil.GetAll();

            foreach (string s in allFields.Keys)
            {
                string type = CameraUtil.GetTypeOfField(s);

                if (!mEntry.ContainsKey(s))
                {
                    continue;
                }

                switch (type)
                {
                case "float":
                    mFields[s] = mEntry.Get <float>(s);
                    break;

                case "int":
                    mFields[s] = mEntry.Get <int>(s);
                    break;

                case "string":
                    mFields[s] = mEntry.Get <string>(s);
                    break;
                }
            }
        }