public void OverwriteWith(LocalizationItemGroup source, bool FullForceOverwrite = false)
 {
     this.groupID = source.groupID;
     if (FullForceOverwrite)
     {
         for (int i = storedItems.Count - 1; i >= 0; i--)
         {
             storedItems[i].Destroy();
         }
         for (int i = 0; i < source.storedItems.Count; i++)
         {
             source.storedItems[i].CloneTo(this);
         }
     }
     else
     {
         //For each type of items
         //1. Check if any item with same ID exist in this group
         //2. If no result from step 1, check if any item with same ID exist in the database
         //3. If any result from step 1/2, overwrite the data from source
         //4. If no result from step 1/2, clone the item from source
         foreach (LocalizationObjectItem item in source.storedItems)
         {
             LocalizationObjectItem temp = this.storedItems.Find(e => e.ID.Equals(item.ID));
             if (temp == null)
             {
                 if (this.database.allItemCache.Contains(item.ID))
                 {
                     temp = this.database.allItemCache[item.ID];
                 }
             }
             if (temp != null)
             {
                 temp._ID          = item.ID;
                 temp.StoredString = item.StoredString;
                 temp.Storage      = item.Storage;
             }
             else
             {
                 item.CloneTo(this);
             }
         }
     }
 }
Beispiel #2
0
        public static void Draw(LocalizationObjectItem drawing,
                                LocalizationObjectItem reference = null,
                                System.Action <LocalizationObjectItem> OnContentChanged           = null,
                                System.Action <LocalizationObjectItem> OnItemIDEdited             = null,
                                System.Action <LocalizationObjectItem> OnItemRemovingFromGroup    = null,
                                System.Action <LocalizationObjectItem> OnItemRemovedAndDestroying = null,
                                params GUILayoutOption[] areaOptions)
        {
            drawing.OnContentChanged       = OnContentChanged;
            drawing.OnIDSet                = OnItemIDEdited;
            drawing.OnRemovedAndDestroying = OnItemRemovedAndDestroying;
            drawing.OnRemovingFromGroup    = OnItemRemovingFromGroup;

            if (drawerDict == null)
            {
                drawerDict = new Dictionary <string, ItemDrawerBase>();
                foreach (ItemTypeSupport its in LocalizaEditor.editorConfig.Supported)
                {
                    if (its.drawerType != null)
                    {
                        drawerDict.Add(its.target.ToString(), System.Activator.CreateInstance(its.drawerType) as ItemDrawerBase);
                    }
                }
            }
            if (!drawerDict.ContainsKey(drawing.ItemType))
            {
                return;
            }
            else if (drawerDict[drawing.ItemType] == null)
            {
                return;
            }
            else
            {
                drawerDict[drawing.ItemType].Draw(drawing, reference, areaOptions);
            }
        }
Beispiel #3
0
 public static void Draw(LocalizationObjectItem drawing, LocalizationObjectItem reference = null, params GUILayoutOption[] areaOptions)
 {
     Draw(drawing, reference, null, null, null, null, areaOptions);
 }
Beispiel #4
0
 public abstract void Draw(LocalizationObjectItem drawing, LocalizationObjectItem reference = null, params GUILayoutOption[] areaOptions);