Ejemplo n.º 1
0
    static string GetScriptString(GPrefabInstance firstTarget)
    {
        string script = "";
        GFrame frame  = firstTarget.GetComponentInParent <GFrame>();

        if (frame)
        {
            //script += "findPath = \"" + GUtility.GetPath(frame.transform, firstTarget.transform) + "\";\n";
            script += "trans = frame.Find(\"" + GUtility.GetPath(frame.transform, firstTarget.transform) + "\");\n";
        }
        GWidget prefab = firstTarget.prefab;

        for (int i = 0; i < prefab.exportToScriptInfos.Count; i++)
        {
            GExportToScriptInfo property = prefab.exportToScriptInfos[i];
            string path = GUtility.GetPath(firstTarget.transform, property.target.transform);
            if (path.StartsWith("/"))
            {
                path = path.Substring(1);
            }
            script += "trans.Find(\"" + path + "\").";
            script += "GetComponent <" + property.type + "> ();";
            script += "//" + property.rename + "\n";
        }
        return(script);
    }
Ejemplo n.º 2
0
        public void Update(GameTime gameTime)
        {
            for (int i = 0; i < this.Count; i++)
            {
                if (this[i].position.X < (0 - this[i].texture.Width))
                {
                    this.Remove(this[i]);
                }
            }

            if (this.Count < this.enemyCap)
            {
                this.CreateEnemy(gameTime);
            }

            for (int i = 0; i < this.Count; i++)
            {
                if (GUtility.OfTypeBoss(this[i]))
                {
                    if (this[i].healthPoints <= 0)
                    {
                        this.Remove(this[i]);
                    }
                }

                this[i].Update(gameTime);
            }

            this.BossManager(gameTime);

            this.DifficultyIncrement(gameTime);
        }
Ejemplo n.º 3
0
 static public int Md5Sum_s(IntPtr l)
 {
     try {
         int argc = LuaDLL.lua_gettop(l);
         if (matchType(l, argc, 1, typeof(System.Byte[])))
         {
             System.Byte[] a1;
             checkArray(l, 1, out a1);
             var ret = GUtility.Md5Sum(a1);
             pushValue(l, true);
             pushValue(l, ret);
             return(2);
         }
         else if (matchType(l, argc, 1, typeof(string)))
         {
             System.String a1;
             checkType(l, 1, out a1);
             var ret = GUtility.Md5Sum(a1);
             pushValue(l, true);
             pushValue(l, ret);
             return(2);
         }
         pushValue(l, false);
         LuaDLL.lua_pushstring(l, "No matched override function Md5Sum to call");
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Ejemplo n.º 4
0
 private string Decrypt(int seed, byte[] src)
 {
     if (src == null)
     {
         return((string)null);
     }
     GUtility.Decrypt(src, src.Length);
     return(Encoding.UTF8.GetString(src));
 }
Ejemplo n.º 5
0
 public static string Decrypt(int seed, byte[] data, bool decompress = false)
 {
     if (data == null)
     {
         return((string)null);
     }
     GUtility.Decrypt(data, data.Length);
     return(Encoding.UTF8.GetString(data));
 }
Ejemplo n.º 6
0
 private byte[] Encrypt(int seed, string src)
 {
     if (string.IsNullOrEmpty(src))
     {
         return((byte[])null);
     }
     byte[] bytes = Encoding.UTF8.GetBytes(src);
     GUtility.Encrypt(bytes, bytes.Length);
     return(bytes);
 }
 protected override void OnDestroy()
 {
     base.OnDestroy();
     GUtility.SetImmersiveMove();
     if (!Object.op_Inequality((Object)this.Target, (Object)null) || this.Target.get_onEndEdit() == null)
     {
         return;
     }
     ((UnityEventBase)this.Target.get_onEndEdit()).RemoveAllListeners();
 }
Ejemplo n.º 8
0
 public static byte[] Encrypt(int seed, string msg, bool compress = false)
 {
     if (string.IsNullOrEmpty(msg))
     {
         return((byte[])null);
     }
     byte[] bytes = Encoding.UTF8.GetBytes(msg);
     GUtility.Encrypt(bytes, bytes.Length);
     return(bytes);
 }
Ejemplo n.º 9
0
 private void OnEndEdit(InputField field)
 {
     GUtility.SetImmersiveMove();
     if (field.get_text().Length <= 0)
     {
         return;
     }
     GlobalVars.EditPlayerName = field.get_text();
     this.Activate(1);
 }
Ejemplo n.º 10
0
 protected override void OnDestroy()
 {
     base.OnDestroy();
     GUtility.SetImmersiveMove();
     if (!UnityEngine.Object.op_Inequality((UnityEngine.Object) this.InputFieldFriendID, (UnityEngine.Object)null) || this.InputFieldFriendID.get_onEndEdit() == null)
     {
         return;
     }
     ((UnityEventBase)this.InputFieldFriendID.get_onEndEdit()).RemoveAllListeners();
 }
 private void OnEndEditDay(InputField field)
 {
     GUtility.SetImmersiveMove();
     if (field.get_text().Length <= 0)
     {
         return;
     }
     DebugUtility.Log("OnEndEditDay:" + field.get_text());
     this.OutputResult();
 }
Ejemplo n.º 12
0
 public static byte[] Decrypt(byte[] data)
 {
     if (data == null)
     {
         return((byte[])null);
     }
     byte[] numArray = new byte[data.Length];
     Array.Copy((Array)data, (Array)numArray, data.Length);
     GUtility.Decrypt(numArray, numArray.Length);
     return(numArray);
 }
Ejemplo n.º 13
0
 public static byte[] Encrypt(byte[] msg)
 {
     if (msg == null)
     {
         return((byte[])null);
     }
     byte[] numArray = new byte[msg.Length];
     Array.Copy((Array)msg, (Array)numArray, msg.Length);
     GUtility.Encrypt(numArray, numArray.Length);
     return(numArray);
 }
 private void OnEndEdit(InputField field)
 {
     GUtility.SetImmersiveMove();
     if (field.get_text().Length <= 0)
     {
         return;
     }
     DebugUtility.Log("OnEndEditRoomName:" + field.get_text());
     GlobalVars.EditMultiPlayRoomComment = field.get_text();
     this.Activate(1);
 }
Ejemplo n.º 15
0
 static public int SyncTimeFromServer_s(IntPtr l)
 {
     try {
         System.Int32 a1;
         checkType(l, 1, out a1);
         GUtility.SyncTimeFromServer(a1);
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Ejemplo n.º 16
0
 static public int DateTimeToTimeStamp_s(IntPtr l)
 {
     try {
         System.DateTime a1;
         checkValueType(l, 1, out a1);
         var ret = GUtility.DateTimeToTimeStamp(a1);
         pushValue(l, true);
         pushValue(l, ret);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Ejemplo n.º 17
0
 static public int HashString_s(IntPtr l)
 {
     try {
         System.String a1;
         checkType(l, 1, out a1);
         var ret = GUtility.HashString(a1);
         pushValue(l, true);
         pushValue(l, ret);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Ejemplo n.º 18
0
 static public int TimeStampToDateTime_s(IntPtr l)
 {
     try {
         System.Int32 a1;
         checkType(l, 1, out a1);
         var ret = GUtility.TimeStampToDateTime(a1);
         pushValue(l, true);
         pushValue(l, ret);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
    private void OnEndEdit(InputField field)
    {
        GUtility.SetImmersiveMove();
        if (field.get_text().Length <= 0)
        {
            return;
        }
        int result = 0;

        if (int.TryParse(field.get_text(), out result))
        {
            GlobalVars.SelectedMultiPlayRoomID = result;
        }
        this.Activate(1);
    }
Ejemplo n.º 20
0
 static public int UnZipFile_s(IntPtr l)
 {
     try {
         System.Byte[] a1;
         checkArray(l, 1, out a1);
         System.String a2;
         checkType(l, 2, out a2);
         GUtility.UnZipFile(a1, a2);
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Ejemplo n.º 21
0
 static public int GetNaturalDaysCount_s(IntPtr l)
 {
     try {
         System.DateTime a1;
         checkValueType(l, 1, out a1);
         System.DateTime a2;
         checkValueType(l, 2, out a2);
         var ret = GUtility.GetNaturalDaysCount(a1, a2);
         pushValue(l, true);
         pushValue(l, ret);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Ejemplo n.º 22
0
    static string CreateBindScript(GFrame frame)
    {
        string result = "";

        //绑定函数
        result += "public void BindProperty(Transform frame)\n";
        result += "{\n";
        ForEachProperty(frame, (GPrefabInstance loader, GRuntimeLib lib) => {
            if (lib)
            {
                result += "    " + GetName(loader.name) + " = frame.Find(\"" + GUtility.GetPath(frame.transform, loader.transform) + "\").GetComponent<" + lib.GetType().Name + ">();";
                result += "\n";
            }
        });
        result += "}\n";
        return(result);
    }
Ejemplo n.º 23
0
    static string GetScriptString2(GPrefabInstance firstTarget)
    {
        string script = "";
        GFrame frame  = firstTarget.GetComponentInParent <GFrame>();

        if (frame)
        {
            script += "相对于Frame的路径:\n";
            script += "    \"" + GUtility.GetPath(frame.transform, firstTarget.transform) + "\"\t//" + GetTypes(firstTarget.prefab.transform) + "\n";
        }
        script += "\n";
        GWidget prefab = firstTarget.prefab;

        script += "内部结构:\n";
        script += GetTreeString(prefab.transform, "    ");
        return(script);
    }
Ejemplo n.º 24
0
        private void CollisionChecker()
        {
            for (int i = 0; i < this.enemyManager.Count; i++)
            {
                for (int j = 0; j < this.Count; j++)
                {
                    if (this[j].hitbox.Intersects(this.enemyManager[i].hitbox) && !GUtility.OfTypeBoss(this.enemyManager[i]))
                    {
                        this.enemyManager.Remove(this.enemyManager[i]);
                        this.Remove(this[j]);
                        this.caster.frags++;
                        this.enemyManager.fragsUntilBoss--;
                        break;
                    }

                    if (this[j].hitbox.Intersects(this.enemyManager[i].hitbox))
                    {
                        this.enemyManager[i].healthPoints -= 10;
                        this.Remove(this[j]);
                    }
                }
            }
        }
Ejemplo n.º 25
0
        } // Draws ship on the screen

        private void Collision()
        {
            switch (this.health)
            {
            case 3:
                this.currentTexture = this.textures[0];
                break;

            case 2:
                this.currentTexture = this.textures[1];
                break;

            case 1:
                this.currentTexture = this.textures[2];
                break;

            default:
                this.game.ResetGame();
                break;
            }

            for (int i = 0; i < this.game.enemyManager.Count; i++)
            {
                if (this.hitbox.Intersects(this.game.enemyManager[i].hitbox))
                {
                    if (GUtility.OfTypeBoss(this.game.enemyManager[i]))
                    {
                        this.health -= this.health;
                        break;
                    }

                    this.health--;
                    this.game.enemyManager.Remove(this.game.enemyManager[i]);
                }
            }
        } // Loops through the enemy manager and checks if the player collides with an enemy.
Ejemplo n.º 26
0
 private void OnEndEdit(InputField field)
 {
     GUtility.SetImmersiveMove();
 }