Example #1
0
        public void Init(string Name)
        {
            ProjectileContext GlobalProjectileContext = new ProjectileContext();
            ProjectileParams  MagicProjectileParams   = new ProjectileParams(GlobalProjectileContext);

            MagicUserContext GlobalMagicContext = new MagicUserContext();
            MagicUserParams  MagicParams        = new MagicUserParams(GlobalMagicContext);

            Dictionary <string, MagicElement> DicMagicElement = MagicElement.LoadRegularCore(MagicParams);

            foreach (KeyValuePair <string, MagicElement> ActiveMagicElement in MagicElement.LoadProjectileCores(MagicParams, MagicProjectileParams))
            {
                DicMagicElement.Add(ActiveMagicElement.Key, ActiveMagicElement.Value);
            }
            foreach (KeyValuePair <string, MagicElement> ActiveMagicElement in MagicElement.LoadElements(MagicParams))
            {
                DicMagicElement.Add(ActiveMagicElement.Key, ActiveMagicElement.Value);
            }

            ActiveSpell               = new MagicSpell(Name, null, GlobalMagicContext, DicMagicElement);
            ActiveMagicEditor         = new MagicEditor(ActiveSpell, GlobalProjectileContext, MagicProjectileParams.SharedParams);
            ActiveMagicEditor.Content = new ContentManager(Services);
            ActiveMagicEditor.Content.RootDirectory = "Content";
            Services.AddService(GraphicsDevice);
            ActiveMagicEditor.Load();
        }
Example #2
0
 public Magic(int[] numberofdices, int[] dicenumbers, int[] bonus, MagicElement[] elements, int manacost, string name)
 {
     this.bonus = bonus;
     this.dicenumbers = dicenumbers;
     this.elements = elements;
     this.name = name;
     this.numberofdices = numberofdices;
 }
Example #3
0
 void createMagic2()
 {
     if (!GameManage.isMagicIng)
     {
         GameManage.isMagicIng = true;
         Instantiate(magicElement, new Vector3(0f, 0f, 0), Quaternion.identity);
         MagicElement me = magicElement.GetComponent <MagicElement>();
         me.way = 1;
         if (GameManage.currMagicLevel == 2)
         {
             Instantiate(magicElement, new Vector3(0f, 0f, 0), Quaternion.identity);
             me     = magicElement.GetComponent <MagicElement>();
             me.way = -1;
         }
     }
 }
Example #4
0
    // Operation
    public void extend_function(MagicElement ele)
    {
        if (ele_count >= Consts.ele_spin_max_elements)
        {
            Debug.Log("Too many elements in one function");
            return;
        }
        if (!MagicElements.instance.valid_elements[idx].is_function)
        {
            Debug.Log("You can only edit magic elements");
            return;
        }

        function_list[ele_count] = ele.idx;
        add_spin_elements(ele.spin_prefab);
        ele_count += 1;
    }
        public UnitMagic(string Name, ContentManager Content, BattleMap Map, Dictionary <string, Unit> DicUnitType, Dictionary <string, BaseSkillRequirement> DicRequirement, Dictionary <string, BaseEffect> DicEffect)
            : base(Name)
        {
            this.Map                = Map;
            ArrayCharacterActive    = new Core.Characters.Character[0];
            ListMagicSpell          = new List <MagicSpell>();
            GlobalProjectileContext = new ProjectileContext();
            MagicProjectileParams   = new ProjectileParams(GlobalProjectileContext);

            GlobalMagicContext = new MagicUserContext();
            MagicParams        = new MagicUserParams(GlobalMagicContext);

            Dictionary <string, MagicElement> DicMagicElement = MagicElement.LoadRegularCore(MagicParams);

            foreach (KeyValuePair <string, MagicElement> ActiveMagicElement in MagicElement.LoadProjectileCores(MagicParams, MagicProjectileParams))
            {
                DicMagicElement.Add(ActiveMagicElement.Key, ActiveMagicElement.Value);
            }
            foreach (KeyValuePair <string, MagicElement> ActiveMagicElement in MagicElement.LoadElements(MagicParams))
            {
                DicMagicElement.Add(ActiveMagicElement.Key, ActiveMagicElement.Value);
            }

            FileStream   FS = new FileStream("Content/Units/Magic/" + Name + ".peu", FileMode.Open, FileAccess.Read);
            BinaryReader BR = new BinaryReader(FS, Encoding.UTF8);

            BR.BaseStream.Seek(0, SeekOrigin.Begin);

            OriginalUnitName = BR.ReadString();
            if (!string.IsNullOrEmpty(OriginalUnitName) && DicUnitType != null)
            {
                OriginalUnit = Unit.FromFullName(OriginalUnitName, Content, DicUnitType, DicRequirement, DicEffect);
                _UnitStat    = OriginalUnit.UnitStat;
            }

            int ListMagicSpellCount = BR.ReadInt32();

            ListMagicSpell = new List <MagicSpell>(ListMagicSpellCount);
            for (int S = 0; S < ListMagicSpellCount; ++S)
            {
                ListMagicSpell.Add(new MagicSpell(BR.ReadString(), this, GlobalMagicContext, DicMagicElement));
            }

            if (Content != null)
            {
                string UnitDirectory = Path.GetDirectoryName("Content\\Units\\Normal\\" + Name);
                string XNADirectory  = UnitDirectory.Substring(8);

                if (File.Exists(UnitDirectory + "\\Map Sprite\\" + Name + ".xnb"))
                {
                    SpriteMap = Content.Load <Texture2D>(XNADirectory + "\\Map Sprite\\" + this.FullName);
                }
                else
                {
                    SpriteMap = Content.Load <Texture2D>("Units/Default");
                }

                if (File.Exists(UnitDirectory + "\\Unit Sprite\\" + Name + ".xnb"))
                {
                    SpriteUnit = Content.Load <Texture2D>(XNADirectory + "\\Unit Sprite\\" + this.FullName);
                }
            }

            FS.Close();
            BR.Close();
        }
 public void TestMagicLoad()
 {
     MagicElement.LoadAllMagicElements();
 }