コード例 #1
0
    public override void Awake()
    {
        base.Awake();
        EditorHeadline  = "ShanghaiWindy Ground Vehicle Text Data Manager";
        vehicleTextData = (VehicleTextData)target;

        UpdateAssetLabel();
    }
コード例 #2
0
    protected void  InitComponent()
    {
        if (!cInput.MobileEnableMonitor)
        {
            if (Application.platform == RuntimePlatform.OSXEditor || Application.platform == RuntimePlatform.WindowsEditor || Application.platform == RuntimePlatform.Android || Application.platform == RuntimePlatform.WP8Player || Application.platform == RuntimePlatform.WSAPlayerARM || Application.platform == RuntimePlatform.IPhonePlayer)
            {
                isMobile = true;
            }
        }


        //加载载具数据AsssetBundle
        AssetRequestTask vehicleDataRequestTask = new AssetRequestTask()
        {
            onAssetLoaded = (vehicleTextDataLoaded) => {
                //读取数据
                VehicleTextData vehicleTextData = (VehicleTextData)vehicleTextDataLoaded;
                PTCParameter = vehicleTextData.PTCParameter;
                TFParameter  = vehicleTextData.TFParameter;
                ExtraTF      = vehicleTextData.ExtraTF;
                multiTurrets = vehicleTextData.multiTurrets;
                MTParameter  = vehicleTextData.MTParameter;
                PSParameter  = vehicleTextData.PSParameter;

                string AssetBundleVariant = "extramesh";

                                #if ClientCode
                AssetBundleVariant = "clientextramesh";
                                #else
                AssetBundleVariant = "masterextramesh";
                                #endif

                //<-加载载具预制体 AsssetBundle->
                AssetRequestTask vehicleModelRequestTask = new AssetRequestTask()
                {
                    onAssetLoaded = (myReturnValue) => {
                        isAssetBundleLoaded = true;
                        AsyncLoadingScript((GameObject)myReturnValue);
                    }
                };
                vehicleModelRequestTask.SetAssetBundleName(VehicleName + "_pre", AssetBundleVariant);

                AssetBundleManager.LoadAssetFromAssetBundle(vehicleModelRequestTask);

                //<-加载载具预制体 AsssetBundle->
            }
        };

        vehicleDataRequestTask.SetAssetBundleName(VehicleName, "data");

        AssetBundleManager.LoadAssetFromAssetBundle(vehicleDataRequestTask);



        //EventManager.TriggerEvent ("CutomizeManager.ApplySelect");
    }
コード例 #3
0
    private void OnSelectNewVehicle(string _vehicle)
    {
        currentSelectedVehicle = _vehicle;

        StartCoroutine(LoadImage(_vehicle));

        UpdateAmmunitionList(_vehicle);

        AssetRequestTask vehicleDataRequestTask = new AssetRequestTask()
        {
            onAssetLoaded = (Object data) => {
                VehicleTextData vehicleTextData = (VehicleTextData)data;
                BulletScript    bulletData      = vehicleTextData.TFParameter.bulletType.GetComponent <BulletScript>();

                string formater = "{0}:{1} {2}:{3}(m/s) {4}:{5}(hp) {6}:{7}(mm)";


                uiReference.APText.text = string.Format(
                    formater,
                    uGUI_Localsize.GetContent("AmmoType"), "AP",
                    uGUI_Localsize.GetContent("AmmoSpeed"), bulletData.Speed,
                    uGUI_Localsize.GetContent("AmmoDamage"), bulletData.APDamage,
                    uGUI_Localsize.GetContent("AmmoPenerate"), bulletData.APPenetration
                    );

                uiReference.HEText.text = string.Format(
                    formater,
                    uGUI_Localsize.GetContent("AmmoType"), "HE",
                    uGUI_Localsize.GetContent("AmmoSpeed"), bulletData.Speed * 0.75f,
                    uGUI_Localsize.GetContent("AmmoDamage"), bulletData.HeDamage,
                    uGUI_Localsize.GetContent("AmmoPenerate"), bulletData.HePenetration
                    );

                uiReference.APCRText.text = string.Format(
                    formater,
                    uGUI_Localsize.GetContent("AmmoType"), "APCR",
                    uGUI_Localsize.GetContent("AmmoSpeed"), bulletData.Speed * 1.25f,
                    uGUI_Localsize.GetContent("AmmoDamage"), bulletData.APDamage * 0.75f,
                    uGUI_Localsize.GetContent("AmmoPenerate"), bulletData.ApcrPenration
                    );
            }
        };

        vehicleDataRequestTask.SetAssetBundleName(_vehicle, "data");

        AssetBundleManager.LoadAssetFromAssetBundle(vehicleDataRequestTask);
    }
コード例 #4
0
        public override void OnInspectorGUI()
        {
            vehicleTextData = (VehicleTextData)target;


            if (GUILayout.Button("Set Asset Label"))
            {
                UpdateAssetLabel();
            }


            base.OnInspectorGUI();



            if (GUI.changed)
            {
                EditorUtility.SetDirty(target);
            }
        }
コード例 #5
0
    public override void OnInspectorGUI()
    {
        vehicleTextData = (VehicleTextData)target;


        BaseGUI();

        if (GUILayout.Button("Export Data as Json"))
        {
            string path = EditorUtility.SaveFilePanel("Export As Json", "Others/Data/", vehicleTextData.AssetName, "json");

            FileStream fs   = new FileStream(path, FileMode.Create);
            byte[]     data = System.Text.Encoding.Default.GetBytes(JsonUtility.ToJson(target));
            fs.Write(data, 0, data.Length);
            fs.Flush();
            fs.Close();
        }

        if (GUILayout.Button("Set Asset Label"))
        {
            UpdateAssetLabel();
        }

        if (vehicleTextData.TFParameter.bulletType != null)
        {
            BulletScript bulletData = vehicleTextData.TFParameter.bulletType.GetComponent <BulletScript>();
            EditorGUILayout.HelpBox(string.Format("AP Damage {0} Peneration{1}", bulletData.APDamage, bulletData.APPenetration), MessageType.None);
            EditorGUILayout.HelpBox(string.Format("HE Damage {0} Peneration{1}", bulletData.HeDamage, bulletData.HePenetration), MessageType.None);
            EditorGUILayout.HelpBox(string.Format("APCR Damage {0} Peneration{1}", bulletData.APDamage * 0.75f, bulletData.ApcrPenration), MessageType.None);
        }

        base.OnInspectorGUI();



        if (GUI.changed)
        {
            EditorUtility.SetDirty(target);
        }
    }