예제 #1
0
    public MissionItems SetReward(MissionData.MissionProperty data)
    {
        for (int i = _MissionRewards.Count; i < data._MissionReward.Length; i++)
        {
            var reward = PoolExtension.GetPool(PoolEnums.PoolId.Reward_Layout, false);

            reward.SetParent(_TransformReward);

            reward.localPosition = Vector.Vector3Zero;
            reward.localScale    = Vector.Vector3One;

            _MissionRewards.Add(reward.GetComponent <MissionReward> ());
        }

        for (int i = 0; i < _MissionRewards.Count; i++)
        {
            _MissionRewards[i].Disable();
        }

        for (int i = 0; i < data._MissionReward.Length; i++)
        {
            var reward      = data._MissionReward[i];
            var reward_item = _MissionRewards[i];

            reward_item.SetValue(ApplicationManager.Instance.AppendFromUnit(reward.Value, 0));
            reward_item.SetIcon(ApplicationManager.Instance.GetIconReward(reward.RewardId));
            reward_item.Enable();
        }

        return(this);
    }
예제 #2
0
    private void InitUpgradeShop()
    {
        var size = GameData.Instance.EquipmentData.GetSize();

        for (int i = 0; i < size; i++)
        {
            var data = GameData.Instance.EquipmentData.GetData(i);

            if (data == null)
            {
                continue;
            }

            var item = PoolExtension.GetPool(PoolEnums.PoolId.InteractEquipmentView, false);

            item.SetParent(grid_upgrade);

            item.localPosition = Vector.Vector3Zero;
            item.localScale    = Vector.Vector3One;

            item.gameObject.SetActive(true);

            var script = item.GetComponent <UIEquipmentView> ();

            script.InitUpgradeItems(data.AbilityId);
            script.RefreshUpgrade();
            script.RefreshUi();

            equipment_view_list.Add(script);
        }
    }
예제 #3
0
    public void FxDisplayGold(Vector3 position, string value)
    {
        var fx = PoolExtension.GetPool(PoolEnums.PoolId.FxUIRaiseGold);

        if (fx == null)
        {
            return;
        }

        fx.GetComponent <FXCoin> ().Enable(position, value);
    }
예제 #4
0
    public void InstanceFxExplodeRocket(Vector3 position)
    {
        var fx = PoolExtension.GetPool(PoolEnums.PoolId.FxRocketExplode, false);

        if (ReferenceEquals(fx, null))
        {
            return;
        }

        fx.position = position;
        fx.gameObject.SetActive(true);
    }
예제 #5
0
    public void InstanceFxTapDiamonds(Vector3 position)
    {
        var fx = PoolExtension.GetPool(PoolEnums.PoolId.FxTapDiamonds, false);

        if (fx == null)
        {
            return;
        }

        fx.transform.position = position;
        fx.gameObject.SetActive(true);
    }
예제 #6
0
    //public void InstanceFxDiamonds (Vector3 start_position, Vector3 end_position, int diamonds)
    //{
    //    var quantity   = 10;
    //    var balance    = diamonds % 10;
    //    var real_value = (diamonds - balance) / 10;

    //    if (diamonds > quantity && balance > 0)
    //    {
    //        PlayerData.Diamonds += balance;
    //    }
    //    else
    //    {
    //        if (diamonds <= quantity)
    //        {
    //            real_value = 1;
    //            quantity   = diamonds;
    //        }
    //    }

    //    for (int i = 0; i < quantity; i++)
    //    {
    //        var fx = PoolExtension.GetPool (PoolEnums.PoolId.FxItem_Diamond);

    //        if (fx == null)
    //            continue;

    //        fx.transform.position = new Vector3 (start_position.x + Random.Range (2f, -2f),
    //                                             start_position.y + Random.Range (2f, -2f));

    //        fx.transform.localScale = Vector3.zero;

    //        var tween = fx.DOScale (1, Durations.DurationScale).SetEase (Ease.OutBack).SetDelay (i * Durations.DurationScale / 3f);

    //        var index = i == quantity - 1;

    //        tween.OnComplete (() =>
    //        {
    //            var tween2 = fx.DOMove (end_position, Durations.DurationMovingBack).SetDelay (Durations.DurationScale).SetEase (Ease.InBack);

    //            tween2.OnComplete (() =>
    //            {
    //                PoolExtension.SetPool (PoolEnums.PoolId.FxItem_Diamond, fx);

    //                PlayerData.Diamonds += real_value;

    //                Instance.InstanceFxFireWork (fx.position);
    //                Instance.PlayAudioSound (AudioEnums.SoundId.Diamonds);
    //                Instance.PostActionEvent (ActionEnums.ActionID.RefreshUIDiamonds);


    //                if (index == true)
    //                {
    //                    PlayerData.SaveDiamonds ();
    //                }
    //            });
    //        }).SetEase (Ease.InBack);
    //    }
    //}

    //public void InstanceFxDiamonds (Vector3 startPosition, Vector3 endPosition, int quantity, System.Action OnCompleted = null)
    //{
    //    var max_quantity = Mathf.Clamp (quantity, 0, 10);

    //    for (int i = 0; i < max_quantity; i++)
    //    {
    //        var fx = PoolExtension.GetPool (PoolEnums.PoolId.FxItem_Diamond);

    //        if (fx == null)
    //            continue;

    //        fx.transform.position = new Vector3 (startPosition.x + Random.Range (2f, -2f),
    //                                             startPosition.y + Random.Range (2f, -2f));

    //        fx.transform.localScale = Vector3.zero;

    //        var tween = fx.DOScale (1, Durations.DurationScale).SetEase (Ease.OutBack).SetDelay (i * Durations.DurationScale / 3f);

    //        var index = i == max_quantity - 1;

    //        tween.OnComplete (() =>
    //        {
    //            var tween2 = fx.DOMove (endPosition, Durations.DurationMovingBack).SetDelay (Durations.DurationScale).SetEase (Ease.InBack);

    //            tween2.OnComplete (() =>
    //            {
    //                PoolExtension.SetPool (PoolEnums.PoolId.FxItem_Diamond, fx);

    //                Instance.InstanceFxFireWork (fx.position);

    //                Instance.PlayAudioSound (AudioEnums.SoundId.Diamonds);

    //                if (index == true)
    //                {
    //                    if (OnCompleted != null)
    //                    {
    //                        OnCompleted ();
    //                    }
    //                }
    //            });
    //        }).SetEase (Ease.InBack);
    //    }
    //}

    //public void InstanceFxCoins (Vector3 start_position, Vector3 end_position, double coins, int unit)
    //{
    //    var quantity = 6;

    //    if (coins < 6 && unit == 0)
    //    {
    //        quantity = (int) coins;
    //    }

    //    var real_coins = coins / quantity;
    //    var real_unit  = unit;

    //    Helper.FixNumber (ref real_coins, ref real_unit);

    //    for (int i = 0; i < quantity; i++)
    //    {
    //        var fx = PoolExtension.GetPool (PoolEnums.PoolId.FxItem_Coins);

    //        if (fx == null)
    //            continue;

    //        fx.transform.position = new Vector3 (start_position.x + Random.Range (2f, -2f),
    //                                             start_position.y + Random.Range (2f, -2f));

    //        fx.transform.localScale = Vector3.zero;

    //        var index = i == quantity - 1;

    //        var tween = fx.DOScale (1, Durations.DurationScale / 2f).SetEase (Ease.OutBack).SetDelay (i * Durations.DurationScale / 3f);

    //        tween.OnComplete (() =>
    //        {
    //            var tween2 = fx.DOMove (end_position, Durations.DurationMovingLine).SetDelay (Durations.DurationScale / 2f).SetEase (Ease.InBack);

    //            tween2.OnComplete (() =>
    //            {
    //                PoolExtension.SetPool (PoolEnums.PoolId.FxItem_Coins, fx);

    //                Helper.AddValue (ref PlayerData.Coins, ref PlayerData.CoinUnit, real_coins, real_unit);

    //                Instance.InstanceFxFireWork (fx.position);
    //                Instance.PostActionEvent (ActionEnums.ActionID.RefreshUICoins);
    //                Instance.PlayAudioSound (AudioEnums.SoundId.Coins);

    //                if (index == true)
    //                {
    //                    PlayerData.SaveCoins ();
    //                }
    //            });
    //        }).SetEase (Ease.InBack);
    //    }
    //}

    //public void InstanceFxCoins (Vector3 startPosition, Vector3 endPosition, int quantity, System.Action OnCompleted)
    //{
    //    var value = Mathf.Clamp (quantity, 0, 6);

    //    for (int i = 0; i < value; i++)
    //    {
    //        var fx = PoolExtension.GetPool (PoolEnums.PoolId.FxItem_Coins);

    //        if (fx == null)
    //            continue;

    //        fx.transform.position = new Vector3 (startPosition.x + Random.Range (2f, -2f),
    //                                             startPosition.y + Random.Range (2f, -2f));

    //        fx.transform.localScale = Vector3.zero;

    //        var tween = fx.DOScale (1, Durations.DurationScale / 2f).SetEase (Ease.OutBack).SetDelay (i * Durations.DurationScale / 3f);

    //        var index = i == value - 1;

    //        tween.OnComplete (() =>
    //        {
    //            var tween2 = fx.DOMove (endPosition, Durations.DurationMovingLine).SetDelay (Durations.DurationScale / 2f).SetEase (Ease.InBack);

    //            tween2.OnComplete (() =>
    //            {
    //                PoolExtension.SetPool (PoolEnums.PoolId.FxItem_Coins, fx);

    //                Instance.InstanceFxFireWork (fx.position);

    //                if (index == true)
    //                {
    //                    if (OnCompleted != null)
    //                    {
    //                        OnCompleted ();
    //                    }
    //                }

    //                Instance.PlayAudioSound (AudioEnums.SoundId.Coins);
    //            });
    //        }).SetEase (Ease.InBack);
    //    }
    //}

    public void InstanceFxFireWork(Vector3 position)
    {
        var fxFirework = PoolExtension.GetPool(PoolEnums.PoolId.FxExplode_Firework, false);

        if (fxFirework == null)
        {
            return;
        }

        fxFirework.transform.position = position;
        fxFirework.gameObject.SetActive(true);
    }
예제 #7
0
    public void InitDailyMission()
    {
        _QuantityDailyQuest = 0;

        var data = MissionManager.Instance.DailyQuest;

        for (int i = _DailyMissionItems.Count; i < data.Length; i++)
        {
            var pref   = PoolExtension.GetPool(PoolEnums.PoolId.Mission_Layout, false);
            var script = pref.GetComponent <MissionItems> ();

            pref.SetParent(_TransformViewDailyMission);

            pref.localPosition = Vector.Vector3Zero;
            pref.localScale    = Vector.Vector3One;

            _DailyMissionItems.Add(script);
        }

        for (int i = 0; i < _DailyMissionItems.Count; i++)
        {
            _DailyMissionItems[i].Disable();
        }

        for (int i = 0; i < data.Length; i++)
        {
            var item = MissionManager.Instance.GetMissionData(data[i].GetId());

            if (item == null)
            {
                continue;
            }

            if (item.MissionProperty.Level < 0)
            {
                continue;
            }

            var script = _DailyMissionItems[i];

            script.SetDescription(MissionManager.Instance.GetDescription(data[i].GetId(), item.MissionProperty))
            .SetQuantityTarget(item.MissionProperty.QuantityTarget)
            .SetProcess(item.Quantity)
            .SetIcon(MissionManager.Instance.MissionIcon.GetIcon(data[i].GetId()))
            .SetReward(item.MissionProperty)
            .SetId(data[i].GetId())
            .RefreshStatus()
            .Enable();

            _QuantityDailyQuest++;
        }
    }
예제 #8
0
    public void InstanceMuzzle(Vector3 position, Vector3 localEulerAngles)
    {
        var muzzle = PoolExtension.GetPool(PoolEnums.PoolId.Muzzle, false);

        if (ReferenceEquals(muzzle, null))
        {
            return;
        }

        muzzle.position         = position;
        muzzle.localEulerAngles = localEulerAngles;
        muzzle.gameObject.SetActive(true);
    }
예제 #9
0
    public void InstanceFxCritTextDamage(Vector3 position, string value)
    {
        var fx = PoolExtension.GetPool(PoolEnums.PoolId.FxTextCritDamage, false);

        if (ReferenceEquals(fx, null))
        {
            return;
        }

        var script = fx.GetComponent <FxTextDamage> ();

        script.Init(position, value);

        fx.gameObject.SetActive(true);
    }
예제 #10
0
    public void InstanceFxLevelUp(Vector3 position)
    {
        var fx = PoolExtension.GetPool(PoolEnums.PoolId.FxLevelUp, false);

        if (fx == null)
        {
            return;
        }

        var script = fx.GetComponent <FxLevelUp> ();

        script.Init(position);

        fx.gameObject.SetActive(true);
    }
예제 #11
0
    public void InstanceBullets(int level, CarDataProperties _carDataProperties, int level_weapon, Vector3 position_start, string tag_enemy, Vector3 angle)
    {
        var data    = GameData.Instance.BulletsData.GetBullets(level);
        var bullets = PoolExtension.GetPool(data.BulletId, false);

        if (ReferenceEquals(bullets, null))
        {
            return;
        }

        var script = bullets.GetComponent <BulletsBehaviour> ();

        script.Init(position_start, angle, tag_enemy, level_weapon, _carDataProperties);

        script.Register();

        bullets.gameObject.SetActive(true);
    }
예제 #12
0
    public void InstanceVirusEnemy()
    {
        var enemy = EnemyEnums.GetRandomVirusEnemy();

        var pool_enemy = PoolExtension.GetPool(EnemyEnums.GetPoolEnemy(enemy), false);

        current_size_enemy_instanced_during_waves++;

        if (ReferenceEquals(pool_enemy, null))
        {
            current_number_enemy_destroyed++;
            return;
        }

        var script = pool_enemy.GetComponent <EnemyBehaviour> ();

        script.Init(GetRandomPosition());

        Register(script);

        pool_enemy.gameObject.SetActive(true);
    }