Commit 82690ab4 authored by 神楽坂玲奈's avatar 神楽坂玲奈

mycard avatar

parent 1ff721b4
Pipeline #5294 passed with stages
in 7 minutes and 5 seconds
using System;
using System.Collections.Generic;
using DefaultNamespace;
using DG.Tweening;
using UnityEngine;
public class gameUIbutton
......@@ -338,18 +340,16 @@ public class gameInfo : MonoBehaviour
((float) Program.I().ocgcore.life_1 > 0 ? Program.I().ocgcore.life_1 : 0).ToString();
me.api_name.text = Program.I().ocgcore.name_0_c;
opponent.api_name.text = Program.I().ocgcore.name_1_c;
me.api_face.mainTexture = UIHelper.getFace(Program.I().ocgcore.name_0_c);
opponent.api_face.mainTexture = UIHelper.getFace(Program.I().ocgcore.name_1_c);
iTween.MoveToLocal(me.api_healthBar.gameObject, new Vector3(
MyCard.LoadAvatar(Program.I().ocgcore.name_0_c, texture => me.api_face.mainTexture = texture);
MyCard.LoadAvatar(Program.I().ocgcore.name_1_c, texture => opponent.api_face.mainTexture = texture);
me.api_healthBar.transform.DOLocalMoveX(
me.api_healthBar.width - getRealLife(Program.I().ocgcore.life_0) / Program.I().ocgcore.lpLimit *
me.api_healthBar.width,
me.api_healthBar.gameObject.transform.localPosition.y,
me.api_healthBar.gameObject.transform.localPosition.z), 1f);
iTween.MoveToLocal(opponent.api_healthBar.gameObject, new Vector3(
me.api_healthBar.width, 1f);
opponent.api_healthBar.transform.DOLocalMoveX(
opponent.api_healthBar.width - getRealLife(Program.I().ocgcore.life_1) / Program.I().ocgcore.lpLimit *
opponent.api_healthBar.width,
opponent.api_healthBar.gameObject.transform.localPosition.y,
opponent.api_healthBar.gameObject.transform.localPosition.z), 1f);
opponent.api_healthBar.width, 1f);
instance_lab.Clear();
if (Program.I().ocgcore.confirmedCards.Count > 0) instance_lab.Add(GameStringHelper.yijingqueren);
foreach (var item in Program.I().ocgcore.confirmedCards) instance_lab.Add(item);
......
using System;
using DefaultNamespace;
using UnityEngine;
public class lazyPlayer : MonoBehaviour
......@@ -55,7 +56,7 @@ public class lazyPlayer : MonoBehaviour
setIfMe(false);
SetNotNull(false);
SetIFcanKick(false);
setName("");
SetName("");
}
private void OnPrepClicked()
......@@ -126,18 +127,11 @@ public class lazyPlayer : MonoBehaviour
return mIfMe;
}
public void setName(string name_)
public void SetName(string name)
{
mName = name_;
UILabel_name.text = name_;
try
{
face.mainTexture = UIHelper.getFace(name_);
}
catch (Exception)
{
Debug.LogError("setName");
}
mName = name;
UILabel_name.text = name;
MyCard.LoadAvatar(name, texture => face.mainTexture = texture);
}
public string getName()
......
using System;
using UnityEngine;
using UnityEngine.Networking;
namespace DefaultNamespace
{
public class MyCard
{
public static void LoadAvatar(string username, Action<Texture2D> callback)
{
var request =
UnityWebRequestTexture.GetTexture($"https://sapi.moecube.com:444/accounts/users/{username}.png");
var operation = request.SendWebRequest();
operation.completed += _ =>
{
if (request.error != null)
{
Debug.LogWarning($"{request.url}: {request.error}");
return;
}
callback(((DownloadHandlerTexture) request.downloadHandler).texture);
};
}
}
}
\ No newline at end of file
fileFormatVersion: 2
guid: e23192c6a90f4880a6558e4dad535f94
timeCreated: 1630859585
\ No newline at end of file
......@@ -684,7 +684,7 @@ public class Room : WindowServantSP
else
{
realPlayers[i].SetNotNull(true);
realPlayers[i].setName(roomPlayers[i].name);
realPlayers[i].SetName(roomPlayers[i].name);
realPlayers[i].SetIFcanKick(is_host && i != selftype);
realPlayers[i].setIfMe(i == selftype);
realPlayers[i].setIfprepared(roomPlayers[i].prep);
......
using System;
using System.Collections.Generic;
using DefaultNamespace;
using DG.Tweening;
using UnityEngine;
using UnityEngine.Assertions;
......@@ -711,7 +712,8 @@ public class Servant
Program.I().ui_main_2d
);
UIHelper.InterGameObject(currentMSwindow);
UIHelper.getByName<UITexture>(currentMSwindow, "face_").mainTexture = UIHelper.getFace(name);
MyCard.LoadAvatar(name,
texture => UIHelper.getByName<UITexture>(currentMSwindow, "face_").mainTexture = texture);
UIHelper.registEvent(currentMSwindow, "yes_", ES_RMSpremono, new messageSystemValue());
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment