void DrawMembersUI()
    {
        ClearParamList();
        Vector2 pos       = new Vector2(10, 20);
        float   maxHeight = 0;

        for (int j = 0; j < Selected.Params.paramsList.Count; j++)
        {
            AParam   item = Selected.Params.paramsList[j];
            MemberUI mu   = Instantiate(prefMemberUI);
            mu.Own = Selected;
            mu.GetComponentInChildren <Button>().interactable = uplockParam;
            mu.transform.SetParent(paramPanel.transform);
            mu.GetComponent <RectTransform>().anchoredPosition = pos;
            mu.GeneNameText.text = item.Name;
            mu.SetParam(item);
            paramElList.Add(mu);
            mu.Position = pos;
            float height = DrawParamsUI(mu);
            if (height > maxHeight)
            {
                maxHeight = height;
            }
            pos.x += mu.Size.x;
            Vector2 sz = paramPanel.GetComponent <RectTransform>().sizeDelta;
            sz = new Vector2(pos.x, maxHeight + 10);
            paramPanel.GetComponent <RectTransform>().sizeDelta = sz;
        }
    }
Ejemplo n.º 2
0
 // RexPrefixOffset: byte; //if specified specifies which byte should be used for the rexw (e.g f3 before rex )
 //paramencoding: TParamEncoding;
 public AOpCode()
 {
     Mnemonic           = "";
     OpCode1            = AExtraOpCode.None;
     OpCode2            = AExtraOpCode.None;
     ParamType1         = AParam.None;
     ParamType2         = AParam.None;
     ParamType3         = AParam.None;
     ParamType4         = AParam.None;
     Bytes              = 0;
     Bt1                = 0;
     Bt2                = 0;
     Bt3                = 0;
     Bt4                = 0;
     Signed             = false;
     W0                 = false;
     W1                 = false;
     InvalidIn64Bit     = false;
     InvalidIn32Bit     = false;
     CanDoAddressSwitch = false;
     DefaultType        = false;
     HasVex             = false;
     VexL               = 0x00;
     VexOpCodeExtension = AVexOpCodeExtension.None;
     VexLeadingOpCode   = AVexLeadingOpCode.None;
     VexExtraParam      = 0;
 }
Ejemplo n.º 3
0
        //param
        public override void OutAParam(AParam node)
        {
            Definition exprsDef;

            //    check if decorated, if no decorate
            if (!_decoratedParseTree.TryGetValue(node.GetExpr1(), out exprsDef))
            {
            }
            else
            {
                _decoratedParseTree.Add(node, exprsDef);
            }
        }
Ejemplo n.º 4
0
    public void TestCall()
    {
        SendParameter        sendParameter;
        IWebReferenceWrapper wrapper;

        //Pseudo
        if (Customer == A)
        {
            sendParameter = new AParam();
            wrapper       = new WebreferenceAWrapper();
        }
        else if (Customer == B)
        {
            sendParameter = new BParam();
            wrapper       = new WebreferenceBWrapper();
        }
    }
Ejemplo n.º 5
0
        public static UpdateDefinition <BsonDocument> GetUpdate(this AParam param)
        {
            switch (param.eParamType)
            {
            case EParamType.Double:
                return(ADBAccessor.update(param.paramName, param.dParamValue));

            case EParamType.Int:
                return(ADBAccessor.update(param.paramName, param.iParamValue));

            case EParamType.Long:
                return(ADBAccessor.update(param.paramName, param.lParamValue));

            case EParamType.String:
                return(ADBAccessor.update(param.paramName, param.sParamValue));
            }
            return(ADBAccessor.update(param.paramName, param.paramValue));
        }
    float DrawParamsUI(MemberUI memUI)
    {
        AParam  mem = memUI.Param;
        Vector2 pos = memUI.Position;
        float   sy  = 0;

        for (int i = 0; i < mem.paramsList.Count; i++)
        {
            ParamUI pu = Instantiate(prefParamUI);
            pu.Own = Selected;
            pu.Button.interactable = memUI.Param.IsActive;
            pu.transform.SetParent(paramPanel.transform);
            pos.y += pu.Size.y + 5;
            sy     = pu.Size.y;
            pu.GetComponent <RectTransform>().anchoredPosition = pos;
            pu.Param = mem.paramsList[i];
            pu.ParamNameText.text = pu.Param.ShortName;
            pu.ParamValText.text  = pu.Param.ToString();
            memUI.paramList.Add(pu);
        }
        return(pos.y + sy);
    }
Ejemplo n.º 7
0
    void ImitationColor(Creature father, AParam p, int j)
    {
        //Color1
        float rnd = Random.value;

        if (rnd <= 0.5f)
        {
            p.Color1 = father.Params.paramsList[j].Color1;
        }
        else
        {
            p.Color1 = Own.Params.paramsList[j].Color1;
        }
        rnd = Random.value;
        if (rnd <= 0.1024f)
        {
            float rand       = Random.value;
            float randValCol = Random.value * 0.1f;
            if (rand < 0.33f)
            {
                if (p.Color1.r + randValCol < 1f)
                {
                    float c = p.Color1.r + randValCol;
                    p.Color1 = new Color(c, p.Color1.g, p.Color1.b);
                }
            }
            else if (rand < 0.66f)
            {
                if (p.Color1.g + randValCol < 1f)
                {
                    float c = p.Color1.g + randValCol;
                    p.Color1 = new Color(p.Color1.r, c, p.Color1.b);
                }
            }
            else
            {
                if (p.Color1.g + randValCol < 1f)
                {
                    float c = p.Color1.b + randValCol;
                    p.Color1 = new Color(p.Color1.r, p.Color1.g, c);
                }
            }
        }
        else if (rnd <= 0.2048f)
        {
            float rand       = Random.value;
            float randValCol = Random.value * 0.1f;
            if (rand < 0.33f)
            {
                if (p.Color1.r - randValCol >= 0)
                {
                    float c = p.Color1.r - randValCol;
                    p.Color1 = new Color(c, p.Color1.g, p.Color1.b);
                }
            }
            else if (rand < 0.66f)
            {
                if (p.Color1.g - randValCol >= 0)
                {
                    float c = p.Color1.g - randValCol;
                    p.Color1 = new Color(p.Color1.r, c, p.Color1.b);
                }
            }
            else
            {
                if (p.Color1.g - randValCol >= 0)
                {
                    float c = p.Color1.b - randValCol;
                    p.Color1 = new Color(p.Color1.r, p.Color1.g, c);
                }
            }
        }
        //Color2
        rnd = Random.value;
        if (rnd <= 0.5f)
        {
            p.Color2 = father.Params.paramsList[j].Color2;
        }
        else
        {
            p.Color2 = Own.Params.paramsList[j].Color2;
        }
        rnd = Random.value;
        if (rnd <= 0.1024f)
        {
            float rand       = Random.value;
            float randValCol = Random.value * 0.1f;
            if (rand < 0.33f)
            {
                if (p.Color2.r + randValCol < 1f)
                {
                    float c = p.Color2.r + randValCol;
                    p.Color2 = new Color(c, p.Color2.g, p.Color2.b);
                }
            }
            else if (rand < 0.66f)
            {
                if (p.Color2.g + randValCol < 1f)
                {
                    float c = p.Color2.g + randValCol;
                    p.Color2 = new Color(p.Color2.r, c, p.Color2.b);
                }
            }
            else
            {
                if (p.Color2.g + randValCol < 1f)
                {
                    float c = p.Color2.b + randValCol;
                    p.Color2 = new Color(p.Color2.r, p.Color2.g, c);
                }
            }
        }
        else if (rnd <= 0.2048f)
        {
            float rand       = Random.value;
            float randValCol = Random.value * 0.1f;
            if (rand < 0.33f)
            {
                if (p.Color2.r - randValCol >= 0)
                {
                    float c = p.Color2.r - randValCol;
                    p.Color2 = new Color(c, p.Color2.g, p.Color2.b);
                }
            }
            else if (rand < 0.66f)
            {
                if (p.Color2.g - randValCol >= 0)
                {
                    float c = p.Color2.g - randValCol;
                    p.Color2 = new Color(p.Color2.r, c, p.Color2.b);
                }
            }
            else
            {
                if (p.Color2.g - randValCol >= 0)
                {
                    float c = p.Color2.b - randValCol;
                    p.Color2 = new Color(p.Color2.r, p.Color2.g, c);
                }
            }
        }
    }
Ejemplo n.º 8
0
    public void CreateBaby(Creature father)
    {
        babyParams = new Params();
        bool oneChange = true;

        for (int j = 0; j < babyParams.paramsList.Count; j++)
        {
            AParam p = babyParams.paramsList[j];
            ImitationColor(father, p, j);
            float rnd = Random.value;
            if (rnd <= 0.5f)
            {
                p.IsActive = father.Params.paramsList[j].IsActive;
            }
            else
            {
                p.IsActive = Own.Params.paramsList[j].IsActive;
            }
            if (oneChange && rnd < 0.1f)            //Mutation
            {
                p.IsActive = !p.IsActive;
                oneChange  = false;
            }
            if (!p.IsActive)
            {
                continue;
            }
            for (int i = 0; i < p.paramsList.Count; i++)
            {
                AParamValue param = babyParams.paramsList[j].paramsList[i];
                rnd = Random.value;
                if (rnd <= 0.5f)
                {
                    param.Level = (father.Params.paramsList[j].paramsList[i]).Level;
                }
                else
                {
                    param.Level = (Own.Params.paramsList[j].paramsList[i]).Level;
                }
                rnd = Random.value;
                if (rnd <= 0.1024f)
                {
                    param.Increase();
                }
                else if (rnd <= 0.2048f)
                {
                    param.Decrease();
                }
            }
        }

        IsPregnant      = true;
        Baby            = GameObject.Instantiate(Own.Map.prefabCreature);
        Baby.Generation = Own.Generation > father.Generation ? Own.Generation : father.Generation;
        Baby.Generation++;
        Baby.Tr.SetParent(Own.Map.Transform);
        Baby.Tr.position = new Vector3(0, -200, 0);
        babyParams.SetOwn(Baby);
        Baby.Init(babyParams);
        Baby.IsAlive = false;
        //Baby.Rb.useGravity = false;
    }
Ejemplo n.º 9
0
 public void SetParam(AParam prm)
 {
     Param = prm;
     ChangeColor();
 }