コード例 #1
0
ファイル: TechnologyDataModel.cs プロジェクト: EpicProj/RPG
 public bool Create(int id)
 {
     if (TechnologyModule.GetTechDataByID(id) != null)
     {
         _id = id;
         return(true);
     }
     return(false);
 }
コード例 #2
0
 public void SetUpItem(GeneralRewardItem item)
 {
     _item = item;
     if (item.type == GeneralRewardItem.RewardType.Material)
     {
         if (MaterialModule.GetMaterialByMaterialID(item.ItemID) != null)
         {
             var icon = MaterialModule.GetMaterialSprite(item.ItemID);
             _icon.sprite = icon;
             _count.text  = item.count.ToString();
         }
     }
     else if (item.type == GeneralRewardItem.RewardType.Tech_Unlock)
     {
         if (TechnologyModule.GetTechDataByID(item.ItemID) != null)
         {
             var icon = TechnologyModule.GetTechIcon(item.ItemID);
             _icon.sprite = icon;
         }
     }
 }
コード例 #3
0
ファイル: TechnologyInfo.cs プロジェクト: EpicProj/RPG
        public TechnologyInfo(int techID)
        {
            _model = new TechnologyDataModel();
            if (!_model.Create(techID))
            {
                return;
            }
            this.techID = techID;
            baseType    = TechnologyModule.GetTechBaseType(techID);

            techRequireList      = TechnologyModule.Instance.GetTechRequireList(techID);
            techFinishEffectList = TechnologyModule.Instance.GetTechCompleteEffect(techID);

            if (TechnologyModule.GetTechDataByID(techID).Unlock)
            {
                currentState = TechnologyState.Unlock;
            }
            else
            {
                currentState = TechnologyState.Lock;
            }
        }
コード例 #4
0
        /// <summary>
        /// 事件触发前置
        /// </summary>
        /// <param name="eventID"></param>
        /// <returns></returns>
        public static bool CheckEventTrigger(int eventID)
        {
            var playerData = GetExploreEventConfigData(eventID).trigger.player;
            ///Check GlobalFlag
            var trigger = GetExploreEventGlobalFlag(eventID);

            if (trigger != null)
            {
                foreach (KeyValuePair <string, bool> kvp in trigger)
                {
                    if (!GlobalEventManager.Instance.CheckGlobalFlagExist(kvp.Key) == kvp.Value)
                    {
                        return(false);
                    }
                }
            }
            ///Currency
            if (playerData != null)
            {
                if (!string.IsNullOrEmpty(playerData.CurrencyCompare))
                {
                    if (!Utility.ParseGeneralCompare(playerData.CurrencyValue, playerData.CurrencyCompare))
                    {
                        return(false);
                    }
                }
                if (playerData.Material != null)
                {
                    foreach (KeyValuePair <string, string> kvp in playerData.Material)
                    {
                        int materialID = Utility.TryParseInt(kvp.Key);
                        if (MaterialModule.GetMaterialByMaterialID(materialID) != null)
                        {
                            if (!Utility.ParseGeneralCompare(PlayerManager.Instance.GetMaterialStoreCount(materialID), kvp.Value))
                            {
                                return(false);
                            }
                        }
                    }
                }
                if (playerData.Technology != null)
                {
                    foreach (KeyValuePair <string, string> kvp in playerData.Technology)
                    {
                        int techID = Utility.TryParseInt(kvp.Value);
                        if (TechnologyModule.GetTechDataByID(techID) != null)
                        {
                            var techData = TechnologyDataManager.Instance.GetTechInfo(techID);
                            if (techData != null)
                            {
                                if (string.Compare(kvp.Value, "Complete") == 0)
                                {
                                    if (techData.currentState != TechnologyState.Done)
                                    {
                                        return(false);
                                    }
                                }
                                else if (string.Compare(kvp.Value, "Lock") == 0)
                                {
                                    if (techData.currentState != TechnologyState.Lock)
                                    {
                                        return(false);
                                    }
                                }
                                else
                                {
                                    Debug.LogError("ExploreEvent Tech Format Error! EventID=" + eventID);
                                }
                            }
                        }
                    }
                }
            }
            /// CheckPre Event
            var preList = GetExploreEventConfigData(eventID).trigger.PreEvent;

            if (preList != null)
            {
                for (int i = 0; i < preList.Count; i++)
                {
                    if (ExploreEventManager.Instance.CheckRandomEventFinish(eventID) == false)
                    {
                        return(false);
                    }
                }
            }
            return(true);
        }