Beispiel #1
0
 public void InitAtbFromMsg(NotifyAtb msg)
 {
     for (int i = 0; i < msg.atbTypes.Count; ++i)
     {
         int     atbInt  = msg.atbTypes[i];
         AtbType atbType = (AtbType)atbInt;
         SetAtb(atbType, msg.atbValues[i]);
     }
 }
Beispiel #2
0
    public int GetAtb(AtbType atb)
    {
        AtbNode node = null;

        if (!atbNodes.TryGetValue(atb, out node))
        {
            return(0);
        }
        return(node.GetValue());
    }
Beispiel #3
0
    public int GetAtb(AtbType atb)
    {
        int v = 0;

        if (!mAtbs.TryGetValue(atb, out v))
        {
            return(0);
        }
        return(v);
    }
Beispiel #4
0
    public float GetAtbPct(AtbType atb)
    {
        AtbNode node = null;

        if (!atbNodes.TryGetValue(atb, out node))
        {
            return(0.0f);
        }
        int v = node.GetValue();

        return((float)v * 0.0001f);
    }
Beispiel #5
0
    public float GetAtbPct(AtbType atb)
    {
        int v = 0;

        if (!mAtbs.TryGetValue(atb, out v))
        {
            return(0.0f);
        }
        float pct = (float)v * 0.0001f;

        return(pct);
    }
Beispiel #6
0
    public void SetAtb(AtbType atb, int value)
    {
        int oldValue = 0;

        if (!mAtbs.TryGetValue(atb, out oldValue))
        {
            mAtbs.Add(atb, value);
        }
        else
        {
            mAtbs[atb] = value;
        }
    }
Beispiel #7
0
    public void SetAtb(AtbType atb, int value)
    {
        AtbNode node = null;

        if (!atbNodes.TryGetValue(atb, out node))
        {
            return;
        }
        int oldValue = node.GetValue();

        if (oldValue == value)
        {
            return;
        }

        node.SetValue(value);
        node.Dirty = true;
        node.UpdateAtbTreeUp();
    }
Beispiel #8
0
 public float GetAtbPct(AtbType atb)
 {
     return(mAtb.GetAtbPct(atb));
 }
Beispiel #9
0
 public int GetAtb(AtbType atb)
 {
     return(mAtb.GetAtb(atb));
 }
Beispiel #10
0
 public void SetAtb(AtbType atb, int value)
 {
     mAtb.SetAtb(atb, value);
 }
Beispiel #11
0
    public AtbTree(Character cha)
    {
        mCharacter = cha;

        List <AtbNode> nodes = new List <AtbNode>();
        List <bool>    token = new List <bool>();

        for (int i = 0; i < excel_atb_data.Count; ++i)
        {
            excel_atb_data excel = excel_atb_data.GetByIndex(i);
            AtbNode        node  = new AtbNode(excel, this);

            AtbNode.CalcFunc func = null;
            if (AtbCalcFuncRegister.mFuncs.TryGetValue(node.AtbType, out func))
            {
                node.mCalcFunc = func;
            }
            else
            {
                node.mCalcFunc = AtbCalcFuncRegister.DefaultCalcFunc;
            }

            atbNodes.Add(node.AtbType, node);
            nodes.Add(node);
            token.Add(false);
        }

        // Build Tree
        for (int i = 0; i < nodes.Count; ++i)
        {
            AtbNode node = nodes[i];
            if (node.excel.inflAtbs == null)
            {
                continue;
            }
            for (int j = 0; j < node.excel.inflAtbs.Length; ++j)
            {
                int     inflID   = node.excel.inflAtbs[j];
                AtbType childAtb = (AtbType)inflID;

                // 获取被影响节点;
                AtbNode inflNode = null;
                if (!atbNodes.TryGetValue(childAtb, out inflNode))
                {
                    continue;
                }
                inflNode.children.Add(node);
                node.parents.Add(inflNode);
            }
        }

        // Update Tree
        for (int i = 0; i < nodes.Count; ++i)
        {
            AtbNode node = nodes[i];
            if (node.parents.Count == 0)
            {
                node.UpdateAtbTreeDown();
            }
        }
    }