5 Commits f8778e95f6 ... fec73fefd1

Author SHA1 Message Date
  XuJJ fec73fefd1 Merge branch 'master' of http://8.140.18.30:3000/James/SniperShooting 1 week ago
  XuJJ aec5607acd 开发:武器部件显示正确的已升级的部件 1 week ago
  XuJJ 33aec2ad98 开发:自动处理的AdMob AppId 1 week ago
  XuJJ 279ea0031b 开发:MenuItem 打包 Android 功能 1 week ago
  XuJJ fe148edb7d 开发:脱靶碰撞体放远一点,防止打不到后面的建筑物 1 week ago

+ 47 - 0
snipershooting/ShootSniper/Assets/Editor/MenuItemTools.cs

@@ -2,6 +2,7 @@ using System;
 using System.Collections.Generic;
 using System.IO;
 using UnityEditor;
+using UnityEditor.AddressableAssets.Settings;
 using UnityEngine;
 
 public class MenuItemTools
@@ -915,4 +916,50 @@ public class MenuItemTools
         AssetDatabase.Refresh();
         Debug.Log("Assets renamed according to dictionary.");
     }
+
+    [MenuItem("Tools/Build/Android/Apk")]
+    private static void BuildAndroidApk()
+    {
+        EditorUserBuildSettings.buildAppBundle = false;
+        var outputPath = $"{Application.productName}-v{Application.version}.apk";
+        BuildAndroid(outputPath);
+    }
+
+    [MenuItem("Tools/Build/Android/AAB")]
+    private static void BuildAndroidAab()
+    {
+        EditorUserBuildSettings.buildAppBundle = true;
+        var outputPath = $"{Application.productName}-v{Application.version}.aab";
+        BuildAndroid(outputPath);
+    }
+
+    private static void BuildAndroid(string outputPath)
+    {
+        KeystorePasswordSetter.AutoSetupKeystore();
+        AddressableAssetSettings.BuildPlayerContent();
+        BuildPlayer(outputPath);
+    }
+
+    private static void BuildPlayer(string outputPath)
+    {
+        var buildOptions = new BuildPlayerOptions {
+            scenes = sceneNames,
+            locationPathName = outputPath,
+            target = BuildTarget.Android,
+            options = BuildOptions.None
+        };
+        BuildPipeline.BuildPlayer(buildOptions);
+        AssetDatabase.Refresh();
+    }
+    
+    private static string[] sceneNames {
+        get {
+            var scenes = EditorBuildSettings.scenes;
+            var names = new List<string>();
+            foreach (var scene in scenes) {
+                if (scene.enabled) names.Add(scene.path);
+            }
+            return names.ToArray();
+        }
+    }
 }

+ 1 - 1
snipershooting/ShootSniper/Assets/Editor/ProjectBuild/AndroidBuild/KeystorePasswordSetter.cs

@@ -20,7 +20,7 @@ public class KeystorePasswordSetter
     }
 
     [MenuItem("Tools/自动设置 Keystore")]
-    private static void AutoSetupKeystore()
+    public static void AutoSetupKeystore()
     {
         var keystorePasswordDict = ReadKeystorePassword();
 

+ 1 - 1
snipershooting/ShootSniper/Assets/Plugins/Android/GoogleMobileAdsPlugin.androidlib/AndroidManifest.xml

@@ -2,7 +2,7 @@
 <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.google.unity.ads" android:versionName="1.0" android:versionCode="1">
   <application>
     <uses-library android:required="false" android:name="org.apache.http.legacy" />
-    <meta-data android:name="com.google.android.gms.ads.APPLICATION_ID" android:value="ca-app-pub-3940256099942544~3347511713" />
+    <meta-data android:name="com.google.android.gms.ads.APPLICATION_ID" android:value="ca-app-pub-7280192585039020~7841518578" />
     <meta-data android:name="com.google.unity.ads.UNITY_VERSION" android:value="2022.3.17f1c1" />
   </application>
 </manifest>

+ 13 - 0
snipershooting/ShootSniper/Assets/Scripts/GamePlay/Data/PlayerRuntimeData.cs

@@ -885,6 +885,19 @@ namespace SSTRGame
             return level;
         }
 
+        public int[] GetWeaponAttributeLevels(int weaponID)
+        {
+            var indexWaepon = GetWeaponSaveInfo(weaponID);
+            if (saveManager.playerConfig.weaponInfoDic.ContainsKey(weaponID))
+            {
+                foreach (AttributeUpdateInfo item in indexWaepon.attributeList)
+                {
+                    return item.attributeLevels;
+                }
+            }
+            return new int[0];
+        }
+
         /// <summary>
         /// 数据检查
         /// </summary>

+ 1 - 1
snipershooting/ShootSniper/Assets/Scripts/GamePlay/Shoot/MagicNum.cs

@@ -15,7 +15,7 @@ public class MagicNum
 	// public const float ARROW_FLY_MAXIMUM_SOUND = 50f;
 
 	//所有目标之后的一块挡板,此挡板距离最后一个目标的距离
-	public const float MISS_TARGET_OFSSET = 130f;
+	public const float MISS_TARGET_OFSSET = 240f;
 
 	// //追踪相机的高度偏移
 	// public const float TRACT_CAMERA_OFFSET_HEIGHT = 2f;

+ 9 - 6
snipershooting/ShootSniper/Assets/Scripts/GamePlay/WeaponPartView.cs

@@ -1,4 +1,5 @@
 using System.Collections.Generic;
+using System.Linq;
 using UnityEngine;
 
 public class WeaponPartView : MonoBehaviour
@@ -56,20 +57,22 @@ public class WeaponPartView : MonoBehaviour
         InitPart();
         List<int> partTypeList = new List<int>();//可以显示的枪的部件类型
         int hologramPartType = 0;//要显示全息投影的枪的部件
-        int curWeaponLv = SSTRGame.PlayerRuntimeData.Instance.GetWeaponAttributeSumLevel(weaponID);
+        //int curWeaponLv = SSTRGame.PlayerRuntimeData.Instance.GetWeaponAttributeSumLevel(weaponID);
+        var attributeLevels = SSTRGame.PlayerRuntimeData.Instance.GetWeaponAttributeLevels(weaponID);
         var weaponParts = DataManager.Instance.csvData.WeaponPart;
         for (int i = 0; i < weaponParts.Count; ++i)
         {
             if (weaponParts[i].weaponID == weaponID)
             {
-                if (curWeaponLv >= weaponParts[i].equipLevel)
+                // if (curWeaponLv >= weaponParts[i].equipLevel)
+                if (attributeLevels.Contains(weaponParts[i].equipLevel - 1))
                 {
                     partTypeList.Add(weaponParts[i].partType);
                 }
-                if (curWeaponLv + 1 == weaponParts[i].equipLevel)
-                {
-                    hologramPartType = weaponParts[i].partType;
-                }
+                // if (curWeaponLv + 1 == weaponParts[i].equipLevel)
+                // {
+                //     hologramPartType = weaponParts[i].partType;
+                // }
             }
         }
         for (int i = 0; i < parts.Length; ++i)

+ 4 - 2
snipershooting/ShootSniper/Assets/ShootGame/Scripts/ArmCtrl.cs

@@ -187,10 +187,12 @@ public class ArmCtrl : MonoBehaviour {
     public void InitWeaponParts(int weaponID)
     {
         var weaponParts = DataManager.Instance.csvData.WeaponPart;
-        int curWeaponLv = SSTRGame.PlayerRuntimeData.Instance.GetWeaponAttributeSumLevel(weaponID);
+        // int curWeaponLv = SSTRGame.PlayerRuntimeData.Instance.GetWeaponAttributeSumLevel(weaponID);
+        IList attributeLevels = SSTRGame.PlayerRuntimeData.Instance.GetWeaponAttributeLevels(weaponID);
         for (int i = 0; i < weaponParts.Count; ++i)
         {
-            if (weaponParts[i].weaponID == weaponID && curWeaponLv >= weaponParts[i].equipLevel)
+            // if (weaponParts[i].weaponID == weaponID && curWeaponLv >= weaponParts[i].equipLevel)
+            if (weaponParts[i].weaponID == weaponID && attributeLevels.Contains(weaponParts[i].equipLevel - 1))
             {
                 for (int j = 0; j < parts.Length; ++j)
                 {