コード例 #1
0
ファイル: DBObject.cs プロジェクト: RPGPlanner/RPGPlanner
 public static string getBaseTable(ObjType type)
 {
     switch (type)
     {
         case ObjType.Hero:
         case ObjType.Wish:
             return type.ToString() + "es";
         default:
             return type.ToString() + "s";
     }
 }
コード例 #2
0
 void Start()
 {
     // アタッチしてるオブジェクトを判別
     if (this.gameObject.GetComponent <Image>())
     {
         thisObjType = ObjType.IMAGE;
         image       = this.gameObject.GetComponent <Image>();
     }
     else if (this.gameObject.GetComponent <Text>())
     {
         thisObjType = ObjType.TEXT;
         text        = this.gameObject.GetComponent <Text>();
     }
 }
コード例 #3
0
    }                                                                  // 플레이어의 망치

    private void Awake()
    {
        _objType = ObjType.EMPTY;

        isIam    = true;
        isStatue = false;
        isShop   = false;
        isDeath  = false;

        isCrouched   = false;
        isStopMoving = false;

        isDoingAction = false;
        isAttacking   = false;

        isHealing   = false;
        isShielding = false;

        playerHp        = 3;
        statueTouch     = 3;
        _shieldDuration = 5.0f;
        _healDuration   = 1.5f;

        // 플레이어가 사용할 파티클을 찾아온다.
        _playerParticle = transform.Find("PlayerParticle").gameObject;
        _playerBleeding = _playerParticle.transform.Find("Bleeding").GetComponent <ParticleSystem>();
        _playerShield   = _playerParticle.transform.Find("Shield").GetComponent <ParticleSystem>();
        _playerHeal     = _playerParticle.transform.Find("HealStream").GetComponent <ParticleSystem>();

        // 플레이어가 들고 있는 오브젝트를 찾아온다.
        playerHand = MyTools.SearchObjectWithTag(transform.gameObject, "PlayerHand");
        if (playerHand == null)
        {
            MyTools.LoadObjectMessage(false, "CharactorAnimationV2.cs -> Player's Hand Object");
        }
        else
        {
            sledgeHammer = playerHand.transform.Find("sledgeHammer").gameObject;
            flashLight   = playerHand.transform.Find("FlashLight").gameObject;
        }
        if (sledgeHammer == null)
        {
            MyTools.LoadObjectMessage(false, "CharactorAnimationV2.cs -> SledgeHammer Object");
        }
        if (flashLight == null)
        {
            MyTools.LoadObjectMessage(false, "CharactorAnimationV2.cs -> FlashLight Object");
        }
    }
    // --------------------------------------------------
    // Determine GameObject type
    // --------------------------------------------------
    // All MayaObjects default to transform only (no shape node).
    // When requested, this will examine what components are attached to
    // the GameObject and determine what type of object this MayaObject is.
    // This will also effectively signal to the exporter that we want to export
    // the shape data as well.
    public void GetObjType()
    {
        // --------------------------------------------------
        // Mesh Check
        // --------------------------------------------------
        MeshFilter MeshCheck = UnityObject.gameObject.GetComponent <MeshFilter>();

        if (MeshCheck != null)
        {
            // Just because there is a mesh filter attached to it doesn't mean there is a mesh
            // linked to it. Check that there is actually a shared mesh
            Mesh SharedMeshCheck = MeshCheck.sharedMesh;
            if (SharedMeshCheck != null)
            {
                // Finally, there might be a mesh, but no data (procedural meshes), so check that there is
                // actually data . . . sheesh! LOL
                if (SharedMeshCheck.vertices.Length > 2)
                {
                    Type = ObjType.Mesh;
                }
            }
        }

        // --------------------------------------------------
        // Skinned Mesh Check
        // --------------------------------------------------
        SkinnedMeshRenderer SkinnedMeshCheck = UnityObject.gameObject.GetComponent <SkinnedMeshRenderer>();

        if (SkinnedMeshCheck != null)
        {
            // Just because there is a mesh filter it doesn't mean there is a mesh
            // linked to it. Check that there is actually a shared mesh
            Mesh SharedMeshCheck = SkinnedMeshCheck.sharedMesh;
            if (SharedMeshCheck != null)
            {
                Type = ObjType.SkinnedMesh;
            }
        }

        // --------------------------------------------------
        // Light Check
        // --------------------------------------------------
        Light LightCheck = UnityObject.gameObject.GetComponent <Light>();

        if (LightCheck != null)
        {
            Type = ObjType.Light;
        }
    }
コード例 #5
0
        public async Task <List <string> > GetFileNames(int objId, ObjType objType)
        {
            string targetFolder = HostingEnvironment.MapPath("~/Uploads");

            List <FileModel> File = await FindAll().Where(f => f.RefId == objId && f.RefGid == objType).ToListAsync();

            List <string> targetPaths = new List <string>();

            foreach (var item in File)
            {
                targetPaths.Add(Path.Combine(targetFolder, item.Id.ToString()));
            }

            return(targetPaths);
        }
コード例 #6
0
        public async Task <Dictionary <int, string> > GetFileNames(List <int> ids, ObjType objType)
        {
            string targetFolder = HostingEnvironment.MapPath("~/Uploads");

            List <FileModel> File = await FindAll().Where(f => f.RefGid == objType && ids.Contains(f.RefId)).GroupBy(x => x.RefId).Select(x => x.OrderByDescending(a => a.Id).FirstOrDefault()).ToListAsync();

            Dictionary <int, string> targetPaths = new Dictionary <int, string>();

            foreach (var item in File)
            {
                targetPaths.Add(item.RefId, Path.Combine(targetFolder, item.Id.ToString()));
            }

            return(targetPaths);
        }
コード例 #7
0
    //-----------------------------------------------------------------------------------
    // public functions
    public GameObject Assign(ObjType objType, Vector3 initPos)
    {
        if (objType == ObjType.zombie)
        {
            GameObject zombieObj = poolList[objType].Assign(initPos);
            //zombieObj.transform.GetComponent<enemyZombie>().InitializeZombie();

            return(zombieObj);
        }

        else
        {
            return(poolList[objType].Assign(initPos));
        }
    }
コード例 #8
0
 // Use this for initialization
 void Start()
 {
     if (this.gameObject.GetComponent <Image>())
     {
         thisObjType = ObjType.IMAGE;
         image       = this.gameObject.GetComponent <Image>();
         motocolor   = image.color;
     }
     else if (this.gameObject.GetComponent <Text>())
     {
         thisObjType = ObjType.TEXT;
         text        = this.gameObject.GetComponent <Text>();
         motocolor   = text.color;
     }
 }
コード例 #9
0
ファイル: ObjRecord.cs プロジェクト: ferrinsp/kbellfireapp
        /**
         * Constructs this object from the raw data
         *
         * @param t the raw data
         */
        public ObjRecord(Record t)
            : base(t)
        {
            byte[] data    = t.getData();
            int    objtype = IntegerHelper.getInt(data[4], data[5]);

            read = true;
            type = ObjType.getType(objtype);

            if (type == UNKNOWN)
            {
                //logger.warn("unknown object type code " + objtype);
            }

            objectId = (uint)IntegerHelper.getInt(data[6], data[7]);
        }
コード例 #10
0
    public virtual void Awake()
    {
        if (this.objType != ObjType.MainLineCanNotGet)
        {
            this.m_curObjType = this.objType;
        }

        if (this.objType != ObjType.none && this.objType != ObjType.none0)
        {
            CharactersManager.AddCharacter(this);
        }

        //if (base.GetComponent<SignSetActiveByState>() != null)
        //{
        //	CharactersManager.AddObj(this);
        //}
    }
コード例 #11
0
    public GameObject acquireReusable(ObjType type)
    {
        List <GameObject> reusables = _available [type];

        if (reusables.Count > 0)
        {
            GameObject item = reusables[0];
            reusables.RemoveAt(0);
            item.SetActive(true);
            return(item);
        }
        else
        {
            GameObject obj = GameObject.Instantiate(_prototypes [type]);
            return(obj);
        }
    }
コード例 #12
0
 private void Init(string url, string fileName, LoadType loadType, bool isReadable = false, bool isKeepLastAsset = false, bool isAutoShowAfterUpdate = true)
 {
     _url                   = url;
     _fileName              = fileName;
     _loadType              = loadType;
     _isReadable            = isReadable;
     _isKeepLastAsset       = isKeepLastAsset;
     _isAutoShowAfterUpdate = isAutoShowAfterUpdate;
     if (_targetType == TargetType.ScribbleTool || _targetType == TargetType.UIMask || _targetType == TargetType.DragonBones)
     {
         _objType = ObjType.Texture2D;
     }
     else
     {
         _objType = ObjType.Sprite;
     }
 }
コード例 #13
0
        private object PrivateReadObject()
        {
            ObjType t = (ObjType)ReadByte();

            switch (t)
            {
            case ObjType.boolType: return(base.ReadBoolean());

            case ObjType.byteType: return(base.ReadByte());

            case ObjType.uint16Type: return(base.ReadUInt16());

            case ObjType.uint32Type: return(base.ReadUInt32());

            case ObjType.uint64Type: return(base.ReadUInt64());

            case ObjType.sbyteType: return(base.ReadSByte());

            case ObjType.int16Type: return(base.ReadInt16());

            case ObjType.int32Type: return(base.ReadInt32());

            case ObjType.int64Type: return(base.ReadInt64());

            case ObjType.charType: return(base.ReadChar());

            case ObjType.stringType: return(base.ReadString());

            case ObjType.singleType: return(base.ReadSingle());

            case ObjType.doubleType: return(base.ReadDouble());

            case ObjType.decimalType: return(base.ReadDecimal());

            case ObjType.dateTimeType: return(this.ReadDateTime());

            case ObjType.byteArrayType: return(this.ReadByteArray());

            case ObjType.charArrayType: return(this.ReadCharArray());

            case ObjType.otherType: return(new BinaryFormatter().Deserialize(BaseStream));

            default: return(null);
            }
        }
コード例 #14
0
        public ObjType[] ObjTypesArray()
        {
            ObjType[] array = new ObjType[Count];

            for (int i = 0; i < Count; i++)
            {
                array[i] = new ObjType()
                {
                    Id        = jSonObjTypes.jToken[i]["id"].Value <string>(),
                    ApiName   = jSonObjTypes.jToken[i]["api_name"].Value <string>(),
                    ProjectId = jSonObjTypes.jToken[i]["project_id"].Value <string>(),
                    ParentId  = jSonObjTypes.jToken[i]["parent_id"].Value <string>(),
                    //Дописать MyExtParams
                };
            }

            return(array);
        }
コード例 #15
0
 public async Task <dynamic> GetObject(int objId, ObjType objType, bool FileList = false)
 {
     try
     {
         if (!FileList)
         {
             return(await GetFileObject(objId, objType));
         }
         else
         {
             return(await GetFileObjects(objId, objType));
         }
     }
     catch (Exception)
     {
         return(null);
     }
 }
コード例 #16
0
        public async Task AddFile(string name, int objId, ObjType objType, byte[] file)
        {
            string targetFolder = HostingEnvironment.MapPath("~/Uploads");

            FileModel filee = new FileModel
            {
                Name      = name,
                Extension = PDCore.Utils.IOUtils.GetSimpleExtension(name),
                RefId     = objId,
                RefGid    = objType
            };

            Add(filee);

            await CommitAsync();

            await IOUtils.WriteAllBytesAsync(Path.Combine(targetFolder, filee.Id.ToString()), file);
        }
コード例 #17
0
        /// <summary> Constructs this object from the raw data
        ///
        /// </summary>
        /// <param name="t">the raw data
        /// </param>
        public ObjRecord(Record t) : base(t)
        {
            sbyte[] data    = t.Data;
            int     objtype = IntegerHelper.getInt(data[4], data[5]);

            read = true;

            if (objtype == CHART.Value)
            {
                type = CHART;
            }
            else if (objtype == PICTURE.Value)
            {
                type = PICTURE;
            }

            objectId = IntegerHelper.getInt(data[6], data[7]);
        }
コード例 #18
0
    private void StartBefore()
    {
        if (GetComponent <ButtonTranspoter> () == null)
        {
            Debug.LogWarning("not attouch <ButtonTranspoter> script");
        }
        else if (GetComponent <ButtonTranspoter> ().type == null)
        {
            Debug.LogWarning("not set type data");
        }
        else
        {
            //type = GetComponent<ButtonTranspoter> ().type;
        }

        curEditData.editType = EditType.Text;
        curEditData.id       = 0;
        lineNum = 1;
        type    = baseObj.type;
    }
コード例 #19
0
        public async Task <dynamic> GetFile(int objId, ObjType objType, bool FileList = false)
        {
            try
            {
                if (!FileList)
                {
                    string fileName = await GetFileName(objId, objType);

                    return(await IOUtils.ReadAllBytesAsync(fileName));
                }
                else
                {
                    return(await GetFile(objId, objType));
                }
            }
            catch (Exception)
            {
                return(null);
            }
        }
コード例 #20
0
ファイル: UserData.cs プロジェクト: uwitec/ds568
    /// <summary>
    /// 检查对象是否为空,验证中如果发现Session["UserData"]为空则创建Session["UserData"],若为空则返回false,否则还回true
    /// </summary>
    /// <param name="ot"></param>
    /// <returns></returns>
    public static bool ChkObjNull(ObjType ot) {
        bool b = false;
        var ud = HttpContext.Current.Session["UserData"] as UserData;
        if (ud == null)
        {
            HttpContext.Current.Session["UserData"]=ud = new UserData();
            return b;
        }
        
        switch (ot) {
            case ObjType.会员信息:
                b = !object.Equals(ud.Member,null);
                break;
            case ObjType.购物车:
                b = !object.Equals(ud.ShoppingCart, null);
                break;
        }

        return b;
    }
コード例 #21
0
        public static ushort GenerateID(ObjType type)
        {
            if (!isInit)
            {
                ResetID();
                isInit = true;
            }

            ushort ret = count[(int)type];

            if (count[(int)type] == ranges[(int)type, 1])
            {
                count[(int)type] = ranges[(int)type, 0];
            }
            else
            {
                count[(int)type]++;
            }

            return(ret);
        }
コード例 #22
0
        public object GetObject()
        {
            if (IsNull)
            {
                return(null);
            }

            foreach (ThriftObject child in ChildObjs)
            {
                // Just load all it's properties
                child.GetObject();

                if (!child.IsNull)
                {
                    var propInfo = ObjType.GetProperty(child.PropertyName);
                    propInfo.SetValue(Obj, child.Obj, null);
                }
            }

            return(Obj);
        }
コード例 #23
0
    public GameObject GetObj(ObjType varType)
    {
        Stack <GameObject> tmpStack;

        if (pool.TryGetValue(varType, out tmpStack))
        {
            if (tmpStack.Count > 0)
            {
                var tmpObject = tmpStack.Pop();
                tmpObject.gameObject.SetActive(true);
                return(tmpObject);
            }
        }

        // 获取预设克隆一个
        var tmpPrefab = LoadPrefab(varType);
        var tmpObj    = GameObject.Instantiate(tmpPrefab);

        tmpObj.name = tmpPrefab.name;
        return(tmpObj);
    }
コード例 #24
0
    public void _GetInstanceGameObjectFromObjectData(ObjectsData data)
    {
        foreach (var item in GeneralController.instanceThisGameObject.GetComponent <CreateObjControll>().instanceCreateObjects)
        {
            targetObjType = item.GetComponent <ButtonTranspoter>().type;
            Debug.Log("searching object type == " + targetObjType);
            if (targetObjType == (ObjType)data.type)
            {
                Debug.Log("hit object type == " + targetObjType);
                targetObjOriginal = item;
                break;
            }
        }

        if (targetObjOriginal == null)
        {
            Debug.LogWarning("not found this argument type");
            return;
        }

        InstantiateObj();
    }
コード例 #25
0
    private void OnGUI()
    {
        #region 2、查找同名文件
        GUILayout.BeginVertical();

        objType = (ObjType)EditorGUILayout.EnumPopup("ObjectType", objType);

        EditorGUILayout.Space();

        filesPath = EditorGUILayout.TextField("Files Path", filesPath);

        GUILayout.BeginHorizontal();
        GUILayout.FlexibleSpace();
        if (GUILayout.Button("Browse", GUILayout.MaxWidth(75f)))
        {
            var newPath = EditorUtility.OpenFolderPanel("Files Folder", prefabsPath, string.Empty);
            if (!string.IsNullOrEmpty(newPath))
            {
                var gamePath = System.IO.Path.GetFullPath(".");
                gamePath = gamePath.Replace("\\", "/");
                if (newPath.StartsWith(gamePath) && newPath.Length > gamePath.Length)
                {
                    newPath = newPath.Remove(0, gamePath.Length + 1);
                }
                filesPath = newPath;
            }
        }
        GUILayout.EndHorizontal();

        EditorGUILayout.Space();
        if (GUILayout.Button("Find Same File Name(查找同名文件)"))
        {
            EditorApplication.delayCall += FindSameFileName;
        }

        GUILayout.EndVertical();
        #endregion
    }
コード例 #26
0
ファイル: Internal.cs プロジェクト: vebin/We7CMS_2010
 public void Build()
 {
     objType = Type.GetType(typeName);
     if (objType == null)
     {
         throw new DataException(ErrorCodes.UnkownObject);
     }
     foreach (PropertyInfo pi in objType.GetProperties())
     {
         if (propertyDict.ContainsKey(pi.Name))
         {
             propertyDict[pi.Name].Info = pi;
         }
     }
     foreach (Property p in propertyDict.Values)
     {
         if (p.Info == null)
         {
             string s = string.Format("{0}.{1}", ObjType.ToString(), p.Name);
             throw new DataException(s, ErrorCodes.UnkownProperty);
         }
     }
 }
コード例 #27
0
    /*
     *
     * public void FreeAll()
     * {
     *  foreach (var pool in poolList)
     *      pool.Value.FreeAll();
     * }
     *
     * public void FreeAfter(GameObject obj, float after)
     * {
     *  StartCoroutine(After(obj, after));
     * }
     *
     * //-----------------------------------------------------------------------------------
     * // coroutine functions
     * IEnumerator After(GameObject obj, float after)
     * {
     *  yield return new WaitForSeconds(after);
     *  Free(obj);
     * }
     */


    //hard coding
    ObjType GetObjType(int index)
    {
        ObjType objType = ObjType.playerAgent;

        switch (index)
        {
        case 0:
            objType = ObjType.zombie;
            break;

        case 1:
            objType = ObjType.shotParticle;
            break;

            /*
             * case 2:
             *  objType = ObjType.playerAgent;
             *  break;
             */
        }

        return(objType);
    }
コード例 #28
0
ファイル: FLibrary.cs プロジェクト: danielverh/OnTheFly
        public static object Is(this FObject obj, ObjType t)
        {
            switch (obj.Type)
            {
            case FObjectType.Int when t == ObjType.Number:
                return(obj.I64);

            case FObjectType.Float when t == ObjType.Number:
                return(obj.F64);

            case FObjectType.Array when t == ObjType.Array:
                return(obj.Array());

            case FObjectType.String when t == ObjType.String:
                return(obj.ToString());

            case FObjectType.Bool when t == ObjType.Bool:
                return(obj.BOOL);

            default:
                throw new Exception($"Not able to cast {obj.Type} to a {t} ");
            }
        }
コード例 #29
0
        private void ParseAttribute(string sAttr)
        {
            ObjType type = ObjType.None;

            if (sAttr[0] == '-')
            {
                type = ObjType.File;
            }
            if (sAttr[0] == 'd')
            {
                type = ObjType.Folder;
            }
            if (sAttr[0] == 'l')
            {
                type = ObjType.Link;
            }


            cbOwRead.Checked    = sAttr[1] == 'r';
            cbOwWrite.Checked   = sAttr[2] == 'w';
            cbOwExecute.Checked = (sAttr[3] == 'x') || (sAttr[3] == 's');

            cbGrRead.Checked    = sAttr[4] == 'r';
            cbGrWrite.Checked   = sAttr[5] == 'w';
            cbGrExecute.Checked = (sAttr[6] == 'x') || (sAttr[6] == 's');

            cbSUID.Checked = sAttr[3] == 's' || sAttr[3] == 'S';
            cbSGID.Checked = sAttr[6] == 's' || sAttr[6] == 'S';

            cbOtRead.Checked    = sAttr[7] == 'r';
            cbOtWrite.Checked   = sAttr[8] == 'w';
            cbOtExecute.Checked = (sAttr[9] == 'x') || (sAttr[9] == 't');

            cbSticky.Checked = sAttr[9] == 't' || sAttr[9] == 'T';

            tbOctal.Text = GetOctal();
        }
コード例 #30
0
    /// <summary>
    /// loads the XML file on object data
    /// </summary>
    public void LoadObjectXML()
    {
        XmlDocument xmlDoc = new XmlDocument();

        xmlDoc.Load(Application.dataPath + "/Resources/Data Files/Object.xml");
        XmlNode     root     = xmlDoc.DocumentElement;
        XmlNodeList nodeList = root.ChildNodes;

        foreach (XmlNode node in nodeList)
        {
            XmlNodeList innerNodeList = node.ChildNodes;
            foreach (XmlNode innerNode in innerNodeList)
            {
                UnityEngine.Object prefab = Resources.Load("Prefabs/" + innerNode.Name + "/" + innerNode.Attributes[0].Value);
                float   defaultY          = float.Parse(innerNode.Attributes[1].Value);
                ObjType objType           = ObjType.Default;
                foreach (ObjType objTypes in Enum.GetValues(typeof(ObjType)))
                {
                    if (innerNode.Name == objTypes.ToString())
                    {
                        objType = objTypes;
                    }
                }
                bool connectsToNeighbors = false;
                if (innerNode.Attributes.Count > 2 && innerNode.Attributes[2].Value == "true")
                {
                    connectsToNeighbors = true;
                }
                if (objType == ObjType.Default)
                {
                    Debug.Log("LoadFurnitureXML: There was an object with ObjType.Default, meaning it is probably an unadded or unrecognized object. It will still be add to the stringObjectMap, but probably need to be added to the rest of the system. It's supposed class name was " + innerNode.Name + " and it's subtype was " + innerNode.Attributes[0].Value + ".");
                }
                Object objInstance = Object.CreateInstance(objType, prefab, defaultY, connectsToNeighbors, innerNode.Attributes[0].Value);
                stringObjectMap.Add(innerNode.Attributes[0].Value, objInstance);
            }
        }
    }
コード例 #31
0
ファイル: Generator.cs プロジェクト: DDininD/Level0
    void InitObj(ObjType type, GameObject obj, Vector3 position)
    {
        var o = Instantiate(obj, position, Quaternion.identity);

        o.SetActive(false);
        switch (type)
        {
        case ObjType.Point:
            pointsPool.Add(o);
            break;

        case ObjType.Obstacle:
            obstaclesPool.Add(o);
            break;

        case ObjType.FootStep:
            footStepsPool.Add(o);
            break;

        case ObjType.Finder:
            findersPool.Add(o);
            break;
        }
    }
コード例 #32
0
ファイル: Compile.cs プロジェクト: Stu042/SimpleC
            public object DoForNum(NumAST num, object options = null)
            {
                ObjType ot = new ObjType();

                switch (num.token.tokenType)
                {
                case TokenType.IntNum:
                    ot = GetTypeFromName("int64");
                    break;

                case TokenType.FloatNum:
                    ot = GetTypeFromName("float64");
                    break;
                }
                ObjExpr oe = new ObjExpr()
                {
                    val = num.value,
                    isSimplifiedToNum = true,
                    isInt             = (num.token.tokenType == TokenType.IntNum),
                    objType           = ot
                };

                return(oe);
            }
コード例 #33
0
    private PropertyValues GetPropertyValues(CsvModel csvModel, 
      Vault vault,
      int classId,
      ObjType objType,
      Dictionary<string, ObjType> objectTypeLookup,
      Dictionary<string, PropertyDef> propertyDefLookupByName,
      Dictionary<int, PropertyDef> propertyDefLookupById)
    {
      var propertyValues = new MFilesAPI.PropertyValues();

      int index = 0;

      /* add the special class property */
      propertyValues.Add(index++, GetPropertyValue((int)MFilesAPI.MFBuiltInPropertyDef.MFBuiltInPropertyDefClass, MFDataType.MFDatatypeLookup, classId));

      ObjectClass objectClass = vault.ClassOperations.GetObjectClass(classId);

      /* if the object type has an owner */
      if (objType.HasOwnerType)
      {
        /* add a special property for the owner */
        var ownerObjType = vault.ObjectTypeOperations.GetObjectType(objType.OwnerType);
        var propertyDef = propertyDefLookupByName[ownerObjType.NameSingular];

        string value;
        if (csvModel.Values.TryGetValue(propertyDef.Name, out value))
        {
          object objValue = ConvertPropertyValue(propertyDef, value, vault);
          var propertyValue = GetPropertyValue(propertyDef.ID, propertyDef.DataType, objValue);
          propertyValues.Add(index++, propertyValue);
        }

      }

      foreach (AssociatedPropertyDef associatedPropertyDef in objectClass.AssociatedPropertyDefs)
      {
        /* get the property definition id */
        PropertyDef propertyDef = PropertyDefLookupById[associatedPropertyDef.PropertyDef];

        string value;
        if (csvModel.Values.TryGetValue(propertyDef.Name, out value))
        {
          /* try to convert the string to the ObjectData Type */
          object objValue = ConvertPropertyValue(propertyDef, value, vault);

          /* create the property value */
          PropertyValue propertyValue = GetPropertyValue(associatedPropertyDef.PropertyDef, propertyDef.DataType, objValue);

          Debug.WriteLine("property - Id: {0}, Name: {1}, DataType: {2}, Value: {3}", associatedPropertyDef.PropertyDef, propertyDef.Name, propertyDef.DataType, objValue);

          /* add the property value */
          propertyValues.Add(index++, propertyValue);

        }
      }

      return propertyValues;
    }
コード例 #34
0
ファイル: Parser.cs プロジェクト: mousetail/MouseEngine
        public pStatus Parse(string line, int linenumber)
        {
            Dictionary<string, string> v;
            if (internalParser != null)
            {
                pStatus w = internalParser.Parse(line, linenumber);
                if (w == pStatus.Finished)
                {
                    internalParser = null;
                }
                else
                {
                    return w;
                }
            }
            if (!started)
            {
                if (ObjectFirstLine.match(line))
                {
                    v = ObjectFirstLine.getArgs();
                    eobj = dtb.getObject(v["Name"],true);
                    eobj.setParent(dtb.getKind(v["kind"],false));
                    tobj = ObjType.Object;
                    started = true;
                    indent.expect(true, false, false);
                }
                else if (KindDefinition.match(line))
                {
                    v = KindDefinition.getArgs();
                    if (v != null)
                    {
                        eobj = dtb.getKind((string)v["Name"],true);
                        eobj.setParent(dtb.getKind((string)v["kind"],false));
                        tobj = ObjType.Kind;
                        started = true;
                        indent.expect(true, false, false);
                    }
                    else
                    {
                        Console.Write("StringError: Object ");
                        Console.Write(KindDefinition.GetType());
                        Console.Write(" returned invalid value after get args, should fail on match if args not valid.");
                    }

                }
                else
                {
                    throw new Errors.ItemMatchException("Expected either a kind of object definition, got " + line,
                        ObjectFirstLine.getLastError(),
                        KindDefinition.getLastError());
                }
            }
            else
            {
                int change = indent.doIndentation(line);

                string strippedLine = line.Trim(StringUtil.whitespace);

                if (change == -1)
                {
                    return pStatus.Finished;
                }

                else if (GlobalFunction.match(strippedLine))
                {
                    startLines[linenumber] = parseFunctionDefinition(strippedLine);
                    internalParser = new DummyParser(indent);

                    indent.expect(true, false, false);
                }
                else if (PropertyDefinition.match(strippedLine))
                {
                    v = PropertyDefinition.getArgs();
                    eobj.setAttr(v["property"], dtb.ParseAnything(v["value"]));

                    indent.expect(false, true, true);
                }
                else if (tobj == ObjType.Kind && NewAttribute.match(strippedLine))
                {
                    v = NewAttribute.getArgs();
                    ((KindPrototype)eobj).MakeAttribute((string)v["Name"], dtb.getKindAny( (string)v["kind"], false), true);

                    indent.expect(false, true, true);
                }
                else
                {

                    throw new Errors.ItemMatchException("Don't know what to do with line: " + line,
                        GlobalFunction.getLastError(),
                        PropertyDefinition.getLastError(),
                        NewAttribute.getLastError());

                }
            }

            return pStatus.Working;
        }
コード例 #35
0
			/// <summary/>
			public CacheInfo(ObjType type, int hvo, int flid, int ws, object obj)
				: this(type, hvo, flid, obj)
			{
				Ws = ws;
			}
コード例 #36
0
			/// <summary/>
			public CacheInfo(ObjType type, int hvo, int flid, object obj)
			{
				Type = type;
				Hvo = hvo;
				Flid = flid;
				Object = obj;
			}
コード例 #37
0
ファイル: DBObject.cs プロジェクト: RPGPlanner/RPGPlanner
 protected DBObject[] getAssociated(ObjType type, string refCol)
 {
     return DBObjectFactory.getCustomObjects(type, " WHERE " + refCol
         + "=" + dbID.ToString());
 }
コード例 #38
0
        /**
         * Constructs this object from the raw data
         *
         * @param t the raw data
         */
        public ObjRecord(Record t)
            : base(t)
        {
            byte[] data = t.getData();
            int objtype = IntegerHelper.getInt(data[4],data[5]);
            read = true;
            type = ObjType.getType(objtype);

            if (type == UNKNOWN)
                {
                //logger.warn("unknown object type code " + objtype);
                }

            objectId = (uint)IntegerHelper.getInt(data[6],data[7]);
        }
コード例 #39
0
 /**
  * Constructor
  *
  * @param objId the object id
  * @param t the object type
  */
 public ObjRecord(uint objId,ObjType t)
     : base(Type.OBJ)
 {
     objectId = objId;
     type = t;
 }
コード例 #40
0
ファイル: ShuttleCompiler.cs プロジェクト: Metapyziks/DCPU-16
 protected ObjType( String identifier, ICollection<VariableInfo> members, ObjType baseType = null )
     : base(identifier, members.Sum( x => x.Size ) + ( baseType != null ? baseType.Size : 0 ))
 {
     BaseType = baseType;
     HasBase = baseType != null;
     ushort offset = (ushort) ( HasBase ? BaseType.Size : 0 );
     foreach( VariableInfo member in members )
         myMembers.Add( member.Name, new VariableInfo( offset, member ) );
 }
コード例 #41
0
ファイル: ShuttleCompiler.cs プロジェクト: Metapyziks/DCPU-16
 public static void Register( ObjType type )
 {
     stTypes.Add( type.Identifier, type );
 }