示例#1
0
 public void Add(Attrib attrib, AttribType attribType, byte num, bool normalized, bool asInt)
 {
     unsafe
     {
         Bgfx.vertex_layout_add((VertexLayoutPtrData *)Unsafe.AsPointer(ref InternalHandle), attrib, num, attribType, normalized, asInt);
     }
 }
    public void FormatMainStatText(float value, AttribType type, UIMainStats uiAtt)
    {
        string attname = "";

        attname           = Helper.FormatAtributeText(type);
        uiAtt.uiName.text = string.Format(attname, value);
    }
示例#3
0
 public void CheckAttrib(PESkEntity entity, AttribType type, float value)
 {
     if (m_AttribPairs[(int)type] != null)
     {
         m_AttribPairs [(int)type].CheckAttrib(entity, type, value);
     }
 }
示例#4
0
 void AddToSendDValue(AttribType type)
 {
     if (!_sendDValue.Contains(type))
     {
         _sendDValue.Add(type);
     }
 }
示例#5
0
 // 在此初始化参数
 protected override void OnCreate()
 {
     obj  = Utility.ToObject(parameters["object"]);
     stat = (AttribType)Utility.ToEnumInt(parameters["stat"]);
     comp = Utility.ToCompare(parameters["compare"]);
     amt  = Utility.ToSingle(missionVars, parameters["amount"]);
 }
示例#6
0
        private static AttribType GetProtoMaxAttr(int npcId, PESkEntity entity, AttribType[] ChangeAbleAttr)
        {
//			float maxP = 0;
            //主线NPC固定
            AttribType FindAttr = ChangeAbleAttr[0];

//			NpcProtoDb.Item Proto = NpcProtoDb.Get(npcId);
//			Pathea.PESkEntity.Attr[] attr = Proto.dbAttr.ToAliveAttr();
//			if(attr == null)
//				return AttribType.Max;
//
//			for(int i=0;i<attr.Length;i++)
//			{
//
//			}
//
//			for(int i=0;i<ChangeAbleAttr.Length;i++)
//			{
//				float currentAttrP = entity.GetAttribute(ChangeAbleAttr[i])/Proto.dbAttr.attributeArray[(int)ChangeAbleAttr[i]];
//				if(currentAttrP > maxP)
//				{
//					FindAttr = ChangeAbleAttr[i];
//					maxP = currentAttrP;
//				}
//			}
            return(FindAttr);
        }
示例#7
0
 public void SetAttribute(AttribType type, float attrValue, bool offEvent = true)
 {
     if (null != m_SkEntity)
     {
         m_SkEntity.SetAttribute((int)type, attrValue, offEvent);
     }
 }
示例#8
0
 public void set_attribute_pointer <T>(int attribute_index, AttribType type, Buffer <T> array_buffer, int stride, int offset = 0, bool normalized = false) where T : struct
 {
     bind();
     GL.EnableVertexAttribArray(attribute_index);
     array_buffer.bind(BufferTarget.ArrayBuffer);
     GL.VertexAttribPointer(attribute_index, get_attrib_size(type), get_attrib_type(type), normalized, stride, offset);
     unbind();
 }
    void ShowAttributeItem(bool _show)
    {
        if (_show)
        {
            if (!m_TraineeNpc.m_Npc.GetCmpt <NpcCmpt>().CanAttributeUp())
            {
                mCannotUpgradeLabel.enabled = true;
                mUpgradeTimesLabel.text     = "";
                mUpgradeTimesLabel.transform.parent.gameObject.SetActive(false);
                mAttributeItemNameLabel.text    = "";
                mAttributeItemPlusLabel.text    = "";
                mAttributeItemContentLabel.text = "";
                return;
            }

            mCannotUpgradeLabel.enabled = false;
            mUpgradeTimesLabel.text     = "[00bbff]" + m_TraineeNpc.m_Npc.GetCmpt <NpcCmpt>().curAttributeUpTimes.ToString() + "/" + AttPlusNPCData.GetPlusCount(m_TraineeNpc.m_Npc.entityProto.protoId).ToString() + "[-]";
            mUpgradeTimesLabel.transform.parent.gameObject.SetActive(true);
            AttribType mType = AttPlusNPCData.GetRandMaxAttribute(m_InsNpc.m_Npc.entityProto.protoId, m_InsNpc.m_Npc.GetCmpt <SkAliveEntity>());
            if (mType == AttribType.Max)
            {
                Debug.Log(m_InsNpc.m_Npc.entityProto.protoId);

                mAttributeItemNameLabel.text    = "";
                mAttributeItemPlusLabel.text    = "";
                mAttributeItemContentLabel.text = "";
                mUpgradeTimesLabel.text         = "";
                mUpgradeTimesLabel.transform.parent.gameObject.SetActive(false);
                mCannotUpgradeLabel.enabled = false;

                return;
            }

            float baseVal = m_TraineeNpc.m_Npc.GetAttribute(mType);
            AttPlusNPCData.AttrPlus.RandomInt randomInt = new AttPlusNPCData.AttrPlus.RandomInt();
            if (AttPlusNPCData.GetRandom(m_InsNpc.m_Npc.entityProto.protoId, mType, out randomInt))
            {
                mAttributeItemNameLabel.text    = AtToString(mType) + ":";
                mAttributeItemPlusLabel.text    = baseVal + "" + "+";
                mAttributeItemContentLabel.text = "[00ff00]" + randomInt.m_Min + "~" + randomInt.m_Max + "[-]";
            }
            else
            {
                Debug.Log("没有获取到属性");
            }
        }
        else
        {
            mAttributeItemNameLabel.text    = "";
            mAttributeItemPlusLabel.text    = "";
            mAttributeItemContentLabel.text = "";
            mUpgradeTimesLabel.text         = "";
            mUpgradeTimesLabel.transform.parent.gameObject.SetActive(false);
            mCannotUpgradeLabel.enabled = false;
        }
    }
示例#10
0
 void OnAttrChange(AttribType type, float value, int casterId, float dValue)
 {
     switch (type)
     {
     case AttribType.Hp:
     {
         OnDamage(casterId, dValue);
     }
     break;
     }
 }
    public string FormatAttributeText(string lineColor, float value, AttribType type)
    {
        string result  = "";
        string attname = "";

        attname = Helper.FormatAtributeText(type);
        attname = "[" + lineColor + "]" + attname + "[-]\n";
        result  = string.Format(attname, value);

        return(result);
    }
示例#12
0
 public void SetUseParentMasks(AttribType type, bool value)
 {
     if (m_UseParentMasks == null)
     {
         return;
     }
     if ((int)type < m_UseParentMasks.Length)
     {
         m_UseParentMasks[(int)type] = value;
     }
 }
示例#13
0
        public static Item Get(AttribType type)
        {
            return(sList.Find((item) =>
            {
                if (item._type == (int)type)
                {
                    return true;
                }

                return false;
            }));
        }
示例#14
0
        public static bool GetRandom(int npcId, AttribType type, out AttPlusNPCData.AttrPlus.RandomInt Rand)
        {
            Rand = new AttrPlus.RandomInt();
            AttPlusNPCData.Item npc = AttPlusNPCData.Get(npcId);
            if (npc == null || npc.AttPlus == null)
            {
                return(false);
            }

            AttPlusNPCData.AttrPlus.Data data = npc.AttPlus.GetPlusRandom(type);
            Rand = data.PlusValue;
            return(true);
        }
示例#15
0
        public override int GetHashCode()
        {
            var hashCode = -2145328967;

            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(PowerFullName);

            hashCode = hashCode * -1521134295 + UniqueId.GetHashCode();
            hashCode = hashCode * -1521134295 + EffectClass.GetHashCode();
            hashCode = hashCode * -1521134295 + EffectType.GetHashCode();
            hashCode = hashCode * -1521134295 + DamageType.GetHashCode();
            hashCode = hashCode * -1521134295 + MezmorizeType.GetHashCode();
            hashCode = hashCode * -1521134295 + EffectModifiers.GetHashCode();
            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Summon);

            hashCode = hashCode * -1521134295 + DelayedTime.GetHashCode();
            hashCode = hashCode * -1521134295 + Ticks.GetHashCode();
            hashCode = hashCode * -1521134295 + Stacking.GetHashCode();
            hashCode = hashCode * -1521134295 + BaseProbability.GetHashCode();
            hashCode = hashCode * -1521134295 + Suppression.GetHashCode();
            hashCode = hashCode * -1521134295 + Buffable.GetHashCode();
            hashCode = hashCode * -1521134295 + Resistible.GetHashCode();
            hashCode = hashCode * -1521134295 + SpecialCase.GetHashCode();
            hashCode = hashCode * -1521134295 + VariableModifiedOverride.GetHashCode();
            hashCode = hashCode * -1521134295 + PlayerVersusMode.GetHashCode();
            hashCode = hashCode * -1521134295 + ToWho.GetHashCode();
            hashCode = hashCode * -1521134295 + DisplayPercentageOverride.GetHashCode();
            hashCode = hashCode * -1521134295 + Scale.GetHashCode();
            hashCode = hashCode * -1521134295 + Magnitude.GetHashCode();
            hashCode = hashCode * -1521134295 + Duration.GetHashCode();
            hashCode = hashCode * -1521134295 + AttribType.GetHashCode();
            hashCode = hashCode * -1521134295 + Aspect.GetHashCode();
            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(ModifierTable);

            hashCode = hashCode * -1521134295 + NearGround.GetHashCode();
            hashCode = hashCode * -1521134295 + CancelOnMiss.GetHashCode();
            hashCode = hashCode * -1521134295 + RequiresToHitCheck.GetHashCode();
            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(UidClassName);

            hashCode = hashCode * -1521134295 + IdClassName.GetHashCode();
            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(MagnitudeExpression);

            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Reward);

            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(EffectId);

            hashCode = hashCode * -1521134295 + IgnoreEnhancementDiversification.GetHashCode();
            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Override);

            hashCode = hashCode * -1521134295 + ProcsPerMinute.GetHashCode();
            return(hashCode);
        }
示例#16
0
 public Data GetPlusRandom(AttribType type)
 {
     return(mList.Find((item) =>
     {
         if (item.AttrID == (int)type)
         {
             return true;
         }
         {
             return false;
         }
     }
                       ));
 }
示例#17
0
        public static Item GetTalkItemByType(PeEntity entity, AttribType _type, AttribType _typeMax)
        {
            Item       curItem   = null;
            float      typevalue = entity.GetAttribute(_type);
            ETalkLevel typeLevel = SwichAtrrLevel(_type, typevalue, entity);

            if (typeLevel != ETalkLevel.Max)
            {
                curItem         = GetTalkItem(_type, typeLevel);
                curItem.Type    = _type;
                curItem.TypeMax = _typeMax;
                curItem.Level   = typeLevel;
            }
            return(curItem);
        }
    string AtToString(AttribType _type)
    {
        string realname = "";

        switch (_type)
        {
        case AttribType.HpMax:
            realname = PELocalization.GetString(10066);
            break;

        case AttribType.StaminaMax:
            realname = PELocalization.GetString(10067);
            break;

        case AttribType.ComfortMax:
            realname = PELocalization.GetString(8000202);
            break;

        case AttribType.OxygenMax:
            realname = PELocalization.GetString(10068);
            break;

        case AttribType.HungerMax:
            realname = PELocalization.GetString(10071);
            break;

        case AttribType.EnergyMax:
            realname = PELocalization.GetString(10070);
            break;

        case AttribType.ShieldMax:
            realname = PELocalization.GetString(2000014);
            break;

        case AttribType.Atk:
            realname = PELocalization.GetString(10077);
            break;

        case AttribType.Def:
            realname = PELocalization.GetString(10078);
            break;
        }

        return(realname);
    }
示例#19
0
 public void CheckAttrib(PESkEntity entity, AttribType type, float value)
 {
     if (type == m_Current)
     {
         if (value < 0 || value > entity.GetAttribute(m_Max))
         {
             entity.SetAttribute(m_Current, Mathf.Clamp(value, 0, entity.GetAttribute(m_Max)));
         }
     }
     else if (type == m_Max)
     {
         float currentValue = entity.GetAttribute(m_Current);
         if (currentValue > value)
         {
             entity.SetAttribute(m_Current, value);
         }
     }
 }
示例#20
0
        private static ETalkLevel SwichAtrrLevel(AttribType type, float attr, PeEntity entity)
        {
            switch (type)
            {
            case AttribType.Hp:
                return(SwichHealthLevel(attr, entity));

            case AttribType.Hunger:
                return(SwichHungerLevel(attr, entity));

            case AttribType.Comfort:
                return(SwichComfortLevel(attr, entity));

            default:
                return(ETalkLevel.Max);
            }
            //return ETalkLevel.Max;
        }
示例#21
0
        public static AttrPer WantByType(PeEntity entity, AttribType _type, AttribType _typeMax, float _eatMin, float _eatMax, bool _bContinue = false)
        {
            AttrPer attrper    = null;
            float   curPercent = 1.0f;
            int     TypeID     = (int)_type;

            //float  eatLimt = _bContinue ? _eatMax : _eatMin;
            float p    = entity.GetAttribute(_type);
            float pMax = entity.GetAttribute(_typeMax);

            curPercent = p / pMax;
            if (curPercent < _eatMax)
            {
                attrper = new AttrPer(TypeID, curPercent);
            }

            return(attrper);
        }
示例#22
0
        private static int get_attrib_size(AttribType type)
        {
            switch (type)
            {
            case AttribType.Float:
            case AttribType.Double:
            case AttribType.Int:
                return(1);

            case AttribType.Vec2:
            case AttribType.DVec2:
            case AttribType.IVec2:
                return(2);

            case AttribType.Vec3:
            case AttribType.DVec3:
            case AttribType.IVec3:
                return(3);
            }
            throw new Exception();
        }
示例#23
0
        private static VertexAttribPointerType get_attrib_type(AttribType type)
        {
            switch (type)
            {
            case AttribType.Float:
            case AttribType.Vec2:
            case AttribType.Vec3:
                return(VertexAttribPointerType.Float);

            case AttribType.Double:
            case AttribType.DVec2:
            case AttribType.DVec3:
                return(VertexAttribPointerType.Double);

            case AttribType.Int:
            case AttribType.IVec2:
            case AttribType.IVec3:
                return(VertexAttribPointerType.Int);
            }
            throw new Exception();
        }
示例#24
0
        private static AttribType GetRandMaxAttr(int npcId, PESkEntity entity, AttribType[] ChangeAbleAttr)
        {
            float      maxP     = 0;
            AttribType FindAttr = ChangeAbleAttr[0];

            RandomNpcDb.Item      rand      = RandomNpcDb.Get(npcId);
            RandomNpcDb.RandomInt randomint = new RandomNpcDb.RandomInt();
            for (int i = 0; i < ChangeAbleAttr.Length; i++)
            {
                if (!rand.TryGetAttrRandom(ChangeAbleAttr[i], out randomint) || randomint.m_Max == 0)
                {
                    continue;
                }

                float currentAttrP = (entity.GetAttribute(ChangeAbleAttr[i], false) - randomint.m_Min) / (randomint.m_Max - randomint.m_Min);
                if (currentAttrP > maxP)
                {
                    FindAttr = ChangeAbleAttr[i];
                    maxP     = currentAttrP;
                }
            }
            return(FindAttr);
        }
示例#25
0
        private static Dictionary <ETalkLevel, Item> SwichMainPlyerItems(AttribType type)
        {
            Dictionary <ETalkLevel, Item> Items = null;

            switch (type)
            {
            case AttribType.Hp:
                Items = GetPlyerHealthCase();
                break;

            case AttribType.Hunger:
                Items = GetPlyerHungerCase();
                break;

            case AttribType.Comfort:
                Items = GetPlyerComfortCase();
                break;

            default:
                break;
            }
            return(Items);
        }
示例#26
0
        public static bool CanEatByAttr(PeEntity entity, AttribType type, AttribType typeMax, bool bContinue)
        {
            if (entity.UseItem == null)
            {
                return(false);
            }

            AttrPer Db = WantByType(entity, type, typeMax, bContinue);

            if (Db == null)
            {
                return(false);
            }

            int[] eatids = GetEatIDs(Db.mTypeId, Db.mCurPercent);
            ItemAsset.ItemObject item = GetCanEatItemFromPackage(entity, eatids);
            if (item != null)
            {
                return(true);
            }

            return(false);
        }
示例#27
0
        public static AttrPer WantByType(PeEntity entity, AttribType _type, AttribType _typeMax, bool _bContinue = false)
        {
            AttrPer attrper    = null;
            float   curPercent = 1.0f;
            int     TypeID     = (int)_type;
            Items   items      = NpcEatDb.GetIitems(TypeID);

            if (items == null)
            {
                return(null);
            }

            //float  eatLimt = _bContinue ? items.mEatMax : items.mEatMin;
            float Hp    = entity.GetAttribute(_type);
            float HpMax = entity.GetAttribute(_typeMax);

            curPercent = Hp / HpMax;
            if (curPercent < items.mEatMax)
            {
                attrper = new AttrPer(TypeID, curPercent);
            }

            return(attrper);
        }
示例#28
0
 public AttributeInfo(AttribType curType, AttribType maxType)
 {
     m_CurType = curType;
     m_MaxType = maxType;
     m_Player  = null;
 }
示例#29
0
        public static int CheckAttrbCase(PESkEntity peskentity)
        {
            RandomAttrChoce attr     = new RandomAttrChoce();
            AttribType      type     = attr.RandType();
            float           curvalue = peskentity.GetAttribute(type);

            switch (type)
            {
            case AttribType.Hunger:
            {
                float maxHunger = peskentity.GetAttribute(AttribType.HungerMax);

                if (curvalue <= maxHunger * NpcRandomTalkDb.Get((int)ENpcTalkType.Follower_hunger_medium)._value &&
                    curvalue > maxHunger * NpcRandomTalkDb.Get((int)ENpcTalkType.Follower_hunger_low)._value)
                {
                    return(NpcRandomTalkDb.Get((int)ENpcTalkType.Follower_hunger_medium).Scenario.RandCase());
                }
                else if (curvalue <= maxHunger * NpcRandomTalkDb.Get((int)ENpcTalkType.Follower_health_low)._value)
                {
                    return(NpcRandomTalkDb.Get((int)ENpcTalkType.Follower_hunger_low).Scenario.RandCase());
                }
                else
                {
                    return(-1);
                }
            }

            //	break;
            case AttribType.Hp:
            {
                float maxHp = peskentity.GetAttribute(AttribType.HpMax);
                if (curvalue <= maxHp * NpcRandomTalkDb.Get((int)ENpcTalkType.Follower_health_medium)._value &&
                    curvalue > maxHp * NpcRandomTalkDb.Get((int)ENpcTalkType.Follower_health_low)._value)
                {
                    return(NpcRandomTalkDb.Get((int)ENpcTalkType.Follower_health_medium).Scenario.RandCase());
                }
                else if (curvalue <= maxHp * NpcRandomTalkDb.Get((int)ENpcTalkType.Follower_health_low)._value)
                {
                    return(NpcRandomTalkDb.Get((int)ENpcTalkType.Follower_health_low).Scenario.RandCase());
                }
                else
                {
                    return(-1);
                }
            }

            //	break;
            case AttribType.Comfort:
            {
                float maxcomfort = peskentity.GetAttribute(AttribType.ComfortMax);
                if (curvalue <= maxcomfort * NpcRandomTalkDb.Get((int)ENpcTalkType.Follower_comfort_common)._value &&
                    curvalue > maxcomfort * NpcRandomTalkDb.Get((int)ENpcTalkType.Follower_comfort_medium)._value)
                {
                    return(NpcRandomTalkDb.Get((int)ENpcTalkType.Follower_comfort_common).Scenario.RandCase());
                }
                else if (curvalue <= maxcomfort * NpcRandomTalkDb.Get((int)ENpcTalkType.Follower_comfort_medium)._value &&
                         curvalue > maxcomfort * NpcRandomTalkDb.Get((int)ENpcTalkType.Follower_comfort_low)._value
                         )
                {
                    return(NpcRandomTalkDb.Get((int)ENpcTalkType.Follower_comfort_medium).Scenario.RandCase());
                }
                else if (curvalue <= maxcomfort * NpcRandomTalkDb.Get((int)ENpcTalkType.Follower_comfort_low)._value)
                {
                    return(NpcRandomTalkDb.Get((int)ENpcTalkType.Follower_comfort_low).Scenario.RandCase());
                }
                else
                {
                    return(-1);
                }
            }
            //	break;

            default:
                break;
            }
            return(-1);
        }
示例#30
0
        private static Item GetPlyerTalkItem(AttribType type, ETalkLevel level)
        {
            Dictionary <ETalkLevel, Item> Items = SwichMainPlyerItems(type);

            return(Items[level]);
        }