Example #1
0
        public override void OnActivate(int pinID)
        {
            if (pinID != 1 || ((Behaviour)this).get_enabled())
            {
                return;
            }
            PlayerData player = MonoSingleton <GameManager> .Instance.Player;

            if (Network.Mode == Network.EConnectMode.Offline)
            {
                for (int index = 0; index < GlobalVars.ConvertAwakePieceList.Count; ++index)
                {
                    SellItem convertAwakePiece = GlobalVars.ConvertAwakePieceList[index];
                    player.GainPiecePoint((int)convertAwakePiece.item.RarityParam.PieceToPoint * convertAwakePiece.num);
                    player.GainItem(convertAwakePiece.item.Param.iname, -convertAwakePiece.num);
                    convertAwakePiece.num   = 0;
                    convertAwakePiece.index = -1;
                }
                GlobalVars.ConvertAwakePieceList.Clear();
                this.Success();
            }
            else
            {
                Dictionary <long, int> sells = new Dictionary <long, int>();
                List <SellItem>        convertAwakePieceList = GlobalVars.ConvertAwakePieceList;
                for (int index = 0; index < convertAwakePieceList.Count; ++index)
                {
                    long uniqueId = convertAwakePieceList[index].item.UniqueID;
                    int  num      = convertAwakePieceList[index].num;
                    sells[uniqueId] = num;
                }
                this.ExecRequest((WebAPI) new ReqSellPiece(sells, new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback)));
                ((Behaviour)this).set_enabled(true);
            }
        }
Example #2
0
        private void createDisplaySellItem(List <ItemData> list)
        {
            List <SellItem> sellItemList = new List <SellItem>();

            using (List <ItemData> .Enumerator enumerator = list.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    ItemData   current    = enumerator.Current;
                    GameObject gameObject = this.CreateItem();
                    if (UnityEngine.Object.op_Equality((UnityEngine.Object)gameObject, (UnityEngine.Object)null))
                    {
                        DebugUtility.LogError("CreateItem returned NULL");
                        return;
                    }
                    gameObject.get_transform().SetParent((Transform)this.ListParent, false);
                    ListItemEvents component = (ListItemEvents)gameObject.GetComponent <ListItemEvents>();
                    if (UnityEngine.Object.op_Inequality((UnityEngine.Object)component, (UnityEngine.Object)null))
                    {
                        component.OnSelect = new ListItemEvents.ListItemEvent(this.OnSelect);
                    }
                    if (current.ItemType != EItemType.Other)
                    {
                        this.mSellItemGameObjects.Add(gameObject);
                        SellItem orSearchSellItem = this.CreateOrSearchSellItem(current);
                        sellItemList.Add(orSearchSellItem);
                        DataSource.Bind <SellItem>(gameObject, orSearchSellItem);
                    }
                }
            }
            this.mSellItemList = sellItemList;
        }
Example #3
0
        private void OnSellNumChanged(float value)
        {
            SellItem selectSellItem = GlobalVars.SelectSellItem;

            if (selectSellItem == null)
            {
                return;
            }
            selectSellItem.num = (int)value;
            GameParameter.UpdateAll(((Component)this).get_gameObject());
        }
Example #4
0
        private SellItem CreateOrSearchSellItem(ItemData item)
        {
            SellItem sellItem = this.SearchFromSelectedItem(item);

            if (sellItem == null)
            {
                sellItem       = new SellItem();
                sellItem.item  = item;
                sellItem.num   = 0;
                sellItem.index = -1;
            }
            else
            {
                Debug.Log((object)("Exist SellItem num=" + (object)sellItem.num));
            }
            return(sellItem);
        }
Example #5
0
        public override void OnActivate(int pinID)
        {
            if (pinID != 1 || ((Behaviour)this).get_enabled())
            {
                return;
            }
            PlayerData player = MonoSingleton <GameManager> .Instance.Player;

            if (Network.Mode == Network.EConnectMode.Offline)
            {
                for (int index = 0; index < GlobalVars.SellItemList.Count; ++index)
                {
                    SellItem sellItem = GlobalVars.SellItemList[index];
                    player.GainGold(sellItem.item.Sell * sellItem.num);
                    player.GainItem(sellItem.item.Param.iname, -sellItem.num);
                    sellItem.num   = 0;
                    sellItem.index = -1;
                    AnalyticsManager.TrackCurrencyObtain(AnalyticsManager.CurrencyType.Zeni, AnalyticsManager.CurrencySubType.FREE, (long)(sellItem.item.Sell * sellItem.num), "Sell Item", (Dictionary <string, object>)null);
                    AnalyticsManager.TrackCurrencyUse(AnalyticsManager.CurrencyType.Item, AnalyticsManager.CurrencySubType.FREE, (long)sellItem.num, "Sell Item", new Dictionary <string, object>()
                    {
                        {
                            "item_id",
                            (object)sellItem.item.ItemID
                        }
                    });
                }
                GlobalVars.SelectSellItem = (SellItem)null;
                GlobalVars.SellItemList.Clear();
                GlobalVars.SellItemList = (List <SellItem>)null;
                this.Success();
            }
            else
            {
                Dictionary <long, int> sells        = new Dictionary <long, int>();
                List <SellItem>        sellItemList = GlobalVars.SellItemList;
                for (int index = 0; index < sellItemList.Count; ++index)
                {
                    long uniqueId = sellItemList[index].item.UniqueID;
                    int  num      = sellItemList[index].num;
                    sells[uniqueId] = num;
                }
                this.ExecRequest((WebAPI) new ReqItemSell(sells, new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback)));
                ((Behaviour)this).set_enabled(true);
            }
        }
Example #6
0
        private void OnAddNum()
        {
            SellItem selectSellItem = GlobalVars.SelectSellItem;

            if (selectSellItem == null)
            {
                return;
            }
            if (selectSellItem.num < selectSellItem.item.Num)
            {
                ++selectSellItem.num;
            }
            if (!Object.op_Inequality((Object)this.SellNumSlider, (Object)null))
            {
                return;
            }
            this.SellNumSlider.set_value((float)selectSellItem.num);
        }
Example #7
0
        private void OnDecide()
        {
            SellItem selectSellItem = GlobalVars.SelectSellItem;

            if (selectSellItem.num > 0)
            {
                if (!GlobalVars.SellItemList.Contains(selectSellItem))
                {
                    GlobalVars.SellItemList.Add(selectSellItem);
                }
            }
            else
            {
                selectSellItem.index = -1;
                selectSellItem.num   = 0;
                GlobalVars.SellItemList.Remove(selectSellItem);
            }
            FlowNode_GameObject.ActivateOutputLinks((Component)this, 100);
        }
Example #8
0
        private void Refresh()
        {
            SellItem selectSellItem = GlobalVars.SelectSellItem;

            if (selectSellItem == null)
            {
                return;
            }
            if (Object.op_Inequality((Object)this.SellNumSlider, (Object)null))
            {
                ((UnityEventBase)this.SellNumSlider.get_onValueChanged()).RemoveAllListeners();
                this.SellNumSlider.set_maxValue((float)selectSellItem.item.Num);
                // ISSUE: method pointer
                ((UnityEvent <float>) this.SellNumSlider.get_onValueChanged()).AddListener(new UnityAction <float>((object)this, __methodptr(OnSellNumChanged)));
                this.SellNumSlider.set_value((float)selectSellItem.num);
            }
            this.mSaveSellNum = selectSellItem.num;
            DataSource.Bind <SellItem>(((Component)this).get_gameObject(), selectSellItem);
            GameParameter.UpdateAll(((Component)this).get_gameObject());
        }
Example #9
0
        private void OnSelect(GameObject go)
        {
            SellItem dataOfClass = DataSource.FindDataOfClass <SellItem>(go, (SellItem)null);

            if (dataOfClass == null || dataOfClass.item == null || dataOfClass.item.Num == 0)
            {
                Debug.Log((object)"invalid state");
            }
            else
            {
                GlobalVars.SelectSellItem = dataOfClass;
                GlobalVars.SellItemList   = this.mSellItemListSelected;
                ItemData itemData = dataOfClass.item;
                if (itemData.Num > 1)
                {
                    if (!this.mSellItemListSelected.Contains(dataOfClass) && this.mSellItemListSelected.Count == 10)
                    {
                        return;
                    }
                    FlowNode_GameObject.ActivateOutputLinks((Component)this, 101);
                }
                else if (this.mSellItemListSelected.Remove(dataOfClass))
                {
                    dataOfClass.index = -1;
                    dataOfClass.num   = 0;
                    this.UpdateSellIndex();
                    GameParameter.UpdateAll(((Component)this).get_gameObject());
                }
                else
                {
                    if (this.mSellItemListSelected.Count == 10)
                    {
                        return;
                    }
                    dataOfClass.num = itemData.Num;
                    this.mSellItemListSelected.Add(dataOfClass);
                    this.UpdateSellIndex();
                    GameParameter.UpdateAll(((Component)this).get_gameObject());
                }
            }
        }
Example #10
0
        private void UpdateDispalyItem(List <ItemData> list)
        {
            List <SellItem> sellItemList = new List <SellItem>();

            for (int index = 0; index < this.mSellItemGameObjects.Count; ++index)
            {
                GameObject sellItemGameObject = this.mSellItemGameObjects[index];
                sellItemGameObject.SetActive(true);
                if (index < list.Count)
                {
                    SellItem orSearchSellItem = this.CreateOrSearchSellItem(list[index]);
                    sellItemList.Add(orSearchSellItem);
                    DataSource.Bind <SellItem>(sellItemGameObject, orSearchSellItem);
                    sellItemGameObject.get_transform().set_localScale(Vector3.get_one());
                }
                else
                {
                    sellItemGameObject.get_transform().set_localScale(Vector3.get_zero());
                }
            }
            this.mSellItemList = sellItemList;
        }
Example #11
0
        public override void OnActivate(int pinID)
        {
            if (pinID != 1 && pinID != 2 || ((Behaviour)this).get_enabled())
            {
                return;
            }
            PlayerData player = MonoSingleton <GameManager> .Instance.Player;

            if (Network.Mode == Network.EConnectMode.Offline)
            {
                for (int index = 0; index < GlobalVars.SellItemList.Count; ++index)
                {
                    SellItem sellItem = GlobalVars.SellItemList[index];
                    player.GainGold(sellItem.item.Sell * sellItem.num);
                    player.GainItem(sellItem.item.Param.iname, -sellItem.num);
                    sellItem.num   = 0;
                    sellItem.index = -1;
                }
                GlobalVars.SelectSellItem = (SellItem)null;
                GlobalVars.SellItemList.Clear();
                GlobalVars.SellItemList = (List <SellItem>)null;
                this.Success();
            }
            else
            {
                Dictionary <long, int> sells        = new Dictionary <long, int>();
                List <SellItem>        sellItemList = GlobalVars.SellItemList;
                for (int index = 0; index < sellItemList.Count; ++index)
                {
                    long uniqueId = sellItemList[index].item.UniqueID;
                    int  num      = sellItemList[index].num;
                    sells[uniqueId] = num;
                }
                this.ExecRequest((WebAPI) new ReqItemSell(sells, pinID == 2, new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback)));
                ((Behaviour)this).set_enabled(true);
            }
        }