Esempio n. 1
0
 public virtual void Go()
 {
     if (Ngnome.nMGMT)
     {
         Isotope iso          = AtomChart.ClosestStableNuclide(UserAtom.p, UserAtom.n);
         int     totalChanges = Mathf.Abs(iso.p - UserAtom.p) + Mathf.Abs(iso.n - UserAtom.n);
         if (totalChanges != 0)
         {
             this.dialog.enabled = true;
             this.dialog.mode    = 0;
         }
         else
         {
             //dialog.message = "it is not stable";
             Application.LoadLevel(1);
         }
     }
     else
     {
         Application.LoadLevel(1);
     }
 }
Esempio n. 2
0
    public virtual void Awake()
    {
        if ((AtomChart.elements != null) && (AtomChart.elements.Length > 0))
        {
            return;
        }
        AtomChart.halfLives[0]  = 10 * Mathf.Pow(10, 15);
        AtomChart.halfLives[1]  = 10 * Mathf.Pow(10, 10);
        AtomChart.halfLives[2]  = 10 * Mathf.Pow(10, 7);
        AtomChart.halfLives[3]  = 10 * Mathf.Pow(10, 5);
        AtomChart.halfLives[4]  = 10 * Mathf.Pow(10, 4);
        AtomChart.halfLives[5]  = 10 * Mathf.Pow(10, 3);
        AtomChart.halfLives[6]  = 10 * Mathf.Pow(10, 2);
        AtomChart.halfLives[7]  = 10 * Mathf.Pow(10, 1);
        AtomChart.halfLives[8]  = 10 * Mathf.Pow(10, 0);
        AtomChart.halfLives[9]  = 10 * Mathf.Pow(10, -1);
        AtomChart.halfLives[10] = 10 * Mathf.Pow(10, -2);
        AtomChart.halfLives[11] = 10 * Mathf.Pow(10, -3);
        AtomChart.halfLives[12] = 10 * Mathf.Pow(10, -4);
        AtomChart.halfLives[13] = 10 * Mathf.Pow(10, -5);
        AtomChart.halfLives[14] = 10 * Mathf.Pow(10, -6);
        AtomChart.halfLives[15] = 10 * Mathf.Pow(10, -7);
        AtomChart.halfLives[16] = 10 * Mathf.Pow(10, -15);
        AtomChart.halfLives[17] = -1;
        float x  = 0f;
        float y  = 0f;
        float i  = 0f;
        int   sy = 0;
        int   sx = 0;
        int   si = 0;

        AtomChart.elements = new Element[this.im1.height];
        y = 0;
        while (y < this.im1.height)
        {
            Element elem = new Element();
            if (sy < this.elementTable.text.Length)
            {
                int newsy = this.elementTable.text.IndexOf(" ", sy);
                if (newsy == -1)
                {
                    newsy = this.elementTable.text.Length;
                }
                string line = this.elementTable.text.Substring(sy, newsy - sy);
                sy = newsy + 2;
                string[] values = new string[5];
                sx = 0;
                si = 0;
                while (si < 5)
                {
                    int newsx = line.IndexOf(",", sx);
                    if (newsx == -1)
                    {
                        newsx = line.Length;
                    }
                    values[si] = line.Substring(sx, newsx - sx);
                    sx         = newsx + 1;
                    si++;
                }
                elem.symbol       = values[0];
                elem.name         = values[1];
                elem.grabElectron = values[2] == "1";
                if (values[3] != string.Empty)
                {
                    elem.size = (float)System.Convert.ToDouble(values[3]);
                }
                if (values[4] != string.Empty)
                {
                    elem.electronAffinity = (float)System.Convert.ToDouble(values[4]);
                }
            }
            elem.p        = (int)(y + 1);
            elem.nuclides = new Isotope[this.im1.width];
            x             = 0;
            while (x < this.im1.width)
            {
                float p1 = this.im1.GetPixel((int)x, (int)y).a;
                float p2 = this.im2.GetPixel((int)x, (int)y).a;
                float p3 = this.im3.GetPixel((int)x, (int)y).a;
                if (p1 != 1)
                {
                    Isotope nuc = new Isotope();
                    nuc.n = (int)x;
                    nuc.p = (int)(y + 1);
                    i     = 0f;
                    while (i < this.totalDecayModes)
                    {
                        if (p1 < (0.07f + (i * 0.1f)))
                        {
                            i = this.totalDecayModes;
                        }
                        else
                        {
                            nuc.decayMode = (DecayMode)UnityScript.Lang.UnityBuiltins.parseInt(i + 1);
                        }
                        i++;
                    }
                    i = 0f;
                    while (i < AtomChart.halfLives.Length)
                    {
                        if (p2 < (i * 0.055556f))
                        {
                            i = AtomChart.halfLives.Length;
                        }
                        else
                        {
                            nuc.halfLife = AtomChart.halfLives[Mathf.RoundToInt(i)];
                        }
                        i++;
                    }
                    nuc.gamma     = ((p3 > 0.1f) && !(((y + 1) == 84) && (x == 126))) && !(((y + 1) == 95) && (x == 146));
                    nuc.onlyGamma = ((y + 1) == 27) && (x == 33);
                    //if(!nuc.gamma) Debug.Log(elem.name + (x+y+1));
                    elem.nuclides[Mathf.RoundToInt(x)] = nuc;
                }
                AtomChart.elements[Mathf.RoundToInt(y)] = elem;
                x++;
            }
            y++;
        }
        AtomChart.ins = this;
    }
Esempio n. 3
0
        public void Summary(string itemCode, AtomChart c)
        {
            var atomData2 = c.ChartData[c.ChartData.Count - 2];
            var atomData1 = c.ChartData[c.ChartData.Count - 1];

            double highLinePoint = Math.Round(atomData2.QuantumHighPrice, RoundLength);
            double lowLinePoint  = Math.Round(atomData2.QuantumLowPrice, RoundLength);

            PlusMinusTypeEnum plusMinusType = atomData2.PlusMinusType;

            //atomData1.ClosePrice
            if (plusMinusType == PlusMinusTypeEnum.양)
            {
                Lib.Base.Enums.UpDownEnum upDown1 = Lib.Base.Enums.UpDownEnum.None;
                if (atomData2.OpenPrice < atomData1.OpenPrice && atomData2.ClosePrice < atomData1.ClosePrice)
                {
                    upDown1 = Lib.Base.Enums.UpDownEnum.StrongUp;
                }
                else if (atomData2.OpenPrice < atomData1.OpenPrice && atomData2.ClosePrice >= atomData1.ClosePrice)
                {
                    upDown1 = Lib.Base.Enums.UpDownEnum.WeakUp;
                }
                else if (atomData2.OpenPrice >= atomData1.OpenPrice && atomData2.ClosePrice >= atomData1.ClosePrice)
                {
                    upDown1 = Lib.Base.Enums.UpDownEnum.None;
                }
                CandleSummary.Instance.UpdateSummaryBaseLine(itemCode, c.TimeInterval, "매수", upDown1);

                Lib.Base.Enums.UpDownEnum upDown2 = Lib.Base.Enums.UpDownEnum.None;
                if (lowLinePoint >= atomData1.ClosePrice && lowLinePoint >= atomData1.LowPrice)
                {
                    upDown2 = Lib.Base.Enums.UpDownEnum.StrongDown;
                }
                else if (lowLinePoint < atomData1.ClosePrice && lowLinePoint >= atomData1.LowPrice)
                {
                    upDown2 = Lib.Base.Enums.UpDownEnum.WeakDown;
                }
                else if (lowLinePoint < atomData1.ClosePrice && lowLinePoint < atomData1.LowPrice)
                {
                    upDown2 = Lib.Base.Enums.UpDownEnum.None;
                }
                CandleSummary.Instance.UpdateSummaryBaseLine(itemCode, c.TimeInterval, "매도", upDown2);
            }
            if (plusMinusType == PlusMinusTypeEnum.음)
            {
                Lib.Base.Enums.UpDownEnum upDown1 = Lib.Base.Enums.UpDownEnum.None;
                if (highLinePoint <= atomData1.ClosePrice && highLinePoint <= atomData1.HighPrice)
                {
                    upDown1 = Lib.Base.Enums.UpDownEnum.StrongUp;
                }
                else if (highLinePoint > atomData1.ClosePrice && highLinePoint <= atomData1.HighPrice)
                {
                    upDown1 = Lib.Base.Enums.UpDownEnum.WeakUp;
                }
                else if (highLinePoint > atomData1.ClosePrice && highLinePoint > atomData1.HighPrice)
                {
                    upDown1 = Lib.Base.Enums.UpDownEnum.None;
                }
                CandleSummary.Instance.UpdateSummaryBaseLine(itemCode, c.TimeInterval, "매수", upDown1);

                Lib.Base.Enums.UpDownEnum upDown2 = Lib.Base.Enums.UpDownEnum.None;
                if (atomData2.OpenPrice > atomData1.OpenPrice && atomData2.ClosePrice > atomData1.ClosePrice)
                {
                    upDown2 = Lib.Base.Enums.UpDownEnum.StrongDown;
                }
                else if (atomData2.OpenPrice > atomData1.OpenPrice && atomData2.ClosePrice <= atomData1.ClosePrice)
                {
                    upDown2 = Lib.Base.Enums.UpDownEnum.WeakDown;
                }
                else if (atomData2.OpenPrice <= atomData1.OpenPrice && atomData2.ClosePrice <= atomData1.ClosePrice)
                {
                    upDown2 = Lib.Base.Enums.UpDownEnum.None;
                }
                CandleSummary.Instance.UpdateSummaryBaseLine(itemCode, c.TimeInterval, "매도", upDown2);
            }
        }
    public override void Content()
    {
        int i = 0;

        GUILayout.BeginHorizontal(new GUILayoutOption[] {});
        GUILayout.Label("New Atom: ", this.labelStyle, new GUILayoutOption[] { GUILayout.Height(30) });
        string[] outs  = new string[3];
        int[]    nvals = new int[3];
        GUILayout.BeginVertical(new GUILayoutOption[] {});
        i = 0;
        while (i < 3)
        {
            GUILayout.BeginHorizontal(new GUILayoutOption[] {});
            GUILayout.Label(("     " + this.names[i]) + "s", this.labelStyle, new GUILayoutOption[] {});
            GUILayout.Space(7);
            //GUI.SetNextControlName("field" + i);
            outs[i] = GUILayout.TextField("" + (this.vals[i] == -1 ? "" : this.vals[i].ToString()), this.fieldStyle, new GUILayoutOption[] { GUILayout.Width(40), GUILayout.Height(19) });
            GUILayout.EndHorizontal();
            outs[i] = outs[i] == "" ? "-1" : outs[i];
            if (int.TryParse(outs[i], out nvals[i]))
            {
                if (this.vals[i] != nvals[i])
                {
                    this.lastMove = Time.time;
                }
                this.vals[i] = nvals[i];
            }
            i++;
        }
        GUILayout.EndVertical();
        nvals[0] = Mathf.Clamp(this.vals[0], 1, Ngnome.MaxProtons());
        nvals[1] = AtomChart.ClosestExistingNuclide(nvals[0], this.vals[1]);
        nvals[2] = Mathf.Clamp(this.vals[2], 0, this.vals[0] + 1);
        bool changed = false;

        i = 0;
        while (i < 3)
        {
            if (this.vals[i] != nvals[i])
            {
                changed    = true;
                this.check = false;
            }
            i++;
        }
        GUILayout.EndHorizontal();
        GUILayout.Space(6);
        GUILayout.BeginHorizontal(new GUILayoutOption[] {});
        GUILayout.FlexibleSpace();
        if (this.check || !changed)
        {
            i = 0;
            while (i < 3)
            {
                this.vals[i] = nvals[i];
                i++;
            }
            this.lastControl = GUIUtility.keyboardControl;
            bool buttonDown = GUILayout.Button("Ok", this.buttonStyle, new GUILayoutOption[] { GUILayout.Width(40), GUILayout.Height(30) });
            if (buttonDown)
            {
                UserAtom.p = this.vals[0];
                UserAtom.n = this.vals[1];
                UserAtom.e = this.vals[2];
                Application.LoadLevel(0);
            }
        }
        else
        {
            if (GUILayout.Button("Check", this.buttonStyle, new GUILayoutOption[] { GUILayout.Width(60), GUILayout.Height(30) }))
            {
                this.check = true;
                i          = 0;
                while (i < 3)
                {
                    this.vals[i] = nvals[i];
                    i++;
                }
            }
        }
        GUILayout.EndHorizontal();
    }
Esempio n. 5
0
    public virtual IEnumerator Go2()
    {
        if (this.going)
        {
            yield break;
        }
        this.going       = true;
        this.dnd.enabled = false;
        Isotope iso          = AtomChart.ClosestStableNuclide(UserAtom.p, UserAtom.n);
        int     totalChanges = Mathf.Abs(iso.p - UserAtom.p) + Mathf.Abs(iso.n - UserAtom.n);

        if (totalChanges == 0)
        {
            Application.LoadLevel(1);
            yield break;
        }
        while ((iso.p != UserAtom.p) || (iso.n != UserAtom.n))
        {
            bool add = false;
            bool pr  = false;
            if (iso.n < UserAtom.n)
            {
                add = false;
                pr  = false;
            }
            if (iso.n > UserAtom.n)
            {
                add = true;
                pr  = false;
            }
            if (iso.p < UserAtom.p)
            {
                add = false;
                pr  = true;
            }
            if (iso.p > UserAtom.p)
            {
                add = true;
                pr  = true;
            }
            float overallSpeed = Mathf.Max((0.5f + Mathf.Min(2, totalChanges / 6)) * (pr ? 0.3f : 1f), 0.25f);
            this.SetFrame(add ? 3 : 0, pr);
            float moveTime = 0.5f / overallSpeed;
            float leftPos  = -3.25f;
            float rightPos = this.sfr.TransformPoint(new Vector3(-0.5f, 0, 0)).x + 1f;
            float lastTime = Time.time;
            while (Time.time < (lastTime + moveTime))
            {
                {
                    float   _77 = this.SineLerp(leftPos, rightPos, (Time.time - lastTime) / moveTime);
                    Vector3 _78 = this.transform.position;
                    _78.x = _77;
                    this.transform.position = _78;
                }
                yield return(null);
            }
            this.SetFrame(add ? 2 : 1, pr);
            yield return(new WaitForSeconds(0.1f / overallSpeed));

            this.SetFrame(add ? 1 : 2, pr);
            if (add)
            {
                if (pr)
                {
                    this.nucleus.p++;
                }
                else
                {
                    this.nucleus.n++;
                }
            }
            else
            {
                if (pr)
                {
                    this.nucleus.p--;
                }
                else
                {
                    this.nucleus.n--;
                }
            }
            this.nucleus.Rebuild();
            lastTime = Time.time;
            while (Time.time < (lastTime + moveTime))
            {
                float amt = (Time.time - lastTime) / moveTime;
                if (amt > 0.2f)
                {
                    this.SetFrame(add ? 0 : 3, pr);
                }

                {
                    float   _79 = this.SineLerp(rightPos, leftPos, amt);
                    Vector3 _80 = this.transform.position;
                    _80.x = _79;
                    this.transform.position = _80;
                }
                yield return(null);
            }
        }
        this.dialog.enabled = true;
        this.dialog.mode    = 1;
        this.going          = false;
    }