Ejemplo n.º 1
0
        public void Test(RpcValue paramater)
        {
            ArrayPool <byte> bufferPool = TcpClient.GetBufferPool();

            ArrayPool <byte> .Node buffer;
            lock (bufferPool)
            {
                buffer = bufferPool.AllocBuffer(DEFAULT_BUFFER_SIZE);
            }

            int serializePoint = buffer.GetOffset();

            paramater.Serialize(buffer.GetBuffer(), ref serializePoint);

            int dserializePoint = buffer.GetOffset();

            paramater.Deserialize(RpcValueArrayPool
                                  , RpcValuePool
                                  , buffer.GetBuffer()
                                  , ref dserializePoint);

            lock (bufferPool)
            {
                bufferPool.ReleaseBuffer(buffer);
            }

            MDebug.Assert(serializePoint == dserializePoint
                          , "Rpc"
                          , "serializePoint == dserializePoint");
        }
    // 몬스터 HP Update
    public void MonsterHPUpdate(int curHP, int maxHP)
    {
        if (maxHP == 0)
        {
            return;
        }
        MDebug.Log("h " + curHP + " max " + maxHP);
        float         percent = ((float)curHP / (float)maxHP);
        float         width   = m_topEnemyHPBar.sprite.rect.size.x;
        RectTransform t       = m_topEnemyHPBar.GetComponent <RectTransform>();

        t.sizeDelta = new Vector2(width * percent, t.sizeDelta.y);

        float arrowWidth = m_enemyHPLeftArrow.sprite.rect.size.x * 0.5f;

        Vector3 left = new Vector3(
            m_topEnemyHPBar.transform.position.x - (t.sizeDelta.x / 2.0f) - arrowWidth,
            m_enemyHPLeftArrow.transform.position.y);
        Vector3 right = new Vector3(
            m_topEnemyHPBar.transform.position.x + (t.sizeDelta.x / 2.0f) + arrowWidth,
            m_enemyHPLeftArrow.transform.position.y);

        m_enemyHPLeftArrow.transform.position  = left;
        m_enemyHPRightArrow.transform.position = right;

        NetworkManager.Instance().SendOrderMessage(JSONMessageTool.ToJsonHPUdate("targetMon", percent));
    }
Ejemplo n.º 3
0
        public static void AppendValueType(StringBuilder stringBuilder, ValueType valueType)
        {
            switch (valueType)
            {
            case ValueType.Byte:
            case ValueType.Short:
            case ValueType.Int:
            case ValueType.Long:
            case ValueType.Float:
            case ValueType.Double:
                stringBuilder.Append('_').Append((byte)valueType);
                break;

            // 所有数组都当成同一种类型,方便处理
            case ValueType.FixedValueTypeArray:
            case ValueType.VariableValueTypeArray:
                stringBuilder.Append('_').Append((byte)ValueType.FixedValueTypeArray);
                break;

            default:
                MDebug.Assert(false
                              , "Rpc"
                              , "Not support ValueType: " + valueType);
                break;
            }
        }
Ejemplo n.º 4
0
        public virtual void OnBefore()
        {
            m_Enable        = false;
            m_CallbackOrder = 0;

            Type   type         = GetType();
            string typeFullName = type.FullName;
            List <PreprocessShadersSetting> preprocessShadersSettings = ShaderToolsSetting.GetInstance().PreprocessShadersSettings;

            for (int iPreprocessShaders = 0; iPreprocessShaders < preprocessShadersSettings.Count; iPreprocessShaders++)
            {
                PreprocessShadersSetting iterPreprocessShadersSetting = preprocessShadersSettings[iPreprocessShaders];
                if (iterPreprocessShadersSetting.MonoScriptTypeFullName == typeFullName)
                {
                    Setting = JsonUtility.FromJson(iterPreprocessShadersSetting.SettingJson
                                                   , typeof(TSetting)) as TSetting;

                    m_Enable        = true;
                    m_CallbackOrder = Setting.CallbackOrder;
                    MDebug.Log("Shader"
                               , $"启用Shader处理({typeFullName}), 顺序({m_CallbackOrder}), 设置({iterPreprocessShadersSetting.SettingJson})");

                    break;
                }
            }

            if (m_Enable)
            {
                OnBeforeInternal();
            }
        }
Ejemplo n.º 5
0
    public float GetValueForStat(StatType type, UnitStats stats)
    {
        foreach (StatLevelConfig config in StatConfigs)
        {
            StatType root_type = config.Perk;

            if (root_type == type)
            {
                MDebug.Log("perk value " + type);
                return(stats.GetStatAmount(type));
            }

            foreach (SubStatConfig sub_config in config.SubConfigs)
            {
                if (sub_config.SubStat == type)
                {
                    int current_level_root = (int)stats.GetStatAmount(root_type);

                    return(sub_config.Values[Mathf.Min(current_level_root, sub_config.Values.Length - 1)]);
                }
            }
        }

        return(0);

        ;
    }
        private void DisableBehaviour(BaseBehaviour behaviour)
        {
            if (!behaviour.IsEnable() && behaviour.IsLastEnable())
            {
                try
                {
                    MDebug.LogVerbose("Core"
                                      , $"Before execute {behaviour.GetName()}.OnDisable");

                    behaviour.OnDisable();

                    MDebug.LogVerbose("Core"
                                      , $"After execute {behaviour.GetName()}.OnDisable");
                }
                catch (Exception e)
                {
                    MDebug.LogError("Core"
                                    , $"Execute {behaviour.GetName()}.OnDisable Exception:{e.ToString()}");
                }
                finally
                {
                    behaviour.SetLastEnable(false);
                }
            }
        }
Ejemplo n.º 7
0
 public void StartTurn()
 {
     MDebug.Log("Start Turn " + GetID());
     selectedAction  = -1;
     actionsMade     = 0;
     currentTurnCost = 0;
 }
Ejemplo n.º 8
0
    IEnumerator DoAction( )
    {
        TargetPosition.y = 0;
        Active           = true;

        Vector3 delta = TargetPosition - M_Math.GetCameraCenter();

        MDebug.Log("^cameraStart Panning " + TargetPosition.ToString());
        while (delta.magnitude > 0.1f)
        {
            delta = TargetPosition - M_Math.GetCameraCenter();
            float speed = Speed;

            if (delta.magnitude < DistanceSpeedFalloffStart)
            {
                speed *= SpeedFalloff.Evaluate((DistanceSpeedFalloffStart - delta.magnitude) / DistanceSpeedFalloffStart);
            }

            transform.Translate(Vector3.ClampMagnitude(delta.normalized * speed * Time.deltaTime, delta.magnitude), Space.World);

            Debug.DrawLine(M_Math.GetCameraCenter(), TargetPosition, Color.red);

            yield return(null);
        }
        MDebug.Log("^cameraEndPanning " + TargetPosition.ToString());
        Active = false;
        Callback();
    }
Ejemplo n.º 9
0
        static void Prefix(GameObject LoadedObject, SavedCustomObject save)
        {
            var handler     = LoadedObject.GetComponent <UpdateHandler>();
            var handlerType = handler.GetType();

            Action <object> setValue = null;

            foreach (var item in save.CustomData.Skip(2))
            {
                if (item is string str && str.StartsWith("::"))
                {
                    string name = str.Substring(2);

                    var field = handlerType.GetField(name);
                    if (field == null)
                    {
                        var prop = handlerType.GetProperty(name);

                        if (prop == null)
                        {
                            MDebug.WriteLine("ERROR: INVALID DATA FIELD!");
                        }
                        else
                        {
                            setValue = o => prop.SetValue(handler, Convert.ChangeType(o, prop.PropertyType), null);
                        }
                    }
                    else
                    {
                        setValue = o => field.SetValue(handler, o);
                    }
                }
Ejemplo n.º 10
0
    public void Damage(int damage, string boneName)
    {
        base.Damage(damage);
        SpriteRenderer target = null;

        if (boneName.Equals("head"))
        {
        }
        else if (boneName.Equals("Tail"))
        {
        }
        else
        {
            string num = Regex.Replace(boneName, @"\D", "");
            MDebug.Log(boneName);
            int index = int.Parse(num);
            target = m_destroyBoneList[index - 1].m_renderer;

            m_destroyBoneList[index - 1].m_hp -= 1;

            if (m_destroyBoneList[index - 1].m_hp <= 0)
            {
                m_destroyBoneList[index - 1].m_renderer.enabled = true;
                NetworkManager.Instance().SendOrderMessage(JSONMessageTool.ToJsonPartDestroy(index - 1));
            }
        }
        NetworkManager.Instance().SendOrderMessage(JSONMessageTool.ToJsonHPUdate(m_name, m_hp));
    }
Ejemplo n.º 11
0
        public unsafe void Send(byte[] data, int offset, int count)
        {
            if (!IsConnected())
            {
                MDebug.LogError(LOG_TAG, $"Client({GetName()}) 并未连接,无法发送数据");
                return;
            }

            byte[] buffer        = m_WaitSendBuffer.GetBuffer();
            int    writePosition = m_WaitSendBuffer.GetOffset() + m_WaitSendBufferSize;

            fixed(byte *pBuffer = &buffer[writePosition])
            {
                *((TLength *)pBuffer) = PACKAGE_HEADER_SIZE + count;
                writePosition        += PACKAGE_HEADER_SIZE;
                m_WaitSendBufferSize += PACKAGE_HEADER_SIZE;
            }

            Array.Copy(data
                       , offset
                       , m_WaitSendBuffer.GetBuffer()
                       , writePosition
                       , count);
            m_WaitSendBufferSize += count;

            StartSend();
        }
Ejemplo n.º 12
0
    private void AttemptApplyEffect(Unit target, UnitEffect effect)
    {
        //Make copy
        UnitEffect copy = MakeCopy(effect, target);

        MDebug.Log("^effectsAttempt Apply \n" + copy.ToString() + "  by " + copy.Instigator);

        if (CanApplyEffect(target, copy) && target.GetComponent <Unit_EffectManager>().ApplyEffect(copy))
        {
            TurnSystem.Instance.OnGlobalTurn += copy.OnGlobalTurn;

            if (VFX_Applied != null)
            {
                VFX_Applied.Init(target.currentTile.gameObject);
            }


            if (TickOnApply)
            {
                copy.EffectTick();
            }
        }
        else
        {
            Destroy(copy.gameObject);
        }
    }
        public ObjectPool <T> GetPool <T>(bool canCreate = true) where T : class
        , IObjectPoolItem
        , new()
        {
            Type   type = typeof(T);
            string key  = TypeToKey(type);

            if (!m_WeakObjectPools.TryGetValue(key, out WeakReference weakReference) ||
                !weakReference.IsAlive)
            {
                if (!canCreate)
                {
                    return(null);
                }

                if (weakReference == null)
                {
                    MDebug.Log("Pool", $"Create new ObjectPool<{type.FullName}>.");
                }
                else
                {
                    MDebug.Log("Pool", $"ObjectPool<{type.FullName}> has been GC. Will create new ObjectPool");
                }
                ObjectPool <T> pool = new ObjectPool <T>();
                m_StrongObjectPools.Add(pool);
                weakReference          = new WeakReference(pool);
                m_WeakObjectPools[key] = weakReference;
            }

            return((ObjectPool <T>)weakReference.Target);
        }
Ejemplo n.º 14
0
    IEnumerator WaitCoroutine(float duration)
    {
        MDebug.Log("ENTER WaitCoroutine");
        yield return(new WaitForSeconds(duration));

        MDebug.Log("EXIT WaitCoroutine");
    }
Ejemplo n.º 15
0
        /// <summary>
        /// 等待所有的<see cref="TaskUpdate"/>完成
        /// </summary>
        private void WaitTaskUpdate()
        {
            for (int iTask = 0; iTask < m_TaskItemsCache.Count; iTask++)
            {
                TaskUpdateItem taskItem = m_TaskItemsCache[iTask];
                taskItem.ManualResetEvent.WaitOne();

                BaseBehaviour iterBehaviour = taskItem.Behaviour;
                try
                {
                    MDebug.LogVerbose("Core"
                                      , $"Before execute {iterBehaviour.GetName()}.OnAfterTaskUpdate");

                    iterBehaviour.OnAfterTaskUpdate(taskItem.Output);

                    MDebug.LogVerbose("Core"
                                      , $"After execute {iterBehaviour.GetName()}.OnAfterTaskUpdate");
                }
                catch (Exception e)
                {
                    MDebug.LogError("Core"
                                    , $"Execute {iterBehaviour.GetName()}.OnAfterTaskUpdate Exception:{e.ToString()}");
                }

                m_TaskItemPool.Release(taskItem);
            }

            m_TaskItemsCache.Clear();
        }
Ejemplo n.º 16
0
    public static void UnitTest(List <IWeightable> WeightableObjects)
    {
        MDebug.Log("test: " + WeightableObjects.Count);
        List <IWeightable> Result = new List <IWeightable>();

        for (int i = 0; i < 100; i++)
        {
            Result.Add(GetWeighted(WeightableObjects));
        }

        int count = 0;

        for (int i = 0; i < WeightableObjects.Count; i++)
        {
            //	MDebug.Log( (WeightableObjects[i]).WeightableID+" checking");
            foreach (IWeightable w in Result)
            {
                if (WeightableObjects[i] == w)
                {
                    count++;
                }
            }
            //MDebug.Log( (WeightableObjects[i]).WeightableID+" : "+count);
            count = 0;
        }
    }
Ejemplo n.º 17
0
        private void EndFrame()
        {
            TaskUpdate(Time.deltaTime);

            #region Handle Disable
            for (int iBehaviour = 0; iBehaviour < m_BehavioursForTraverse.Count; iBehaviour++)
            {
                BaseBehaviour behaviour = m_BehavioursForTraverse[iBehaviour];
                DisableBehaviour(behaviour);
            }
            #endregion

            #region Handle Release
            for (int iBehaviour = 0; iBehaviour < m_RemoveBehavioursCache.Count; iBehaviour++)
            {
                BaseBehaviour behaviour = m_RemoveBehavioursCache[iBehaviour];
                ReleaseBehaviour(behaviour);
            }
            m_RemoveBehavioursCache.Clear();
            #endregion

            m_BehavioursForTraverse.Clear();

            MDebug.LogVerbose("Core", "EndFrame " + Time.frameCount);
        }
Ejemplo n.º 18
0
    public void ReceiveDamage(UnitEffect_Damage dmg)
    {
        if (GetStatAmount(StatType.oxygen) <= 0)
        {
            return;
        }

        int dmg_received = (-(dmg.GetDamage()));
        int int_received = Constants.GetGainedAdrenaline(this, Mathf.Abs(dmg_received));

        MDebug.Log("^effects " + this.name + " rcv damge " + dmg_received + "  rcvd multiplier:" + "WTF" + "  +int=" + int_received);

        AddOxygen(dmg_received, true);

        if (dmg_received < 0 && OnDmgReceived != null)
        {
            OnDmgReceived();
        }


        int x, y = 0;

        if (GetStatAmount(StatType.oxygen) > 0)
        {
            AddAdrenaline(int_received, true, out x, out y);
        }
    }
Ejemplo n.º 19
0
        protected void FixedUpdate()
        {
            BeginFrame();

            float deltaTime = Time.fixedDeltaTime;

            for (int iBehaviour = 0; iBehaviour < m_BehavioursForTraverse.Count; iBehaviour++)
            {
                BaseBehaviour iterBehaviour = m_BehavioursForTraverse[iBehaviour];
                if (!iterBehaviour.CanUpdate())
                {
                    continue;
                }

                try
                {
                    MDebug.LogVerbose("Core"
                                      , $"Before execute {iterBehaviour.GetName()}.OnFixedUpdate");

                    iterBehaviour.OnFixedUpdate(deltaTime);

                    MDebug.LogVerbose("Core"
                                      , $"After execute {iterBehaviour.GetName()}.OnFixedUpdate");
                }
                catch (Exception e)
                {
                    MDebug.LogError("Core"
                                    , $"Execute {iterBehaviour.GetName()}.OnFixedUpdate Exception:{e.ToString()}");
                }
            }
        }
Ejemplo n.º 20
0
    public void AttemptAction(Component target)
    {
        if (CanExecAction(true))
        {
            if (OnTarget != null)
            {
                OnTarget(this, target.transform);
            }
            ActionInProgress = true;
            ChargeController.UseCharge();

            ActionStarted(target);

            if (OnActionStart != null)
            {
                OnActionStart(this);
            }

            // MDebug.Log("executing " + gameObject.name);

            if (action_sequence != null)
            {
                action_sequence.StartSequence(GetExecAnimation(), GetExecSound(), Owner, target.transform, () => ActionExecuted(target));
            }
            else
            {
                ActionExecuted(target);
            }
        }
        else
        {
            MDebug.Log("Coudlnt execute " + ActionID + " ap cost:" + AP_Cost + " / " + Owner.Actions.GetAPLeft());
        }
    }
Ejemplo n.º 21
0
    void SelectAction(int id)
    {
        MDebug.Log("attempt select " + id + " length" + ActionCost.Length);

        if (id == -1)
        {
            MDebug.Log("select " + id);
            selectedAction = -1;
        }
        else if (id < ActionCost.Length && id >= 0)
        {
            MDebug.Log("asdasd");
            if (selectedAction == id)
            {
                currentTurnCost += ActionCost[id];
                actionsMade++;
                selectedAction = -1;
                MDebug.Log("execte " + id + "   actions:" + actionsMade);
            }
            else
            {
                selectedAction = id;
            }
        }

        if (UpdateCostPreview != null)
        {
            UpdateCostPreview(this);
        }
    }
Ejemplo n.º 22
0
        /// <summary>
        /// Jacobi求解三元一次方程近似解
        ///     <see cref="https://en.wikipedia.org/wiki/Jacobi_method"/>
        /// a_n1 * x + a_n2 * y + a_n3 * z = bn
        /// 方程组需要满足diagonally dominant matrices或symmetric matrix
        ///     <see cref="https://en.wikipedia.org/wiki/Diagonally_dominant_matrix"/>
        ///     TODO 我只判断了diagonally dominant matrices,还没判断symmetric的情况
        /// <see cref="GaussSeidelMethod"/>
        /// </summary>
        /// <param name="iterationCount">迭代次数,次数越多结果越正确</param>
        /// <param name="x" name="y" name="z">预测的近似值及计算结果</param>
        public static void JacobiMethod(int iterationCount
                                        , ref float x, ref float y, ref float z
                                        , float a11, float a12, float a13, float b1
                                        , float a21, float a22, float a23, float b2
                                        , float a31, float a32, float a33, float b3)
        {
#if GF_DEBUG
            MDebug.Assert(Mathf.Abs(a11) > Mathf.Abs(a12) + Mathf.Abs(a13) &&
                          Mathf.Abs(a22) > Mathf.Abs(a21) + Mathf.Abs(a23) &&
                          Mathf.Abs(a33) > Mathf.Abs(a31) + Mathf.Abs(a32),
                          "Not a diagonally dominant matrices!");
#endif

            float tempX = x, tempY = y, tempZ = z;
            // 对角线的导数,为了性能提前算好
            float a11Reciprocal = 1.0f / a11;
            float a22Reciprocal = 1.0f / a22;
            float a33Reciprocal = 1.0f / a33;
            while (iterationCount-- > 0)
            {
                tempX = (b1 - a12 * y - a13 * z) * a11Reciprocal;
                tempY = (b2 - a21 * x - a23 * z) * a22Reciprocal;
                tempZ = (b3 - a31 * x - a32 * y) * a33Reciprocal;
                x     = tempX; y = tempY; z = tempZ;
            }
        }
Ejemplo n.º 23
0
    IEnumerator ApplyEffects(Unit atk, Unit target)
    {
        ActionInProgress = true;
        List <UnitEffect> Effects = GetEffects();

        MDebug.Log("^effects Applying " + Effects.Count + "effects   to " + target.GetID());



        bool first = true;

        foreach (UnitEffect effect in Effects)
        {
            if (!first)
            {
                yield return(new WaitForSeconds(0.5f));
            }
            first = false;
            if (effect == null)
            {
                Debug.LogError("^effects NO EFFECT..");
            }
            if (!effect.GetTarget(target, atk).IsDead())
            {
                yield return(StartCoroutine(effect.ApplyEffectSequence(target)));
            }
        }

        StartCoroutine(DelayedCompletion(0.5f));
    }
Ejemplo n.º 24
0
        private void LogShaderKeywords()
        {
            RefreshShaderKeywords();
            StringBuilder disableKeywords = new StringBuilder();
            StringBuilder enabledKeywords = new StringBuilder();

            for (int iKeyword = 0; iKeyword < m_GlobalKeywords.Count; iKeyword++)
            {
                KeywordItem iterKeyword = m_GlobalKeywords[iKeyword];
                if (Shader.IsKeywordEnabled(iterKeyword.KeywordName))
                {
                    enabledKeywords.Append(iKeyword).Append(",是,")
                    .Append(iterKeyword.KeywordName).Append(',')
                    .Append(iterKeyword.KeywordType).Append('\n');
                }
                else
                {
                    disableKeywords.Append(iKeyword).Append(",否,")
                    .Append(iterKeyword.KeywordName).Append(',')
                    .Append(iterKeyword.KeywordType).Append('\n');
                }
            }

            string shaderKeywords = $"编号,是否启用,名字,类型\n{enabledKeywords.ToString()}{disableKeywords.ToString()}";

            MDebug.Log("ShaderTools", "ShaderKeywords:\n" + shaderKeywords);

#if UNITY_EDITOR
            string reportFileName = $"{Application.dataPath}/../Temp/ShaderKeywords.csv";
            File.WriteAllText(reportFileName, shaderKeywords);
            EditorUtility.OpenWithDefaultApp(reportFileName);
            EditorUtility.RevealInFinder(reportFileName);
#endif
        }
Ejemplo n.º 25
0
    void OnTriggerExit2D(Collider2D col)
    {
        MDebug.Log("Exit " + col.tag);

        if (m_damagePointFix != null && m_damagePointFix.Equals(col.gameObject))
        {
            m_damagePointFix = null;
        }

        if (!string.IsNullOrEmpty(col.transform.tag))
        {
            m_userControlName = null;
        }

        if (col.tag == "LADDER")
        {
            ShowWeapon(true);
            m_LadderState            = false;
            m_rigidBody.gravityScale = 1.0f;
            m_curState = BitControl.Clear(m_curState, (int)Hero.HERO_STATE.LADDER);

            // 사다리
            m_skletonAnimation.enabled = true;
            this.GetComponent <MeshRenderer>().enabled = true;
            if (m_climb == null)
            {
                return;
            }
            if (m_climb.state.GetCurrent(0) != null)
            {
                m_climb.state.ClearTrack(0);
            }
            m_climb.gameObject.SetActive(false);
        }
    }
Ejemplo n.º 26
0
    public override void Init(Func <bool> canComplete)
    {
        base.Init(canComplete);
        MDebug.Log("Condition Pressbutton");

        // key = config.key;
    }
Ejemplo n.º 27
0
        public static void AppendParameterInfo(StringBuilder stringBuilder, RpcValue parameterInfo)
        {
            switch (parameterInfo.ValueType)
            {
            case ValueType.Byte:
            case ValueType.Short:
            case ValueType.Int:
            case ValueType.Long:
            case ValueType.Float:
            case ValueType.Double:
                AppendValueType(stringBuilder, parameterInfo.ValueType);
                break;

            case ValueType.FixedValueTypeArray:
            case ValueType.VariableValueTypeArray:
                ArrayPool <RpcValue> .Node parameters = parameterInfo.ArrayValue;
                break;

            default:
                MDebug.Assert(false
                              , "Rpc"
                              , "Not support ValueType: " + parameterInfo.ValueType);
                break;
            }
        }
Ejemplo n.º 28
0
        private void ParallelUpdate(float deltaTime)
        {
            MDebug.Assert(m_ParallelItemsCache.Count == 0, "Core", "m_ParallelTasksCache.Count == 0");

            string lastGroupName = string.Empty;

            for (int iBehaviour = 0; iBehaviour < m_BehavioursForTraverse.Count; iBehaviour++)
            {
                BaseBehaviour iterBehaviour = m_BehavioursForTraverse[iBehaviour];
                if (!iterBehaviour.CanUpdate() ||
                    !iterBehaviour.HasFeature(FeatureFlag.ParallelUpdate))
                {
                    continue;
                }

                string groupName = iterBehaviour.GetGroup();
                if (groupName != lastGroupName)
                {
                    ExecuteParallelUpdateGroup();
                }

                lastGroupName = groupName;
                m_ParallelItemsCache.Add(m_ParallelItemPool.Alloc()
                                         .SetData(iterBehaviour, deltaTime));
            }

            ExecuteParallelUpdateGroup();
        }
Ejemplo n.º 29
0
        public static void Build()
        {
            bool success = false;

            try
            {
                ms_Context = new Context();
                AssetBundleBuild[] assetBundleBuild = GenerateAssetBundle();
                success = BuildAB(assetBundleBuild, out AssetBundleManifest assetBundleManifest);

                if (success)
                {
                    GenerateAssetMapAndAssetKeyEnumFile();
                }

                if (success && BuildSetting.GetInstance().BuildAssetBuild)
                {
                    GenerateBundleInfosAndAssetInfosAndAssetKeyEnumFile(assetBundleManifest);
                }
            }
            catch (Exception e)
            {
                MDebug.LogError("AssetBundle", "Build AssetBundle Exception:\n" + e.ToString());
            }
            finally
            {
                ms_Context = null;
                EditorUtility.ClearProgressBar();
                EditorUtility.DisplayDialog("AssetBundle"
                                            , "Build AB " + (success ? "Success" : "Failed")
                                            , "OK");
            }
        }
Ejemplo n.º 30
0
    IEnumerator PanToWorldPos(Vector3 pos, float speed, EventHandler _cb)
    {
        MDebug.Log("Start Pan");
        pos.y          = 0;
        drag           = true;
        event_callback = _cb;
        Vector3 delta = pos - M_Math.GetCameraCenter();

        while (delta.magnitude > 0.1f)
        {
            transform.Translate((pos - M_Math.GetCameraCenter()).normalized * speed * Time.deltaTime, Space.World);

            delta = pos - M_Math.GetCameraCenter();

            Debug.DrawLine(M_Math.GetCameraCenter(), pos, Color.red);
            yield return(null);
        }

        if (event_callback != null)
        {
            event_callback();
            event_callback = null;
        }

        inputEnabled = true;
        drag         = false;
    }