Exemplo n.º 1
0
        private void GetDiamondBox_ExcuteHave(List <DropData> list, List <DropData> giftlist)
        {
            int num   = 0;
            int count = giftlist.Count;

            while (num < count)
            {
                bool flag = false;
                int  num3 = 0;
                int  num4 = list.Count;
                while (num3 < num4)
                {
                    if (list[num3].Equals(giftlist[num]))
                    {
                        DropData local1 = list[num3];
                        local1.count += giftlist[num].count;
                        flag          = true;
                        break;
                    }
                    num3++;
                }
                if (!flag)
                {
                    list.Add(giftlist[num]);
                }
                num++;
            }
        }
        private void ProcessLiveQueue()
        {
            do
            {
                ResolvedEvent e;
                while (_liveQueue.TryDequeue(out e))
                {
                    if (e.Equals(DropSubscriptionEvent)) // drop subscription artificial ResolvedEvent
                    {
                        if (_dropData == null)
                        {
                            _dropData = new DropData(SubscriptionDropReason.Unknown, new Exception("Drop reason not specified."));
                        }
                        DropSubscription(_dropData.Reason, _dropData.Error);
                        Interlocked.CompareExchange(ref _isProcessing, 0, 1);
                        return;
                    }

                    try
                    {
                        TryProcess(e);
                    }
                    catch (Exception exc)
                    {
                        Log.Debug("Catch-up Subscription to {0} Exception occurred in subscription {1}", IsSubscribedToAll ? "<all>" : StreamId, exc);
                        DropSubscription(SubscriptionDropReason.EventHandlerException, exc);
                        return;
                    }
                }
                Interlocked.CompareExchange(ref _isProcessing, 0, 1);
            } while (_liveQueue.Count > 0 && Interlocked.CompareExchange(ref _isProcessing, 1, 0) == 0);
        }
Exemplo n.º 3
0
 private async void ProcessLiveQueueAsync()
 {
     do
     {
         RecordedEvent e;
         while (_liveQueue.TryDequeue(out e))
         {
             if (e.Equals(DropSubscriptionEvent))
             {
                 _dropData = _dropData ?? new DropData(SubscriptionDropReason.Unknown, new Exception("Drop reason not specified."));
                 DropSubscription(_dropData.Reason, _dropData.Error);
                 Interlocked.CompareExchange(ref _isProcessing, 0, 1);
                 return;
             }
             try
             {
                 await TryProcessAsync(e).ConfigureAwait(false);
             }
             catch (Exception ex)
             {
                 Log.Debug("Catch-up Subscription {0} to {1} Exception occurred in subscription {1}", SubscriptionName, IsSubscribedToAll ? "<all>" : StreamId, ex);
                 DropSubscription(SubscriptionDropReason.EventHandlerException, ex);
                 return;
             }
         }
         Interlocked.CompareExchange(ref _isProcessing, 0, 1);
         //e = new RecordedEvent();
     }while (_liveQueue.Count > 0 && Interlocked.CompareExchange(ref _isProcessing, 1, 0) == 0);
 }
Exemplo n.º 4
0
    private void Instance_OnDropAdded(DropData obj)
    {
        DropLabel labelInst = Instantiate(dropLabelPrefab, labelsParent);

        labelInst.Fill(obj);
        labels.Add(obj.id, labelInst);
    }
Exemplo n.º 5
0
	void Start () {
		item.SetActive (false);
        DropData dropD = DropData.GetData(SuccessSystem.Reward50().data_._DropId);
        if (dropD != null)
        {
            GameObject clone = null;
            for (int i = 0; i < dropD.itemList.Count; i++)
            {
                if (dropD.itemList[i] == 0)
                    continue;

                clone = GameObject.Instantiate(item) as GameObject;
                clone.SetActive(true);
                clone.transform.parent = grid.transform;
                clone.transform.position = Vector3.zero;
                clone.transform.localScale = Vector3.one;
                ItemData idata = ItemData.GetData(dropD.itemList[i]);
                UIManager.SetButtonEventHandler(clone.gameObject, EnumButtonEvent.OnClick, OnClickclone, idata.id_, 0);
                SuccessRewardCell asCell = clone.GetComponent<SuccessRewardCell>();
                asCell.Idata = idata;
            }
            grid.repositionNow = true;
        }
        contionlabel.text = SuccessSystem.Reward50().data_._Desc;
        UIManager.SetButtonEventHandler(ReceiveBtn.gameObject, EnumButtonEvent.OnClick, OnClickReceive, 0, 0);
	}
Exemplo n.º 6
0
        private async void ProcessLiveQueueAsync()
        {
            do
            {
                while (this._liveQueue.TryDequeue(out var e))
                {
                    if (e.Equals(DropSubscriptionEvent)) // drop subscription artificial ResolvedEvent
                    {
                        this._dropData = this._dropData ?? new DropData(SubscriptionDropReason.Unknown, new Exception("Drop reason not specified."));
                        this.DropSubscription(this._dropData.Reason, this._dropData.Error);
                        Interlocked.CompareExchange(ref this._isProcessing, 0, 1);
                        return;
                    }

                    try
                    {
                        await TryProcessAsync(e).ConfigureAwait(false);
                    }
                    catch (Exception exc)
                    {
                        //Log.Debug("Catch-up Subscription {0} to {1} Exception occurred in subscription {1}", SubscriptionName, IsSubscribedToAll ? "<all>" : StreamId, exc);
                        DropSubscription(SubscriptionDropReason.EventHandlerException, exc);
                        return;
                    }
                }
                Interlocked.CompareExchange(ref this._isProcessing, 0, 1);
            } while (this._liveQueue.Count > 0 && Interlocked.CompareExchange(ref this._isProcessing, 1, 0) == 0);
        }
Exemplo n.º 7
0
        /// <summary>
        /// Creates new item based on drop data.
        /// </summary>
        /// <param name="dropData"></param>
        public Item(DropData dropData)
            : this(dropData.ItemId)
        {
            var rnd = RandomProvider.Get();

            this.Info.Amount = (ushort)rnd.Next(dropData.AmountMin, dropData.AmountMax + 1);
            if (this.Data.StackType != StackType.Sac && this.Info.Amount < 1)
            {
                this.Info.Amount = 1;
            }

            this.OptionInfo.Prefix = (ushort)dropData.Prefix;
            this.OptionInfo.Suffix = (ushort)dropData.Suffix;

            if (dropData.Color1 != null)
            {
                this.Info.Color1 = (uint)dropData.Color1;
            }
            if (dropData.Color2 != null)
            {
                this.Info.Color2 = (uint)dropData.Color2;
            }
            if (dropData.Color3 != null)
            {
                this.Info.Color3 = (uint)dropData.Color3;
            }

            if (dropData.Durability != -1)
            {
                this.Durability = dropData.Durability;
            }
        }
Exemplo n.º 8
0
        /// <summary>
        /// Returns a random drop from the given list as item.
        /// Returns null if total wasn't reached.
        /// </summary>
        /// <param name="rnd"></param>
        /// <param name="total"></param>
        /// <param name="drops"></param>
        /// <returns></returns>
        /// <exception cref="ArgumentException"></exception>
        public static Item GetRandomDrop(Random rnd, float total, List <DropData> drops)
        {
            if (drops == null || drops.Count == 0)
            {
                throw new ArgumentException("Drops list empty.");
            }

            var num = rnd.NextDouble() * total;

            var      n    = 0.0;
            DropData data = null;

            foreach (var drop in drops)
            {
                n += drop.Chance;
                if (num <= n)
                {
                    data = drop;
                    break;
                }
            }

            if (data == null)
            {
                return(null);
            }

            return(new Item(data));
        }
Exemplo n.º 9
0
    protected override void OnTriggerEnter(Collider other)
    {
        base.OnTriggerEnter(other);

        if (other.gameObject.CompareTag(TagMaskDefine.GFAN_ACTOR))
        {
            DropData tDropData = ItemDataManager.Instance.CopyDropData;
            if (tDropData != null)
            {
                tDropData.PickupItemList.Add(chestID);
            }

            NetSender.Instance.RequestRandomCopyChest(chestID);

            PackedSprite chestAnim = GetComponentInChildren <PackedSprite>() as PackedSprite;
            if (null != chestAnim)
            {
                chestAnim.PlayAnim(1);                 // Unseal a chest animation
                // chestAnim.PlayAnim("OpenBaoxiang");
                float animLen = chestAnim.GetCurAnim().GetLength();

                StartCoroutine(DoWaitForSeconds(animLen + 0.2f, delegate()
                {
                    Status2DCopy status2DCopy = (Status2DCopy)GameStatusManager.Instance.MCopyStatus;
                    if (null != status2DCopy && null != status2DCopy.StageCopy)
                    {
                        status2DCopy.StageCopy.DestroyChest(gameObject);
                    }
                }));
            }
        }
    }
Exemplo n.º 10
0
 private void Reset_Level()
 {
     this.level_dropequip        = LocalSave.Instance.SaveExtra.EquipDropRate;
     this.mDropData              = GameLogic.Hold.BattleData.mModeData.GetDropData();
     this.equip_talent_enable    = LocalSave.Instance.SaveExtra.Get_Equip_Drop();
     this.equipexp_talent_enable = LocalSave.Instance.SaveExtra.Get_EquipExp_Drop();
     this.equip_must_drop        = LocalSave.Instance.GetEquipGuide_mustdrop();
 }
Exemplo n.º 11
0
 private void Instance_OnDropRemoved(DropData obj)
 {
     if (labels.TryGetValue(obj.id, out DropLabel label))
     {
         labels.Remove(obj.id);
         Destroy(label.gameObject);
     }
 }
Exemplo n.º 12
0
 private Task DropAction()
 {
     _dropData = _dropData ?? new DropData(SubscriptionDropReason.Unknown,
                                           new Exception("Drop reason not specified."));
     DropSubscription(_dropData.Reason, _dropData.Error);
     Interlocked.CompareExchange(ref _isProcessing, 0, 1);
     return(TaskEx.CompletedTask);
 }
Exemplo n.º 13
0
    public static void LoadData()
    {
        if (s_ItemDropDataTbl != null)
        {
            return;
        }

        s_ItemDropDataTbl = new Dictionary <int, ItemDropData>();
        SqliteDataReader reader = LocalDatabase.Instance.ReadFullTable("loot");

        while (reader.Read())
        {
            string strId = reader.GetString(reader.GetOrdinal("id"));
            int    id    = Convert.ToInt32(strId);

            bool validData = false;
            // Meat
            ItemDropData itemDropData  = new ItemDropData();
            string       strMeat       = reader.GetString(reader.GetOrdinal("meat"));
            string[]     strLowerUpper = strMeat.Split(';');
            if (strLowerUpper.Length == 2)
            {
                itemDropData._meatData.lower = Convert.ToInt32(strLowerUpper[0]);
                itemDropData._meatData.upper = Convert.ToInt32(strLowerUpper[1]);
                validData = true;
            }
            // Other
            string   strTmp   = reader.GetString(reader.GetOrdinal("loot"));
            string[] strlist0 = strTmp.Split(';');
            if (strlist0.Length == 2)
            {
                int      count       = Convert.ToInt32(strlist0[0]);
                string[] stritemlist = strlist0[1].Split(',');
                if (count > 0 && stritemlist.Length > 0)
                {
                    List <DropData> dropLst = new List <DropData>();
                    for (int i = 0; i < stritemlist.Length; i++)
                    {
                        string[] strlist1 = stritemlist[i].Split('_');
                        if (strlist1.Length == 2)
                        {
                            DropData dropData = new DropData();
                            dropData.id  = Convert.ToInt32(strlist1[0]);
                            dropData.pro = Convert.ToSingle(strlist1[1]);
                            dropLst.Add(dropData);
                        }
                    }
                    itemDropData._cnt      = count;
                    itemDropData._dropList = dropLst;
                }
                validData = true;
            }
            if (validData)
            {
                s_ItemDropDataTbl[id] = itemDropData;
            }
        }
    }
Exemplo n.º 14
0
        private void EnqueueSubscriptionDropNotification(SubscriptionDropReason reason, Exception error)
        {
            // if drop data was already set -- no need to enqueue drop again, somebody did that already
            var dropData = new DropData(reason, error);

            if (Interlocked.CompareExchange(ref _dropData, dropData, null) == null)
            {
                Enqueue(DropSubscriptionEvent);
            }
        }
Exemplo n.º 15
0
    public DropData triggerDrop()
    {
        DropData dd = null;

        if (dropDelay.trigger())
        {
            dd = new DropData(location, takeNextDrop());
            playerUI.UpdateNextDrops(nextDropType);
        }
        return(dd);
    }
Exemplo n.º 16
0
 public virtual void DragCleanup(bool revertExpanded)
 {
     if (m_DropData != null)
     {
         if (m_DropData.expandedArrayBeforeDrag != null && revertExpanded)
         {
             RestoreExpanded(new List <int>(m_DropData.expandedArrayBeforeDrag));
         }
         m_DropData = new DropData();
     }
 }
Exemplo n.º 17
0
 public virtual void DragCleanup(bool revertExpanded)
 {
     if (this.m_DropData != null)
     {
         if ((this.m_DropData.expandedArrayBeforeDrag != null) && revertExpanded)
         {
             this.RestoreExpanded(new List<int>(this.m_DropData.expandedArrayBeforeDrag));
         }
         this.m_DropData = new DropData();
     }
 }
Exemplo n.º 18
0
        public static DropData GetDropData(string str)
        {
            DropData data = new DropData();

            char[]   separator = new char[] { ',' };
            string[] strArray  = str.Split(separator);
            int.TryParse(strArray[0], out int num);
            data.type = (PropType)num;
            int.TryParse(strArray[1], out data.id);
            int.TryParse(strArray[2], out data.count);
            return(data);
        }
Exemplo n.º 19
0
    /// <summary>
    /// 將字典傳入,依json表設定資料
    /// </summary>
    public static void SetData(Dictionary <int, DropData> _dic)
    {
        string   jsonStr = Resources.Load <TextAsset>("Json/Drop").ToString();
        JsonData jd      = JsonMapper.ToObject(jsonStr);
        JsonData items   = jd["Drop"];

        for (int i = 0; i < items.Count; i++)
        {
            DropData dropData = new DropData(items[i]);
            int      id       = int.Parse(items[i]["ID"].ToString());
            _dic.Add(id, dropData);
        }
    }
Exemplo n.º 20
0
    public IEnumerator EndRecording()
    {
        savingMessage.SetActive(true);
        recording = false;
        yield return(null);

        data.SaveData();
        yield return(null);

        data  = null;
        ready = true;
        savingMessage.SetActive(false);
    }
Exemplo n.º 21
0
        /// <summary>
        /// Enqueues a dropped notification for later processing.
        /// </summary>
        /// <param name="reason"></param>
        /// <param name="error"></param>
        protected void EnqueueSubscriptionDropNotification(SubscriptionDropReason reason, Exception error)
        {
            // if drop data was already set -- no need to enqueue drop again, somebody did that already
            var dropData = new DropData(reason, error);

            if (Interlocked.CompareExchange(ref _dropData, dropData, null) == null)
            {
                LiveQueue.Enqueue(DropAction);
                if (AllowProcessing)
                {
                    EnsureProcessingPushQueue();
                }
            }
        }
Exemplo n.º 22
0
        private void EnqueueSubscriptionDropNotification(SubscriptionDropReason reason, Exception error)
        {
            // if drop data was already set -- no need to enqueue drop again, somebody did that already
            var dropData = new DropData(reason, error);

            if (Interlocked.CompareExchange(ref this._dropData, dropData, null) == null)
            {
                this._liveQueue.Enqueue(DropSubscriptionEvent);
                if (this._allowProcessing)
                {
                    this.EnsureProcessingPushQueue();
                }
            }
        }
Exemplo n.º 23
0
 public LevelData(int cNumber, HeroController player, List <DropClass> drops, History history, GameStatistics gStats,
                  List <EnemyData> _enInfo, List <InterObjData> _intInfo, List <NPCData> _npcInfo)
 {
     active           = true;
     checkpointNumber = cNumber;
     qInfo            = new QuestInfo(history.ActiveQuests);
     sInfo            = new StoryInfo(history);
     lStatsInfo       = new LevelStatsData(gStats);
     eInfo            = new EquipmentInfo(player.CurrentWeapon, player.Bag);
     dropInfo         = new DropData(drops);
     enInfo           = _enInfo;
     intInfo          = _intInfo;
     npcInfo          = _npcInfo;
 }
Exemplo n.º 24
0
        public Calculate(Action<Action<double?>> ejectNumber,
            Action<Tuple<char, double?>, Action<double>> applyOperation)
        {
            var opToSignal = new DropData<char>();
            var joinOpAndNumber = new Join<char, double?>();

            this.In_Process = (c) =>
                {
                    opToSignal.In_Drop(c);
                    joinOpAndNumber.Input0(c);
                };

            opToSignal.Out_Signal += () => ejectNumber(joinOpAndNumber.Input1);
            joinOpAndNumber.Output += _ => applyOperation(_, this.Out_Result);
        }
Exemplo n.º 25
0
    public void StartRecording(DropBall ball, List <Camera> dropCams)
    {
        recording = true;
        ready     = false;
        frame     = 0;

        BallData          ballData    = new BallData(ball);
        List <CameraData> camerasData = new List <CameraData>(dropCams.Count);

        for (int i = 0; i < dropCams.Count; i++)
        {
            camerasData.Add(new CameraData(dropCams[i]));
            camerasData[i].cameraNumber = i;
        }

        data = new DropData(ballData, camerasData);
    }
Exemplo n.º 26
0
    ///////////////
    public MaterialData TryDropItem()
    {
        List <DropData> droppedItems = null;

        foreach (DropData drop in Drops)
        {
            if (drop.IsDropped())
            {
                if (droppedItems == null)
                {
                    droppedItems = new List <DropData>();
                }

                droppedItems.Add(drop);
            }
        }

        if (droppedItems == null)
        {
            return(null);
        }
        else if (droppedItems.Count == 1)
        {
            return(GameDataStorage.Instance.GetMaterialByName(droppedItems[0].MaterialDropName));
        }
        else
        {
            DropData lowestChanceItem = null;

            foreach (DropData drop in droppedItems)
            {
                if (lowestChanceItem == null)
                {
                    lowestChanceItem = drop;
                    continue;
                }

                if (drop.MaterialDropChance < lowestChanceItem.MaterialDropChance)
                {
                    lowestChanceItem = drop;
                }
            }

            return(GameDataStorage.Instance.GetMaterialByName(lowestChanceItem.MaterialDropName));
        }
    }
Exemplo n.º 27
0
    private void Awake()
    {
        ID = this.gameObject.GetComponent <GameEntity>().ID;

        // Get the sprite's physics shape
        List <Vector2> physicsShapeList = new List <Vector2>();

        this.gameObject.GetComponent <SpriteRenderer>().sprite.GetPhysicsShape(0, physicsShapeList);

        // Assign it to the polygon collider
        var pc2d = this.gameObject.AddComponent <PolygonCollider2D>();

        pc2d.points = physicsShapeList.ToArray();

        damageStatus = hitPoints;
        dropData     = DropData.GetDropData(dropDataString);
    }
Exemplo n.º 28
0
    /// <summary>
    /// Spawns a unit based on the level set.
    /// </summary>
    private void SpawnUnit()
    {
        if (GameManager.Instance.PauseGame)
        {
            return;
        }

        if (unitList[(int)unitLevel] != null)
        {
            Transform unit = InstanceManager.Spawn(unitList[(int)unitLevel].transform, spawnLocation.position, Quaternion.identity);

            //↓↓↓ここからオリジナルソースコード追加↓↓↓//

            int id = GameManager.Instance.crntEnemyDictionary.Count + 1;
            unit.gameObject.GetComponent <EnemyObject> ().EnemyData = _enemyData;
            unit.gameObject.GetComponent <EnemyObject> ().CurrentHP = _enemyData.HP;

            timeBetweenSpawns = _enemyData.Interval;

            //ドロップの設定
            GameObject stgObj = GameManager.Instance.CurrentStageObject;
            if (stgObj != null)
            {
                DropData dropData = stgObj.GetComponent <StageObject> ().MakeDrop();
                if (dropData != null)
                {
                    unit.gameObject.GetComponent <EnemyObject> ().dropData = dropData;
                }
            }

            GameManager.Instance.crntEnemyDictionary.Add(id.ToString(), unit.gameObject.GetComponent <EnemyObject> ());


            //↑↑↑==========ここまで===========↑↑↑//

            unit.GetComponent <SpawnAI>().SetOwner(this);
            // Increase the total number of enemies spawned and the number of spawned enemies
            numberOfUnits++;
            totalSpawnedUnits++;
        }
        else
        {
            Debug.LogError("Error trying to spawn unit of level " + unitLevel.ToString() + " on spawner " + spawnID + " - No unit set");
            spawn = false;
        }
    }
Exemplo n.º 29
0
            public void Serialize(EB.BitStream bs)
            {
                if (bs.isWriting)
                {
                    int numDrops = Drops.Count;
                    bs.Serialize(ref numDrops);
                    foreach (KeyValuePair <string, List <DropData> > pair in Drops)
                    {
                        int numData = pair.Value.Count;
                        bs.Serialize(ref numData);

                        string key = pair.Key;
                        bs.Serialize(ref key);

                        foreach (DropData drop in pair.Value)
                        {
                            drop.Serialize(bs);
                        }
                    }
                }
                else
                {
                    int numDrops = 0;
                    bs.Serialize(ref numDrops);
                    Drops = new Dictionary <string, List <DropData> >();
                    for (int i = 0; i < numDrops; i++)
                    {
                        int numData = 0;
                        bs.Serialize(ref numData);

                        string key = string.Empty;
                        bs.Serialize(ref key);

                        List <DropData> dropList = new List <DropData>();
                        for (int j = 0; j < numData; j++)
                        {
                            DropData d = new DropData();
                            d.Serialize(bs);
                            dropList.Add(d);
                        }

                        Drops[key] = dropList;
                    }
                }
            }
Exemplo n.º 30
0
    /**
     *
     * Stage.csvの、Dropsを元に、
     * ドロップするアイテムを生成。
     *
     * 敵を倒した際、%でアイテムドロップ。
     * ステージクリア時に最低1つプレゼント。
     *
     */
    private void ParseDropData(string dropDataStr)
    {
        if (string.IsNullOrEmpty(dropDataStr))
        {
            return;
        }

        string[] dropSplited = dropDataStr.Split('|');

        foreach (string dropStr in dropSplited)
        {
            DropData dropData = new DropData();
            dropData.ID         = dropStr.Split(':')[0];
            dropData.Percentage = float.Parse(dropStr.Split(':')[1]);

            dropDataList.Add(dropData);
        }
    }
Exemplo n.º 31
0
    public virtual void CalculateDamage(EnemyObject enemyObject)
    {
        enemyObject.CurrentHP -= (int)System.Math.Ceiling(_weapon.Damage);
        Debug.LogError("weapon: " + _weapon + ", dmg: " + _weapon.Damage + ", enemyHP: " + enemyObject.EnemyData.HP + ", CurrentHP: " + enemyObject.CurrentHP);

        //敵が死んだ場合の処理
        if (enemyObject.CurrentHP <= 0)
        {
            //ドロップはenemyObjectを破壊する前にコピーしておく。
            if (enemyObject.dropData != null)
            {
                DropData dropData = new DropData(enemyObject.dropData);
                int      total    = PlayerData.AddItem(dropData.GetDropItemData());
                enemyObject.dropData = null;                 //メモリの解放

                //リザルト画面に必要なので各ドロップをセーブしておく。
                if (GameManager.Instance.CurrentStageObject.GetComponent <StageObject> ().DropItemNum.ContainsKey(dropData.ID))
                {
                    GameManager.Instance.CurrentStageObject.GetComponent <StageObject> ().DropItemNum [dropData.ID]++;
                }
                else
                {
                    GameManager.Instance.CurrentStageObject.GetComponent <StageObject> ().DropItemNum.Add(dropData.ID, 1);
                }

//				Debug.LogError ("@@@@@@@Dropping: " + dropData.ID + ": " + total + ", exp added: " + enemyObject.EnemyData.GetExpPoint() + ", unusedExp: " + PlayerData.unusedExpPoints);
            }

            //ExpPoint保存
            PlayerData.unusedExpPoints += enemyObject.EnemyData.GetExpPoint();
            UiController.Instance.UpdateExpPointTextUI();


            bool isBoss = enemyObject.IsBoss;
            Destroy(enemyObject.gameObject, 0.05f);

            //ボスを倒した場合リザルト画面表示
            if (isBoss)
            {
                GameManager.Instance.InitResult();
            }
        }
    }
Exemplo n.º 32
0
    public void PvPDayReward(int reward)
    {
        for (int j = 0; j < itemObjs.Count; j++)
        {
            itemObjs[j].gameObject.SetActive(false);
        }
        DropData dropData = DropData.GetData(reward);

        if (dropData == null)
        {
            return;
        }
        List <int> rewardList = new List <int> ();

        rewardList.Add(dropData.item_1_);
        rewardList.Add(dropData.item_2);
        rewardList.Add(dropData.item_3);
        rewardList.Add(dropData.item_4);
        rewardList.Add(dropData.item_5);
        List <int> rewardNumList = new List <int> ();

        rewardNumList.Add(dropData.item_num_1_);
        rewardNumList.Add(dropData.item_num_2);
        rewardNumList.Add(dropData.item_num_3);
        rewardNumList.Add(dropData.item_num_4);
        rewardNumList.Add(dropData.item_num_5);
        //	fenLab.gameObject.SetActive (false);
        for (int i = 0; i < rewardList.Count; i++)
        {
            if (rewardList[i] == 0)
            {
                break;
            }
            itemObjs[i].gameObject.SetActive(true);
            ItemCellUI itemcell = UIManager.Instance.AddItemCellUI(itemObjs[i].gameObject.GetComponent <UISprite>(), (uint)rewardList[i]);
            itemObjs[i].transform.FindChild("name").GetComponent <UILabel>().text  = ItemData.GetData(rewardList[i]).name_;
            itemObjs[i].transform.FindChild("Label").GetComponent <UILabel>().text = rewardNumList[i].ToString();
            itemcell.showTips = true;
            itemObjs[i].SetActive(true);
            itemObjs[i].transform.localScale = Vector3.one;
        }
    }
        private void ProcessLiveQueue()
        {
            do
            {
                ResolvedEvent e;
                while (_liveQueue.TryDequeue(out e))
                {
                    if (e.Equals(DropSubscriptionEvent)) // drop subscription artificial ResolvedEvent
                    {
                        if (_dropData == null) _dropData = new DropData(SubscriptionDropReason.Unknown, new Exception("Drop reason not specified."));
                        DropSubscription(_dropData.Reason, _dropData.Error);
                        Interlocked.CompareExchange(ref _isProcessing, 0, 1);
                        return;
                    }

                    try
                    {
                        TryProcess(e);
                    }
                    catch (Exception exc)
                    {
                        DropSubscription(SubscriptionDropReason.EventHandlerException, exc);
                        return;
                    }
                }
                Interlocked.CompareExchange(ref _isProcessing, 0, 1);
            } while (_liveQueue.Count > 0 && Interlocked.CompareExchange(ref _isProcessing, 1, 0) == 0);
        }
Exemplo n.º 34
0
		public GlobalDropByTag(string identifier, string tag, DropData data)
			: base(identifier, data)
		{
			this.Tag = tag;
		}
Exemplo n.º 35
0
		public GlobalDrop(string identifier, DropData data)
		{
			this.Identifier = identifier;
			this.Data = data;
		}
 private void EnqueueSubscriptionDropNotification(SubscriptionDropReason reason, Exception error)
 {
     // if drop data was already set -- no need to enqueue drop again, somebody did that already
     var dropData = new DropData(reason, error);
     if (Interlocked.CompareExchange(ref _dropData, dropData, null) == null)
     {
         _liveQueue.Enqueue(DropSubscriptionEvent);
         if (_allowProcessing)
             EnsureProcessingPushQueue();
     }
 }
Exemplo n.º 37
0
		/// <summary>
		/// Creates new item based on drop data.
		/// </summary>
		/// <param name="dropData"></param>
		public Item(DropData dropData)
			: this(dropData.ItemId)
		{
			var rnd = RandomProvider.Get();

			// Amount
			this.Info.Amount = (ushort)rnd.Next(dropData.AmountMin, dropData.AmountMax + 1);
			if (this.Data.StackType != StackType.Sac && this.Info.Amount < 1)
				this.Info.Amount = 1;

			// Set enchant meta data or apply option sets to item
			if (dropData.Prefix != 0 || dropData.Suffix != 0)
			{
				if (this.HasTag("/enchantscroll/"))
				{
					// Prefix
					if (dropData.Prefix != 0)
					{
						var data = AuraData.OptionSetDb.Find(dropData.Prefix);
						if (data == null) throw new ArgumentException("Option set doesn't exist: " + dropData.Prefix);
						if (data.Category != OptionSetCategory.Prefix) throw new ArgumentException("Option set is not a prefix.");

						this.MetaData1.SetInt("ENPFIX", dropData.Prefix);
					}

					// Suffix
					if (dropData.Suffix != 0)
					{
						var data = AuraData.OptionSetDb.Find(dropData.Suffix);
						if (data == null) throw new ArgumentException("Option set doesn't exist: " + dropData.Suffix);
						if (data.Category != OptionSetCategory.Suffix) throw new ArgumentException("Option set is not a suffix.");

						this.MetaData1.SetInt("ENSFIX", dropData.Suffix);
					}

					// TODO: Expiration?
				}
				else
					this.ApplyPreSuffix(dropData.Prefix, dropData.Suffix);
			}

			// Colors
			if (dropData.Color1 != null) this.Info.Color1 = (uint)dropData.Color1;
			if (dropData.Color2 != null) this.Info.Color2 = (uint)dropData.Color2;
			if (dropData.Color3 != null) this.Info.Color3 = (uint)dropData.Color3;

			// Lowered durability
			if (dropData.Durability != -1)
				this.Durability = dropData.Durability;
		}
Exemplo n.º 38
0
		/// <summary>
		/// Creates item based on parameters.
		/// </summary>
		/// <param name="id"></param>
		/// <param name="amount"></param>
		/// <returns></returns>
		public static Item Create(int id, int amount = 0, int amountMin = 0, int amountMax = 0, uint? color1 = null, uint? color2 = null, uint? color3 = null, int prefix = 0, int suffix = 0, int expires = 0, int durability = -1)
		{
			var dropData = new DropData(id, 100, amount, amountMin, amountMax, color1, color2, color3, prefix, suffix, expires, durability);
			return new Item(dropData);
		}
Exemplo n.º 39
0
 /// <summary>
 /// Adds drop
 /// </summary>
 /// <param name="itemId"></param>
 /// <param name="chance"></param>
 public void Add(int itemId, float chance)
 {
     lock (_drops)
         _drops[itemId] = new DropData(itemId, chance);
 }
Exemplo n.º 40
0
		public GlobalDropById(string identifier, int raceId, DropData data)
			: base(identifier, data)
		{
			this.RaceId = raceId;
		}
Exemplo n.º 41
0
 public virtual bool DragElement(TreeViewItem targetItem, Rect targetItemRect, bool firstItem)
 {
     DropPosition below;
     TreeViewItem parent;
     if (targetItem == null)
     {
         if (this.m_DropData != null)
         {
             this.m_DropData.dropTargetControlID = 0;
             this.m_DropData.rowMarkerControlID = 0;
         }
         bool perform = Event.current.type == EventType.DragPerform;
         DragAndDrop.visualMode = this.DoDrag(null, null, perform, DropPosition.Below);
         if ((DragAndDrop.visualMode != DragAndDropVisualMode.None) && perform)
         {
             this.FinalizeDragPerformed(true);
         }
         return false;
     }
     Vector2 mousePosition = Event.current.mousePosition;
     bool flag2 = this.m_TreeView.data.CanBeParent(targetItem);
     Rect rect = targetItemRect;
     float betweenHalfHeight = !flag2 ? (targetItemRect.height * 0.5f) : this.m_TreeView.gui.halfDropBetweenHeight;
     if (firstItem)
     {
         rect.yMin -= betweenHalfHeight;
     }
     rect.yMax += betweenHalfHeight;
     if (!rect.Contains(mousePosition))
     {
         return false;
     }
     if (!flag2 || (mousePosition.y >= (targetItemRect.yMax - betweenHalfHeight)))
     {
         below = DropPosition.Below;
     }
     else if (!flag2 || (firstItem && (mousePosition.y <= (targetItemRect.yMin + betweenHalfHeight))))
     {
         below = DropPosition.Above;
     }
     else
     {
         below = DropPosition.Upon;
     }
     if (this.m_TreeView.data.IsExpanded(targetItem) && targetItem.hasChildren)
     {
         parent = targetItem;
     }
     else
     {
         parent = targetItem.parent;
     }
     DragAndDropVisualMode none = DragAndDropVisualMode.None;
     if (Event.current.type == EventType.DragPerform)
     {
         if (below == DropPosition.Upon)
         {
             none = this.DoDrag(targetItem, targetItem, true, below);
         }
         if ((none == DragAndDropVisualMode.None) && (parent != null))
         {
             none = this.DoDrag(parent, targetItem, true, below);
         }
         if (none != DragAndDropVisualMode.None)
         {
             this.FinalizeDragPerformed(false);
         }
         else
         {
             this.DragCleanup(true);
             this.m_TreeView.NotifyListenersThatDragEnded(null, false);
         }
     }
     else
     {
         if (this.m_DropData == null)
         {
             this.m_DropData = new DropData();
         }
         this.m_DropData.dropTargetControlID = 0;
         this.m_DropData.rowMarkerControlID = 0;
         int itemControlID = TreeView.GetItemControlID(targetItem);
         this.HandleAutoExpansion(itemControlID, targetItem, targetItemRect, betweenHalfHeight, mousePosition);
         if (below == DropPosition.Upon)
         {
             none = this.DoDrag(targetItem, targetItem, false, below);
         }
         if (none != DragAndDropVisualMode.None)
         {
             this.m_DropData.dropTargetControlID = itemControlID;
             DragAndDrop.visualMode = none;
         }
         else if ((targetItem != null) && (parent != null))
         {
             none = this.DoDrag(parent, targetItem, false, below);
             if (none != DragAndDropVisualMode.None)
             {
                 this.drawRowMarkerAbove = below == DropPosition.Above;
                 this.m_DropData.rowMarkerControlID = itemControlID;
                 this.m_DropData.dropTargetControlID = !this.drawRowMarkerAbove ? TreeView.GetItemControlID(parent) : 0;
                 DragAndDrop.visualMode = none;
             }
         }
     }
     Event.current.Use();
     return true;
 }
Exemplo n.º 42
0
Arquivo: Item.cs Projeto: xKamuna/aura
		/// <summary>
		/// Creates new item based on drop data.
		/// </summary>
		/// <param name="dropData"></param>
		public Item(DropData dropData)
			: this(dropData.ItemId)
		{
			var rnd = RandomProvider.Get();

			this.Info.Amount = (ushort)rnd.Next(dropData.AmountMin, dropData.AmountMax + 1);
			if (this.Data.StackType != StackType.Sac && this.Info.Amount < 1)
				this.Info.Amount = 1;

			this.OptionInfo.Prefix = (ushort)dropData.Prefix;
			this.OptionInfo.Suffix = (ushort)dropData.Suffix;

			if (dropData.Color1 != null) this.Info.Color1 = (uint)dropData.Color1;
			if (dropData.Color2 != null) this.Info.Color2 = (uint)dropData.Color2;
			if (dropData.Color3 != null) this.Info.Color3 = (uint)dropData.Color3;

			if (dropData.Durability != -1)
				this.Durability = dropData.Durability;
		}
Exemplo n.º 43
0
		public GlobalDropByType(string identifier, GlobalDropType type, DropData data)
			: base(identifier, data)
		{
			this.Type = type;
		}
Exemplo n.º 44
0
		/// <summary>
		/// Adds global drop by type.
		/// </summary>
		/// <param name="tag"></param>
		/// <param name="data"></param>
		protected void AddGlobalDrop(GlobalDropType type, DropData data)
		{
			ChannelServer.Instance.GameEventManager.GlobalBonuses.AddDrop(this.Id, new GlobalDropByType(this.Id, type, data));
		}
Exemplo n.º 45
0
		/// <summary>
		/// Adds global drop by race tag.
		/// </summary>
		/// <param name="tag"></param>
		/// <param name="data"></param>
		protected void AddGlobalDrop(string tag, DropData data)
		{
			ChannelServer.Instance.GameEventManager.GlobalBonuses.AddDrop(this.Id, new GlobalDropByTag(this.Id, tag, data));
		}
Exemplo n.º 46
0
		/// <summary>
		/// Adds global drop by race id.
		/// </summary>
		/// <param name="raceId"></param>
		/// <param name="data"></param>
		protected void AddGlobalDrop(int raceId, DropData data)
		{
			ChannelServer.Instance.GameEventManager.GlobalBonuses.AddDrop(this.Id, new GlobalDropById(this.Id, raceId, data));
		}
Exemplo n.º 47
0
 /// <summary>
 /// 將字典傳入,依json表設定資料
 /// </summary>
 public static void SetData(Dictionary<int, DropData> _dic)
 {
     string jsonStr = Resources.Load<TextAsset>("Json/Drop").ToString();
     JsonData jd = JsonMapper.ToObject(jsonStr);
     JsonData items = jd["Drop"];
     for (int i = 0; i < items.Count; i++)
     {
         DropData dropData = new DropData(items[i]);
         int id = int.Parse(items[i]["ID"].ToString());
         _dic.Add(id, dropData);
     }
 }