public void SetSize(int size)
        {
            if (size > this.size)
            {
                for (int i = this.size; i < size; i++)
                {
                    zCViewText vt = view.CreateText(0, 0, SpaceText);
                    vt.Timed = 0;
                    vt.Timer = -1;
                    vt.PosX  = posX;
                    vt.PosY  = posY + i * vt.Font.GetFontY();
                    textViews.Add(vt);
                }
            }
            if (size < this.size)
            {
                for (int i = size; i < this.size; i++)
                {
                    textViews[i].Timed = 1;
                    textViews[i].Timer = 1;
                }
            }

            this.size = size;
        }
        public void SetSize(int size)
        {
            if (size > this.size)
            {
                for (int i = this.size; i < size; i++)
                {
                    zString str    = zString.Create(process, "");
                    int     height = (int)(mHeight * 0.1f);
                    int     width  = (int)(mWidth * 0.05f);

                    zCViewText vt = viewBG.CreateText(0, 0, str);
                    vt.Timed = 0;
                    vt.Timer = -1;
                    vt.PosX  = width;
                    vt.PosY  = height + i * height;

                    viewTextList.Add(vt);

                    str.Dispose();
                }
            }
            else if (size < this.size)
            {
                zCViewText[] txview = viewTextList.ToArray();
                for (int i = size; i < this.size; i++)
                {
                    txview[i].Timed = 1;
                    txview[i].Timer = 0;
                    viewTextList.Remove(txview[i]);
                }
            }

            this.size = size;
        }
Beispiel #3
0
        private void createText()
        {
            Process process = Process.ThisProcess();
            zString str     = zString.Create(process, this.text);

            textView = thisView.CreateText(this.position.X, this.position.Y, str);
            str.Dispose();

            textView.Timed = 0;
            textView.Timer = -1;
        }
        public virtual void setControl(zCViewText text)
        {
            if (text == null)
            {
                isActive  = false;
                mTextView = null;
                return;
            }
            mTextView = text;
            isActive  = true;

            mTextView.Text.Set(mText);
        }
        public override void setControl(zCViewText text)
        {
            if (text == null)
            {
                isActive  = false;
                mTextView = null;
                return;
            }
            mTextView = text;
            isActive  = true;

            mTextView.Text.Set(hardText + mText);
        }
Beispiel #6
0
        private void createText()
        {
            Process process = Process.ThisProcess();
            zString str     = zString.Create(process, this.text);
            zColor  c       = zColor.Create(process, color.R, color.G, color.B, color.A);

            textView = view.PrintTimedCXY_TV(str, -1, c);
            str.Dispose();
            c.Dispose();

            textView.Timed = 0;
            textView.Timer = -1;
        }
Beispiel #7
0
        public textBox(zCView view, Process process)
        {
            this.process = process;
            this.view    = view;
            zString empty = zString.Create(process, "");

            vt = view.CreateText(0, 0, empty);
            empty.Dispose();
            vt.Timed = 0;
            vt.Timer = -1;


            Inputenabled = true;
            InputHooked.receivers.Add(this);
        }
Beispiel #8
0
        public GUCVisualText(string text, int x, int y, GUCVisual parent, bool virtuals)
        {
            this.parent = parent;
            if (virtuals)
            {
                vpos = new ViewPoint(x, y);
            }
            else
            {
                vpos = GUCVisual.PixelToVirtual(x, y);
            }
            vpos = new ViewPoint(vpos.X * 0x2000 / parent.VSize.X, vpos.Y * 0x2000 / parent.VSize.Y);
            using (zString z = zString.Create(text))
                zviewText = parent.zView.CreateText(vpos.X, vpos.Y, z);

            shown = true;
        }
Beispiel #9
0
        public override void InputUpdate(ManagedListBox mlb, WinApi.User.Enumeration.VirtualKeys key)
        {
            if (key == VirtualKeys.Up)
            {
                mlb.ActiveID--;
            }
            if (key == VirtualKeys.Down || key == VirtualKeys.Return)
            {
                mlb.ActiveID++;
            }

            //Rückgänig
            if ((int)key == 8)
            {
                if (((String)mData).Length == 0)
                {
                    return;
                }
                mData    = ((String)mData).Substring(0, ((String)mData).Length - 1);
                TextView = TextView;
                return;
            }

            //Taste eintragen
            if (((int)key < 0x30 || (int)key > 0x5A) && (int)key != 0x20 && (int)key != 222 && (int)key != 192 &&
                (int)key != 186 && (int)key != 219 && (int)key != (int)VirtualKeys.OEMPeriod &&
                (int)key != (int)VirtualKeys.OEMComma && (int)key != (int)VirtualKeys.OEMMinus)
            {
                return;
            }


            String keyVal = Convert.ToString((char)key);

            if ((int)key == 222)
            {
                keyVal = "A";
            }
            if ((int)key == 192)
            {
                keyVal = "O";
            }
            if ((int)key == 186)
            {
                keyVal = "U";
            }
            if ((int)key == 219)
            {
                keyVal = "SS";
            }

            if ((int)key == (int)VirtualKeys.N1 && InputHooked.IsPressed((int)VirtualKeys.Shift))
            {
                keyVal = "!";
            }
            if ((int)key == (int)VirtualKeys.N8 && InputHooked.IsPressed((int)VirtualKeys.Shift))
            {
                keyVal = "(";
            }
            if ((int)key == (int)VirtualKeys.N9 && InputHooked.IsPressed((int)VirtualKeys.Shift))
            {
                keyVal = ")";
            }
            if ((int)key == (int)VirtualKeys.N7 && InputHooked.IsPressed((int)VirtualKeys.Shift))
            {
                keyVal = "/";
            }
            if ((int)key == 219 && InputHooked.IsPressed((int)VirtualKeys.Shift))
            {
                keyVal = "?";
            }
            if ((int)key == (int)VirtualKeys.OEMPeriod)
            {
                keyVal = ".";
            }
            if ((int)key == (int)VirtualKeys.OEMPeriod && InputHooked.IsPressed((int)VirtualKeys.Shift))
            {
                keyVal = ":";
            }
            if ((int)key == (int)VirtualKeys.OEMComma)
            {
                keyVal = ",";
            }
            if ((int)key == (int)VirtualKeys.OEMMinus)
            {
                keyVal = "-";
            }
            if ((int)key == (int)VirtualKeys.OEMMinus && InputHooked.IsPressed((int)VirtualKeys.Shift))
            {
                keyVal = "_";
            }
            if (!InputHooked.IsPressed((int)VirtualKeys.Shift))
            {
                keyVal = keyVal.ToLower();
            }


            mData    = (String)mData + keyVal;
            TextView = TextView;
        }
Beispiel #10
0
        public void Update()
        {
            if (client == null)
            {
                return;
            }

            if (connectionView == null)
            {
                Process process = Process.ThisProcess();
                connectionView = zCView.Create(process, 0, 0, 0x2000, 0x2000);
                zString    str = zString.Create(process, "Connection aborted!");
                zCViewText vt  = connectionView.CreateText(0x950, 0x800, str);
                str.Dispose();
                vt.Color.G = 0;
                vt.Color.B = 0;
                vt.Color.R = 255;
                vt.Color.A = 255;

                vt.Timed = 0;
                vt.Timer = -1;
            }

            if (!shown && (client.GetLastPing(client.GetSystemAddressFromIndex(0)) > 1000 || client.GetLastPing(client.GetSystemAddressFromIndex(0)) <= -1))
            {
                zCView.GetStartscreen(Process.ThisProcess()).InsertItem(connectionView, 0);
                shown = true;
            }
            else if (shown && (client.GetLastPing(client.GetSystemAddressFromIndex(0)) < 700 && client.GetLastPing(client.GetSystemAddressFromIndex(0)) > -1))
            {
                zCView.GetStartscreen(Process.ThisProcess()).RemoveItem(connectionView);
                shown = false;
            }

            int    counter = 0;
            Packet packet  = client.Receive();


            while (packet != null)
            {
                WinApi.Kernel.Process.SetWindowText(System.Diagnostics.Process.GetCurrentProcess().MainWindowHandle, "Gothic II - Untold Chapters - " + client.GetLastPing(client.GetSystemAddressFromIndex(0)));

                switch (packet.data[0])
                {
                case (byte)DefaultMessageIDTypes.ID_CONNECTION_REQUEST_ACCEPTED:
                    isConnected    = true;
                    connectionTrys = 0;
                    break;

                case (byte)DefaultMessageIDTypes.ID_CONNECTION_ATTEMPT_FAILED:
                    logError("Connection Failed!");
                    isConnected = false;
                    break;

                case (byte)DefaultMessageIDTypes.ID_ALREADY_CONNECTED:
                    logError("Already Connected!");
                    break;

                case (byte)DefaultMessageIDTypes.ID_CONNECTION_BANNED:
                    logError("Client banned!");
                    break;

                case (byte)DefaultMessageIDTypes.ID_INVALID_PASSWORD:
                    logError("Wrong password");
                    break;

                case (byte)DefaultMessageIDTypes.ID_INCOMPATIBLE_PROTOCOL_VERSION:
                    logError("ID_INCOMPATIBLE_PROTOCOL_VERSION");
                    break;

                case (byte)DefaultMessageIDTypes.ID_NO_FREE_INCOMING_CONNECTIONS:
                    logError("ID_NO_FREE_INCOMING_CONNECTIONS");
                    break;

                case (byte)DefaultMessageIDTypes.ID_DISCONNECTION_NOTIFICATION:
                case (byte)DefaultMessageIDTypes.ID_CONNECTION_LOST:
                    isConnected = false;
                    break;

                case (byte)DefaultMessageIDTypes.ID_USER_PACKET_ENUM:
                    try
                    {
                        receiveBitStream.Reset();
                        receiveBitStream.Write(packet.data, packet.length);
                        receiveBitStream.IgnoreBytes(2);
                        if ((Player.Hero == null || Player.Hero.ID == 0) && packet.data[1] != (byte)NetworkID.ConnectionMessage)
                        {
                            break;
                        }
                        if (messageListener.ContainsKey(packet.data[1]))
                        {
                            messageListener[packet.data[1]].Read(receiveBitStream, packet, this);
                        }
                    }
                    catch (Exception ex) { zERROR.GetZErr(Process.ThisProcess()).Report(2, 'G', ex.Message + ex.StackTrace, 0, "Client.cs", 0); }
                    break;
                }

                client.DeallocatePacket(packet);


                counter++;
                if (counter >= 1000)
                {
                    counter = 0;
                    zERROR.GetZErr(Process.ThisProcess()).Report(2, 'G', "1000 Packete hintereinander", 0, "Client.cs", 0);
                }

                packet = client.Receive();
            }
        }