"use strict";
var __reflect = (this && this.__reflect) || function (p, c, t) {
    p.__class__ = c, t ? t.push(c) : t = [c], p.__types__ = p.__types__ ? t.concat(p.__types__) : t;
};
var __extends = this && this.__extends || function __extends(t, e) { 
 function r() { 
 this.constructor = t;
}
for (var i in e) e.hasOwnProperty(i) && (t[i] = e[i]);
r.prototype = e.prototype, t.prototype = new r();
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};
var __generator = (this && this.__generator) || function (thisArg, body) {
    var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
    return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
    function verb(n) { return function (v) { return step([n, v]); }; }
    function step(op) {
        if (f) throw new TypeError("Generator is already executing.");
        while (_) try {
            if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t;
            if (y = 0, t) op = [0, t.value];
            switch (op[0]) {
                case 0: case 1: t = op; break;
                case 4: _.label++; return { value: op[1], done: false };
                case 5: _.label++; y = op[1]; op = [0]; continue;
                case 7: op = _.ops.pop(); _.trys.pop(); continue;
                default:
                    if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
                    if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
                    if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
                    if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
                    if (t[2]) _.ops.pop();
                    _.trys.pop(); continue;
            }
            op = body.call(thisArg, _);
        } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
        if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
    }
};
Object.defineProperty(exports, "__esModule", { value: true });
var Panel_1 = require("../views/Panel");
// import { NetManager } from '../../libs/tw/manager/NetManager';
var DataManager_1 = require("../../libs/tw/manager/DataManager");
var DogShowItemComponent_1 = require("../components/DogShowItemComponent");
var NetName_1 = require("../../libs/tw/enum/NetName");
var DogShowPanel = (function (_super) {
    __extends(DogShowPanel, _super);
    function DogShowPanel(data) {
        var _this = _super.call(this, data) || this;
        _this.callback = data;
        _this.percentHeight = 100;
        _this.maxLv = DataManager_1.DataManager.ins.getData(NetName_1.NetName.GET_HOME).data.maxLevel;
        return _this;
    }
    Object.defineProperty(DogShowPanel.prototype, "skinKey", {
        get: function () { return 'DogShowPanel'; },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(DogShowPanel.prototype, "groupName", {
        get: function () { return 'dogShow_panel'; },
        enumerable: true,
        configurable: true
    });
    DogShowPanel.prototype.setShowAct = function () {
        this.alpha = 0;
        this.panelGroup.top = this.height;
        egret.Tween.get(this).to({ alpha: 1 }, 300);
        egret.Tween.get(this.panelGroup).to({ top: 330 }, 300, egret.Ease.cubicOut);
    };
    DogShowPanel.prototype.preLoadRes = function () {
        return __awaiter(this, void 0, void 0, function () {
            return __generator(this, function (_a) {
                return [2 /*return*/, new Promise(function (resolve, reject) {
                        resolve();
                    })];
            });
        });
    };
    DogShowPanel.prototype.onSkinComplete = function () {
        _super.prototype.onSkinComplete.call(this);
        this.once(egret.Event.ADDED_TO_STAGE, this.onLoad, this);
        if (this.stage) {
            this.onLoad();
        }
    };
    DogShowPanel.prototype.initEvents = function () {
        _super.prototype.initEvents.call(this);
    };
    DogShowPanel.prototype.onTap = function () {
        if (this.callback) {
            this.callback();
        }
        this.hidePanel();
    };
    DogShowPanel.prototype.removeEvents = function () {
        _super.prototype.removeEvents.call(this);
    };
    DogShowPanel.prototype.onLoad = function () {
        this.initData();
        this.initUI();
    };
    DogShowPanel.prototype.initUI = function () {
        var orgX = 50;
        var spaceX = 10;
        var spaceY = 10;
        for (var i = 0; i < 30; i++) {
            var dname = void 0;
            if (i < this.maxLv) {
                dname = 'dog_lv_' + (i + 1) + '_png';
            }
            else {
                dname = 'dog' + i + '_png';
            }
            var dItem = new DogShowItemComponent_1.DogShowItemComponent(i + 1, this.dogLvLists[i], dname, this.dogSizePos[i]);
            this.showListGroup.addChild(dItem);
            var xidx = (i + 1) % 3;
            var yidx = Math.floor((i + 1) / 3) - 1;
            if (xidx > 0) {
                yidx += 1;
            }
            if (xidx > 0) {
                xidx -= 1;
            }
            else {
                xidx = 2;
            }
            dItem.x = xidx * (211 + spaceX) + orgX;
            dItem.y = yidx * (250 + spaceY);
        }
    };
    DogShowPanel.prototype.initData = function () {
        this.dogSizePos = [
            [156, 126],
            [124, 145],
            [108, 148],
            [123, 152],
            [154, 152],
            [111, 152],
            [144, 143],
            [110, 147],
            [140, 163],
            [114, 162],
            [115, 156],
            [112, 148],
            [110, 149],
            [147, 143],
            [137, 144],
            [148, 152],
            [119, 163],
            [103, 154],
            [110, 153],
            [117, 160],
            [92, 160],
            [137, 158],
            [129, 158],
            [104, 156],
            [123, 156],
            [127, 171],
            [135, 151],
            [143, 157],
            [108, 156],
            [112, 156]
        ];
        this.dogLvLists = [
            "小奶狗",
            "小白狗",
            "小黑狗",
            "小狼狗",
            "金毛",
            "柯基",
            "柴犬",
            "博美",
            "泰迪",
            "巴哥犬",
            "比熊",
            "雪纳瑞",
            "秋田犬",
            "萨摩耶",
            "贵宾犬",
            "边境牧羊犬",
            "拉布拉多",
            "哈士奇",
            "吉娃娃",
            "法国斗牛犬",
            "牛头梗",
            "蝴蝶犬",
            "杜宾",
            "松狮",
            "茶杯犬",
            "苏格兰牧羊犬",
            "英国玩具犬",
            "迦南犬",
            "阿拉斯加雪橇犬",
            "阿富汗猎犬",
        ];
    };
    return DogShowPanel;
}(Panel_1.default));
exports.default = DogShowPanel;
__reflect(DogShowPanel.prototype, "\"c:/Users/duiba/Documents/kuwo/egret/src/dogShowPanel/DogShowPanel\".DogShowPanel");
//# sourceMappingURL=DogShowPanel.js.map