Exemplo n.º 1
0
 private void StoreItemClick(UnityEngine.GameObject goc)
 {
     foreach (storeInfo si in storeDic.Values)
     {
         if (si != null)
         {
             if (si.go == goc)
             {
                 if (si.CanBuyTime == 0)
                 {
                     //已卖完
                 }
                 else
                 {
                     //需要兑换
                     ArkCrossEngine.StoreConfig sc = ArkCrossEngine.StoreConfigProvider.Instance.GetDataById(si.ID);
                     if (sc != null)
                     {
                         ArkCrossEngine.ItemConfig itemconfig = ArkCrossEngine.ItemConfigProvider.Instance.GetDataById(sc.m_ItemId);
                         if (itemconfig != null)
                         {
                             if (itemconfig.m_CanWear)
                             {
                                 EquipmentInfo ei = GamePokeyManager.GetEquipmentInfo(itemconfig.m_WearParts);
                                 if (ei != null)
                                 {
                                     UnityEngine.GameObject go = UIManager.Instance.GetWindowGoByName("ItemProperty");
                                     if (go != null && !NGUITools.GetActive(go))
                                     {
                                         ItemProperty ip = go.GetComponent <ItemProperty>();
                                         if (ip != null)
                                         {
                                             ip.ExchangeGoodsCompare(currencySprite, si.ID, ei.id, ei.level, ei.propertyid, sc.m_ItemId, ei.level, ei.propertyid, itemconfig.m_WearParts, si.GetCurrency());
                                             UIManager.Instance.ShowWindowByName("ItemProperty");
                                         }
                                     }
                                 }
                             }
                             else
                             {
                                 UnityEngine.GameObject go = UIManager.Instance.GetWindowGoByName("ItemProperty");
                                 if (go != null && !NGUITools.GetActive(go))
                                 {
                                     ItemProperty ip = go.GetComponent <ItemProperty>();
                                     if (ip != null)
                                     {
                                         ip.ExchangeGoodsSetItemProperty(currencySprite, si.ID, sc.m_ItemId, 0, 0, 0, si.GetCurrency());
                                         UIManager.Instance.ShowWindowByName("ItemProperty");
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
 }
Exemplo n.º 2
0
 public int GetCurrency()
 {
     ArkCrossEngine.StoreConfig sc = ArkCrossEngine.StoreConfigProvider.Instance.GetDataById(ID);
     if (sc != null)
     {
         if (sc.m_HaveDayLimit)
         {
             if (sc.m_Price.Count > sc.m_DayLimit - CanBuyTime)
             {
                 return(sc.m_Price[sc.m_DayLimit - CanBuyTime]);
             }
         }
         else
         {
             return(sc.m_Price[0]);
         }
     }
     return(0);
 }
Exemplo n.º 3
0
 // Update is called once per frame
 void Update()
 {
     try
     {
         RoleInfo ri = ArkCrossEngine.LobbyClient.Instance.CurrentRole;
         if (ri != null)
         {
             int nowcurrency = 0;
             if (currencyId == ItemConfigProvider.Instance.GetGoldId())
             {
                 nowcurrency = ri.Money;
             }
             else if (currencyId == ItemConfigProvider.Instance.GetDiamondId())
             {
                 nowcurrency = ri.Gold;
             }
             else
             {
                 nowcurrency = ri.ExchangeCurrency;
             }
             if (nowcurrency != lastcurrency)
             {
                 lastcurrency = nowcurrency;
                 foreach (storeInfo si in storeDic.Values)
                 {
                     ArkCrossEngine.StoreConfig sc = ArkCrossEngine.StoreConfigProvider.Instance.GetDataById(si.ID);
                     if (sc != null)
                     {
                         SetGameObjectInfo(si.go, sc, si.CanBuyTime);
                     }
                 }
                 if (currencyLabel != null)
                 {
                     currencyLabel.text = lastcurrency.ToString();
                 }
             }
         }
     }
     catch (System.Exception ex)
     {
         ArkCrossEngine.LogicSystem.LogErrorFromGfx("Exception {0}\n{1}", ex.Message, ex.StackTrace);
     }
 }
Exemplo n.º 4
0
    void ManageExchangeGoods(int currency, bool refresh, ArkCrossEngine.Network.GeneralOperationResult result, int exchangeid, int exchangenum)
    {
        try
        {
            GfxSystem.PublishGfxEvent("ge_ui_connect_hint", "ui", false, false);
            if (currency != currencyId && currency != 0)
            {
                return;
            }
            if (refresh)
            {
                if (result == ArkCrossEngine.Network.GeneralOperationResult.LC_Succeed)
                {
                    DataDictionaryMgr <StoreConfig> storedata = ArkCrossEngine.StoreConfigProvider.Instance.StoreDictionaryMgr;
                    if (storedata != null)
                    {
                        MyDictionary <int, object> storedic = storedata.GetData();
                        if (storedic != null)
                        {
                            StoreConfig sc = null;
                            foreach (KeyValuePair <int, object> pair in storedic)
                            {
                                sc = pair.Value as StoreConfig;
                                if (sc != null)
                                {
                                    if (sc.m_Currency == currencyId || (currency == 0 && sc.m_Currency == currencyId))
                                    {
                                        AddItem(pair.Key, 0);
                                    }
                                }
                            }
                        }
                    }
                }
                else if (result == ArkCrossEngine.Network.GeneralOperationResult.LC_Failure_CostError)
                {
                    ArkCrossEngine.LogicSystem.EventChannelForGfx.Publish("ge_show_dialog", "ui", ArkCrossEngine.StrDictionaryProvider.Instance.GetDictString(123),
                                                                          ArkCrossEngine.StrDictionaryProvider.Instance.GetDictString(140), null, null, null, false);
                }
            }
            else
            {
                if (result == ArkCrossEngine.Network.GeneralOperationResult.LC_Succeed)
                {
                    AddItem(exchangeid, exchangenum);
                    ArkCrossEngine.StoreConfig sc = ArkCrossEngine.StoreConfigProvider.Instance.GetDataById(exchangeid);
                    if (sc != null)
                    {
                        ArkCrossEngine.ItemConfig ic = ArkCrossEngine.ItemConfigProvider.Instance.GetDataById(sc.m_ItemId);
                        if (ic != null)
                        {
                            GfxSystem.PublishGfxEvent("ge_screen_tip", "ui", ArkCrossEngine.StrDictionaryProvider.Instance.GetDictString(1005)
                                                      + ic.m_ItemName + "X" + sc.m_ItemNum, UIScreenTipPosEnum.AlignCenter, UnityEngine.Vector3.zero);
                        }
                    }
                }
                else
                {
                    //提示
                    int sign = 1003;
                    switch (result)
                    {
                    case ArkCrossEngine.Network.GeneralOperationResult.LC_Failure_CostError:
                        sign = 1000;
                        break;

                    case ArkCrossEngine.Network.GeneralOperationResult.LC_Failure_Overflow:
                        sign = 1001;
                        break;

                    case ArkCrossEngine.Network.GeneralOperationResult.LC_Failure_LevelError:
                        sign = 1002;
                        break;

                    default:
                        sign = 1003;
                        break;
                    }
                    GfxSystem.PublishGfxEvent("ge_screen_tip", "ui", ArkCrossEngine.StrDictionaryProvider.Instance.GetDictString(sign), UIScreenTipPosEnum.AlignCenter, UnityEngine.Vector3.zero);
                }
            }
            UIGrid ug = gridGo.GetComponent <UIGrid>();
            if (ug != null)
            {
                ug.repositionNow = true;
            }
        }
        catch (Exception ex)
        {
            ArkCrossEngine.LogicSystem.LogFromGfx("[Error]:Exception:{0}\n{1}", ex.Message, ex.StackTrace);
        }
    }