Beispiel #1
0
//#endif


    public void loadSnapshot(FakePlayerSaver saver)
    {
//#if UNITY_EDITOR
        if (saver.towers.Count == 0)
        {
            return;
        }
        Init();
        current_snapshot  = saver.current_snapshot;
        snapshot_filename = saver.snapshot_filename;
        ff = saver.ff;
        force_all_towers   = saver.force_all_towers;
        force_all_upgrades = saver.force_all_upgrades;

        upgrades = CloneUtil.copyList <TowerUpgrade>(saver.upgrades);
        for (int i = 0; i < towers.Count; i++)
        {
            towers[i].loadSnapshot(saver.towers[i]);
        }

        foreach (Firearm f in Peripheral.Instance.firearms)
        {
            if (f.toy.toy_type == ToyType.Temporary)
            {
                ghosts.Add(f.toy);
            }
        }

//#endif
    }
Beispiel #2
0
 public object Clone() => new PmxMorphData()
 {
     MorphName  = MorphName,
     MorphNameE = MorphNameE,
     SlotType   = SlotType,
     MorphArray = CloneUtil.CloneArray(MorphArray),
 };
Beispiel #3
0
 public object Clone()
 {
     return(new PmxBoneData()
     {
         BoneName = BoneName,
         BoneNameE = BoneNameE,
         Pos = Pos,
         BoneId = BoneId,
         ParentId = ParentId,
         ArrowId = ArrowId,
         Flag = Flag,
         ExtraParentId = ExtraParentId,
         Depth = Depth,
         PosOffset = PosOffset,
         LinkParentId = LinkParentId,
         LinkWeight = LinkWeight,
         AxisVec = AxisVec,
         LocalAxisVecX = LocalAxisVecX,
         LocalAxisVecZ = LocalAxisVecZ,
         IkTargetId = IkTargetId,
         IkDepth = IkDepth,
         AngleLimit = AngleLimit,
         IkChilds = CloneUtil.CloneArray(IkChilds),
     });
 }
        object ICloneable.Clone()
        {
            // It's slow. So in case of requiring performance, override this deep clone method by your code.
            var clone = CloneUtil.MemoryClone(this) as StateBase;

            clone.Id = this.Id;
            return(clone);
        }
Beispiel #5
0
    public skill_stat_group DeepClone()
    {
        skill_stat_group my_clone = new skill_stat_group();

        my_clone.effect_type = this.effect_type;
        my_clone.skill_stats = CloneUtil.copyArray <skill_stat>(this.skill_stats);
        return(my_clone);
    }
Beispiel #6
0
 public object Clone() => new PmxSlotData()
 {
     SlotName   = SlotName,
     SlotNameE  = SlotNameE,
     NormalSlot = NormalSlot,
     Type       = Type,
     Indices    = CloneUtil.CloneArray(Indices),
 };
Beispiel #7
0
 public override PmxMaterialData[] CreateMaterials(World wolrd, ShotProperty prop)
 {
     PmxMaterialData[] result = new PmxMaterialData[OriginalData.MaterialArray.Length];
     for (int i = 0; i < result.Length; i++)
     {
         result[i] = CloneUtil.Clone(OriginalData.MaterialArray[i]);
     }
     return(result);
 }
Beispiel #8
0
 private void JobEditorClicked(object param)
 {
     this.jobMemento = new JobMemento(this.SelectedJob);
     Dialogs.DialogService.DialogResult result = this.dialogFacade.ShowJobEditorDetail("Job Editor Detail", param as Window, this.SelectedJob);
     if (result == Dialogs.DialogService.DialogResult.No)
     {
         CloneUtil.CopyProperties(jobMemento.Job, this.SelectedJob);
     }
 }
 private void EconomyEditorClicked(object param)
 {
     this.ProductMemento = new ProductMemento(this.SelectedProduct);
     Dialogs.DialogService.DialogResult result = this.dialogFacade.ShowEconomyEditorDetail("Product Editor Detail", param as Window, this.SelectedProduct);
     if (result == Dialogs.DialogService.DialogResult.No)
     {
         CloneUtil.CopyProperties(ProductMemento.Product, this.SelectedProduct);
     }
 }
Beispiel #10
0
 public override PmxBoneData[] CreateBones(World wolrd, ShotProperty prop)
 {
     PmxBoneData[] result = new PmxBoneData[Data.BoneArray.Length];
     for (int i = 0; i < result.Length; i++)
     {
         result[i] = CloneUtil.Clone(Data.BoneArray[i]);
     }
     return(result);
 }
Beispiel #11
0
 public override PmxVertexData[] CreateVertices(World wolrd, ShotProperty prop)
 {
     PmxVertexData[] result = new PmxVertexData[OriginalData.VertexArray.Length];
     for (int i = 0; i < result.Length; i++)
     {
         var clone = result[i] = CloneUtil.Clone(OriginalData.VertexArray[i]);
         clone.Pos = (Vector4)clone.Pos * prop.Scale;
     }
     return(result);
 }
Beispiel #12
0
        public void GameManager_CloneGame()
        {
            Game gameBefore = gm.CurrentGame;
            Game gameAfter  = CloneUtil.Clone(gameBefore);

            // On modifie volontairement le game pour vérifier qu'il s'agit bien d'une copie
            gameBefore.nextUnit();

            Assert.IsFalse(gameBefore.Equals(gameAfter));
        }
Beispiel #13
0
    public static List <Defense> getDefenses(EnemyType type, bool clone)
    {
        if (enemyDefenses == null)
        {
            initDefenses();
        }

        List <Defense> defenses = enemyDefenses[type];

        return((clone) ? CloneUtil.copyList <Defense>(defenses) : defenses);
    }
Beispiel #14
0
 public object Clone() => new PmxModelData()
 {
     Header        = CloneUtil.Clone(Header),
     VertexArray   = CloneUtil.CloneArray(VertexArray),
     MaterialArray = CloneUtil.CloneArray(MaterialArray),
     BoneArray     = CloneUtil.CloneArray(BoneArray),
     MorphArray    = CloneUtil.CloneArray(MorphArray),
     SlotArray     = CloneUtil.CloneArray(SlotArray),
     VertexIndices = CloneUtil.CloneArray(VertexIndices),
     TextureFiles  = CloneUtil.CloneArray(TextureFiles),
 };
 private void EconomyEditorCopyClicked(object param)
 {
     if (this.SelectedProduct != null)
     {
         Product newProduct = new Product();
         CloneUtil.CopyProperties(this.SelectedProduct, newProduct);
         newProduct.Id = newProduct.Id + "_copy";
         this.Galaxy.Products.Add(newProduct);
         this.SelectedProduct = newProduct;
     }
 }
Beispiel #16
0
 private void JobEditorCopyClicked(object param)
 {
     if (this.SelectedJob != null)
     {
         Job newJob = new Job();
         CloneUtil.CopyProperties(this.SelectedJob, newJob);
         newJob.Id = newJob.Id + "_copy";
         this.Galaxy.Jobs.Add(newJob);
         this.SelectedJob = newJob;
     }
 }
 // Token: 0x06000FE0 RID: 4064 RVA: 0x0006580C File Offset: 0x00063A0C
 public static void CopyProperties <T>(T config, BaseUberStrikeItemView item) where T : BaseUberStrikeItemView
 {
     CloneUtil.CopyAllFields <BaseUberStrikeItemView>(config, item);
     foreach (FieldInfo fieldInfo in ItemConfigurationUtil.GetAllFields(config.GetType()))
     {
         string customPropertyName = ItemConfigurationUtil.GetCustomPropertyName(fieldInfo);
         if (!string.IsNullOrEmpty(customPropertyName) && item.CustomProperties != null && item.CustomProperties.ContainsKey(customPropertyName))
         {
             fieldInfo.SetValue(config, ItemConfigurationUtil.Convert(item.CustomProperties[customPropertyName], fieldInfo.FieldType));
         }
     }
 }
Beispiel #18
0
    public InitWavelet DeepClone()
    {
        InitWavelet my_clone = new InitWavelet();

        my_clone.enemies       = CloneUtil.copyArray <InitEnemyCount>(enemies);
        my_clone.interval      = this.interval;
        my_clone.lull          = this.lull;
        my_clone.monster_count = this.monster_count;
        my_clone.run_time      = this.run_time;
        my_clone.end_wait      = this.end_wait;

        return(my_clone);
    }
Beispiel #19
0
    // Token: 0x06001C26 RID: 7206 RVA: 0x0008F1C0 File Offset: 0x0008D3C0
    public static T Clone <T>(T instance) where T : class
    {
        Type            type        = instance.GetType();
        ConstructorInfo constructor = type.GetConstructor(new Type[0]);

        if (constructor != null)
        {
            T t = constructor.Invoke(new object[0]) as T;
            CloneUtil.CopyAllFields <T>(t, instance);
            return(t);
        }
        return((T)((object)null));
    }
Beispiel #20
0
 public object Clone() => new PmxVertexData()
 {
     Pos        = Pos,
     Normal     = Normal,
     Uv         = Uv,
     Edge       = Edge,
     WeightType = WeightType,
     BoneId     = CloneUtil.CloneArray(BoneId),
     Weight     = CloneUtil.CloneArray(Weight),
     Sdef_c     = Sdef_c,
     Sdef_r0    = Sdef_r0,
     Sdef_r1    = Sdef_r1,
 };
Beispiel #21
0
    //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%            LOAD WAVES

    public void LoadWaves(InitLevel level)
    {
        //random wave mode is not supported!!!
        List <int> pathlist = new List <int>();

        LevelMod level_mod = Peripheral.Instance.getLevelMod();

        Moon.Instance.Waves = new List <wave>();


        for (int x = 0; x < level.waves.Length; x++)
        {
            InitWave init_wave = level.waves[x];
            int      i         = 1;
            wave     mywave    = new wave();
            mywave.points = init_wave.points;
            mywave.xp     = 5f;

            for (int y = 0; y < init_wave.wavelets.Length; y++)
            {
                InitWavelet init_wavelet = init_wave.wavelets[y];
                init_wavelet.Modify(level_mod.wave_time_multiplier);
                mywave.add_wavelet(init_wavelet, false);
                i++;
            }
            mywave.wait = init_wave.wait_time;

            TimeName time_start = EnumUtil.EnumFromString <TimeName>(init_wave.time_start, TimeName.Null);
            TimeName time_end   = EnumUtil.EnumFromString <TimeName>(init_wave.time_end, TimeName.Null);
            if (time_start != TimeName.Null && time_end != TimeName.Null)
            {
                mywave.SetTime(time_start, time_end, init_wave.time_change_percent);
            }
            else if (time_start != TimeName.Null)
            {
                mywave.SetStartTime(time_start);
            }
            else
            {
                mywave.SetStartTime(TimeName.Day);
                // Debug.Log("WAVE missing start time! Assuming Day\n");
            }
            //mywave.adjust_total_run_time();
            Moon.Instance.AddWave(mywave);
        }
        if (LevelBalancer.Instance.am_enabled)
        {
            LevelBalancer.Instance.original_waves = CloneUtil.copyList <wave>(Moon.Instance.Waves);
            LevelBalancer.Instance.AutoSetPaths();
        }
    }
Beispiel #22
0
    public tower_stats DeepClone()
    {
        tower_stats my_clone = new tower_stats();

        my_clone.id          = this.id;
        my_clone.name        = string.Copy(this.name);
        my_clone.skill_stats = CloneUtil.copyArray <skill_stat_group>(this.skill_stats);
        my_clone.hits        = this.hits;
        my_clone.shots_fired = this.shots_fired;
        my_clone.lava_count  = this.lava_count;
        my_clone.island_name = string.Copy(this.island_name);

        return(my_clone);
    }
Beispiel #23
0
 public object Clone()
 {
     return(new PmxModelData()
     {
         Header = CloneUtil.Clone(Header),
         VertexArray = CloneUtil.CloneArray(VertexArray),
         MaterialArray = CloneUtil.CloneArray(MaterialArray),
         BoneArray = CloneUtil.CloneArray(BoneArray),
         MorphArray = CloneUtil.CloneArray(MorphArray),
         SlotArray = CloneUtil.CloneArray(SlotArray),
         RigidArray = CloneUtil.CloneArray(RigidArray),
         JointArray = CloneUtil.CloneArray(JointArray),
         VertexIndices = CloneUtil.CloneArray(VertexIndices),
         TextureFiles = CloneUtil.CloneArray(TextureFiles),
     });
 }
Beispiel #24
0
    public enemyStats DeepClone()
    {
        enemyStats my_clone = new enemyStats();

        my_clone.name         = string.Copy(this.name);
        my_clone.target       = this.target;
        my_clone.ammo         = this.ammo;
        my_clone.remaining_xp = this.remaining_xp;
        my_clone.init_xp      = this.init_xp;
        my_clone.inventory    = CloneUtil.copyList(this.inventory);
        my_clone.mass         = this.mass;
        my_clone.speed        = this.speed;
        my_clone.defenses     = CloneUtil.copyList(defenses);
        //my_clone.defense = this.defense;
        //my_clone.vf_defense = this.vf_defense;
        return(my_clone);
    }
Beispiel #25
0
 public void ToggleMe()
 {
     am_enabled = !am_enabled;
     panel.SetActive(am_enabled);
     if (am_enabled)
     {
         Init();
         LevelBalancer.Instance.original_waves = CloneUtil.copyList <wave>(Moon.Instance.Waves);
         LevelBalancer.Instance.AutoSetPaths();
         EagleEyes.Instance.WaveButton(false);
         Moon.Instance.abortWave();
     }
     else
     {
         EagleEyes.Instance.WaveButton(true);
     }
 }
Beispiel #26
0
    public wave DeepClone()
    {
        wave my_clone = new wave();

        my_clone.wavelets       = CloneUtil.copyList <InitWavelet>(wavelets);
        my_clone.wait           = this.wait;
        my_clone.retry          = this.retry;
        my_clone.total_run_time = this.total_run_time;
        my_clone.points         = this.points;
        my_clone.xp             = this.xp;

        my_clone.monster_count       = this.monster_count;
        my_clone.time_name_start     = this.time_name_start;
        my_clone.time_name_end       = this.time_name_end;
        my_clone.time_change_percent = this.time_change_percent;
        my_clone.time_start          = this.time_start;
        my_clone.time_change_at      = this.time_change_at;
        my_clone.enemies_left        = this.enemies_left;

        return(my_clone);
    }
Beispiel #27
0
    public FakePlayerSaver getSnapshot()
    {
        FakePlayerSaver saver = new FakePlayerSaver();

//#if UNITY_EDITOR
        saver.current_snapshot  = current_snapshot;
        saver.snapshot_filename = snapshot_filename;
        saver.ff                 = ff;
        saver.upgrades           = CloneUtil.copyList <TowerUpgrade>(upgrades);
        saver.force_all_upgrades = force_all_upgrades;
        saver.force_all_towers   = force_all_towers;

        List <BuildTowerSaver> towers_saver = new List <BuildTowerSaver>();

        for (int i = 0; i < towers.Count; i++)
        {
            towers_saver.Add(towers[i].getSnapshot());
        }
        saver.towers = towers_saver;

//#endif
        return(saver);
    }
Beispiel #28
0
    public void ChangeMe(bool revert)
    {
        am_transformed = !revert;
        is_active      = am_transformed;
        TransformedProperties tf = (revert) ? before : getProperties(after);

        setCollider(tf);


        my_hitme.sprite_renderer.sprite              = tf.sprite;
        my_hitme.my_ai.speed                         = tf.speed;
        my_hitme.my_ai.current_speed                 = tf.speed;
        my_hitme.my_ai.rotation_interval             = tf.rotation_interval;
        my_hitme.my_ai.rotation_inverse_speed_factor = tf.rotation_inverse_speed_factor;
        my_hitme.my_ai.rotation_lerp_amount          = tf.rotation_lerp_amount;
        my_hitme.getCollider().sharedMaterial = Get.getPhysicsMaterial(tf.physics_material);


        if (revert)
        {
            my_hitme.init_defenses = CloneUtil.copyList <Defense>(tf.defenses);
            my_hitme.defenses      = CloneUtil.copyList <Defense>(tf.defenses);
        }
        else
        {
            AvgDefenses(my_hitme.init_defenses, tf.defenses, 0.5f);
            AvgDefenses(my_hitme.defenses, tf.defenses, 0.5f);
        }

        my_hitme.sprite_renderer.gameObject.transform.localScale = tf.sprite_size;
        my_hitme.my_rigidbody.drag        = tf.linear_drag;
        my_hitme.my_rigidbody.angularDrag = tf.angular_drag;
        my_hitme.my_ai.AmHit();
        my_hitme.my_ai.ForceVelocity();

        //  Debug.Log("Finished converting " + this.name + " am transformed " + am_transformed + "\n");
    }
 /// <summary>
 /// Creates an instance and returns it for deep copy
 /// </summary>
 /// <returns>Created instance for deep copy</returns>
 public override ShapeElement Copy()
 {
     return(CloneUtil <ShapeElement> .DeepClone <ShapeElement>(this));
 }
Beispiel #30
0
 public new object Clone()
 {
     return(CloneUtil.CopyEntity(this, Activator.CreateInstance(this.GetType())));
 }