Ejemplo n.º 1
0
 private static void AddToCache(SimpleCache cache, string key, BaseDef def)
 {
     AddToTypeCache(def);
     if (key == null)
     {
         key = "";
     }
     if (!cache.TryGetValue(key, out object data))
     {
         cache.Add(key, def);
         return;
     }
     if (data is BaseDef[] list)
     {
         var len     = list.Length;
         var newList = new BaseDef[len + 1];
         Array.Copy(list, newList, len);
         newList[len] = def;
         cache[key]   = newList;
     }
     else
     {
         cache[key] = new BaseDef[] { data as BaseDef, def }
     };
 }
Ejemplo n.º 2
0
 private static void AddToCache(BaseDef def)
 {
     if (def == null)
     {
         return;
     }
     AddToCache(ByName, def.name, def);
     AddToCache(ByPath, def.ResourcePath, def); // path has too many dups
 }
Ejemplo n.º 3
0
        private static void AddToTypeCache(BaseDef def)
        {
            Type t = def.GetType();

            do
            {
                if (!ByType.TryGetValue(t, out List <BaseDef> list))
                {
                    ByType[t] = list = new List <BaseDef>();
                }
                list.Add(def);
                t = t.BaseType;
            } while (t != typeof(BaseDef));
        }
Ejemplo n.º 4
0
    // Use this for initialization
    void Start()
    {
        dr   = GetComponent <DragRacer>();
        bd   = GetComponent <BaseDef>();
        kd   = GetComponent <KingdomClicker>();
        tg   = GetComponent <TypingGame>();
        grm  = GetComponent <GetRevengeMain>();
        ec   = GetComponent <EnergyCrysis>();
        cog  = GetComponent <COG>();
        tbui = GetComponent <TerrorBirdsUI>();
        bj   = GetComponent <BlackJack>();
        rpg  = GetComponent <RPGMain>();
//		brickDestroyer = GetComponent<BrickBreaker>();
        UpdateGamesList();
    }
Ejemplo n.º 5
0
 private void SimpleBaseDef(string tag, BaseDef def, bool selfClose = true) => StartTag(tag, selfClose, "name", def.name, "guid", def.Guid);
Ejemplo n.º 6
0
 public void InitFromSceneDef(BaseDef sceneDef)
 {
 }
Ejemplo n.º 7
0
        public void Save(int ID)
        {
            using (XmlWriter writer = XmlWriter.Create(Paths.DataPath + "Dex\\" + ID.ToString() + "-" + FormIndex + ".xml", Logger.XmlWriterSettings)) {
                writer.WriteStartDocument();
                writer.WriteStartElement("FormEntry");

                #region Basic data
                writer.WriteStartElement("General");
                writer.WriteElementString("FormName", FormName);
                writer.WriteElementString("Height", Height.ToString());
                writer.WriteElementString("Weight", Weight.ToString());
                writer.WriteElementString("Male", MaleRatio.ToString());
                writer.WriteElementString("Female", FemaleRatio.ToString());
                writer.WriteElementString("RecruitRate", RecruitRate.ToString());
                writer.WriteElementString("BodyStyle", BodyStyle.ToString());
                writer.WriteEndElement();
                #endregion
                #region Stats
                writer.WriteStartElement("BaseStats");
                writer.WriteElementString("HP", BaseHP.ToString());
                writer.WriteElementString("Atk", BaseAtk.ToString());
                writer.WriteElementString("Def", BaseDef.ToString());
                writer.WriteElementString("SpAtk", BaseSpAtk.ToString());
                writer.WriteElementString("SpDef", BaseSpDef.ToString());
                writer.WriteElementString("Speed", BaseSpeed.ToString());
                writer.WriteEndElement();
                #endregion
                #region Pokemon Info
                writer.WriteStartElement("FormInfo");
                writer.WriteElementString("Type1", Type1.ToString());
                writer.WriteElementString("Type2", Type2.ToString());
                writer.WriteElementString("Ability1", Ability1);
                writer.WriteElementString("Ability2", Ability2);
                writer.WriteElementString("Ability3", Ability3);
                writer.WriteElementString("Exp", ExpYield.ToString());
                writer.WriteEndElement();
                #endregion
                #region Moves
                writer.WriteStartElement("Moves");
                #region Level Up Moves
                writer.WriteStartElement("LevelUpMoves");
                for (int i = 0; i < LevelUpMoves.Count; i++)
                {
                    writer.WriteStartElement("LevelUpMove");
                    writer.WriteElementString("Level", LevelUpMoves[i].Level.ToString());
                    writer.WriteElementString("Name", GameData.MoveDex[LevelUpMoves[i].Move].Name);
                    writer.WriteEndElement();
                }
                writer.WriteEndElement();
                #endregion
                #region TM Moves
                writer.WriteStartElement("TMMoves");
                for (int i = 0; i < TMMoves.Count; i++)
                {
                    writer.WriteStartElement("TMMove");
                    writer.WriteElementString("Name", GameData.MoveDex[TMMoves[i]].Name);
                    writer.WriteEndElement();
                }
                writer.WriteEndElement();
                #endregion
                #region Egg Moves
                writer.WriteStartElement("EggMoves");
                for (int i = 0; i < EggMoves.Count; i++)
                {
                    writer.WriteStartElement("EggMove");
                    writer.WriteElementString("Name", GameData.MoveDex[EggMoves[i]].Name);
                    writer.WriteEndElement();
                }
                writer.WriteEndElement();
                #endregion
                #region DW Moves
                writer.WriteStartElement("DWMoves");
                for (int i = 0; i < DWMoves.Count; i++)
                {
                    writer.WriteStartElement("DWMove");
                    writer.WriteElementString("Name", GameData.MoveDex[DWMoves[i]].Name);
                    writer.WriteEndElement();
                }
                writer.WriteEndElement();
                #endregion
                #region Event Moves
                writer.WriteStartElement("EventMoves");
                for (int i = 0; i < EventMoves.Count; i++)
                {
                    writer.WriteStartElement("EventMove");
                    writer.WriteElementString("Name", GameData.MoveDex[EventMoves[i]].Name);
                    writer.WriteEndElement();
                }
                writer.WriteEndElement();
                #endregion
                writer.WriteEndElement();
                #endregion

                writer.WriteEndElement();
                writer.WriteEndDocument();
            }
        }
Ejemplo n.º 8
0
 public DerivedDef(BaseDef bd)
 {
     this.Id = bd.Id;
 }
Ejemplo n.º 9
0
 public BaseView(BaseDef bd)
 {
     Id = bd.Id;
 }