Пример #1
0
        private void Init()
        {
            ConfigData[] configDataList1 = GameDataProxy.GetAllData("CreditRelation");
            if (configDataList1 == null)
            {
                return;
            }
            foreach (ConfigData item in configDataList1)
            {
                if (item == null)
                {
                    continue;
                }

                CreditType cr = GetCreditType(item.GetInt("typeid"));
                cr.Add(item.GetInt("relationid"), (CreditLevelId)item.GetInt("relationlevel"));
            }

            ConfigData[] configDataList2 = GameDataProxy.GetAllData("CreditType");
            if (configDataList2 == null)
            {
                return;
            }
            foreach (ConfigData item in configDataList2)
            {
                if (item == null)
                {
                    continue;
                }

                CreditType cr = GetCreditType(item.GetInt("typeid"));
                cr.m_Default = (CreditLevelId)item.GetInt("defaultlevel");
            }
        }
Пример #2
0
        public CreditType GetCreditType(int typeID)
        {
            CreditType res;

            if (!CreditMap.TryGetValue(typeID, out res))
            {
                res = new CreditType();
                CreditMap.Add(typeID, res);
            }
            return(res);
        }
Пример #3
0
        public bool CheckRelation(ActorObj objA, ActorObj objB, TargetType type)
        {
            if (objA == null || objB == null)
            {
                return(false);
            }
            int           cmpA = objA.GetCamp();
            int           cmpB = objB.GetCamp();
            CreditLevelId cl   = CreditLevelId.Credit_Friendly;

            if (cmpB <= 0)
            {
                cl = CreditLevelId.Credit_Friendly;
            }
            else
            {
                CreditType creditA = GetCreditType(cmpA);
                if (creditA != null)
                {
                    cl = creditA.GetCredit(cmpB);
                }
            }
            if ((type & TargetType.ToEnemy) != 0 && IsEnemy(cl))
            {
                return(true);
            }

            if ((type & TargetType.ToFriend) != 0 && IsFriend(cl))
            {
                return(true);
            }

            if ((type & TargetType.ToNeutral) != 0 && IsNeutral(cl))
            {
                return(true);
            }
            return(false);
        }