Ejemplo n.º 1
0
    /// <summary>
    /// </summary>
    /// <param name="p_name"></param>
    /// <param name="isShowAnimation"></param>
    /// <returns></returns>
    public bool CloseUI(string p_name, bool isShowAnimation)
    {
        try
        {
            if (!m_UIItemMap.ContainsKey(p_name))
            {
                throw new KeyNotFoundException(string.Format("Cannot close UI: {0} cause key not found in UIItemMap",
                                                             p_name));
            }

            if (m_UIItemMap.ContainsKey(p_name) && !m_UIItemMap[p_name].IsShowing)
            {
                LogModule.WarningLog("Cancel close {0} UI cause already closed.", p_name);
                return(false);
            }

            if (isShowAnimation)
            {
                m_UIItemMap[p_name].ViewBase.OnClose();
            }
            else
            {
                CloseUIInternal(p_name);
            }

            return(true);
        }
        catch (Exception e)
        {
            LogModule.ErrorLog("Exception in close UI, {0}\n{1}", e.Message, e.StackTrace);
            return(false);
        }
    }
    /// <summary>
    /// 设置升级侠客信息
    /// </summary>
    void SetLevelUpSwordsMan(SwordsMan oSwordsMan, SwordsManToolTipsLogic.SwordsMan_ShowType ShowType)
    {
        m_curChooseQuality = SwordsMan.SWORDSMANQUALITY.ORANGE;
        m_bClearAllSelect  = false;
        m_SwordsManGuid    = oSwordsMan.Guid;

        if (null == oSwordsMan)
        {
            LogModule.ErrorLog("SetLevelUpSwordsMan::oSwordsMan is null");
            return;
        }
        if (SwordsManToolTipsLogic.SwordsMan_ShowType.Equiped == ShowType)
        {
            m_PackType = SwordsManContainer.PACK_TYPE.TYPE_EQUIPPACK;
        }
        else if (SwordsManToolTipsLogic.SwordsMan_ShowType.UnEquiped == ShowType)
        {
            m_PackType = SwordsManContainer.PACK_TYPE.TYPE_BACKPACK;
        }
        else
        {
            LogModule.ErrorLog("SetLevelUpSwordsMan::ShowType invalid");
            return;
        }
        if (m_LabelTips != null)
        {
            m_LabelTips.text = StrDictionary.GetClientDictionaryString("#{2719}");
        }
        UpdateSwordsManBackPack();
        UpdateSwordsManInfo();
    }
Ejemplo n.º 3
0
    // 读表展示UI,
    public static bool ShowUIByID(int tableID, OnOpenUIDelegate delOpenUI = null, object param = null)
    {
        if (null == m_instance)
        {
            LogModule.ErrorLog("game manager is not init");
            return(false);
        }

        Tab_UIPath curTabPath = TableManager.GetUIPathByID(tableID, 0);

        if (null == curTabPath)
        {
            LogModule.ErrorLog("cur ui is not set in table" + tableID);
            return(false);
        }

        if (!UIPathData.m_DicUIInfo.ContainsKey(curTabPath.Path))
        {
            LogModule.ErrorLog("cur ui is not set in table" + curTabPath.Path);
            return(false);
        }

        UIPathData curData = UIPathData.m_DicUIInfo[curTabPath.Path];

        return(UIManager.ShowUI(curData, delOpenUI, param));
    }
Ejemplo n.º 4
0
    private void CalcuteCreateBelleState()
    {
        if (BelleInfoWindow.Instance() != null && m_CreateBelle != null)
        {
            Tab_Belle belleTab = BelleInfoWindow.Instance().CurSellectedBelleData;

            if (null == belleTab)
            {
                LogModule.ErrorLog("BelleInfoWindow.Instance().CurSellectedBelleData is null!");
                return;
            }

            int belleSubItemId     = belleTab.BelleItemID;
            int belleTotalSubCount = belleTab.BelleItemCount;
            int belleSubItemCount  = GameManager.gameManager.PlayerDataPool.BackPack.GetItemCountByDataId(belleSubItemId);

            //数量不够显示获取界面
            if (belleTotalSubCount > 0 && belleSubItemCount < belleTotalSubCount)
            {
                m_CreateBelle.isEnabled = false;
            }
            else if (belleTotalSubCount > 0 && belleSubItemCount >= belleTotalSubCount)
            {
                m_CreateBelle.isEnabled = true;
            }
        }
    }
    //加载购买界面物品条目item
    void OnLoadBuyItem(GameObject resObj, object param)
    {
        if (null == resObj)
        {
            LogModule.ErrorLog("load OnLoadBuyItem error");
            return;
        }
        for (int nIndex = 0; nIndex < (int)ConsignSaleData.MAXCOUNTSANDTOCLIENT; ++nIndex)
        {
            GameObject _gameObject = Utils.BindObjToParent(resObj, m_buyGird, (nIndex + 1000).ToString());
            if (null != _gameObject)
            {
                ConsignsaleBuyItem buyItem = _gameObject.GetComponent <ConsignsaleBuyItem>();
                if (null != buyItem)
                {
                    buyItem.SetItemIndex(nIndex);
                    m_BuyItem[nIndex] = buyItem;
                }

                _gameObject.SetActive(false);
            }
        }

        //加载完后 开始加载左边分类按钮
        CreateSearchClassBtItem();
        m_bBuyItemLoad = true;
    }
Ejemplo n.º 6
0
    void OnLoadBackPackItem(GameObject resObj, object param)
    {
        if (null == resObj)
        {
            LogModule.ErrorLog("load cangku backpack item error");
            return;
        }
        GameItemContainer itempack = GameManager.gameManager.PlayerDataPool.BackPack;

        for (int nIndex = 0; nIndex < itempack.ContainerSize; ++nIndex)
        {
            GameObject itemobject = Utils.BindObjToParent(resObj, m_CangKuBackPackItemGrid, (nIndex + 1000).ToString());
            if (itemobject != null)
            {
                CangKuBackItemLogic itemLogic = itemobject.GetComponent <CangKuBackItemLogic>();
                if (itemLogic != null)
                {
                    m_CangKuBackItems.Add(itemLogic);
                    itemLogic.UpdateEmpty();
                }
            }
        }
        m_CangKuBackPackItemGrid.GetComponent <UIGrid>().sorted        = true;
        m_CangKuBackPackItemGrid.GetComponent <UIGrid>().repositionNow = true;

        UpdateBackPack();
    }
Ejemplo n.º 7
0
        public ServerListData(string id, string name, string ip, string port, string state, string type)
        {
            if (!int.TryParse(id, out m_id))
            {
                LogModule.ErrorLog("id parse error");
            }

            m_name = name;
            m_ip   = ip;

            if (!int.TryParse(port, out m_port))
            {
                LogModule.ErrorLog("port parse error");
            }

            if (!int.TryParse(state, out m_state))
            {
                LogModule.ErrorLog("state parse error");
            }

            if (!int.TryParse(type, out m_type))
            {
                LogModule.ErrorLog("type parse error");
            }
        }
Ejemplo n.º 8
0
    // 获取版本号回调
    void OnCheckVersion(bool bSuccess)
    {
        if (bSuccess)
        {
            LogModule.DebugLog("comparing version");

            // 比较版本号
            LogModule.DebugLog("version --local:" + m_localVersion.ToString() + " --remote:" + m_remoteVersion);
            if (m_remoteVersion > m_localVersion)
            {
                Utils.DeleteFolder(CacheVersionPath);
                LogModule.DebugLog("remote version is big than local, begin update");

                m_curUpdateStep = UpdateStep.GetFileList;

                // 下载文件列表
                m_versionFileDownloader = DownloadHelper.StartDownload(this, m_resServerUrl + "/" + ResFileListName, true, CacheVersionPath + "/" + ResFileListName, OnDownloadRemoteResFileList);
            }
            else
            {
                StartCoroutine(OnDownloadlevelIndexFile());
            }
        }
        else
        {
            // error 严重错误,可能网络不通,需要重新请求
            LogModule.ErrorLog("check verion fail");
            UpdateFinish(UpdateResult.GetVersionFail);
        }
    }
Ejemplo n.º 9
0
    // 拷贝文件列表
    void GenerateLocalFileList()
    {
        try
        {
            LogModule.DebugLog("copy filelist");
            string localFileListName = LocalVersionPath + "/" + ResFileListName;
            //string cacheFileListName = CacheVersionPath + "/" + ResFileListName;

            if (!Utils.GenerateResFileList(localFileListName, m_dicLocalFiles))
            {
                LogModule.ErrorLog("generate version file fail!");
                UpdateFinish(UpdateResult.GenerateVersionFileFail);
            }

            //Utils.CheckTargetPath(localFileListName);
            //File.Copy(cacheFileListName, localFileListName, true);
        }
        catch (System.Exception ex)
        {
            LogModule.ErrorLog("generate version file fail!" + ex.ToString());
            UpdateFinish(UpdateResult.GenerateFileListFail);
            return;
        }

        GenerateResLevelFile();
    }
Ejemplo n.º 10
0
        /// <summary>
        /// 从XML字符串中反序列化对象
        /// </summary>
        /// <typeparam name="T">结果对象类型</typeparam>
        /// <param name="s">包含对象的XML字符串</param>
        /// <param name="encoding">编码方式</param>
        /// <returns>反序列化得到的对象</returns>
        public static T XmlDeserialize <T>(string s, Encoding encoding)
        {
            try
            {
                if (string.IsNullOrEmpty(s))
                {
                    throw new ArgumentNullException("s");
                }
                if (encoding == null)
                {
                    throw new ArgumentNullException("encoding");
                }

                XmlSerializer mySerializer = new XmlSerializer(typeof(T));
                using (MemoryStream ms = new MemoryStream(encoding.GetBytes(s)))
                {
                    using (StreamReader sr = new StreamReader(ms, encoding))
                    {
                        return((T)mySerializer.Deserialize(sr));
                    }
                }
            }
            catch (System.Exception e)
            {
                LogModule.ErrorLog("Deserialize object from string error " + " e: " + e.ToString());
                return(default(T));
            }
        }
Ejemplo n.º 11
0
        /// <summary>
        /// 读入一个文件,并按XML的方式反序列化对象。
        /// </summary>
        /// <typeparam name="T">结果对象类型</typeparam>
        /// <param name="path">文件路径</param>
        /// <param name="encoding">编码方式</param>
        /// <returns>反序列化得到的对象</returns>
        public static T XmlDeserializeFromFile <T>(string path, Encoding encoding)
        {
            try
            {
                if (string.IsNullOrEmpty(path) || !File.Exists(path))
                {
                    return(default(T));
                }

                if (encoding == null)
                {
                    throw new ArgumentNullException("encoding");
                }

                StreamReader objReader = new StreamReader(path, encoding);
                string       xml       = objReader.ReadToEnd();
                objReader.Close();

                return(XmlDeserialize <T>(xml, encoding));
            }
            catch (System.Exception e)
            {
                LogModule.ErrorLog("Deserialize object from file error: " + path + " e: " + e.ToString());
                return(default(T));
            }
        }
Ejemplo n.º 12
0
    public void ReportState(string p_name, string p_funcName)
    {
        try
        {
            switch (p_funcName)
            {
            case "OnEnable":
            {
                //OpenUI(p_name, null, false);

                break;
            }

            case "OnDisable":
            {
                //CloseUI(p_name, false);

                break;
            }

            case "Destroy":
            {
                //DestroyUI(p_name);

                break;
            }
            }
        }
        catch (Exception e)
        {
            LogModule.ErrorLog("Exception in report UI state, {0}\n{1}", e.Message, e.StackTrace);
            throw;
        }
    }
Ejemplo n.º 13
0
    private bool DestroyUIInternal(string p_name)
    {
        try
        {
            if (!m_UIItemMap.ContainsKey(p_name))
            {
                throw new KeyNotFoundException(string.Format("Cannot destroy UI: {0} cause key not found in UIItemMap",
                                                             p_name));
            }

            var item = m_UIItemMap[p_name];

            Object.Destroy(item.RootObject);
            if (item.Mediator != null)
            {
                MediatorManager.GetInstance().Remove(item.Mediator.GetType());
            }

            GameAssets.SubBundleRef(m_UIItemMap[p_name].BundlePath);

            m_UICategoryMap[item.CategoryName].RemoveItem(item);
            m_UIItemMap.Remove(p_name);

            return(true);
        }
        catch (Exception e)
        {
            LogModule.ErrorLog("Exception in destroy UI, {0}\n{1}", e.Message, e.StackTrace);
            return(false);
        }
    }
Ejemplo n.º 14
0
    /// <summary>
    ///
    /// </summary>
    /// <param name="p_name"></param>
    /// <returns></returns>
    private bool DestroyUI(string p_name, bool isShowAnimation)
    {
        try
        {
            if (!m_UIItemMap.ContainsKey(p_name))
            {
                throw new KeyNotFoundException(string.Format("Cannot destroy UI: {0} cause key not found in UIItemMap",
                                                             p_name));
            }

            if (isShowAnimation)
            {
                m_UIItemMap[p_name].ViewBase.OnCloseUIComplete += () =>
                {
                    DestroyUIInternal(p_name);
                };
                if (!CloseUI(p_name, true))
                {
                    DestroyUIInternal(p_name);
                }
            }
            else
            {
                return(DestroyUIInternal(p_name));
            }

            return(true);
        }
        catch (Exception e)
        {
            LogModule.ErrorLog("Exception in destroy UI, {0}\n{1}", e.Message, e.StackTrace);
            return(false);
        }
    }
Ejemplo n.º 15
0
 private void OnShowChangeName(ChangeNameType NameType)
 {
     if (m_ChangeNameTitleLable != null)
     {
         m_ChangeNameTitleLable.text = "";
     }
     if (NameType < ChangeNameType.ChangeNameType_PlayerName || NameType > ChangeNameType.ChangeNameType_PlayerName_CombineServer)
     {
         LogModule.ErrorLog("OnShowChangeName::NameType is invalid");
         return;
     }
     m_NameType = NameType;
     if (ChangeNameType.ChangeNameType_PlayerName == m_NameType || ChangeNameType.ChangeNameType_PlayerName_CombineServer == m_NameType)
     {
         m_ChangeNameTitleLable.text = StrDictionary.GetClientDictionaryString("#{3054}");
     }
     else if (ChangeNameType.ChangeNameType_GuildName == m_NameType)
     {
         m_ChangeNameTitleLable.text = StrDictionary.GetClientDictionaryString("#{3055}");
     }
     else if (ChangeNameType.ChangeNameType_MasterName == m_NameType)
     {
         m_ChangeNameTitleLable.text = StrDictionary.GetClientDictionaryString("#{3056}");
     }
 }
Ejemplo n.º 16
0
    void SetTipText(int nMissionID, byte yQuality)
    {
        Tab_MissionBase MissionBase = TableManager.GetMissionBaseByID(nMissionID, 0);

        if (MissionBase == null || MissionBase.MissionType != (int)MISSIONTYPE.MISSION_DAILY)
        {
            LogModule.ErrorLog("Can not find missionBase {0}", nMissionID);
            return;
        }

        Tab_DailyMission DailyMission = TableManager.GetDailyMissionByID(MissionBase.DalityMissionTabID, 0);

        if (DailyMission == null)
        {
            LogModule.ErrorLog("Can not find DailyMission {0}", MissionBase.DalityMissionTabID);
            return;
        }

        Tab_MissionDictionary MisDec = TableManager.GetMissionDictionaryByID(MissionID, 0);

        if (MisDec == null)
        {
            LogModule.ErrorLog("Can not find missionDictionary {0}", MissionID);
            return;
        }

        if (m_NameText && m_QualityColorText && m_ActivenessText && m_MisDec)
        {
            m_NameText.text         = DailyMission.Name;
            m_QualityColorText.text = GetStrColorByQuality(yQuality);
            m_ActivenessText.text   = "+" + DailyMission.AwardActiveness;
            m_MisDec.text           = MisDec.MissionDesc;
        }
        return;
    }
Ejemplo n.º 17
0
        /// <summary>
        /// 日志检测处理方法
        /// </summary>
        /// <param name="message"></param>
        /// <param name="stacktrace"></param>
        /// <param name="type"></param>
        public void OnLog(string message, string stacktrace, LogType type)
        {
            if (UnityGuiConsole.Instance != null)
            {
                UnityGuiConsole.Instance.LogCallback(message, stacktrace, type);
            }
            switch (type)
            {
            case LogType.Exception:
            {
                string butMsg = "{\n" +
                                "\"message\":" + "\"" + message.Replace("\n", "") + "\"" +
                                ",\n\"stacktrace\":" + "\"" + stacktrace.Replace("\n", "") + "\"" +
                                ",\n\"time\":" + "\"" + PlatformHelper.getcurrentTime() + "\""
                                + "\n" + "\"" + "\n}";

                //PlatformHelper.UploadBug(butMsg);
                LogModule.DebugLog(butMsg);
                break;
            }

            case  LogType.Log:
                LogModule.DebugLog(message);
                break;

            case LogType.Warning:
                LogModule.WarningLog(message);
                break;

            case LogType.Error:
                LogModule.ErrorLog(message);
                break;
            }
        }
Ejemplo n.º 18
0
    bool IsMasterMission()
    {
        Tab_MissionBase MissionBase = TableManager.GetMissionBaseByID(m_nMissionID, 0);

        if (MissionBase == null)
        {
            LogModule.ErrorLog("Can not find missionBase {0}", m_nMissionID);
            return(false);
        }

        Tab_DailyMission DailyMission = TableManager.GetDailyMissionByID(MissionBase.DalityMissionTabID, 0);

        if (DailyMission == null)
        {
            LogModule.ErrorLog("Can not find dailyMission {0}", MissionBase.DalityMissionTabID);
            return(false);
        }

        if (DailyMission.Type == 0)
        {
            return(true);
        }

        return(false);
    }
Ejemplo n.º 19
0
    void OnLoadCangKuItem(GameObject resObj, object param)
    {
        if (null == resObj)
        {
            LogModule.ErrorLog("load cangku item error");
            return;
        }
        for (int nIndex = 0; nIndex < MAX_ITEM_PAGE; ++nIndex)
        {
            GameObject itemobject = Utils.BindObjToParent(resObj, m_CangKuItemGrid, (nIndex + 1000).ToString());
            if (null != itemobject)
            {
                m_CangKuItems[nIndex] = itemobject.GetComponent <CangKuItemLogic>();
                if (null != m_CangKuItems[nIndex])
                {
                    m_CangKuItems[nIndex].UpdateEmpty();
                }
            }
        }

        UIGrid cangKuItemGrid = m_CangKuItemGrid.GetComponent <UIGrid>();

        if (null != cangKuItemGrid)
        {
            cangKuItemGrid.sorted        = true;
            cangKuItemGrid.repositionNow = true;
        }

        ReqCangKuPackData();
        UpdateCangKu();
    }
Ejemplo n.º 20
0
    void OnNormalBtnClick()
    {
        if (null == m_curTabDesk || null == m_curDestData)
        {
            return;
        }
        if (null == RestaurantController.Instance())
        {
            LogModule.ErrorLog("OnNormalBtnClick::RestaurantController.Instance() is null ");
            return;
        }

        if (m_curDestData.m_IsActive)
        {
            if (m_curDestData.m_DestState == RestaurantData.DeskState.None)
            {
                RestaurantController.Instance().OpenFoodWindow(this);
            }
            else if (m_curDestData.m_DestState == RestaurantData.DeskState.PrepareFood)
            {
                FinishPrepareDesk();
            }
            else if (m_curDestData.m_DestState == RestaurantData.DeskState.WaitBilling)
            {
                RestaurantController.Instance().BillingDesk(this);
            }
            return;
        }
    }
Ejemplo n.º 21
0
    private void setCard(int nTempID)
    {
        if (TableManager.GetCardByID(nTempID) == null)
        {
            LogModule.ErrorLog("SetCardTemplateID(),card icon, no such template id: " + nTempID);
            return;
        }

        string atlasname = TableManager.GetAppearanceByID(TableManager.GetCardByID(nTempID).Appearance).HeadIcon;

        AtlasManager.Instance.setHeadName(cardIcon, atlasname);

        //iconFrame.spriteName = UserCardItem.iconFrameName[TableManager.GetCardByID(nTempID).Star];
        //iconFrame.transform.localScale=new Vector3(106,106,1);

        //cardIcon.transform.localScale = new Vector3(90,90, 1);
        //iconFrame.MakePixelPerfect();

        //------------------------卡牌背景及外框--------------------------------
        //2013-10-12 Jack Wen
        if (iconBorder != null)
        {
            int icon_star = TableManager.GetCardByID(nTempID).Star;
            iconFrame.spriteName  = UserCardItem.littleCardFrameName[icon_star];
            iconBorder.spriteName = UserCardItem.littleCardBorderName[icon_star];
        }
        //--------------------------------------------------------------------
    }
Ejemplo n.º 22
0
    void OnActiveDesk()
    {
        if (null == m_curDestData)
        {
            LogModule.ErrorLog("OnActiveDesk:: m_curDestData is null");
            return;
        }
        if (null == m_curTabDesk)
        {
            LogModule.ErrorLog("OnActiveDesk:: m_curTabDesk is null");
            return;
        }
        int nCostValue         = m_curTabDesk.OpenConditionValue;
        int nPlayerYuanBao     = GameManager.gameManager.PlayerDataPool.Money.GetMoney_YuanBao();
        int nPlayerBindYuanBao = GameManager.gameManager.PlayerDataPool.Money.GetMoney_YuanBaoBind();
        int nTotalYuanBao      = nPlayerBindYuanBao + nPlayerYuanBao;

        if (nTotalYuanBao < nCostValue)
        {
            GUIData.AddNotifyData("#{1018}");
            return;
        }
        CG_RESTAURANT_ACTIVEDESK packet = (CG_RESTAURANT_ACTIVEDESK)PacketDistributed.CreatePacket(MessageID.PACKET_CG_RESTAURANT_ACTIVEDESK);

        packet.SetDeskIndex(m_curDeskIndex);
        packet.SendPacket();
    }
Ejemplo n.º 23
0
    public void CreateBelle()
    {
        if (BelleInfoWindow.Instance() != null)
        {
            Tab_Belle belleTab = BelleInfoWindow.Instance().CurSellectedBelleData;

            if (null == belleTab)
            {
                LogModule.ErrorLog("BelleInfoWindow.Instance().CurSellectedBelleData is null!");
                return;
            }

            int belleSubItemId     = belleTab.BelleItemID;
            int belleTotalSubCount = belleTab.BelleItemCount;
            int belleSubItemCount  = GameManager.gameManager.PlayerDataPool.BackPack.GetItemCountByDataId(belleSubItemId);

            //数量不够显示获取界面
            if (belleTotalSubCount > 0 && belleSubItemCount < belleTotalSubCount)
            {
                //提示数量不够
            }
            else if (belleTotalSubCount > 0 && belleSubItemCount >= belleTotalSubCount)
            {
                //合成,发送消息包
                ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////合成美人发送消息包。
                Tab_CommonItem commonItemTab = TableManager.GetCommonItemByID(belleSubItemId, 0);
                if (commonItemTab != null)
                {
                    string tip = StrDictionary.GetClientDictionaryString("#{10257}", commonItemTab.Name, belleTotalSubCount);
                    //定义一个激活美人消息包
                    MessageBoxLogic.OpenOKCancelBox(tip, "", DoGetBelle);
                }
            }
        }
    }
Ejemplo n.º 24
0
        public string GetPath(int id, EResourceType type)
        {
            string url = "";

            switch (type)
            {
            case EResourceType.Effect:
            {
                Tab_Effect data = TableManager.GetEffectByID(id, 0);
                if (data == null)
                {
                    LogModule.ErrorLog("GetPath called type {0} id {1} is invalid!", type, id);
                    return(url);
                }
                url = data.Path.Substring(data.Path.LastIndexOf('/') + 1);
                url = BundleManager.GetBundleLoadUrl(BundleManager.PathEffectPrefab, url + ".data");
                return(url);
            }

            case EResourceType.CharacterModel:
            {
                Tab_CharModel model = TableManager.GetCharModelByID(id, 0);
                if (model == null)
                {
                    LogModule.ErrorLog("GetPath called type {0} id {1} is invalid!", type, id);
                    return(url);
                }
                url = BundleManager.GetBundleLoadUrl(BundleManager.PathModelPrefab, model.ResPath + ".data");
                return(url);
            }
            }
            LogModule.ErrorLog("GetPath failed invalid type {0} id {1} !", type, id);
            return("ffff");
        }
Ejemplo n.º 25
0
    void UpdateMountLeftTime()
    {
        if (m_MountLeftTime == null)
        {
            LogModule.ErrorLog("UpdateMountLeftTime:m_MountLeftTime is null");
            return;
        }
        if (m_CurMountID < 0 || m_CurMountID >= GameManager.gameManager.PlayerDataPool.m_objMountParam.MountCollect.Length)
        {
            m_MountLeftTime.text = "";
            return;
        }
        if (0 == GameManager.gameManager.PlayerDataPool.m_objMountParam.MountCollect[m_CurMountID])
        {
            m_MountLeftTime.text = "";
            return;
        }
        int nLeftTime = GameManager.gameManager.PlayerDataPool.m_objMountParam.GetMoountLeftTime(m_CurMountID);

        if (nLeftTime < 0)
        {
            m_MountLeftTime.text = StrDictionary.GetClientDictionaryString("#{2779}");
            return;
        }
        int    nDurationSeconds      = nLeftTime;
        int    nDurationTotalMinutes = nDurationSeconds / 60;
        int    nDurationMinutes      = nDurationTotalMinutes % 60;
        int    nDurationHours        = (nDurationTotalMinutes / 60) % 24;
        int    nDurationDays         = nDurationTotalMinutes / 1440;
        string strLeftTime           = StrDictionary.GetClientDictionaryString("#{2761}", nDurationDays, nDurationHours, nDurationMinutes);

        m_MountLeftTime.text = strLeftTime;
    }
Ejemplo n.º 26
0
    void WriteFile(string filePath)
    {
        if (File.Exists(filePath))
        {
            File.Delete(filePath);
        }
        FileStream   wfs = new FileStream(filePath, FileMode.CreateNew);
        StreamWriter sw  = new StreamWriter(wfs, Encoding.GetEncoding("GB2312"));

        sw.WriteLine("Id\tDesc\tSceneID\tDataID\tPosX\tPosZ\tFaceDirection\tGroupID\tMutexID\tIsHideAndSeekNpc");
        sw.WriteLine("INT\tSTRING\tINT\tINT\tFLOAT\tFLOAT\tFLOAT\tINT\tINT\tINT");
        sw.WriteLine("#MAX_ID=4999;MAX_RECORD=5000;TableType=Hash;\t\t\t\t\t\t\t");
        sw.WriteLine("#唯一标示\t描述,策划维护,此列程序不读\t所属场景\tDataID\t位置X\t位置Z\tNpc朝向(弧度数值)\tGroupID\tMutexID\t能否被选为公会捉迷藏NPC");

        int id = 0;

        for (int i = 0; i < m_listSceneID.Count; i++)
        {
            if (!m_dicNPCCache.ContainsKey(m_listSceneID[i]))
            {
                LogModule.ErrorLog("cur npc dic not contain scene" + m_listSceneID[i]);
                return;
            }
            List <NPCData> curList = m_dicNPCCache[m_listSceneID[i]];

            foreach (NPCData curNPC in curList)
            {
                sw.WriteLine(id.ToString() + "\t" + curNPC.GetString());
                id++;
            }
        }
        sw.Close();
        wfs.Close();
    }
    void OnAkeyLevelupOk()
    {
        SwordsManContainer Container = GameManager.gameManager.PlayerDataPool.GetSwordsManContainer(m_PackType);

        if (Container == null)
        {
            LogModule.ErrorLog("OnAkeyLevelupOk::Container is null");
            return;
        }
        SwordsMan oSwordsMan = Container.GetSwordsManByGuid(m_SwordsManGuid);

        if (oSwordsMan == null)
        {
            LogModule.ErrorLog("OnAkeyLevelupOk::oSwordsMan is null");
            return;
        }
        CG_SWORDSMAN_LEVELUP packet = (CG_SWORDSMAN_LEVELUP)PacketDistributed.CreatePacket(MessageID.PACKET_CG_SWORDSMAN_LEVELUP);

        packet.Swordsmanid     = oSwordsMan.Guid;
        packet.Eatallswordsman = 1;
        packet.Packtype        = (int)m_PackType;
        packet.FilterQuality   = (int)m_curChooseQuality;
        for (int i = 0; i < m_EatGuidlist.Count; ++i)
        {
            packet.AddEatguid(m_EatGuidlist[i]);
        }
        packet.SendPacket();
    }
Ejemplo n.º 28
0
    void OnEnable()
    {
        if (null == m_ResObj)
        {
            LogModule.ErrorLog("must set a res Obj");
            return;
        }

        m_totalNum = m_delays.Length;
        m_curIndex = -1;
        if (m_rotations.Length != m_totalNum || m_positions.Length != m_totalNum)
        {
            LogModule.ErrorLog("data array lenth error");

            return;
        }

        if (m_totalNum <= 0)
        {
            return;
        }

        m_curDelay = m_delays[0];
        m_curIndex = 0;
        for (int i = 0; i < m_usingObj.Count; i++)
        {
            m_usingObj[i].DeActive();
        }
    }
Ejemplo n.º 29
0
    public static void CloseUIByID(int tableID)
    {
        if (null == m_instance)
        {
            LogModule.ErrorLog("game manager is not init");
            return;
        }


        Tab_UIPath curTabPath = TableManager.GetUIPathByID(tableID, 0);

        if (null == curTabPath)
        {
            LogModule.ErrorLog("cur ui is not set in table" + tableID);
            return;
        }

        if (!UIPathData.m_DicUIInfo.ContainsKey(curTabPath.Path))
        {
            LogModule.ErrorLog("cur ui is not set in table " + curTabPath.Path);
            return;
        }

        UIPathData curPathData = UIPathData.m_DicUIInfo[curTabPath.Path];

        CloseUI(curPathData);
    }
Ejemplo n.º 30
0
    /// <summary>
    /// Create a UI
    /// </summary>
    /// <param name="p_type">UI category: fullscreen, window, popup, etc</param>
    /// <param name="p_name">name you defined</param>
    /// <param name="p_mediatorType"></param>
    /// <param name="p_bundlePath">prefab to instantiate</param>
    /// <param name="p_viewInitCallBack"></param>
    /// <param name="p_viewRefreshCallBack"></param>
    /// <param name="p_allocateDepth">allocate several panel depth to ui</param>
    /// <param name="p_viewName"></param>
    /// <param name="isShowAnimation"></param>
    private void CreateUI(UIItemConfig p_config, DelegateHelper.TableDelegate p_viewInitCallBack, DelegateHelper.TableDelegate p_viewRefreshCallBack = null, bool isShowAnimation = true)
    {
        try
        {
            if (!m_UICategoryMap.ContainsKey(p_config.Type))
            {
                throw new KeyNotFoundException(string.Format("Key: {0} not found in UI Category.", p_config.Type));
            }

            if (p_config.BundleName == null)
            {
                throw new Exception("Cannot create UI cause no res provided.");
            }

            Game.StartCoroutine(GameAssets.LoadAssetAsync <GameObject>(p_config.BundleName, p_config.AssetName,
                                                                       (prefab) =>
            {
                CreateUIInternal(p_config, prefab, p_viewInitCallBack,
                                 p_viewRefreshCallBack, isShowAnimation);
            }));
            GameAssets.AddBundleRef(p_config.BundleName);
        }
        catch (Exception e)
        {
            LogModule.ErrorLog("Exception in create UI, {0}\n{1}", e.Message, e.StackTrace);
            return;
        }
    }