Example #1
0
 void proc_Exited(object sender, EventArgs e)
 {
     if (this.InvokeRequired)
     {
         end en = new end(End);
         this.Invoke(en);
     }
     else
     {
         End();
     }
 }
 public value2(string su, string st, string en, string em, string name)
 {
     subject          = su;
     Start            = new start();
     Start.DateTime   = st;
     Start.TimeZone   = "UTC";
     End              = new end();
     End.DateTime     = en;
     End.TimeZone     = "UTC";
     Attendees        = new atendee();
     Attendees.adress = em;
     Attendees.name   = name;
 }
 public void finishGame(end typeofEnd)
 {
     if (typeofEnd == end.Loose)
     {
         GetComponent <goToScene>().goTo(3);
     }
     else if (typeofEnd == end.Win)
     {
         PlayerPrefs.SetInt("missilesLaunched", player.missilesLaunched);
         PlayerPrefs.SetFloat("timeTaken", Time.time - player.startTime);
         GetComponent <goToScene>().goTo(2);
     }
 }
Example #4
0
        public string Post(end End)
        {
            Connection      conn   = new Connection();
            MySqlConnection myConn = conn.GetConnection();
            //string time=DateTime.Now.ToShortDateString();
            string       s       = string.Format("update sick_leave set terminate_time='{0}' where sickleave_ID='{1}'", End.terminate_time, End.sickleave_ID);
            MySqlCommand command = new MySqlCommand(s, myConn);
            int          i       = command.ExecuteNonQuery();

            conn.Close();
            if (i != 0)
            {
                return("success");
            }
            return("fail");
        }
Example #5
0
 // Start is called before the first frame update
 private void Awake()
 {
     Player = GameObject.FindGameObjectWithTag("Player").GetComponent <Transform>();
     loser  = GameObject.FindGameObjectWithTag("END").GetComponent <end>();
     anim   = GetComponent <Animator>();
 }
Example #6
0
        static string decompile(Chunk chunk)
        {
            if (chunk != file.Main)
            {
            write("; Function " + chunk.Name);
            write(".func");
            indent = indent + 1;
            }
        else
            write("; Main code");

        write(".name \"" + chunk.Name + "\"");
        write(".options " + chunk.UpvalueCount + " " + chunk.ArgumentCount + " " + chunk.Vararg + " " + chunk.MaxStackSize);
        write("; Above contains: Upvalue count, Argument count, Vararg flag, Max Stack Size");
        write"";
        if chunk.Constants.Count > 0 then
            write("; Constants")
            for i = 1, chunk.Constants.Count do
                local c = chunk.Constants[i - 1]
                if c.Type == "Nil" then
                    write(".const nil")
                elseif c.Type == "Bool" then
                    write(".const " .. (c.Value and "true" or "false"))
                elseif c.Type == "Number" then
                    write(".const " .. c.Value)
                elseif c.Type == "String" then
                    local v = ""
                    for i = 1, c.Value:len() do
                        local ch = string.byte(c.Value, i)
                        -- other chars with values > 31 are '"' (34), '\' (92) and > 126
                        if ch < 32 or ch == 34 or ch == 92 or ch > 126 then
                            if ch >= 7 and ch <= 13 then
                                ch = string.sub("abtnvfr", ch - 6, ch - 6)
                            elseif ch == 34 or ch == 92 then
                                ch = string.char(ch)
                            end
                            v = v .. "\\" .. ch
                        else-- 32 <= v <= 126 (NOT 255)
                            v = v .. string.char(ch)
                        end
                    end
                    write(".const \"" .. v .. "\"")
                end
            end
        end
        if chunk.Locals.Count > 0 then
            write("; Locals")
            for i = 1, chunk.Locals.Count do
                write(".local " .. chunk.Locals[i - 1].Name)
            end
        end
        if chunk.Upvalues.Count > 0 then
            write("; Upvalues")
            for i = 1, chunk.Upvalues.Count do
                write(".upval " .. chunk.Upvalues[i - 1].Name)
            end
        end
        write("; Instructions")
        for i = 1, chunk.Instructions.Count do
            local instr = chunk.Instructions[i - 1]
            if instr.OpcodeType == "ABC" then
                write(instr.Opcode:lower() .. " " .. instr.A .. " " .. instr.B .. " " .. instr.C)
            elseif instr.OpcodeType == "ABx" then
                write(instr.Opcode:lower() .. " " .. instr.A .. " " .. instr.Bx)
            elseif instr.OpcodeType == "AsBx" then
                write(instr.Opcode:lower() .. " " .. instr.A .. " " .. instr.sBx)
            end
        end
        if chunk.Protos.Count > 0 then
            write("; Protos")
            write""
            for i = 1, chunk.Protos.Count do
                decompile(chunk.Protos[i - 1])
            end
        end
        if chunk ~= file.Main then
            indent = indent - 1
            write(".end")
        end
        }
        /// <summary>
        /// Este Metodo executa o movimento de End.
        /// </summary>
        /// <returns>Return TRUE se o movimento ocorreu</returns>
        public bool Do()
        {
            Structs.BasicStructs.Point r1;
            Structs.BasicStructs.Point r2;

            if (GCPS.chain.selectNode == 0)
            {
                //r1 = Members.monomero.r[Members.monomero.selectNode];
                //r2 = Members.monomero.r[Members.monomero.selectNode + 1];

                //copia dos dados do monomero para movimento
                r1 = new Structs.BasicStructs.Point()
                {
                    x = GCPS.chain.r[GCPS.chain.selectNode].x,
                    y = GCPS.chain.r[GCPS.chain.selectNode].y,
                    z = GCPS.chain.r[GCPS.chain.selectNode].z
                };
                r1.e = new List <TypeE>();
                r1.e.AddRange(GCPS.chain.r[GCPS.chain.selectNode].e);

                //copia dos dados do monomero para movimento
                r2 = new Structs.BasicStructs.Point()
                {
                    x = GCPS.chain.r[GCPS.chain.selectNode + 1].x,
                    y = GCPS.chain.r[GCPS.chain.selectNode + 1].y,
                    z = GCPS.chain.r[GCPS.chain.selectNode + 1].z
                };
                r2.e = new List <TypeE>();
                r2.e.AddRange(GCPS.chain.r[GCPS.chain.selectNode + 1].e);
            }
            else
            {
                //r1 = Members.monomero.r[Members.monomero.selectNode];
                //r2 = Members.monomero.r[Members.monomero.selectNode - 1];

                //copia dos dados do monomero para movimento
                r1 = new Structs.BasicStructs.Point()
                {
                    x = GCPS.chain.r[GCPS.chain.selectNode].x,
                    y = GCPS.chain.r[GCPS.chain.selectNode].y,
                    z = GCPS.chain.r[GCPS.chain.selectNode].z
                };
                r1.e = new List <TypeE>();
                r1.e.AddRange(GCPS.chain.r[GCPS.chain.selectNode].e);

                //copia dos dados do monomero para movimento
                r2 = new Structs.BasicStructs.Point()
                {
                    x = GCPS.chain.r[GCPS.chain.selectNode - 1].x,
                    y = GCPS.chain.r[GCPS.chain.selectNode - 1].y,
                    z = GCPS.chain.r[GCPS.chain.selectNode - 1].z
                };
                r2.e = new List <TypeE>();
                r2.e.AddRange(GCPS.chain.r[GCPS.chain.selectNode - 1].e);
            }

            //Vetor p, como sendo a difereça entre os vetores posuicao do residuo "2" e do residuo "1", isto é: p=r1-r1
            Structs.BasicStructs.Point p = new Structs.BasicStructs.Point()
            {
                x = r2.x - r1.x,
                y = r2.y - r1.y,
                z = r2.z - r1.z
            };


            //Definicao dos dois vetores v e w
            Structs.BasicStructs.Point v;
            Structs.BasicStructs.Point w;
            //cria as 3 possibilidades para v e w
            if (p.x != 0)
            {
                v = new Structs.BasicStructs.Point()
                {
                    x = 0, y = p.x, z = 0
                };
                w = new Structs.BasicStructs.Point()
                {
                    x = 0, y = 0, z = p.x
                };
            }
            else if (p.y != 0)
            {
                v = new Structs.BasicStructs.Point()
                {
                    x = 0, y = 0, z = p.y
                };
                w = new Structs.BasicStructs.Point()
                {
                    x = p.y, y = 0, z = 0
                };
            }
            else //if (p.z != 0)
            {
                v = new Structs.BasicStructs.Point()
                {
                    x = p.z, y = 0, z = 0
                };
                w = new Structs.BasicStructs.Point()
                {
                    x = 0, y = p.z, z = 0
                };
            }


            //Sorteio do movimento para 4 possibilidades (de 0 à 3)
            Randomic.Random();
            int i = (int)(Randomic.randu * 4);

            end type = end.none;

            switch (i)
            {
            case 0:
                //Primeira possibilidade: r1=r2+vi
                r1.x = r2.x + v.x;
                r1.y = r2.y + v.y;
                r1.z = r2.z + v.z;
                type = end.one;
                break;

            case 1:
                //Segunda possibilidade: r1=r2-vi
                r1.x = r2.x - v.x;
                r1.y = r2.y - v.y;
                r1.z = r2.z - v.z;
                type = end.two;
                break;

            case 2:
                //Terceira possibilidade: r1=r2+wi
                r1.x = r2.x + w.x;
                r1.y = r2.y + w.y;
                r1.z = r2.z + w.z;
                type = end.three;
                break;

            case 3:
                //Quarta possibilidade: r1=r2-wi
                r1.x = r2.x - w.x;
                r1.y = r2.y - w.y;
                r1.z = r2.z - w.z;
                type = end.four;
                break;

            default:
                new GridProteinFolding.Middle.Helpers.LoggingHelpers.Log().Exception(new System.Exception("Error ends.."), Types.ErrorLevel.Warning);
                break;
            }

            //GICO.WriteLine("{0} {1} {2}", r1.x, r1.y, r1.z);

            //Verifica a aceitação do movimento
            if (TryMove(ref r1)) // && TryMovePeerDPP(ref pointSorted, (Structs.Point)Members.monomero.r[neighborNode]))
            {
                GCPS.tempChain.r[GCPS.chain.selectNode] = r1;
                GCPS.tempChain.contMoves.endsAccept++;

                switch (type)
                {
                case end.one:
                    GCPS.tempChain.contMoves.moveSetEnd.endAccept_1++;
                    break;

                case end.two:
                    GCPS.tempChain.contMoves.moveSetEnd.endAccept_2++;
                    break;

                case end.three:
                    GCPS.tempChain.contMoves.moveSetEnd.endAccept_3++;
                    break;

                case end.four:
                    GCPS.tempChain.contMoves.moveSetEnd.endAccept_4++;
                    break;
                }

                GCPS.tempChain.typeOfLattice = BasicEnums.Lattices.End;

                return(true);
            }
            else
            {
                GCPS.chain.contMoves.endsReject++;

                switch (type)
                {
                case end.one:
                    GCPS.chain.contMoves.moveSetEnd.endReject_1++;
                    break;

                case end.two:
                    GCPS.chain.contMoves.moveSetEnd.endReject_2++;
                    break;

                case end.three:
                    GCPS.chain.contMoves.moveSetEnd.endReject_3++;
                    break;

                case end.four:
                    GCPS.chain.contMoves.moveSetEnd.endReject_4++;
                    break;
                }
                return(false);
            }
        }
 => PolygonSetContainsPoints0(polygons, start, end, epsilon);