Esempio n. 1
0
    void Putdown()
    {
        if (!conveyObject)
        {
            return;
        }
        GTower tower = GridManager.instance.GetTower(GetSelectLocation());

        if (tower != null)
        {
            IReceiveable target = tower as IReceiveable;
            if (target != null)
            {
                target.Receive(conveyObject);
            }
        }
        else
        {
            switch (conveyObject.type)
            {
            case ProjectileType.RawMaterial:
                if (GridManager.instance.GetFloor(GetSelectLocation()).floorType == GFloor.FloorType.the_enemy_path)
                {
                    break;
                }
                Build(GetSelectLocation(), ColorMixing.instance.AnalysisColor(conveyObject.Color));
                Destroy(conveyObject.gameObject);
                break;

            case ProjectileType.BuildingMaterial:
                break;

            case ProjectileType.NormalBullet:
                break;

            case ProjectileType.BlueBullet:
                break;

            case ProjectileType.RedBullet:
                break;

            case ProjectileType.Text:
                Transform target = GridManager.instance.InstansiateChessAt(PrefabManager.instance.textPrefab, GetSelectLocation()).GetComponent <Transform>();
                target.transform.position             = target.transform.position + new Vector3(0, 0.05f, 0);
                target.GetComponent <TextMesh>().text = conveyObject.gameObject.GetComponent <TextMesh>().text;

                target.GetComponent <LevelNumber>().levelNumber    = conveyObject.GetComponent <LevelNumber>().levelNumber;
                target.GetComponent <LevelNumber>().targetLocation = conveyObject.GetComponent <LevelNumber>().targetLocation;

                Destroy(conveyObject.gameObject);
                break;
            }
        }
    }
Esempio n. 2
0
            public Dispatcher(IReceiveable receiver)
            {
                dispatcher = this;

                this.receiver = receiver;
            }
Esempio n. 3
0
        //在联网前,读取Read本地缓存文件,如果没有文件,hashcode为"",第一行是hashcode
        //加载Load hashcode,数据,到内存
        //登录,比较新hashcode,相同则跳过;不同,则申请新的hashcode
        //申请的结果和运行时动态更新都是收到服务端的ResponseTextConfig,加载hashcode,数据,到内存,组装新文件替换缓存

        /// <summary>
        /// 从硬盘读取bytes加载到内存。每次刚运行时调用
        /// </summary>
        public static void ReadCacheAndLoadAllLargeConfigs()
        {
            for (int i = 0; i < Configs.Length; i++)
            {
                var configType = (ConfigType)i;

                var    path  = GetFilePath(configType);
                byte[] bytes = null;
                if (File.Exists(path))
                {
                    try
                    {
                        //bytes = File.ReadAllBytes(path);
                    }
                    catch (Exception e)
                    {
                        Debug.LogException(e);
                    }
                }
                if (bytes != null)
                {
                    IReceiveable configCmd = null;
                    switch (configType)
                    {
                    case ConfigType.CoreConfig:
                        configCmd = new CoreConfig();
                        break;

                    case ConfigType.RechargeConfig:
                        configCmd = new RechargeConfig();
                        break;

                    case ConfigType.SkillConfig:
                        configCmd = new SkillConfig();
                        break;

                    case ConfigType.SkillParameterConfig:
                        configCmd = new SkillParameterConfig();
                        break;

                    case ConfigType.ExchangeConfig:
                        configCmd = new ExchangeConfig();
                        break;

                    case ConfigType.VegetableConfig:
                        configCmd = new VegetableConfig();
                        break;

                    case ConfigType.ChallengeLevelConfig:
                        configCmd = new ChallengeLevelConfig();
                        break;

                    case ConfigType.SkillIntroTextConfig:
                        configCmd = new SkillIntroTextConfig();
                        break;

                    case ConfigType.SkillLevelDetailTextConfig:
                        configCmd = new SkillLevelDetailTextConfig();
                        break;

                    case ConfigType.VegetableIntroTextConfig:
                        configCmd = new VegetableIntroTextConfig();
                        break;

                    case ConfigType.WaitHintTextConfig:
                        configCmd = new WaitHintTextConfig();
                        break;

                    case ConfigType.CharacterConfig:
                        configCmd = new CharacterConfig();
                        break;

                    case ConfigType.EquipConfig:
                        configCmd = new EquipConfig();
                        break;

                    case ConfigType.MajorLevelIntroTextConfig:
                        configCmd = new MajorLevelIntroTextConfig();
                        break;

                    case ConfigType.EquipIntroTextConfig:
                        configCmd = new EquipIntroTextConfig();
                        break;

                    case ConfigType.CharacterIntroTextConfig:
                        configCmd = new CharacterIntroTextConfig();
                        break;

                    case ConfigType.OAuthParamConfig:
                        configCmd = new OAuthParamConfig();
                        break;

                    default:
                        Debug.LogError("遇到新的ConfigType,需添加代码。type:" + configType);
                        break;
                    }
                    if (configCmd != null)
                    {
                        configCmd.ParseFrom(bytes);
                        SetConfig(configType, configCmd);
                    }
                }
            }
        }