AddRange() 공개 메소드

public AddRange ( ICollection collection, string type ) : int
collection ICollection
type string
리턴 int
        public override void OnEnter()
        {
            GameObject _go = Fsm.GetOwnerDefaultTarget(target);

            //Get all Proxy Components
            PlayMakerArrayListProxy[] proxies = _go.GetComponents <PlayMakerArrayListProxy>();

            if (reference.Value != "" || reference.Value != null)
            {
                //Check if more than one Proxy Component exists on the target
                if (proxies.Length > 0)
                {
                    foreach (PlayMakerArrayListProxy iProxy in proxies)
                    {
                        if (iProxy.referenceName == reference.Value)
                        {
                            proxy = iProxy;
                        }
                        else
                        {
                            // Debug.LogWarning("No Array List with the Reference " + reference.Value + " in " + _go.name + " found!");
                            // Finish();
                        }
                    }
                }
            }
            else
            {
                proxy = _go.GetComponent("" + "PlayMakerArrayListProxy") as PlayMakerArrayListProxy;
            }

            try
            {
                Dictionary <string, object> data;

                if (proxy == null)
                {
                    LogError("ArrayMaker Proxy is null!");
                }

                if (GDEDataManager.Get(ItemName.Value, out data) && proxy != null)
                {
                    List <string> val;
                    data.TryGetStringList(FieldName.Value, out val);

                    proxy.AddRange(val, string.Empty);
                }
                else
                {
                    //LogError(string.Format(GDMConstants.ErrorLoadingValue, "string array", ItemName.Value, FieldName.Value));
                }
            } catch (System.Exception ex)
            {
                UnityEngine.Debug.LogException(ex);
            } finally
            {
                Finish();
            }
        }
예제 #2
0
        public override void OnEnter()
        {
            List <string> allSchemas = GDEHelpers.GDEGetAllDataBy(GDEDataType.Schema).ToStringList();

            if (Fsm.GetOwnerDefaultTarget(gameObject).GetComponent <PlayMakerArrayListProxy>() != null)
            {
                PlayMakerArrayListProxy _proxy = GetArrayListProxyPointer(Fsm.GetOwnerDefaultTarget(gameObject), reference.Value, false);
                _proxy.AddRange(allSchemas, string.Empty);
            }

            if (viaProxyReference != null)
            {
                viaProxyReference.AddRange(allSchemas, string.Empty);
            }

            if (storeAsString != null)
            {
                foreach (string schema in allSchemas)
                {
                    if (schema == (string)allSchemas.ToArray().GetValue(allSchemas.ToArray().Length - 1))
                    {
                        storeAsString.Value = string.Concat(storeAsString.Value + schema);
                    }
                    else
                    {
                        storeAsString.Value = string.Concat(storeAsString.Value + schema + ", ");
                    }
                }

                storeAsString.Value.Remove(storeAsString.Value.Length - 2);
            }

            if (storeAsStringArray != null)
            {
                storeAsStringArray.Values = allSchemas.ToArray();
            }
        }
예제 #3
0
        public override void OnEnter()
        {
            List <string> allItems      = new List <string>();
            string        currentSchema = "";

            foreach (KeyValuePair <string, object> pair in GDEDataManager.DataDictionary)
            {
                if (pair.Key.StartsWith(GDMConstants.SchemaPrefix))
                {
                    continue;
                }

                //skip if not in the specified schema
                if (schema.Value != null && schema.Value != "")
                {
                    //get all values of current Item
                    Dictionary <string, object> currentDataSet = pair.Value as Dictionary <string, object>;
                    //get Schema of current Item
                    currentDataSet.TryGetString(GDMConstants.SchemaKey, out currentSchema);
                    //check if current Schema equals specified one
                    if (!(currentSchema == schema.Value))
                    {
                        continue;
                    }
                }
                //add current Item to List
                allItems.Add(pair.Key);
            }

            if (Fsm.GetOwnerDefaultTarget(gameObject).GetComponent <PlayMakerArrayListProxy>() != null)
            {
                PlayMakerArrayListProxy _proxy = GetArrayListProxyPointer(Fsm.GetOwnerDefaultTarget(gameObject), reference.Value, false);
                _proxy.AddRange(allItems, string.Empty);
            }

            if (viaProxyReference != null)
            {
                viaProxyReference.AddRange(allItems, string.Empty);
            }

            if (storeAsString != null)
            {
                foreach (string schema in allItems)
                {
                    if (schema == allItems.ToArray().GetValue(allItems.ToArray().Length - 1).ToString())
                    {
                        storeAsString.Value = string.Concat(storeAsString.Value + schema);
                    }
                    else
                    {
                        storeAsString.Value = string.Concat(storeAsString.Value + schema + ", ");
                    }
                }
            }

            if (storeAsStringArray != null)
            {
                storeAsStringArray.Values = allItems.ToArray();
            }

            Finish();
        }